]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Small Sysdyn improvements (refs #4803):
authormiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 7 Apr 2014 12:19:54 +0000 (12:19 +0000)
committermiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 7 Apr 2014 12:19:54 +0000 (12:19 +0000)
Commented out the currently useless Synthesim button.
Using most profiles as default.
Multiple dependency selection tab to inherit adjustable tab.
Moved sensitivity chart up in the context menu and added chart tab to sensitivity chart property view.

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29253 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayDependencyTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java
org.simantics.sysdyn/src/org/simantics/sysdyn/utils/ProfileEntries.java

index 9a671258740de4d1e665141d469d4cf664704d1b..d9a5d7eb90b005f10887684dfc26c52a2e578f88 100644 (file)
                         </equals>\r
                      </iterate>\r
                      <and>\r
-                        <not>\r
-                           <count\r
-                                 value="0">\r
-                           </count>\r
-                        </not>\r
+                        <count\r
+                              value="0">\r
+                        </count>\r
                      </and>\r
                   </with>\r
                </visibleWhen>\r
             <command\r
                   commandId="org.simantics.sysdyn.ui.newModuleNode"\r
                   id="org.simantics.sysdyn.ui.browser.newModule"\r
-                  label="Module"\r
+                  label="Module type"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
                </visibleWhen>\r
             </command>\r
             <command\r
-                  commandId="org.simantics.sysdyn.ui.newBarChart"\r
-                  icon="platform:/plugin/com.famfamfam.silk/icons/chart_bar.png"\r
-                  id="org.simantics.sysdyn.ui.browser.newBarChart"\r
-                  label="Bar Chart"\r
+                  commandId="org.simantics.sysdyn.ui.newSensitivityChart"\r
+                  icon="platform:/plugin/com.famfamfam.silk/icons/rainbow.png"\r
+                  id="org.simantics.sysdyn.ui.browser.newSensitivityChart"\r
+                  label="Sensitivity Chart"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
                </visibleWhen>\r
             </command>\r
             <command\r
-                  commandId="org.simantics.sysdyn.ui.newPieChart"\r
-                  icon="platform:/plugin/com.famfamfam.silk/icons/chart_pie.png"\r
-                  id="org.simantics.sysdyn.ui.browser.newPieChart"\r
-                  label="Pie Chart"\r
+                  commandId="org.simantics.sysdyn.ui.newBarChart"\r
+                  icon="platform:/plugin/com.famfamfam.silk/icons/chart_bar.png"\r
+                  id="org.simantics.sysdyn.ui.browser.newBarChart"\r
+                  label="Bar Chart"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
                </visibleWhen>\r
             </command>\r
             <command\r
-                  commandId="org.simantics.sysdyn.ui.newSensitivityChart"\r
-                  icon="platform:/plugin/com.famfamfam.silk/icons/rainbow.png"\r
-                  id="org.simantics.sysdyn.ui.browser.newSensitivityChart"\r
-                  label="Sensitivity Chart"\r
+                  commandId="org.simantics.sysdyn.ui.newPieChart"\r
+                  icon="platform:/plugin/com.famfamfam.silk/icons/chart_pie.png"\r
+                  id="org.simantics.sysdyn.ui.browser.newPieChart"\r
+                  label="Pie Chart"\r
                   style="push">\r
                <visibleWhen\r
                      checkEnabled="true">\r
             type="radio"\r
             value="flow">\r
       </command>\r
+      <!--<command\r
+            commandId="org.simantics.sysdyn.ui.diagramTool"\r
+            image="platform:/plugin/com.famfamfam.silk/icons/textfield_add.png"\r
+            name="Create Auxiliary (Shift+A)"\r
+            toolbarId="org.simantics.sysdyn.ui.diagramToolbar"\r
+            type="radio"\r
+            value="auxiliary">\r
+      </command>-->\r
    </extension>\r
    <extension\r
          point="org.simantics.project.feature">\r
index a94c8a14905c4508e3e7e6847dd471b803fe0763..189a5b0fc9d4b3fd16b2cb4bd3da601d418241fb 100644 (file)
@@ -33,7 +33,7 @@ import org.simantics.db.Resource;
 import org.simantics.db.WriteGraph;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.management.ISessionContext;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.elements.connections.DependencyEdgeClass;\r
 import org.simantics.sysdyn.ui.elements.connections.DependencyNode;\r
@@ -47,95 +47,19 @@ import org.simantics.utils.datastructures.Triple;
  * @author Tuomas Miettinen\r
  *\r
  */\r
-public class ArrayDependencyTab  extends LabelPropertyTabContributor {\r
+public class ArrayDependencyTab  extends AdjustableTab {\r
 \r
     Button none, plus, minus, other, inside, outside;\r
     TrackedText polarityText, polarityLocationText;\r
     private DelayMarkWidget delayMark;\r
     private ArrowHeadWidget arrowhead;\r
        private Scale lineThicknessScale;\r
-    \r
-    @Override\r
-    public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r
-        Composite composite = new Composite(body, SWT.NONE);\r
-        GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
-        GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);\r
-        \r
-        /* Add a dummy button at the begin to suck in the nonsense selection events that\r
-         * the first radio button in the group of ALL the radio buttons receives when no\r
-         * radio is selected and then one is selected in other group than where the first \r
-         * radio button lies.  \r
-         */\r
-        Group hiddenDefaultbuttonGroup = new Group(composite, SWT.NONE);\r
-        GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup);\r
-        GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup);\r
-        new Button(hiddenDefaultbuttonGroup, support, SWT.RADIO);\r
-        \r
-        Group polarityGroup = new Group(composite, SWT.NONE);\r
-        polarityGroup.setText("Polarity");\r
-        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup);\r
-        GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup);\r
-        \r
-        none = new Button(polarityGroup, support, SWT.RADIO);\r
-        none.setText("None");\r
-        none.setSelectionFactory(new PolarityRadioSelectionFactory(""));\r
-        none.addSelectionListener(new PolaritySelectionListener(context, ""));\r
-        \r
-        plus = new Button(polarityGroup, support, SWT.RADIO);\r
-        plus.setText("+");\r
-        plus.setSelectionFactory(new PolarityRadioSelectionFactory("+"));\r
-        plus.addSelectionListener(new PolaritySelectionListener(context, "+"));\r
-        \r
-        minus = new Button(polarityGroup, support, SWT.RADIO);\r
-        minus.setText("-");\r
-        minus.setSelectionFactory(new PolarityRadioSelectionFactory("-"));\r
-        minus.addSelectionListener(new PolaritySelectionListener(context, "-"));\r
-        \r
-        other = new Button(polarityGroup, support, SWT.RADIO);\r
-        other.setText("other");\r
-        other.setSelectionFactory(new OtherPolaritySelectionFactory(new String[] {null, "+", "-", ""}));\r
-        \r
-        polarityText = new TrackedText(polarityGroup, support, SWT.BORDER);\r
-        polarityText.setTextFactory(new OtherPolarityStringPropertyFactory());\r
-        polarityText.addModifyListener(new OtherPolarityStringPropertyModifier());\r
-        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget());\r
-        \r
-        Group locationGroup = new Group(composite, SWT.NONE);\r
-        GridDataFactory.fillDefaults().applyTo(locationGroup);\r
-        GridLayoutFactory.fillDefaults().applyTo(locationGroup);\r
-        locationGroup.setText("Location");\r
-        \r
-        inside = new Button(locationGroup, support, SWT.RADIO);\r
-        inside.setText("Inside");\r
-        inside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.INSIDE));\r
-        inside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.INSIDE));\r
-        \r
-        outside = new Button(locationGroup, support, SWT.RADIO);\r
-        outside.setText("Outside");\r
-        outside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.OUTSIDE));\r
-        outside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.OUTSIDE));\r
-\r
-        Composite misc = new Composite(composite, SWT.NONE);\r
-        GridDataFactory.fillDefaults().grab(true, true).applyTo(misc);\r
-        GridLayoutFactory.fillDefaults().numColumns(3).applyTo(misc);\r
-        \r
-        arrowhead = new ArrowHeadWidget(misc, support, SWT.NULL);\r
-        GridDataFactory.fillDefaults().applyTo(arrowhead.getWidget());\r
-        delayMark = new DelayMarkWidget(misc, support, SWT.NULL);\r
-        GridDataFactory.fillDefaults().applyTo(delayMark.getWidget());\r
-        \r
-        Group lineThicknessGroup = new Group(misc, SWT.NONE);\r
-        GridDataFactory.fillDefaults().applyTo(lineThicknessGroup);\r
-        GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup);\r
-        lineThicknessGroup.setText("Line thickness:");\r
-        lineThicknessScale = new Scale(lineThicknessGroup, support, SWT.HORIZONTAL);\r
-        lineThicknessScale.getWidget().setMinimum(1);\r
-        lineThicknessScale.getWidget().setMaximum(15);\r
-        lineThicknessScale.getWidget().setPageIncrement(1);\r
-        lineThicknessScale.getWidget().setIncrement(1);\r
-        lineThicknessScale.setSelectionFactory(new LineThicknessRadioSelectionFactory());\r
-        lineThicknessScale.addSelectionListener(new LineThicknessSelectionListener(context, lineThicknessScale));\r
-    }\r
+       private Composite composite;\r
+       private Group hiddenDefaultbuttonGroup;\r
+       private Group polarityGroup;\r
+       private Group locationGroup;\r
+       private Composite misc;\r
+       private Group lineThicknessGroup;\r
     \r
     class LineThicknessSelectionListener extends SelectionListenerImpl<ArrayList<Resource>> {\r
        Scale scale;\r
@@ -345,4 +269,124 @@ public class ArrayDependencyTab  extends LabelPropertyTabContributor {
         }\r
     }\r
 \r
+       @Override\r
+       protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+                       ISessionContext context, WidgetSupport support) {\r
+               composite = new Composite(body, SWT.NONE);\r
+        \r
+        /* Add a dummy button at the begin to suck in the nonsense selection events that\r
+         * the first radio button in the group of ALL the radio buttons receives when no\r
+         * radio is selected and then one is selected in other group than where the first \r
+         * radio button lies.  \r
+         */\r
+        hiddenDefaultbuttonGroup = new Group(composite, SWT.NONE);\r
+        new Button(hiddenDefaultbuttonGroup, support, SWT.RADIO);\r
+        \r
+        polarityGroup = new Group(composite, SWT.NONE);\r
+        polarityGroup.setText("Polarity");\r
+        \r
+        none = new Button(polarityGroup, support, SWT.RADIO);\r
+        none.setText("None");\r
+        none.setSelectionFactory(new PolarityRadioSelectionFactory(""));\r
+        none.addSelectionListener(new PolaritySelectionListener(context, ""));\r
+        \r
+        plus = new Button(polarityGroup, support, SWT.RADIO);\r
+        plus.setText("+");\r
+        plus.setSelectionFactory(new PolarityRadioSelectionFactory("+"));\r
+        plus.addSelectionListener(new PolaritySelectionListener(context, "+"));\r
+        \r
+        minus = new Button(polarityGroup, support, SWT.RADIO);\r
+        minus.setText("-");\r
+        minus.setSelectionFactory(new PolarityRadioSelectionFactory("-"));\r
+        minus.addSelectionListener(new PolaritySelectionListener(context, "-"));\r
+        \r
+        other = new Button(polarityGroup, support, SWT.RADIO);\r
+        other.setText("other");\r
+        other.setSelectionFactory(new OtherPolaritySelectionFactory(new String[] {null, "+", "-", ""}));\r
+        \r
+        polarityText = new TrackedText(polarityGroup, support, SWT.BORDER);\r
+        polarityText.setTextFactory(new OtherPolarityStringPropertyFactory());\r
+        polarityText.addModifyListener(new OtherPolarityStringPropertyModifier());\r
+        \r
+        locationGroup = new Group(composite, SWT.NONE);\r
+        locationGroup.setText("Location");\r
+        \r
+        inside = new Button(locationGroup, support, SWT.RADIO);\r
+        inside.setText("Inside");\r
+        inside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.INSIDE));\r
+        inside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.INSIDE));\r
+        \r
+        outside = new Button(locationGroup, support, SWT.RADIO);\r
+        outside.setText("Outside");\r
+        outside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.OUTSIDE));\r
+        outside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.OUTSIDE));\r
+\r
+        misc = new Composite(composite, SWT.NONE);\r
+        \r
+        arrowhead = new ArrowHeadWidget(misc, support, SWT.NULL);\r
+        delayMark = new DelayMarkWidget(misc, support, SWT.NULL);\r
+        \r
+        lineThicknessGroup = new Group(misc, SWT.NONE);\r
+        lineThicknessGroup.setText("Line thickness:");\r
+        lineThicknessScale = new Scale(lineThicknessGroup, support, SWT.HORIZONTAL);\r
+        lineThicknessScale.getWidget().setMinimum(1);\r
+        lineThicknessScale.getWidget().setMaximum(15);\r
+        lineThicknessScale.getWidget().setPageIncrement(1);\r
+        lineThicknessScale.getWidget().setIncrement(1);\r
+        lineThicknessScale.setSelectionFactory(new LineThicknessRadioSelectionFactory());\r
+        lineThicknessScale.addSelectionListener(new LineThicknessSelectionListener(context, lineThicknessScale));\r
+       }\r
+\r
+       @Override\r
+       protected void createControlLayoutVertical() {\r
+               GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+        GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(1).applyTo(composite);\r
+        \r
+        GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup);\r
+        GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget());\r
+        \r
+        GridDataFactory.fillDefaults().applyTo(locationGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(locationGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, true).applyTo(misc);\r
+        GridLayoutFactory.fillDefaults().numColumns(2).applyTo(misc);\r
+\r
+        GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(arrowhead.getWidget());\r
+        GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(delayMark.getWidget());\r
+        \r
+        GridDataFactory.fillDefaults().span(2, 1).applyTo(lineThicknessGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup);\r
+       }\r
+\r
+       @Override\r
+       protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+               GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+        GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);\r
+        \r
+        GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup);\r
+        GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget());\r
+        \r
+        GridDataFactory.fillDefaults().applyTo(locationGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(locationGroup);\r
+        \r
+        GridDataFactory.fillDefaults().grab(true, true).applyTo(misc);\r
+        GridLayoutFactory.fillDefaults().numColumns(3).applyTo(misc);\r
+\r
+        GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(arrowhead.getWidget());\r
+        GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(delayMark.getWidget());\r
+        \r
+        GridDataFactory.fillDefaults().span(1, 1).applyTo(lineThicknessGroup);\r
+        GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup);\r
+       }\r
+\r
 }\r
index 1fb36162a2c5dd822dbacfcca4d94fd03f6afa94..49407d6bbd459f0590427f117e4d0207f17a8632 100644 (file)
@@ -32,6 +32,7 @@ import org.simantics.db.layer0.request.PossibleActiveVariableFromVariable;
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.jfreechart.ChartSelectionTabContributor;\r
+import org.simantics.jfreechart.chart.properties.ChartTab;\r
 import org.simantics.jfreechart.chart.properties.xyline.XYLineGeneralPropertiesTab;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.modeling.ModelingResources;\r
@@ -527,6 +528,11 @@ public class ResourceSelectionProcessor implements SelectionProcessor<Object, Re
                             9,\r
                             r,\r
                             "Axis and Variables"));\r
+                    tabs.add(new ComparableTabContributor(\r
+                            new ChartTab(),\r
+                            1,\r
+                            r,\r
+                            "Chart"));\r
                     return true;\r
                 }\r
             }\r
index f53920c9f126186910190a1bedbaf4a71d7dfabd..7a61c36dfc28b4ef34886bc1f2faf4d0a253db24 100644 (file)
@@ -17,6 +17,7 @@ import org.simantics.db.exception.DatabaseException;
 import org.simantics.diagram.profile.Profiles;\r
 import org.simantics.diagram.stubs.DiagramResource;\r
 import org.simantics.layer0.Layer0;\r
+import org.simantics.simulation.ontology.SimulationResource;\r
 import org.simantics.sysdyn.SysdynResource;\r
 \r
 public class ProfileEntries  {\r
@@ -43,6 +44,9 @@ public class ProfileEntries  {
 //            public void perform(WriteGraph graph) throws DatabaseException {\r
 //                DiagramResource DIA = DiagramResource.getInstance(graph);\r
                 graph.claim(model, DIA.HasActiveProfile, defaultProfile);\r
+                SimulationResource SIMU = SimulationResource.getInstance(graph);\r
+                graph.claim(defaultProfile, SIMU.IsActive, null, sr.Profiles_IssueWarnings);\r
+                graph.claim(defaultProfile, SIMU.IsActive, null, sr.Profiles_ShadowVisualizations);\r
 //            }\r
 //        });\r
 \r