From: miettinen Date: Fri, 8 Feb 2013 06:19:24 +0000 (+0000) Subject: * The sorting of variables in shortcut tab lost the data field. Now the data field... X-Git-Tag: simantics-1.10.1~50 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=ec4b7aa568b105a1686d6236d769d4a0dd87eb2f;p=simantics%2Fsysdyn.git * The sorting of variables in shortcut tab lost the data field. Now the data field is added in addition to the text field (refs #4048). * Added polarity signs for dependencies whose one end is connected to a module, similarly to those that were connected to variables (refs #3940). * Validating names of variables and module instances now checks also that there are no similarly named modules within the current model (or current module instance). Such invalid names are not accepted (#refs #3040). * Validating names of variables and module instances now checks also that there are no similarly named module types defined in the model. Such invalid names are not accepted (#refs #680). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26737 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java index 5581db47..ab4c39b5 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java @@ -22,7 +22,6 @@ import org.simantics.browsing.ui.model.nodetypes.NodeType; import org.simantics.browsing.ui.model.nodetypes.SpecialNodeType; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; -import org.simantics.db.common.request.ObjectsWithType; import org.simantics.db.common.utils.ListUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ManyObjectsForFunctionalRelationException; @@ -31,21 +30,12 @@ import org.simantics.db.layer0.request.PossibleActiveVariableFromVariable; import org.simantics.db.layer0.variable.Variable; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.jfreechart.ChartSelectionTabContributor; -import org.simantics.jfreechart.chart.properties.ChartTab; -import org.simantics.jfreechart.chart.properties.bar.BarAxisTab; -import org.simantics.jfreechart.chart.properties.bar.BarGeneralPropertiesTab; -import org.simantics.jfreechart.chart.properties.bar.BarSeriesTab; -import org.simantics.jfreechart.chart.properties.pie.PieGeneralPropertiesTab; -import org.simantics.jfreechart.chart.properties.pie.PieSeriesTab; -import org.simantics.jfreechart.chart.properties.xyline.XYLineAxisAndVariablesTab; -import org.simantics.jfreechart.chart.properties.xyline.XYLineGeneralPropertiesTab; import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; import org.simantics.modeling.ui.property.svg.SVGElementComposite; import org.simantics.selectionview.ComparableTabContributor; import org.simantics.selectionview.SelectionProcessor; import org.simantics.simulation.ontology.SimulationResource; -import org.simantics.sysdyn.JFreeChartResource; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.browser.nodes.SharedFunctionsFolder; import org.simantics.ui.selection.AnyVariable; @@ -57,6 +47,7 @@ import org.simantics.utils.ui.ISelectionUtils; * SelectionProcessor for processing selections for property view in system dynamics * * @author Teemu Lempinen + * @author Tuomas Miettinen * */ public class ResourceSelectionProcessor implements SelectionProcessor { @@ -342,14 +333,15 @@ public class ResourceSelectionProcessor implements SelectionProcessor { - private Resource parent; - private IProgressMonitor monitor; - private String migrationURI; - private DefaultPasteImportAdvisor importAdvisor; + private final Resource parent; + private final IProgressMonitor monitor; + private final String migrationURI; + private final DefaultPasteImportAdvisor importAdvisor; /** * Works 2 (2 * 1) in the monitor @@ -87,7 +87,7 @@ public class SysdynImportFormatHandler implements FormatHandler { MigrationStep step = MigrationUtils.getStep(session, migrationURI); MigrationState state = MigrationUtils.newState(); state.setProperty(MigrationStateKeys.CURRENT_TG, tg); - step.applyTo(session, state); + step.applyTo(monitor, session, state); // tg = state.getProperty(MigrationStateKeys.CURRENT_TG); worked(1); diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Model.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Model.java index 6e22190f..bb4e3f66 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Model.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/Model.java @@ -26,16 +26,17 @@ import org.simantics.sysdyn.representation.annotations.BuiltinFunctions; /** * Representation of a system dynamics model * @author Teemu Lempinen + * @author Tuomas Miettinen * */ @GraphType(SysdynResource.URIs.SysdynModel) public class Model { @RelatedValue(SysdynResource.URIs.SysdynModel_startTime) - private Double startTime = 0.0; + private final Double startTime = 0.0; @RelatedValue(SysdynResource.URIs.SysdynModel_stopTime) - private Double stopTime = 10.0; + private final Double stopTime = 10.0; @RelatedValue(SysdynResource.URIs.SysdynModel_outputInterval) private Double outputInterval; @@ -58,12 +59,12 @@ public class Model { @RelatedElements( value = Layer0.URIs.ConsistsOf, composition = true) - private ArrayList consistsOf = new ArrayList(); + private final ArrayList consistsOf = new ArrayList(); @RelatedElements( value = Layer0.URIs.IsLinkedTo, composition = true) - private ArrayList linkedTo = new ArrayList(); + private final ArrayList linkedTo = new ArrayList(); @BuiltinFunctions @@ -159,6 +160,24 @@ public class Model { return functions; } + /** + * Determine if this Model consists of a certain ModuleType. + * @param moduleType The name of the ModuleType that is sought + * @return true iff this consists of moduleType + */ + public boolean containsModuleType(String moduleType) { + if(consistsOf != null ) { + for(Object o : consistsOf) { + if(o instanceof ModuleType) { + ModuleType mt = (ModuleType)o; + if (mt.getName().equals(moduleType)) + return true; + } + } + } + return false; + } + /** * Add built-in functions to functions map. Built-in functions do not have any library path. * @param library Built-in function library