]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Optimise performance of job scheduling in QueryListening"
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 24 Jan 2020 21:41:56 +0000 (21:41 +0000)
committerGerrit Code Review <gerrit2@simantics>
Fri, 24 Jan 2020 21:41:56 +0000 (21:41 +0000)
14 files changed:
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/GraphDebugger.java
bundles/org.simantics.debug.ui/src/org/simantics/debug/ui/VariableDebugger.java
bundles/org.simantics.desktop.product/splash.svg
bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/PickRequest.java
bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/handler/impl/PickContextImpl.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/AssignSymbolGroupsDialog.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/Messages.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/WorkbenchMessages.java [deleted file]
bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/SCLOsgi.java
bundles/org.simantics.structural2/src/org/simantics/structural2/scl/procedural/CompileProceduralComponentTypeRequest.java
features/org.simantics.sdk.feature/feature.xml
releng/org.simantics.sdk.build.targetdefinition/simantics.target
releng/org.simantics.sdk.build.targetdefinition/simantics.tpd
releng/org.simantics.sdk.repository/pom.xml

index 46d31fabe50516ba107b7d38a7f78460119aab8b..559b0e70275fe9ce3430eabc5a68ccd662202621 100644 (file)
@@ -496,7 +496,7 @@ public class GraphDebugger extends Composite {
 
     public Browser createBrowser(Composite parent) {
         try {
-            browser = new Browser(parent, SWT.MOZILLA);
+            browser = new Browser(parent, SWT.WEBKIT);
         } catch (SWTError e) {
             //System.out.println("Could not instantiate Browser: " + e.getMessage());
             browser = new Browser(parent, SWT.NONE);
index 697a589395dae9eab29af679020ee53780d6b444..c1f47624d7fa6d542ec5a6a9d14135b33a47ebda 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2020 Association for Decentralized Information Management
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -65,7 +65,6 @@ import org.simantics.db.Session;
 import org.simantics.db.common.ResourceArray;
 import org.simantics.db.common.procedure.adapter.DisposableListener;
 import org.simantics.db.common.request.UnaryRead;
-import org.simantics.db.common.utils.Logger;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.layer0.SelectionHints;
 import org.simantics.db.layer0.request.PossibleURI;
@@ -90,6 +89,8 @@ import org.simantics.utils.bytes.Base64;
 import org.simantics.utils.ui.ErrorLogger;
 import org.simantics.utils.ui.ISelectionUtils;
 import org.simantics.utils.ui.PathUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -98,6 +99,8 @@ import org.simantics.utils.ui.PathUtils;
  */
 public class VariableDebugger extends Composite {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(VariableDebugger.class);
+
     public interface HistoryListener {
         void historyChanged();
     }
@@ -166,7 +169,7 @@ public class VariableDebugger extends Composite {
 
         @Override
         public void exception(Throwable t) {
-            Logger.defaultLogError(t);
+            LOGGER.error("Page content listener failed unexpectedly", t);
         }
     }
 
@@ -261,15 +264,16 @@ public class VariableDebugger extends Composite {
             @Override
             public void drop(DropTargetEvent event) {
                 label.setBackground(null);
+                String uri = null;
                 try {
-                    String uri = parseUri(event);
+                    uri = parseUri(event);
                     if (uri == null) {
                         event.detail = DND.DROP_NONE;
                         return;
                     }
                     changeLocation(uri);
                 } catch (DatabaseException e) {
-                    Logger.defaultLogError(e);
+                    LOGGER.error("Changing location to URI {} failed", uri, e);
                 }
             }
 
@@ -330,13 +334,14 @@ public class VariableDebugger extends Composite {
             @Override
             public void widgetSelected(SelectionEvent e) {
 
+                String uri = null;
                 try {
-                    String uri = text.getText();
+                    uri = text.getText();
                     // Make sure that URI is resolvable to Variable
                     session.sync(new ResourceURIToVariable(uri));
                     changeLocation(uri);
                 } catch (DatabaseException e1) {
-                    Logger.defaultLogError(e1);
+                    LOGGER.error("Lookup failed for URI {}", uri, e1);
                 }
 
             }
@@ -356,7 +361,7 @@ public class VariableDebugger extends Composite {
 
     public Browser createBrowser(Composite parent) {
         try {
-            browser = new Browser(parent, SWT.MOZILLA);
+            browser = new Browser(parent, SWT.NONE);
         } catch (SWTError e) {
             //System.out.println("Could not instantiate Browser: " + e.getMessage());
             browser = new Browser(parent, SWT.NONE);
@@ -594,9 +599,9 @@ public class VariableDebugger extends Composite {
             else return value != null ? getValue(graph, r, value) : "null"; //$NON-NLS-1$
         } catch (Throwable e) {
             try {
-                Logger.defaultLogError("getValue " + r.getURI(graph), e); //$NON-NLS-1$
+                LOGGER.error("getValue({})", r.getURI(graph), e); //$NON-NLS-1$
             } catch (DatabaseException e1) {
-                Logger.defaultLogError(e1);
+                LOGGER.error("Failed to get URI for problematic value variable", e1);
             }
             return e.getMessage();
         }
@@ -634,7 +639,7 @@ public class VariableDebugger extends Composite {
             String encoded = Base64.encode(uri.getBytes(utf8));
             return encoded;
         } catch (Exception e) {
-            Logger.defaultLogError(e);
+            LOGGER.error("Failed to construct link string for variable", e); //$NON-NLS-1$
             return e.getMessage();
         }
     }
@@ -681,11 +686,11 @@ public class VariableDebugger extends Composite {
             String rviString = getRVIString(graph, var);
             Object node = null;
             if(var instanceof AbstractChildVariable) {
-                VariableNode vn = ((AbstractChildVariable)var).node; 
+                VariableNode<?> vn = ((AbstractChildVariable)var).node; 
                 if(vn != null) node = vn.node;
             }
             if(var instanceof AbstractPropertyVariable) {
-                VariableNode vn = ((AbstractPropertyVariable)var).node;
+                VariableNode<?> vn = ((AbstractPropertyVariable)var).node;
                 if(vn != null) node = vn.node;
             }
             
index 8d7aa725ba647ade5b4a33d02ebf8fb6c6f399fc..b984365f40d85a93433ea14337e4587b7e79e96d 100644 (file)
          id="tspan6235"
          x="4.0821486"
          y="291.79337"
-         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.6444446px;font-family:'Cascadia Code';-inkscape-font-specification:'Cascadia Code, Normal';fill:#ffffff;fill-opacity:1;stroke-width:0.26458335px;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;">1.42.0</tspan></text>
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.6444446px;font-family:'Cascadia Code';-inkscape-font-specification:'Cascadia Code, Normal';fill:#ffffff;fill-opacity:1;stroke-width:0.26458335px;text-anchor:start;text-align:start;writing-mode:lr;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;">1.43.0</tspan></text>
     <circle
        style="opacity:0.92900002;fill:#5d6b91;fill-opacity:1;stroke:none;stroke-width:1.27400005;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter6809)"
        id="path6231"
index 912e79cd9ce3e8caec89606ba61c495e797c0923..8d9d814d8eeb3c5599a08a4113e380752a1863b6 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2020 Association for Decentralized Information Management
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *     VTT Technical Research Centre of Finland - initial API and implementation
+ *     Semantum Oy - gitlab #454
  *******************************************************************************/
 package org.simantics.g2d.diagram.handler;
 
@@ -143,8 +144,33 @@ public class PickRequest {
     }
 
     public static interface PickSorter {
+        /**
+         * Sorts the specified element list.
+         * 
+         * @param elements the element list to sort
+         */
         void sort(List<IElement> elements);
 
+        /**
+         * Extended interface-method that receives the pick request in addition to the
+         * picked elements to be sorted. Allows e.g. looking at the pick area in the
+         * sorter.
+         * 
+         * <p>
+         * The default implementation just invokes {@link #sort(List)} ignoring the pick
+         * request. The default implementation also keeps PickSorter API/ABI-compatible.
+         * 
+         * @param request  the original pick request that produced the hits listed in
+         *                 <code>elements</code>
+         * @param elements the element list to sort
+         * 
+         * @author Tuukka Lehtonen
+         * @since 1.43.0, 1.35.3
+         */
+        default void sort(PickRequest request, List<IElement> elements) {
+            sort(elements);
+        }
+
         //
         public static final PickSorter CONNECTIONS_LAST = new PickSorter() {
             @Override
@@ -204,12 +230,8 @@ public class PickRequest {
                     }
                     return minDistanceSq;
                 }
-                
-                @Override
-                public void sort(List<IElement> elements) {
-                    if (sorter != null)
-                        sorter.sort(elements);
 
+                private void sortConnections(List<IElement> elements) {
                     List<Pair<Double, IElement>> connections = new ArrayList<>(elements.size());
                     int tail = 0;
                     for (int i = 0; i < elements.size(); i++) {
@@ -217,7 +239,7 @@ public class PickRequest {
                         RouteGraphNode rgn = element.getHint(RouteGraphConnectionClass.KEY_RG_NODE);
                         if (rgn != null) {
                             double distanceSq = getDistanceSqToRouteGraphConnection(rgn, x, y);
-                            connections.add(new Pair<Double, IElement>(distanceSq, element));
+                            connections.add(Pair.make(distanceSq, element));
                         }
                         
                         if (rgn == null || i == elements.size() - 1) {
@@ -236,6 +258,20 @@ public class PickRequest {
                         }
                     }
                 }
+
+                @Override
+                public void sort(PickRequest request, List<IElement> elements) {
+                    if (sorter != null)
+                        sorter.sort(request, elements);
+                    sortConnections(elements);
+                }
+
+                @Override
+                public void sort(List<IElement> elements) {
+                    if (sorter != null)
+                        sorter.sort(elements);
+                    sortConnections(elements);
+                }
             }; 
         }
     }
index 6a77af9b80e0cb0463abe78f5d8e0962f9b66c2a..5d42cebb8970273841cdac2488f2fdf200a9e357 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2018 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2020 Association for Decentralized Information Management
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -8,7 +8,7 @@
  *
  * Contributors:
  *     VTT Technical Research Centre of Finland - initial API and implementation
- *     Semantum Oy - gitlab #66 - parallel/spatial optimization
+ *     Semantum Oy - gitlab #60, #454 - parallel/spatial optimization
  *******************************************************************************/
 package org.simantics.g2d.diagram.handler.impl;
 
@@ -97,7 +97,7 @@ public class PickContextImpl implements PickContext {
                if (!result.isEmpty()) {
                        if (request.pickSorter != null) {
                                List<IElement> elems = new ArrayList<>(result);
-                               request.pickSorter.sort(elems);
+                               request.pickSorter.sort(request, elems);
                                finalResult.addAll(elems);
                        } else {
                                finalResult.addAll(result);
index a85c35628fb1a69252eed0359ed3ae7c7fdb8c7c..2af1510945b05e1958d4406e270d1fe9bcf05c7c 100644 (file)
@@ -135,7 +135,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog {
         Label label = new Label(buttonComposite, SWT.NONE);
 
         Button newButton = createButton(buttonComposite,
-                IDialogConstants.INTERNAL_ID-1, org.simantics.modeling.ui.actions.WorkbenchMessages.AssignSymbolGroupsDialog_New, false);
+                IDialogConstants.INTERNAL_ID-1, org.simantics.modeling.ui.actions.Messages.AssignSymbolGroupsDialog_New, false);
 
         listener = new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
@@ -145,7 +145,7 @@ public abstract class AssignSymbolGroupsDialog extends SelectionDialog {
         newButton.addSelectionListener(listener);
 
         Button removeButton = createButton(buttonComposite,
-                IDialogConstants.INTERNAL_ID-2, org.simantics.modeling.ui.actions.WorkbenchMessages.AssignSymbolGroupsDialog_Remove, false);
+                IDialogConstants.INTERNAL_ID-2, org.simantics.modeling.ui.actions.Messages.AssignSymbolGroupsDialog_Remove, false);
 
         listener = new SelectionAdapter() {
             public void widgetSelected(SelectionEvent e) {
index 2039c105b6b82a33de2a2b5c4e30c6540afb80de..6c45308a68fa10522df94dae50beb4194d9df3de 100644 (file)
@@ -16,6 +16,8 @@ public class Messages extends NLS {
        public static String AssignSymbolGroup_SelectSymbolGroupsTheSelectedSymbolsAreShownIn;
        public static String AssignSymbolGroup_SymbolGroupAssignments;
        public static String AssignSymbolGroup_WriteSymbolGroupName;
+       public static String AssignSymbolGroupsDialog_New;
+       public static String AssignSymbolGroupsDialog_Remove;
        public static String CompilePGraphsAction_CompilePGraphs;
        public static String CompilePGraphsAction_Continue;
        public static String CompilePGraphsAction_FollowingIssuesFound;
diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/WorkbenchMessages.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/actions/WorkbenchMessages.java
deleted file mode 100644 (file)
index 24e7b8a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.simantics.modeling.ui.actions;
-
-import org.eclipse.osgi.util.NLS;
-
-public class WorkbenchMessages extends NLS {
-       private static final String BUNDLE_NAME = "org.simantics.modeling.ui.actions.messages"; //$NON-NLS-1$
-       public static String AssignSymbolGroupsDialog_New;
-       public static String AssignSymbolGroupsDialog_Remove;
-       static {
-               // initialize resource bundle
-               NLS.initializeMessages(BUNDLE_NAME, WorkbenchMessages.class);
-       }
-
-       private WorkbenchMessages() {
-       }
-}
index 2e717f945780574f71c3382c33cb3bf157fa55e2..90876bbdf229747a06e400e15fe35c441677f2a1 100644 (file)
@@ -13,12 +13,16 @@ import org.simantics.scl.compiler.testing.repository.TestRepository;
 import org.simantics.scl.osgi.internal.Activator;
 import org.simantics.scl.osgi.internal.ServiceBasedModuleSourceRepository;
 import org.simantics.scl.osgi.internal.ServiceBasedTestRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import gnu.trove.procedure.TObjectProcedure;
 
 
 public class SCLOsgi {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(SCLOsgi.class);
+
     private SCLOsgi() {}
     
     public static ModuleSourceRepository SOURCE_REPOSITORY = new ServiceBasedModuleSourceRepository(Activator.getContext());
@@ -38,21 +42,19 @@ public class SCLOsgi {
             }
         });
     }
-    
+
     public static String compileAllModules() {
         ArrayList<String> modulesWithErrors = new ArrayList<String>(); 
         SCLOsgi.SOURCE_REPOSITORY.forAllModules(new TObjectProcedure<String>() {
             @Override
             public boolean execute(String moduleName) {
-                System.out.print(moduleName);
-                System.out.print(" - ");
                 Failable<Module> module = SCLOsgi.MODULE_REPOSITORY.getModule(moduleName);
                 if(module.didSucceed())
-                    System.out.println("succeeded");
+                    LOGGER.trace("{} - {}", moduleName, "succeeded");
                 else if(module == DoesNotExist.INSTANCE)
-                    System.out.println("does not exist"); // should not happen
+                    LOGGER.trace("{} - {}", moduleName, "does not exist"); // should not happen
                 else {
-                    System.out.println("error");
+                    LOGGER.trace("{} - {}", moduleName, "error");
                     modulesWithErrors.add(moduleName);
                 }
                 return true;
index 871dc1975c7a70295ced2b5cf800e51cf0496429..3a4801078664ae5539556436bbb1664f936cb828 100644 (file)
@@ -58,6 +58,10 @@ public class CompileProceduralComponentTypeRequest extends AbstractExpressionCom
         }
     }
 
+    public static Function1<Variable, Object> compile(ReadGraph graph, Resource componentType) throws DatabaseException {
+        return graph.syncRequest(new CompileProceduralComponentTypeRequest(componentType), TransientCacheListener.instance());
+    }
+    
     @Override
     protected String getExpressionText(ReadGraph graph)
             throws DatabaseException {
index cd214cf610b6f850dce1e8938ecca73bfca68638..0d0bc2f072e0231669ed8825444bc6a31fe5c466 100644 (file)
@@ -13,7 +13,7 @@
 <feature
       id="org.simantics.sdk"
       label="Simantics SDK"
-      version="1.42.0.qualifier"
+      version="1.43.0.qualifier"
       provider-name="VTT Technical Research Centre of Finland">
 
    <description url="http://www.example.com/description">
index f35f163feeb98878c28f6fa0d1113d4616bc5aa2..67ce332010243ffbdff1829b94ef343059e7a71c 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <?pde?>
 <!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="Simantics 1.42.0" sequenceNumber="1579509507">
+<target name="Simantics 1.43.0" sequenceNumber="1579509507">
   <locations>
     <location includeMode="slicer" includeAllPlatforms="true" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
       <unit id="com.google.guava" version="21.0.0.v20170206-1425"/>
index ddb3a17027edae11375c639250332830f7c7c8dd..1d7588e2646b56ca377c9298075f73ba27df56c0 100644 (file)
@@ -1,4 +1,4 @@
-target "Simantics 1.42.0"
+target "Simantics 1.43.0"
 
 with source allEnvironments
 
index 6ca55771e564ada07f5db82f533451947740dfbc..c636acba4307532b65fe7b27c1adab3b082ec48b 100644 (file)
@@ -2,7 +2,7 @@
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <artifactId>org.simantics.sdk.repository</artifactId>
-       <version>1.42.0-SNAPSHOT</version>
+       <version>1.43.0-SNAPSHOT</version>
        <packaging>eclipse-repository</packaging>
 
        <parent>