import org.simantics.g2d.diagram.participant.pointertool.TerminalUtil;\r
import org.simantics.g2d.diagram.participant.pointertool.TerminalUtil.TerminalInfo;\r
import org.simantics.g2d.element.ElementClass;\r
+import org.simantics.g2d.element.IElement;\r
import org.simantics.g2d.element.IElementClassProvider;\r
import org.simantics.g2d.event.MouseEvent;\r
import org.simantics.g2d.event.EventHandlerReflection.EventHandler;\r
// Pick Terminal\r
TerminalInfo ti = pickTerminal(me.controlPosition);\r
\r
- if(elementClassProvider != null) {\r
+ if(ti != null && elementClassProvider != null) {\r
\r
- ElementClass connectionClass = null;\r
+ IElement terminalElement = ti.e;\r
\r
+ ElementClass connectionClass = null;\r
if( me.button == MouseEvent.LEFT_BUTTON && (me.stateMask & MouseEvent.ALT_MASK) != 0) {\r
- if(ti.e.getElementClass().getId().equals(CloudFactory.class.getSimpleName())) return false;\r
+ if(terminalElement.getElementClass().getId().equals(CloudFactory.class.getSimpleName())) return false;\r
diagram.setHint(DiagramHints.ROUTE_ALGORITHM, RouterFactory.create(false, false));\r
connectionClass = elementClassProvider.get(ConnectionClasses.DEPENDENCY);\r
\r
} else if (me.button == MouseEvent.RIGHT_BUTTON && (me.stateMask & MouseEvent.ALT_MASK) != 0) {\r
- if(ti.e.getElementClass().getId().equals(AuxiliaryFactory.class.getSimpleName())) return false;\r
+ if(terminalElement.getElementClass().getId().equals(AuxiliaryFactory.class.getSimpleName())) return false;\r
diagram.setHint(DiagramHints.ROUTE_ALGORITHM, RouterFactory.create(true, true));\r
connectionClass = elementClassProvider.get(ConnectionClasses.FLOW);\r
} else {\r
package org.simantics.sysdyn.ui.elements2;\r
\r
import java.awt.BasicStroke;\r
+import java.awt.Font;\r
import java.awt.geom.Rectangle2D;\r
import java.util.Collection;\r
\r
OutlinePick.INSTANCE,\r
TextImpl.INSTANCE,\r
TextColorImpl.BLACK,\r
- TextFontImpl.DEFAULT,\r
+ new TextFontImpl(new Font("arial", Font.PLAIN, 25)),\r
DefaultTransform.INSTANCE,\r
new StaticObjectAdapter(elementType),\r
new StaticSymbolImpl(DEFAULT_IMAGE),\r
StaticSymbolImageInitializer.INSTANCE,\r
- new HoverTextElementHandler(0, 0, Alignment.LEADING, 0.2f),\r
+ new HoverTextElementHandler(0, 0, Alignment.LEADING, 1f , 7, 7, false),\r
BoundsOutline.INSTANCE,\r
new WholeElementTerminals(terminals)\r
).setId(ModuleFactory.class.getSimpleName());\r
ModelingUtils mu = new ModelingUtils(g);\r
\r
Resource moduleType = g.newResource();\r
+ g.claimValue(moduleType, mu.b.HasName, "New Module Type");\r
g.claimValue(moduleType, mu.b.HasLabel, "New Module Type");\r
g.claim(moduleType, mu.b.Inherits, sr.Module);\r
g.claim(moduleType, mu.b.PartOf, model);\r
--- /dev/null
+package org.simantics.sysdyn.ui.properties;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.ui.IWorkbenchSite;\r
+import org.simantics.browsing.ui.swt.PropertyTabContributorImpl;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.db.Builtins;\r
+import org.simantics.db.management.ISessionContext;\r
+\r
+public class ModuleTypeTab extends PropertyTabContributorImpl {\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(6).applyTo(composite);\r
+ TrackedText nameText = new TrackedText(composite, support, SWT.BORDER);\r
+ nameText.setTextFactory(new StringPropertyFactory(Builtins.URIs.HasName));\r
+ nameText.addModifyListener(new StringPropertyModifier(context, Builtins.URIs.HasName));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText.getWidget());\r
+ }\r
+\r
+}\r
0,\r
r,\r
"Dependency Properties"));\r
+ if (backend.isInheritedFrom(r, sr.Module))\r
+ return Collections.singleton(\r
+ new ComparableTabContributor(\r
+ new ModuleTypeTab(),\r
+ 0,\r
+ r,\r
+ "Module Type Properties"));\r
} catch (ServiceException e) {\r
e.printStackTrace();\r
} catch (ManyObjectsForFunctionalRelationException e) {\r
%list_elements\r
CustomersElement : CustomersSymbol\r
MOD.ElementToComponent Customers\r
- DIA.HasTransform "3.5, 0.0, 0.0, 3.5, 89.0, 133.0" : G2D.Transform\r
+ DIA.HasTransform "1.0, 0.0, 0.0, 1.0, 89.0, 133.0" : G2D.Transform\r
CapacityElement : CapacitySymbol\r
MOD.ElementToComponent Capacity\r
- DIA.HasTransform "3.5, 0.0, 0.0, 3.5, 87.0, 65.0" : G2D.Transform\r
+ DIA.HasTransform "1.0, 0.0, 0.0, 1.0, 87.0, 65.0" : G2D.Transform\r
SalesRevenueElement : ValveSymbol\r
MOD.ElementToComponent SalesRevenue\r
DIA.HasTransform "1.0, 0.0, 0.0, 1.0, 100.0, 90.0" : G2D.Transform\r