From: lempinen Date: Tue, 27 Jul 2010 14:34:23 +0000 (+0000) Subject: git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@16847 ac1ea38d-2e2b... X-Git-Tag: simantics-1.2.0~157 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=57bf717d7696b301dda5ff340483c5912a580127;p=simantics%2Fsysdyn.git git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@16847 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ConfigurationLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ConfigurationLabeler.java index 379e3a56..2161aaee 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ConfigurationLabeler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ConfigurationLabeler.java @@ -20,8 +20,7 @@ public class ConfigurationLabeler extends LabelerContributor{ @Override public String getLabel(ReadGraph graph, ConfigurationNode conf) throws DatabaseException { - String name = graph.getPossibleRelatedValue(conf.resource, graph.getBuiltins().HasLabel); - return name == null ? "Project (no name)" : name; + return "Configuration"; } } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/LibraryViewpointContributor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/LibraryViewpointContributor.java index fd43e11f..7eea1213 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/LibraryViewpointContributor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/LibraryViewpointContributor.java @@ -36,7 +36,6 @@ public abstract class LibraryViewpointContributor extend ArrayList result = new ArrayList(); for (Resource r : graph.syncRequest(getChildRequest(graph, lib))) { try { - System.out.println("Is Flow? " + graph.isInstanceOf(r, SysdynResource.getInstance(graph).Flow)); AbstractNode n = graph.adapt(r, AbstractNode.class); result.add(n); } catch (DatabaseException e) { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Module.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Module.java index 54011f7d..59945da3 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Module.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Module.java @@ -22,7 +22,8 @@ public class Module extends ViewpointContributor { Builtins b = graph.getBuiltins(); SysdynResource sr = SysdynResource.getInstance(graph); StructuralResource2 str = StructuralResource2.getInstance(graph); - Resource instance = graph.getSingleObject(module.resource, b.InstanceOf); + Resource instance = graph.getPossibleObject(module.resource, b.InstanceOf); + if(instance == null) return result; Resource conf = graph.getSingleObject(instance, str.IsDefinedBy); for(Resource r : graph.syncRequest(new ObjectsWithType(conf, b.ConsistsOf, sr.IndependentVariable))) { try { diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleType.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleType.java index 00bc9fb5..5e79acd9 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleType.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleType.java @@ -4,13 +4,10 @@ import java.util.ArrayList; import java.util.Collection; import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor; -import org.simantics.db.Builtins; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.exception.DatabaseException; import org.simantics.modeling.ModelingResources; -import org.simantics.structural.stubs.StructuralResource2; -import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.browser.nodes.AbstractNode; import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode; @@ -19,9 +16,6 @@ public class ModuleType extends ViewpointContributor { @Override public Collection getContribution(ReadGraph graph, ModuleTypeNode module) throws DatabaseException { ArrayList result = new ArrayList(); - Builtins b = graph.getBuiltins(); - SysdynResource sr = SysdynResource.getInstance(graph); - StructuralResource2 str = StructuralResource2.getInstance(graph); ModelingResources mr = ModelingResources.getInstance(graph); Resource symbol = graph.getPossibleObject(module.resource, mr.ComponentTypeToSymbol); result.add(graph.adapt(symbol, AbstractNode.class)); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleTypeLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleTypeLabeler.java index cefdd32b..4390dcdf 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleTypeLabeler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/ModuleTypeLabeler.java @@ -10,7 +10,7 @@ public class ModuleTypeLabeler extends LabelerContributor{ @Override public String getLabel(ReadGraph graph, ModuleTypeNode moduleType) throws DatabaseException { String label = graph.getPossibleRelatedValue(moduleType.resource, graph.getBuiltins().HasLabel); - return label == null ? "Model (no name)" : label; + return label == null ? "ModuleType (no name)" : label; } } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java index 3db2b187..5d6d72b7 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/NewModuleNodeHandler.java @@ -40,8 +40,7 @@ public class NewModuleNodeHandler extends AbstractHandler { ModelingUtils mu = new ModelingUtils(g); Resource moduleType = g.newResource(); - g.claimValue(moduleType, mu.b.HasName, "ModuleType"); - g.claimValue(moduleType, mu.b.HasLabel, "ModuleTypeLabel"); + g.claimValue(moduleType, mu.b.HasLabel, "New Module Type"); g.claim(moduleType, mu.b.Inherits, sr.Module); g.claim(moduleType, mu.b.PartOf, model); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java new file mode 100644 index 00000000..30eebee6 --- /dev/null +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java @@ -0,0 +1,30 @@ +package org.simantics.sysdyn.ui.properties; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbenchSite; +import org.simantics.browsing.ui.swt.PropertyTabContributorImpl; +import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory; +import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier; +import org.simantics.browsing.ui.swt.widgets.TrackedText; +import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; +import org.simantics.db.Builtins; +import org.simantics.db.management.ISessionContext; + +public class DependencyTab extends PropertyTabContributorImpl { + + @Override + public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) { + Composite composite = new Composite(body, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); + GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(6).applyTo(composite); + TrackedText nameText = new TrackedText(composite, support, SWT.BORDER); + nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName)); + nameText.addModifyListener(new StringPropertyModifier(context, Builtins.URIs.HasName)); + GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget()); + } + + +} diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java index 08a6c612..f8fccc79 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java @@ -54,7 +54,8 @@ public class ModuleInputTab extends PropertyTabContributorImpl { SysdynResource sr = SysdynResource.getInstance(graph); StructuralResource2 sr2 = StructuralResource2.getInstance(graph); ArrayList result = new ArrayList(); - Resource instanceOf = graph.getSingleObject(module, b.InstanceOf); + Resource instanceOf = graph.getPossibleObject(module, b.InstanceOf); + if(instanceOf == null) return result; Resource configuration = graph.getSingleObject(instanceOf, sr2.IsDefinedBy); for(Resource input : graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, sr.Input))) { Resource dependency = null; diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java index 0cd2b29c..a12623a4 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java @@ -54,7 +54,8 @@ public class ModuleOutputTab extends PropertyTabContributorImpl { SysdynResource sr = SysdynResource.getInstance(graph); StructuralResource2 sr2 = StructuralResource2.getInstance(graph); ArrayList result = new ArrayList(); - Resource instanceOf = graph.getSingleObject(module, b.InstanceOf); + Resource instanceOf = graph.getPossibleObject(module, b.InstanceOf); + if(instanceOf == null) return result; Resource configuration = graph.getSingleObject(instanceOf, sr2.IsDefinedBy); for(Resource variable : graph.syncRequest(new ObjectsWithType(configuration, b.ConsistsOf, sr.Variable))) { if(!graph.hasStatement(variable, sr.IsOutput)) continue; 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 ff30ee0d..1ecd329c 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 @@ -121,6 +121,13 @@ public class ResourceSelectionProcessor implements SelectionProcessor