From: Tuukka Lehtonen Date: Thu, 16 Apr 2020 13:46:58 +0000 (+0000) Subject: Merge "Improvements to styling of connection lines" X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=b41d9e01fd8e7a2c2d89252db91caab753ac3278;hp=e3f46ffc9d4a6930adc83ebb8e6730f19708cc94 Merge "Improvements to styling of connection lines" --- diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/UndoMetadata.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/UndoMetadata.java index f8026f594..0568b3103 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/UndoMetadata.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/UndoMetadata.java @@ -116,4 +116,11 @@ public class UndoMetadata extends ACommentMetadata { public String getHeader() { return getType() + getRange(); } + + /** + * Returns true when no change sets are included. + */ + public boolean isEmpty() { + return begin == 0 && end == 0; + } } diff --git a/bundles/org.simantics.excel/SimanticsExcel_64.dll b/bundles/org.simantics.excel/SimanticsExcel_64.dll new file mode 100644 index 000000000..9be7f04fe Binary files /dev/null and b/bundles/org.simantics.excel/SimanticsExcel_64.dll differ diff --git a/bundles/org.simantics.excel/build.properties b/bundles/org.simantics.excel/build.properties index 9a56e9b7e..4f7390681 100644 --- a/bundles/org.simantics.excel/build.properties +++ b/bundles/org.simantics.excel/build.properties @@ -13,4 +13,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - SimanticsExcel.dll + SimanticsExcel.dll,\ + scl/ diff --git a/bundles/org.simantics.excel/native/Interface.cpp b/bundles/org.simantics.excel/native/Interface.cpp index 46f894c63..9e67f4aa8 100644 --- a/bundles/org.simantics.excel/native/Interface.cpp +++ b/bundles/org.simantics.excel/native/Interface.cpp @@ -1,31 +1,21 @@ -//#include "stdafx.h" - -//#ifndef _UNICODE -//#define _UNICODE -//#endif - #include #include -//#include -//#include +#include +#include +#include +#include using namespace std; -#import "c:/program files (x86)/common files/microsoft shared/office12/mso.dll" \ - rename( "RGB", "MSORGB" ) - -using namespace Office; - -#import "c:/program files (x86)/common files/microsoft shared/vba/vba6/vbe6ext.olb" \ - -using namespace VBIDE; +// mso.dll +#import "libid:{2df8d04c-5bfa-101b-bde5-00aa0044de52}" auto_rename +// vb6ext.olb +#import "libid:{0002e157-0000-0000-c000-000000000046}" auto_rename +// excel.exe +#import "libid:{00020813-0000-0000-c000-000000000046}" auto_rename -#import "c:/program files (x86)/microsoft office/office12/excel.exe" \ - rename( "DialogBox", "ExcelDialogBox" ) \ - rename( "RGB", "ExcelRGB" ) \ - rename( "CopyFile", "ExcelCopyFile" ) \ - rename( "ReplaceText", "ExcelReplaceText" ) +using namespace Excel; #include "jni2.h" @@ -34,10 +24,10 @@ using namespace VBIDE; #define SIMANTICS_DEBUG(...) -using namespace std; -using namespace Excel; +//using namespace std; +//using namespace Office; -map handles; +map handles; static int handleCounter = 1; void replace(std::string &s, const std::string &s1, const std::string &s2) { @@ -464,7 +454,7 @@ JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_close(JNIEnv *env, jobject } -/** + JNIEXPORT jdouble JNICALL Java_org_simantics_excel_Excel_getDouble(JNIEnv *env, jobject, jint handle, jint row, jint column) { SIMANTICS_DEBUG("getDouble(%d, %d)\r\n", row, column); @@ -489,7 +479,7 @@ JNIEXPORT jdouble JNICALL Java_org_simantics_excel_Excel_getDouble(JNIEnv *env, } JNIEXPORT jstring JNICALL Java_org_simantics_excel_Excel_getString(JNIEnv *env, jobject, jint handle, jint row, jint column) { - + USES_CONVERSION; //string val = getString(env, value); SIMANTICS_DEBUG("getString(%d, %d)\r\n", row, column); @@ -499,30 +489,30 @@ JNIEXPORT jstring JNICALL Java_org_simantics_excel_Excel_getString(JNIEnv *env, Excel::RangePtr range = sheet->Cells; if(!range) return NULL; - variant_t val = range->Item[row+1][column+1]; - if (val.vt != VT_NULL) { // val.vt seems to be always VT_DISPATCH. - try { + _bstr_t val = _bstr_t(range->Item[row + 1][column + 1]); + //if (val.vt != VT_NULL) { // val.vt seems to be always VT_DISPATCH. + //try { //this call will crash the application, if the cell is empty! - _bstr_t bstrt = val; - TCHAR text[1024]; + //_bstr_t bstrt = val; + //std::string text(val); + //CString text(val); + //text. + //TCHAR text[1024]; // TODO: this uses wide character (16-bit) while NewStringUTF expext regular character (8-bit), hence Java gets only the fisrt charater of the whole string. - _stprintf(text, _T("%s"), (LPCTSTR)bstrt); + //_stprintf(text, _T("%s"), (LPCTSTR)bstrt); //const char *text = bstrt; SIMANTICS_DEBUG("%s\r\n",text); - - // this code returns "??" for all cells. - //BSTR bstr = val.bstrVal; - //const char *text = _com_util::ConvertBSTRToString(bstr); - jstring ret = env->NewStringUTF((const char*)text); - delete[] text; - return ret; - } catch (...) { - return NULL; - } - } - SIMANTICS_DEBUG("%d\r\n",val.vt); - return NULL; + string text(val); + + + return env->NewStringUTF(text.c_str()); + + //} catch (...) { + // return NULL; + //} + //} + //SIMANTICS_DEBUG("%d\r\n",val.vt); + //return NULL; } -*/ \ No newline at end of file diff --git a/bundles/org.simantics.excel/native/SimanticsExcel.sln b/bundles/org.simantics.excel/native/SimanticsExcel.sln index 59c24ad34..bb04a663d 100644 --- a/bundles/org.simantics.excel/native/SimanticsExcel.sln +++ b/bundles/org.simantics.excel/native/SimanticsExcel.sln @@ -1,7 +1,9 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimanticsExcel", "SimanticsExcel.vcproj", "{E106958A-412F-4782-81CD-DF380D66BA6B}" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimanticsExcel", "SimanticsExcel.vcxproj", "{E106958A-412F-4782-81CD-DF380D66BA6B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,8 +13,8 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {E106958A-412F-4782-81CD-DF380D66BA6B}.Debug|Win32.ActiveCfg = Debug|Win32 {E106958A-412F-4782-81CD-DF380D66BA6B}.Debug|Win32.Build.0 = Debug|Win32 - {E106958A-412F-4782-81CD-DF380D66BA6B}.Release|Win32.ActiveCfg = Release|Win32 - {E106958A-412F-4782-81CD-DF380D66BA6B}.Release|Win32.Build.0 = Release|Win32 + {E106958A-412F-4782-81CD-DF380D66BA6B}.Release|Win32.ActiveCfg = Release|x64 + {E106958A-412F-4782-81CD-DF380D66BA6B}.Release|Win32.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/bundles/org.simantics.excel/native/SimanticsExcel.vcxproj b/bundles/org.simantics.excel/native/SimanticsExcel.vcxproj index 77b342183..67c676b43 100644 --- a/bundles/org.simantics.excel/native/SimanticsExcel.vcxproj +++ b/bundles/org.simantics.excel/native/SimanticsExcel.vcxproj @@ -1,14 +1,22 @@  - + Debug Win32 + + Debug + x64 + Release Win32 + + Release + x64 + {E106958A-412F-4782-81CD-DF380D66BA6B} @@ -18,12 +26,27 @@ DynamicLibrary + v120 + false + Unicode + true + + + DynamicLibrary + v120 false Unicode true DynamicLibrary + v120 + false + Unicode + + + DynamicLibrary + v120 false Unicode @@ -33,20 +56,38 @@ + + + + + + - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - false - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - false + <_ProjectFileVersion>12.0.30501.0 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + false + + + true + false + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + false + + + false + false @@ -60,8 +101,7 @@ EnableFastChecks MultiThreadedDebugDLL true - - + Level3 EditAndContinue @@ -78,7 +118,64 @@ MachineX86 + + + _DEBUG;%(PreprocessorDefinitions) + false + + + Disabled + WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + true + + + Level3 + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + LinkVerboseLib + .\SimanticsExcel.def + true + Windows + + + + NDEBUG;%(PreprocessorDefinitions) + false + + + MaxSpeed + true + WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + Level3 + ProgramDatabase + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + + + .\SimanticsExcel.def + true + Windows + true + true + MachineX86 + + + NDEBUG;%(PreprocessorDefinitions) false @@ -105,7 +202,6 @@ Windows true true - MachineX86 @@ -113,12 +209,11 @@ - - - + + @@ -127,6 +222,9 @@ + + + diff --git a/bundles/org.simantics.excel/native/jni2.h b/bundles/org.simantics.excel/native/jni2.h index d2c7715f0..ba3eeec8b 100644 --- a/bundles/org.simantics.excel/native/jni2.h +++ b/bundles/org.simantics.excel/native/jni2.h @@ -14,9 +14,8 @@ JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_setString(JNIEnv *env, job JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_setName(JNIEnv *env, jobject, jint handle, jint row, jint column, jstring value); JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_setVisible(JNIEnv *env, jobject, jint handle, jboolean value); JNIEXPORT jint JNICALL Java_org_simantics_excel_Excel_close(JNIEnv *env, jobject, jint handle); - -//JNIEXPORT jstring JNICALL Java_org_simantics_excel_Excel_getString(JNIEnv *env, jobject, jint handle, jint row, jint column); -//JNIEXPORT jdouble JNICALL Java_org_simantics_excel_Excel_getDouble(JNIEnv *env, jobject, jint handle, jint row, jint column); +JNIEXPORT jstring JNICALL Java_org_simantics_excel_Excel_getString(JNIEnv *env, jobject, jint handle, jint row, jint column); +JNIEXPORT jdouble JNICALL Java_org_simantics_excel_Excel_getDouble(JNIEnv *env, jobject, jint handle, jint row, jint column); #ifdef __cplusplus } diff --git a/bundles/org.simantics.excel/scl/Excel.scl b/bundles/org.simantics.excel/scl/Excel.scl new file mode 100644 index 000000000..4314025ed --- /dev/null +++ b/bundles/org.simantics.excel/scl/Excel.scl @@ -0,0 +1,19 @@ +importJava "org.simantics.excel.Excel" where + + data Excel + + @JavaName "getInstance" + excelInstance :: () -> Excel + + @JavaName "open2_" + openExcelSheet :: Excel -> String -> String -> Integer + @JavaName "close_" + closeExcelSheet :: Excel -> Integer -> () + @JavaName "setString_" + setExcelString :: Excel -> Integer -> Integer -> Integer -> String -> Integer + @JavaName "getString_" + getExcelString :: Excel -> Integer -> Integer -> Integer -> String + @JavaName "setDouble_" + setExcelDouble :: Excel -> Integer -> Integer -> Integer -> Double -> Integer + @JavaName "getDouble_" + getExcelDouble :: Excel -> Integer -> Integer -> Integer -> Double diff --git a/bundles/org.simantics.excel/src/org/simantics/excel/Excel.java b/bundles/org.simantics.excel/src/org/simantics/excel/Excel.java index bf7ddb5d5..d692206bd 100644 --- a/bundles/org.simantics.excel/src/org/simantics/excel/Excel.java +++ b/bundles/org.simantics.excel/src/org/simantics/excel/Excel.java @@ -45,6 +45,10 @@ public class Excel { private static Excel instance; + public static Excel getInstance() throws ExcelException { + return getInstance(System.out); + } + public static Excel getInstance(PrintStream out) throws ExcelException { if(instance == null) { @@ -89,11 +93,11 @@ public class Excel { File extractDir = context.getDataFile(""); if (extractDir == null) - throw new IOException("Bundle '" + Activator.PLUGIN_ID + " context has no file system support. Cannot extract server executables."); + throw new IOException("Bundle '" + Activator.PLUGIN_ID + " context has no file system support. Cannot extract DLLs."); if (!extractDir.exists()) if (!extractDir.mkdir()) - throw new IOException("Could not create directory '" + extractDir.getCanonicalPath() + "' for storing Balas solver data."); + throw new IOException("Could not create directory '" + extractDir.getCanonicalPath() + "' for communicating with Excel."); return extractDir; @@ -266,7 +270,7 @@ public class Excel { if (!extractDir.exists()) if (!extractDir.mkdir()) - throw new IOException("Could not create directory '" + extractDir.getCanonicalPath() + "' for storing Balas solver data."); + throw new IOException("Could not create directory '" + extractDir.getCanonicalPath() + "' for communicating with Excel."); String asd = ""; ExecEnvironment env = ExecEnvironment.calculate(); @@ -306,8 +310,8 @@ public class Excel { private native int setVisible(int handle, boolean value); private native int close(int handle); -// private native double getDouble(int handle, int row, int column); -// private native String getString(int handle, int row, int column); + private native double getDouble(int handle, int row, int column); + private native String getString(int handle, int row, int column); final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); @@ -331,6 +335,20 @@ public class Excel { }); } + public int open2_(final String fileName, final String sheetName) { + try { + return scheduler.submit(new Callable() { + @Override + public Integer call() throws Exception { + return Integer.parseInt(open(fileName, sheetName)); + } + }).get(); + } catch (Exception e) { + e.printStackTrace(); + return -1; + } + } + public String open_(final String fileName, final String sheetName) { try { return scheduler.submit(new Callable() { @@ -437,32 +455,32 @@ public class Excel { } } -// public double getDouble_(final int handle, final int row, final int column) { -// try { -// return scheduler.submit(new Callable() { -// @Override -// public Double call() throws Exception { -// return getDouble(handle, row, column); -// } -// }).get(); -// } catch (Exception e) { -// e.printStackTrace(); -// return Double.NaN; -// } -// } -// -// public String getString_(final int handle, final int row, final int column) { -// try { -// return scheduler.submit(new Callable() { -// @Override -// public String call() throws Exception { -// return getString(handle, row, column); -// } -// }).get(); -// } catch (Exception e) { -// e.printStackTrace(); -// return null; -// } -// } + public double getDouble_(final int handle, final int row, final int column) { + try { + return scheduler.submit(new Callable() { + @Override + public Double call() throws Exception { + return getDouble(handle, row, column); + } + }).get(); + } catch (Exception e) { + e.printStackTrace(); + return Double.NaN; + } + } + + public String getString_(final int handle, final int row, final int column) { + try { + return scheduler.submit(new Callable() { + @Override + public String call() throws Exception { + return getString(handle, row, column); + } + }).get(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } } diff --git a/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java index 095640c4a..5f8334398 100644 --- a/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java +++ b/bundles/org.simantics.structural.synchronization/src/org/simantics/structural/synchronization/base/SynchronizationEventHandlerBase.java @@ -56,6 +56,13 @@ public abstract class SynchronizationEventHandlerBase */ THashSet potentiallyUpdatedComponents = new THashSet<>(); + /** + * Is this potentially an undo/redo-related synchronization? + * + * Default is true for backwards compatibility. + */ + protected boolean isUndo = true; + public SynchronizationEventHandlerBase(Solver solver, ReferenceResolverBase resolver, SolverNameUtil nameUtil, ComponentFactory componentFactory, ModuleUpdaterFactoryBase moduleUpdaterFactory, MappingBase mapping) { this.solver = solver; @@ -66,6 +73,19 @@ public abstract class SynchronizationEventHandlerBase this.resolver = resolver; } + /** + * Mark the undo/redo status of this handler. + * + * Set 'isUndo' to false when processing a normal synchronization and true when + * processing an undo/redo. + * + * When 'isUndo' is false, loading of component solver state from the state undo context + * is skipped for added components. + */ + public void setAsUndo(boolean isUndo) { + this.isUndo = isUndo; + } + @Override public void beginSynchronization() { if(TRACE_EVENTS) { @@ -311,14 +331,16 @@ public abstract class SynchronizationEventHandlerBase else { component.attached = false; context.setModuleName(nameUtil.getFreshName(parentSolverComponentName, name)); - context.addPostUpdateAction(new Runnable() { - @Override - public void run() { - context.stateLoadedFromUndo = mapping.undoContext.loadState(solver, - context.component.componentId, - context.component.uid); - } - }); + if (isUndo) { + context.addPostUpdateAction(new Runnable() { + @Override + public void run() { + context.stateLoadedFromUndo = mapping.undoContext.loadState(solver, + context.component.componentId, + context.component.uid); + } + }); + } updater.create(context, properties, connections); solverComponentNameToComponent.put(context.getModuleName(), component); } diff --git a/releng/org.simantics.sdk.build.p2.site/pom.xml b/releng/org.simantics.sdk.build.p2.site/pom.xml index 9c3e9fae3..96acab029 100644 --- a/releng/org.simantics.sdk.build.p2.site/pom.xml +++ b/releng/org.simantics.sdk.build.p2.site/pom.xml @@ -26,7 +26,7 @@ 2.1.6.b0005 2.30.1 - 2.30.1.b0005 + 2.30.1.b0006 1.5.0 1.7.30 1.7.30 @@ -478,6 +478,7 @@ javax.annotation, javax.inject, + javax.servlet-api, jakarta.validation.jakarta.validation-api, jakarta.ws.rs-api, jakarta.xml.bind-api @@ -497,6 +498,7 @@ javax.annotation, javax.inject, + javax.servlet-api, jakarta.validation.jakarta.validation-api, jakarta.ws.rs-api, jakarta.xml.bind-api @@ -513,6 +515,7 @@ javax.annotation, javax.inject, + javax.servlet-api, jakarta.validation.jakarta.validation-api, jakarta.ws.rs-api, jakarta.xml.bind-api @@ -542,6 +545,7 @@ ${jersey.version.actual} jakarta.ws.rs-api, + javax.servlet-api, org.glassfish.jersey.core.jersey-server !javax.*,*;resolution:=optional @@ -559,6 +563,7 @@ javax.annotation, javax.inject, + javax.servlet-api, jakarta.validation.jakarta.validation-api, jakarta.ws.rs-api, jakarta.xml.bind-api @@ -575,6 +580,24 @@ javax.annotation, javax.inject, + javax.servlet-api, + jakarta.validation.jakarta.validation-api, + jakarta.ws.rs-api, + jakarta.xml.bind-api + + !javax.*,*;resolution:=optional + + + + org.glassfish.jersey.inject:jersey-hk2:${jersey.version} + true + true + + ${jersey.version.actual} + + javax.annotation, + javax.inject, + javax.servlet-api, jakarta.validation.jakarta.validation-api, jakarta.ws.rs-api, jakarta.xml.bind-api diff --git a/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.target b/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.target index 2386f897f..7f51cb1cd 100644 --- a/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.target +++ b/releng/org.simantics.sdk.build.targetdefinition/org.simantics.sdk.build.targetdefinition.target @@ -1,7 +1,7 @@ - + @@ -319,20 +319,20 @@ - - - - - - - - - - + + + + + + + + + + - - + + diff --git a/releng/org.simantics.sdk.build.targetdefinition/simantics.target b/releng/org.simantics.sdk.build.targetdefinition/simantics.target index ad1d836da..5ae6bcbde 100644 --- a/releng/org.simantics.sdk.build.targetdefinition/simantics.target +++ b/releng/org.simantics.sdk.build.targetdefinition/simantics.target @@ -1,7 +1,7 @@ - + @@ -319,20 +319,20 @@ - - - - - - - - - - + + + + + + + + + + - - + +