Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2013-07-12 08:40:15 +0000
committerThomas Schuetz2013-07-12 08:40:15 +0000
commit12cda553738ca88662624b6f47066b5564549648 (patch)
treebfa65b6c38aa566a5f1cc98395da6546a6c6e282 /plugins/org.eclipse.etrice.ui.commands
parent3447749b1a453735ac54fc09ea7680acdbb19b69 (diff)
parentd65e1d1bdd43feadb43261b85aac2d8aef5e089c (diff)
downloadorg.eclipse.etrice-12cda553738ca88662624b6f47066b5564549648.tar.gz
org.eclipse.etrice-12cda553738ca88662624b6f47066b5564549648.tar.xz
org.eclipse.etrice-12cda553738ca88662624b6f47066b5564549648.zip
Merge remote-tracking branch 'origin/master'
Conflicts: plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip Change-Id: I98e2df3ab57d6e7e8f27e5b0aee7eaa189bfbc33
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.commands')
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/.classpath14
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/.gitignore2
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/.project56
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/META-INF/MANIFEST.MF38
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/build.properties12
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/plugin.xml410
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/Activator.java122
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/AbstractEditHandler.java484
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java268
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java140
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditStructureHandler.java108
-rw-r--r--plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java490
13 files changed, 1080 insertions, 1080 deletions
diff --git a/plugins/org.eclipse.etrice.ui.commands/.classpath b/plugins/org.eclipse.etrice.ui.commands/.classpath
index 8a8f1668c..ad32c83a7 100644
--- a/plugins/org.eclipse.etrice.ui.commands/.classpath
+++ b/plugins/org.eclipse.etrice.ui.commands/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.etrice.ui.commands/.gitignore b/plugins/org.eclipse.etrice.ui.commands/.gitignore
index 092357e47..ba077a403 100644
--- a/plugins/org.eclipse.etrice.ui.commands/.gitignore
+++ b/plugins/org.eclipse.etrice.ui.commands/.gitignore
@@ -1 +1 @@
-bin
+bin
diff --git a/plugins/org.eclipse.etrice.ui.commands/.project b/plugins/org.eclipse.etrice.ui.commands/.project
index c3a385f70..4904c0f33 100644
--- a/plugins/org.eclipse.etrice.ui.commands/.project
+++ b/plugins/org.eclipse.etrice.ui.commands/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.etrice.ui.commands</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.etrice.ui.commands</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.etrice.ui.commands/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.etrice.ui.commands/.settings/org.eclipse.jdt.core.prefs
index c23e01803..bcaf6d5a1 100644
--- a/plugins/org.eclipse.etrice.ui.commands/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.etrice.ui.commands/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,8 @@
-#Sun Mar 13 09:32:41 CET 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+#Sun Mar 13 09:32:41 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/org.eclipse.etrice.ui.commands/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.ui.commands/META-INF/MANIFEST.MF
index 07c97fe3f..649ea7c8b 100644
--- a/plugins/org.eclipse.etrice.ui.commands/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.ui.commands/META-INF/MANIFEST.MF
@@ -1,19 +1,19 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: eTrice Commands
-Bundle-SymbolicName: org.eclipse.etrice.ui.commands; singleton:=true
-Bundle-Version: 0.3.0.qualifier
-Bundle-Activator: org.eclipse.etrice.ui.commands.Activator
-Bundle-Vendor: Eclipse eTrice (Incubation)
-Require-Bundle: org.eclipse.etrice.core.room.ui;bundle-version="0.3.0",
- org.eclipse.etrice.ui.common;bundle-version="0.3.0",
- org.eclipse.etrice.ui.structure;bundle-version="0.3.0",
- org.eclipse.etrice.ui.behavior;bundle-version="0.3.0",
- org.eclipse.graphiti;bundle-version="0.8.0",
- org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.100",
- org.eclipse.xtext.ui;bundle-version="2.1.1",
- org.eclipse.graphiti.ui;bundle-version="0.8.0",
- org.eclipse.gef;bundle-version="3.7.0",
- org.eclipse.ui.ide;bundle-version="3.7.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Bundle-ActivationPolicy: lazy
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: eTrice Commands
+Bundle-SymbolicName: org.eclipse.etrice.ui.commands; singleton:=true
+Bundle-Version: 0.3.0.qualifier
+Bundle-Activator: org.eclipse.etrice.ui.commands.Activator
+Bundle-Vendor: Eclipse eTrice (Incubation)
+Require-Bundle: org.eclipse.etrice.core.room.ui;bundle-version="0.3.0",
+ org.eclipse.etrice.ui.common;bundle-version="0.3.0",
+ org.eclipse.etrice.ui.structure;bundle-version="0.3.0",
+ org.eclipse.etrice.ui.behavior;bundle-version="0.3.0",
+ org.eclipse.graphiti;bundle-version="0.8.0",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.100",
+ org.eclipse.xtext.ui;bundle-version="2.1.1",
+ org.eclipse.graphiti.ui;bundle-version="0.8.0",
+ org.eclipse.gef;bundle-version="3.7.0",
+ org.eclipse.ui.ide;bundle-version="3.7.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.etrice.ui.commands/build.properties b/plugins/org.eclipse.etrice.ui.commands/build.properties
index 4b8162ab8..0d3d3a745 100644
--- a/plugins/org.eclipse.etrice.ui.commands/build.properties
+++ b/plugins/org.eclipse.etrice.ui.commands/build.properties
@@ -1,6 +1,6 @@
-source.. = src/
-output.. = bin/
-bin.includes = plugin.xml,\
- META-INF/,\
- .,\
- icons/
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/plugins/org.eclipse.etrice.ui.commands/plugin.xml b/plugins/org.eclipse.etrice.ui.commands/plugin.xml
index 824e6802d..850b0478a 100644
--- a/plugins/org.eclipse.etrice.ui.commands/plugin.xml
+++ b/plugins/org.eclipse.etrice.ui.commands/plugin.xml
@@ -1,205 +1,205 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
- <extension
- point="org.eclipse.ui.commands">
- <category
- name="eTrice Commands"
- id="org.eclipse.etrice.ui.commands.category">
- </category>
- <command
- name="open associated textual model"
- categoryId="org.eclipse.etrice.ui.commands.category"
- id="org.eclipse.etrice.ui.commands.commands.editModel">
- </command>
- <command
- description="open this ActorClass&apos;s structure as diagram"
- id="org.eclipse.etrice.core.room.ui.editStructure"
- name="Edit Structure">
- </command>
- <command
- description="open this ActorClass&apos;s state machine as diagram"
- id="org.eclipse.etrice.core.room.ui.editBehavior"
- name="Edit Behavior">
- </command>
- <command
- description="export all structure and behavior diagrams as files"
- id="org.eclipse.etrice.core.room.ui.exportDiagrams"
- name="Export Diagrams">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- commandId="org.eclipse.etrice.core.room.ui.editBehavior"
- class="org.eclipse.etrice.ui.commands.handlers.EditBehaviorHandler">
- <activeWhen>
- <with variable="activeEditorId">
- <or>
- <equals
- value="org.eclipse.etrice.ui.structure.editor.StructureEditor">
- </equals>
- <equals
- value="org.eclipse.etrice.core.Room">
- </equals>
- </or>
- </with>
- </activeWhen>
- </handler>
- <handler
- commandId="org.eclipse.etrice.core.room.ui.editStructure"
- class="org.eclipse.etrice.ui.commands.handlers.EditStructureHandler">
- <activeWhen>
- <with
- variable="activeEditorId">
- <or>
- <equals
- value="org.eclipse.etrice.ui.behavior.editor.BehaviorEditor">
- </equals>
- <equals
- value="org.eclipse.etrice.core.Room">
- </equals>
- </or>
- </with>
- </activeWhen>
- </handler>
- <handler
- commandId="org.eclipse.etrice.ui.commands.commands.editModel"
- class="org.eclipse.etrice.ui.commands.handlers.EditModelHandler">
- <activeWhen>
- <or>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.etrice.ui.behavior.editor.BehaviorEditor">
- </equals>
- </with>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.etrice.ui.structure.editor.StructureEditor">
- </equals>
- </with>
- </or>
- </activeWhen>
- </handler>
- <handler
- commandId="org.eclipse.etrice.core.room.ui.exportDiagrams"
- class="org.eclipse.etrice.ui.commands.handlers.ExportDiagramsHandler">
- <activeWhen>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.etrice.core.Room">
- </equals>
- </with>
- </activeWhen>
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.bindings">
- <key
- commandId="org.eclipse.etrice.core.room.ui.editBehavior"
- contextId="org.eclipse.ui.contexts.window"
- sequence="M3+B"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- commandId="org.eclipse.etrice.core.room.ui.editStructure"
- contextId="org.eclipse.ui.contexts.window"
- sequence="M3+S"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- commandId="org.eclipse.etrice.ui.commands.commands.editModel"
- contextId="org.eclipse.ui.contexts.window"
- sequence="M3+M"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:org.eclipse.ui.main.menu?after=additions">
- <menu
- label="eTrice"
- mnemonic="T"
- id="org.eclipse.etrice.ui.commands.menus.eTrice">
- <command
- commandId="org.eclipse.etrice.core.room.ui.editBehavior"
- icon="icons/Behavior.gif"
- id="org.eclipse.etrice.ui.commands.menus.editBehavior"
- label="Open Behavior"
- mnemonic="B">
- </command>
- <command
- commandId="org.eclipse.etrice.core.room.ui.editStructure"
- icon="icons/Structure.gif"
- id="org.eclipse.etrice.ui.commands.menus.editStructure"
- label="Open Structure"
- mnemonic="S">
- </command>
- <command
- commandId="org.eclipse.etrice.ui.commands.commands.editModel"
- icon="icons/RoomModel.gif"
- id="org.eclipse.etrice.ui.commands.menus.openModel"
- label="Open Model"
- mnemonic="M">
- </command>
- </menu>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.etrice.core.room.outline?after=additions">
- <command
- commandId="org.eclipse.etrice.core.room.ui.editBehavior"
- label="Edit Behavior"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <iterate>
- <adapt
- type="org.eclipse.xtext.ui.editor.outline.IOutlineNode">
- </adapt>
- </iterate>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.etrice.core.room.outline?after=additions">
- <command
- commandId="org.eclipse.etrice.core.room.ui.editStructure"
- label="Edit Structure"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <iterate>
- <adapt
- type="org.eclipse.xtext.ui.editor.outline.IOutlineNode">
- </adapt>
- </iterate>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.etrice.core.room.outline?after=additions">
- <command
- commandId="org.eclipse.etrice.core.room.ui.exportDiagrams"
- label="Export Diagrams"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <iterate>
- <adapt
- type="org.eclipse.xtext.ui.editor.outline.IOutlineNode">
- </adapt>
- </iterate>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <category
+ name="eTrice Commands"
+ id="org.eclipse.etrice.ui.commands.category">
+ </category>
+ <command
+ name="open associated textual model"
+ categoryId="org.eclipse.etrice.ui.commands.category"
+ id="org.eclipse.etrice.ui.commands.commands.editModel">
+ </command>
+ <command
+ description="open this ActorClass&apos;s structure as diagram"
+ id="org.eclipse.etrice.core.room.ui.editStructure"
+ name="Edit Structure">
+ </command>
+ <command
+ description="open this ActorClass&apos;s state machine as diagram"
+ id="org.eclipse.etrice.core.room.ui.editBehavior"
+ name="Edit Behavior">
+ </command>
+ <command
+ description="export all structure and behavior diagrams as files"
+ id="org.eclipse.etrice.core.room.ui.exportDiagrams"
+ name="Export Diagrams">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ commandId="org.eclipse.etrice.core.room.ui.editBehavior"
+ class="org.eclipse.etrice.ui.commands.handlers.EditBehaviorHandler">
+ <activeWhen>
+ <with variable="activeEditorId">
+ <or>
+ <equals
+ value="org.eclipse.etrice.ui.structure.editor.StructureEditor">
+ </equals>
+ <equals
+ value="org.eclipse.etrice.core.Room">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ commandId="org.eclipse.etrice.core.room.ui.editStructure"
+ class="org.eclipse.etrice.ui.commands.handlers.EditStructureHandler">
+ <activeWhen>
+ <with
+ variable="activeEditorId">
+ <or>
+ <equals
+ value="org.eclipse.etrice.ui.behavior.editor.BehaviorEditor">
+ </equals>
+ <equals
+ value="org.eclipse.etrice.core.Room">
+ </equals>
+ </or>
+ </with>
+ </activeWhen>
+ </handler>
+ <handler
+ commandId="org.eclipse.etrice.ui.commands.commands.editModel"
+ class="org.eclipse.etrice.ui.commands.handlers.EditModelHandler">
+ <activeWhen>
+ <or>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.etrice.ui.behavior.editor.BehaviorEditor">
+ </equals>
+ </with>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.etrice.ui.structure.editor.StructureEditor">
+ </equals>
+ </with>
+ </or>
+ </activeWhen>
+ </handler>
+ <handler
+ commandId="org.eclipse.etrice.core.room.ui.exportDiagrams"
+ class="org.eclipse.etrice.ui.commands.handlers.ExportDiagramsHandler">
+ <activeWhen>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.etrice.core.Room">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.etrice.core.room.ui.editBehavior"
+ contextId="org.eclipse.ui.contexts.window"
+ sequence="M3+B"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </key>
+ <key
+ commandId="org.eclipse.etrice.core.room.ui.editStructure"
+ contextId="org.eclipse.ui.contexts.window"
+ sequence="M3+S"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </key>
+ <key
+ commandId="org.eclipse.etrice.ui.commands.commands.editModel"
+ contextId="org.eclipse.ui.contexts.window"
+ sequence="M3+M"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+ </key>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.ui.main.menu?after=additions">
+ <menu
+ label="eTrice"
+ mnemonic="T"
+ id="org.eclipse.etrice.ui.commands.menus.eTrice">
+ <command
+ commandId="org.eclipse.etrice.core.room.ui.editBehavior"
+ icon="icons/Behavior.gif"
+ id="org.eclipse.etrice.ui.commands.menus.editBehavior"
+ label="Open Behavior"
+ mnemonic="B">
+ </command>
+ <command
+ commandId="org.eclipse.etrice.core.room.ui.editStructure"
+ icon="icons/Structure.gif"
+ id="org.eclipse.etrice.ui.commands.menus.editStructure"
+ label="Open Structure"
+ mnemonic="S">
+ </command>
+ <command
+ commandId="org.eclipse.etrice.ui.commands.commands.editModel"
+ icon="icons/RoomModel.gif"
+ id="org.eclipse.etrice.ui.commands.menus.openModel"
+ label="Open Model"
+ mnemonic="M">
+ </command>
+ </menu>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.etrice.core.room.outline?after=additions">
+ <command
+ commandId="org.eclipse.etrice.core.room.ui.editBehavior"
+ label="Edit Behavior"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <iterate>
+ <adapt
+ type="org.eclipse.xtext.ui.editor.outline.IOutlineNode">
+ </adapt>
+ </iterate>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.etrice.core.room.outline?after=additions">
+ <command
+ commandId="org.eclipse.etrice.core.room.ui.editStructure"
+ label="Edit Structure"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <iterate>
+ <adapt
+ type="org.eclipse.xtext.ui.editor.outline.IOutlineNode">
+ </adapt>
+ </iterate>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.etrice.core.room.outline?after=additions">
+ <command
+ commandId="org.eclipse.etrice.core.room.ui.exportDiagrams"
+ label="Export Diagrams"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <iterate>
+ <adapt
+ type="org.eclipse.xtext.ui.editor.outline.IOutlineNode">
+ </adapt>
+ </iterate>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/Activator.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/Activator.java
index 512081655..fafaee464 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/Activator.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/Activator.java
@@ -1,61 +1,61 @@
-package org.eclipse.etrice.ui.commands;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.etrice.ui.commands"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
+package org.eclipse.etrice.ui.commands;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.etrice.ui.commands"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/AbstractEditHandler.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/AbstractEditHandler.java
index 2885d44dd..e550b3899 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/AbstractEditHandler.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/AbstractEditHandler.java
@@ -1,242 +1,242 @@
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * 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
- *******************************************************************************/
-
-package org.eclipse.etrice.ui.commands.handlers;
-
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.StructureClass;
-import org.eclipse.etrice.core.ui.RoomUiModule;
-import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
-import org.eclipse.etrice.ui.structure.editor.StructureEditor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.views.contentoutline.ContentOutline;
-import org.eclipse.xtext.diagnostics.Severity;
-import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
-import org.eclipse.xtext.resource.IFragmentProvider;
-import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.ui.editor.XtextEditor;
-import org.eclipse.xtext.ui.editor.model.IXtextDocument;
-import org.eclipse.xtext.ui.editor.outline.impl.EObjectNode;
-import org.eclipse.xtext.ui.editor.utils.EditorUtils;
-import org.eclipse.xtext.util.CancelIndicator;
-import org.eclipse.xtext.util.concurrent.IUnitOfWork;
-import org.eclipse.xtext.validation.CheckMode;
-import org.eclipse.xtext.validation.IResourceValidator;
-import org.eclipse.xtext.validation.Issue;
-
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-
-/**
- * description
- *
- * @author Henrik Rentz-Reichert initial contribution and API
- *
- */
-public abstract class AbstractEditHandler extends AbstractHandler {
-
- @Inject
- protected IResourceValidator resourceValidator;
-
- @Inject
- IFragmentProvider fragmentProvider;
-
- private EObjectAtOffsetHelper helper = new EObjectAtOffsetHelper();
-
- public AbstractEditHandler() {
- super();
-
- Injector injector = RoomUiModule.getInjector();
- injector.injectMembers(this);
- }
-
- abstract protected boolean prepare(XtextEditor xtextEditor, final String fragment);
- abstract protected void openEditor(EObject object);
- abstract protected boolean isEnabled(String fragment);
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- IEditorPart editor = window.getActivePage().getActiveEditor();
- if (editor instanceof XtextEditor) {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- // event from the xtext editor's outline view
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object sel = ss.getFirstElement();
- if (sel instanceof EObjectNode) {
- XtextEditor xtextEditor = EditorUtils.getActiveXtextEditor(event);
- IXtextDocument document = xtextEditor.getDocument();
- final String fragment = ((EObjectNode) sel).getEObjectURI().fragment();
- if (checkPrerequisites(xtextEditor, document, fragment)) {
- openEditor(document, fragment);
- }
- }
- }
- else if (selection instanceof ITextSelection) {
- // event from the xtext editor itself
- final ITextSelection ss = (ITextSelection) selection;
- XtextEditor xed = (XtextEditor) editor;
- IXtextDocument document = xed.getDocument();
- String fragment = document.readOnly(new IUnitOfWork<String, XtextResource>() {
- @Override
- public String exec(XtextResource resource) throws Exception {
- EObject obj = helper.resolveElementAt(resource, ss.getOffset());
- while (obj!=null) {
- if (obj instanceof StructureClass) {
- return fragmentProvider.getFragment(obj, null);
- }
- obj = obj.eContainer();
- }
- return null;
- }
- });
- if (checkPrerequisites(xed, document, fragment)) {
- openEditor(document, fragment);
- }
- }
- }
- else if (editor instanceof StructureEditor) {
- StructureClass sc = ((StructureEditor)editor).getStructureClass();
- if (sc instanceof ActorClass) {
- openEditor(sc);
- }
- }
- else if (editor instanceof BehaviorEditor) {
- ActorClass ac = ((BehaviorEditor)editor).getActorClass();
- openEditor(ac);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- */
- @Override
- public boolean isEnabled() {
- IWorkbench wb = PlatformUI.getWorkbench();
- IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
- IWorkbenchPage page = win.getActivePage();
- IWorkbenchPart part = page.getActivePart();
- if (part instanceof ContentOutline) {
- ISelection selection = ((ContentOutline)part).getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object sel = ss.getFirstElement();
- if (sel instanceof EObjectNode) {
- EObjectNode node = (EObjectNode) sel;
- String fragment = node.getEObjectURI().fragment();
- return isEnabled(fragment);
- }
- }
- }
- IEditorPart editor = page.getActiveEditor();
- if (editor instanceof XtextEditor) {
- ISelection selection = ((XtextEditor) editor).getSelectionProvider().getSelection();
- if (selection instanceof ITextSelection) {
- // event from the xtext editor itself
- final ITextSelection ss = (ITextSelection) selection;
- XtextEditor xed = (XtextEditor) editor;
- IXtextDocument document = xed.getDocument();
- String fragment = document.readOnly(new IUnitOfWork<String, XtextResource>() {
- @Override
- public String exec(XtextResource resource) throws Exception {
- EObject obj = helper.resolveElementAt(resource, ss.getOffset());
- while (obj!=null) {
- if (obj instanceof StructureClass) {
- return fragmentProvider.getFragment(obj, null);
- }
- obj = obj.eContainer();
- }
- return "";
- }
- });
- return isEnabled(fragment);
- }
- }
- else if (editor instanceof StructureEditor) {
- StructureClass sc = ((StructureEditor)editor).getStructureClass();
- return isEnabled(fragmentProvider.getFragment(sc, null));
- }
- else if (editor instanceof BehaviorEditor) {
- ActorClass ac = ((BehaviorEditor)editor).getActorClass();
- return isEnabled(fragmentProvider.getFragment(ac, null));
- }
- return false;
- }
-
- protected void openEditor(IXtextDocument document, final String fragment) {
- document.readOnly(new IUnitOfWork.Void<XtextResource>() {
- @Override
- public void process(XtextResource resource) throws Exception {
- if (resource != null) {
- EObject object = resource.getEObject(fragment);
- openEditor(object);
- }
- }
- });
- }
-
- protected boolean checkPrerequisites(XtextEditor xtextEditor,
- IXtextDocument document, final String fragment) {
- if (hasIssues(document, new NullProgressMonitor())) {
- MessageDialog.openError(xtextEditor.getSite().getShell(), "Validation Errors", "The editor has validation errors.\nCannot open diagram!");
- return false;
- }
- if (xtextEditor.isDirty()) {
- if (!MessageDialog.openQuestion(xtextEditor.getSite().getShell(), "Save model file", "The editor will be saved before opening the diagram editor.\nProceed?"))
- return false;
- // postpone save to avoid doing it twice
- }
- if (!prepare(xtextEditor, fragment))
- return false;
- if (xtextEditor.isDirty()) {
- xtextEditor.doSave(new NullProgressMonitor());
- }
- return true;
- }
-
- public boolean hasIssues(IXtextDocument xtextDocument, final IProgressMonitor monitor) {
- final boolean issues = xtextDocument
- .readOnly(new IUnitOfWork<Boolean, XtextResource>() {
- public Boolean exec(XtextResource resource) throws Exception {
- if (resource == null)
- return false;
- List<Issue> issueList = resourceValidator.validate(resource, CheckMode.NORMAL_AND_FAST, new CancelIndicator() {
- public boolean isCanceled() {
- return monitor.isCanceled();
- }
- });
- for (Issue issue : issueList) {
- if (issue.getSeverity()==Severity.ERROR)
- return true;
- }
- return false;
- }
- });
- return issues;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * 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
+ *******************************************************************************/
+
+package org.eclipse.etrice.ui.commands.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.StructureClass;
+import org.eclipse.etrice.core.ui.RoomUiModule;
+import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
+import org.eclipse.etrice.ui.structure.editor.StructureEditor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.xtext.diagnostics.Severity;
+import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
+import org.eclipse.xtext.resource.IFragmentProvider;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.ui.editor.XtextEditor;
+import org.eclipse.xtext.ui.editor.model.IXtextDocument;
+import org.eclipse.xtext.ui.editor.outline.impl.EObjectNode;
+import org.eclipse.xtext.ui.editor.utils.EditorUtils;
+import org.eclipse.xtext.util.CancelIndicator;
+import org.eclipse.xtext.util.concurrent.IUnitOfWork;
+import org.eclipse.xtext.validation.CheckMode;
+import org.eclipse.xtext.validation.IResourceValidator;
+import org.eclipse.xtext.validation.Issue;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+/**
+ * description
+ *
+ * @author Henrik Rentz-Reichert initial contribution and API
+ *
+ */
+public abstract class AbstractEditHandler extends AbstractHandler {
+
+ @Inject
+ protected IResourceValidator resourceValidator;
+
+ @Inject
+ IFragmentProvider fragmentProvider;
+
+ private EObjectAtOffsetHelper helper = new EObjectAtOffsetHelper();
+
+ public AbstractEditHandler() {
+ super();
+
+ Injector injector = RoomUiModule.getInjector();
+ injector.injectMembers(this);
+ }
+
+ abstract protected boolean prepare(XtextEditor xtextEditor, final String fragment);
+ abstract protected void openEditor(EObject object);
+ abstract protected boolean isEnabled(String fragment);
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ IEditorPart editor = window.getActivePage().getActiveEditor();
+ if (editor instanceof XtextEditor) {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ // event from the xtext editor's outline view
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Object sel = ss.getFirstElement();
+ if (sel instanceof EObjectNode) {
+ XtextEditor xtextEditor = EditorUtils.getActiveXtextEditor(event);
+ IXtextDocument document = xtextEditor.getDocument();
+ final String fragment = ((EObjectNode) sel).getEObjectURI().fragment();
+ if (checkPrerequisites(xtextEditor, document, fragment)) {
+ openEditor(document, fragment);
+ }
+ }
+ }
+ else if (selection instanceof ITextSelection) {
+ // event from the xtext editor itself
+ final ITextSelection ss = (ITextSelection) selection;
+ XtextEditor xed = (XtextEditor) editor;
+ IXtextDocument document = xed.getDocument();
+ String fragment = document.readOnly(new IUnitOfWork<String, XtextResource>() {
+ @Override
+ public String exec(XtextResource resource) throws Exception {
+ EObject obj = helper.resolveElementAt(resource, ss.getOffset());
+ while (obj!=null) {
+ if (obj instanceof StructureClass) {
+ return fragmentProvider.getFragment(obj, null);
+ }
+ obj = obj.eContainer();
+ }
+ return null;
+ }
+ });
+ if (checkPrerequisites(xed, document, fragment)) {
+ openEditor(document, fragment);
+ }
+ }
+ }
+ else if (editor instanceof StructureEditor) {
+ StructureClass sc = ((StructureEditor)editor).getStructureClass();
+ if (sc instanceof ActorClass) {
+ openEditor(sc);
+ }
+ }
+ else if (editor instanceof BehaviorEditor) {
+ ActorClass ac = ((BehaviorEditor)editor).getActorClass();
+ openEditor(ac);
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
+ IWorkbenchPage page = win.getActivePage();
+ IWorkbenchPart part = page.getActivePart();
+ if (part instanceof ContentOutline) {
+ ISelection selection = ((ContentOutline)part).getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Object sel = ss.getFirstElement();
+ if (sel instanceof EObjectNode) {
+ EObjectNode node = (EObjectNode) sel;
+ String fragment = node.getEObjectURI().fragment();
+ return isEnabled(fragment);
+ }
+ }
+ }
+ IEditorPart editor = page.getActiveEditor();
+ if (editor instanceof XtextEditor) {
+ ISelection selection = ((XtextEditor) editor).getSelectionProvider().getSelection();
+ if (selection instanceof ITextSelection) {
+ // event from the xtext editor itself
+ final ITextSelection ss = (ITextSelection) selection;
+ XtextEditor xed = (XtextEditor) editor;
+ IXtextDocument document = xed.getDocument();
+ String fragment = document.readOnly(new IUnitOfWork<String, XtextResource>() {
+ @Override
+ public String exec(XtextResource resource) throws Exception {
+ EObject obj = helper.resolveElementAt(resource, ss.getOffset());
+ while (obj!=null) {
+ if (obj instanceof StructureClass) {
+ return fragmentProvider.getFragment(obj, null);
+ }
+ obj = obj.eContainer();
+ }
+ return "";
+ }
+ });
+ return isEnabled(fragment);
+ }
+ }
+ else if (editor instanceof StructureEditor) {
+ StructureClass sc = ((StructureEditor)editor).getStructureClass();
+ return isEnabled(fragmentProvider.getFragment(sc, null));
+ }
+ else if (editor instanceof BehaviorEditor) {
+ ActorClass ac = ((BehaviorEditor)editor).getActorClass();
+ return isEnabled(fragmentProvider.getFragment(ac, null));
+ }
+ return false;
+ }
+
+ protected void openEditor(IXtextDocument document, final String fragment) {
+ document.readOnly(new IUnitOfWork.Void<XtextResource>() {
+ @Override
+ public void process(XtextResource resource) throws Exception {
+ if (resource != null) {
+ EObject object = resource.getEObject(fragment);
+ openEditor(object);
+ }
+ }
+ });
+ }
+
+ protected boolean checkPrerequisites(XtextEditor xtextEditor,
+ IXtextDocument document, final String fragment) {
+ if (hasIssues(document, new NullProgressMonitor())) {
+ MessageDialog.openError(xtextEditor.getSite().getShell(), "Validation Errors", "The editor has validation errors.\nCannot open diagram!");
+ return false;
+ }
+ if (xtextEditor.isDirty()) {
+ if (!MessageDialog.openQuestion(xtextEditor.getSite().getShell(), "Save model file", "The editor will be saved before opening the diagram editor.\nProceed?"))
+ return false;
+ // postpone save to avoid doing it twice
+ }
+ if (!prepare(xtextEditor, fragment))
+ return false;
+ if (xtextEditor.isDirty()) {
+ xtextEditor.doSave(new NullProgressMonitor());
+ }
+ return true;
+ }
+
+ public boolean hasIssues(IXtextDocument xtextDocument, final IProgressMonitor monitor) {
+ final boolean issues = xtextDocument
+ .readOnly(new IUnitOfWork<Boolean, XtextResource>() {
+ public Boolean exec(XtextResource resource) throws Exception {
+ if (resource == null)
+ return false;
+ List<Issue> issueList = resourceValidator.validate(resource, CheckMode.NORMAL_AND_FAST, new CancelIndicator() {
+ public boolean isCanceled() {
+ return monitor.isCanceled();
+ }
+ });
+ for (Issue issue : issueList) {
+ if (issue.getSeverity()==Severity.ERROR)
+ return true;
+ }
+ return false;
+ }
+ });
+ return issues;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java
index 018303aa0..fa6eb1a2e 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditBehaviorHandler.java
@@ -1,134 +1,134 @@
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * 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:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.ui.commands.handlers;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.naming.RoomFragmentProvider;
-import org.eclipse.etrice.core.naming.RoomNameProvider;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.State;
-import org.eclipse.etrice.core.room.StateGraph;
-import org.eclipse.etrice.core.room.Transition;
-import org.eclipse.etrice.ui.behavior.DiagramAccess;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.ui.editor.XtextEditor;
-import org.eclipse.xtext.ui.editor.model.IXtextDocument;
-import org.eclipse.xtext.util.concurrent.IUnitOfWork;
-
-/**
- * Handler for outline menu item to open behavior editor.
- * The handler will ask to save unsaved editor before opening the diagram.
- *
- * If there are unnamed transitions they will be named with unique names.
- *
- * @author Henrik Rentz-Reichert initial contribution and API
- *
- */
-public class EditBehaviorHandler extends AbstractEditHandler {
-
- protected boolean prepare(XtextEditor xtextEditor, final String fragment) {
- if (hasUnnamedTransitions(xtextEditor.getDocument(), fragment)) {
- if (!MessageDialog.openQuestion(xtextEditor.getSite().getShell(), "Create transition names", "Transition names will be created where missing.\nProceed?"))
- return false;
- createTransitionNames(xtextEditor.getDocument(), fragment);
- xtextEditor.doSave(new NullProgressMonitor());
- }
- return true;
- }
-
- /**
- * @param document
- * @param fragment
- */
- private void createTransitionNames(IXtextDocument document, final String fragment) {
- document.modify(new IUnitOfWork.Void<XtextResource>() {
- @Override
- public void process(XtextResource resource) throws Exception {
- if (resource != null) {
- EObject object = resource.getEObject(fragment);
- if (object instanceof ActorClass) {
- createTransitionNames(((ActorClass) object).getStateMachine());
- }
- }
- }
-
- private void createTransitionNames(StateGraph sg) {
- if (sg==null)
- return;
-
- for (Transition tr : sg.getTransitions()) {
- if (tr.getName()==null || tr.getName().isEmpty()) {
- tr.setName(RoomNameProvider.getUniqueTransitionName(sg));
- }
- }
-
- for (State s : sg.getStates()) {
- createTransitionNames(s.getSubgraph());
- }
- }
-
- });
- }
-
- /**
- * @param document
- * @param fragment
- * @return
- */
- private boolean hasUnnamedTransitions(IXtextDocument document, final String fragment) {
- return document.readOnly(new IUnitOfWork<Boolean, XtextResource>() {
- @Override
- public Boolean exec(XtextResource resource) throws Exception {
- if (resource != null) {
- EObject object = resource.getEObject(fragment);
- if (object instanceof ActorClass) {
- return hasUnnamedTransitions(((ActorClass) object).getStateMachine());
- }
- }
- return false;
- }
-
- private boolean hasUnnamedTransitions(StateGraph sg) {
- if (sg==null)
- return false;
-
- for (Transition tr : sg.getTransitions()) {
- if (tr.getName()==null || tr.getName().isEmpty())
- return true;
- }
-
- for (State s : sg.getStates()) {
- if (hasUnnamedTransitions(s.getSubgraph()))
- return true;
- }
-
- return false;
- }
- });
- }
-
- protected void openEditor(EObject object) {
- if (object instanceof ActorClass) {
- DiagramAccess diagramAccess = new DiagramAccess();
- diagramAccess.openDiagramEditor((ActorClass) object);
- }
- }
-
- @Override
- protected boolean isEnabled(String fragment) {
- return RoomFragmentProvider.isActorClass(fragment);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.ui.commands.handlers;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.naming.RoomFragmentProvider;
+import org.eclipse.etrice.core.naming.RoomNameProvider;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.State;
+import org.eclipse.etrice.core.room.StateGraph;
+import org.eclipse.etrice.core.room.Transition;
+import org.eclipse.etrice.ui.behavior.DiagramAccess;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.ui.editor.XtextEditor;
+import org.eclipse.xtext.ui.editor.model.IXtextDocument;
+import org.eclipse.xtext.util.concurrent.IUnitOfWork;
+
+/**
+ * Handler for outline menu item to open behavior editor.
+ * The handler will ask to save unsaved editor before opening the diagram.
+ *
+ * If there are unnamed transitions they will be named with unique names.
+ *
+ * @author Henrik Rentz-Reichert initial contribution and API
+ *
+ */
+public class EditBehaviorHandler extends AbstractEditHandler {
+
+ protected boolean prepare(XtextEditor xtextEditor, final String fragment) {
+ if (hasUnnamedTransitions(xtextEditor.getDocument(), fragment)) {
+ if (!MessageDialog.openQuestion(xtextEditor.getSite().getShell(), "Create transition names", "Transition names will be created where missing.\nProceed?"))
+ return false;
+ createTransitionNames(xtextEditor.getDocument(), fragment);
+ xtextEditor.doSave(new NullProgressMonitor());
+ }
+ return true;
+ }
+
+ /**
+ * @param document
+ * @param fragment
+ */
+ private void createTransitionNames(IXtextDocument document, final String fragment) {
+ document.modify(new IUnitOfWork.Void<XtextResource>() {
+ @Override
+ public void process(XtextResource resource) throws Exception {
+ if (resource != null) {
+ EObject object = resource.getEObject(fragment);
+ if (object instanceof ActorClass) {
+ createTransitionNames(((ActorClass) object).getStateMachine());
+ }
+ }
+ }
+
+ private void createTransitionNames(StateGraph sg) {
+ if (sg==null)
+ return;
+
+ for (Transition tr : sg.getTransitions()) {
+ if (tr.getName()==null || tr.getName().isEmpty()) {
+ tr.setName(RoomNameProvider.getUniqueTransitionName(sg));
+ }
+ }
+
+ for (State s : sg.getStates()) {
+ createTransitionNames(s.getSubgraph());
+ }
+ }
+
+ });
+ }
+
+ /**
+ * @param document
+ * @param fragment
+ * @return
+ */
+ private boolean hasUnnamedTransitions(IXtextDocument document, final String fragment) {
+ return document.readOnly(new IUnitOfWork<Boolean, XtextResource>() {
+ @Override
+ public Boolean exec(XtextResource resource) throws Exception {
+ if (resource != null) {
+ EObject object = resource.getEObject(fragment);
+ if (object instanceof ActorClass) {
+ return hasUnnamedTransitions(((ActorClass) object).getStateMachine());
+ }
+ }
+ return false;
+ }
+
+ private boolean hasUnnamedTransitions(StateGraph sg) {
+ if (sg==null)
+ return false;
+
+ for (Transition tr : sg.getTransitions()) {
+ if (tr.getName()==null || tr.getName().isEmpty())
+ return true;
+ }
+
+ for (State s : sg.getStates()) {
+ if (hasUnnamedTransitions(s.getSubgraph()))
+ return true;
+ }
+
+ return false;
+ }
+ });
+ }
+
+ protected void openEditor(EObject object) {
+ if (object instanceof ActorClass) {
+ DiagramAccess diagramAccess = new DiagramAccess();
+ diagramAccess.openDiagramEditor((ActorClass) object);
+ }
+ }
+
+ @Override
+ protected boolean isEnabled(String fragment) {
+ return RoomFragmentProvider.isActorClass(fragment);
+ }
+
+}
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java
index ae4ed8fcb..9480ffc30 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditModelHandler.java
@@ -1,70 +1,70 @@
-package org.eclipse.etrice.ui.commands.handlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.edit.ui.util.EditUIUtil;
-import org.eclipse.etrice.core.room.StructureClass;
-import org.eclipse.etrice.core.ui.RoomUiModule;
-import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
-import org.eclipse.etrice.ui.structure.editor.StructureEditor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.xtext.resource.ILocationInFileProvider;
-import org.eclipse.xtext.ui.editor.XtextEditor;
-import org.eclipse.xtext.util.ITextRegion;
-
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-
-/**
- * Our sample handler extends AbstractHandler, an IHandler base class.
- * @see org.eclipse.core.commands.IHandler
- * @see org.eclipse.core.commands.AbstractHandler
- */
-public class EditModelHandler extends AbstractHandler {
-
- @Inject
- ILocationInFileProvider locationProvider;
-
- /**
- * The constructor.
- */
- public EditModelHandler() {
- Injector injector = RoomUiModule.getInjector();
- injector.injectMembers(this);
- }
-
- /**
- * the command has been executed, so extract extract the needed information
- * from the application context.
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- IEditorPart editor = window.getActivePage().getActiveEditor();
- StructureClass sc = null;
- if (editor instanceof StructureEditor) {
- sc = ((StructureEditor)editor).getStructureClass();
- }
- else if (editor instanceof BehaviorEditor) {
- sc = ((BehaviorEditor)editor).getActorClass();
- }
- if (sc!=null) {
- try {
- if (EditUIUtil.openEditor(sc)) {
- editor = window.getActivePage().getActiveEditor();
- if (editor instanceof XtextEditor) {
- XtextEditor xed = (XtextEditor) editor;
- ITextRegion location = locationProvider.getFullTextRegion(sc);
- xed.selectAndReveal(location.getOffset(), location.getLength());
- }
- }
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-}
+package org.eclipse.etrice.ui.commands.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
+import org.eclipse.etrice.core.room.StructureClass;
+import org.eclipse.etrice.core.ui.RoomUiModule;
+import org.eclipse.etrice.ui.behavior.editor.BehaviorEditor;
+import org.eclipse.etrice.ui.structure.editor.StructureEditor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.xtext.resource.ILocationInFileProvider;
+import org.eclipse.xtext.ui.editor.XtextEditor;
+import org.eclipse.xtext.util.ITextRegion;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class EditModelHandler extends AbstractHandler {
+
+ @Inject
+ ILocationInFileProvider locationProvider;
+
+ /**
+ * The constructor.
+ */
+ public EditModelHandler() {
+ Injector injector = RoomUiModule.getInjector();
+ injector.injectMembers(this);
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information
+ * from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ IEditorPart editor = window.getActivePage().getActiveEditor();
+ StructureClass sc = null;
+ if (editor instanceof StructureEditor) {
+ sc = ((StructureEditor)editor).getStructureClass();
+ }
+ else if (editor instanceof BehaviorEditor) {
+ sc = ((BehaviorEditor)editor).getActorClass();
+ }
+ if (sc!=null) {
+ try {
+ if (EditUIUtil.openEditor(sc)) {
+ editor = window.getActivePage().getActiveEditor();
+ if (editor instanceof XtextEditor) {
+ XtextEditor xed = (XtextEditor) editor;
+ ITextRegion location = locationProvider.getFullTextRegion(sc);
+ xed.selectAndReveal(location.getOffset(), location.getLength());
+ }
+ }
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditStructureHandler.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditStructureHandler.java
index 31ce7123b..126ccd8a0 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditStructureHandler.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/EditStructureHandler.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
- * 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:
- * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.ui.commands.handlers;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.naming.RoomFragmentProvider;
-import org.eclipse.etrice.core.room.StructureClass;
-import org.eclipse.etrice.ui.structure.DiagramAccess;
-import org.eclipse.xtext.ui.editor.XtextEditor;
-
-/**
- * Handler for outline menu item to open structure editor.
- * The handler will ask to save unsaved editor before opening the diagram.
- *
- * @author Henrik Rentz-Reichert initial contribution and API
- *
- */
-public class EditStructureHandler extends AbstractEditHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.core.ui.outline.AbstractEditHandler#prepare(org.eclipse.xtext.ui.editor.XtextEditor, java.lang.String)
- */
- @Override
- protected boolean prepare(XtextEditor xtextEditor, String fragment) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.etrice.core.ui.outline.AbstractEditHandler#openEditor(org.eclipse.emf.ecore.EObject)
- */
- @Override
- protected void openEditor(EObject object) {
- if (object instanceof StructureClass) {
- DiagramAccess diagramAccess = new DiagramAccess();
- diagramAccess.openDiagramEditor((StructureClass) object);
- }
- }
-
- @Override
- protected boolean isEnabled(String fragment) {
- return RoomFragmentProvider.isStructureClass(fragment);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Thomas Schuetz and Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.ui.commands.handlers;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.naming.RoomFragmentProvider;
+import org.eclipse.etrice.core.room.StructureClass;
+import org.eclipse.etrice.ui.structure.DiagramAccess;
+import org.eclipse.xtext.ui.editor.XtextEditor;
+
+/**
+ * Handler for outline menu item to open structure editor.
+ * The handler will ask to save unsaved editor before opening the diagram.
+ *
+ * @author Henrik Rentz-Reichert initial contribution and API
+ *
+ */
+public class EditStructureHandler extends AbstractEditHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.core.ui.outline.AbstractEditHandler#prepare(org.eclipse.xtext.ui.editor.XtextEditor, java.lang.String)
+ */
+ @Override
+ protected boolean prepare(XtextEditor xtextEditor, String fragment) {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.core.ui.outline.AbstractEditHandler#openEditor(org.eclipse.emf.ecore.EObject)
+ */
+ @Override
+ protected void openEditor(EObject object) {
+ if (object instanceof StructureClass) {
+ DiagramAccess diagramAccess = new DiagramAccess();
+ diagramAccess.openDiagramEditor((StructureClass) object);
+ }
+ }
+
+ @Override
+ protected boolean isEnabled(String fragment) {
+ return RoomFragmentProvider.isStructureClass(fragment);
+ }
+
+}
diff --git a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java
index 1448666de..bce9478dc 100644
--- a/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java
+++ b/plugins/org.eclipse.etrice.ui.commands/src/org/eclipse/etrice/ui/commands/handlers/ExportDiagramsHandler.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * 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:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.ui.commands.handlers;
-
-import java.io.ByteArrayInputStream;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.room.ActorClass;
-import org.eclipse.etrice.core.room.RoomModel;
-import org.eclipse.etrice.core.room.SubSystemClass;
-import org.eclipse.etrice.core.ui.RoomUiModule;
-import org.eclipse.etrice.ui.behavior.editor.BehaviorExporter;
-import org.eclipse.etrice.ui.common.Activator;
-import org.eclipse.etrice.ui.common.preferences.PreferenceConstants;
-import org.eclipse.etrice.ui.structure.editor.StructureExporter;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.views.contentoutline.ContentOutline;
-import org.eclipse.xtext.diagnostics.Severity;
-import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.ui.editor.XtextEditor;
-import org.eclipse.xtext.ui.editor.model.IXtextDocument;
-import org.eclipse.xtext.ui.editor.outline.impl.EObjectNode;
-import org.eclipse.xtext.ui.editor.utils.EditorUtils;
-import org.eclipse.xtext.util.CancelIndicator;
-import org.eclipse.xtext.util.concurrent.IUnitOfWork;
-import org.eclipse.xtext.validation.CheckMode;
-import org.eclipse.xtext.validation.IResourceValidator;
-import org.eclipse.xtext.validation.Issue;
-
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-
-public class ExportDiagramsHandler extends AbstractHandler {
-
- @Inject
- protected IResourceValidator resourceValidator;
- private IPreferenceStore store;
-
- public ExportDiagramsHandler() {
- super();
-
- Injector injector = RoomUiModule.getInjector();
- injector.injectMembers(this);
-
- this.store = Activator.getDefault().getPreferenceStore();
- }
-
- // TODO: code copied from org.eclipse.etrice.ui.commands.handlers.AbstractEditHandler - refactor
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- final IEditorPart editor = window.getActivePage().getActiveEditor();
- if (editor instanceof XtextEditor) {
- final IPath path = ((FileEditorInput)editor.getEditorInput()).getPath();
-
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- // event from the xtext editor's outline view
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object sel = ss.getFirstElement();
- if (sel instanceof EObjectNode) {
- XtextEditor xtextEditor = EditorUtils.getActiveXtextEditor(event);
- IXtextDocument document = xtextEditor.getDocument();
- final String fragment = ((EObjectNode) sel).getEObjectURI().fragment();
- if (checkPrerequisites(xtextEditor, document, fragment)) {
- document.readOnly(new IUnitOfWork.Void<XtextResource>() {
- @Override
- public void process(XtextResource resource) throws Exception {
- if (resource != null) {
- EObject object = resource.getEObject(fragment);
-
- if (object instanceof RoomModel)
- exportDiagrams((RoomModel)object, path, editor.getSite().getShell());
- }
- }
- });
- }
- }
- }
- }
- return null;
- }
-
- protected void exportDiagrams(RoomModel model, IPath modelPath, Shell shell) {
- IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(modelPath.removeLastSegments(1));
- String relPath = store.getString(PreferenceConstants.EXPORT_DIAGRAM_PATH);
- boolean projectRelative = PreferenceConstants.PATH_REL_TO_PROJECT.equals(
- store.getString(PreferenceConstants.EXPORT_DIAGRAM_PATH_RELATIVE_TO));
-
- IFolder folder;
- if (projectRelative) {
- IProject project = container.getProject();
- folder = project.getFolder(relPath);
- }
- else {
- folder = container.getFolder(new Path(relPath));
- }
- if (folder!=null) {
- if (!folder.exists())
- try {
- create(folder);
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- if (folder.exists()) {
- String folderPath = folder.getLocation().toOSString();
-
- for (ActorClass ac : model.getActorClasses()) {
- if (ac.getStateMachine()!=null)
- BehaviorExporter.export(ac, folderPath);
-
- StructureExporter.export(ac, folderPath);
- }
-
- for (SubSystemClass ssc : model.getSubSystemClasses()) {
- StructureExporter.export(ssc, folderPath);
- }
-
- try {
- folder.refreshLocal(IResource.DEPTH_ONE, null);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- protected void create(final IResource resource) throws CoreException {
- if (resource == null || resource.exists())
- return;
- if (!resource.getParent().exists())
- create(resource.getParent());
- switch (resource.getType()) {
- case IResource.FILE:
- ((IFile) resource).create(new ByteArrayInputStream(new byte[0]), true, null);
- break;
- case IResource.FOLDER:
- ((IFolder) resource).create(IResource.NONE, true, null);
- break;
- case IResource.PROJECT:
- ((IProject) resource).create(null);
- ((IProject) resource).open(null);
- break;
- }
- }
- // TODO: code copied from org.eclipse.etrice.ui.commands.handlers.AbstractEditHandler - refactor
- protected boolean checkPrerequisites(XtextEditor xtextEditor,
- IXtextDocument document, final String fragment) {
- if (hasIssues(document, new NullProgressMonitor())) {
- MessageDialog.openError(xtextEditor.getSite().getShell(), "Validation Errors", "The editor has validation errors.\nCannot open diagram!");
- return false;
- }
- if (xtextEditor.isDirty()) {
- if (!MessageDialog.openQuestion(xtextEditor.getSite().getShell(), "Save model file", "The editor will be saved before opening the diagram editor.\nProceed?"))
- return false;
- // postpone save to avoid doing it twice
- }
- if (xtextEditor.isDirty()) {
- xtextEditor.doSave(new NullProgressMonitor());
- }
- return true;
- }
-
- // TODO: code copied from org.eclipse.etrice.ui.commands.handlers.AbstractEditHandler - refactor
- public boolean hasIssues(IXtextDocument xtextDocument, final IProgressMonitor monitor) {
- final boolean issues = xtextDocument
- .readOnly(new IUnitOfWork<Boolean, XtextResource>() {
- public Boolean exec(XtextResource resource) throws Exception {
- if (resource == null)
- return false;
- List<Issue> issueList = resourceValidator.validate(resource, CheckMode.NORMAL_AND_FAST, new CancelIndicator() {
- public boolean isCanceled() {
- return monitor.isCanceled();
- }
- });
- for (Issue issue : issueList) {
- if (issue.getSeverity()==Severity.ERROR)
- return true;
- }
- return false;
- }
- });
- return issues;
- }
-
- @Override
- public boolean isEnabled() {
- IWorkbench wb = PlatformUI.getWorkbench();
- IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
- IWorkbenchPage page = win.getActivePage();
- IWorkbenchPart part = page.getActivePart();
- if (part instanceof ContentOutline) {
- ISelection selection = ((ContentOutline)part).getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object sel = ss.getFirstElement();
- if (sel instanceof EObjectNode) {
- EObjectNode node = (EObjectNode) sel;
- String fragment = node.getEObjectURI().fragment();
- return fragment.equals("/");
- }
- }
- }
- return false;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.ui.commands.handlers;
+
+import java.io.ByteArrayInputStream;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.etrice.core.room.ActorClass;
+import org.eclipse.etrice.core.room.RoomModel;
+import org.eclipse.etrice.core.room.SubSystemClass;
+import org.eclipse.etrice.core.ui.RoomUiModule;
+import org.eclipse.etrice.ui.behavior.editor.BehaviorExporter;
+import org.eclipse.etrice.ui.common.Activator;
+import org.eclipse.etrice.ui.common.preferences.PreferenceConstants;
+import org.eclipse.etrice.ui.structure.editor.StructureExporter;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.xtext.diagnostics.Severity;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.ui.editor.XtextEditor;
+import org.eclipse.xtext.ui.editor.model.IXtextDocument;
+import org.eclipse.xtext.ui.editor.outline.impl.EObjectNode;
+import org.eclipse.xtext.ui.editor.utils.EditorUtils;
+import org.eclipse.xtext.util.CancelIndicator;
+import org.eclipse.xtext.util.concurrent.IUnitOfWork;
+import org.eclipse.xtext.validation.CheckMode;
+import org.eclipse.xtext.validation.IResourceValidator;
+import org.eclipse.xtext.validation.Issue;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+public class ExportDiagramsHandler extends AbstractHandler {
+
+ @Inject
+ protected IResourceValidator resourceValidator;
+ private IPreferenceStore store;
+
+ public ExportDiagramsHandler() {
+ super();
+
+ Injector injector = RoomUiModule.getInjector();
+ injector.injectMembers(this);
+
+ this.store = Activator.getDefault().getPreferenceStore();
+ }
+
+ // TODO: code copied from org.eclipse.etrice.ui.commands.handlers.AbstractEditHandler - refactor
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ final IEditorPart editor = window.getActivePage().getActiveEditor();
+ if (editor instanceof XtextEditor) {
+ final IPath path = ((FileEditorInput)editor.getEditorInput()).getPath();
+
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ // event from the xtext editor's outline view
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Object sel = ss.getFirstElement();
+ if (sel instanceof EObjectNode) {
+ XtextEditor xtextEditor = EditorUtils.getActiveXtextEditor(event);
+ IXtextDocument document = xtextEditor.getDocument();
+ final String fragment = ((EObjectNode) sel).getEObjectURI().fragment();
+ if (checkPrerequisites(xtextEditor, document, fragment)) {
+ document.readOnly(new IUnitOfWork.Void<XtextResource>() {
+ @Override
+ public void process(XtextResource resource) throws Exception {
+ if (resource != null) {
+ EObject object = resource.getEObject(fragment);
+
+ if (object instanceof RoomModel)
+ exportDiagrams((RoomModel)object, path, editor.getSite().getShell());
+ }
+ }
+ });
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ protected void exportDiagrams(RoomModel model, IPath modelPath, Shell shell) {
+ IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(modelPath.removeLastSegments(1));
+ String relPath = store.getString(PreferenceConstants.EXPORT_DIAGRAM_PATH);
+ boolean projectRelative = PreferenceConstants.PATH_REL_TO_PROJECT.equals(
+ store.getString(PreferenceConstants.EXPORT_DIAGRAM_PATH_RELATIVE_TO));
+
+ IFolder folder;
+ if (projectRelative) {
+ IProject project = container.getProject();
+ folder = project.getFolder(relPath);
+ }
+ else {
+ folder = container.getFolder(new Path(relPath));
+ }
+ if (folder!=null) {
+ if (!folder.exists())
+ try {
+ create(folder);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+
+ if (folder.exists()) {
+ String folderPath = folder.getLocation().toOSString();
+
+ for (ActorClass ac : model.getActorClasses()) {
+ if (ac.getStateMachine()!=null)
+ BehaviorExporter.export(ac, folderPath);
+
+ StructureExporter.export(ac, folderPath);
+ }
+
+ for (SubSystemClass ssc : model.getSubSystemClasses()) {
+ StructureExporter.export(ssc, folderPath);
+ }
+
+ try {
+ folder.refreshLocal(IResource.DEPTH_ONE, null);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ protected void create(final IResource resource) throws CoreException {
+ if (resource == null || resource.exists())
+ return;
+ if (!resource.getParent().exists())
+ create(resource.getParent());
+ switch (resource.getType()) {
+ case IResource.FILE:
+ ((IFile) resource).create(new ByteArrayInputStream(new byte[0]), true, null);
+ break;
+ case IResource.FOLDER:
+ ((IFolder) resource).create(IResource.NONE, true, null);
+ break;
+ case IResource.PROJECT:
+ ((IProject) resource).create(null);
+ ((IProject) resource).open(null);
+ break;
+ }
+ }
+ // TODO: code copied from org.eclipse.etrice.ui.commands.handlers.AbstractEditHandler - refactor
+ protected boolean checkPrerequisites(XtextEditor xtextEditor,
+ IXtextDocument document, final String fragment) {
+ if (hasIssues(document, new NullProgressMonitor())) {
+ MessageDialog.openError(xtextEditor.getSite().getShell(), "Validation Errors", "The editor has validation errors.\nCannot open diagram!");
+ return false;
+ }
+ if (xtextEditor.isDirty()) {
+ if (!MessageDialog.openQuestion(xtextEditor.getSite().getShell(), "Save model file", "The editor will be saved before opening the diagram editor.\nProceed?"))
+ return false;
+ // postpone save to avoid doing it twice
+ }
+ if (xtextEditor.isDirty()) {
+ xtextEditor.doSave(new NullProgressMonitor());
+ }
+ return true;
+ }
+
+ // TODO: code copied from org.eclipse.etrice.ui.commands.handlers.AbstractEditHandler - refactor
+ public boolean hasIssues(IXtextDocument xtextDocument, final IProgressMonitor monitor) {
+ final boolean issues = xtextDocument
+ .readOnly(new IUnitOfWork<Boolean, XtextResource>() {
+ public Boolean exec(XtextResource resource) throws Exception {
+ if (resource == null)
+ return false;
+ List<Issue> issueList = resourceValidator.validate(resource, CheckMode.NORMAL_AND_FAST, new CancelIndicator() {
+ public boolean isCanceled() {
+ return monitor.isCanceled();
+ }
+ });
+ for (Issue issue : issueList) {
+ if (issue.getSeverity()==Severity.ERROR)
+ return true;
+ }
+ return false;
+ }
+ });
+ return issues;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
+ IWorkbenchPage page = win.getActivePage();
+ IWorkbenchPart part = page.getActivePart();
+ if (part instanceof ContentOutline) {
+ ISelection selection = ((ContentOutline)part).getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Object sel = ss.getFirstElement();
+ if (sel instanceof EObjectNode) {
+ EObjectNode node = (EObjectNode) sel;
+ String fragment = node.getEObjectURI().fragment();
+ return fragment.equals("/");
+ }
+ }
+ }
+ return false;
+ }
+
+}

Back to the top