Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordstadnik2008-08-01 07:40:22 -0400
committerdstadnik2008-08-01 07:40:22 -0400
commit4375346ab23dc19a9c103e402aa653d6dfa7c67a (patch)
tree733ffa51744772aeeceb7634526db99f9141cfc5
parent78f089e051e27fbf5f55d318c7550716dc1bc17e (diff)
downloadorg.eclipse.gmf-tooling-4375346ab23dc19a9c103e402aa653d6dfa7c67a.tar.gz
org.eclipse.gmf-tooling-4375346ab23dc19a9c103e402aa653d6dfa7c67a.tar.xz
org.eclipse.gmf-tooling-4375346ab23dc19a9c103e402aa653d6dfa7c67a.zip
regenerated
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.properties6
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.xml82
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/BesiegePortOrderCreateCommand.java1
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/EscortShipsOrderCreateCommand.java1
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/ReliableRouteCreateCommand.java32
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/UnreliableRouteCreateCommand.java32
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/helpers/TaiPanBaseEditHelper.java18
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/BesiegePortOrderEditPart.java3
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EmptyBoxEditPart.java38
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EscortShipsOrderEditPart.java3
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/LargeItemEditPart.java38
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortEditPart.java38
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortRegisterEditPart.java3
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ReliableRouteEditPart.java3
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipDestinationEditPart.java3
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipEditPart.java38
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipRouteEditPart.java3
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/UnreliableRouteEditPart.java3
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/WarshipEditPart.java38
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryCanonicalEditPolicy.java11
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/BesiegePortOrderItemSemanticEditPolicy.java8
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EmptyBoxItemSemanticEditPolicy.java8
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EscortShipsOrderItemSemanticEditPolicy.java8
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/LargeItemItemSemanticEditPolicy.java8
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/OpenDiagramEditPolicy.java5
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortRegisterItemSemanticEditPolicy.java8
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ReliableRouteItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipDestinationItemSemanticEditPolicy.java8
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoCanonicalEditPolicy.java4
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipRouteItemSemanticEditPolicy.java8
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoCanonicalEditPolicy.java4
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/SmallItemsItemSemanticEditPolicy.java8
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/TaiPanBaseItemSemanticEditPolicy.java181
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/UnreliableRouteItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoCanonicalEditPolicy.java4
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoCanonicalEditPolicy.java4
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoItemSemanticEditPolicy.java7
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanAbstractExpression.java166
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanOCLFactory.java13
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/DeleteElementAction.java94
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/DiagramEditorContextMenuProvider.java77
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanCreationWizard.java12
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDiagramEditor.java11
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDocumentProvider.java23
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanVisualIDRegistry.java33
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/ValidateAction.java5
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/preferences/DiagramPreferenceInitializer.java1
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/properties/TaiPanPropertiesLabelProvider.java57
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/ElementInitializers.java15
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanElementTypes.java51
-rw-r--r--examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanValidationProvider.java225
58 files changed, 934 insertions, 579 deletions
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.properties b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.properties
index b388c563d..85451708a 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.properties
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.properties
@@ -62,3 +62,9 @@ metatype.name.BesiegePortOrder_4005=Besiege Port Order
metatype.name.EscortShipsOrder_4006=Escort Ships Order
metatype.name.PortRegister_4007=Port Register
+prefpage.org.eclipse.gmf.examples.taipan.diagram.general=TaiPan Diagram
+prefpage.org.eclipse.gmf.examples.taipan.diagram.appearance=Appearance
+prefpage.org.eclipse.gmf.examples.taipan.diagram.connections=Connections
+prefpage.org.eclipse.gmf.examples.taipan.diagram.printing=Printing
+prefpage.org.eclipse.gmf.examples.taipan.diagram.rulersAndGrid=Rulers And Grid
+prefpage.org.eclipse.gmf.examples.taipan.diagram.pathmaps=Pathmaps
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.xml b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.xml
index 50860346e..2c5efbf3b 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.xml
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/plugin.xml
@@ -137,60 +137,6 @@ Contributors:
</GlobalActionHandlerProvider>
</extension>
- <extension point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
- <?gmfgen generated="true"?>
- <contributionItemProvider
- class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContributionItemProvider"
- checkPluginLoaded="false">
- <Priority name="Low"/>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.PortLocationEditPart"/>
- <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
- <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
- </popupContribution>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.ShipDestinationEditPart"/>
- <popupAction path="/editGroup" id="deleteFromModelAction"/>
- <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
- </popupContribution>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.ShipDestinationMarkerEditPart"/>
- <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
- <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
- </popupContribution>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.ReliableRouteDescEditPart"/>
- <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
- <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
- </popupContribution>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.ReliableRouteRelbEditPart"/>
- <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
- <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
- </popupContribution>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.UnreliableRouteDescEditPart"/>
- <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
- <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
- </popupContribution>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.UnreliableRouteRelbEditPart"/>
- <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
- <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
- </popupContribution>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.ShipRouteEditPart"/>
- <popupAction path="/editGroup" id="deleteFromModelAction"/>
- <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
- </popupContribution>
- <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
- <popupStructuredContributionCriteria objectClass="org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.PortRegisterEditPart"/>
- <popupAction path="/editGroup" id="deleteFromModelAction"/>
- <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
- </popupContribution>
- </contributionItemProvider>
- </extension>
-
<extension id="ValidationContributionItemProvider" name="Validation"
point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
<?gmfgen generated="true"?>
@@ -204,6 +150,8 @@ Contributors:
</contributionItemProvider>
</extension>
+
+
<extension id="validationDecoratorProvider" name="ValidationDecorations" point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
<?gmfgen generated="true"?>
<decoratorProvider class="org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanValidationDecoratorProvider">
@@ -222,36 +170,36 @@ Contributors:
<?gmfgen generated="true"?>
<page
id="org.eclipse.gmf.examples.taipan.diagram.general"
- name="%preference.page.title.org.eclipse.gmf.examples.taipan.diagram.general"
+ name="%prefpage.org.eclipse.gmf.examples.taipan.diagram.general"
class="org.eclipse.gmf.examples.taipan.gmf.editor.preferences.DiagramGeneralPreferencePage">
</page>
<page
id="org.eclipse.gmf.examples.taipan.diagram.appearance"
- name="%preference.page.title.org.eclipse.gmf.examples.taipan.diagram.appearance"
+ name="%prefpage.org.eclipse.gmf.examples.taipan.diagram.appearance"
category="org.eclipse.gmf.examples.taipan.diagram.general"
class="org.eclipse.gmf.examples.taipan.gmf.editor.preferences.DiagramAppearancePreferencePage">
</page>
<page
id="org.eclipse.gmf.examples.taipan.diagram.connections"
- name="%preference.page.title.org.eclipse.gmf.examples.taipan.diagram.connections"
+ name="%prefpage.org.eclipse.gmf.examples.taipan.diagram.connections"
category="org.eclipse.gmf.examples.taipan.diagram.general"
class="org.eclipse.gmf.examples.taipan.gmf.editor.preferences.DiagramConnectionsPreferencePage">
</page>
<page
id="org.eclipse.gmf.examples.taipan.diagram.printing"
- name="%preference.page.title.org.eclipse.gmf.examples.taipan.diagram.printing"
+ name="%prefpage.org.eclipse.gmf.examples.taipan.diagram.printing"
category="org.eclipse.gmf.examples.taipan.diagram.general"
class="org.eclipse.gmf.examples.taipan.gmf.editor.preferences.DiagramPrintingPreferencePage">
</page>
<page
id="org.eclipse.gmf.examples.taipan.diagram.rulersAndGrid"
- name="%preference.page.title.org.eclipse.gmf.examples.taipan.diagram.rulersAndGrid"
+ name="%prefpage.org.eclipse.gmf.examples.taipan.diagram.rulersAndGrid"
category="org.eclipse.gmf.examples.taipan.diagram.general"
class="org.eclipse.gmf.examples.taipan.gmf.editor.preferences.DiagramRulersAndGridPreferencePage">
</page>
<page
id="org.eclipse.gmf.examples.taipan.diagram.pathmaps"
- name="%preference.page.title.org.eclipse.gmf.examples.taipan.diagram.pathmaps"
+ name="%prefpage.org.eclipse.gmf.examples.taipan.diagram.pathmaps"
category="org.eclipse.gmf.examples.taipan.diagram.general"
class="org.eclipse.gmf.runtime.emf.ui.preferences.PathmapsPreferencePage">
</page>
@@ -510,14 +458,14 @@ Contributors:
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
<?gmfgen generated="true"?>
- <clientContext id="TaiPanClientContext">
+ <clientContext id="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.TypeContext">
<enablement>
<test
property="org.eclipse.gmf.runtime.emf.core.editingDomain"
value="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.EditingDomain"/>
</enablement>
</clientContext>
- <binding context="TaiPanClientContext">
+ <binding context="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.TypeContext">
<elementType ref="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.Aquatory_1000"/>
<elementType ref="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.Port_2001"/>
<elementType ref="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.Ship_2002"/>
@@ -619,7 +567,6 @@ Contributors:
</category>
<constraintProvider cache="true">
<package namespaceUri="http://www.eclipse.org/examples/gmf/taipan"/>
- <package namespaceUri="http://www.eclipse.org/examples/gmf/taipan"/>
<constraints categories="taipan">
<constraint id="port_location"
lang="OCL"
@@ -647,14 +594,7 @@ Contributors:
<extension point="org.eclipse.emf.validation.constraintBindings">
<?gmfgen generated="true"?>
- <clientContext default="false" id="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.DefaultCtx">
- <selector class="org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanValidationProvider$DefaultCtx1"/>
- </clientContext>
- <binding context="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.DefaultCtx">
- <constraint ref="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.port_location"/>
- <constraint ref="org.eclipse.gmf.examples.taipan.gmf.editor.rcp.ship_name"/>
- </binding>
- </extension>
+ </extension>
<extension point="org.eclipse.ui.commands">
<?gmfgen generated="true"?>
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/BesiegePortOrderCreateCommand.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/BesiegePortOrderCreateCommand.java
index c92945319..b59ec4ac4 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/BesiegePortOrderCreateCommand.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/BesiegePortOrderCreateCommand.java
@@ -83,7 +83,6 @@ public class BesiegePortOrderCreateCommand extends CreateElementCommand {
BesiegePortOrder newElement = TaiPanFactory.eINSTANCE.createBesiegePortOrder();
getSource().getAttackOrders().add(newElement);
newElement.setPort(getTarget());
-
return newElement;
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/EscortShipsOrderCreateCommand.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/EscortShipsOrderCreateCommand.java
index 98c42836b..bb08f4935 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/EscortShipsOrderCreateCommand.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/EscortShipsOrderCreateCommand.java
@@ -83,7 +83,6 @@ public class EscortShipsOrderCreateCommand extends CreateElementCommand {
EscortShipsOrder newElement = TaiPanFactory.eINSTANCE.createEscortShipsOrder();
getSource().setEscortOrder(newElement);
newElement.getShips().add(getTarget());
-
return newElement;
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/ReliableRouteCreateCommand.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/ReliableRouteCreateCommand.java
index 9471d00ee..bc16af246 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/ReliableRouteCreateCommand.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/ReliableRouteCreateCommand.java
@@ -46,7 +46,7 @@ public class ReliableRouteCreateCommand extends CreateElementCommand {
/**
* @generated
*/
- private Aquatory container;
+ private final Aquatory container;
/**
* @generated
@@ -59,15 +59,9 @@ public class ReliableRouteCreateCommand extends CreateElementCommand {
setContainmentFeature(TaiPanPackage.eINSTANCE.getAquatory_Routes());
}
- // Find container element for the new link.
- // Climb up by containment hierarchy starting from the source
- // and return the first element that is instance of the container class.
- for (EObject element = source; element != null; element = element.eContainer()) {
- if (element instanceof Aquatory) {
- container = (Aquatory) element;
- super.setElementToEdit(container);
- break;
- }
+ container = deduceContainer(source, target);
+ if (container != null) {
+ super.setElementToEdit(container);
}
}
@@ -103,7 +97,6 @@ public class ReliableRouteCreateCommand extends CreateElementCommand {
newElement.setSource(getSource());
newElement.setDestination(getTarget());
TaiPanElementTypes.init_Route_4002(newElement);
-
return newElement;
}
@@ -161,4 +154,21 @@ public class ReliableRouteCreateCommand extends CreateElementCommand {
public Aquatory getContainer() {
return container;
}
+
+ /**
+ * Default approach is to traverse ancestors of the source to find instance of container.
+ * Modify with appropriate logic.
+ * @generated
+ */
+ private static Aquatory deduceContainer(EObject source, EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Aquatory) {
+ return (Aquatory) element;
+ }
+ }
+ return null;
+ }
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/UnreliableRouteCreateCommand.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/UnreliableRouteCreateCommand.java
index 45722efea..a95cab69c 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/UnreliableRouteCreateCommand.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/commands/UnreliableRouteCreateCommand.java
@@ -46,7 +46,7 @@ public class UnreliableRouteCreateCommand extends CreateElementCommand {
/**
* @generated
*/
- private Aquatory container;
+ private final Aquatory container;
/**
* @generated
@@ -59,15 +59,9 @@ public class UnreliableRouteCreateCommand extends CreateElementCommand {
setContainmentFeature(TaiPanPackage.eINSTANCE.getAquatory_Routes());
}
- // Find container element for the new link.
- // Climb up by containment hierarchy starting from the source
- // and return the first element that is instance of the container class.
- for (EObject element = source; element != null; element = element.eContainer()) {
- if (element instanceof Aquatory) {
- container = (Aquatory) element;
- super.setElementToEdit(container);
- break;
- }
+ container = deduceContainer(source, target);
+ if (container != null) {
+ super.setElementToEdit(container);
}
}
@@ -103,7 +97,6 @@ public class UnreliableRouteCreateCommand extends CreateElementCommand {
newElement.setSource(getSource());
newElement.setDestination(getTarget());
TaiPanElementTypes.init_Route_4003(newElement);
-
return newElement;
}
@@ -161,4 +154,21 @@ public class UnreliableRouteCreateCommand extends CreateElementCommand {
public Aquatory getContainer() {
return container;
}
+
+ /**
+ * Default approach is to traverse ancestors of the source to find instance of container.
+ * Modify with appropriate logic.
+ * @generated
+ */
+ private static Aquatory deduceContainer(EObject source, EObject target) {
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (EObject element = source; element != null; element = element.eContainer()) {
+ if (element instanceof Aquatory) {
+ return (Aquatory) element;
+ }
+ }
+ return null;
+ }
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/helpers/TaiPanBaseEditHelper.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/helpers/TaiPanBaseEditHelper.java
index be875966f..b682933d5 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/helpers/TaiPanBaseEditHelper.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/helpers/TaiPanBaseEditHelper.java
@@ -13,7 +13,10 @@ package org.eclipse.gmf.examples.taipan.gmf.editor.edit.helpers;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
@@ -33,6 +36,21 @@ public class TaiPanBaseEditHelper extends AbstractEditHelper {
/**
* @generated
*/
+ public static final String CONTEXT_ELEMENT_TYPE = "context element type"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ protected IEditHelperAdvice[] getEditHelperAdvice(IEditCommandRequest req) {
+ if (req.getParameter(CONTEXT_ELEMENT_TYPE) instanceof IElementType) {
+ return ElementTypeRegistry.getInstance().getEditHelperAdvice((IElementType) req.getParameter(CONTEXT_ELEMENT_TYPE));
+ }
+ return super.getEditHelperAdvice(req);
+ }
+
+ /**
+ * @generated
+ */
protected ICommand getInsteadCommand(IEditCommandRequest req) {
ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
req.setParameter(EDIT_POLICY_COMMAND, null);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/BesiegePortOrderEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/BesiegePortOrderEditPart.java
index e151cdb22..e178d3731 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/BesiegePortOrderEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/BesiegePortOrderEditPart.java
@@ -15,13 +15,14 @@ import org.eclipse.draw2d.Connection;
import org.eclipse.gmf.examples.taipan.figures.ArrowConnection;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies.BesiegePortOrderItemSemanticEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
-public class BesiegePortOrderEditPart extends ConnectionNodeEditPart {
+public class BesiegePortOrderEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
/**
* @generated
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EmptyBoxEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EmptyBoxEditPart.java
index 879a86cba..fd0c4e443 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EmptyBoxEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EmptyBoxEditPart.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
@@ -27,6 +28,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
/**
* @generated
@@ -150,4 +152,40 @@ public class EmptyBoxEditPart extends ShapeNodeEditPart {
return super.getContentPane();
}
+ /**
+ * @generated
+ */
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setBackgroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setBackgroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineWidth(int width) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineWidth(getMapMode().DPtoLP(width));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineType(int style) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineStyle(style);
+ }
+ }
+
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EscortShipsOrderEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EscortShipsOrderEditPart.java
index 2940670ef..3baf43e91 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EscortShipsOrderEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/EscortShipsOrderEditPart.java
@@ -15,13 +15,14 @@ import org.eclipse.draw2d.Connection;
import org.eclipse.gmf.examples.taipan.figures.ThickDirectedConnection;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies.EscortShipsOrderItemSemanticEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
-public class EscortShipsOrderEditPart extends ConnectionNodeEditPart {
+public class EscortShipsOrderEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
/**
* @generated
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/LargeItemEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/LargeItemEditPart.java
index 5bee2add2..d55b8ab5b 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/LargeItemEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/LargeItemEditPart.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
@@ -29,6 +30,7 @@ import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
/**
* @generated
@@ -160,6 +162,42 @@ public class LargeItemEditPart extends ShapeNodeEditPart {
/**
* @generated
*/
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setBackgroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setBackgroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineWidth(int width) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineWidth(getMapMode().DPtoLP(width));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineType(int style) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(TaiPanVisualIDRegistry.getType(LargeItemArticleEditPart.VISUAL_ID));
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortEditPart.java
index 624eff5ce..992f45dbc 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortEditPart.java
@@ -13,6 +13,7 @@ package org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.emf.common.notify.Notification;
@@ -37,6 +38,7 @@ import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
/**
* @generated
@@ -192,6 +194,42 @@ public class PortEditPart extends AbstractBorderedShapeEditPart {
/**
* @generated
*/
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setBackgroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setBackgroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineWidth(int width) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineWidth(getMapMode().DPtoLP(width));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineType(int style) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineStyle(style);
+ }
+ }
+
+ /**
+ * @generated
+ */
public EditPart getPrimaryChildEditPart() {
return getChildBySemanticHint(TaiPanVisualIDRegistry.getType(PortLocationEditPart.VISUAL_ID));
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortRegisterEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortRegisterEditPart.java
index a979e1874..d0197cf03 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortRegisterEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/PortRegisterEditPart.java
@@ -15,13 +15,14 @@ import org.eclipse.draw2d.Connection;
import org.eclipse.gmf.examples.taipan.figures.DashedConnection;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies.PortRegisterItemSemanticEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
-public class PortRegisterEditPart extends ConnectionNodeEditPart {
+public class PortRegisterEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
/**
* @generated
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ReliableRouteEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ReliableRouteEditPart.java
index 9258e9ad6..fb4f65a4a 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ReliableRouteEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ReliableRouteEditPart.java
@@ -15,6 +15,7 @@ import org.eclipse.draw2d.Connection;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies.ReliableRouteItemSemanticEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
import org.eclipse.gmf.runtime.notation.View;
@@ -22,7 +23,7 @@ import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
-public class ReliableRouteEditPart extends ConnectionNodeEditPart {
+public class ReliableRouteEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
/**
* @generated
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipDestinationEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipDestinationEditPart.java
index 97b4c6747..7d0f5fc1b 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipDestinationEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipDestinationEditPart.java
@@ -16,13 +16,14 @@ import org.eclipse.gef.EditPart;
import org.eclipse.gmf.examples.taipan.figures.DirectedConnection;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies.ShipDestinationItemSemanticEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
-public class ShipDestinationEditPart extends ConnectionNodeEditPart {
+public class ShipDestinationEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
/**
* @generated
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipEditPart.java
index a70e92ca1..03c6e3c39 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipEditPart.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EcorePackage;
@@ -39,6 +40,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
/**
* @generated
@@ -184,6 +186,42 @@ public class ShipEditPart extends ShapeNodeEditPart {
return super.getContentPane();
}
+ /**
+ * @generated
+ */
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setBackgroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setBackgroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineWidth(int width) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineWidth(getMapMode().DPtoLP(width));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineType(int style) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineStyle(style);
+ }
+ }
+
protected void addChildVisual(EditPart childEditPart, int index) {
if (childEditPart instanceof ShipNameEditPart) {
((ShipNameEditPart) childEditPart).setLabel(getPrimaryShape().getLabel());
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipRouteEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipRouteEditPart.java
index 7fbfdf062..0de36c26c 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipRouteEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/ShipRouteEditPart.java
@@ -15,13 +15,14 @@ import org.eclipse.draw2d.Connection;
import org.eclipse.gmf.examples.taipan.figures.DirectedConnection;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies.ShipRouteItemSemanticEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
-public class ShipRouteEditPart extends ConnectionNodeEditPart {
+public class ShipRouteEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
/**
* @generated
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/UnreliableRouteEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/UnreliableRouteEditPart.java
index e3336bf8b..32fb83084 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/UnreliableRouteEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/UnreliableRouteEditPart.java
@@ -16,13 +16,14 @@ import org.eclipse.gef.EditPart;
import org.eclipse.gmf.examples.taipan.figures.DashedConnection;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies.UnreliableRouteItemSemanticEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
/**
* @generated
*/
-public class UnreliableRouteEditPart extends ConnectionNodeEditPart {
+public class UnreliableRouteEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart {
/**
* @generated
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/WarshipEditPart.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/WarshipEditPart.java
index 1f02e55fe..bda2038ce 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/WarshipEditPart.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/parts/WarshipEditPart.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EcorePackage;
@@ -40,6 +41,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
/**
* @generated
@@ -186,6 +188,42 @@ public class WarshipEditPart extends ShapeNodeEditPart {
return super.getContentPane();
}
+ /**
+ * @generated
+ */
+ protected void setForegroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setForegroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setBackgroundColor(Color color) {
+ if (primaryShape != null) {
+ primaryShape.setBackgroundColor(color);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineWidth(int width) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineWidth(getMapMode().DPtoLP(width));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLineType(int style) {
+ if (primaryShape instanceof Shape) {
+ ((Shape) primaryShape).setLineStyle(style);
+ }
+ }
+
protected void addChildVisual(EditPart childEditPart, int index) {
if (childEditPart instanceof WarshipNameEditPart) {
((WarshipNameEditPart) childEditPart).setLabel(getPrimaryShape().getLabel());
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryCanonicalEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryCanonicalEditPolicy.java
index 121d80c0b..c5c78e865 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryCanonicalEditPolicy.java
@@ -93,7 +93,9 @@ public class AquatoryCanonicalEditPolicy extends CanonicalConnectionEditPolicy {
case PortEditPart.VISUAL_ID:
case ShipEditPart.VISUAL_ID:
case WarshipEditPart.VISUAL_ID:
- return !semanticChildren.contains(view.getElement()) || visualID != TaiPanVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
}
return false;
}
@@ -191,12 +193,13 @@ public class AquatoryCanonicalEditPolicy extends CanonicalConnectionEditPolicy {
EObject diagramLinkObject = nextDiagramLink.getElement();
EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
- for (Iterator LinkDescriptorsIterator = linkDescriptors.iterator(); LinkDescriptorsIterator.hasNext();) {
- TaiPanLinkDescriptor nextLinkDescriptor = (TaiPanLinkDescriptor) LinkDescriptorsIterator.next();
+ for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
+ TaiPanLinkDescriptor nextLinkDescriptor = (TaiPanLinkDescriptor) linkDescriptorsIterator.next();
if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination()
&& diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
linksIterator.remove();
- LinkDescriptorsIterator.remove();
+ linkDescriptorsIterator.remove();
+ break;
}
}
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryItemSemanticEditPolicy.java
index fabf5e678..69d5f8883 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/AquatoryItemSemanticEditPolicy.java
@@ -31,6 +31,13 @@ public class AquatoryItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPo
/**
* @generated
*/
+ public AquatoryItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Aquatory_1000);
+ }
+
+ /**
+ * @generated
+ */
protected Command getCreateCommand(CreateElementRequest req) {
if (TaiPanElementTypes.Port_2001 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/BesiegePortOrderItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/BesiegePortOrderItemSemanticEditPolicy.java
index f90400b76..1d689cc35 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/BesiegePortOrderItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/BesiegePortOrderItemSemanticEditPolicy.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
@@ -23,6 +24,13 @@ public class BesiegePortOrderItemSemanticEditPolicy extends TaiPanBaseItemSemant
/**
* @generated
*/
+ public BesiegePortOrderItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.BesiegePortOrder_4005);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
return getGEFWrapper(new DestroyElementCommand(req));
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EmptyBoxItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EmptyBoxItemSemanticEditPolicy.java
index 8552e9dc3..d6b688ac0 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EmptyBoxItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EmptyBoxItemSemanticEditPolicy.java
@@ -13,6 +13,7 @@ package org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
@@ -24,6 +25,13 @@ public class EmptyBoxItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPo
/**
* @generated
*/
+ public EmptyBoxItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.EmptyBox_3003);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
CompoundCommand cc = getDestroyEdgesCommand();
addDestroyShortcutsCommand(cc);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EscortShipsOrderItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EscortShipsOrderItemSemanticEditPolicy.java
index fca124d23..f0c29f2c6 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EscortShipsOrderItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/EscortShipsOrderItemSemanticEditPolicy.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
@@ -23,6 +24,13 @@ public class EscortShipsOrderItemSemanticEditPolicy extends TaiPanBaseItemSemant
/**
* @generated
*/
+ public EscortShipsOrderItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.EscortShipsOrder_4006);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
return getGEFWrapper(new DestroyElementCommand(req));
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/LargeItemItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/LargeItemItemSemanticEditPolicy.java
index 90e790a8e..fa4d6bcaa 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/LargeItemItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/LargeItemItemSemanticEditPolicy.java
@@ -13,6 +13,7 @@ package org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
@@ -24,6 +25,13 @@ public class LargeItemItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditP
/**
* @generated
*/
+ public LargeItemItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.LargeItem_3002);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
CompoundCommand cc = getDestroyEdgesCommand();
addDestroyShortcutsCommand(cc);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/OpenDiagramEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/OpenDiagramEditPolicy.java
index e047b9807..7e97aea76 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/OpenDiagramEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/OpenDiagramEditPolicy.java
@@ -125,6 +125,11 @@ public class OpenDiagramEditPolicy extends OpenEditPolicy {
diagramFacet.setDiagramLink(d);
assert diagramFacet.eResource() != null;
diagramFacet.eResource().getContents().add(d);
+ EObject container = diagramFacet.eContainer();
+ while (container instanceof View) {
+ ((View) container).persist();
+ container = container.eContainer();
+ }
try {
for (Iterator it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) {
Resource nextResource = (Resource) it.next();
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java
index 0f802fc5e..92b256ceb 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortItemSemanticEditPolicy.java
@@ -44,6 +44,13 @@ public class PortItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPolicy
/**
* @generated
*/
+ public PortItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Port_2001);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
CompoundCommand cc = getDestroyEdgesCommand();
addDestroyShortcutsCommand(cc);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortRegisterItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortRegisterItemSemanticEditPolicy.java
index ce3aec549..fc2f436ef 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortRegisterItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/PortRegisterItemSemanticEditPolicy.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
@@ -23,6 +24,13 @@ public class PortRegisterItemSemanticEditPolicy extends TaiPanBaseItemSemanticEd
/**
* @generated
*/
+ public PortRegisterItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.PortRegister_4007);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
return getGEFWrapper(new DestroyReferenceCommand(req));
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ReliableRouteItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ReliableRouteItemSemanticEditPolicy.java
index e95720e72..d795709f8 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ReliableRouteItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ReliableRouteItemSemanticEditPolicy.java
@@ -36,6 +36,13 @@ public class ReliableRouteItemSemanticEditPolicy extends TaiPanBaseItemSemanticE
/**
* @generated
*/
+ public ReliableRouteItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Route_4002);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
return getGEFWrapper(new DestroyElementCommand(req));
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipDestinationItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipDestinationItemSemanticEditPolicy.java
index 71b75874b..f62e38d53 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipDestinationItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipDestinationItemSemanticEditPolicy.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
@@ -23,6 +24,13 @@ public class ShipDestinationItemSemanticEditPolicy extends TaiPanBaseItemSemanti
/**
* @generated
*/
+ public ShipDestinationItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.ShipDestination_4001);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
return getGEFWrapper(new DestroyReferenceCommand(req));
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java
index 6bf7b8f6b..5bf8ec9b4 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipItemSemanticEditPolicy.java
@@ -51,6 +51,13 @@ public class ShipItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPolicy
/**
* @generated
*/
+ public ShipItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Ship_2002);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
CompoundCommand cc = getDestroyEdgesCommand();
addDestroyChildNodesCommand(cc);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoCanonicalEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoCanonicalEditPolicy.java
index 666ab1c7c..b8faeb039 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoCanonicalEditPolicy.java
@@ -57,7 +57,9 @@ public class ShipLargeCargoCanonicalEditPolicy extends CanonicalEditPolicy {
switch (visualID) {
case LargeItemEditPart.VISUAL_ID:
case EmptyBoxEditPart.VISUAL_ID:
- return !semanticChildren.contains(view.getElement()) || visualID != TaiPanVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
}
return false;
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoItemSemanticEditPolicy.java
index e41a3db52..0db37f8fb 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipLargeCargoItemSemanticEditPolicy.java
@@ -26,6 +26,13 @@ public class ShipLargeCargoItemSemanticEditPolicy extends TaiPanBaseItemSemantic
/**
* @generated
*/
+ public ShipLargeCargoItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Ship_2002);
+ }
+
+ /**
+ * @generated
+ */
protected Command getCreateCommand(CreateElementRequest req) {
if (TaiPanElementTypes.LargeItem_3002 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipRouteItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipRouteItemSemanticEditPolicy.java
index c46d6d0b8..e9ea8a936 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipRouteItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipRouteItemSemanticEditPolicy.java
@@ -12,6 +12,7 @@
package org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
@@ -23,6 +24,13 @@ public class ShipRouteItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditP
/**
* @generated
*/
+ public ShipRouteItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.ShipRoute_4004);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
return getGEFWrapper(new DestroyReferenceCommand(req));
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoCanonicalEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoCanonicalEditPolicy.java
index 736e24fac..9ad11a872 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoCanonicalEditPolicy.java
@@ -55,7 +55,9 @@ public class ShipSmallCargoCanonicalEditPolicy extends CanonicalEditPolicy {
int visualID = TaiPanVisualIDRegistry.getVisualID(view);
switch (visualID) {
case SmallItemsEditPart.VISUAL_ID:
- return !semanticChildren.contains(view.getElement()) || visualID != TaiPanVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
}
return false;
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoItemSemanticEditPolicy.java
index 05fbf4072..3733cc500 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/ShipSmallCargoItemSemanticEditPolicy.java
@@ -25,6 +25,13 @@ public class ShipSmallCargoItemSemanticEditPolicy extends TaiPanBaseItemSemantic
/**
* @generated
*/
+ public ShipSmallCargoItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Ship_2002);
+ }
+
+ /**
+ * @generated
+ */
protected Command getCreateCommand(CreateElementRequest req) {
if (TaiPanElementTypes.SmallItems_3001 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/SmallItemsItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/SmallItemsItemSemanticEditPolicy.java
index 057164ca8..4713d7e2d 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/SmallItemsItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/SmallItemsItemSemanticEditPolicy.java
@@ -13,6 +13,7 @@ package org.eclipse.gmf.examples.taipan.gmf.editor.edit.policies;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
@@ -24,6 +25,13 @@ public class SmallItemsItemSemanticEditPolicy extends TaiPanBaseItemSemanticEdit
/**
* @generated
*/
+ public SmallItemsItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.SmallItems_3001);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
CompoundCommand cc = getDestroyEdgesCommand();
addDestroyShortcutsCommand(cc);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/TaiPanBaseItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/TaiPanBaseItemSemanticEditPolicy.java
index 20c543f56..a90d76426 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/TaiPanBaseItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/TaiPanBaseItemSemanticEditPolicy.java
@@ -36,6 +36,7 @@ import org.eclipse.gmf.examples.taipan.gmf.editor.expressions.TaiPanAbstractExpr
import org.eclipse.gmf.examples.taipan.gmf.editor.expressions.TaiPanOCLFactory;
import org.eclipse.gmf.examples.taipan.gmf.editor.part.TaiPanDiagramEditorPlugin;
import org.eclipse.gmf.examples.taipan.gmf.editor.part.TaiPanVisualIDRegistry;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
@@ -77,6 +78,18 @@ public class TaiPanBaseItemSemanticEditPolicy extends SemanticEditPolicy {
public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
/**
+ * @generated
+ */
+ private final IElementType myElementType;
+
+ /**
+ * @generated
+ */
+ protected TaiPanBaseItemSemanticEditPolicy(IElementType elementType) {
+ myElementType = elementType;
+ }
+
+ /**
* Extended request data key to hold editpart visual id.
* Add visual id of edited editpart to extended data of the request
* so command switch can decide what kind of diagram element is being edited.
@@ -111,33 +124,8 @@ public class TaiPanBaseItemSemanticEditPolicy extends SemanticEditPolicy {
*/
protected Command getSemanticCommand(IEditCommandRequest request) {
IEditCommandRequest completedRequest = completeRequest(request);
- Object editHelperContext = completedRequest.getEditHelperContext();
- if (editHelperContext instanceof View || (editHelperContext instanceof IEditHelperContext && ((IEditHelperContext) editHelperContext).getEObject() instanceof View)) {
- // no semantic commands are provided for pure design elements
- return null;
- }
- if (editHelperContext == null) {
- editHelperContext = ViewUtil.resolveSemanticElement((View) getHost().getModel());
- }
- IElementType elementType = ElementTypeRegistry.getInstance().getElementType(editHelperContext);
- if (elementType == ElementTypeRegistry.getInstance().getType("org.eclipse.gmf.runtime.emf.type.core.default")) { //$NON-NLS-1$
- elementType = null;
- }
Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- if (semanticCommand != null) {
- ICommand command = semanticCommand instanceof ICommandProxy ? ((ICommandProxy) semanticCommand).getICommand() : new CommandProxy(semanticCommand);
- completedRequest.setParameter(TaiPanBaseEditHelper.EDIT_POLICY_COMMAND, command);
- }
- if (elementType != null) {
- ICommand command = elementType.getEditCommand(completedRequest);
- if (command != null) {
- if (!(command instanceof CompositeTransactionalCommand)) {
- TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- command = new CompositeTransactionalCommand(editingDomain, command.getLabel()).compose(command);
- }
- semanticCommand = new ICommandProxy(command);
- }
- }
+ semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
boolean shouldProceed = true;
if (completedRequest instanceof DestroyRequest) {
shouldProceed = shouldProceed((DestroyRequest) completedRequest);
@@ -156,6 +144,37 @@ public class TaiPanBaseItemSemanticEditPolicy extends SemanticEditPolicy {
/**
* @generated
*/
+ private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
+ if (editPolicyCommand != null) {
+ ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
+ request.setParameter(TaiPanBaseEditHelper.EDIT_POLICY_COMMAND, command);
+ }
+ IElementType requestContextElementType = getContextElementType(request);
+ request.setParameter(TaiPanBaseEditHelper.CONTEXT_ELEMENT_TYPE, requestContextElementType);
+ ICommand command = requestContextElementType.getEditCommand(request);
+ request.setParameter(TaiPanBaseEditHelper.EDIT_POLICY_COMMAND, null);
+ request.setParameter(TaiPanBaseEditHelper.CONTEXT_ELEMENT_TYPE, null);
+ if (command != null) {
+ if (!(command instanceof CompositeTransactionalCommand)) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ command = new CompositeTransactionalCommand(editingDomain, command.getLabel()).compose(command);
+ }
+ return new ICommandProxy(command);
+ }
+ return editPolicyCommand;
+ }
+
+ /**
+ * @generated
+ */
+ private IElementType getContextElementType(IEditCommandRequest request) {
+ IElementType requestContextElementType = TaiPanElementTypes.getElementType(getVisualID(request));
+ return requestContextElementType != null ? requestContextElementType : myElementType;
+ }
+
+ /**
+ * @generated
+ */
protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
if (req instanceof CreateRelationshipRequest) {
return getCreateRelationshipCommand((CreateRelationshipRequest) req);
@@ -350,46 +369,17 @@ public class TaiPanBaseItemSemanticEditPolicy extends SemanticEditPolicy {
/**
* @generated
*/
- private static final TaiPanAbstractExpression BesiegePortOrder_4005_SourceExpression;
-
- /**
- * @generated
- */
- static {
- Map env = new HashMap(3);
- env.put(OPPOSITE_END_VAR, TaiPanPackage.eINSTANCE.getPort());
- BesiegePortOrder_4005_SourceExpression = TaiPanOCLFactory
- .getExpression("self.attackOrders->select(order | order.port = oppositeEnd)->isEmpty()", TaiPanPackage.eINSTANCE.getWarship(), env); //$NON-NLS-1$
- }
-
- /**
- * @generated
- */
- private static final TaiPanAbstractExpression EscortShipsOrder_4006_SourceExpression;
-
- /**
- * @generated
- */
- static {
- Map env = new HashMap(3);
- env.put(OPPOSITE_END_VAR, TaiPanPackage.eINSTANCE.getShip());
- EscortShipsOrder_4006_SourceExpression = TaiPanOCLFactory.getExpression(
- "self.escortOrder->isEmpty() or self.escortOrder.ships->select(ship | ship = oppositeEnd)->isEmpty()", TaiPanPackage.eINSTANCE.getWarship(), env); //$NON-NLS-1$
- }
+ private static TaiPanAbstractExpression BesiegePortOrder_4005_SourceExpression;
/**
* @generated
*/
- private static final TaiPanAbstractExpression EscortShipsOrder_4006_TargetExpression;
+ private static TaiPanAbstractExpression EscortShipsOrder_4006_SourceExpression;
/**
* @generated
*/
- static {
- Map env = new HashMap(3);
- env.put(OPPOSITE_END_VAR, TaiPanPackage.eINSTANCE.getWarship());
- EscortShipsOrder_4006_TargetExpression = TaiPanOCLFactory.getExpression("not self.oclIsKindOf(Warship)", TaiPanPackage.eINSTANCE.getShip(), env); //$NON-NLS-1$
- }
+ private static TaiPanAbstractExpression EscortShipsOrder_4006_TargetExpression;
/**
* @generated
@@ -400,6 +390,7 @@ public class TaiPanBaseItemSemanticEditPolicy extends SemanticEditPolicy {
return false;
}
}
+
return canExistShipDestination_4001(source, target);
}
@@ -426,6 +417,7 @@ public class TaiPanBaseItemSemanticEditPolicy extends SemanticEditPolicy {
return false;
}
}
+
return canExistShipRoute_4004(source, target);
}
@@ -457,6 +449,7 @@ public class TaiPanBaseItemSemanticEditPolicy extends SemanticEditPolicy {
return false;
}
}
+
return canExistPortRegister_4007(source, target);
}
@@ -492,43 +485,55 @@ public class TaiPanBaseItemSemanticEditPolicy extends SemanticEditPolicy {
* @generated
*/
public static boolean canExistBesiegePortOrder_4005(Warship source, Port target) {
- if (!evaluate(BesiegePortOrder_4005_SourceExpression, source, target, false)) {
+ try {
+ if (source == null) {
+ return true;
+ }
+ if (BesiegePortOrder_4005_SourceExpression == null) {
+ Map env = Collections.singletonMap(OPPOSITE_END_VAR, TaiPanPackage.eINSTANCE.getPort());
+ BesiegePortOrder_4005_SourceExpression = TaiPanOCLFactory.getExpression(
+ "self.attackOrders->select(order | order.port = oppositeEnd)->isEmpty()", TaiPanPackage.eINSTANCE.getWarship(), env); //$NON-NLS-1$
+ }
+ Object sourceVal = BesiegePortOrder_4005_SourceExpression.evaluate(source, Collections.singletonMap(OPPOSITE_END_VAR, target));
+ if (false == sourceVal instanceof Boolean || !((Boolean) sourceVal).booleanValue()) {
+ return false;
+ } // else fall-through
+ return true;
+ } catch (Exception e) {
+ TaiPanDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
return false;
}
- return true;
}
/**
* @generated
*/
public static boolean canExistEscortShipsOrder_4006(Warship source, Ship target) {
- if (!evaluate(EscortShipsOrder_4006_SourceExpression, source, target, false)) {
- return false;
- }
- if (!evaluate(EscortShipsOrder_4006_TargetExpression, target, source, true)) {
- return false;
- }
- return true;
- }
-
- /**
- * @generated
- */
- public static boolean canExistPortRegister_4007(Port source, Ship target) {
- return true;
- }
-
- /**
- * @generated
- */
- private static boolean evaluate(TaiPanAbstractExpression constraint, Object sourceEnd, Object oppositeEnd, boolean clearEnv) {
- if (sourceEnd == null) {
- return true;
- }
- Map evalEnv = Collections.singletonMap(OPPOSITE_END_VAR, oppositeEnd);
try {
- Object val = constraint.evaluate(sourceEnd, evalEnv);
- return (val instanceof Boolean) ? ((Boolean) val).booleanValue() : false;
+ if (source == null) {
+ return true;
+ }
+ if (EscortShipsOrder_4006_SourceExpression == null) {
+ Map env = Collections.singletonMap(OPPOSITE_END_VAR, TaiPanPackage.eINSTANCE.getShip());
+ EscortShipsOrder_4006_SourceExpression = TaiPanOCLFactory.getExpression(
+ "self.escortOrder->isEmpty() or self.escortOrder.ships->select(ship | ship = oppositeEnd)->isEmpty()", TaiPanPackage.eINSTANCE.getWarship(), env); //$NON-NLS-1$
+ }
+ Object sourceVal = EscortShipsOrder_4006_SourceExpression.evaluate(source, Collections.singletonMap(OPPOSITE_END_VAR, target));
+ if (false == sourceVal instanceof Boolean || !((Boolean) sourceVal).booleanValue()) {
+ return false;
+ } // else fall-through
+ if (target == null) {
+ return true;
+ }
+ if (EscortShipsOrder_4006_TargetExpression == null) {
+ Map env = Collections.singletonMap(OPPOSITE_END_VAR, TaiPanPackage.eINSTANCE.getWarship());
+ EscortShipsOrder_4006_TargetExpression = TaiPanOCLFactory.getExpression("not self.oclIsKindOf(Warship)", TaiPanPackage.eINSTANCE.getShip(), env); //$NON-NLS-1$
+ }
+ Object targetVal = EscortShipsOrder_4006_TargetExpression.evaluate(target, Collections.singletonMap(OPPOSITE_END_VAR, source));
+ if (false == targetVal instanceof Boolean || !((Boolean) targetVal).booleanValue()) {
+ return false;
+ } // else fall-through
+ return true;
} catch (Exception e) {
TaiPanDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
return false;
@@ -538,8 +543,8 @@ public class TaiPanBaseItemSemanticEditPolicy extends SemanticEditPolicy {
/**
* @generated
*/
- private static class JavaConstraints {
-
+ public static boolean canExistPortRegister_4007(Port source, Ship target) {
+ return true;
}
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/UnreliableRouteItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/UnreliableRouteItemSemanticEditPolicy.java
index 10257cb37..ce6351d83 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/UnreliableRouteItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/UnreliableRouteItemSemanticEditPolicy.java
@@ -36,6 +36,13 @@ public class UnreliableRouteItemSemanticEditPolicy extends TaiPanBaseItemSemanti
/**
* @generated
*/
+ public UnreliableRouteItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Route_4003);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
return getGEFWrapper(new DestroyElementCommand(req));
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java
index cd8bdcc55..3b1906ecd 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipItemSemanticEditPolicy.java
@@ -54,6 +54,13 @@ public class WarshipItemSemanticEditPolicy extends TaiPanBaseItemSemanticEditPol
/**
* @generated
*/
+ public WarshipItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Warship_2003);
+ }
+
+ /**
+ * @generated
+ */
protected Command getDestroyElementCommand(DestroyElementRequest req) {
CompoundCommand cc = getDestroyEdgesCommand();
addDestroyChildNodesCommand(cc);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoCanonicalEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoCanonicalEditPolicy.java
index 7abcdb4eb..52c7cfe34 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoCanonicalEditPolicy.java
@@ -57,7 +57,9 @@ public class WarshipLargeCargoCanonicalEditPolicy extends CanonicalEditPolicy {
switch (visualID) {
case LargeItemEditPart.VISUAL_ID:
case EmptyBoxEditPart.VISUAL_ID:
- return !semanticChildren.contains(view.getElement()) || visualID != TaiPanVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
}
return false;
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoItemSemanticEditPolicy.java
index fc35f1c90..831187439 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipLargeCargoItemSemanticEditPolicy.java
@@ -26,6 +26,13 @@ public class WarshipLargeCargoItemSemanticEditPolicy extends TaiPanBaseItemSeman
/**
* @generated
*/
+ public WarshipLargeCargoItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Warship_2003);
+ }
+
+ /**
+ * @generated
+ */
protected Command getCreateCommand(CreateElementRequest req) {
if (TaiPanElementTypes.LargeItem_3002 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoCanonicalEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoCanonicalEditPolicy.java
index 9307d2c49..6666844c9 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoCanonicalEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoCanonicalEditPolicy.java
@@ -55,7 +55,9 @@ public class WarshipSmallCargoCanonicalEditPolicy extends CanonicalEditPolicy {
int visualID = TaiPanVisualIDRegistry.getVisualID(view);
switch (visualID) {
case SmallItemsEditPart.VISUAL_ID:
- return !semanticChildren.contains(view.getElement()) || visualID != TaiPanVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
}
return false;
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoItemSemanticEditPolicy.java
index 7d51fa485..2c357c0f9 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/edit/policies/WarshipSmallCargoItemSemanticEditPolicy.java
@@ -25,6 +25,13 @@ public class WarshipSmallCargoItemSemanticEditPolicy extends TaiPanBaseItemSeman
/**
* @generated
*/
+ public WarshipSmallCargoItemSemanticEditPolicy() {
+ super(TaiPanElementTypes.Warship_2003);
+ }
+
+ /**
+ * @generated
+ */
protected Command getCreateCommand(CreateElementRequest req) {
if (TaiPanElementTypes.SmallItems_3001 == req.getElementType()) {
if (req.getContainmentFeature() == null) {
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanAbstractExpression.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanAbstractExpression.java
index 2540621d2..54f09df5a 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanAbstractExpression.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanAbstractExpression.java
@@ -24,6 +24,9 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.ETypedElement;
@@ -40,37 +43,14 @@ public abstract class TaiPanAbstractExpression {
/**
* @generated
*/
- private static final boolean DISABLED_NO_IMPL_EXCEPTION_LOG = Boolean.valueOf(
- Platform.getDebugOption(TaiPanDiagramEditorPlugin.getInstance().getBundle().getSymbolicName() + "/debug/disableNoExprImplExceptionLog")).booleanValue();
-
- /**
- * @generated
- */
- private final String body;
-
- /**
- * @generated
- */
- private final EClassifier context;
-
- /**
- * @generated
- */
private IStatus status = Status.OK_STATUS;
/**
* @generated
*/
- protected TaiPanAbstractExpression(EClassifier context) {
- this(null, context);
- }
-
- /**
- * @generated
- */
protected TaiPanAbstractExpression(String body, EClassifier context) {
- this.body = body;
- this.context = context;
+ myBody = body;
+ myContext = context;
}
/**
@@ -80,7 +60,7 @@ public abstract class TaiPanAbstractExpression {
String pluginID = TaiPanDiagramEditorPlugin.ID;
this.status = new Status(severity, pluginID, -1, (message != null) ? message : "", throwable); //$NON-NLS-1$
if (!this.status.isOK()) {
- TaiPanDiagramEditorPlugin.getInstance().logError("Expression problem: " + message + " body: " + body, throwable); //$NON-NLS-1$ //$NON-NLS-2$
+ TaiPanDiagramEditorPlugin.getInstance().logError("Expression problem:" + message + "body:" + body(), throwable); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -104,121 +84,85 @@ public abstract class TaiPanAbstractExpression {
try {
return doEvaluate(context, env);
} catch (Exception e) {
- if (DISABLED_NO_IMPL_EXCEPTION_LOG && e instanceof NoImplException) {
- return null;
- }
- TaiPanDiagramEditorPlugin.getInstance().logError("Expression evaluation failure: " + body, e);
+ TaiPanDiagramEditorPlugin.getInstance().logError("Expression evaluation failure: " + body(), e);//$NON-NLS-1$
}
}
return null;
}
/**
+ * Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected
* @generated
*/
- public IStatus getStatus() {
- return status;
- }
-
- /**
- * @generated
- */
- public String body() {
- return body;
+ public static Object performCast(Object value, EDataType targetType) {
+ if (targetType instanceof EEnum) {
+ if (value instanceof EEnumLiteral) {
+ EEnumLiteral literal = (EEnumLiteral) value;
+ return (literal.getInstance() != null) ? literal.getInstance() : literal;
+ }
+ }
+ if (false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) {
+ return value;
+ }
+ Class targetClass = targetType.getInstanceClass();
+ Number num = (Number) value;
+ Class valClass = value.getClass();
+ Class targetWrapperClass = targetClass;
+ if (targetClass.isPrimitive()) {
+ targetWrapperClass = EcoreUtil.wrapperClassFor(targetClass);
+ }
+ if (valClass.equals(targetWrapperClass)) {
+ return value;
+ }
+ if (Number.class.isAssignableFrom(targetWrapperClass)) {
+ if (targetWrapperClass.equals(Byte.class))
+ return new Byte(num.byteValue());
+ if (targetWrapperClass.equals(Integer.class))
+ return new Integer(num.intValue());
+ if (targetWrapperClass.equals(Short.class))
+ return new Short(num.shortValue());
+ if (targetWrapperClass.equals(Long.class))
+ return new Long(num.longValue());
+ if (targetWrapperClass.equals(BigInteger.class))
+ return BigInteger.valueOf(num.longValue());
+ if (targetWrapperClass.equals(Float.class))
+ return new Float(num.floatValue());
+ if (targetWrapperClass.equals(Double.class))
+ return new Double(num.doubleValue());
+ if (targetWrapperClass.equals(BigDecimal.class))
+ return new BigDecimal(num.doubleValue());
+ }
+ return value;
}
/**
* @generated
*/
- public EClassifier context() {
- return context;
+ public IStatus getStatus() {
+ return status;
}
/**
* @generated
*/
- public void assignTo(EStructuralFeature feature, EObject target) {
- Object value = evaluate(target);
- value = (value != null) ? performCast(value, feature) : null;
- if (feature.isMany()) {
- Collection destCollection = (Collection) target.eGet(feature);
- destCollection.clear();
- if (value instanceof Collection) {
- Collection valueCollection = (Collection) value;
- for (Iterator it = valueCollection.iterator(); it.hasNext();) {
- destCollection.add(performCast(it.next(), feature));
- }
- } else {
- destCollection.add(value);
- }
- return;
- }
- target.eSet(feature, value);
- }
+ private final String myBody;
/**
* @generated
*/
- protected Object performCast(Object value, ETypedElement targetType) {
- if (targetType.getEType() == null || targetType.getEType().getInstanceClass() == null) {
- return value;
- }
- Class targetClass = targetType.getEType().getInstanceClass();
- if (value != null && value instanceof Number) {
- Number num = (Number) value;
- Class valClass = value.getClass();
- Class targetWrapperClass = targetClass;
- if (targetClass.isPrimitive()) {
- targetWrapperClass = EcoreUtil.wrapperClassFor(targetClass);
- }
- if (valClass.equals(targetWrapperClass)) {
- return value;
- }
- if (Number.class.isAssignableFrom(targetWrapperClass)) {
- if (targetWrapperClass.equals(Byte.class))
- return new Byte(num.byteValue());
- if (targetWrapperClass.equals(Integer.class))
- return new Integer(num.intValue());
- if (targetWrapperClass.equals(Short.class))
- return new Short(num.shortValue());
- if (targetWrapperClass.equals(Long.class))
- return new Long(num.longValue());
- if (targetWrapperClass.equals(BigInteger.class))
- return BigInteger.valueOf(num.longValue());
- if (targetWrapperClass.equals(Float.class))
- return new Float(num.floatValue());
- if (targetWrapperClass.equals(Double.class))
- return new Double(num.doubleValue());
- if (targetWrapperClass.equals(BigDecimal.class))
- return new BigDecimal(num.doubleValue());
- }
- }
- return value;
+ public String body() {
+ return myBody;
}
/**
* @generated
*/
- public static final TaiPanAbstractExpression createNullExpression(EClassifier context) {
- return new TaiPanAbstractExpression(context) {
-
- protected Object doEvaluate(Object context, Map env) {
- // TODO - log entry about not provider available for this expression
- return null;
- }
- };
- }
+ private final EClassifier myContext;
/**
* @generated
*/
- public static class NoImplException extends RuntimeException {
-
- /**
- * @generated
- */
- public NoImplException(String message) {
- super(message);
- }
+ public EClassifier context() {
+ return myContext;
}
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanOCLFactory.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanOCLFactory.java
index cebab02d9..99c4403bc 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanOCLFactory.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/expressions/TaiPanOCLFactory.java
@@ -140,19 +140,6 @@ public class TaiPanOCLFactory {
/**
* @generated
*/
- protected Object performCast(Object value, ETypedElement targetType) {
- if (targetType.getEType() instanceof EEnum) {
- if (value instanceof EEnumLiteral) {
- EEnumLiteral literal = (EEnumLiteral) value;
- return (literal.getInstance() != null) ? literal.getInstance() : literal;
- }
- }
- return super.performCast(value, targetType);
- }
-
- /**
- * @generated
- */
private void initExtentMap(Object context) {
if (!getStatus().isOK() || context == null) {
return;
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/DeleteElementAction.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/DeleteElementAction.java
new file mode 100644
index 000000000..f9d60a37c
--- /dev/null
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/DeleteElementAction.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2006, 2007 Borland Software Corporation
+ *
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.examples.taipan.gmf.editor.part;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.diagram.ui.actions.AbstractDeleteFromAction;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @generated
+ */
+public class DeleteElementAction extends AbstractDeleteFromAction {
+
+ /**
+ * @generated
+ */
+ public DeleteElementAction(IWorkbenchPart part) {
+ super(part);
+ }
+
+ /**
+ * @generated
+ */
+ public DeleteElementAction(IWorkbenchPage workbenchPage) {
+ super(workbenchPage);
+ }
+
+ /**
+ * @generated
+ */
+ public void init() {
+ super.init();
+ setId(ActionIds.ACTION_DELETE_FROM_MODEL);
+ setText(DiagramUIMessages.DiagramEditor_Delete_from_Model);
+ setToolTipText(DiagramUIMessages.DiagramEditor_Delete_from_ModelToolTip);
+ ISharedImages workbenchImages = PlatformUI.getWorkbench().getSharedImages();
+ setHoverImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ setImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ setDisabledImageDescriptor(workbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
+ }
+
+ /**
+ * @generated
+ */
+ protected String getCommandLabel() {
+ return DiagramUIMessages.DiagramEditor_Delete_from_Model;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCommand(Request request) {
+ List operationSet = getOperationSet();
+ if (operationSet.isEmpty()) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ Iterator editParts = operationSet.iterator();
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(getEditingDomain(), getCommandLabel());
+ while (editParts.hasNext()) {
+ EditPart editPart = (EditPart) editParts.next();
+ Command curCommand = editPart.getCommand(request);
+ if (curCommand != null) {
+ command.compose(new CommandProxy(curCommand));
+ }
+ }
+ if (command.isEmpty() || command.size() != operationSet.size()) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return new ICommandProxy(command);
+ }
+}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/DiagramEditorContextMenuProvider.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/DiagramEditorContextMenuProvider.java
new file mode 100644
index 000000000..1ed21b108
--- /dev/null
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/DiagramEditorContextMenuProvider.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2006, 2007 Borland Software Corporation
+ *
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+package org.eclipse.gmf.examples.taipan.gmf.editor.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
+import org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class DiagramEditorContextMenuProvider extends DiagramContextMenuProvider {
+
+ /**
+ * @generated
+ */
+ private IWorkbenchPart part;
+
+ /**
+ * @generated
+ */
+ private DeleteElementAction deleteAction;
+
+ /**
+ * @generated
+ */
+ public DiagramEditorContextMenuProvider(IWorkbenchPart part, EditPartViewer viewer) {
+ super(part, viewer);
+ this.part = part;
+ deleteAction = new DeleteElementAction(part);
+ deleteAction.init();
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ if (deleteAction != null) {
+ deleteAction.dispose();
+ deleteAction = null;
+ }
+ super.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public void buildContextMenu(final IMenuManager menu) {
+ getViewer().flush();
+ try {
+ TransactionUtil.getEditingDomain((EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
+
+ public void run() {
+ ContributionItemService.getInstance().contributeToPopupMenu(DiagramEditorContextMenuProvider.this, part);
+ menu.remove(ActionIds.ACTION_DELETE_FROM_MODEL);
+ menu.appendToGroup("editGroup", deleteAction);
+ }
+ });
+ } catch (Exception e) {
+ TaiPanDiagramEditorPlugin.getInstance().logError("Error building context menu", e);
+ }
+ }
+}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanCreationWizard.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanCreationWizard.java
index 1069e5b3e..c01883968 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanCreationWizard.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanCreationWizard.java
@@ -114,7 +114,17 @@ public class TaiPanCreationWizard extends Wizard implements INewWizard {
diagramModelFilePage.setDescription(Messages.TaiPanCreationWizard_DiagramModelFilePageDescription);
addPage(diagramModelFilePage);
- domainModelFilePage = new TaiPanCreationWizardPage("DomainModelFile", getSelection(), "taipan"); //$NON-NLS-1$ //$NON-NLS-2$
+ domainModelFilePage = new TaiPanCreationWizardPage("DomainModelFile", getSelection(), "taipan") { //$NON-NLS-1$ //$NON-NLS-2$
+
+ public void setVisible(boolean visible) {
+ if (visible) {
+ String fileName = diagramModelFilePage.getFileName();
+ fileName = fileName.substring(0, fileName.length() - ".taipan_diagram".length()); //$NON-NLS-1$
+ setFileName(TaiPanDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), fileName, "taipan")); //$NON-NLS-1$
+ }
+ super.setVisible(visible);
+ }
+ };
domainModelFilePage.setTitle(Messages.TaiPanCreationWizard_DomainModelFilePageTitle);
domainModelFilePage.setDescription(Messages.TaiPanCreationWizard_DomainModelFilePageDescription);
addPage(domainModelFilePage);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDiagramEditor.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDiagramEditor.java
index 40ff3b517..0e22e3900 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDiagramEditor.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDiagramEditor.java
@@ -27,6 +27,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds;
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener;
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
@@ -125,6 +126,16 @@ public class TaiPanDiagramEditor extends DiagramDocumentEditor {
/**
* @generated
*/
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
+ getDiagramGraphicalViewer().setContextMenu(provider);
+ getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
+ }
+
+ /**
+ * @generated
+ */
protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();
getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDocumentProvider.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDocumentProvider.java
index 502ce8acc..ce849d1a2 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDocumentProvider.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanDocumentProvider.java
@@ -13,6 +13,7 @@ package org.eclipse.gmf.examples.taipan.gmf.editor.part;
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -107,7 +108,7 @@ public class TaiPanDocumentProvider extends AbstractDocumentProvider implements
*/
private long computeModificationStamp(ResourceSetInfo info) {
int result = 0;
- for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
Resource nextResource = (Resource) it.next();
File file = getFile(nextResource);
if (file != null && file.exists()) {
@@ -315,7 +316,7 @@ public class TaiPanDocumentProvider extends AbstractDocumentProvider implements
protected void updateCache(Object element) throws CoreException {
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
- for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
Resource nextResource = (Resource) it.next();
File file = getFile(nextResource);
if (file != null && file.exists() && !file.canWrite()) {
@@ -358,7 +359,7 @@ public class TaiPanDocumentProvider extends AbstractDocumentProvider implements
protected void doSynchronize(Object element, IProgressMonitor monitor) throws CoreException {
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
- for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
Resource nextResource = (Resource) it.next();
handleElementChanged(info, nextResource, monitor);
}
@@ -377,10 +378,9 @@ public class TaiPanDocumentProvider extends AbstractDocumentProvider implements
throw new CoreException(new Status(IStatus.ERROR, TaiPanDiagramEditorPlugin.ID, IStatus.ERROR, Messages.TaiPanDocumentProvider_UnsynchronizedFileSaveError, null));
}
fireElementStateChanging(element);
- List resources = info.getResourceSet().getResources();
try {
- monitor.beginTask(Messages.TaiPanDocumentProvider_SaveDiagramTask, resources.size() + 1); //"Saving diagram"
- for (Iterator it = resources.iterator(); it.hasNext();) {
+ monitor.beginTask(Messages.TaiPanDocumentProvider_SaveDiagramTask, info.getResourceSet().getResources().size() + 1); //"Saving diagram"
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = info.getLoadedResourcesIterator(); it.hasNext();) {
Resource nextResource = (Resource) it.next();
monitor.setTaskName(NLS.bind(Messages.TaiPanDocumentProvider_SaveNextResourceTask, nextResource.getURI()));
if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
@@ -589,6 +589,13 @@ public class TaiPanDocumentProvider extends AbstractDocumentProvider implements
/**
* @generated
*/
+ public Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/getLoadedResourcesIterator() {
+ return new ArrayList/*<org.eclipse.emf.ecore.resource.Resource>*/(getResourceSet().getResources()).iterator();
+ }
+
+ /**
+ * @generated
+ */
public IEditorInput getEditorInput() {
return myEditorInput;
}
@@ -598,7 +605,7 @@ public class TaiPanDocumentProvider extends AbstractDocumentProvider implements
*/
public void dispose() {
getResourceSet().eAdapters().remove(myResourceSetListener);
- for (Iterator it = getResourceSet().getResources().iterator(); it.hasNext();) {
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = getLoadedResourcesIterator(); it.hasNext();) {
Resource resource = (Resource) it.next();
resource.unload();
}
@@ -691,7 +698,7 @@ public class TaiPanDocumentProvider extends AbstractDocumentProvider implements
Resource resource = (Resource) notification.getNotifier();
if (resource.isLoaded()) {
boolean modified = false;
- for (Iterator it = myInfo.getResourceSet().getResources().iterator(); it.hasNext() && !modified;) {
+ for (Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
Resource nextResource = (Resource) it.next();
if (nextResource.isLoaded()) {
modified = nextResource.isModified();
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanVisualIDRegistry.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanVisualIDRegistry.java
index 6344582b5..862c9f1a5 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanVisualIDRegistry.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/TaiPanVisualIDRegistry.java
@@ -15,6 +15,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.examples.taipan.Aquatory;
+import org.eclipse.gmf.examples.taipan.Route;
import org.eclipse.gmf.examples.taipan.TaiPanPackage;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.AquatoryEditPart;
import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.BesiegePortOrderEditPart;
@@ -59,22 +60,17 @@ public class TaiPanVisualIDRegistry {
/**
* @generated
*/
- private static final String DEBUG_KEY = TaiPanDiagramEditorPlugin.getInstance().getBundle().getSymbolicName() + "/debug/visualID"; //$NON-NLS-1$
+ private static final String DEBUG_KEY = "org.eclipse.gmf.examples.taipan.gmf.editor.rcp/debug/visualID"; //$NON-NLS-1$
/**
* @generated
*/
- private static final TaiPanAbstractExpression Ship_2002_Constraint = TaiPanOCLFactory.getExpression("not oclIsKindOf(taipan::Warship)", TaiPanPackage.eINSTANCE.getShip());
+ private static TaiPanAbstractExpression Route_4002_Constraint;
/**
* @generated
*/
- private static final TaiPanAbstractExpression Route_4002_Constraint = TaiPanOCLFactory.getExpression("reliability >= 0.5", TaiPanPackage.eINSTANCE.getRoute());
-
- /**
- * @generated
- */
- private static final TaiPanAbstractExpression Route_4003_Constraint = TaiPanOCLFactory.getExpression("reliability < 0.5", TaiPanPackage.eINSTANCE.getRoute());
+ private static TaiPanAbstractExpression Route_4003_Constraint;
/**
* @generated
@@ -191,7 +187,7 @@ public class TaiPanVisualIDRegistry {
if (TaiPanPackage.eINSTANCE.getPort().isSuperTypeOf(domainElement.eClass())) {
return PortEditPart.VISUAL_ID;
}
- if (TaiPanPackage.eINSTANCE.getShip().isSuperTypeOf(domainElement.eClass()) && evaluate(Ship_2002_Constraint, domainElement)) {
+ if (TaiPanPackage.eINSTANCE.getShip().isSuperTypeOf(domainElement.eClass())) {
return ShipEditPart.VISUAL_ID;
}
if (TaiPanPackage.eINSTANCE.getWarship().isSuperTypeOf(domainElement.eClass())) {
@@ -325,10 +321,10 @@ public class TaiPanVisualIDRegistry {
if (domainElement == null) {
return -1;
}
- if (TaiPanPackage.eINSTANCE.getRoute().isSuperTypeOf(domainElement.eClass()) && evaluate(Route_4002_Constraint, domainElement)) {
+ if (TaiPanPackage.eINSTANCE.getRoute().isSuperTypeOf(domainElement.eClass()) && isRoute_4002((Route) domainElement)) {
return ReliableRouteEditPart.VISUAL_ID;
}
- if (TaiPanPackage.eINSTANCE.getRoute().isSuperTypeOf(domainElement.eClass()) && evaluate(Route_4003_Constraint, domainElement)) {
+ if (TaiPanPackage.eINSTANCE.getRoute().isSuperTypeOf(domainElement.eClass()) && isRoute_4003((Route) domainElement)) {
return UnreliableRouteEditPart.VISUAL_ID;
}
if (TaiPanPackage.eINSTANCE.getBesiegePortOrder().isSuperTypeOf(domainElement.eClass())) {
@@ -353,16 +349,23 @@ public class TaiPanVisualIDRegistry {
/**
* @generated
*/
- private static boolean evaluate(TaiPanAbstractExpression expression, Object element) {
- Object result = expression.evaluate(element);
+ private static boolean isRoute_4002(Route domainElement) {
+ if (Route_4002_Constraint == null) { // lazy initialization
+ Route_4002_Constraint = TaiPanOCLFactory.getExpression("reliability >= 0.5", TaiPanPackage.eINSTANCE.getRoute()); //$NON-NLS-1$
+ }
+ Object result = Route_4002_Constraint.evaluate(domainElement);
return result instanceof Boolean && ((Boolean) result).booleanValue();
}
/**
* @generated
*/
- private static class JavaConstraints {
-
+ private static boolean isRoute_4003(Route domainElement) {
+ if (Route_4003_Constraint == null) { // lazy initialization
+ Route_4003_Constraint = TaiPanOCLFactory.getExpression("reliability < 0.5", TaiPanPackage.eINSTANCE.getRoute()); //$NON-NLS-1$
+ }
+ Object result = Route_4003_Constraint.evaluate(domainElement);
+ return result instanceof Boolean && ((Boolean) result).booleanValue();
}
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/ValidateAction.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/ValidateAction.java
index 70bcde992..537593c33 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/ValidateAction.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/part/ValidateAction.java
@@ -24,6 +24,8 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.emf.validation.model.EvaluationMode;
import org.eclipse.emf.validation.model.IConstraintStatus;
import org.eclipse.emf.validation.service.IBatchValidator;
@@ -119,7 +121,8 @@ public class ValidateAction extends Action {
public static void runValidation(DiagramEditPart diagramEditPart, View view) {
final DiagramEditPart fpart = diagramEditPart;
final View fview = view;
- TaiPanValidationProvider.runWithConstraints(view, new Runnable() {
+ TransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(view);
+ TaiPanValidationProvider.runWithConstraints(txDomain, new Runnable() {
public void run() {
validate(fpart, fview);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/preferences/DiagramPreferenceInitializer.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/preferences/DiagramPreferenceInitializer.java
index 150b31bdd..4290f4548 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/preferences/DiagramPreferenceInitializer.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/preferences/DiagramPreferenceInitializer.java
@@ -52,6 +52,7 @@ public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer
store.setDefault(IPreferenceConstants.PREF_RULER_UNITS, false);
store.setDefault(IPreferenceConstants.PREF_SHOW_GRID, RulerProvider.UNIT_PIXELS);
store.setDefault(IPreferenceConstants.PREF_SNAP_TO_GRID, false);
+ store.setDefault(IPreferenceConstants.PREF_SNAP_TO_GEOMETRY, false);
store.setDefault(IPreferenceConstants.PREF_GRID_SPACING, 0.125);
store.setDefault(IPreferenceConstants.PREF_PROMPT_ON_DEL_FROM_MODEL, false);
store.setDefault(IPreferenceConstants.PREF_PROMPT_ON_DEL_FROM_DIAGRAM, false);
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/properties/TaiPanPropertiesLabelProvider.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/properties/TaiPanPropertiesLabelProvider.java
index 7db4141aa..c037525a2 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/properties/TaiPanPropertiesLabelProvider.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/properties/TaiPanPropertiesLabelProvider.java
@@ -15,36 +15,36 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.examples.taipan.gmf.editor.part.TaiPanDiagramEditorPlugin;
+import org.eclipse.gmf.examples.taipan.gmf.editor.part.TaiPanVisualIDRegistry;
+import org.eclipse.gmf.examples.taipan.gmf.editor.providers.TaiPanElementTypes;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.graphics.Image;
/**
* @generated
*/
-public class TaiPanPropertiesLabelProvider extends DecoratingLabelProvider {
-
- /**
- * @generated
- */
- public TaiPanPropertiesLabelProvider() {
- super(new AdapterFactoryLabelProvider(TaiPanDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()), null);
- }
+public class TaiPanPropertiesLabelProvider extends BaseLabelProvider implements ILabelProvider {
/**
* @generated
*/
public String getText(Object element) {
- Object selected = unwrap(element);
- return super.getText(selected);
+ element = unwrap(element);
+ IElementType etype = getElementType(getView(element));
+ return etype == null ? "" : etype.getDisplayName();
}
/**
* @generated
*/
public Image getImage(Object element) {
- return super.getImage(unwrap(element));
+ IElementType etype = getElementType(getView(unwrap(element)));
+ return etype == null ? null : TaiPanElementTypes.getImage(etype);
}
/**
@@ -52,16 +52,7 @@ public class TaiPanPropertiesLabelProvider extends DecoratingLabelProvider {
*/
private Object unwrap(Object element) {
if (element instanceof IStructuredSelection) {
- return unwrap(((IStructuredSelection) element).getFirstElement());
- }
- if (element instanceof EditPart) {
- return unwrapEditPart((EditPart) element);
- }
- if (element instanceof IAdaptable) {
- View view = (View) ((IAdaptable) element).getAdapter(View.class);
- if (view != null) {
- return unwrapView(view);
- }
+ return ((IStructuredSelection) element).getFirstElement();
}
return element;
}
@@ -69,18 +60,30 @@ public class TaiPanPropertiesLabelProvider extends DecoratingLabelProvider {
/**
* @generated
*/
- private Object unwrapEditPart(EditPart p) {
- if (p.getModel() instanceof View) {
- return unwrapView((View) p.getModel());
+ private View getView(Object element) {
+ if (element instanceof View) {
+ return (View) element;
+ }
+ if (element instanceof IAdaptable) {
+ return (View) ((IAdaptable) element).getAdapter(View.class);
}
- return p.getModel();
+ return null;
}
/**
* @generated
*/
- private Object unwrapView(View view) {
- return view.getElement() == null ? view : view.getElement();
+ private IElementType getElementType(View view) {
+ // For intermediate views climb up the containment hierarchy to find the one associated with an element type.
+ while (view != null) {
+ int vid = TaiPanVisualIDRegistry.getVisualID(view);
+ IElementType etype = TaiPanElementTypes.getElementType(vid);
+ if (etype != null) {
+ return etype;
+ }
+ view = view.eContainer() instanceof View ? (View) view.eContainer() : null;
+ }
+ return null;
}
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/ElementInitializers.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/ElementInitializers.java
index cff380382..ca0150c5f 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/ElementInitializers.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/ElementInitializers.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.gmf.examples.taipan.Route;
import org.eclipse.gmf.examples.taipan.TaiPanPackage;
@@ -38,8 +39,10 @@ public class ElementInitializers {
*/
public static void init_Route_4002(Route instance) {
try {
- TaiPanOCLFactory.getExpression("0.8", TaiPanPackage.eINSTANCE.getRoute()).assignTo(TaiPanPackage.eINSTANCE.getRoute_Reliability(), instance);
+ Object value_0 = TaiPanOCLFactory.getExpression("0.8", TaiPanPackage.eINSTANCE.getRoute()).evaluate(instance);
+ value_0 = TaiPanAbstractExpression.performCast(value_0, EcorePackage.eINSTANCE.getEDouble());
+ instance.setReliability(((Double) value_0).doubleValue());
} catch (RuntimeException e) {
TaiPanDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
}
@@ -50,16 +53,12 @@ public class ElementInitializers {
*/
public static void init_Route_4003(Route instance) {
try {
- TaiPanOCLFactory.getExpression("0.2", TaiPanPackage.eINSTANCE.getRoute()).assignTo(TaiPanPackage.eINSTANCE.getRoute_Reliability(), instance);
+ Object value_0 = TaiPanOCLFactory.getExpression("0.2", TaiPanPackage.eINSTANCE.getRoute()).evaluate(instance);
+ value_0 = TaiPanAbstractExpression.performCast(value_0, EcorePackage.eINSTANCE.getEDouble());
+ instance.setReliability(((Double) value_0).doubleValue());
} catch (RuntimeException e) {
TaiPanDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
}
}
-
- /**
- * @generated
- */
- static class Java {
- }
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanElementTypes.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanElementTypes.java
index 1a6fd1bf8..27134238e 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanElementTypes.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanElementTypes.java
@@ -22,6 +22,20 @@ import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gmf.examples.taipan.TaiPanPackage;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.AquatoryEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.BesiegePortOrderEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.EmptyBoxEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.EscortShipsOrderEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.LargeItemEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.PortEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.PortRegisterEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.ReliableRouteEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.ShipDestinationEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.ShipEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.ShipRouteEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.SmallItemsEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.UnreliableRouteEditPart;
+import org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.WarshipEditPart;
import org.eclipse.gmf.examples.taipan.gmf.editor.part.TaiPanDiagramEditorPlugin;
import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
@@ -293,4 +307,41 @@ public class TaiPanElementTypes extends ElementInitializers {
return KNOWN_ELEMENT_TYPES.contains(elementType);
}
+ /**
+ * @generated
+ */
+ public static IElementType getElementType(int visualID) {
+ switch (visualID) {
+ case AquatoryEditPart.VISUAL_ID:
+ return Aquatory_1000;
+ case PortEditPart.VISUAL_ID:
+ return Port_2001;
+ case ShipEditPart.VISUAL_ID:
+ return Ship_2002;
+ case WarshipEditPart.VISUAL_ID:
+ return Warship_2003;
+ case SmallItemsEditPart.VISUAL_ID:
+ return SmallItems_3001;
+ case LargeItemEditPart.VISUAL_ID:
+ return LargeItem_3002;
+ case EmptyBoxEditPart.VISUAL_ID:
+ return EmptyBox_3003;
+ case ShipDestinationEditPart.VISUAL_ID:
+ return ShipDestination_4001;
+ case ReliableRouteEditPart.VISUAL_ID:
+ return Route_4002;
+ case UnreliableRouteEditPart.VISUAL_ID:
+ return Route_4003;
+ case ShipRouteEditPart.VISUAL_ID:
+ return ShipRoute_4004;
+ case BesiegePortOrderEditPart.VISUAL_ID:
+ return BesiegePortOrder_4005;
+ case EscortShipsOrderEditPart.VISUAL_ID:
+ return EscortShipsOrder_4006;
+ case PortRegisterEditPart.VISUAL_ID:
+ return PortRegister_4007;
+ }
+ return null;
+ }
+
}
diff --git a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanValidationProvider.java b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanValidationProvider.java
index e7dc7d2ef..1d4fae619 100644
--- a/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanValidationProvider.java
+++ b/examples/org.eclipse.gmf.examples.taipan.gmf.editor.rcp/src/org/eclipse/gmf/examples/taipan/gmf/editor/providers/TaiPanValidationProvider.java
@@ -59,35 +59,24 @@ public class TaiPanValidationProvider extends AbstractContributionItemProvider {
/**
* @generated
*/
- protected IAction createAction(String actionId, IWorkbenchPartDescriptor partDescriptor) {
- if (ValidateAction.VALIDATE_ACTION_KEY.equals(actionId)) {
- return new ValidateAction(partDescriptor);
- }
- return super.createAction(actionId, partDescriptor);
- }
-
- /**
- * @generated
- */
- public static void runWithConstraints(View view, Runnable op) {
- final Runnable fop = op;
+ public static void runWithConstraints(TransactionalEditingDomain editingDomain, Runnable operation) {
+ final Runnable op = operation;
Runnable task = new Runnable() {
public void run() {
try {
constraintsActive = true;
- fop.run();
+ op.run();
} finally {
constraintsActive = false;
}
}
};
- TransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(view);
- if (txDomain != null) {
+ if (editingDomain != null) {
try {
- txDomain.runExclusive(task);
+ editingDomain.runExclusive(task);
} catch (Exception e) {
- TaiPanDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
+ TaiPanDiagramEditorPlugin.getInstance().logError("Validation failed", e); //$NON-NLS-1$
}
} else {
task.run();
@@ -97,156 +86,24 @@ public class TaiPanValidationProvider extends AbstractContributionItemProvider {
/**
* @generated
*/
- static boolean isInDefaultEditorContext(Object object) {
- if (shouldConstraintsBePrivate() && !constraintsActive) {
- return false;
- }
- if (object instanceof View) {
- return constraintsActive && AquatoryEditPart.MODEL_ID.equals(TaiPanVisualIDRegistry.getModelID((View) object));
- }
- return true;
- }
-
- /**
- * @generated
- */
- static final Map semanticCtxIdMap = new HashMap();
-
- /**
- * @generated
- */
- public static class DefaultCtx1 implements IClientSelector {
-
- /**
- * @generated
- */
- public boolean selects(Object object) {
- return isInDefaultEditorContext(object);
- }
- }
-
- /**
- * @generated
- */
- public static class DefaultCtx2 implements IClientSelector {
-
- /**
- * @generated
- */
- public boolean selects(Object object) {
- return isInDefaultEditorContext(object);
+ protected IAction createAction(String actionId, IWorkbenchPartDescriptor partDescriptor) {
+ if (ValidateAction.VALIDATE_ACTION_KEY.equals(actionId)) {
+ return new ValidateAction(partDescriptor);
}
+ return super.createAction(actionId, partDescriptor);
}
/**
* @generated
*/
- public static ITraversalStrategy getNotationTraversalStrategy(IBatchValidator validator) {
- return new CtxSwitchStrategy(validator);
- }
-
- /**
- * @generated
- */
- private static class CtxSwitchStrategy implements ITraversalStrategy {
-
- /**
- * @generated
- */
- private ITraversalStrategy defaultStrategy;
-
- /**
- * @generated
- */
- private String currentSemanticCtxId;
-
- /**
- * @generated
- */
- private boolean ctxChanged = true;
-
- /**
- * @generated
- */
- private EObject currentTarget;
-
- /**
- * @generated
- */
- private EObject preFetchedNextTarget;
-
- /**
- * @generated
- */
- CtxSwitchStrategy(IBatchValidator validator) {
- this.defaultStrategy = validator.getDefaultTraversalStrategy();
- }
-
- /**
- * @generated
- */
- public void elementValidated(EObject element, IStatus status) {
- defaultStrategy.elementValidated(element, status);
- }
-
- /**
- * @generated
- */
- public boolean hasNext() {
- return defaultStrategy.hasNext();
- }
-
- /**
- * @generated
- */
- public boolean isClientContextChanged() {
- if (preFetchedNextTarget == null) {
- preFetchedNextTarget = next();
- prepareNextClientContext(preFetchedNextTarget);
- }
- return ctxChanged;
- }
-
- /**
- * @generated
- */
- public EObject next() {
- EObject nextTarget = preFetchedNextTarget;
- if (nextTarget == null) {
- nextTarget = defaultStrategy.next();
- }
- this.preFetchedNextTarget = null;
- return this.currentTarget = nextTarget;
- }
-
- /**
- * @generated
- */
- public void startTraversal(Collection traversalRoots, IProgressMonitor monitor) {
- defaultStrategy.startTraversal(traversalRoots, monitor);
+ static boolean isInDefaultEditorContext(Object object) {
+ if (shouldConstraintsBePrivate() && !constraintsActive) {
+ return false;
}
-
- /**
- * @generated
- */
- private void prepareNextClientContext(EObject nextTarget) {
- if (nextTarget != null && currentTarget != null) {
- if (nextTarget instanceof View) {
- String id = ((View) nextTarget).getType();
- String nextSemanticId = id != null && semanticCtxIdMap.containsKey(id) ? id : null;
- if ((currentSemanticCtxId != null && !currentSemanticCtxId.equals(nextSemanticId)) || (nextSemanticId != null && !nextSemanticId.equals(currentSemanticCtxId))) {
- this.ctxChanged = true;
- }
- currentSemanticCtxId = nextSemanticId;
- } else {
- // context of domain model
- this.ctxChanged = currentSemanticCtxId != null;
- currentSemanticCtxId = null;
- }
- } else {
- this.ctxChanged = false;
- }
+ if (object instanceof View) {
+ return constraintsActive && AquatoryEditPart.MODEL_ID.equals(TaiPanVisualIDRegistry.getModelID((View) object));
}
+ return true;
}
/**
@@ -257,50 +114,24 @@ public class TaiPanValidationProvider extends AbstractContributionItemProvider {
/**
* @generated
*/
- private TaiPanAbstractExpression expression;
-
- /**
- * @generated
- */
- public Adapter2() {
- expression = new TaiPanAbstractExpression(EcorePackage.eINSTANCE.getEString()) {
-
- protected Object doEvaluate(Object context, Map env) {
- java.lang.String self = (java.lang.String) context;
- return JavaAudits.selflength0(self);
- }
- };
- }
-
- /**
- * @generated
- */
public IStatus validate(IValidationContext ctx) {
- Object evalCtx = ctx.getTarget();
- if (evalCtx instanceof EObject) {
- evalCtx = ((EObject) evalCtx).eGet(TaiPanPackage.eINSTANCE.getShip_Name());
- }
- if (evalCtx == null) {
- return ctx.createFailureStatus(new Object[] { EMFCoreUtil.getQualifiedName(ctx.getTarget(), true) });
+ final Object context = ctx.getTarget().eGet(TaiPanPackage.eINSTANCE.getShip_Name());
+ if (context == null) {
+ return ctx.createFailureStatus(new Object[] { formatElement(ctx.getTarget()) });
}
- Object result = expression.evaluate(evalCtx);
- if (result instanceof Boolean && ((Boolean) result).booleanValue()) {
- return Status.OK_STATUS;
- }
- return ctx.createFailureStatus(new Object[] { EMFCoreUtil.getQualifiedName(ctx.getTarget(), true) });
+ // TODO: put validation code here
+ // Ensure that you remove @generated tag or use @generated NOT
+ //
+ // To construct approprate return value, use ctx.createSuccessStatus()
+ // or ctx.createFailureStatus(...)
+ throw new UnsupportedOperationException("No user java implementation provided for #validate(IValidationContext) operation");//$NON-NLS-1$
}
}
/**
* @generated
*/
- static class JavaAudits {
-
- /**
- * @generated NOT
- */
- private static java.lang.Boolean selflength0(java.lang.String self) {
- return Boolean.valueOf(self.length() > 0);
- }
- } //JavaAudits
+ static String formatElement(EObject object) {
+ return EMFCoreUtil.getQualifiedName(object, true);
+ }
} //TaiPanValidationProvider

Back to the top