Sync git svn branch with SVN repository r33406. svn
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 6 Dec 2016 12:30:40 +0000 (14:30 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Tue, 6 Dec 2016 12:30:40 +0000 (14:30 +0200)
16 files changed:
bundles/org.simantics.charts/META-INF/MANIFEST.MF
bundles/org.simantics.charts/src/org/simantics/charts/editor/SubscriptionDropParticipant.java
bundles/org.simantics.charts/src/org/simantics/charts/internal/JsonUtils.java [new file with mode: 0644]
bundles/org.simantics.charts/src/org/simantics/charts/ui/AddVariableToChartAction.java
bundles/org.simantics.charts/src/org/simantics/charts/ui/ChartDropActionFactory.java
bundles/org.simantics.charts/src/org/simantics/charts/ui/SubscriptionDropActionFactory.java
bundles/org.simantics.diagram/src/org/simantics/diagram/profile/TextGridStyle.java
bundles/org.simantics.help.feature/.project [deleted file]
bundles/org.simantics.help.feature/build.properties [deleted file]
bundles/org.simantics.help.feature/feature.xml [deleted file]
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java
bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/utils/NodeUtil.java
bundles/org.simantics.trend/src/org/simantics/trend/impl/TrendNode.java
features/org.simantics.charts.feature/feature.xml
features/org.simantics.workbench.feature/build.properties
features/org.simantics.workbench.feature/root/SIMANTICS-README.mediawiki [deleted file]

index a0c30d5897775cbd0da4d80a4e6965e16c306351..bd0e1c59c02baf928dee52c9bd09963773a86ec4 100644 (file)
@@ -47,6 +47,7 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.e4.core.commands,
  org.eclipse.e4.ui.bindings;bundle-version="0.11.0",
  org.eclipse.e4.core.di.annotations,
- org.eclipse.e4.core.services
+ org.eclipse.e4.core.services,
+ com.fasterxml.jackson.core.jackson-core;bundle-version="2.5.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
index c410414d2276a3b2930a00d4938b5b2f6563a837..c41070934cbebe63344c49fbe8e640313bfdc6c5 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2016 Association for Decentralized Information Management in\r
  * Industry THTH ry.\r
  * All rights reserved. This program and the accompanying materials\r
  * are made available under the terms of the Eclipse Public License v1.0\r
@@ -8,9 +8,11 @@
  *\r
  * Contributors:\r
  *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *     Semantum Oy - JSON plain text input support\r
  *******************************************************************************/\r
 package org.simantics.charts.editor;\r
 \r
+import java.awt.datatransfer.DataFlavor;\r
 import java.awt.datatransfer.Transferable;\r
 import java.awt.datatransfer.UnsupportedFlavorException;\r
 import java.awt.dnd.DnDConstants;\r
@@ -18,13 +20,18 @@ import java.awt.dnd.DropTargetDragEvent;
 import java.awt.dnd.DropTargetDropEvent;\r
 import java.awt.dnd.DropTargetEvent;\r
 import java.io.IOException;\r
+import java.io.InputStream;\r
+import java.nio.charset.Charset;\r
 import java.util.ArrayList;\r
 import java.util.Collection;\r
 import java.util.Collections;\r
 import java.util.List;\r
+import java.util.Optional;\r
+import java.util.stream.Collectors;\r
 \r
 import org.eclipse.jface.viewers.ISelection;\r
 import org.simantics.Simantics;\r
+import org.simantics.charts.internal.JsonUtils;\r
 import org.simantics.charts.query.AddChartItem;\r
 import org.simantics.charts.query.ChartItemDescriptor;\r
 import org.simantics.charts.ui.AddVariableToChartAction;\r
@@ -33,7 +40,9 @@ import org.simantics.charts.ui.ChartVariable;
 import org.simantics.databoard.util.ObjectUtils;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
+import org.simantics.db.Session;\r
 import org.simantics.db.common.request.UnaryRead;\r
+import org.simantics.db.common.request.UniqueRead;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.SelectionHints;\r
 import org.simantics.db.layer0.request.PossibleModel;\r
@@ -41,7 +50,6 @@ import org.simantics.db.layer0.variable.RVI;
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.db.layer0.variable.VariableReference;\r
 import org.simantics.db.layer0.variable.Variables;\r
-import org.simantics.db.request.Read;\r
 import org.simantics.g2d.diagram.participant.AbstractDiagramParticipant;\r
 import org.simantics.g2d.dnd.DragItem;\r
 import org.simantics.g2d.dnd.IDnDContext;\r
@@ -54,6 +62,7 @@ import org.simantics.modeling.utils.VariableReferences;
 import org.simantics.ui.dnd.LocalObjectTransfer;\r
 import org.simantics.ui.dnd.LocalObjectTransferable;\r
 import org.simantics.ui.selection.WorkbenchSelectionElement;\r
+import org.simantics.utils.FileUtils;\r
 import org.simantics.utils.ui.ErrorLogger;\r
 import org.simantics.utils.ui.ISelectionUtils;\r
 import org.simantics.utils.ui.dialogs.ShowMessage;\r
@@ -88,12 +97,6 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
 \r
     @Override\r
     public void dragEnter(DropTargetDragEvent dtde, IDnDContext dp) {\r
-        // The transferable doesn't know LOT\r
-        if (!dtde.isDataFlavorSupported(LocalObjectTransferable.FLAVOR)) {\r
-            dtde.rejectDrag();\r
-            return;\r
-        }\r
-\r
         // The source cannot link, too bad\r
         if ((dtde.getSourceActions() & DnDConstants.ACTION_LINK) == 0) {\r
             dtde.rejectDrag();\r
@@ -101,26 +104,34 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
         }\r
 \r
         // Ensure the content is usable\r
+        if (dtde.isDataFlavorSupported(LocalObjectTransferable.FLAVOR)) {\r
+            dragEnterLocalObject(dtde, dp);\r
+        } else if (dtde.isDataFlavorSupported(DataFlavor.getTextPlainUnicodeFlavor())) {\r
+            dragEnterPlainText(dtde, dp);\r
+        } else {\r
+            dtde.rejectDrag();\r
+        }\r
+    }\r
+\r
+    private void dragEnterLocalObject(DropTargetDragEvent dtde, IDnDContext dp) {\r
         try {\r
-            Transferable t = dtde.getTransferable();\r
-            Object data = t.getTransferData(LocalObjectTransferable.FLAVOR);\r
+            Object data = dtde.getTransferable().getTransferData(LocalObjectTransferable.FLAVOR);\r
             data = LocalObjectTransfer.getTransfer().getObject();\r
 \r
-            List<IDragItem> items = new ArrayList<IDragItem>();\r
+            List<IDragItem> items = new ArrayList<>();\r
+            Session session = Simantics.getSession();\r
 \r
             final List<Resource> resources = ISelectionUtils.getPossibleKeys(data, SelectionHints.KEY_MAIN, Resource.class);\r
             if (!resources.isEmpty()) {\r
                 // Support SubscriptionItem drags\r
-                items.addAll( Simantics.getSession().syncRequest(new Read<List<IDragItem>>() {\r
+                items.addAll( session.syncRequest(new UniqueRead<List<IDragItem>>() {\r
                     @Override\r
                     public List<IDragItem> perform(ReadGraph graph) throws DatabaseException {\r
-                        List<IDragItem> result = new ArrayList<IDragItem>();\r
-                        //Layer0 L0 = Layer0.getInstance(graph);\r
+                        List<IDragItem> result = new ArrayList<>();\r
                         ModelingResources MOD = ModelingResources.getInstance(graph);\r
                         Resource targetModel = graph.syncRequest(new PossibleModel(container));\r
                         if (targetModel != null) {\r
                             for (Resource r : resources) {\r
-                               //System.out.println( graph.getPossibleRelatedValue(r, L0.HasName) );\r
                                 if (graph.isInstanceOf(r, MOD.Subscription_Item)) {\r
                                     Resource model = graph.syncRequest(new PossibleModel(r));\r
                                     if (ObjectUtils.objectEquals(targetModel, model))\r
@@ -135,7 +146,7 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
 \r
             if(data instanceof RVI) {\r
 \r
-                VariableReferenceDragItem vrdi = new VariableReferenceDragItem(Simantics.getSession().sync(new UnaryRead<RVI, VariableReference>((RVI)data) {\r
+                VariableReferenceDragItem vrdi = new VariableReferenceDragItem(session.sync(new UnaryRead<RVI, VariableReference>((RVI)data) {\r
                     @Override\r
                     public VariableReference perform(ReadGraph graph) throws DatabaseException {\r
                         return new VariableReference(parameter, Variables.getDatatype(graph, model, parameter), null);\r
@@ -150,7 +161,7 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
                 // 1st try Variable\r
                 final List<Variable> vars2 = ISelectionUtils.getPossibleKeys(data, SelectionHints.KEY_MAIN, Variable.class);\r
                 if (!vars2.isEmpty()) {\r
-                    varItems = Simantics.getSession().syncRequest( new Read<List<IDragItem>>() {\r
+                    varItems = session.syncRequest( new UniqueRead<List<IDragItem>>() {\r
                         @Override\r
                         public List<IDragItem> perform(ReadGraph graph) throws DatabaseException {\r
                             return toDragItems( graph.syncRequest(VariableReferences.variablesToReferences(model, vars2)) );\r
@@ -161,7 +172,7 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
                     // Try legacy PropertyVariables\r
                     final List<PropertyVariables> vars = ISelectionUtils.getPossibleKeys(data, SelectionHints.KEY_MAIN, PropertyVariables.class);\r
                     if (!vars.isEmpty()) {\r
-                        varItems = Simantics.getSession().syncRequest( new Read<List<IDragItem>>() {\r
+                        varItems = session.syncRequest( new UniqueRead<List<IDragItem>>() {\r
                             @Override\r
                             public List<IDragItem> perform(ReadGraph graph) throws DatabaseException {\r
                                 List<PropertyVariables> vars2 = PropertyVariablesImpl.resolve(graph, vars);\r
@@ -177,10 +188,10 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
                 if (data instanceof ISelection) {\r
                     final List<WorkbenchSelectionElement> wses = ISelectionUtils.filterSelection((ISelection)data, WorkbenchSelectionElement.class);\r
                     if (!wses.isEmpty()) {\r
-                        items.addAll( Simantics.getSession().syncRequest( new Read<List<IDragItem>>() {\r
+                        items.addAll( session.syncRequest( new UniqueRead<List<IDragItem>>() {\r
                             @Override\r
                             public List<IDragItem> perform(ReadGraph graph) throws DatabaseException {\r
-                                List<Variable> wsevars = new ArrayList<Variable>();\r
+                                List<Variable> wsevars = new ArrayList<>();\r
                                 ChartVariable av = new ChartVariable(graph);\r
                                 for(WorkbenchSelectionElement wse : wses) {\r
                                     Variable v = wse.getContent(av);\r
@@ -214,6 +225,40 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
         }\r
     }\r
 \r
+    private void dragEnterPlainText(DropTargetDragEvent dtde, IDnDContext dp) {\r
+        try {\r
+            DataFlavor flavor = DataFlavor.getTextPlainUnicodeFlavor();\r
+            String flavorCharset = flavor.getParameter("charset");\r
+            Transferable t = dtde.getTransferable();\r
+            InputStream in = (InputStream) t.getTransferData(flavor);\r
+            String data = FileUtils.getContents(in, Charset.forName(flavorCharset));\r
+\r
+            List<IDragItem> items = new ArrayList<>();\r
+            Session session = Simantics.getSession();\r
+            Optional<Variable> v = JsonUtils.tryParseJsonPropertyVariable(session, data);\r
+            if (v.isPresent()) {\r
+                items.addAll( toDragItems( session.syncRequest(VariableReferences.variablesToReferences(model, Collections.singletonList(v.get()))) ) );\r
+            }\r
+\r
+            if (items.isEmpty()) {\r
+                dtde.rejectDrag();\r
+            } else {\r
+                // Accept, make sure it is Link\r
+                for (IDragItem i : items)\r
+                    dp.add(i);\r
+                dtde.acceptDrag( DnDConstants.ACTION_LINK );\r
+            }\r
+        } catch (UnsupportedFlavorException e) {\r
+            throw new RuntimeException(e);\r
+        } catch (IOException e) {\r
+            ErrorLogger.defaultLogError(e);\r
+            dtde.rejectDrag();\r
+        } catch (DatabaseException e) {\r
+            ErrorLogger.defaultLogError(e);\r
+            dtde.rejectDrag();\r
+        }\r
+    }\r
+\r
     @Override\r
     public void dragExit(DropTargetEvent dte, IDnDContext dp) {\r
         for (IDragItem i : dp.getItemsByClass(SubscriptionItemDragItem.class))\r
@@ -228,30 +273,23 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
 \r
     @Override\r
     public void drop(DropTargetDropEvent dtde, IDnDContext dp) {\r
-       // Subscription Item\r
+        // Subscription Item\r
         Collection<SubscriptionItemDragItem> subs = dp.getItemsByClass(SubscriptionItemDragItem.class);\r
         if (!subs.isEmpty()) {\r
-            List<ChartItemDescriptor> cicr = new ArrayList<ChartItemDescriptor>();\r
-            for (SubscriptionItemDragItem sidi : subs) {\r
-                cicr.add(sidi.getObject());\r
-            }\r
-            ChartDropActionFactory.addPlots(container, cicr, Collections.<Resource>emptySet()).run();\r
+            ChartDropActionFactory.addPlots(container,\r
+                    subs.stream().map(DragItem::getObject).collect(Collectors.toList()),\r
+                    Collections.<Resource>emptySet()).run();\r
             dtde.dropComplete(true);\r
             return;\r
         }\r
-        \r
+\r
         // Variable Reference\r
         Collection<VariableReferenceDragItem> vrdis = dp.getItemsByClass(VariableReferenceDragItem.class);\r
         if (!vrdis.isEmpty()) {\r
-            List<VariableReference> refs = new ArrayList<VariableReference>();\r
-            for (VariableReferenceDragItem vrdi : vrdis) {\r
-                refs.add( vrdi.getObject() );\r
-            }\r
-            Resource chart = container;\r
             try {\r
-                AddVariableToChartAction a = new AddVariableToChartAction( chart, null, refs );\r
-                               a.init();\r
-                   a.run();\r
+                new AddVariableToChartAction( container, null,\r
+                        vrdis.stream().map(DragItem::getObject).collect(Collectors.toList()) )\r
+                .init().run();\r
                    dtde.dropComplete(true);\r
                        } catch (DatabaseException e) {\r
                                ShowMessage.showError(e.getClass().getName(), e.getMessage());\r
@@ -259,7 +297,7 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
                        }\r
             return;\r
         }\r
-        \r
+\r
         dtde.rejectDrop();\r
     }\r
 \r
@@ -274,14 +312,9 @@ public class SubscriptionDropParticipant extends AbstractDiagramParticipant impl
     }\r
 \r
     private static List<IDragItem> toDragItems(Collection<VariableReference> references) {\r
-        List<IDragItem> result = new ArrayList<IDragItem>(references.size());\r
-        for (VariableReference vr : references) {\r
-            VariableReferenceDragItem di = new VariableReferenceDragItem( vr );\r
-            result.add( di );\r
-        }\r
-        return result;\r
+        return references.stream().map(VariableReferenceDragItem::new).collect(Collectors.toList());\r
     }\r
-    \r
+\r
     @Override\r
     public double getPriority() {\r
        return 10.0;\r
diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/internal/JsonUtils.java b/bundles/org.simantics.charts/src/org/simantics/charts/internal/JsonUtils.java
new file mode 100644 (file)
index 0000000..31861ea
--- /dev/null
@@ -0,0 +1,71 @@
+package org.simantics.charts.internal;\r
+\r
+import java.io.IOException;\r
+import java.util.Optional;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.RequestProcessor;\r
+import org.simantics.db.common.request.UniqueRead;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+\r
+import com.fasterxml.jackson.core.JsonFactory;\r
+import com.fasterxml.jackson.core.JsonParser;\r
+import com.fasterxml.jackson.core.JsonToken;\r
+\r
+/**\r
+ * @author Tuukka Lehtonen\r
+ *\r
+ */\r
+public class JsonUtils {\r
+\r
+    public static Optional<Variable> tryParseJsonPropertyVariable(RequestProcessor processor, String json) throws DatabaseException {\r
+        return processor.syncRequest(new UniqueRead<Optional<Variable>>() {\r
+            @Override\r
+            public Optional<Variable> perform(ReadGraph graph) throws DatabaseException {\r
+                return tryParseJsonPropertyVariable(graph, json);\r
+            }\r
+        });\r
+    }\r
+\r
+    public static Optional<Variable> tryParseJsonPropertyVariable(ReadGraph graph, String json) throws DatabaseException {\r
+        try (JsonParser jp = new JsonFactory().createParser(json)) {\r
+            return JsonUtils.readPossibleVariable(graph, jp);\r
+        } catch (IOException e) {\r
+            throw new DatabaseException(e);\r
+        }\r
+    }\r
+\r
+    public static Optional<Variable> readPossibleVariable(ReadGraph graph, JsonParser jp) throws IOException, DatabaseException {\r
+        Optional<String> uri = readPossibleVariableUri(jp);\r
+        return uri.isPresent() ? Optional.ofNullable(Variables.getPossibleVariable(graph, uri.get())) : Optional.empty();\r
+    }\r
+\r
+    public static Optional<String> readPossibleVariableUri(JsonParser jp) throws IOException {\r
+        // Sanity check: verify that we got "Json Object":\r
+        if (jp.nextToken() != JsonToken.START_OBJECT)\r
+            throw new IOException("Expected data to start with an Object");\r
+\r
+        String uri = null;\r
+        String type = null;\r
+        String defaultPropertyUri = null;\r
+\r
+        while (jp.nextToken() != JsonToken.END_OBJECT) {\r
+            String fieldName = jp.getCurrentName();\r
+            jp.nextToken();\r
+            if (fieldName.equals("uri")) {\r
+                uri = jp.getValueAsString();\r
+            } else if (fieldName.equals("type")) {\r
+                type = jp.getValueAsString();\r
+            } else if (fieldName.equals("defaultPropertyUri")) {\r
+                defaultPropertyUri = jp.getValueAsString();\r
+            }\r
+        }\r
+\r
+        return Optional.ofNullable("Variable".equals(type) ?\r
+                defaultPropertyUri != null ? defaultPropertyUri : uri\r
+                        : null);\r
+    }\r
+\r
+}\r
index 994624a8b1169d82adc3b0589f2968539a578905..4caa80a66037275d2cb8a364075c185496b41901 100644 (file)
@@ -65,7 +65,7 @@ public class AddVariableToChartAction implements Runnable {
         * \r
         * @throws DatabaseException\r
         */\r
-       public void init() throws DatabaseException \r
+       public AddVariableToChartAction init() throws DatabaseException \r
        {\r
        Simantics.getSession().sync( new ReadRequest() {\r
                        @Override\r
@@ -73,6 +73,7 @@ public class AddVariableToChartAction implements Runnable {
                                init(g);\r
                        }\r
                } );\r
+       return this;\r
        }\r
 \r
        /**\r
@@ -80,7 +81,7 @@ public class AddVariableToChartAction implements Runnable {
         * \r
         * @throws DatabaseException\r
         */\r
-       public void init( ReadGraph g ) throws DatabaseException \r
+       public AddVariableToChartAction init( ReadGraph g ) throws DatabaseException \r
        {\r
        Layer0 L0 = Layer0.getInstance(g);\r
        if(chart != null) {\r
@@ -103,6 +104,8 @@ public class AddVariableToChartAction implements Runnable {
                                variableReferences.add( var.getVariableId().toPossibleString(g, configuration) );\r
                        }\r
                }\r
+\r
+               return this;\r
        }\r
        \r
        /**\r
index 648336b6770af0023b2818c9ce9e3ae3e8b0c22d..db93f33e42581d165b215b6663900d9aa8f0b190 100644 (file)
@@ -13,12 +13,16 @@ package org.simantics.charts.ui;
 \r
 import java.util.ArrayList;\r
 import java.util.Collection;\r
+import java.util.Collections;\r
 import java.util.HashSet;\r
 import java.util.List;\r
+import java.util.Optional;\r
 import java.util.Set;\r
+import java.util.stream.Collectors;\r
 \r
 import org.eclipse.jface.viewers.ISelection;\r
 import org.simantics.Simantics;\r
+import org.simantics.charts.internal.JsonUtils;\r
 import org.simantics.charts.ontology.ChartResource;\r
 import org.simantics.charts.query.AddChartItem;\r
 import org.simantics.charts.query.ChartItemDescriptor;\r
@@ -43,7 +47,6 @@ import org.simantics.modeling.PropertyVariablesImpl;
 import org.simantics.modeling.utils.VariableReferences;\r
 import org.simantics.trend.configuration.TrendItem.Renderer;\r
 import org.simantics.ui.selection.WorkbenchSelectionElement;\r
-import org.simantics.utils.datastructures.collections.CollectionUtils;\r
 import org.simantics.utils.ui.ErrorLogger;\r
 import org.simantics.utils.ui.ISelectionUtils;\r
 \r
@@ -62,71 +65,41 @@ public class ChartDropActionFactory implements DropActionFactory {
         if (targetModel == null) return null;\r
 \r
         if(source instanceof RVI) {\r
-\r
-               RVI rvi = (RVI)source;\r
-               List<VariableReference> refs = CollectionUtils.toList(new VariableReference(rvi, SubscriptionDropActionFactory.getDatatype(g, targetModel, rvi), null));\r
-               \r
-               AddVariableToChartAction a = new AddVariableToChartAction(chart, null, refs);\r
-               a.init(g);\r
-               return a;\r
-               \r
+            List<VariableReference> refs = Collections.singletonList(new VariableReference((RVI)source,\r
+                    SubscriptionDropActionFactory.getDatatype(g, targetModel, (RVI) source), null));\r
+            return new AddVariableToChartAction(chart, null, refs).init(g);\r
         }\r
-        \r
+\r
         List<PropertyVariables> vars = ISelectionUtils.getPossibleKeys(source, SelectionHints.KEY_MAIN, PropertyVariables.class);\r
         if (!vars.isEmpty()) {\r
             // FIXME: this is a hack for indexed value support\r
             vars = PropertyVariablesImpl.resolve(g, vars);\r
-            List<VariableReference> references2 = g.syncRequest(VariableReferences.toReferences(targetModel, vars));\r
-            List<VariableReference> references = new ArrayList<VariableReference>();\r
-            for (VariableReference ref : references2) {\r
-               if (ref.datatype instanceof BooleanType || ref.datatype instanceof NumberType) {\r
-                       references.add(ref);\r
-               }\r
-            }\r
-            \r
-               AddVariableToChartAction a = new AddVariableToChartAction(chart, null, references);\r
-               a.init(g);\r
-               return a;\r
+            List<VariableReference> references = toPropertyReferences(g, targetModel, vars);\r
+            if (!references.isEmpty())\r
+                return new AddVariableToChartAction(chart, null, references).init(g);\r
         }\r
-        final List<Variable> vars2 = ISelectionUtils.getPossibleKeys(source, SelectionHints.KEY_MAIN, Variable.class);\r
+\r
+        List<Variable> vars2 = ISelectionUtils.getPossibleKeys(source, SelectionHints.KEY_MAIN, Variable.class);\r
         if (!vars2.isEmpty()) {\r
-            // FIXME: this is a hack for indexed value support\r
-            List<VariableReference> references2 = g.syncRequest(VariableReferences.variablesToReferences(targetModel, vars2));\r
-            List<VariableReference> references = new ArrayList<VariableReference>();\r
-            for (VariableReference ref : references2) {\r
-                if (ref.datatype instanceof BooleanType || ref.datatype instanceof NumberType) {\r
-                    references.add(ref);\r
-                }\r
-            }\r
-            AddVariableToChartAction a = new AddVariableToChartAction(chart, null, references);\r
-            a.init(g);\r
-            return a;\r
+            List<VariableReference> references = toReferences(g, targetModel, vars2);\r
+            if (!references.isEmpty())\r
+                return new AddVariableToChartAction(chart, null, references).init(g);\r
         }\r
 \r
         if(source instanceof ISelection) {\r
             List<WorkbenchSelectionElement> wses = ISelectionUtils.filterSelection((ISelection)source, WorkbenchSelectionElement.class);\r
             if (!wses.isEmpty()) {\r
-                List<Variable> wsevars = new ArrayList<Variable>();\r
+                List<Variable> wsevars = new ArrayList<>();\r
                 ChartVariable av = new ChartVariable(g);\r
                 for(WorkbenchSelectionElement wse : wses) {\r
                     Variable v = wse.getContent(av);\r
-                    if(v != null) {\r
+                    if(v != null)\r
                         wsevars.add(v);\r
-                    }\r
                 }\r
 \r
+                List<VariableReference> references = toReferences(g, targetModel, wsevars);\r
                 if (!wsevars.isEmpty()) {\r
-                    // FIXME: this is a hack for indexed value support\r
-                    List<VariableReference> references2 = g.syncRequest(VariableReferences.variablesToReferences(targetModel, wsevars));\r
-                    List<VariableReference> references = new ArrayList<VariableReference>();\r
-                    for (VariableReference ref : references2) {\r
-                        if (ref.datatype instanceof BooleanType || ref.datatype instanceof NumberType) {\r
-                            references.add(ref);\r
-                        }\r
-                    }\r
-                    AddVariableToChartAction a = new AddVariableToChartAction(chart, null, references);\r
-                    a.init(g);\r
-                    return a;\r
+                    return new AddVariableToChartAction(chart, null, references).init(g);\r
                 }\r
             }\r
         }\r
@@ -158,22 +131,48 @@ public class ChartDropActionFactory implements DropActionFactory {
                 return addPlots(chart, newItems, movedPlots);\r
         }\r
 \r
+        if (source instanceof String) {\r
+            // JSON ?\r
+            Optional<Variable> v = JsonUtils.tryParseJsonPropertyVariable(g, (String) source);\r
+            if (v.isPresent()) {\r
+                List<VariableReference> references = toReferences(g, targetModel, Collections.singletonList(v.get()));\r
+                if (!references.isEmpty())\r
+                    return new AddVariableToChartAction(chart, null, references).init(g);\r
+            }\r
+        }\r
+\r
         return null;\r
     }\r
 \r
-    public static Runnable addPlots(final Resource chart, final List<ChartItemDescriptor> references, final Set<Resource> movedPlots) {\r
-        return new Runnable() {\r
-            @Override\r
-            public void run() {\r
-                Simantics.getSession().asyncRequest(\r
-                        AddChartItem.addAndMoveChartItems(chart, references, movedPlots),\r
-                        new ProcedureAdapter<Collection<Resource>>() {\r
-                            @Override\r
-                            public void exception(Throwable e) {\r
+    private static List<VariableReference> toReferences(ReadGraph graph, Resource contextIndexRoot, List<Variable> variables) throws DatabaseException {\r
+        if (variables.isEmpty())\r
+            return Collections.emptyList();\r
+        return filterReferences( graph.syncRequest(VariableReferences.variablesToReferences(contextIndexRoot, variables)) );\r
+    }\r
+\r
+    private static List<VariableReference> toPropertyReferences(ReadGraph graph, Resource contextIndexRoot, List<PropertyVariables> variables) throws DatabaseException {\r
+        if (variables.isEmpty())\r
+            return Collections.emptyList();\r
+        return filterReferences( graph.syncRequest(VariableReferences.toReferences(contextIndexRoot, variables)) );\r
+    }\r
+\r
+    private static List<VariableReference> filterReferences(List<VariableReference> variables) throws DatabaseException {\r
+        return variables.stream()\r
+                .filter(ref -> ref.datatype instanceof BooleanType || ref.datatype instanceof NumberType)\r
+                .collect(Collectors.toList());\r
+    }\r
+\r
+    public static Runnable addPlots(Resource chart, List<ChartItemDescriptor> references, Set<Resource> movedPlots) {\r
+        return () -> {\r
+            Simantics.getSession().asyncRequest(\r
+                    AddChartItem.addAndMoveChartItems(chart, references, movedPlots),\r
+                    new ProcedureAdapter<Collection<Resource>>() {\r
+                        @Override\r
+                        public void exception(Throwable e) {\r
+                            if (e != null)\r
                                 ErrorLogger.defaultLogError(e);\r
-                            }\r
-                        });\r
-            }\r
+                        }\r
+                    });\r
         };\r
     }\r
 \r
index fe865cb8d4cfa462207ad23505031080db967903..ee3975d9515975a7c4f514830d162260221a14ab 100644 (file)
@@ -14,10 +14,12 @@ package org.simantics.charts.ui;
 import java.util.Collections;\r
 import java.util.HashSet;\r
 import java.util.List;\r
+import java.util.Optional;\r
 import java.util.Set;\r
 \r
 import org.simantics.Simantics;\r
 import org.simantics.browsing.ui.common.ErrorLogger;\r
+import org.simantics.charts.internal.JsonUtils;\r
 import org.simantics.databoard.type.Datatype;\r
 import org.simantics.databoard.util.ObjectUtils;\r
 import org.simantics.db.ReadGraph;\r
@@ -38,8 +40,6 @@ import org.simantics.modeling.ModelingResources;
 import org.simantics.modeling.PropertyVariables;\r
 import org.simantics.modeling.PropertyVariablesImpl;\r
 import org.simantics.modeling.utils.VariableReferences;\r
-import org.simantics.utils.datastructures.Callback;\r
-import org.simantics.utils.datastructures.collections.CollectionUtils;\r
 import org.simantics.utils.ui.ISelectionUtils;\r
 \r
 /**\r
@@ -57,68 +57,64 @@ public class SubscriptionDropActionFactory implements DropActionFactory {
         Resource targetModel = g.syncRequest(new PossibleModel(subscription));\r
 \r
         if(source instanceof RVI) {\r
+            RVI rvi = (RVI)source;\r
+            List<VariableReference> refs = Collections.singletonList(new VariableReference(rvi, getDatatype(g, targetModel, rvi), null));\r
+            return addSubscriptions(g, subscription, refs, Collections.<Resource>emptySet());\r
+        }\r
 \r
-               RVI rvi = (RVI)source;\r
-               List<VariableReference> refs = CollectionUtils.toList(new VariableReference(rvi, getDatatype(g, targetModel, rvi), null));\r
-               if (!refs.isEmpty())\r
-                       return addSubscriptions(g, subscription, refs, Collections.<Resource>emptySet());\r
-               \r
+        List<PropertyVariables> vars = ISelectionUtils.getPossibleKeys(source, SelectionHints.KEY_MAIN, PropertyVariables.class);\r
+        if (!vars.isEmpty()) {\r
+            // FIXME: this is a hack for indexed value support\r
+            vars = PropertyVariablesImpl.resolve(g, vars);\r
+            List<VariableReference> references = g.syncRequest(VariableReferences.toReferences(targetModel, vars));\r
+            if (!references.isEmpty())\r
+                return addSubscriptions(g, subscription, references, Collections.<Resource>emptySet());\r
         } else {\r
-        \r
-               List<PropertyVariables> vars = ISelectionUtils.getPossibleKeys(source, SelectionHints.KEY_MAIN, PropertyVariables.class);\r
-               if (!vars.isEmpty()) {\r
-                       // FIXME: this is a hack for indexed value support\r
-                       vars = PropertyVariablesImpl.resolve(g, vars);\r
+            List<Resource> srcs = ISelectionUtils.getPossibleKeys(source, SelectionHints.KEY_MAIN, Resource.class);\r
+            ModelingResources MOD = ModelingResources.getInstance(g);\r
+            Set<Resource> movedItems = new HashSet<>();\r
+            for (Resource src : srcs) {\r
+                if (g.isInstanceOf(src, MOD.Subscription_Item)) {\r
+                    Resource model = g.syncRequest(new PossibleModel(src));\r
+                    if (ObjectUtils.objectEquals(targetModel, model))\r
+                        movedItems.add(src);\r
+                }\r
+            }\r
+            if (!movedItems.isEmpty())\r
+                return addSubscriptions(g, subscription, Collections.emptyList(), movedItems);\r
+        }\r
 \r
-                       List<VariableReference> references = g.syncRequest(VariableReferences.toReferences(targetModel, vars));\r
-                       if (!references.isEmpty())\r
-                               return addSubscriptions(g, subscription, references, Collections.<Resource>emptySet());\r
-               } else {\r
-                       List<Resource> srcs = ISelectionUtils.getPossibleKeys(source, SelectionHints.KEY_MAIN, Resource.class);\r
-                       ModelingResources MOD = ModelingResources.getInstance(g);\r
-                       Set<Resource> movedItems = new HashSet<Resource>();\r
-                       for (Resource src : srcs) {\r
-                               if (g.isInstanceOf(src, MOD.Subscription_Item)) {\r
-                                       Resource model = g.syncRequest(new PossibleModel(src));\r
-                                       if (ObjectUtils.objectEquals(targetModel, model))\r
-                                               movedItems.add(src);\r
-                               }\r
-                       }\r
-                       if (!movedItems.isEmpty())\r
-                               return addSubscriptions(g, subscription, Collections.<VariableReference>emptyList(), movedItems);\r
-               }\r
-        \r
+        if (source instanceof String) {\r
+            // JSON ?\r
+            Optional<Variable> v = JsonUtils.tryParseJsonPropertyVariable(g, (String) source);\r
+            if (v.isPresent()) {\r
+                List<VariableReference> references = g.syncRequest(VariableReferences.variablesToReferences(targetModel, Collections.singletonList(v.get())));\r
+                return addSubscriptions(g, subscription, references, Collections.emptySet());\r
+            }\r
         }\r
 \r
         return null;\r
     }\r
 \r
-    private Runnable addSubscriptions(ReadGraph graph, final Resource subscription, final List<VariableReference> references,\r
-            final Set<Resource> movedSubscriptionItems) throws DatabaseException {\r
-        final AddVariableToChartAction action = new AddVariableToChartAction(null, subscription, references);\r
-        action.init(graph);\r
-        return new Runnable() {\r
-            @Override\r
-            public void run() {\r
-                action.run();\r
-                if(!movedSubscriptionItems.isEmpty()) {\r
-                    Simantics.getSession().asyncRequest(new WriteRequest() {\r
-                        @Override\r
-                        public void perform(WriteGraph graph) throws DatabaseException {\r
-                            Layer0 L0 = Layer0.getInstance(graph);\r
-                            for (Resource item : movedSubscriptionItems) {\r
-                                graph.deny(item, L0.PartOf);\r
-                                graph.claim(subscription, L0.ConsistsOf, item);\r
-                            }\r
-                        }\r
-                    }, new Callback<DatabaseException>() {\r
-                        @Override\r
-                        public void run(DatabaseException e) {\r
-                            if (e != null)\r
-                                ErrorLogger.defaultLogError(e);\r
+    private Runnable addSubscriptions(ReadGraph graph, Resource subscription, List<VariableReference> references,\r
+            Set<Resource> movedSubscriptionItems) throws DatabaseException {\r
+        AddVariableToChartAction action = new AddVariableToChartAction(null, subscription, references).init(graph);\r
+        return () -> {\r
+            action.run();\r
+            if(!movedSubscriptionItems.isEmpty()) {\r
+                Simantics.getSession().asyncRequest(new WriteRequest() {\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        Layer0 L0 = Layer0.getInstance(graph);\r
+                        for (Resource item : movedSubscriptionItems) {\r
+                            graph.deny(item, L0.PartOf);\r
+                            graph.claim(subscription, L0.ConsistsOf, item);\r
                         }\r
-                    });\r
-                }\r
+                    }\r
+                }, e -> {\r
+                    if (e != null)\r
+                        ErrorLogger.defaultLogError(e);\r
+                });\r
             }\r
         };\r
     }\r
index 6657d5a60eca5856f3785cb4f77f07197dfa5c5a..cf3d217c9414a89650bb1200529db1bba54a58cf 100644 (file)
@@ -123,7 +123,7 @@ public abstract class TextGridStyle extends StyleBase<MonitorTextGridResult> {
                String name = getConfigurationComponentNameForElement(graph, element);\r
                if (name == null)\r
                        return null;\r
-               AffineTransform transform = DiagramGraphUtil.getAffineTransform(graph, element);\r
+               AffineTransform transform = DiagramGraphUtil.getDynamicAffineTransform(graph, runtimeDiagram, element);\r
                Vec2d offset = DiagramGraphUtil.getOffset(graph, element);\r
                boolean enabled = !DiagramGraphUtil.getProfileMonitorsHidden(graph, element);\r
                boolean up = DiagramGraphUtil.getProfileMonitorsUp(graph, element);\r
diff --git a/bundles/org.simantics.help.feature/.project b/bundles/org.simantics.help.feature/.project
deleted file mode 100644 (file)
index 5f32fab..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>org.simantics.help.feature</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>org.eclipse.pde.FeatureBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>org.eclipse.pde.FeatureNature</nature>\r
-       </natures>\r
-</projectDescription>\r
diff --git a/bundles/org.simantics.help.feature/build.properties b/bundles/org.simantics.help.feature/build.properties
deleted file mode 100644 (file)
index 0c85ae7..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################\r
-# Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
-# in Industry THTH ry.\r
-# All rights reserved. This program and the accompanying materials\r
-# are made available under the terms of the Eclipse Public License v1.0\r
-# which accompanies this distribution, and is available at\r
-# http://www.eclipse.org/legal/epl-v10.html\r
-#\r
-# Contributors:\r
-#     VTT Technical Research Centre of Finland - initial API and implementation\r
-###############################################################################\r
-bin.includes = feature.xml\r
diff --git a/bundles/org.simantics.help.feature/feature.xml b/bundles/org.simantics.help.feature/feature.xml
deleted file mode 100644 (file)
index 24eaf09..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--
-    Copyright (c) 2007, 2010 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
-    which accompanies this distribution, and is available at
-    http://www.eclipse.org/legal/epl-v10.html
-   
-    Contributors:
-        VTT Technical Research Centre of Finland - initial API and implementation
- -->\r
-<feature\r
-      id="org.simantics.help"\r
-      label="Simantics Help"\r
-      version="1.1.1.qualifier"\r
-      provider-name="VTT Technical Research Centre of Finland">\r
-\r
-   <description>\r
-      This feature gather together the parts of Eclipse SDK that are needed to use the Eclipse help system and cheat sheets.\r
-   </description>\r
-\r
-   <license url="http://www.eclipse.org/legal/epl-v10.html">\r
-      Licensed under Eclipse Public License (EPL) 1.0.\r
-   </license>\r
-\r
-   <plugin\r
-         id="org.eclipse.help"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.help.base"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.help.ui"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.apache.lucene.analysis"\r
-         download-size="887"\r
-         install-size="1772"\r
-         version="3.5.0.v20120725-1805"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.apache.lucene.core"\r
-         download-size="1513"\r
-         install-size="3048"\r
-         version="3.5.0.v20120725-1805"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.help.webapp"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.equinox.http.registry"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="javax.servlet"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="javax.servlet.jsp"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.equinox.jsp.jasper"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.equinox.jsp.jasper.registry"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.equinox.http.jetty"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.equinox.http.servlet"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.ui.cheatsheets"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="javax.el"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="com.sun.el"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.apache.commons.logging"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.apache.jasper.glassfish"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.jetty.continuation"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.jetty.http"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.jetty.io"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.jetty.security"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.jetty.server"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.jetty.servlet"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="org.eclipse.jetty.util"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-   <plugin\r
-         id="winterwell.markdown"\r
-         download-size="0"\r
-         install-size="0"\r
-         version="0.0.0"\r
-         unpack="false"/>\r
-\r
-</feature>\r
index 42c489e24d4b866d310507cf7d1d00d4cc1508cf..27e58b5d1b832a042504a9cf945ae15f13150510 100644 (file)
@@ -65,6 +65,7 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider {
 \r
                             DiagramResource DIA = DiagramResource.getInstance(graph);\r
                             ModelingResources MOD = ModelingResources.getInstance(graph);\r
+                            Layer0 L0 = Layer0.getInstance(graph);\r
 \r
                             String uri = graph.getPossibleRelatedValue(resource, DIA.RuntimeDiagram_HasVariable);\r
                             if (uri == null)\r
@@ -76,6 +77,11 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider {
 \r
                             Resource config = graph.getPossibleObject(resource2, MOD.ElementToComponent);\r
                             if (config == null) {\r
+                                if (graph.isInstanceOf(resource2, DIA.Connection)) {\r
+                                    Variable v = FlagUtil.getPossibleConnectionSignal(graph, var, resource2, L0.Entity);\r
+                                    if (v != null)\r
+                                        return v;\r
+                                }\r
                                 // Apros #9646: if resource2 is the diagram\r
                                 // itself, return the diagram composite variable\r
                                 // since it is generally more useful than the\r
@@ -87,7 +93,6 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider {
                                 }\r
                                 \r
                                 if(graph.isInstanceOf(resource2, DIA.Flag)) {\r
-                                       Layer0 L0 = Layer0.getInstance(graph);\r
                                        Variable signal = FlagUtil.getPossibleFlagSignal(graph, var, resource2, L0.Entity);\r
                                        if(signal != null)\r
                                                return signal;\r
index fb2f485f6b5935cc9166a59d9728fbaafd244458..727b98dbc2295eb499a7aad5fee14d5339db1f87 100644 (file)
@@ -978,9 +978,14 @@ public final class NodeUtil {
         if(node instanceof ConnectionNode) {\r
             return getLocalBounds(node);\r
         } else if(node instanceof SingleElementNode) {\r
+            // For normal symbols\r
             INode image = NodeUtil.findChildByPrefix((SingleElementNode)node, "composite_image");\r
             if (image == null)\r
+                // For generic text nodes\r
                 image = NodeUtil.findChildByPrefix((SingleElementNode) node, "text");\r
+            if (image == null)\r
+                // For I/O table diagram flags (value of org.simantics.diagram.flag.FlagSceneGraph.VISUAL_ROOT)\r
+                image = NodeUtil.findChildByPrefix((SingleElementNode) node, "visual");\r
             if (image == null)\r
                 image = NodeUtil.getNearestChildByClass((SingleElementNode) node, FlagNode.class);\r
             if (image != null)\r
index 1d19e2f1775c1df298d31fa864a02ac3c1be4242..dba76ccad2afdc13565cdc1412a62ab20a358883 100644 (file)
@@ -60,7 +60,6 @@ import org.simantics.utils.format.ValueFormat;
 \r
 import gnu.trove.map.TObjectIntMap;\r
 import gnu.trove.map.hash.TObjectIntHashMap;\r
-import gnu.trove.procedure.TIntProcedure;\r
 import gnu.trove.procedure.TObjectProcedure;\r
 \r
 public class TrendNode extends G2DParentNode implements TrendLayout {\r
@@ -276,7 +275,6 @@ public class TrendNode extends G2DParentNode implements TrendLayout {
 \r
                TObjectIntMap<String> newItemMap = itemIndexMap(newSpec.items);\r
                TObjectIntMap<String> currentItemMap = itemIndexMap(spec.items);\r
-               TObjectIntMap<String> addedItemMap = subtract(newItemMap, currentItemMap);\r
                TObjectIntMap<String> removedItemMap = subtract(currentItemMap, newItemMap);\r
                Map<String, VertRuler> existingRulers = new HashMap<>();\r
                if (this.spec.axisMode == YAxisMode.MultiAxis) {\r
@@ -347,6 +345,9 @@ public class TrendNode extends G2DParentNode implements TrendLayout {
                                for (int i=0; i<analogItems.size(); i++)\r
                                        vertRulers.add( addNode(VertRuler.class) );\r
                        } else {\r
+                               // Remove rulers of the items that were removed\r
+                               // and add new rulers to have enough of them for\r
+                               // each separate analog signal.\r
                                removedItemMap.forEachKey(new TObjectProcedure<String>() {\r
                                        @Override\r
                                        public boolean execute(String id) {\r
@@ -358,13 +359,10 @@ public class TrendNode extends G2DParentNode implements TrendLayout {
                                                return true;\r
                                        }\r
                                });\r
-                               addedItemMap.forEachValue(new TIntProcedure() {\r
-                                       @Override\r
-                                       public boolean execute(int index) {\r
-                                               vertRulers.add( index, addNode(VertRuler.class) );\r
-                                               return true;\r
-                                       }\r
-                               });\r
+                               for (int i = vertRulers.size(); i < analogItems.size(); ++i) {\r
+                                       VertRuler ruler = addNode(VertRuler.class);\r
+                                       vertRulers.add(ruler);\r
+                               }\r
                        }\r
 \r
                        for (int i = 0; i < analogItems.size(); i++) {\r
index 65acfa3903b2059fb9554576fc578421bffa8a98..c220c1c7eb4005821ff0d07f8f7e03377ef1add3 100644 (file)
          version="0.0.0"\r
          unpack="false"/>\r
 \r
+   <plugin\r
+         id="com.fasterxml.jackson.core.jackson-core"\r
+         download-size="0"\r
+         install-size="0"\r
+         version="0.0.0"\r
+         unpack="false"/>\r
+\r
 </feature>\r
index a4d30189f89998c0f7312525166201835a1f8f38..0c85ae77c5008968105d751688682f3640cca60e 100644 (file)
@@ -10,4 +10,3 @@
 #     VTT Technical Research Centre of Finland - initial API and implementation\r
 ###############################################################################\r
 bin.includes = feature.xml\r
-root=root\r
diff --git a/features/org.simantics.workbench.feature/root/SIMANTICS-README.mediawiki b/features/org.simantics.workbench.feature/root/SIMANTICS-README.mediawiki
deleted file mode 100644 (file)
index 68b6e91..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-== Known Issues ==\r
-\r
-=== Unexpected JVM crashes related to diagrams (AWT) ===\r
-Ticket [https://www.simulationsite.net/trac/simantics/ticket/626 #626]\r
-\r
-There's currently no resolution or workaround for this issue.\r
-Mostly these seem to be related to graphics card drivers and possible bugs therein.\r
\r
-The only advice we currently have to give is to:\r
-* Update to the latest JRE/JDK\r
-* Update your graphics card drivers if possible\r
-* Try changing between D3D, OpenGL and software rendering\r
-** TODO: howto!\r