Merge branch 'zmeer/feature/emfGraphicalViewer'
diff --git a/description.txt b/description.txt
index bbeaa70..b8de5c8 100644
--- a/description.txt
+++ b/description.txt
@@ -1,4 +1,4 @@
-Application Platform Project for MultiCore (APP4MC) - Development tools
+1.Application Platform Project for MultiCore (APP4MC) - Development tools.
Development workflow:
diff --git a/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.extractor.build/.project b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.extractor.build/.project
new file mode 100644
index 0000000..c93b42d
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.extractor.build/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.app4mc.emfutils.extractor.build</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
diff --git a/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.extractor.build/META-INF/MANIFEST.MF b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.extractor.build/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9779095
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.extractor.build/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.app4mc.emfutils.content.extractor.build
+Bundle-SymbolicName: org.eclipse.app4mc.emfutils.extractor.build;singleton:=true
+Bundle-Version: 1.2.0
+Bundle-Activator: org.eclipse.app4mc.emfutils.content.extractor.Activator
+Require-Bundle: org.eclipse.ui
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7,
+ JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .,
+ lib/plantuml.8041.jar
+Bundle-Vendor: Eclipse.org
diff --git a/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.extractor.build/pom.xml b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.extractor.build/pom.xml
new file mode 100644
index 0000000..60d8273
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.extractor.build/pom.xml
@@ -0,0 +1,194 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.eclipse.app4mc.emfutils.content.extractor</groupId>
+ <artifactId>org.eclipse.app4mc.emfutils.extractor.build</artifactId>
+ <version>0.8.0</version>
+ <packaging>pom</packaging>
+ <name>Ecore Reference Extractor</name>
+
+ <properties>
+ <tycho.version>0.22.0</tycho.version>
+ <jacoco.version>0.7.4.201502262128</jacoco.version>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <luna-repo.url>http://download.eclipse.org/releases/luna</luna-repo.url>
+ <amalthea-repo.url>http://download.eclipse.org/app4mc/updatesites/releases/0.8.0/</amalthea-repo.url>
+
+ <franca-repo.url>http://franca.github.io/franca/update_site/releases/0.9.1/</franca-repo.url>
+ <orbit-repo.url>http://download.eclipse.org/tools/orbit/downloads/drops/R20150124073747/repository/</orbit-repo.url>
+ <ease-repo-url>http://download.eclipse.org/ease/update/release</ease-repo-url>
+ <sphinx-repo-url>http://download.eclipse.org/sphinx/updates/interim</sphinx-repo-url>
+ </properties>
+ <repositories>
+<repository>
+ <id>amalthea</id>
+ <url>${amalthea-repo.url}</url>
+ <layout>p2</layout>
+ </repository>
+ <repository>
+ <id>franca</id>
+ <url>${franca-repo.url}</url>
+ <layout>p2</layout>
+ </repository>
+ <repository>
+ <id>luna</id>
+ <url>${luna-repo.url}</url>
+ <layout>p2</layout>
+ </repository>
+ <repository>
+ <id>orbit</id>
+ <url>${orbit-repo.url}</url>
+ <layout>p2</layout>
+ </repository>
+ <repository>
+ <id>ease</id>
+ <url>${ease-repo-url}</url>
+ <layout>p2</layout>
+ </repository>
+ <repository>
+ <id>sphinx</id>
+ <url>${sphinx-repo-url}</url>
+ <layout>p2</layout>
+ </repository>
+ </repositories>
+
+
+ <modules>
+ <!-- Plugins -->
+ <module>../../plugins/org.eclipse.app4mc.emfutils.content.extractor</module>
+ <module>../../plugins/org.eclipse.app4mc.emfutils.metamodelviewer</module>
+ <module>../../plugins/org.eclipse.app4mc.emfutils.resourceset.mapper</module>
+
+ <!-- Tests -->
+
+ <!-- Features -->
+ <module>../../features/org.eclipse.app4mc.emfutils.content.extractor.feature</module>
+ <module>../../features/org.eclipse.app4mc.emfutils.metamodelviewer.feature</module>
+
+ <!-- P2Repo -->
+ <module>../org.eclipse.app4mc.emfutils.p2repo</module>
+
+ </modules>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-maven-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-compiler-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <configuration>
+ <verbose>true</verbose>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <version>${tycho.version}</version>
+ <configuration>
+ <dependency-resolution>
+ <extraRequirements>
+ <requirement>
+ <type>eclipse-plugin</type>
+ <id>org.hamcrest</id>
+ <versionRange>0.0.0</versionRange>
+ </requirement>
+ </extraRequirements>
+ </dependency-resolution>
+ <environments>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>linux</os>
+ <ws>gtk</ws>
+ <arch>x86_64</arch>
+ </environment>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86</arch>
+ </environment>
+ <environment>
+ <os>win32</os>
+ <ws>win32</ws>
+ <arch>x86_64</arch>
+ </environment>
+ <environment>
+ <os>macosx</os>
+ <ws>cocoa</ws>
+ <arch>x86_64</arch>
+ </environment>
+ </environments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <configuration>
+ <!-- argLine>${tycho.testArgLine}</argLine> -->
+ <forkMode>never</forkMode>
+ <includes>
+ <include>**/*Test.*</include>
+ </includes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.7.4.201502262128</version>
+ <configuration>
+ <excludes>
+
+ </excludes>
+ </configuration>
+ <executions>
+ <!-- Prepares the property pointing to the JaCoCo runtime agent which
+ is passed as VM argument when Maven the Surefire plugin is executed. -->
+ <execution>
+ <id>pre-unit-test</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
+ </configuration>
+ </execution>
+ <!-- Ensures that the code coverage report for unit tests is created
+ after unit tests have been run. -->
+ <execution>
+ <id>post-unit-test</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <!-- Sets the path to the file which contains the execution data. -->
+ <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
+ <!-- Sets the output directory for the code coverage report. -->
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/.gitignore b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/.project b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/.project
new file mode 100644
index 0000000..75a48a0
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.app4mc.emfutils.p2repo</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.UpdateSiteBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.UpdateSiteNature</nature>
+ </natures>
+</projectDescription>
diff --git a/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/category.xml b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/category.xml
new file mode 100644
index 0000000..11c6855
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/category.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <feature url="features/org.eclipse.app4mc.emfutils.metamodelviewer.feature_0.8.0.jar" id="org.eclipse.app4mc.emfutils.metamodelviewer.feature" version="0.8.0">
+ <category name="Ecore Tools"/>
+ </feature>
+ <feature url="features/org.eclipse.app4mc.emfutils.content.extractor.feature_0.8.0.jar" id="org.eclipse.app4mc.emfutils.content.extractor.feature" version="0.8.0">
+ <category name="Ecore Tools"/>
+ </feature>
+ <category-def name="Ecore Tools" label="org.eclipse.app4mc.emfutils.content.extractor"/>
+</site>
diff --git a/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/pom.xml b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/pom.xml
new file mode 100644
index 0000000..4f727c9
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/pom.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <relativePath>../org.eclipse.app4mc.emfutils.extractor.build</relativePath>
+ <groupId>org.eclipse.app4mc.emfutils.content.extractor</groupId>
+ <artifactId>org.eclipse.app4mc.emfutils.extractor.build</artifactId>
+ <version>0.8.0</version>
+ </parent>
+
+ <artifactId>org.eclipse.app4mc.emfutils.p2repo</artifactId>
+ <packaging>eclipse-repository</packaging>
+
+ <properties>
+ <org.jboss.tools.tycho-plugins.version>0.22.0</org.jboss.tools.tycho-plugins.version>
+ </properties>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Repository Group</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ </pluginRepository>
+
+ <pluginRepository>
+ <id>jboss-snapshots-repository</id>
+ <name>JBoss Snapshots Repository</name>
+ <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-repository-plugin</artifactId>
+ <version>${tycho.version}</version>
+
+ <configuration>
+ <compress/>
+ </configuration>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.jboss.tools.tycho-plugins</groupId>
+ <artifactId>repository-utils</artifactId>
+ <version>${org.jboss.tools.tycho-plugins.version}</version>
+
+ <executions>
+ <execution>
+ <id>generate-facade</id>
+ <phase>package</phase>
+
+ <goals>
+ <goal>generate-repository-facade</goal>
+ </goals>
+
+ <configuration>
+ <siteTemplateFolder>siteTemplate</siteTemplateFolder>
+
+ <!-- Symbols are used while expanding index.html template -->
+ <symbols>
+ <update.site.name>${project.parent.name}</update.site.name>
+ <target.eclipse.version>4.3.2</target.eclipse.version>
+ </symbols>
+
+ <associateSites>
+ <!-- site>http://hudson.eclipse.org/hudson/job/damos-master/lastSuccessfulBuild/artifact/update-site</site>
+ <site>http://download.eclipse.org/modeling/emf/emf/updates/releases</site>
+ <site>http://download.eclipse.org/modeling/emf/compare/updates/releases</site>
+ <site>http://download.eclipse.org/rmf/updates</site>
+ <site>http://download.eclipse.org/sphinx/updates/interim</site>
+ <site>http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases</site>
+ <site>http://franca.github.io/franca/update_site/releases</site>
+ <site>http://updates.yakindu.org/sct/kepler/releases</site>
+
+ <site>http://download.eclipse.org/sphinx/updates/interim</site-->
+ </associateSites>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/site.xml b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/site.xml
new file mode 100644
index 0000000..a1b4060
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/site.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <feature url="features/org.eclipse.app4mc.emfutils.content.extractor.feature_0.8.0.201704071342.jar" id="org.eclipse.app4mc.emfutils.content.extractor.feature" version="0.8.0.201704071342">
+ <category name="Ecore Tools"/>
+ </feature>
+ <feature url="features/org.eclipse.app4mc.emfutils.metamodelviewer.feature_0.8.0.201704071342.jar" id="org.eclipse.app4mc.emfutils.metamodelviewer.feature" version="0.8.0.201704071342">
+ <category name="Ecore Tools"/>
+ </feature>
+ <category-def name="Ecore Tools" label="Ecore Tools"/>
+</site>
diff --git a/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/siteTemplate/index.html b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/siteTemplate/index.html
new file mode 100644
index 0000000..ae0f77d
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/build/org.eclipse.app4mc.emfutils.p2repo/siteTemplate/index.html
@@ -0,0 +1,25 @@
+<html>
+ <head>
+ <title>${update.site.name} Update Site</title>
+ </head>
+
+ <body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
+
+ <h2 class="title">${update.site.name} - Use this URL in Eclipse to install ${update.site.name}</h2>
+
+ <p>This is the Update Site for ${update.site.name}.
+ <ol>
+ <li>To install ${update.site.name} from this site, start up Eclipse ${target.eclipse.version}, then do:
+ <ul><code><strong>Help > Install New Software... ></strong></code></ul>
+ </li>
+ <li>Copy this site's URL into Eclipse, and hit Enter.</li>
+ <li>When the site loads, select the features to install, or click the <code><strong>Select All</strong></code> button.</li>
+ <li>To properly resolve all dependencies, check
+ <ul><code><strong>[x] Contact all update sites during install to find required software</strong></code></ul>
+ <li>Click <code><strong>Next</strong></code>, agree to the license terms, and install.</li>
+ </ol>
+ </p>
+
+ <p>${site.contents}</p>
+ </body>
+</html>
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/.gitignore b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/.gitignore
new file mode 100644
index 0000000..84a4913
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/.gitignore
@@ -0,0 +1,2 @@
+/target
+/bin
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/.project b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/.project
new file mode 100644
index 0000000..b090637
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.app4mc.emfutils.content.extractor.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/build.properties b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/build.properties
new file mode 100644
index 0000000..64f93a9
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/build.properties
@@ -0,0 +1 @@
+bin.includes = feature.xml
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/feature.xml b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/feature.xml
new file mode 100644
index 0000000..313ecfa
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/feature.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.app4mc.emfutils.content.extractor.feature"
+ label="AMALTHEA Graphical Tools"
+ version="0.8.0"
+ provider-name="Eclipse.org">
+
+ <description url="http://www.example.com/description">
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ [Enter Copyright Description here.]
+ </copyright>
+
+ <license url="http://www.example.com/license">
+ [Enter License Description here.]
+ </license>
+
+ <includes
+ id="org.eclipse.app4mc.emfutils.metamodelviewer.feature"
+ version="0.0.0"/>
+
+ <requires>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.emf.ecore"/>
+ <import plugin="org.eclipse.emf.ecore.xmi"/>
+ <import plugin="org.eclipse.ui.browser"/>
+ <import plugin="org.eclipse.sphinx.emf"/>
+ <import plugin="org.eclipse.sphinx.emf.editors"/>
+ <import plugin="org.eclipse.sphinx.emf.editors.forms"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.app4mc.emfutils.content.extractor"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/pom.xml b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/pom.xml
new file mode 100644
index 0000000..40759f5
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.content.extractor.feature/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <relativePath>../../build/org.eclipse.app4mc.emfutils.extractor.build</relativePath>
+ <groupId>org.eclipse.app4mc.emfutils.content.extractor</groupId>
+ <artifactId>org.eclipse.app4mc.emfutils.extractor.build</artifactId>
+ <version>0.8.0</version>
+ </parent>
+
+ <artifactId>org.eclipse.app4mc.emfutils.content.extractor.feature</artifactId>
+ <packaging>eclipse-feature</packaging>
+
+</project>
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/.gitignore b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/.project b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/.project
new file mode 100644
index 0000000..2b681c4
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.app4mc.emfutils.metamodelviewer.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/build.properties b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/build.properties
new file mode 100644
index 0000000..64f93a9
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/build.properties
@@ -0,0 +1 @@
+bin.includes = feature.xml
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/feature.xml b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/feature.xml
new file mode 100644
index 0000000..971575e
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/feature.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.app4mc.emfutils.metamodelviewer.feature"
+ label="AMALTHEA MetaModel Viewer"
+ version="0.8.0"
+ provider-name="Eclipse.org">
+
+ <description url="http://www.example.com/description">
+ [Enter Feature Description here.]
+ </description>
+
+ <copyright url="http://www.example.com/copyright">
+ [Enter Copyright Description here.]
+ </copyright>
+
+ <license url="http://www.example.com/license">
+ [Enter License Description here.]
+ </license>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.sphinx.emf"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.app4mc.emfutils.metamodelviewer"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/pom.xml b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/pom.xml
new file mode 100644
index 0000000..fbcec10
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/features/org.eclipse.app4mc.emfutils.metamodelviewer.feature/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <relativePath>../../build/org.eclipse.app4mc.emfutils.extractor.build</relativePath>
+ <groupId>org.eclipse.app4mc.emfutils.content.extractor</groupId>
+ <artifactId>org.eclipse.app4mc.emfutils.extractor.build</artifactId>
+ <version>0.8.0</version>
+ </parent>
+
+ <artifactId>org.eclipse.app4mc.emfutils.metamodelviewer.feature</artifactId>
+ <packaging>eclipse-feature</packaging>
+
+</project>
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.classpath b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.classpath
new file mode 100644
index 0000000..fcf8b26
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.classpath
@@ -0,0 +1,9 @@
+<?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.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="xtend-gen"/>
+ <classpathentry exported="true" kind="lib" path="lib/plantuml.8041.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.gitignore b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.gitignore
new file mode 100644
index 0000000..8dc087c
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.gitignore
@@ -0,0 +1,3 @@
+/bin
+/target
+/xtend-gen
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.project b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.project
new file mode 100644
index 0000000..5f0bcdd
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.app4mc.emfutils.content.extractor</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <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>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.settings/org.eclipse.jdt.core.prefs b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f42de36
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/META-INF/MANIFEST.MF b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..491b281
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/META-INF/MANIFEST.MF
@@ -0,0 +1,201 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.app4mc.emfutils.content.extractor
+Bundle-SymbolicName: org.eclipse.app4mc.emfutils.content.extractor;singleton:=true
+Bundle-Version: 0.8.0
+Bundle-Activator: org.eclipse.app4mc.emfutils.content.extractor.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.ui.browser,
+ org.eclipse.sphinx.emf,
+ org.eclipse.sphinx.emf.editors,
+ org.eclipse.sphinx.emf.editors.forms,
+ com.google.guava,
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.xtend.lib,
+ org.eclipse.xtend.lib.macro
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7,JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .,lib/plantuml.8041.jar
+Export-Package: com.ctreber.acearth,
+ com.ctreber.acearth.gui,
+ com.ctreber.acearth.plugins,
+ com.ctreber.acearth.plugins.markers,
+ com.ctreber.acearth.projection,
+ com.ctreber.acearth.renderer,
+ com.ctreber.acearth.scanbit,
+ com.ctreber.acearth.scandot,
+ com.ctreber.acearth.shader,
+ com.ctreber.acearth.util,
+ com.ctreber.aclib.gui,
+ com.ctreber.aclib.sort,
+ com.google.zxing,
+ com.google.zxing.client.j2se,
+ com.google.zxing.common,
+ com.google.zxing.common.reedsolomon,
+ com.google.zxing.datamatrix.decoder,
+ com.google.zxing.qrcode,
+ com.google.zxing.qrcode.decoder,
+ com.google.zxing.qrcode.encoder,
+ gen.lib.cdt,
+ gen.lib.cgraph,
+ gen.lib.circogen,
+ gen.lib.common,
+ gen.lib.dotgen,
+ gen.lib.fdpgen,
+ gen.lib.gvc,
+ gen.lib.label,
+ gen.lib.ortho,
+ gen.lib.pack,
+ gen.lib.pathplan,
+ gen.lib.xdot,
+ gen.plugin.core,
+ gen.plugin.dot_layout,
+ h,
+ jcckit,
+ jcckit.data,
+ jcckit.graphic,
+ jcckit.plot,
+ jcckit.renderer,
+ jcckit.transformation,
+ jcckit.util,
+ net.sourceforge.plantuml,
+ net.sourceforge.plantuml.acearth,
+ net.sourceforge.plantuml.activitydiagram,
+ net.sourceforge.plantuml.activitydiagram.command,
+ net.sourceforge.plantuml.activitydiagram3,
+ net.sourceforge.plantuml.activitydiagram3.command,
+ net.sourceforge.plantuml.activitydiagram3.ftile,
+ net.sourceforge.plantuml.activitydiagram3.ftile.vcompact,
+ net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond,
+ net.sourceforge.plantuml.activitydiagram3.ftile.vertical,
+ net.sourceforge.plantuml.anim,
+ net.sourceforge.plantuml.ant,
+ net.sourceforge.plantuml.api,
+ net.sourceforge.plantuml.api.mda.option2,
+ net.sourceforge.plantuml.api.mda.option3,
+ net.sourceforge.plantuml.applet,
+ net.sourceforge.plantuml.asciiart,
+ net.sourceforge.plantuml.braille,
+ net.sourceforge.plantuml.classdiagram,
+ net.sourceforge.plantuml.classdiagram.command,
+ net.sourceforge.plantuml.code,
+ net.sourceforge.plantuml.command,
+ net.sourceforge.plantuml.command.note,
+ net.sourceforge.plantuml.command.note.sequence,
+ net.sourceforge.plantuml.command.regex,
+ net.sourceforge.plantuml.compositediagram,
+ net.sourceforge.plantuml.compositediagram.command,
+ net.sourceforge.plantuml.core,
+ net.sourceforge.plantuml.creole,
+ net.sourceforge.plantuml.cucadiagram,
+ net.sourceforge.plantuml.cucadiagram.dot,
+ net.sourceforge.plantuml.cucadiagram.entity,
+ net.sourceforge.plantuml.cute,
+ net.sourceforge.plantuml.dedication,
+ net.sourceforge.plantuml.descdiagram,
+ net.sourceforge.plantuml.descdiagram.command,
+ net.sourceforge.plantuml.directdot,
+ net.sourceforge.plantuml.ditaa,
+ net.sourceforge.plantuml.donors,
+ net.sourceforge.plantuml.eggs,
+ net.sourceforge.plantuml.eps,
+ net.sourceforge.plantuml.flashcode,
+ net.sourceforge.plantuml.flowdiagram,
+ net.sourceforge.plantuml.font,
+ net.sourceforge.plantuml.ftp,
+ net.sourceforge.plantuml.fun,
+ net.sourceforge.plantuml.geom,
+ net.sourceforge.plantuml.geom.kinetic,
+ net.sourceforge.plantuml.golem,
+ net.sourceforge.plantuml.graph,
+ net.sourceforge.plantuml.graph2,
+ net.sourceforge.plantuml.graphic,
+ net.sourceforge.plantuml.graphic.color,
+ net.sourceforge.plantuml.hector,
+ net.sourceforge.plantuml.hector2,
+ net.sourceforge.plantuml.hector2.continuity,
+ net.sourceforge.plantuml.hector2.graphic,
+ net.sourceforge.plantuml.hector2.layering,
+ net.sourceforge.plantuml.hector2.mpos,
+ net.sourceforge.plantuml.html,
+ net.sourceforge.plantuml.jasic,
+ net.sourceforge.plantuml.jcckit,
+ net.sourceforge.plantuml.jdot,
+ net.sourceforge.plantuml.jungle,
+ net.sourceforge.plantuml.logo,
+ net.sourceforge.plantuml.mda,
+ net.sourceforge.plantuml.mjpeg,
+ net.sourceforge.plantuml.objectdiagram,
+ net.sourceforge.plantuml.objectdiagram.command,
+ net.sourceforge.plantuml.openiconic,
+ net.sourceforge.plantuml.openiconic.data,
+ net.sourceforge.plantuml.oregon,
+ net.sourceforge.plantuml.pdf,
+ net.sourceforge.plantuml.png,
+ net.sourceforge.plantuml.posimo,
+ net.sourceforge.plantuml.postit,
+ net.sourceforge.plantuml.preproc,
+ net.sourceforge.plantuml.printskin,
+ net.sourceforge.plantuml.project,
+ net.sourceforge.plantuml.project.command,
+ net.sourceforge.plantuml.project.graphic,
+ net.sourceforge.plantuml.project2,
+ net.sourceforge.plantuml.project2.command,
+ net.sourceforge.plantuml.real,
+ net.sourceforge.plantuml.salt,
+ net.sourceforge.plantuml.salt.element,
+ net.sourceforge.plantuml.salt.factory,
+ net.sourceforge.plantuml.sequencediagram,
+ net.sourceforge.plantuml.sequencediagram.command,
+ net.sourceforge.plantuml.sequencediagram.graphic,
+ net.sourceforge.plantuml.sequencediagram.puma,
+ net.sourceforge.plantuml.sequencediagram.teoz,
+ net.sourceforge.plantuml.skin,
+ net.sourceforge.plantuml.skin.bluemodern,
+ net.sourceforge.plantuml.skin.rose,
+ net.sourceforge.plantuml.statediagram,
+ net.sourceforge.plantuml.statediagram.command,
+ net.sourceforge.plantuml.sudoku,
+ net.sourceforge.plantuml.suggest,
+ net.sourceforge.plantuml.svek,
+ net.sourceforge.plantuml.svek.extremity,
+ net.sourceforge.plantuml.svek.image,
+ net.sourceforge.plantuml.svg,
+ net.sourceforge.plantuml.swing,
+ net.sourceforge.plantuml.syntax,
+ net.sourceforge.plantuml.telnet,
+ net.sourceforge.plantuml.tikz,
+ net.sourceforge.plantuml.turing,
+ net.sourceforge.plantuml.ugraphic,
+ net.sourceforge.plantuml.ugraphic.arc,
+ net.sourceforge.plantuml.ugraphic.crossing,
+ net.sourceforge.plantuml.ugraphic.eps,
+ net.sourceforge.plantuml.ugraphic.g2d,
+ net.sourceforge.plantuml.ugraphic.hand,
+ net.sourceforge.plantuml.ugraphic.html5,
+ net.sourceforge.plantuml.ugraphic.sprite,
+ net.sourceforge.plantuml.ugraphic.svg,
+ net.sourceforge.plantuml.ugraphic.tikz,
+ net.sourceforge.plantuml.ugraphic.txt,
+ net.sourceforge.plantuml.ugraphic.visio,
+ net.sourceforge.plantuml.utils,
+ net.sourceforge.plantuml.version,
+ net.sourceforge.plantuml.webp,
+ net.sourceforge.plantuml.xmi,
+ net.sourceforge.plantuml.xmlsc,
+ org.eclipse.app4mc.emfutils.content.extractor,
+ org.eclipse.app4mc.emfutils.content.extractor.builders,
+ org.eclipse.app4mc.emfutils.content.extractor.handlers,
+ org.eclipse.app4mc.emfutils.content.extractor.preferences,
+ org.eclipse.app4mc.emfutils.content.extractor.views,
+ org.stathissideris.ascii2image.core,
+ org.stathissideris.ascii2image.graphics,
+ org.stathissideris.ascii2image.text,
+ smetana.core,
+ smetana.core.amiga,
+ smetana.core.debug
+Bundle-Vendor: Eclipse.org
+
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/build.properties b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/build.properties
new file mode 100644
index 0000000..ad1497a
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ lib/
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/drive_go.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/drive_go.png
new file mode 100644
index 0000000..fc53379
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/drive_go.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/elements_obj.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/elements_obj.gif
new file mode 100644
index 0000000..33be7d8
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/elements_obj.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/filenav_nav.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/filenav_nav.gif
new file mode 100644
index 0000000..4b98a62
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/filenav_nav.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/keygroups_obj.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/keygroups_obj.gif
new file mode 100644
index 0000000..fbc00a9
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/keygroups_obj.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/prop_ps.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/prop_ps.gif
new file mode 100644
index 0000000..d11c996
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/prop_ps.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/sample.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/sample.gif
new file mode 100644
index 0000000..34fb3c9
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/sample.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/super_co.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/super_co.gif
new file mode 100644
index 0000000..59ac116
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/super_co.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/tag_blue_add.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/tag_blue_add.png
new file mode 100644
index 0000000..f135248
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/icons/tag_blue_add.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/lib/plantuml.8041.jar b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/lib/plantuml.8041.jar
new file mode 100644
index 0000000..8350177
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/lib/plantuml.8041.jar
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/plugin.xml b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/plugin.xml
new file mode 100644
index 0000000..020cafa
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/plugin.xml
@@ -0,0 +1,312 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.commands">
+ <category
+ id="org.eclipse.app4mc.emfutils.content.extractor.category"
+ name="Extract Eclass References Category">
+ </category>
+ <command
+ categoryId="org.eclipse.app4mc.emfutils.content.extractor.category"
+ id="org.eclipse.app4mc.emfutils.content.extractor.eClassHierarchy.command"
+ name="Extract Eclass Hierarchy">
+ </command>
+ <command
+ categoryId="org.eclipse.app4mc.emfutils.content.extractor.category"
+ id="org.eclipse.app4mc.emfutils.content.extractor.eObjectReferences.command"
+ name="Extract Eobject References">
+ </command>
+ <command
+ categoryId="org.eclipse.app4mc.emfutils.content.extractor.category"
+ id="org.eclipse.app4mc.emfutils.content.extractor.eClassAllReferences.command"
+ name="Extract Eclass All References">
+ </command>
+ <command
+ categoryId="org.eclipse.app4mc.emfutils.content.extractor.category"
+ id="org.eclipse.app4mc.emfutils.content.extractor.eClassContentsAndHierarchy.command"
+ name="Extract Eclass Hierarchy And Their Contents">
+ </command>
+ <command
+ categoryId="org.eclipse.app4mc.emfutils.content.extractor.category"
+ id="org.eclipse.app4mc.emfutils.content.extractor.eClassContents.command"
+ name="Extract Eclass UML Contents">
+ </command>
+ <command
+ categoryId="org.eclipse.app4mc.emfutils.content.extractor.category"
+ id="org.eclipse.app4mc.emfutils.content.extractor.eClassContentsFromReference.command"
+ name="From reference -> Extract Eclass UML Contents">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.app4mc.emfutils.content.extractor.handlers.EClassHierarchyHandler"
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassHierarchy.command">
+ </handler>
+ <handler
+ class="org.eclipse.app4mc.emfutils.content.extractor.handlers.EObjectRefsHandler"
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eObjectReferences.command">
+ </handler>
+ <handler
+ class="org.eclipse.app4mc.emfutils.content.extractor.handlers.EClassAllReferencesHandler"
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassAllReferences.command">
+ </handler>
+ <handler
+ class="org.eclipse.app4mc.emfutils.content.extractor.handlers.EClassContentsAndHierarchyHandler"
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassContentsAndHierarchy.command">
+ </handler>
+ <handler
+ class="org.eclipse.app4mc.emfutils.content.extractor.handlers.EClassContentsHandler"
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassContents.command">
+ </handler>
+ <handler
+ class="org.eclipse.app4mc.emfutils.content.extractor.handlers.EClassContentsFromReferenceHandler"
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassContentsFromReference.command">
+ </handler>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.ui.popup.any?after=additions">
+ <menu
+ id="org.eclipse.app4mc.emfutils.content.extractor.menu"
+ label="APP4MC-EMF Utils"
+ mnemonic="M">
+ <command
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassHierarchy.command"
+ icon="icons/keygroups_obj.gif"
+ id="com.test.menus.sampleCommand"
+ label="EClass Hierarchy"
+ mnemonic="S">
+ <visibleWhen
+ checkEnabled="true">
+
+ <with
+ variable="activeMenuSelection">
+
+ <iterate
+ operator="or">
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EDataType">
+ </instanceof>
+ </not>
+ <or>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EStructuralFeature">
+ </instanceof>
+ </not>
+ </or>
+ </iterate>
+
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eObjectReferences.command"
+ icon="icons/sample.gif"
+ id="com.test.menus.sampleCommand1"
+ label="Eobject Refs">
+ <visibleWhen
+ checkEnabled="true">
+
+ <with
+ variable="activeMenuSelection">
+
+ <iterate>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EClass">
+ </instanceof>
+ </not>
+ <or>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EStructuralFeature">
+ </instanceof>
+ </not>
+ </or>
+ <or>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EDataType">
+ </instanceof>
+ </not>
+ </or>
+ </iterate>
+
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassAllReferences.command"
+ icon="icons/tag_blue_add.png"
+ id="com.test.menus.sampleCommand4"
+ label="EClass All References"
+ mnemonic="S">
+ <visibleWhen
+ checkEnabled="true">
+
+ <with
+ variable="activeMenuSelection">
+
+ <iterate>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EDataType">
+ </instanceof>
+ </not>
+ <or>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EStructuralFeature">
+ </instanceof>
+ </not>
+ </or>
+ </iterate>
+
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassContentsAndHierarchy.command"
+ icon="icons/elements_obj.gif"
+ id="com.test.menus.sampleCommand"
+ label="EClass Contents + Hierarchy"
+ mnemonic="S">
+ <visibleWhen
+ checkEnabled="true">
+
+ <with
+ variable="activeMenuSelection">
+
+ <iterate>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EDataType">
+ </instanceof>
+ </not>
+ <or>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EStructuralFeature">
+ </instanceof>
+ </not>
+ </or>
+ </iterate>
+
+ </with>
+
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassContents.command"
+ icon="icons/prop_ps.gif"
+ id="com.test.menus.sampleCommand"
+ label="EClass Contents"
+ mnemonic="S">
+ <visibleWhen
+ checkEnabled="true">
+
+ <with
+ variable="activeMenuSelection">
+
+ <iterate>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EDataType">
+ </instanceof>
+ </not>
+ <or>
+ <not>
+ <instanceof
+ value="org.eclipse.emf.ecore.EStructuralFeature">
+ </instanceof>
+ </not>
+ </or>
+ </iterate>
+
+ </with>
+
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.app4mc.emfutils.content.extractor.eClassContentsFromReference.command"
+ icon="icons/drive_go.png"
+ id="com.test.menus.sampleCommand"
+ label="EClass Contents from Reference"
+ mnemonic="S">
+ <visibleWhen
+ checkEnabled="true">
+
+ <with
+ variable="activeMenuSelection">
+
+ <iterate>
+ <instanceof
+ value="org.eclipse.emf.ecore.EStructuralFeature">
+ </instanceof>
+ </iterate>
+
+ </with>
+ </visibleWhen>
+ </command>
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="activeMenuSelection">
+ <iterate>
+ <instanceof
+ value="org.eclipse.emf.ecore.EObject">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </menu>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.eclipse.app4mc.emfutils.content.extractor.preferences.AmaltheaGraphicalRepresentationPreferencePage"
+ id="org.eclipse.app4mc.emfutils.content.extractor.preferences.AmaltheaPreferencePage"
+ name="AMALTHEA-Graphical-Representation">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.app4mc.emfutils.content.extractor.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.app4mc.emfutils.content.extractor"
+ name="AMALTHEA Graphical Representation">
+ </category>
+ <view
+ category="org.eclipse.app4mc.emfutils.content.extractor"
+ class="org.eclipse.app4mc.emfutils.content.extractor.views.DiagramView"
+ icon="icons/sample.gif"
+ id="org.eclipse.app4mc.emfutils.content.extractor.views.DiagramView"
+ name="Diagram View">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.eclipse.jdt.ui.JavaPerspective">
+ <view
+ id="org.eclipse.app4mc.emfutils.content.extractor.views.DiagramView"
+ ratio="0.5"
+ relationship="right"
+ relative="org.eclipse.ui.views.ProblemView">
+ </view>
+ </perspectiveExtension>
+ </extension>
+
+</plugin>
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/pom.xml b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/pom.xml
new file mode 100644
index 0000000..b09d677
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/pom.xml
@@ -0,0 +1,82 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <relativePath>../../build/org.eclipse.app4mc.emfutils.extractor.build</relativePath>
+ <groupId>org.eclipse.app4mc.emfutils.content.extractor</groupId>
+ <artifactId>org.eclipse.app4mc.emfutils.extractor.build</artifactId>
+ <version>0.8.0</version>
+ </parent>
+
+ <artifactId>org.eclipse.app4mc.emfutils.content.extractor</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>xtend-gen</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.4.1</version>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>xtend-gen</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>xtend-gen</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <version>2.7.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>xtend-gen</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/Activator.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/Activator.java
new file mode 100644
index 0000000..2030c5d
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/Activator.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor;
+
+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.app4mc.emfutils.content.extractor"; //$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)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassAllReferencesBufferBuilder.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassAllReferencesBufferBuilder.java
new file mode 100644
index 0000000..07dda76
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassAllReferencesBufferBuilder.java
@@ -0,0 +1,447 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.builders;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+public class EClassAllReferencesBufferBuilder {
+
+
+ private EMap<String, Object> id2ObjectsMap;
+
+ public EMap<String, Object> getId2ObjectsMap() {
+ return this.id2ObjectsMap;
+ }
+
+
+ public void setId2ObjectsMap(final EMap<String, Object> id2ObjectsMap) {
+ this.id2ObjectsMap = id2ObjectsMap;
+ }
+
+
+ public StringBuffer buildBuffer(final EClass selectedObjClass) {
+
+ this.id2ObjectsMap = new BasicEMap<String, Object>();
+
+
+ final StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ plantumlBuffer.append("@startuml");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ addClassInfo(selectedObjClass, plantumlBuffer);
+
+
+ populateHeirarchy(plantumlBuffer, selectedObjClass);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ /*- also display information of sub-classes */
+ populateSubClasses(plantumlBuffer, selectedObjClass);
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("@enduml");
+
+ return plantumlBuffer;
+
+ }
+
+
+ private void addClassInfo(final EClass selectedObjClass, final StringBuffer plantumlBuffer) {
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ if (selectedObjClass.isAbstract() && selectedObjClass.isInterface()) {
+ plantumlBuffer.append("interface \"" + selectedObjClass.getName() + "\"");
+
+ }
+ else if (selectedObjClass.isAbstract()) {
+ plantumlBuffer.append("abstract \"" + selectedObjClass.getName() + "\"");
+
+ }
+ else if (selectedObjClass.isInterface()) {
+
+ plantumlBuffer.append("interface \"" + selectedObjClass.getName() + "\"");
+ }
+ else {
+ plantumlBuffer.append("class \"" + selectedObjClass.getName() + "\"");
+
+ }
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+
+
+ private void populateHeirarchy(final StringBuffer plantumlBuffer, final EClass selectedObjClass) {
+
+ populateEClassReferences(plantumlBuffer, selectedObjClass);
+
+ for (final EClass superClass : selectedObjClass.getESuperTypes()) {
+
+
+ if (superClass.isAbstract() && superClass.isInterface()) {
+ addContentToBuffer(plantumlBuffer,
+ "interface \"" + superClass.getName() + "\"" + " [[" + getUUID(superClass) + "]]");
+
+ }
+ else if (superClass.isAbstract()) {
+ addContentToBuffer(plantumlBuffer,
+ "abstract \"" + superClass.getName() + "\"" + " [[" + getUUID(superClass) + "]]");
+
+ }
+ else if (superClass.isInterface()) {
+
+ addContentToBuffer(plantumlBuffer,
+ "interface \"" + superClass.getName() + "\"" + " [[" + getUUID(superClass) + "]]");
+ }
+ else {
+ addContentToBuffer(plantumlBuffer,
+ "class \"" + superClass.getName() + "\"" + " [[" + getUUID(superClass) + "]]");
+
+ }
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ addContentToBuffer(plantumlBuffer,
+ superClass.getName() + " <|-- " + selectedObjClass.getName() + " #darkblue");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ populateHeirarchy(plantumlBuffer, superClass);
+
+
+ }
+
+
+ }
+
+ private void addContentToBuffer(final StringBuffer plantumlBuffer, final String data) {
+
+ if (plantumlBuffer.toString().contains(data) == false) {
+ plantumlBuffer.append(data);
+ }
+
+ }
+
+ private void populateSubClasses(final StringBuffer plantumlBuffer, final EClass selectedObjClass) {
+
+ for (final EClass subClass : getSubClasses(selectedObjClass)) {
+
+
+ if (subClass.isAbstract() && subClass.isInterface()) {
+
+
+ addContentToBuffer(plantumlBuffer,
+ "interface \"" + subClass.getName() + "\"" + " [[" + getUUID(subClass) + "]]");
+
+ }
+ else if (subClass.isAbstract()) {
+ addContentToBuffer(plantumlBuffer,
+ "abstract \"" + subClass.getName() + "\"" + " [[" + getUUID(subClass) + "]]");
+
+ }
+ else if (subClass.isInterface()) {
+
+ addContentToBuffer(plantumlBuffer,
+ "interface \"" + subClass.getName() + "\"" + " [[" + getUUID(subClass) + "]]");
+ }
+ else {
+ addContentToBuffer(plantumlBuffer,
+ "class \"" + subClass.getName() + "\"" + " [[" + getUUID(subClass) + "]]");
+
+ }
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ addContentToBuffer(plantumlBuffer,
+ selectedObjClass.getName() + " <|-- " + subClass.getName() + " #darkGreen");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ populateEClassContainerInfo(plantumlBuffer, subClass);
+
+ populateSubClasses(plantumlBuffer, subClass);
+
+ }
+ }
+
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass) {
+
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ final ResourceSet resourceSet = selectedObjClass.eResource().getResourceSet();
+
+ if (resourceSet != null) {
+
+ // With this approach check is made to find the Sub-Classes for the supplied EClass in all the packages
+ // belonging to the resourceset
+
+ final EList<Resource> resources = resourceSet.getResources();
+
+ for (final Resource resource : resources) {
+
+ final EList<EObject> contents = resource.getContents();
+
+ if (contents.size() > 0) {
+// final EObject eObject = contents.get(0);
+
+ for (EObject eobj : contents) {
+
+ if (eobj instanceof EPackage) {
+ allSubClasses.addAll(getSubClasses(selectedObjClass, (EPackage) eobj));
+ }
+ }
+ }
+
+ }
+ }
+ else {
+
+ final EPackage ePackage = selectedObjClass.getEPackage();
+ return getSubClasses(selectedObjClass, ePackage);
+ }
+
+ return allSubClasses;
+
+ }
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass, final EPackage ePackage) {
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ final EList<EClassifier> eClassifiers = ePackage.getEClassifiers();
+
+ for (final EClassifier eClassifier : eClassifiers) {
+
+ if (eClassifier instanceof EClass) {
+
+ if (!(selectedObjClass == eClassifier) && selectedObjClass.isSuperTypeOf((EClass) eClassifier)) {
+ allSubClasses.add((EClass) eClassifier);
+ }
+
+
+ }
+ }
+ return allSubClasses;
+ }
+
+
+ private void populateEClassReferences(final StringBuffer plantumlBuffer, final EClass selectedObjClass) {
+ final List<EReference> result = new ArrayList<EReference>();
+
+ final Object searchScope = (selectedObjClass.eResource().getResourceSet() == null)
+ ? selectedObjClass.eResource() : selectedObjClass.eResource().getResourceSet();
+
+ /*- getting all the elements from the selected objects EClass --> by supplying the EResource of the corresponding EClass (i.e. ecore or Xcore) */
+
+ Collection<Setting> allRefSettings = null;
+ if (searchScope instanceof Resource) {
+ allRefSettings = EcoreUtil.UsageCrossReferencer.find(selectedObjClass, (Resource) searchScope);
+ }
+ else if (searchScope instanceof ResourceSet) {
+ allRefSettings = EcoreUtil.UsageCrossReferencer.find(selectedObjClass, (ResourceSet) searchScope);
+ }
+
+
+ /*- if refs of the EClass are found, then fill the plantUMLBuffer with the appropriate contents */
+
+ if (allRefSettings.size() > 0) {
+
+ for (final EStructuralFeature.Setting refSetting : allRefSettings) {
+
+ if (refSetting.getEObject() instanceof EReference
+ && !isElementContained(result, (EReference) refSetting.getEObject())) {
+ result.add((EReference) refSetting.getEObject());
+ }
+ }
+
+ for (final EReference eReference : result) {
+
+ final EClassifier eType = eReference.getEContainingClass();
+
+ addContentToBuffer(plantumlBuffer, "class \"" + eType.getName() + "\""
+ + (eReference.isContainment() ? "" : "") + " [[" + getUUID(eType) + "]]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+
+ for (final EReference eReference : result) {
+
+ final EClassifier referenceClasseType = eReference.getEContainingClass();
+
+
+ final String name = eReference.getName();
+
+ final boolean containment = eReference.isContainment();
+
+ final boolean many = eReference.isMany();
+
+ if (containment) {
+
+ addContentToBuffer(plantumlBuffer, referenceClasseType.getName() + "*-- "
+ + selectedObjClass.getName() + ":" + (many ? " (0-*) " : "") + name + " >");
+ }
+ else {
+ addContentToBuffer(plantumlBuffer, referenceClasseType.getName() + "--> "
+ + selectedObjClass.getName() + ":" + (many ? " (0-*) " : "") + name);
+
+ }
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+ }
+ else {
+
+ /*- no references for this EClass are found */
+ addContentToBuffer(plantumlBuffer,
+ "class \"" + selectedObjClass.getName() + "\"" + " [[" + getUUID(selectedObjClass) + "]]");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+ }
+
+
+ private void populateEClassContainerInfo(final StringBuffer plantumlBuffer, final EClass selectedObjClass) {
+ final List<EReference> result = new ArrayList<EReference>();
+
+
+ final Object searchScope = (selectedObjClass.eResource().getResourceSet() == null)
+ ? selectedObjClass.eResource() : selectedObjClass.eResource().getResourceSet();
+
+ /*- getting all the elements from the selected objects EClass --> by supplying the EResource of the corresponding EClass (i.e. ecore or Xcore) */
+
+ Collection<Setting> allRefSettings = null;
+ if (searchScope instanceof Resource) {
+ allRefSettings = EcoreUtil.UsageCrossReferencer.find(selectedObjClass, (Resource) searchScope);
+ }
+ else if (searchScope instanceof ResourceSet) {
+ allRefSettings = EcoreUtil.UsageCrossReferencer.find(selectedObjClass, (ResourceSet) searchScope);
+ }
+
+
+ /*- if refs of the EClass are found, then fill the plantUMLBuffer with the appropriate contents */
+
+ if (allRefSettings.size() > 0) {
+
+ for (final EStructuralFeature.Setting refSetting : allRefSettings) {
+
+ if (refSetting.getEObject() instanceof EReference
+ && !isElementContained(result, (EReference) refSetting.getEObject())) {
+ if (((EReference) refSetting.getEObject()).isContainment()) {
+ result.add((EReference) refSetting.getEObject());
+ }
+ }
+ }
+
+ for (final EReference eReference : result) {
+
+ /*- only containment reference information should be displayed --> other info should be ignored */
+
+ final EClassifier eType = eReference.getEContainingClass();
+
+ addContentToBuffer(plantumlBuffer, "class \"" + eType.getName() + "\""
+ + (eReference.isContainment() ? "" : "") + " [[" + getUUID(eType) + "]]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+
+ for (final EReference eReference : result) {
+
+ final EClassifier referenceClasseType = eReference.getEContainingClass();
+
+
+ final String name = eReference.getName();
+
+ final boolean containment = eReference.isContainment();
+
+ final boolean many = eReference.isMany();
+
+ if (containment) {
+
+ addContentToBuffer(plantumlBuffer, referenceClasseType.getName() + "*-- "
+ + selectedObjClass.getName() + ":" + (many ? " (0-*) " : "") + name + " >");
+ }
+ else {
+ addContentToBuffer(plantumlBuffer, referenceClasseType.getName() + "--> "
+ + selectedObjClass.getName() + ":" + (many ? " (0-*) " : "") + name);
+
+ }
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+ }
+ else {
+
+ /*- no references for this EClass are found */
+ addContentToBuffer(plantumlBuffer,
+ "class \"" + selectedObjClass.getName() + "\"" + " [[" + getUUID(selectedObjClass) + "]]");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+ }
+
+
+ private boolean isElementContained(final List<EReference> l, final EReference eRef) {
+ boolean isElementFound = false;
+ final Iterator<EReference> it = l.iterator();
+ while (it.hasNext() && !isElementFound) {
+ final EReference isContained = it.next();
+ if (isContained.equals(eRef)) {
+ isElementFound = true;
+ }
+ }
+ return isElementFound;
+ }
+
+
+ private String getUUID(final EClassifier eClass) {
+
+ if (this.id2ObjectsMap.containsValue(eClass)) {
+
+
+ for (final String key : this.id2ObjectsMap.keySet()) {
+ if (eClass == this.id2ObjectsMap.get(key)) {
+ return key;
+ }
+ }
+ }
+
+ final String uuid = EcoreUtil.generateUUID();
+
+ this.id2ObjectsMap.put(uuid, eClass);
+
+ return uuid;
+
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassContentsAndHierarchyBufferBuilder.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassContentsAndHierarchyBufferBuilder.java
new file mode 100644
index 0000000..4dd88cd
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassContentsAndHierarchyBufferBuilder.java
@@ -0,0 +1,436 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.builders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+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.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+public class EClassContentsAndHierarchyBufferBuilder {
+
+ private EMap<String, Object> id2ObjectsMap;
+
+ private final EList<EClass> addedEClassifiers = new BasicEList<EClass>();
+
+ public EMap<String, Object> getId2ObjectsMap() {
+ return this.id2ObjectsMap;
+ }
+
+
+ public void setId2ObjectsMap(final EMap<String, Object> id2ObjectsMap) {
+ this.id2ObjectsMap = id2ObjectsMap;
+ }
+
+
+ public StringBuffer buildBuffer(final EClass selectedObjClass) {
+
+ this.addedEClassifiers.clear();
+
+ this.id2ObjectsMap = new BasicEMap<String, Object>();
+
+ final StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ plantumlBuffer.append("@startuml");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ fillPlantUMLSkinParams(plantumlBuffer);
+
+ if (selectedObjClass.getESuperTypes().size() > 0) {
+
+ populateHeirarchy(plantumlBuffer, selectedObjClass);
+
+ }
+ else {
+
+ /*- no references for this EClass are found */
+ createClass(plantumlBuffer, selectedObjClass, "SelectedElement");
+
+ }
+
+
+ populateSubClassInfo(selectedObjClass, plantumlBuffer);
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("@enduml");
+
+ return plantumlBuffer;
+
+ }
+
+
+ private void populateSubClassInfo(final EClass selectedObjClass, final StringBuffer plantumlBuffer) {
+ for (final EClass subClass : getSubClasses(selectedObjClass)) {
+
+
+ createClass(plantumlBuffer, subClass, "H");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append(selectedObjClass.getName() + " <|-- " + subClass.getName());
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+ }
+
+
+ private void fillPlantUMLSkinParams(final StringBuffer plantumlBuffer) {
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("skinparam class {");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("BackgroundColor PaleGreen");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("ArrowColor SeaGreen");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("BorderColor SpringGreen");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("BackgroundColor<<H>> Wheat");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("BorderColor<<H>> Tomato");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("BackgroundColor<<SelectedElement>> DarkOrange ");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("BorderColor<<SelectedElement>> Tomato");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("}");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ plantumlBuffer.append("skinparam stereotypeCBackgroundColor YellowGreen");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("skinparam stereotypeCBackgroundColor <<H>> DimGray");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ }
+
+ private void populateHeirarchy(final StringBuffer plantumlBuffer, final EClass selectedObjClass) {
+
+ createClass(plantumlBuffer, selectedObjClass, "SelectedElement");
+
+
+ for (final EClass superClass : selectedObjClass.getESuperTypes()) {
+
+
+ createClass(plantumlBuffer, superClass, "H");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append(superClass.getName() + " <|-- " + selectedObjClass.getName());
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ populateHeirarchy(plantumlBuffer, superClass);
+ }
+
+ }
+
+
+ private void createEEnum(final StringBuffer plantumlBuffer, final EEnum eClassifier) {
+
+ plantumlBuffer.append("enum \"" + eClassifier.getName() + "\"");
+ plantumlBuffer.append("{");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ final EList<EEnumLiteral> eTypeParameters = eClassifier.getELiterals();
+
+ for (final EEnumLiteral eTypeParameter : eTypeParameters) {
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append(eTypeParameter.getName());
+
+
+ }
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("}");
+
+
+ }
+
+ private void createEDataType(final StringBuffer plantumlBuffer, final EDataType eClassifier) {
+
+ }
+
+
+ private void createClass(final StringBuffer plantumlBuffer, final EClass eClass, final String stereoType) {
+
+ if (!this.addedEClassifiers.contains(eClass)) {
+
+ this.addedEClassifiers.add(eClass);
+
+ /*- =================================== Start of Class Object =================================== */
+
+ final String uuid = EcoreUtil.generateUUID();
+
+
+ if (eClass.isAbstract() && eClass.isInterface()) {
+ plantumlBuffer.append("interface \"" + eClass.getName() + "\"");
+
+ }
+ else if (eClass.isAbstract()) {
+ plantumlBuffer.append("abstract \"" + eClass.getName() + "\"");
+
+ }
+ else if (eClass.isInterface()) {
+
+ plantumlBuffer.append("interface \"" + eClass.getName() + "\"");
+ }
+ else {
+ plantumlBuffer.append("class \"" + eClass.getName() + "\"");
+
+ }
+
+ if (stereoType != null) {
+ plantumlBuffer.append("<<" + stereoType + ">>");
+ }
+
+ plantumlBuffer.append(" [[" + uuid + "]] ");
+
+ this.id2ObjectsMap.put(uuid, eClass);
+
+
+ /*- listing attributes beloning to the specific EMF element */
+
+ final EList<EAttribute> eAttributes = eClass.getEAttributes();
+ final EList<EStructuralFeature> eStructuralFeatures = eClass.getEStructuralFeatures();
+
+ plantumlBuffer.append("{");
+
+ final List<EAttribute> referredEnums = new ArrayList<EAttribute>();
+
+ if (eAttributes.size() > 0) {
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ final List<EAttribute> processedAttributes = new ArrayList<EAttribute>();
+
+ for (final EAttribute eAttribute : eAttributes) {
+
+ if (!processedAttributes.contains(eAttribute)) {
+
+ if (eAttribute.getEAttributeType() instanceof EEnum) {
+ referredEnums.add(eAttribute);
+ }
+
+ processedAttributes.add(eAttribute);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ final String lowerBound = eAttribute.getLowerBound() == -1 ? "*"
+ : eAttribute.getLowerBound() + "";
+
+ final String upperBound = eAttribute.getUpperBound() == -1 ? "*"
+ : eAttribute.getUpperBound() + "";
+
+ plantumlBuffer.append(eAttribute.getEType().getName() + " " + eAttribute.getName() + " ["
+ + lowerBound + ":" + upperBound + "]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+
+
+ }
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ }
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ /*- listing EStructuralFeatures beloning to the specific EMF element */
+
+ final List<EStructuralFeature> processedFeatures = new ArrayList<EStructuralFeature>();
+
+ final List<EStructuralFeature> referredEStrcuturalFeatures = new ArrayList<EStructuralFeature>();
+
+ for (final EStructuralFeature eStructuralFeature : eStructuralFeatures) {
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ if (!processedFeatures.contains(eStructuralFeature) && (eStructuralFeature instanceof EReference)) {
+
+ processedFeatures.add(eStructuralFeature);
+
+ referredEStrcuturalFeatures.add(eStructuralFeature);
+
+ final String lowerBound = eStructuralFeature.getLowerBound() == -1 ? "*"
+ : eStructuralFeature.getLowerBound() + "";
+
+ final String upperBound = eStructuralFeature.getUpperBound() == -1 ? "*"
+ : eStructuralFeature.getUpperBound() + "";
+
+ plantumlBuffer.append(eStructuralFeature.getEType().getName() + " " + eStructuralFeature.getName()
+ + " [" + lowerBound + ":" + upperBound + "]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+ }
+
+ plantumlBuffer.append("}");
+
+ /*- =================================== End of Class Object =================================== */
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ for (final EStructuralFeature eStructuralFeature : referredEStrcuturalFeatures) {
+
+ createEClassifier(plantumlBuffer, eStructuralFeature.getEType());
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ final String relation = ((EReference) eStructuralFeature).isContainment() ? " *-- " : "--> ";
+
+
+ final String lowerBound = eStructuralFeature.getLowerBound() == -1 ? "*"
+ : eStructuralFeature.getLowerBound() + "";
+
+ final String upperBound = eStructuralFeature.getUpperBound() == -1 ? "*"
+ : eStructuralFeature.getUpperBound() + "";
+
+
+ plantumlBuffer.append(eClass.getName() + relation + eStructuralFeature.getEType().getName() + " : "
+ + eStructuralFeature.getName() + " [" + lowerBound + ":" + upperBound + "]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ for (final EAttribute eAttribute : referredEnums) {
+
+ createEClassifier(plantumlBuffer, eAttribute.getEType());
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ final String lowerBound = eAttribute.getLowerBound() == -1 ? "*" : eAttribute.getLowerBound() + "";
+
+ final String upperBound = eAttribute.getUpperBound() == -1 ? "*" : eAttribute.getUpperBound() + "";
+
+
+ plantumlBuffer.append(eClass.getName() + " *-- " + eAttribute.getEType().getName() + " : "
+ + eAttribute.getName() + " [" + lowerBound + ":" + upperBound + "]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ }
+
+ }
+
+
+ private void createEClassifier(final StringBuffer plantumlBuffer, final EClassifier eClassifier) {
+
+ if (eClassifier instanceof EClass) {
+ createClass(plantumlBuffer, (EClass) eClassifier, null);
+ }
+ else if (eClassifier instanceof EEnum) {
+ createEEnum(plantumlBuffer, (EEnum) eClassifier);
+ }
+ else if (eClassifier instanceof EDataType) {
+ createEDataType(plantumlBuffer, (EDataType) eClassifier);
+ }
+ }
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass) {
+
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ final ResourceSet resourceSet = selectedObjClass.eResource().getResourceSet();
+
+ if (resourceSet != null) {
+
+ // With this approach check is made to find the Sub-Classes for the supplied EClass in all the packages
+ // belonging to the resourceset
+
+ final EList<Resource> resources = resourceSet.getResources();
+
+ for (final Resource resource : resources) {
+
+ final EList<EObject> contents = resource.getContents();
+
+ if (contents.size() > 0) {
+// final EObject eObject = contents.get(0);
+
+ for (EObject eobj : contents) {
+
+ if (eobj instanceof EPackage) {
+ allSubClasses.addAll(getSubClasses(selectedObjClass, (EPackage) eobj));
+ }
+ }
+ }
+
+ }
+ }
+ else {
+
+ final EPackage ePackage = selectedObjClass.getEPackage();
+ return getSubClasses(selectedObjClass, ePackage);
+ }
+
+ return allSubClasses;
+
+ }
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass, final EPackage ePackage) {
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ final EList<EClassifier> eClassifiers = ePackage.getEClassifiers();
+
+ for (final EClassifier eClassifier : eClassifiers) {
+
+ if (eClassifier instanceof EClass) {
+
+ if (!(selectedObjClass == eClassifier) && selectedObjClass.isSuperTypeOf((EClass) eClassifier)) {
+ allSubClasses.add((EClass) eClassifier);
+ }
+
+
+ }
+ }
+ return allSubClasses;
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassContentsFromReferenceBufferBuilder.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassContentsFromReferenceBufferBuilder.java
new file mode 100644
index 0000000..14027c9
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassContentsFromReferenceBufferBuilder.java
@@ -0,0 +1,420 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.builders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+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.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+public class EClassContentsFromReferenceBufferBuilder {
+
+ private EMap<String, Object> id2ObjectsMap;
+
+ private final EList<EClass> addedEClassifiers = new BasicEList<EClass>();
+
+ public EMap<String, Object> getId2ObjectsMap() {
+ return this.id2ObjectsMap;
+ }
+
+
+ public void setId2ObjectsMap(final EMap<String, Object> id2ObjectsMap) {
+ this.id2ObjectsMap = id2ObjectsMap;
+ }
+
+
+ public StringBuffer buildBuffer(final EClass selectedObjClass) {
+
+ this.addedEClassifiers.clear();
+
+ this.id2ObjectsMap = new BasicEMap<String, Object>();
+
+ final StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ plantumlBuffer.append("@startuml");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ fillPlantUMLSkinParams(plantumlBuffer);
+
+ if (selectedObjClass.getESuperTypes().size() > 0) {
+
+ populateHeirarchy(plantumlBuffer, selectedObjClass);
+
+ }
+ else {
+
+ /*- no references for this EClass are found */
+ createClass(plantumlBuffer, selectedObjClass, "SelectedElement", 1);
+
+ }
+
+ populateSubClassInfo(selectedObjClass, plantumlBuffer);
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("@enduml");
+
+ return plantumlBuffer;
+
+ }
+
+ private void populateSubClassInfo(final EClass selectedObjClass, final StringBuffer plantumlBuffer) {
+ for (final EClass subClass : getSubClasses(selectedObjClass)) {
+
+
+ createClass(plantumlBuffer, subClass, "SelectedElement", 1);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append(selectedObjClass.getName() + " <|-- " + subClass.getName());
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+ }
+
+
+ private void fillPlantUMLSkinParams(final StringBuffer plantumlBuffer) {
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("skinparam class {");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("BackgroundColor PaleGreen");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("ArrowColor SeaGreen");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("BorderColor SpringGreen");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("BackgroundColor<<H>> Wheat");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("BorderColor<<H>> Tomato");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("BackgroundColor<<SelectedElement>> DarkOrange ");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("BorderColor<<SelectedElement>> Tomato");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("}");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ plantumlBuffer.append("skinparam stereotypeCBackgroundColor YellowGreen");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("skinparam stereotypeCBackgroundColor <<H>> DimGray");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ }
+
+ private void populateHeirarchy(final StringBuffer plantumlBuffer, final EClass selectedObjClass) {
+
+ createClass(plantumlBuffer, selectedObjClass, "H", 1);
+
+ }
+
+
+ private void createEEnum(final StringBuffer plantumlBuffer, final EEnum eClassifier, final int level) {
+
+ plantumlBuffer.append("enum \"" + eClassifier.getName() + "\"");
+ plantumlBuffer.append("{");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ final EList<EEnumLiteral> eTypeParameters = eClassifier.getELiterals();
+
+ for (final EEnumLiteral eTypeParameter : eTypeParameters) {
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append(eTypeParameter.getName());
+
+
+ }
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("}");
+
+
+ }
+
+ private void createEDataType(final StringBuffer plantumlBuffer, final EDataType eClassifier, final int level) {
+
+ }
+
+
+ private void createClass(final StringBuffer plantumlBuffer, final EClass eClass, final String stereoType,
+ final int level) {
+
+ if (!this.addedEClassifiers.contains(eClass)) {
+
+ this.addedEClassifiers.add(eClass);
+
+ /*- =================================== Start of Class Object =================================== */
+
+ final String uuid = EcoreUtil.generateUUID();
+
+
+ if (eClass.isAbstract() && eClass.isInterface()) {
+ plantumlBuffer.append("interface \"" + eClass.getName() + "\"");
+
+ }
+ else if (eClass.isAbstract()) {
+ plantumlBuffer.append("abstract \"" + eClass.getName() + "\"");
+
+ }
+ else if (eClass.isInterface()) {
+
+ plantumlBuffer.append("interface \"" + eClass.getName() + "\"");
+ }
+ else {
+ plantumlBuffer.append("class \"" + eClass.getName() + "\"");
+
+ }
+
+ if (stereoType != null) {
+ plantumlBuffer.append("<<" + stereoType + ">>");
+ }
+
+ plantumlBuffer.append(" [[" + uuid + "]] ");
+
+ this.id2ObjectsMap.put(uuid, eClass);
+
+
+ /*- listing attributes beloning to the specific EMF element */
+
+ final EList<EAttribute> eAttributes = eClass.getEAllAttributes();
+ final EList<EStructuralFeature> eStructuralFeatures = eClass.getEAllStructuralFeatures();
+
+ plantumlBuffer.append("{");
+
+ final List<EAttribute> referredEnums = new ArrayList<EAttribute>();
+
+ if (eAttributes.size() > 0) {
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ final List<EAttribute> processedAttributes = new ArrayList<EAttribute>();
+
+ for (final EAttribute eAttribute : eAttributes) {
+
+ if (!processedAttributes.contains(eAttribute)) {
+
+ if (eAttribute.getEAttributeType() instanceof EEnum) {
+ referredEnums.add(eAttribute);
+ }
+
+ processedAttributes.add(eAttribute);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ final String lowerBound = eAttribute.getLowerBound() == -1 ? "*"
+ : eAttribute.getLowerBound() + "";
+
+ final String upperBound = eAttribute.getUpperBound() == -1 ? "*"
+ : eAttribute.getUpperBound() + "";
+
+ plantumlBuffer.append(eAttribute.getEType().getName() + " " + eAttribute.getName() + " ["
+ + lowerBound + ":" + upperBound + "]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+
+
+ }
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ }
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ /*- listing EStructuralFeatures beloning to the specific EMF element */
+
+ final List<EStructuralFeature> processedFeatures = new ArrayList<EStructuralFeature>();
+
+ final List<EStructuralFeature> referredEStrcuturalFeatures = new ArrayList<EStructuralFeature>();
+
+ for (final EStructuralFeature eStructuralFeature : eStructuralFeatures) {
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ if (!processedFeatures.contains(eStructuralFeature) && (eStructuralFeature instanceof EReference)) {
+
+ processedFeatures.add(eStructuralFeature);
+
+ referredEStrcuturalFeatures.add(eStructuralFeature);
+
+ final String lowerBound = eStructuralFeature.getLowerBound() == -1 ? "*"
+ : eStructuralFeature.getLowerBound() + "";
+
+ final String upperBound = eStructuralFeature.getUpperBound() == -1 ? "*"
+ : eStructuralFeature.getUpperBound() + "";
+
+ plantumlBuffer.append(eStructuralFeature.getEType().getName() + " " + eStructuralFeature.getName()
+ + " [" + lowerBound + ":" + upperBound + "]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+ }
+
+ plantumlBuffer.append("}");
+
+ /*- =================================== End of Class Object =================================== */
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ for (final EStructuralFeature eStructuralFeature : referredEStrcuturalFeatures) {
+
+ createEClassifier(plantumlBuffer, eStructuralFeature.getEType(), level + 1);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ final String relation = ((EReference) eStructuralFeature).isContainment() ? " *-- " : "--> ";
+
+
+ final String lowerBound = eStructuralFeature.getLowerBound() == -1 ? "*"
+ : eStructuralFeature.getLowerBound() + "";
+
+ final String upperBound = eStructuralFeature.getUpperBound() == -1 ? "*"
+ : eStructuralFeature.getUpperBound() + "";
+
+
+ plantumlBuffer.append(eClass.getName() + relation + eStructuralFeature.getEType().getName() + " : "
+ + eStructuralFeature.getName() + " [" + lowerBound + ":" + upperBound + "]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ for (final EAttribute eAttribute : referredEnums) {
+
+ createEClassifier(plantumlBuffer, eAttribute.getEType(), level + 1);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ final String lowerBound = eAttribute.getLowerBound() == -1 ? "*" : eAttribute.getLowerBound() + "";
+
+ final String upperBound = eAttribute.getUpperBound() == -1 ? "*" : eAttribute.getUpperBound() + "";
+
+
+ plantumlBuffer.append(eClass.getName() + " *-- " + eAttribute.getEType().getName() + " : "
+ + eAttribute.getName() + " [" + lowerBound + ":" + upperBound + "]");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ }
+
+ }
+
+
+ private void createEClassifier(final StringBuffer plantumlBuffer, final EClassifier eClassifier, final int level) {
+
+ if (level > 2) {
+ return;
+ }
+ if (eClassifier instanceof EClass) {
+ createClass(plantumlBuffer, (EClass) eClassifier, null, level);
+ }
+ else if (eClassifier instanceof EEnum) {
+ createEEnum(plantumlBuffer, (EEnum) eClassifier, level);
+ }
+ else if (eClassifier instanceof EDataType) {
+ createEDataType(plantumlBuffer, (EDataType) eClassifier, level);
+ }
+ }
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass) {
+
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ final ResourceSet resourceSet = selectedObjClass.eResource().getResourceSet();
+
+ if (resourceSet != null) {
+
+ // With this approach check is made to find the Sub-Classes for the supplied EClass in all the packages
+ // belonging to the resourceset
+
+ final EList<Resource> resources = resourceSet.getResources();
+
+ for (final Resource resource : resources) {
+
+ final EList<EObject> contents = resource.getContents();
+
+ if (contents.size() > 0) {
+ final EObject eObject = contents.get(0);
+
+ if (eObject instanceof EPackage) {
+ allSubClasses.addAll(getSubClasses(selectedObjClass, (EPackage) eObject));
+ }
+ }
+
+ }
+ }
+ else {
+
+ final EPackage ePackage = selectedObjClass.getEPackage();
+ return getSubClasses(selectedObjClass, ePackage);
+ }
+
+ return allSubClasses;
+
+ }
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass, final EPackage ePackage) {
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ final EList<EClassifier> eClassifiers = ePackage.getEClassifiers();
+
+ for (final EClassifier eClassifier : eClassifiers) {
+
+ if (eClassifier instanceof EClass) {
+
+ if (!(selectedObjClass == eClassifier) && selectedObjClass.isSuperTypeOf((EClass) eClassifier)) {
+ allSubClasses.add((EClass) eClassifier);
+ }
+
+
+ }
+ }
+ return allSubClasses;
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassHierarchyBufferBuilder.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassHierarchyBufferBuilder.java
new file mode 100644
index 0000000..4bfc97a
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassHierarchyBufferBuilder.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.builders;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+public class EClassHierarchyBufferBuilder {
+
+ private EMap<String, Object> id2ObjectsMap;
+
+ public EMap<String, Object> getId2ObjectsMap() {
+ return this.id2ObjectsMap;
+ }
+
+
+ public void setId2ObjectsMap(final EMap<String, Object> id2ObjectsMap) {
+ this.id2ObjectsMap = id2ObjectsMap;
+ }
+
+
+ public StringBuffer buildBuffer(final EClass selectedObjClass) {
+
+ this.id2ObjectsMap = new BasicEMap<String, Object>();
+
+ final StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ plantumlBuffer.append("@startuml");
+
+ addClassInfo(selectedObjClass, plantumlBuffer);
+
+ final EList<EClass> eSuperTypes = selectedObjClass.getESuperTypes();
+ final List<EClass> subClasses = getSubClasses(selectedObjClass);
+
+ if (eSuperTypes.size() > 0) {
+
+ populateHeirarchy(plantumlBuffer, selectedObjClass, this.id2ObjectsMap);
+
+ }
+
+ if (subClasses.size() > 0) {
+
+ /*- populating sub-classes */
+ populateSubClasses(plantumlBuffer, subClasses, selectedObjClass, this.id2ObjectsMap);
+ }
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("@enduml");
+
+ return plantumlBuffer;
+
+ }
+
+ private void addClassInfo(final EClass selectedObjClass, final StringBuffer plantumlBuffer) {
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ if (selectedObjClass.isAbstract() && selectedObjClass.isInterface()) {
+ plantumlBuffer.append("interface \"" + selectedObjClass.getName() + "\"");
+
+ }
+ else if (selectedObjClass.isAbstract()) {
+ plantumlBuffer.append("abstract \"" + selectedObjClass.getName() + "\"");
+
+ }
+ else if (selectedObjClass.isInterface()) {
+
+ plantumlBuffer.append("interface \"" + selectedObjClass.getName() + "\"");
+ }
+ else {
+ plantumlBuffer.append("class \"" + selectedObjClass.getName() + "\"");
+
+ }
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+
+
+ private void populateSubClasses(final StringBuffer plantumlBuffer, final List<EClass> subClasses,
+ final EClass selectedObjClass, final EMap<String, Object> id2ObjectsMap) {
+
+ for (final EClass subClass : subClasses) {
+
+ final String uuid = EcoreUtil.generateUUID();
+
+
+ if (subClass.isAbstract() && subClass.isInterface()) {
+ plantumlBuffer.append("interface \"" + subClass.getName() + "\"" + " [[" + uuid + "]]");
+
+ }
+ else if (subClass.isAbstract()) {
+ plantumlBuffer.append("abstract \"" + subClass.getName() + "\"" + " [[" + uuid + "]]");
+
+ }
+ else if (subClass.isInterface()) {
+
+ plantumlBuffer.append("interface \"" + subClass.getName() + "\"" + " [[" + uuid + "]]");
+ }
+ else {
+ plantumlBuffer.append("class \"" + subClass.getName() + "\"" + " [[" + uuid + "]]");
+
+ }
+
+ id2ObjectsMap.put(uuid, subClass);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append(selectedObjClass.getName() + " <|-- " + subClass.getName());
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ }
+
+ }
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass) {
+
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ final ResourceSet resourceSet = selectedObjClass.eResource().getResourceSet();
+
+ if (resourceSet != null) {
+
+ // With this approach check is made to find the Sub-Classes for the supplied EClass in all the packages
+ // belonging to the resourceset
+
+ final EList<Resource> resources = resourceSet.getResources();
+
+ for (final Resource resource : resources) {
+
+ final EList<EObject> contents = resource.getContents();
+
+ if (contents.size() > 0) {
+// final EObject eObject = contents.get(0);
+
+ for (EObject eobj : contents) {
+
+ if (eobj instanceof EPackage) {
+ allSubClasses.addAll(getSubClasses(selectedObjClass, (EPackage) eobj));
+ }
+ }
+
+ }
+
+ }
+ }
+ else {
+
+ final EPackage ePackage = selectedObjClass.getEPackage();
+ return getSubClasses(selectedObjClass, ePackage);
+ }
+
+ return allSubClasses;
+
+ }
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass, final EPackage ePackage) {
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ final EList<EClassifier> eClassifiers = ePackage.getEClassifiers();
+
+ for (final EClassifier eClassifier : eClassifiers) {
+
+ if (eClassifier instanceof EClass) {
+
+ if (!(selectedObjClass == eClassifier) && selectedObjClass.isSuperTypeOf((EClass) eClassifier)) {
+ allSubClasses.add((EClass) eClassifier);
+ }
+
+
+ }
+ }
+ return allSubClasses;
+ }
+
+
+ private void populateHeirarchy(final StringBuffer plantumlBuffer, final EClass selectedObjClass,
+ final EMap<String, Object> id2ObjectsMap) {
+ for (final EClass superClass : selectedObjClass.getESuperTypes()) {
+
+ final String uuid = EcoreUtil.generateUUID();
+
+ if (superClass.isAbstract() && superClass.isInterface()) {
+ plantumlBuffer.append("interface \"" + superClass.getName() + "\"" + " [[" + uuid + "]]");
+
+ }
+ else if (superClass.isAbstract()) {
+ plantumlBuffer.append("abstract \"" + superClass.getName() + "\"" + " [[" + uuid + "]]");
+
+ }
+ else if (superClass.isInterface()) {
+
+ plantumlBuffer.append("interface \"" + superClass.getName() + "\"" + " [[" + uuid + "]]");
+ }
+ else {
+ plantumlBuffer.append("class \"" + superClass.getName() + "\"" + " [[" + uuid + "]]");
+
+ }
+
+ id2ObjectsMap.put(uuid, superClass);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append(superClass.getName() + " <|-- " + selectedObjClass.getName());
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ populateHeirarchy(plantumlBuffer, superClass, id2ObjectsMap);
+ }
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassHierarchyBufferBuilder2.xtend b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassHierarchyBufferBuilder2.xtend
new file mode 100644
index 0000000..7903bed
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EClassHierarchyBufferBuilder2.xtend
@@ -0,0 +1,156 @@
+package org.eclipse.app4mc.emfutils.content.extractor.builders
+
+import org.eclipse.emf.common.util.BasicEMap
+import org.eclipse.emf.common.util.EMap
+import org.eclipse.emf.ecore.EClass
+import org.eclipse.emf.ecore.EObject
+import org.eclipse.emf.ecore.resource.ResourceSet
+import org.eclipse.emf.common.util.EList
+import java.util.ArrayList
+import org.eclipse.emf.ecore.EPackage
+import java.util.List
+import org.eclipse.emf.ecore.resource.Resource
+import org.eclipse.emf.ecore.EClassifier
+import org.eclipse.emf.ecore.util.EcoreUtil
+
+class EClassHierarchyBufferBuilder2 {
+
+ var EMap<String, Object> id2ObjectsMap = new BasicEMap
+
+ def public setId2ObjectsMap(EMap<String, Object> id2ObjectsMap) {
+ this.id2ObjectsMap = id2ObjectsMap
+ }
+
+ def buildBuffer(EClass selectedObjClass) '''
+
+ «id2ObjectsMap = new BasicEMap»
+
+ @startuml
+
+ ««« Generation of EClass basic information »»
+
+ «addClassInfo(selectedObjClass)»
+
+ ««« Generation of Hierarchy for Super types »»
+
+ «IF selectedObjClass.ESuperTypes.size > 0»
+
+ «FOR superClass: selectedObjClass.ESuperTypes»
+
+ ««« UUID - which will be used for elements lookup »»
+ «var String uuid=EcoreUtil.generateUUID»
+
+ «IF superClass.abstract && superClass.interface»
+ interface «superClass.name» "[[«uuid»]]"
+ «ELSEIF superClass.abstract»
+ abstract «superClass.name» "[[«uuid»]]"
+ «ELSEIF superClass.interface»
+ interface «superClass.name» "[[«uuid»]]"
+ «ELSE»
+ class «superClass.name» "[[«uuid»]]"
+
+ «ENDIF»
+
+
+ «id2ObjectsMap.put(uuid, superClass)»
+
+ «superClass.name» <|--«selectedObjClass.name»
+
+
+
+ «ENDFOR»
+
+
+ «ENDIF»
+
+ « var List<EClass> subClasses=getSubClasses(selectedObjClass) »
+
+ «IF subClasses.size>0»
+
+ «ENDIF»
+
+ @enduml
+
+
+
+ '''
+
+ /**
+ * This method is used to add EClass specific information
+ */
+ protected def CharSequence addClassInfo(EClass selectedObjClass) '''«IF selectedObjClass.abstract && selectedObjClass.interface»
+
+ interface «selectedObjClass.name»
+ «ELSEIF selectedObjClass.abstract»
+ abstract «selectedObjClass.name»
+ «ELSEIF selectedObjClass.interface»
+ interface «selectedObjClass.name»
+ «ELSE»
+ class «selectedObjClass.name»
+ «ENDIF»'''
+
+/**
+ * This method is used to get the List of sub-classes of a specific EClass
+ */
+
+ def private List<EClass> getSubClasses(EClass eClass) {
+
+ var List<EClass> allSubClasses = new ArrayList
+
+ var ResourceSet resourceSet = eClass.eResource().getResourceSet();
+
+ if (resourceSet != null) {
+
+ // With this approach check is made to find the Sub-Classes for the supplied EClass in all the packages
+ // belonging to the resourceset
+ var EList<Resource> resources = resourceSet.getResources();
+
+ for (Resource resource : resources) {
+
+ var EList<EObject> contents = resource.getContents();
+
+ if (contents.size() > 0) {
+// var EObject eObject = contents.get(0);
+
+ for (element : contents) {
+ if (element instanceof EPackage) {
+ allSubClasses.addAll(getSubClasses(eClass, element));
+ }
+
+}
+ }
+
+ }
+ } else {
+
+ var EPackage ePackage = eClass.getEPackage();
+ return getSubClasses(eClass, ePackage);
+ }
+
+ return allSubClasses;
+
+ }
+
+/**
+ * This method is used to get the List of sub-classes of a specific EClass in the scope of EPackage
+ */
+ def List<EClass> getSubClasses(EClass selectedObjClass, EPackage ePackage) {
+
+ var List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ var EList<EClassifier> eClassifiers = ePackage.getEClassifiers();
+
+ for (EClassifier eClassifier : eClassifiers) {
+
+ if (eClassifier instanceof EClass) {
+
+ if (!(selectedObjClass == eClassifier) && selectedObjClass.isSuperTypeOf(eClassifier)) {
+ allSubClasses.add(eClassifier);
+ }
+
+ }
+ }
+ return allSubClasses;
+ }
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EObjectRefsBufferBuilder.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EObjectRefsBufferBuilder.java
new file mode 100644
index 0000000..73ebd6f
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/EObjectRefsBufferBuilder.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.builders;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+
+public class EObjectRefsBufferBuilder {
+
+ private EMap<String, Object> id2ObjectsMap;
+
+ public StringBuffer buildBuffer(final EObject eObject) {
+
+ this.id2ObjectsMap = new BasicEMap<String, Object>();
+
+ final StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ plantumlBuffer.append("@startuml");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ buildBuffer(eObject, plantumlBuffer);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("@enduml");
+
+ return plantumlBuffer;
+
+ }
+
+
+ public EMap<String, Object> getId2ObjectsMap() {
+ return this.id2ObjectsMap;
+ }
+
+
+ private void buildBuffer(final EObject selectedEObj, final StringBuffer plantumlBuffer) {
+
+ final List<EObject> result = new ArrayList<EObject>();
+
+ /*- getting all the elements from the selected objects EClass --> by supplying the EResource of the corresponding EClass (i.e. ecore or Xcore) */
+
+ Collection<Setting> allRefSettings = null;
+
+ final Resource eResource = selectedEObj.eResource();
+
+ if (eResource == null) {
+ allRefSettings = EcoreUtil.UsageCrossReferencer.find(selectedEObj,
+ EcoreUtil.getRootContainer(selectedEObj));
+ }
+ else {
+ allRefSettings = EcoreUtil.UsageCrossReferencer.find(selectedEObj, eResource.getResourceSet());
+ }
+
+ /*-
+ * In case of many elements it is difficult to visualize the contents in the diagram.
+ *
+ * Below code provides the possibility to specify the range
+ */
+ if (allRefSettings.size() > 100) {
+
+
+ final InputDialog inputDialog = new InputDialog(
+ org.eclipse.swt.widgets.Display.getDefault().getActiveShell(), "Element selection dialog",
+ "There are " + allRefSettings.size()
+ + " references. specify the range for which contents should be represented graphically",
+ "0-" + (allRefSettings.size() - 1), new IInputValidator() {
+
+ @Override
+ public String isValid(final String newText) {
+ if (Pattern.matches("(\\d)+\\-(\\d)+", newText) == false) {
+ return "Specify the range in the following way int-int eg. 10-20 ";
+ }
+ return null;
+ }
+ });
+
+ final int status = inputDialog.open();
+
+ if (status == 0) {
+ final String value = inputDialog.getValue();
+
+ final String[] split = value.split("-");
+
+ allRefSettings = new ArrayList<Setting>(allRefSettings).subList(Integer.parseInt(split[0]),
+ Integer.parseInt(split[1]) < allRefSettings.size() ? Integer.parseInt(split[1])
+ : (allRefSettings.size() - 1));
+
+ }
+ else {
+ allRefSettings = new ArrayList<Setting>(allRefSettings).subList(0, 99);
+ }
+
+
+ }
+
+
+ /*- if refs of the EClass are found, then fill the plantUMLBuffer with the appropriate contents */
+
+ if (allRefSettings.size() > 0) {
+
+ for (final EStructuralFeature.Setting setting : allRefSettings) {
+
+ if (!isElementContained(result, setting.getEObject())) {
+ result.add(setting.getEObject());
+
+ }
+
+ }
+
+ createClass(plantumlBuffer, this.id2ObjectsMap, selectedEObj);
+
+ for (final EObject eobj : result) {
+
+ createClass(plantumlBuffer, this.id2ObjectsMap, eobj);
+
+ if (!isNamePresent(eobj)) {
+
+ /*- As name is not present, generate the heirarchy till the level Object with Structural Feature name is present */
+
+ associateContainer(eobj, plantumlBuffer, this.id2ObjectsMap);
+
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+ }
+
+ for (final EObject eobj : result) {
+
+ final String name = getName(eobj).toString();
+
+ plantumlBuffer.append(name + "--> " + getName(selectedEObj));
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+ }
+ else {
+
+ /*- no references for this EClass are found */
+
+ createClass(plantumlBuffer, this.id2ObjectsMap, selectedEObj);
+
+ }
+
+
+ }
+
+ private void createClass(final StringBuffer plantumlBuffer, final EMap<String, Object> id2ObjectsMap,
+ final EObject selectedEObj) {
+ final String uuid = EcoreUtil.generateUUID();
+
+ plantumlBuffer.append("class " + getName(selectedEObj) + " << (O,#B4A7E5) " + selectedEObj.eClass().getName()
+ + " >>" + " [[" + uuid + "]]");
+
+ id2ObjectsMap.put(uuid, selectedEObj);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+
+
+ private Object getName(final EObject eObject) {
+ final EStructuralFeature eStructuralFeature = eObject.eClass().getEStructuralFeature("name");
+
+ if (eStructuralFeature != null) {
+
+ final Object originalName = eObject.eGet(eStructuralFeature);
+
+ return "\"" + originalName + "\"";
+ }
+
+ return eObject.eClass().getName() + "__" + eObject.hashCode();
+ }
+
+
+ private void associateContainer(final EObject eobj, final StringBuffer plantumlBuffer,
+ final EMap<String, Object> id2ObjectsMap) {
+
+ final EObject eContainerObj = eobj.eContainer();
+
+ if (eContainerObj == null) {
+ return;
+ }
+
+ createClass(plantumlBuffer, id2ObjectsMap, eContainerObj);
+
+
+ plantumlBuffer.append(getName(eContainerObj) + " *-- " + getName(eobj));
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ if (!isNamePresent(eContainerObj)) {
+
+ associateContainer(eContainerObj, plantumlBuffer, id2ObjectsMap);
+
+ }
+
+ }
+
+ private boolean isNamePresent(final EObject eObject) {
+ final EStructuralFeature eStructuralFeature = eObject.eClass().getEStructuralFeature("name");
+
+ if (eStructuralFeature == null) {
+
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean isElementContained(final List<EObject> l, final EObject eRef) {
+ boolean isElementFound = false;
+ final Iterator<EObject> it = l.iterator();
+ while (it.hasNext() && !isElementFound) {
+ final EObject isContained = it.next();
+ if (isContained.equals(eRef)) {
+ isElementFound = true;
+ }
+ }
+ return isElementFound;
+ }
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/ObjectContentBufferBuilder.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/ObjectContentBufferBuilder.java
new file mode 100644
index 0000000..4f289ab
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/builders/ObjectContentBufferBuilder.java
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.builders;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+
+
+public class ObjectContentBufferBuilder {
+
+ /* EClassContents and EObjectRefs behaviour is included in ObjectContentBufferBuilder java class */
+
+ private EMap<String, Object> id2ObjectsMap;
+
+ public StringBuffer buildBuffer(final EObject eObject) {
+
+ this.id2ObjectsMap = new BasicEMap<String, Object>();
+
+ final StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ plantumlBuffer.append("@startuml");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ buildBuffer(eObject, plantumlBuffer);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("@enduml");
+
+ return plantumlBuffer;
+
+ }
+
+
+ public StringBuffer buildBufferForCollection(final EList<?> eList) {
+
+ this.id2ObjectsMap = new BasicEMap<String, Object>();
+
+ final StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ plantumlBuffer.append("@startuml");
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ createClass(plantumlBuffer, this.id2ObjectsMap, eList, null);
+
+ for (final Object object : getElementsBasedOnRange(eList)) {
+ if (object instanceof EObject) {
+
+ createClass(plantumlBuffer, this.id2ObjectsMap, (EObject) object);
+
+ final String name = getName((EObject) object).toString();
+
+ plantumlBuffer.append("Collection --> " + name);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ }
+ }
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ plantumlBuffer.append("@enduml");
+
+ return plantumlBuffer;
+
+ }
+
+
+ public EMap<String, Object> getId2ObjectsMap() {
+ return this.id2ObjectsMap;
+ }
+
+
+ private void buildBuffer(final EObject selectedEObj, final StringBuffer plantumlBuffer) {
+
+
+ final EList<EStructuralFeature> eStructuralFeatures = selectedEObj.eClass().getEAllStructuralFeatures();
+
+
+ /*- if refs of the EClass are found, then fill the plantUMLBuffer with the appropriate contents */
+
+ if (eStructuralFeatures.size() > 0) {
+
+ createClass(plantumlBuffer, this.id2ObjectsMap, selectedEObj);
+
+ final List<EStructuralFeature> processedFeatures = new ArrayList<EStructuralFeature>();
+
+
+ for (final EStructuralFeature eStructuralFeature : eStructuralFeatures) {
+
+ final boolean eIsSet = selectedEObj.eIsSet(eStructuralFeature);
+
+ if (eIsSet && !processedFeatures.contains(eStructuralFeature)
+ && (eStructuralFeature instanceof EReference)) {
+
+ processedFeatures.add(eStructuralFeature);
+
+ final Object eobj = selectedEObj.eGet(eStructuralFeature);
+
+
+ if (eobj instanceof EObject) {
+ createClass(plantumlBuffer, this.id2ObjectsMap, (EObject) eobj);
+
+ final String name = getName((EObject) eobj).toString();
+
+ final String relation = ((EReference) eStructuralFeature).isContainment() ? " *-- " : "--> ";
+
+ plantumlBuffer.append(getName(selectedEObj) + relation + name);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ }
+ else if (eobj instanceof EList) {
+
+ createClass(plantumlBuffer, this.id2ObjectsMap, (EList<?>) eobj, eStructuralFeature);
+
+ final String relation = ((EReference) eStructuralFeature).isContainment() ? " *-- " : "--> ";
+
+ plantumlBuffer.append(getName(selectedEObj) + relation + eStructuralFeature.getName());
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+
+ }
+
+ }
+ }
+
+
+ }
+ else {
+
+ /*- no references for this EClass are found */
+
+ createClass(plantumlBuffer, this.id2ObjectsMap, selectedEObj);
+
+ }
+
+
+ }
+
+
+ private void createClass(final StringBuffer plantumlBuffer, final EMap<String, Object> id2ObjectsMap,
+ final EList<?> eList, final EStructuralFeature eStructuralFeature) {
+
+ final String uuid = EcoreUtil.generateUUID();
+
+ if (eStructuralFeature != null) {
+ plantumlBuffer.append("class \"" + eStructuralFeature.getName() + "\"" + " << (*,#FF7700) EList<"
+ + eStructuralFeature.getEType().getName() + "> >>" + " [[" + uuid + "]]");
+
+ }
+ else {
+ plantumlBuffer.append("class \"" + "Collection" + "\"" + " << (*,#FF7700) Collection<" + "EList" + "> >>"
+ + " [[" + uuid + "]]");
+ }
+
+ id2ObjectsMap.put(uuid, eList);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+
+
+ private void createClass(final StringBuffer plantumlBuffer, final EMap<String, Object> id2ObjectsMap,
+ final EObject selectedEObj) {
+ final String uuid = EcoreUtil.generateUUID();
+
+ plantumlBuffer.append("class " + getName(selectedEObj) + " << (O,#B4A7E5) " + selectedEObj.eClass().getName()
+ + " >>" + " [[" + uuid + "]]");
+
+ final EList<EAttribute> eAllAttributes = selectedEObj.eClass().getEAllAttributes();
+
+ if (eAllAttributes.size() > 0) {
+
+ plantumlBuffer.append("{");
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ final List<EAttribute> processedFeatures = new ArrayList<EAttribute>();
+
+ for (final EAttribute eAttribute : eAllAttributes) {
+
+ if (selectedEObj.eIsSet(eAttribute) && !processedFeatures.contains(eAttribute)) {
+
+ processedFeatures.add(eAttribute);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append(eAttribute.getEType().getName() + " " + eAttribute.getName() + " = "
+ + selectedEObj.eGet(eAttribute));
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+
+
+ }
+ plantumlBuffer.append(System.getProperty("line.separator"));
+
+ plantumlBuffer.append("}");
+ }
+
+ id2ObjectsMap.put(uuid, selectedEObj);
+
+ plantumlBuffer.append(System.getProperty("line.separator"));
+ }
+
+
+ private Object getName(final EObject eObject) {
+ final EStructuralFeature eStructuralFeature = eObject.eClass().getEStructuralFeature("name");
+
+ if (eStructuralFeature != null) {
+
+ final Object originalName = eObject.eGet(eStructuralFeature);
+
+ return "\"" + originalName + "\"";
+ }
+
+ return eObject.eClass().getName() + "__" + eObject.hashCode();
+ }
+
+ private List<?> getElementsBasedOnRange(final EList<?> eList) {
+
+
+ if (eList.size() > 100) {
+
+ List<?> subList = new ArrayList();
+
+ final InputDialog inputDialog = new InputDialog(
+ org.eclipse.swt.widgets.Display.getDefault().getActiveShell(), "Element selection dialog",
+ "There are " + eList.size()
+ + " references. specify the range for which contents should be represented graphically",
+ "0-" + (eList.size() - 1), new IInputValidator() {
+
+ @Override
+ public String isValid(final String newText) {
+ if (Pattern.matches("(\\d)+\\-(\\d)+", newText) == false) {
+ return "Specify the range in the following way int-int eg. 10-20 ";
+ }
+ return null;
+ }
+ });
+
+ final int status = inputDialog.open();
+
+ if (status == 0) {
+ final String value = inputDialog.getValue();
+
+ final String[] split = value.split("-");
+
+ subList = new ArrayList(eList).subList(Integer.parseInt(split[0]),
+ Integer.parseInt(split[1]) < eList.size() ? Integer.parseInt(split[1]) : (eList.size() - 1));
+
+ }
+ else {
+ subList = new ArrayList(eList).subList(0, 99);
+ }
+
+ return subList;
+
+ }
+ return eList;
+ }
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/AbstractHandlerUtils.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/AbstractHandlerUtils.java
new file mode 100644
index 0000000..c62e27d
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/AbstractHandlerUtils.java
@@ -0,0 +1,426 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.handlers;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.eclipse.app4mc.emfutils.content.extractor.Activator;
+import org.eclipse.app4mc.emfutils.content.extractor.preferences.PreferenceConstants;
+import org.eclipse.app4mc.emfutils.content.extractor.views.DiagramView;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+import net.sourceforge.plantuml.FileFormat;
+import net.sourceforge.plantuml.FileFormatOption;
+import net.sourceforge.plantuml.SourceStringReader;
+
+public abstract class AbstractHandlerUtils extends AbstractHandler {
+
+ protected void openEReferencesView(final EClass activeEClass) {
+
+ if (activeEClass != null) {
+ try {
+
+ if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .findView("org.eclipse.emf.ecoretools.internal.views.EReferencesView") == null) {
+
+ return;
+ }
+ final IViewPart view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .showView("org.eclipse.emf.ecoretools.internal.views.EReferencesView");
+
+ if (view != null) {
+ final Class<?> eClassReferencesViewClass = Class
+ .forName("org.eclipse.emf.ecoretools.internal.views.EReferencesView");
+
+ if (eClassReferencesViewClass != null) {
+ final Method setAnalyzedObjectMethod = eClassReferencesViewClass.getMethod("setAnalyzedObject",
+ EObject.class);
+
+ if (setAnalyzedObjectMethod != null) {
+ setAnalyzedObjectMethod.setAccessible(true);
+ setAnalyzedObjectMethod.invoke(view, activeEClass);
+
+ }
+ }
+ }
+
+ }
+ catch (final PartInitException exception) {
+ exception.printStackTrace();
+ }
+ catch (final ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ catch (final NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ catch (final SecurityException e) {
+ e.printStackTrace();
+ }
+ catch (final IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ catch (final IllegalArgumentException e) {
+ e.printStackTrace();
+ }
+ catch (final InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected void openHierarchyView(final EClass activeEClass) {
+
+ if (activeEClass != null) {
+ try {
+
+ if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .findView("org.eclipse.emf.ecoretools.internal.views.EClassHierarchyView") == null) {
+ return;
+ }
+
+ final IViewPart view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .showView("org.eclipse.emf.ecoretools.internal.views.EClassHierarchyView");
+
+ if (view != null) {
+ final Class<?> eClassHierarchyViewClass = Class
+ .forName("org.eclipse.emf.ecoretools.internal.views.EClassHierarchyView");
+
+ if (eClassHierarchyViewClass != null) {
+ final Method setAnalyzedObjectMethod = eClassHierarchyViewClass.getMethod("setAnalyzedObject",
+ EObject.class);
+
+ if (setAnalyzedObjectMethod != null) {
+ setAnalyzedObjectMethod.setAccessible(true);
+ setAnalyzedObjectMethod.invoke(view, activeEClass);
+ }
+ }
+ }
+ }
+ catch (final PartInitException exception) {
+ exception.printStackTrace();
+ }
+ catch (final ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ catch (final NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ catch (final SecurityException e) {
+ e.printStackTrace();
+ }
+ catch (final IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ catch (final IllegalArgumentException e) {
+ e.printStackTrace();
+ }
+ catch (final InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ protected void openErrorDialog() {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+
+ final Shell shell = new Shell(Display.getDefault());
+
+ MessageDialog.openError(shell, "EMF content extractor dialog", "Selected object is not a EMF object");
+
+ }
+ });
+ }
+
+ protected static void openErrorDialog(final String msg) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+
+ final Shell shell = new Shell(Display.getDefault());
+
+ MessageDialog.openError(shell, "EMF content extractor dialog", msg);
+
+ }
+ });
+ }
+
+
+ /**
+ * This method returns the value for a supplied key from the Preference Store
+ *
+ * @param key
+ * @return
+ */
+ protected static String getValueFromPreferenceStore(final String key) {
+
+ final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+ return store.getString(key);
+ }
+
+ public static void generateSVGAndDisplayDiagram(final StringBuffer plantumlBuffer, final String fileNamePrefix,
+ final EMap<String, Object> id2ObjectsMap, final Map<String, String> properties) throws IOException {
+
+ final String dot_exe_location = getValueFromPreferenceStore(PreferenceConstants.P_DOT_PATH);
+
+ if (dot_exe_location == null) {
+
+ openErrorDialog("DOT file exe path is not set in the Preferences");
+
+ return;
+ }
+ else if (!new File(dot_exe_location).exists()) {
+ openErrorDialog(
+ "DOT file exe is not existing in the specified path. Update the valid path in Preferences -> AMALTHEA-Grpahical-Representation node");
+
+ return;
+ }
+
+ System.setProperty("GRAPHVIZ_DOT", dot_exe_location);
+
+ final SourceStringReader reader = new SourceStringReader(plantumlBuffer.toString());
+
+ final String genFileLocation = getValueFromPreferenceStore(PreferenceConstants.P_FOLDER_PATH)
+ + "\\amalthea_element_" + fileNamePrefix;
+
+ try (final FileOutputStream fileOutputStream = new FileOutputStream(
+
+ new File(genFileLocation + ".svg"));) {
+
+ reader.generateImage(fileOutputStream, new FileFormatOption(FileFormat.SVG));
+
+ fileOutputStream.close();
+ }
+
+
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+
+ try (final FileOutputStream fileOutputStream = new FileOutputStream(
+
+ new File(genFileLocation + ".plantuml"));
+
+ final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fileOutputStream));) {
+
+ bw.write(plantumlBuffer.toString());
+
+ }
+ catch (final FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ catch (final IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ });
+
+
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ final String diagramViewID = "org.eclipse.app4mc.emfutils.content.extractor.views.DiagramView";
+
+ IViewPart diagramView = activePage.findView(diagramViewID);
+
+ final IViewReference findViewReference = activePage.findViewReference(diagramViewID);
+
+
+ if (diagramView == null) {
+ try {
+ diagramView = activePage.showView(diagramViewID);
+
+ // updateBooleanProps(properties, diagramView);
+
+
+ ((DiagramView) diagramView).getIdObjectsMap().putAll(id2ObjectsMap);
+ ((DiagramView) diagramView).getBrowser()
+ .setUrl(("file:/" + getValueFromPreferenceStore(PreferenceConstants.P_FOLDER_PATH)
+ + "\\amalthea_element_" + fileNamePrefix + ".svg"));
+ }
+ catch (final PartInitException e) {
+ e.printStackTrace();
+ }
+
+ }
+ else {
+
+ // updateBooleanProps(properties, diagramView);
+
+ ((DiagramView) diagramView).getIdObjectsMap().putAll(id2ObjectsMap);
+
+ ((DiagramView) diagramView).getBrowser()
+ .setUrl(("file:/" + getValueFromPreferenceStore(PreferenceConstants.P_FOLDER_PATH)
+ + "\\amalthea_element_" + fileNamePrefix + ".svg"));
+ }
+ }
+
+ /*-private void updateBooleanProps(final Map<String, String> properties, final IViewPart diagramView) {
+ if (properties.get(ExecutionCategory.isClassHierarchyGeneration.toString()) != null
+ && properties.get(ExecutionCategory.isClassHierarchyGeneration.toString()).equals("true")) {
+
+ ((DiagramView) diagramView).setDisplayingClassHierarchy(true);
+
+ ((DiagramView) diagramView).setDisplayingClassHierarchy_And_corresponding_Relation_Contents(false);
+
+ ((DiagramView) diagramView).setDisplayingClassReference_Hierarchy_subclass_info_generation(false);
+ ((DiagramView) diagramView).setClassContents_UML_Generation(false);
+ }
+ else if (properties.get(ExecutionCategory.isClassHierarchy_Contents_Generation.toString()) != null
+ && properties.get(ExecutionCategory.isClassHierarchy_Contents_Generation.toString())
+ .equals("true")) {
+
+ ((DiagramView) diagramView).setDisplayingClassHierarchy(false);
+
+ ((DiagramView) diagramView).setDisplayingClassHierarchy_And_corresponding_Relation_Contents(true);
+
+ ((DiagramView) diagramView).setDisplayingClassReference_Hierarchy_subclass_info_generation(false);
+ ((DiagramView) diagramView).setClassContents_UML_Generation(false);
+ }
+ else if (properties
+ .get(ExecutionCategory.isClassReference_Hierarchy_subclass_info_generation.toString()) != null
+ && properties
+ .get(ExecutionCategory.isClassReference_Hierarchy_subclass_info_generation.toString())
+ .equals("true")) {
+
+ ((DiagramView) diagramView).setDisplayingClassHierarchy(false);
+
+ ((DiagramView) diagramView).setDisplayingClassHierarchy_And_corresponding_Relation_Contents(false);
+
+ ((DiagramView) diagramView).setDisplayingClassReference_Hierarchy_subclass_info_generation(true);
+ ((DiagramView) diagramView).setClassContents_UML_Generation(false);
+ }
+ else if (properties.get(ExecutionCategory.isClassContents_UML_Generation.toString()) != null
+ && properties.get(ExecutionCategory.isClassContents_UML_Generation.toString()).equals("true")) {
+
+ ((DiagramView) diagramView).setDisplayingClassHierarchy(false);
+
+ ((DiagramView) diagramView).setDisplayingClassHierarchy_And_corresponding_Relation_Contents(false);
+
+ ((DiagramView) diagramView).setDisplayingClassReference_Hierarchy_subclass_info_generation(false);
+ ((DiagramView) diagramView).setClassContents_UML_Generation(true);
+
+ }
+ else {
+ ((DiagramView) diagramView).setDisplayingClassHierarchy(false);
+ ((DiagramView) diagramView).setClassContents_UML_Generation(false);
+ ((DiagramView) diagramView).setDisplayingClassHierarchy_And_corresponding_Relation_Contents(false);
+ ((DiagramView) diagramView).setDisplayingClassReference_Hierarchy_subclass_info_generation(false);
+ }
+ }*/
+ });
+
+
+ }
+
+
+ public static String generateSVGFile(final StringBuffer plantumlBuffer, final String fileNamePrefix,
+ final EMap<String, Object> id2ObjectsMap) throws IOException {
+
+
+ final String dot_exe_location = Activator.getDefault().getPreferenceStore()
+ .getString(PreferenceConstants.P_DOT_PATH);
+
+ if (dot_exe_location == null) {
+
+ openErrorDialog("DOT file exe path is not set in the Preferences");
+ return null;
+ }
+ else if (!new File(dot_exe_location).exists()) {
+ openErrorDialog(
+ "DOT file exe is not existing in the specified path. Update the valid path in Preferences -> AMALTHEA-Grpahical-Representation node");
+
+ return null;
+ }
+
+ System.setProperty("GRAPHVIZ_DOT", dot_exe_location);
+
+ final SourceStringReader reader = new SourceStringReader(plantumlBuffer.toString());
+
+
+ final String genFileLocation = Activator.getDefault().getPreferenceStore()
+ .getString(PreferenceConstants.P_FOLDER_PATH) + "\\amalthea_element_" + fileNamePrefix;
+
+
+ try (final FileOutputStream svgFileOutputStream = new FileOutputStream(new File(genFileLocation + ".svg"));
+
+ ) {
+
+ reader.generateImage(svgFileOutputStream, new FileFormatOption(FileFormat.SVG));
+
+ }
+
+
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+
+ try (final FileOutputStream fileOutputStream = new FileOutputStream(
+
+ new File(genFileLocation + ".plantuml"));
+
+ final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fileOutputStream));) {
+
+ bw.write(plantumlBuffer.toString());
+
+ }
+ catch (final FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ catch (final IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ });
+
+
+ return ("file:/" + Activator.getDefault().getPreferenceStore().getString(PreferenceConstants.P_FOLDER_PATH)
+ + "\\amalthea_element_" + fileNamePrefix + ".svg");
+
+
+ }
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassAllReferencesHandler.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassAllReferencesHandler.java
new file mode 100644
index 0000000..8810e7b
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassAllReferencesHandler.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.handlers;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EClassAllReferencesBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionCategory;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionUtil;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class EClassAllReferencesHandler extends AbstractHandlerUtils {
+
+ private final EMap<String, Object> id2ObjectsMap;
+
+ /**
+ * The constructor.
+ */
+ public EClassAllReferencesHandler() {
+
+ this.id2ObjectsMap = new BasicEMap<String, Object>();
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information from the application context.
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+
+ StringBuffer plantumlBuffer = new StringBuffer();
+
+ final EClassAllReferencesBufferBuilder builder = new EClassAllReferencesBufferBuilder();
+
+
+ final String eClassName = "";
+
+
+ ISelection selection = null;
+
+ selection = HandlerUtil.getActiveMenuSelection(event);
+
+ if (selection == null) {
+
+ selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
+
+ }
+ if (selection != null & selection instanceof IStructuredSelection) {
+
+ final IStructuredSelection strucSelection = (IStructuredSelection) selection;
+
+ for (final Iterator<Object> iterator = strucSelection.iterator(); iterator.hasNext();) {
+
+ final Object element = iterator.next();
+
+ if (element instanceof EObject) {
+
+ EClass eClass = null;
+
+ if (element instanceof EClass) {
+ eClass = (EClass) element;
+ }
+ else {
+ eClass = ((EObject) element).eClass();
+ }
+
+ plantumlBuffer = builder.buildBuffer(eClass);
+
+ this.id2ObjectsMap.addAll(builder.getId2ObjectsMap());
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+ }
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+
+ System.out.println(plantumlBuffer.toString());
+
+ try {
+ final Map<String, String> propsMap = new HashMap<String, String>();
+
+ // propsMap.put(ExecutionCategory.isClassReference_Hierarchy_subclass_info_generation.toString(), "true");
+
+ ExecutionUtil.setExecutionCategory(ExecutionCategory.eClassAllReferences);
+
+ generateSVGAndDisplayDiagram(plantumlBuffer, eClassName + "_SuperTypes_References", this.id2ObjectsMap,
+ propsMap);
+ }
+ catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassContentsAndHierarchyHandler.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassContentsAndHierarchyHandler.java
new file mode 100644
index 0000000..61a77e3
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassContentsAndHierarchyHandler.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.handlers;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EClassContentsAndHierarchyBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionCategory;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionUtil;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class EClassContentsAndHierarchyHandler extends AbstractHandlerUtils {
+ /**
+ * The constructor.
+ */
+ public EClassContentsAndHierarchyHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information from the application context.
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+
+ final EMap<String, Object> id2ObjectsMap = new BasicEMap<String, Object>();
+
+
+ StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ String eClassName = "";
+
+
+ ISelection selection = null;
+
+ selection = HandlerUtil.getActiveMenuSelection(event);
+
+ if (selection == null) {
+
+ selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
+
+ }
+ if (selection != null & selection instanceof IStructuredSelection) {
+
+ final IStructuredSelection strucSelection = (IStructuredSelection) selection;
+
+ for (final Iterator<Object> iterator = strucSelection.iterator(); iterator.hasNext();) {
+
+ final Object element = iterator.next();
+
+ if (element instanceof EObject) {
+
+
+ EClass selectedObjClass = null;
+
+ if (element instanceof EClass) {
+ selectedObjClass = (EClass) element;
+ }
+ else {
+ selectedObjClass = ((EObject) element).eClass();
+ }
+
+
+ // final EClass selectedObjClass = ((EObject) element).eClass();
+
+ /* ====================Opening Heirarchy View ===================== */
+
+ openHierarchyView(selectedObjClass);
+
+
+ eClassName = selectedObjClass.getName();
+
+
+ final EClassContentsAndHierarchyBufferBuilder builder = new EClassContentsAndHierarchyBufferBuilder();
+
+ plantumlBuffer = builder.buildBuffer(selectedObjClass);
+
+ id2ObjectsMap.addAll(builder.getId2ObjectsMap());
+
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+ }
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+
+ System.out.println(plantumlBuffer.toString());
+
+ try {
+ final Map<String, String> propsMap = new HashMap<String, String>();
+
+ // propsMap.put(ExecutionCategory.isClassHierarchy_Contents_Generation.toString(), "true");
+
+ ExecutionUtil.setExecutionCategory(ExecutionCategory.eClassContentsAndHierarchy);
+
+ generateSVGAndDisplayDiagram(plantumlBuffer, eClassName + "__contents_deep_Heirarchy", id2ObjectsMap,
+ propsMap);
+ }
+ catch (final IOException e) {
+ // TODO Zmeer Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassContentsFromReferenceHandler.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassContentsFromReferenceHandler.java
new file mode 100644
index 0000000..28c8e27
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassContentsFromReferenceHandler.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.handlers;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EClassContentsFromReferenceBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionCategory;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionUtil;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class EClassContentsFromReferenceHandler extends AbstractHandlerUtils {
+ /**
+ * The constructor.
+ */
+ public EClassContentsFromReferenceHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information from the application context.
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+
+ final EMap<String, Object> id2ObjectsMap = new BasicEMap<String, Object>();
+
+
+ StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ String eClassName = "";
+
+
+ ISelection selection = null;
+
+ selection = HandlerUtil.getActiveMenuSelection(event);
+
+ if (selection == null) {
+
+ selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
+
+ }
+ if (selection != null & selection instanceof IStructuredSelection) {
+
+ final IStructuredSelection strucSelection = (IStructuredSelection) selection;
+
+ if (strucSelection == null) {
+ return null;
+ }
+
+ for (final Iterator<Object> iterator = strucSelection.iterator(); iterator.hasNext();) {
+
+ final Object element = iterator.next();
+
+ if (element instanceof EObject) {
+
+
+ EClass selectedObjClass = null;
+
+ if (element instanceof EStructuralFeature && element instanceof EReference) {
+
+ final EClassifier eType = ((EReference) element).getEType();
+
+ if (eType instanceof EClass) {
+
+ selectedObjClass = (EClass) eType;
+ }
+ else {
+ selectedObjClass = ((EObject) element).eClass();
+ }
+
+ }
+ else if (element instanceof EClass) {
+ selectedObjClass = ((EClass) element);
+ }
+ else {
+ selectedObjClass = ((EObject) element).eClass();
+ }
+
+
+ // final EClass selectedObjClass = ((EObject) element).eClass();
+
+ /* ====================Opening Heirarchy View ===================== */
+
+ openHierarchyView(selectedObjClass);
+
+
+ eClassName = selectedObjClass.getName();
+
+
+ final EClassContentsFromReferenceBufferBuilder builder = new EClassContentsFromReferenceBufferBuilder();
+
+ plantumlBuffer = builder.buildBuffer(selectedObjClass);
+
+ id2ObjectsMap.addAll(builder.getId2ObjectsMap());
+
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+ }
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+
+ System.out.println(plantumlBuffer.toString());
+
+ try {
+ final Map<String, String> propsMap = new HashMap<String, String>();
+
+ // propsMap.put(ExecutionCategory.isClassContents_UML_Generation.toString(), "true");
+
+ ExecutionUtil.setExecutionCategory(ExecutionCategory.eClassContentsFromReference);
+
+ generateSVGAndDisplayDiagram(plantumlBuffer, eClassName + "__reference_type_Heirarchy", id2ObjectsMap,
+ propsMap);
+ }
+ catch (final IOException e) {
+ // TODO Zmeer Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassContentsHandler.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassContentsHandler.java
new file mode 100644
index 0000000..3029eaf
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassContentsHandler.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.handlers;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EClassContentsFromReferenceBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionCategory;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionUtil;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class EClassContentsHandler extends AbstractHandlerUtils {
+ /**
+ * The constructor.
+ */
+ public EClassContentsHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information from the application context.
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+
+ final EMap<String, Object> id2ObjectsMap = new BasicEMap<String, Object>();
+
+
+ StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ String eClassName = "";
+
+
+ ISelection selection = null;
+
+ selection = HandlerUtil.getActiveMenuSelection(event);
+
+ if (selection == null) {
+
+ selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
+
+ }
+ if (selection != null & selection instanceof IStructuredSelection) {
+
+ final IStructuredSelection strucSelection = (IStructuredSelection) selection;
+
+ for (final Iterator<Object> iterator = strucSelection.iterator(); iterator.hasNext();) {
+
+ final Object element = iterator.next();
+
+ if (element instanceof EObject) {
+
+
+ EClass selectedObjClass = null;
+
+ if (element instanceof EClass) {
+ selectedObjClass = (EClass) element;
+ }
+ else {
+ selectedObjClass = ((EObject) element).eClass();
+ }
+
+
+ // final EClass selectedObjClass = ((EObject) element).eClass();
+
+ /* ====================Opening Heirarchy View ===================== */
+
+ openHierarchyView(selectedObjClass);
+
+
+ eClassName = selectedObjClass.getName();
+
+
+ final EClassContentsFromReferenceBufferBuilder builder = new EClassContentsFromReferenceBufferBuilder();
+
+ plantumlBuffer = builder.buildBuffer(selectedObjClass);
+
+ id2ObjectsMap.addAll(builder.getId2ObjectsMap());
+
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+ }
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+
+ System.out.println(plantumlBuffer.toString());
+
+ try {
+ final Map<String, String> propsMap = new HashMap<String, String>();
+
+ // propsMap.put(ExecutionCategory.isClassContents_UML_Generation.toString(), "true");
+ ExecutionUtil.setExecutionCategory(ExecutionCategory.eClassContents);
+
+ generateSVGAndDisplayDiagram(plantumlBuffer, eClassName + "__precise_Heirarchy", id2ObjectsMap, propsMap);
+ }
+ catch (final IOException e) {
+ // TODO Zmeer Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassHierarchyHandler.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassHierarchyHandler.java
new file mode 100644
index 0000000..3ad0576
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EClassHierarchyHandler.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.handlers;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EClassHierarchyBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionCategory;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionUtil;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class EClassHierarchyHandler extends AbstractHandlerUtils {
+
+ /**
+ * The constructor.
+ */
+ public EClassHierarchyHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information from the application context.
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+
+ final EMap<String, Object> id2ObjectsMap = new BasicEMap<String, Object>();
+
+ final EClassHierarchyBufferBuilder builder = new EClassHierarchyBufferBuilder();
+
+
+ String eClassName = "";
+
+ StringBuffer plantumlBuffer = new StringBuffer();
+
+
+ ISelection selection = null;
+
+ selection = HandlerUtil.getActiveMenuSelection(event);
+
+ if (selection == null) {
+
+ selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
+
+ }
+ if (selection != null & selection instanceof IStructuredSelection) {
+
+ final IStructuredSelection strucSelection = (IStructuredSelection) selection;
+
+ for (final Iterator<Object> iterator = strucSelection.iterator(); iterator.hasNext();) {
+
+ final Object element = iterator.next();
+
+ if (element instanceof EObject) {
+
+ EClass selectedObjClass = null;
+
+ if (element instanceof EClass) {
+ selectedObjClass = (EClass) element;
+ }
+ else {
+ selectedObjClass = ((EObject) element).eClass();
+ }
+
+
+ // final EClass selectedObjClass = ((EObject) element).eClass();
+
+ /* ====================Opening Heirarchy View ===================== */
+
+ openHierarchyView(selectedObjClass);
+
+
+ eClassName = selectedObjClass.getName();
+
+
+ plantumlBuffer = builder.buildBuffer(selectedObjClass);
+
+ id2ObjectsMap.addAll(builder.getId2ObjectsMap());
+
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+ }
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+
+
+ System.out.println(plantumlBuffer.toString());
+
+ try {
+ final Map<String, String> propsMap = new HashMap<String, String>();
+
+ ExecutionUtil.setExecutionCategory(ExecutionCategory.eClassHierarchy);
+
+ generateSVGAndDisplayDiagram(plantumlBuffer, eClassName + "__eclass_Heirarchy", id2ObjectsMap, propsMap);
+ }
+ catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EObjectRefsHandler.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EObjectRefsHandler.java
new file mode 100644
index 0000000..25f0cc1
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/handlers/EObjectRefsHandler.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.handlers;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EObjectRefsBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionCategory;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionUtil;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class EObjectRefsHandler extends AbstractHandlerUtils {
+ /**
+ * The constructor.
+ */
+ public EObjectRefsHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information from the application context.
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+
+ final EObjectRefsBufferBuilder bufferBuilder = new EObjectRefsBufferBuilder();
+
+
+ StringBuffer plantumlBuffer = new StringBuffer();
+
+ String eClassName = "";
+
+ String elementName = "";
+
+ ISelection selection = null;
+
+ selection = HandlerUtil.getActiveMenuSelection(event);
+
+ if (selection == null) {
+
+ selection = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
+
+ }
+
+ if (selection != null & selection instanceof IStructuredSelection) {
+
+ final IStructuredSelection strucSelection = (IStructuredSelection) selection;
+
+ for (final Iterator<Object> iterator = strucSelection.iterator(); iterator.hasNext();) {
+
+ final Object element = iterator.next();
+
+ if (element instanceof EObject) {
+
+ EClass selectedObjClass = null;
+
+ if (element instanceof EClass) {
+ selectedObjClass = (EClass) element;
+ }
+ else {
+ selectedObjClass = ((EObject) element).eClass();
+ }
+
+ // final EClass selectedObjClass = ((EObject) element).eClass();
+
+ eClassName = selectedObjClass.getName();
+
+ elementName = (String) getName((EObject) element);
+
+
+ plantumlBuffer = bufferBuilder.buildBuffer((EObject) element);
+
+
+ /* ====================Opening References View ===================== */
+
+ openEReferencesView(selectedObjClass);
+
+ /* ====================Opening Hierarchy View ===================== */
+ openHierarchyView(selectedObjClass);
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+ }
+ }
+ else {
+ openErrorDialog();
+ return null;
+ }
+
+ System.out.println(plantumlBuffer.toString());
+
+ try {
+
+ final Map<String, String> propsMap = new HashMap<String, String>();
+
+ ExecutionUtil.setExecutionCategory(ExecutionCategory.eObjectRefs);
+
+ generateSVGAndDisplayDiagram(plantumlBuffer, eClassName + "_" + elementName + "_References",
+ bufferBuilder.getId2ObjectsMap(), propsMap);
+ }
+ catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ private Object getName(final EObject eObject) {
+ final EStructuralFeature eStructuralFeature = eObject.eClass().getEStructuralFeature("name");
+
+ if (eStructuralFeature != null) {
+
+ final Object originalName = eObject.eGet(eStructuralFeature);
+
+ return originalName;
+ }
+
+ return eObject.eClass().getName() + "__" + eObject.hashCode();
+ }
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/preferences/AmaltheaGraphicalRepresentationPreferencePage.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/preferences/AmaltheaGraphicalRepresentationPreferencePage.java
new file mode 100644
index 0000000..c3f82a7
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/preferences/AmaltheaGraphicalRepresentationPreferencePage.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.preferences;
+
+import org.eclipse.app4mc.emfutils.content.extractor.Activator;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.DirectoryFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * This class represents a preference page that is contributed to the Preferences dialog. By subclassing
+ * <samp>FieldEditorPreferencePage</samp>, we can use the field support built into JFace that allows us to create a page
+ * that is small and knows how to save, restore and apply itself.
+ * <p>
+ * This page is used to modify preferences only. They are stored in the preference store that belongs to the main
+ * plug-in class. That way, preferences can be accessed directly via the preference store.
+ */
+
+public class AmaltheaGraphicalRepresentationPreferencePage extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
+
+ public AmaltheaGraphicalRepresentationPreferencePage() {
+ super(GRID);
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription(
+ "Preference page to specify the Graphviz (dot executable) location & the folder (with RW access) to generate SVG files");
+ }
+
+ /**
+ * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to manipulate various
+ * types of preferences. Each field editor knows how to save and restore itself.
+ */
+ @Override
+ public void createFieldEditors() {
+
+ addField(new FileFieldEditor(PreferenceConstants.P_DOT_PATH, "&Path to the dot executable of Graphviz:",
+ getFieldEditorParent()));
+
+ addField(new DirectoryFieldEditor(PreferenceConstants.P_FOLDER_PATH,
+ "&Path to the directory where SVG files shall be generated:", getFieldEditorParent()));
+
+ addField(new BooleanFieldEditor(PreferenceConstants.P_DRILL_DOWN,
+ "&Show the details of selected element (Contents)", getFieldEditorParent()));
+
+ addField(new BooleanFieldEditor(PreferenceConstants.P_REDRAW_TREE_ON_SELECTION,
+ "&Collapse other elements and make the selection (by enabling this -> selected element will be focused more precisely in the tree )",
+ getFieldEditorParent()));
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(final IWorkbench workbench) {
+ }
+
+}
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/preferences/PreferenceConstants.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/preferences/PreferenceConstants.java
new file mode 100644
index 0000000..ff1cd17
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/preferences/PreferenceConstants.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.preferences;
+
+/**
+ * Constant definitions for plug-in preferences
+ */
+public class PreferenceConstants {
+
+ public static final String P_DOT_PATH = "P_DOT_PATH";
+
+ public static final String P_FOLDER_PATH = "P_FOLDER_PATH";
+
+ public static final String P_DRILL_DOWN = "P_DRILL_DOWN";
+
+ public static final String P_REDRAW_TREE_ON_SELECTION = "P_REDRAW_TREE_ON_SELECTION";
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/preferences/PreferenceInitializer.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/preferences/PreferenceInitializer.java
new file mode 100644
index 0000000..6460380
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/preferences/PreferenceInitializer.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.preferences;
+
+import org.eclipse.app4mc.emfutils.content.extractor.Activator;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Class used to initialize default preference values.
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ store.setDefault(PreferenceConstants.P_DOT_PATH, store.getString(PreferenceConstants.P_DOT_PATH) != null
+ ? store.getString(PreferenceConstants.P_DOT_PATH) : "");
+ store.setDefault(PreferenceConstants.P_FOLDER_PATH, store.getString(PreferenceConstants.P_FOLDER_PATH) != null
+ ? store.getString(PreferenceConstants.P_FOLDER_PATH) : "");
+
+ store.setDefault(PreferenceConstants.P_DRILL_DOWN, store.getBoolean(PreferenceConstants.P_DRILL_DOWN));
+
+ store.setDefault(PreferenceConstants.P_REDRAW_TREE_ON_SELECTION,
+ store.contains(PreferenceConstants.P_REDRAW_TREE_ON_SELECTION)
+ ? store.getBoolean(PreferenceConstants.P_REDRAW_TREE_ON_SELECTION) : false);
+ }
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/utils/ExecutionCategory.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/utils/ExecutionCategory.java
new file mode 100644
index 0000000..3dc8b9a
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/utils/ExecutionCategory.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.utils;
+
+public enum ExecutionCategory {
+ dummy, eClassHierarchy, eObjectRefs, eClassAllReferences, eClassContentsAndHierarchy, eClassContents, eClassContentsFromReference
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/utils/ExecutionUtil.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/utils/ExecutionUtil.java
new file mode 100644
index 0000000..20bd1a0
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/utils/ExecutionUtil.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.utils;
+
+public class ExecutionUtil {
+
+ private static ExecutionCategory category = ExecutionCategory.dummy;
+
+ public static void setExecutionCategory(final ExecutionCategory category) {
+ ExecutionUtil.category = category;
+ }
+
+ public static ExecutionCategory getCategory() {
+ return category;
+ }
+
+ public static boolean isExecuting(final ExecutionCategory currentExecutionCategory) {
+
+ return currentExecutionCategory == category;
+ }
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/views/DiagramView.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/views/DiagramView.java
new file mode 100644
index 0000000..3b72af9
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.content.extractor/src/org/eclipse/app4mc/emfutils/content/extractor/views/DiagramView.java
@@ -0,0 +1,458 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.content.extractor.views;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import org.eclipse.app4mc.emfutils.content.extractor.Activator;
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EClassAllReferencesBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EClassContentsAndHierarchyBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EClassContentsFromReferenceBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.builders.EClassHierarchyBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.builders.ObjectContentBufferBuilder;
+import org.eclipse.app4mc.emfutils.content.extractor.handlers.AbstractHandlerUtils;
+import org.eclipse.app4mc.emfutils.content.extractor.preferences.PreferenceConstants;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionCategory;
+import org.eclipse.app4mc.emfutils.content.extractor.utils.ExecutionUtil;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.sphinx.emf.editors.forms.BasicTransactionalFormEditor;
+import org.eclipse.sphinx.emf.ui.util.EcoreUIUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.LocationEvent;
+import org.eclipse.swt.browser.LocationListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ViewPart;
+
+
+public class DiagramView extends ViewPart {
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.eclipse.app4mc.emfutils.content.extractor.views.DiagramView";
+
+ /** counter for the generated files (which are associated to the collections ) **/
+ private int i = 0;
+
+ private Browser browser;
+
+
+ final EMap<String, Object> idObjectsMap;
+
+
+ /**
+ * The constructor.
+ */
+ public DiagramView() {
+
+ this.idObjectsMap = new BasicEMap<String, Object>();
+ }
+
+ @Override
+ public void init(final IViewSite site) throws PartInitException {
+ super.init(site);
+ addActions();
+ }
+
+ /**
+ * This is a callback that will allow us to create the viewer and initialize it.
+ */
+ @Override
+ public void createPartControl(final Composite parent) {
+ this.browser = new Browser(parent, SWT.None);
+
+ this.browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+
+ this.browser.addLocationListener(new LocationListener() {
+
+ String lastSource = "";
+
+ @Override
+ public void changing(final LocationEvent event) {
+
+ final String location = event.location;
+
+ if (!location.endsWith(".svg")) {
+ final int lastIndexOf = location.lastIndexOf("/");
+
+ String id = "";
+ if (lastIndexOf != -1) {
+ id = location.substring(lastIndexOf + 1, location.length());
+ }
+ final Object source = event.getSource();
+
+ if (source instanceof Browser) {
+
+ try {
+ ((Browser) source).setUrl(this.lastSource);
+ }
+ catch (final Exception e) {
+ // skipping exception logging, as here goal is to still retain the same image
+ }
+ }
+
+ final Object eObject = DiagramView.this.idObjectsMap.get(id);
+
+ if (eObject != null) {
+
+ if (eObject instanceof EObject) {
+ if (Activator.getDefault().getPreferenceStore()
+ .getBoolean(PreferenceConstants.P_DRILL_DOWN)) {
+
+ /*- ======================================== Regeneration of SVG Buffer for populating content specific to the selection =====================*/
+
+ StringBuffer buildBuffer = new StringBuffer();
+
+
+ if (ExecutionUtil.isExecuting(ExecutionCategory.eClassHierarchy)
+ && (eObject instanceof EClass)) {
+
+ final EClassHierarchyBufferBuilder bufferBuilder = new EClassHierarchyBufferBuilder();
+
+ buildBuffer = bufferBuilder.buildBuffer((EClass) eObject);
+
+ getIdObjectsMap().addAll(bufferBuilder.getId2ObjectsMap());
+ }
+ else if (ExecutionUtil.isExecuting(ExecutionCategory.eClassContentsAndHierarchy)
+ && (eObject instanceof EClass)) {
+
+ final EClassContentsAndHierarchyBufferBuilder bufferBuilder = new EClassContentsAndHierarchyBufferBuilder();
+
+ buildBuffer = bufferBuilder.buildBuffer((EClass) eObject);
+
+ getIdObjectsMap().addAll(bufferBuilder.getId2ObjectsMap());
+ }
+ else if (ExecutionUtil.isExecuting(ExecutionCategory.eClassAllReferences)
+ && (eObject instanceof EClass)) {
+
+
+ final EClassAllReferencesBufferBuilder bufferBuilder = new EClassAllReferencesBufferBuilder();
+
+ buildBuffer = bufferBuilder.buildBuffer((EClass) eObject);
+
+ getIdObjectsMap().addAll(bufferBuilder.getId2ObjectsMap());
+
+
+ }
+ else if (ExecutionUtil.isExecuting(ExecutionCategory.eClassContentsFromReference)
+ && (eObject instanceof EClass)) {
+
+
+ final EClassContentsFromReferenceBufferBuilder bufferBuilder = new EClassContentsFromReferenceBufferBuilder();
+
+ buildBuffer = bufferBuilder.buildBuffer((EClass) eObject);
+
+ getIdObjectsMap().addAll(bufferBuilder.getId2ObjectsMap());
+
+
+ }
+
+ else {
+
+ /*- EClassContents and EObjectRefs behaviour is included in ObjectContentBufferBuilder java class */
+ final ObjectContentBufferBuilder bufferBuilder = new ObjectContentBufferBuilder();
+
+ buildBuffer = bufferBuilder.buildBuffer((EObject) eObject);
+
+ getIdObjectsMap().addAll(bufferBuilder.getId2ObjectsMap());
+ }
+
+
+ System.out.println(buildBuffer);
+
+ try {
+
+
+ final String svgFile = AbstractHandlerUtils.generateSVGFile(buildBuffer,
+ ((EObject) eObject).eClass().getName() + DiagramView.this.i++,
+ new BasicEMap<String, Object>());
+ ((Browser) source).setUrl(svgFile);
+ }
+ catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+
+ }
+ else {
+
+
+ if (ExecutionUtil.isExecuting(ExecutionCategory.eClassHierarchy)
+ && (eObject instanceof EClass)) {
+ // do nothing
+ }
+
+
+ else if (ExecutionUtil.isExecuting(ExecutionCategory.eClassContentsAndHierarchy)
+ && (eObject instanceof EClass)) {
+ // do nothing
+ }
+ else if (ExecutionUtil.isExecuting(ExecutionCategory.eClassAllReferences)
+ && (eObject instanceof EClass)) {
+ // do nothing
+ }
+ else {
+ selectElement((EObject) eObject);
+
+ }
+ }
+
+ }
+ else if (eObject instanceof EList<?>) {
+
+ if (Activator.getDefault().getPreferenceStore()
+ .getBoolean(PreferenceConstants.P_DRILL_DOWN)) {
+
+ /*- ======================================== Regeneration of SVG Buffer for populating content specific to the selection =====================*/
+
+ final ObjectContentBufferBuilder bufferBuilder = new ObjectContentBufferBuilder();
+
+ final StringBuffer buildBuffer = bufferBuilder
+ .buildBufferForCollection((EList<?>) eObject);
+ System.out.println(buildBuffer);
+
+ try {
+
+ getIdObjectsMap().addAll(bufferBuilder.getId2ObjectsMap());
+
+ final String svgFile = AbstractHandlerUtils.generateSVGFile(buildBuffer,
+ "Collection" + DiagramView.this.i++, bufferBuilder.getId2ObjectsMap());
+ ((Browser) source).setUrl(svgFile);
+ }
+ catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+
+ }
+ else {
+ MessageDialog.openError(Display.getDefault().getActiveShell(), "Element Selection",
+ "Selection of list is not possible for AMALTHEA model");
+
+ try {
+ ((Browser) source).setUrl(this.lastSource);
+
+ }
+ catch (final Exception e) {
+ throw e;
+ }
+ }
+
+ }
+
+
+ }
+
+
+ }
+
+
+ }
+
+ @Override
+ public void changed(final LocationEvent event) {
+ this.lastSource = event.location;
+ }
+
+ /**
+ * This method is used to select specified AMALTHEA element in the Sphinx editor
+ *
+ * @param element
+ */
+ private void selectElement(final EObject element) {
+
+ final URIEditorInput input = EcoreUIUtil.createURIEditorInput(element.eResource());
+ if (null != input) {
+
+ final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null
+ ? PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ : PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage();
+
+ Display.getDefault().asyncExec(new java.lang.Runnable() {
+
+ @Override
+ public void run() {
+ final IEditorReference[] editorReferences = page.getEditorReferences();
+
+ for (final IEditorReference iEditorReference : editorReferences) {
+
+
+ if (iEditorReference.getId().equals("org.eclipse.app4mc.amalthea.sphinx.ui.editor")
+ || iEditorReference.getId().equals("org.itea2.amalthea.sphinx.ui.editor")) {
+ try {
+ final FileEditorInput editorInput = (FileEditorInput) iEditorReference
+ .getEditorInput();
+
+ final IFile fileFromEditor = editorInput.getFile();
+
+ final Resource eResource = element.eResource();
+
+ final URI uri = eResource.getURI();
+
+ final IFile fileFromResource = ResourcesPlugin.getWorkspace().getRoot()
+ .getFile(new Path(uri.toPlatformString(true)));
+
+
+ if ((fileFromEditor != null && fileFromResource != null)
+ && fileFromEditor.toString().equals(fileFromResource.toString())) {
+
+ final IEditorPart activeEditor = iEditorReference.getEditor(false);
+
+ if (activeEditor instanceof BasicTransactionalFormEditor) {
+
+ IDE.openEditor(page, editorInput, iEditorReference.getId());
+
+ if (canCollapseTreeElements()) {
+
+ final Viewer viewer = ((BasicTransactionalFormEditor) activeEditor)
+ .getViewer();
+
+ if (viewer instanceof TreeViewer) {
+ ((TreeViewer) viewer).collapseAll();
+ }
+ }
+ ((BasicTransactionalFormEditor) activeEditor)
+ .setSelectionToViewer(Collections.singleton(element));
+ }
+
+ }
+ }
+ catch (final PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ }
+
+ private boolean canCollapseTreeElements() {
+ return Activator.getDefault().getPreferenceStore()
+ .getBoolean(PreferenceConstants.P_REDRAW_TREE_ON_SELECTION);
+ }
+ });
+
+ }
+
+ }
+ });
+
+ }
+
+ private void addActions() {
+ final String P_DRILL_DOWN = Activator.getDefault().getPreferenceStore()
+ .getString(PreferenceConstants.P_DRILL_DOWN);
+
+ boolean state = false;
+ if (P_DRILL_DOWN == null) {
+ state = true;
+ }
+ else if (P_DRILL_DOWN.equals("false")) {
+ state = true;
+ }
+ else if (P_DRILL_DOWN.equals("true")) {
+ state = false;
+ }
+
+
+ final IActionBars actionBars = getViewSite().getActionBars();
+
+ final IToolBarManager toolBar = actionBars.getToolBarManager();
+ final Action action = new Action("Select in Editor", IAction.AS_CHECK_BOX) {
+ @Override
+ public void setText(final String text) {
+ super.setText(text);
+ }
+
+ @Override
+ public void run() {
+
+ if (isChecked() == false) {
+
+ try {
+
+ Activator.getDefault().getPreferenceStore().setValue(PreferenceConstants.P_DRILL_DOWN, true);
+ }
+ catch (final Exception e) {
+
+ throw e;
+ }
+ }
+ else if (isChecked() == true) {
+
+ try {
+ Activator.getDefault().getPreferenceStore().setValue(PreferenceConstants.P_DRILL_DOWN, false);
+
+ }
+ catch (final Exception e) {
+ throw e;
+ }
+ }
+
+ }
+
+
+ };
+
+ action.setChecked(state);
+
+ toolBar.add(action);
+
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ @Override
+ public void setFocus() {
+ getViewSite().getActionBars().updateActionBars();
+
+
+ }
+
+ public Browser getBrowser() {
+ return this.browser;
+ }
+
+ public EMap<String, Object> getIdObjectsMap() {
+ return this.idObjectsMap;
+ }
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.classpath b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.classpath
new file mode 100644
index 0000000..eca7bdb
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.classpath
@@ -0,0 +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.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.gitignore b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.gitignore
new file mode 100644
index 0000000..934e0e0
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.gitignore
@@ -0,0 +1,2 @@
+/bin
+/target
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.project b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.project
new file mode 100644
index 0000000..48e979a
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.app4mc.emfutils.metamodelviewer</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/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.settings/org.eclipse.jdt.core.prefs b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/META-INF/MANIFEST.MF b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2fd71fd
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Metamodelviewer
+Bundle-SymbolicName: org.eclipse.app4mc.emfutils.metamodelviewer;singleton:=true
+Bundle-Version: 0.8.0
+Bundle-Vendor: Eclipse.org
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.sphinx.emf
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-Activator: org.eclipse.app4mc.emfutils.metamodelviewer.base.Activator
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.app4mc.emfutils.metamodelviewer.base,
+ org.eclipse.app4mc.emfutils.metamodelviewer.dialogs,
+ org.eclipse.app4mc.emfutils.metamodelviewer.preferences,
+ org.eclipse.app4mc.emfutils.metamodelviewer.utils,
+ org.eclipse.app4mc.emfutils.metamodelviewer.views,
+ org.eclipse.app4mc.emfutils.metamodelviewer.views.providers
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/build.properties b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/build.properties
new file mode 100644
index 0000000..0d3d3a7
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/abstract_class_obj.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/abstract_class_obj.png
new file mode 100644
index 0000000..60c23de
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/abstract_class_obj.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/attribute.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/attribute.png
new file mode 100644
index 0000000..12b5d78
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/attribute.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/attribute_containment.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/attribute_containment.png
new file mode 100644
index 0000000..c65cd7c
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/attribute_containment.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/attribute_reference.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/attribute_reference.png
new file mode 100644
index 0000000..6dfe8f3
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/attribute_reference.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/class_obj.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/class_obj.png
new file mode 100644
index 0000000..1cb8bc7
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/class_obj.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/container.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/container.gif
new file mode 100644
index 0000000..d90a51c
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/container.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/downward_co.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/downward_co.gif
new file mode 100644
index 0000000..e622f4b
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/downward_co.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/enum_obj.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/enum_obj.png
new file mode 100644
index 0000000..ff3e4fb
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/enum_obj.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/hierarchy.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/hierarchy.gif
new file mode 100644
index 0000000..5ba5b91
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/hierarchy.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/interface_obj.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/interface_obj.png
new file mode 100644
index 0000000..9b17b6f
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/interface_obj.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/prop_ps.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/prop_ps.gif
new file mode 100644
index 0000000..d11c996
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/prop_ps.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/register_ecores.png b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/register_ecores.png
new file mode 100644
index 0000000..28c2175
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/register_ecores.png
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/sample.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/sample.gif
new file mode 100644
index 0000000..34fb3c9
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/sample.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/super_co.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/super_co.gif
new file mode 100644
index 0000000..59ac116
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/super_co.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/type_obj.gif b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/type_obj.gif
new file mode 100644
index 0000000..34bcaf7
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/icons/type_obj.gif
Binary files differ
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/plugin.xml b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/plugin.xml
new file mode 100644
index 0000000..4fb9b05
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/plugin.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ name="Meta Model Explorer"
+ id="org.eclipse.app4mc.emfutils.metamodelviewer.explorer.view.category">
+ </category>
+ <view
+ allowMultiple="true"
+ category="org.eclipse.app4mc.emfutils.metamodelviewer.explorer.view.category"
+ class="org.eclipse.app4mc.emfutils.metamodelviewer.views.MetaModelExplorerView"
+ icon="icons/sample.gif"
+ id="org.eclipse.app4mc.emfutils.metamodelviewer.views.MetaModel-ExplorerView"
+ name="Meta Model Explorer">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.app4mc.emfutils.metamodelviewer.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.eclipse.app4mc.emfutils.metamodelviewer.preferences.MetaModelViewerPreferencePage"
+ id="org.eclipse.app4mc.emfutils.metamodelviewer.page1"
+ name="Meta Model Viewer">
+ </page>
+ </extension>
+
+</plugin>
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/pom.xml b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/pom.xml
new file mode 100644
index 0000000..b2fff4c
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/pom.xml
@@ -0,0 +1,82 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <relativePath>../../build/org.eclipse.app4mc.emfutils.extractor.build</relativePath>
+ <groupId>org.eclipse.app4mc.emfutils.content.extractor</groupId>
+ <artifactId>org.eclipse.app4mc.emfutils.extractor.build</artifactId>
+ <version>0.8.0</version>
+ </parent>
+
+ <artifactId>org.eclipse.app4mc.emfutils.metamodelviewer</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>xtend-gen</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.4.1</version>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>xtend-gen</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>xtend-gen</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <version>2.7.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>xtend-gen</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/base/Activator.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/base/Activator.java
new file mode 100644
index 0000000..9deb32e
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/base/Activator.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.base;
+
+
+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.app4mc.emfutils.metamodelviewer"; //$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)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/dialogs/SelectedElementContentDialog.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/dialogs/SelectedElementContentDialog.java
new file mode 100644
index 0000000..7f938dd
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/dialogs/SelectedElementContentDialog.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.dialogs;
+
+import java.util.AbstractMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.app4mc.emfutils.metamodelviewer.base.Activator;
+import org.eclipse.app4mc.emfutils.metamodelviewer.preferences.MetaModelViewerPreferenceConstants;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPartSite;
+
+public class SelectedElementContentDialog extends org.eclipse.jface.dialogs.Dialog {
+
+ EObject eObject;
+
+ private TreeViewer tv;
+
+ private final IWorkbenchPartSite iWorkbenchPartSite;
+
+ public SelectedElementContentDialog(final Shell parentShell, final IWorkbenchPartSite iWorkbenchPartSite,
+ final EObject eObject) {
+ super(parentShell);
+ this.eObject = eObject;
+ this.iWorkbenchPartSite = iWorkbenchPartSite;
+ }
+
+
+ @Override
+ protected Control createDialogArea(final Composite parent) {
+ final Composite container = (Composite) super.createDialogArea(parent);
+
+ //
+ // final ElementSearchPatternFilter patternFilter = new ElementSearchPatternFilter(true, true);
+ //
+ // final FilteredTree filteredTree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL |
+ // SWT.BORDER,
+ // patternFilter, true);
+ //
+ // filteredTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 0));
+ //
+ //
+ // filteredTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 0));
+ //
+ // this.tv = filteredTree.getViewer();
+
+
+ this.tv = new TreeViewer(container);
+ this.tv.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ this.tv.setContentProvider(
+ new org.eclipse.app4mc.emfutils.metamodelviewer.views.providers.ViewContentProvider());
+ this.tv.setLabelProvider(new org.eclipse.app4mc.emfutils.metamodelviewer.views.providers.ViewLabelProvider());
+
+
+ final Entry<String, EObject> entry = new AbstractMap.SimpleEntry<String, EObject>("Selected Element",
+ this.eObject);
+
+ this.tv.setInput(entry);
+
+ hookContextMenu();
+ hookDoubleClickAction();
+ return container;
+ }
+
+ private void hookContextMenu() {
+ final MenuManager menuMgr = new MenuManager("#PopupMenu") {
+ @Override
+ public IContributionItem[] getItems() {
+
+ IContributionItem[] menuItems = super.getItems();
+
+ final List<IContributionItem> filteredContributionItems = new LinkedList<IContributionItem>();
+
+ for (final IContributionItem contributionItem : menuItems) {
+ if (contributionItem != null && (contributionItem.getId() != null && (!(contributionItem.getId()
+ .startsWith("org.eclipse.emf.ecore.editor.CreateDynamicInstance"))))) {
+ filteredContributionItems.add(contributionItem);
+ }
+ }
+ menuItems = new IContributionItem[filteredContributionItems.size()];
+ return filteredContributionItems.toArray(menuItems);
+
+ }
+ };
+ menuMgr.setRemoveAllWhenShown(true);
+ final Menu menu = menuMgr.createContextMenu(this.tv.getControl());
+ this.tv.getControl().setMenu(menu);
+ getIWorkbenchPartSite().registerContextMenu(menuMgr, this.tv);
+ }
+
+
+ private void hookDoubleClickAction() {
+ this.tv.addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(final DoubleClickEvent event) {
+ // MetaModelExplorerView.this.doubleClickAction.run();
+
+ final ISelection selection = event.getSelection();
+
+ if (selection instanceof TreeSelection) {
+ final Object firstElement = ((TreeSelection) selection).getFirstElement();
+ if (firstElement instanceof EObject) {
+ Shell parentShell = null;
+
+ String displayDialogStyle=(Activator.getDefault().getPreferenceStore().getString(MetaModelViewerPreferenceConstants.P_DIALOG_DISPLAY));
+
+ if(displayDialogStyle !=null && displayDialogStyle.equals(MetaModelViewerPreferenceConstants.V_ON_TOP)){
+ parentShell=new Shell(SWT.ON_TOP);
+ }else{
+ parentShell=new Shell();
+ }
+
+ // final String name = ((firstElement instanceof EClass) ? ((EClass) firstElement).getName() :
+ // "");
+ //
+ // parentShell.setText("Details of : " + ((EClass) firstElement).eClass().getName() + " " +
+ // name);
+ //
+ //
+ // final TaskBar systemTaskBar = parentShell.getDisplay().getSystemTaskBar();
+ // final TaskItem taskItem = systemTaskBar.getItem(parentShell);
+ //
+ // taskItem.setData(parentShell);
+ // taskItem.setOverlayText(name);
+ // taskItem.setText(name);
+
+
+ new SelectedElementContentDialog(parentShell, getIWorkbenchPartSite(), (EObject) firstElement)
+ .open();
+
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void configureShell(final Shell newShell) {
+ super.configureShell(newShell);
+
+ final String name = ((this.eObject instanceof EClass) ? ((EClass) this.eObject).getName() : "");
+
+ // newShell.setText("Details of : " + this.eObject.eClass().getName() + " " + name);
+ newShell.setText(name);
+
+ //
+ // final TaskBar systemTaskBar = newShell.getDisplay().getSystemTaskBar();
+ // final TaskItem taskItem = systemTaskBar.getItem(newShell);
+ //
+ // taskItem.setData(newShell);
+ // taskItem.setOverlayText(name);
+ // taskItem.setText(name);
+ }
+
+ @Override
+ protected Point getInitialSize() {
+ return new Point(450, 300);
+ }
+
+
+ @Override
+ protected void setShellStyle(final int newShellStyle) {
+ super.setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE | SWT.RESIZE);
+ setBlockOnOpen(false);
+ }
+
+
+ public IWorkbenchPartSite getIWorkbenchPartSite() {
+ return this.iWorkbenchPartSite;
+ }
+
+}
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/preferences/MetaModelViewerPreferenceConstants.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/preferences/MetaModelViewerPreferenceConstants.java
new file mode 100644
index 0000000..a40be90
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/preferences/MetaModelViewerPreferenceConstants.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.preferences;
+
+/**
+ * Constant definitions for plug-in preferences
+ */
+public class MetaModelViewerPreferenceConstants {
+
+ public static final String P_DIALOG_DISPLAY = "P_DIALOG_DISPLAY";
+
+ public static final String V_ON_TOP = "On Top";
+
+ public static final String V_DEFAUT = "Default";
+
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/preferences/MetaModelViewerPreferencePage.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/preferences/MetaModelViewerPreferencePage.java
new file mode 100644
index 0000000..8dcad3a
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/preferences/MetaModelViewerPreferencePage.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.preferences;
+
+import org.eclipse.app4mc.emfutils.metamodelviewer.base.Activator;
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+
+public class MetaModelViewerPreferencePage extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
+
+ public MetaModelViewerPreferencePage() {
+ super(GRID);
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription(
+ "Preference page to specify the properties/behaviour of MetaModel viewer");
+ }
+
+ /**
+ * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to manipulate various
+ * types of preferences. Each field editor knows how to save and restore itself.
+ */
+ @Override
+ public void createFieldEditors() {
+
+
+
+ final String[][] options = { { MetaModelViewerPreferenceConstants.V_DEFAUT,
+ MetaModelViewerPreferenceConstants.V_DEFAUT} ,{ MetaModelViewerPreferenceConstants.V_ON_TOP, MetaModelViewerPreferenceConstants.V_ON_TOP }
+ };
+
+
+ addField(new ComboFieldEditor(MetaModelViewerPreferenceConstants.P_DIALOG_DISPLAY, "&Configure the way child dialogs should be displayed", options,
+ getFieldEditorParent()));
+
+
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(final IWorkbench workbench) {
+ }
+
+}
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/preferences/PreferenceInitializer.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/preferences/PreferenceInitializer.java
new file mode 100644
index 0000000..12997de
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/preferences/PreferenceInitializer.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.preferences;
+
+import org.eclipse.app4mc.emfutils.metamodelviewer.base.Activator;
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * Class used to initialize default preference values.
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ store.setDefault(MetaModelViewerPreferenceConstants.P_DIALOG_DISPLAY, store.getString(MetaModelViewerPreferenceConstants.P_DIALOG_DISPLAY) != null
+ ? store.getString(MetaModelViewerPreferenceConstants.P_DIALOG_DISPLAY) : "");
+ }
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/ElementSearchPatternFilter.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/ElementSearchPatternFilter.java
new file mode 100644
index 0000000..fc8c3ca
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/ElementSearchPatternFilter.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.utils;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.dialogs.PatternFilter;
+
+public class ElementSearchPatternFilter extends PatternFilter {
+
+
+ private boolean filterForEClassifiersBoolean;
+
+ private boolean filterForAttributesBoolean;
+
+ public ElementSearchPatternFilter(final boolean filterForEClassifiersBoolean,
+ final boolean filterForAttributesBoolean) {
+
+ this.filterForEClassifiersBoolean = filterForEClassifiersBoolean;
+ this.filterForAttributesBoolean = filterForAttributesBoolean;
+ }
+
+ @Override
+ protected boolean isParentMatch(final Viewer viewer, final Object element) {
+
+ if (element instanceof SuperClassesListBuilder) {
+ return false;
+ }
+ else if (element instanceof SubClassesListBuilder) {
+ return false;
+ }
+ else if (element instanceof EStructuralFeature) {
+ return false;
+ }
+
+ else if (element instanceof TypeElement) {
+ return false;
+ }
+
+ return super.isParentMatch(viewer, element);
+ }
+
+ @Override
+ protected boolean isLeafMatch(final Viewer viewer, final Object element) {
+
+ if ((element instanceof EClassifier)) {
+ if (!isFilterForEClassifiersBoolean()) {
+ return false;
+ }
+ return super.isLeafMatch(viewer, element);
+
+ }
+ else if ((element instanceof EStructuralFeature)) {
+ if (!isFilterForAttributesBoolean()) {
+ return false;
+ }
+ return super.isLeafMatch(viewer, element);
+
+ }
+ else if (element instanceof SuperClassesListBuilder) {
+ return false;
+ }
+ else if (element instanceof org.eclipse.app4mc.emfutils.metamodelviewer.utils.SubClassesListBuilder) {
+ return false;
+ }
+ else if (element instanceof TypeElement) {
+ return false;
+ }
+ return super.isLeafMatch(viewer, element);
+ }
+
+ public boolean isFilterForEClassifiersBoolean() {
+ return this.filterForEClassifiersBoolean;
+ }
+
+ public boolean isFilterForAttributesBoolean() {
+ return this.filterForAttributesBoolean;
+ }
+
+ public void setFilterForEClassifiersBoolean(final boolean filterForEClassifiersBoolean) {
+ this.filterForEClassifiersBoolean = filterForEClassifiersBoolean;
+ }
+
+ public void setFilterForAttributesBoolean(final boolean filterForAttributesBoolean) {
+ this.filterForAttributesBoolean = filterForAttributesBoolean;
+ }
+}
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/PluginUtils.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/PluginUtils.java
new file mode 100644
index 0000000..19e0851
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/PluginUtils.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.utils;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.app4mc.emfutils.metamodelviewer.base.Activator;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+public class PluginUtils {
+
+ public static ImageDescriptor getImageDescriptor(final String location) {
+
+ final URL entry = Activator.getDefault().getBundle().getEntry(location);
+
+ if (entry != null) {
+
+ URL fileURL;
+ try {
+ fileURL = FileLocator.toFileURL(entry);
+ if (fileURL != null) {
+
+
+ return ImageDescriptor.createFromURL(fileURL);
+ }
+ }
+ catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ return null;
+ }
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/RegisterECOREfilesAction.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/RegisterECOREfilesAction.java
new file mode 100644
index 0000000..bc2d78d
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/RegisterECOREfilesAction.java
@@ -0,0 +1,114 @@
+package org.eclipse.app4mc.emfutils.metamodelviewer.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
+import org.eclipse.jface.viewers.ComboViewer;
+
+public class RegisterECOREfilesAction {
+
+ @SuppressWarnings({ "unused", "rawtypes", "unchecked" })
+ public static ResourceSet loadECOREs(List<String> ecoreFiles, ComboViewer combo_ecore) throws IOException {
+
+ final Registry master_ePackageRegistry = EPackage.Registry.INSTANCE;
+
+ System.out.println(master_ePackageRegistry.size());
+
+ ResourceSet metaDataResourceSet = new ResourceSetImpl();
+
+ if(metaDataResourceSet instanceof ResourceSetImpl){
+ ((ResourceSetImpl) metaDataResourceSet).setURIResourceMap(new HashMap<>());
+ }
+ Map<String, Object> extensionToFactoryMap = metaDataResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap();
+
+ extensionToFactoryMap.put("ecore", new EcoreResourceFactoryImpl());
+
+// extensionToFactoryMap.put("xmi", new XMIResourceFactoryImpl());
+
+ // resourceSet.getURIConverter().getURIMap().putAll(EcorePlugin.computePlatformURIMap(true));
+
+ EcorePackage ecorePackage = EcorePackage.eINSTANCE;
+
+ // register Ecore model in resourceSet registry
+ Map packageRegistry = metaDataResourceSet.getPackageRegistry();
+
+ packageRegistry.put("http://www.eclipse.org/emf/2002/Ecore",
+ EcorePackage.eINSTANCE);
+
+
+ for (String ecorePath : ecoreFiles) {
+
+ EPackage loadEPackage = loadEPackage(ecorePath, metaDataResourceSet);
+
+ if(packageRegistry.containsKey(loadEPackage.getNsURI())){
+ Object object = packageRegistry.get(loadEPackage.getNsURI());
+
+ if(object instanceof EPackage){
+ ((EPackage)object).getESubpackages().add(loadEPackage);
+ }
+ }else{
+ packageRegistry.put(loadEPackage.getNsURI(), loadEPackage);
+
+ }
+
+// master_ePackageRegistry.put(loadEPackage.getNsURI(), loadEPackage);
+
+ }
+
+ EcoreUtil.resolveAll(metaDataResourceSet);
+
+ /*-for sorting */
+
+ ArrayList arrayList = new ArrayList(master_ePackageRegistry.keySet());
+
+ Collections.sort(arrayList);
+
+ arrayList.addAll(0, metaDataResourceSet.getPackageRegistry().keySet());
+
+ master_ePackageRegistry.putAll(metaDataResourceSet.getPackageRegistry());
+
+
+ combo_ecore.setInput(arrayList.toArray());
+
+
+ return metaDataResourceSet;
+ }
+
+ private static EPackage loadEPackage(String path, ResourceSet metaResourceSet) throws IOException {
+
+
+// path = path.contains("file:////") ? path : "file:////" + getCanonicalPathFullPath(path);
+ path = getCanonicalPathFullPath(path);
+
+// Resource metaResource = metaResourceSet.getResource(URI.createURI(path), true);
+ Resource metaResource = metaResourceSet.getResource(URI.createFileURI(path), true);
+
+ metaResource.load(Collections.EMPTY_MAP);
+
+ EObject eObject = metaResource.getContents().get(0);
+
+ return (EPackage) eObject;
+
+ }
+
+ private static String getCanonicalPathFullPath(String path) throws IOException {
+
+ File file = new File(path);
+ return file.getCanonicalPath();
+ }
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/SubClassesListBuilder.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/SubClassesListBuilder.java
new file mode 100644
index 0000000..59f1f95
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/SubClassesListBuilder.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.utils;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+public class SubClassesListBuilder {
+
+ private final EClass eClass;
+
+ public SubClassesListBuilder(final EClass eClass) {
+ this.eClass = eClass;
+ }
+
+ private boolean isCalculated;
+
+ final Set<EClass> allSubClasses = new HashSet<EClass>();
+
+ public Set<EClass> getAllSubClasses() {
+
+ if (!this.isCalculated) {
+ final List<EClass> eAllSuperTypes = getSubClasses(this.eClass);
+
+ this.allSubClasses.addAll(eAllSuperTypes);
+
+ for (final EClass subClass : eAllSuperTypes) {
+ final SubClassesListBuilder classList = new SubClassesListBuilder(subClass);
+
+ this.allSubClasses.addAll(classList.getAllSubClasses());
+
+
+ }
+
+ }
+
+
+ return this.allSubClasses;
+
+ }
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass) {
+
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ final ResourceSet resourceSet = selectedObjClass.eResource().getResourceSet();
+
+ if (resourceSet != null) {
+
+ // With this approach check is made to find the Sub-Classes for the supplied EClass in all the packages
+ // belonging to the resourceset
+
+ final EList<Resource> resources = resourceSet.getResources();
+
+ for (final Resource resource : resources) {
+
+ final EList<EObject> contents = resource.getContents();
+
+ if (contents.size() > 0) {
+// final EObject eObject = contents.get(0);
+
+ for (EObject eObj : contents) {
+
+ if (eObj instanceof EPackage) {
+ allSubClasses.addAll(getSubClasses(selectedObjClass, (EPackage) eObj));
+ }
+
+ }
+ }
+
+ }
+ }
+ else {
+
+ final EPackage ePackage = selectedObjClass.getEPackage();
+
+ if(ePackage !=null){
+ EObject rootEPackage=org.eclipse.emf.ecore.util.EcoreUtil.getRootContainer(selectedObjClass);
+
+ if(rootEPackage instanceof EPackage){
+ return getSubClasses(selectedObjClass, (EPackage) rootEPackage);
+ }
+ }
+
+ return getSubClasses(selectedObjClass, ePackage);
+
+ }
+
+ return allSubClasses;
+
+ }
+
+ private List<EClass> getSubClasses(final EClass selectedObjClass, final EPackage ePackage) {
+
+
+
+ final List<EClass> allSubClasses = new ArrayList<EClass>();
+
+ EList<EPackage> eSubpackages = ePackage.getESubpackages();
+
+ for (EPackage eSubPackage : eSubpackages) {
+ allSubClasses.addAll(getSubClasses(selectedObjClass, eSubPackage));
+ }
+
+ final EList<EClassifier> eClassifiers = ePackage.getEClassifiers();
+
+ for (final EClassifier eClassifier : eClassifiers) {
+
+ if (eClassifier instanceof EClass) {
+
+ if (!(selectedObjClass == eClassifier) && selectedObjClass.isSuperTypeOf((EClass) eClassifier)) {
+ allSubClasses.add((EClass) eClassifier);
+ }
+
+
+ }
+ }
+ return allSubClasses;
+ }
+
+}
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/SuperClassesListBuilder.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/SuperClassesListBuilder.java
new file mode 100644
index 0000000..379d594
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/SuperClassesListBuilder.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.utils;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+
+public class SuperClassesListBuilder {
+
+ private final EClass eClass;
+
+ private boolean isCalculated;
+
+ final Set<EClass> allSuperClasses = new HashSet<EClass>();
+
+ public SuperClassesListBuilder(final EClass eClass) {
+ this.eClass = eClass;
+
+ }
+
+ public Set<EClass> getAllSuperClasses() {
+
+ if (!this.isCalculated) {
+
+ final EList<EClass> eAllSuperTypes = this.eClass.getEAllSuperTypes();
+
+ this.allSuperClasses.addAll(eAllSuperTypes);
+
+ for (final EClass subClass : eAllSuperTypes) {
+ final SuperClassesListBuilder classList = new SuperClassesListBuilder(subClass);
+
+ this.allSuperClasses.addAll(classList.getAllSuperClasses());
+
+
+ }
+ }
+
+ return this.allSuperClasses;
+
+ }
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/TypeElement.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/TypeElement.java
new file mode 100644
index 0000000..4a04a8f
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/utils/TypeElement.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.utils;
+
+import org.eclipse.emf.ecore.EClassifier;
+
+public class TypeElement {
+
+ private EClassifier classifier;
+
+ public TypeElement(final EClassifier classifier) {
+ this.classifier = classifier;
+ }
+
+ public EClassifier getClassifier() {
+ return this.classifier;
+ }
+
+ public void setClassifier(final EClassifier classifier) {
+ this.classifier = classifier;
+ }
+
+}
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/views/MetaModelExplorerView.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/views/MetaModelExplorerView.java
new file mode 100644
index 0000000..b2dee70
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/views/MetaModelExplorerView.java
@@ -0,0 +1,471 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.views;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.app4mc.emfutils.metamodelviewer.base.Activator;
+import org.eclipse.app4mc.emfutils.metamodelviewer.dialogs.SelectedElementContentDialog;
+import org.eclipse.app4mc.emfutils.metamodelviewer.preferences.MetaModelViewerPreferenceConstants;
+import org.eclipse.app4mc.emfutils.metamodelviewer.utils.ElementSearchPatternFilter;
+import org.eclipse.app4mc.emfutils.metamodelviewer.utils.PluginUtils;
+import org.eclipse.app4mc.emfutils.metamodelviewer.utils.RegisterECOREfilesAction;
+import org.eclipse.app4mc.emfutils.metamodelviewer.views.providers.ViewContentProvider;
+import org.eclipse.app4mc.emfutils.metamodelviewer.views.providers.ViewLabelProvider;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EPackage.Registry;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.sphinx.emf.metamodel.IMetaModelDescriptor;
+import org.eclipse.sphinx.emf.metamodel.MetaModelDescriptorRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.part.ViewPart;
+
+
+public class MetaModelExplorerView extends ViewPart {
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.eclipse.app4mc.emfutils.metamodelviewer.views.MetaModel-ExplorerView";
+ private static int id_Counter = 1;
+ private TreeViewer viewer;
+ private Action filterClassesAction;
+ private Action registerEcoreFilesAction;
+ private Action filterAttributesAction;
+ private Action cloneViewAction;
+ private boolean filterForEClassifiersBoolean = true;
+ private boolean filterForAttributesBoolean;
+ private ElementSearchPatternFilter patternFilter;
+ private ComboViewer combo_ecore;
+
+ /**
+ * The constructor.
+ */
+ public MetaModelExplorerView() {
+ }
+
+ /**
+ * This is a callback that will allow us to create the viewer and initialize it.
+ */
+ @Override
+ public void createPartControl(final Composite parent) {
+ parent.setLayout(new GridLayout(2, false));
+
+ final Label label = new Label(parent, 0);
+
+ label.setText("SPHINX Registry");
+
+ label.setLayoutData(new GridData());
+
+ final Combo combo = new Combo(parent,
+ SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
+
+ final Label label_ecore = new Label(parent, 0);
+
+ label_ecore.setText("ECORE Registry");
+
+ label_ecore.setLayoutData(new GridData());
+
+ combo_ecore = new ComboViewer(parent,
+ SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
+
+ final Registry ePackageRegistry = EPackage.Registry.INSTANCE;
+
+ final Set<String> keySet = ePackageRegistry.keySet();
+ // for (final String string : new TreeSet<String>(keySet)) {
+ //
+ // combo_ecore.add(string);
+ // }
+ combo_ecore.setContentProvider(ArrayContentProvider.getInstance());
+ combo_ecore.setLabelProvider(new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return super.getText(element);
+ }
+ });
+
+ ArrayList<String> arrayList = new ArrayList<String>(keySet);
+
+ Collections.sort(arrayList);
+
+ combo_ecore.setInput(arrayList.toArray());
+
+ combo_ecore.getCombo().addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ combo.deselectAll();
+
+ final String text = combo_ecore.getCombo().getText();
+
+ final EPackage ePackage = ePackageRegistry.getEPackage(text);
+
+ getViewer().setInput(ePackage);
+ }
+ });
+
+ final List<IMetaModelDescriptor> descriptors = MetaModelDescriptorRegistry.INSTANCE.getDescriptors(MetaModelDescriptorRegistry.ANY_MM);
+
+ for (final IMetaModelDescriptor iMetaModelDescriptor : descriptors) {
+ final String identifier = iMetaModelDescriptor.getIdentifier();
+ combo.add(identifier);
+ }
+
+ combo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ combo_ecore.getCombo().deselectAll();
+
+ final String text = combo.getText();
+
+ final IMetaModelDescriptor descriptor = MetaModelDescriptorRegistry.INSTANCE.getDescriptor(text);
+
+ getViewer().setInput(descriptor);
+ }
+ });
+
+ this.patternFilter = new ElementSearchPatternFilter(this.filterForEClassifiersBoolean,
+ this.filterForAttributesBoolean);
+
+ final FilteredTree filteredTree = new FilteredTree(parent,
+ SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER,
+ this.patternFilter, true);
+
+ filteredTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true,
+ 2, 0));
+
+ this.viewer = filteredTree.getViewer();
+
+ final GridData gridLayoutData = new GridData();
+ gridLayoutData.horizontalSpan = 2;
+ gridLayoutData.grabExcessHorizontalSpace = true;
+ gridLayoutData.grabExcessVerticalSpace = true;
+ gridLayoutData.horizontalAlignment = GridData.FILL;
+ gridLayoutData.verticalAlignment = GridData.FILL;
+
+ this.viewer.getTree()
+ .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true,
+ 2, 0));
+
+ this.viewer.setContentProvider(new ViewContentProvider());
+
+ this.viewer.setInput(getViewSite());
+
+ this.viewer.setLabelProvider(new ViewLabelProvider());
+
+ getSite().setSelectionProvider(this.viewer);
+
+ makeActions();
+
+ hookContextMenu();
+
+ hookDoubleClickAction();
+
+ contributeToActionBars();
+ }
+
+ public TreeViewer getViewer() {
+ return this.viewer;
+ }
+
+ private void hookContextMenu() {
+ final MenuManager menuMgr = new MenuManager("#PopupMenu") {
+ @Override
+ public IContributionItem[] getItems() {
+ IContributionItem[] menuItems = super.getItems();
+
+ final List<IContributionItem> filteredContributionItems = new LinkedList<IContributionItem>();
+
+ for (final IContributionItem contributionItem : menuItems) {
+ if ((contributionItem != null) &&
+ ((contributionItem.getId() != null) &&
+ (!(contributionItem.getId()
+ .startsWith("org.eclipse.emf.ecore.editor.CreateDynamicInstance"))))) {
+ filteredContributionItems.add(contributionItem);
+ }
+ }
+
+ menuItems = new IContributionItem[filteredContributionItems.size()];
+
+ return filteredContributionItems.toArray(menuItems);
+ }
+ };
+
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ @Override
+ public void menuAboutToShow(final IMenuManager manager) {
+ MetaModelExplorerView.this.fillContextMenu(manager);
+ }
+ });
+
+ final Menu menu = menuMgr.createContextMenu(this.viewer.getControl());
+ this.viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, this.viewer);
+ }
+
+ private void contributeToActionBars() {
+ final IActionBars bars = getViewSite().getActionBars();
+ fillLocalPullDown(bars.getMenuManager());
+ fillLocalToolBar(bars.getToolBarManager());
+ }
+
+ private void fillLocalPullDown(final IMenuManager manager) {
+ manager.add(this.filterClassesAction);
+ manager.add(new Separator());
+ manager.add(this.filterAttributesAction);
+ manager.add(new Separator());
+ manager.add(this.cloneViewAction);
+ }
+
+ void fillContextMenu(final IMenuManager manager) {
+ // manager.add(this.filterClassesAction);
+ // manager.add(this.filterAttributesAction);
+ // manager.add(new Separator());
+ // this.drillDownAdapter.addNavigationActions(manager);
+ // Other plug-ins can contribute there actions here
+ // manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ private void fillLocalToolBar(final IToolBarManager manager) {
+ manager.add(this.filterClassesAction);
+ manager.add(this.filterAttributesAction);
+ manager.add(new Separator());
+
+ manager.add(this.registerEcoreFilesAction);
+ }
+
+ private void makeActions() {
+ this.filterClassesAction = new Action("Filter for EClassifers",
+ IAction.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ if (isChecked()) {
+ setFilterForEClassifiersBoolean(true);
+ } else {
+ setFilterForEClassifiersBoolean(false);
+ }
+ }
+ };
+
+ this.filterClassesAction.setEnabled(true);
+
+ this.filterClassesAction.setToolTipText("Filter for EClassifiers");
+ this.filterClassesAction.setImageDescriptor(PluginUtils.getImageDescriptor(
+ "icons/class_obj.png"));
+
+ this.filterAttributesAction = new Action("Filter for Attributes",
+ IAction.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ if (isChecked()) {
+ setFilterForAttributesBoolean(true);
+ } else {
+ setFilterForAttributesBoolean(false);
+ }
+ }
+ };
+ this.filterAttributesAction.setToolTipText("Filter for Attributes");
+ this.filterAttributesAction.setImageDescriptor(PluginUtils.getImageDescriptor(
+ "icons/prop_ps.gif"));
+
+ this.cloneViewAction = new Action("Clone View", IAction.AS_CHECK_BOX) {
+ @Override
+ public void run() {
+ try {
+ getViewSite().getPage()
+ .showView(ID, id_Counter++ + "",
+ IWorkbenchPage.VIEW_VISIBLE);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ };
+ this.cloneViewAction.setToolTipText("Clone View");
+ this.cloneViewAction.setImageDescriptor(PluginUtils.getImageDescriptor(
+ "icons/prop_ps.gif"));
+
+
+ this.registerEcoreFilesAction = new Action("Register ECORE files") {
+ @Override
+ public void run() {
+ //TODO: add implementation for CSV report generation
+ Object input = viewer.getInput();
+
+ FileDialog dialog = new FileDialog(Display.getDefault()
+ .getActiveShell(),
+ SWT.OPEN | SWT.MULTI);
+
+ dialog.setFilterExtensions(new String[] { "*.ecore" });
+
+ dialog.open();
+
+ if ((dialog.getFileName() == null) ||
+ (dialog.getFileNames() == null)) {
+ return;
+ }
+
+ List<String> files = new ArrayList<String>();
+
+ for (String fileName : dialog.getFileNames()) {
+ String filePath = dialog.getFilterPath() +
+ File.separator + fileName;
+
+ files.add(filePath);
+ }
+
+ try {
+ RegisterECOREfilesAction.loadECOREs(files,
+ combo_ecore);
+ } catch (Exception e) {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ MessageDialog.openError(Display.getDefault()
+ .getActiveShell(),
+ "Error", e.getMessage());
+ }
+ });
+ }
+ }
+ };
+ this.registerEcoreFilesAction.setToolTipText(
+ "Register ECORE files");
+ this.registerEcoreFilesAction.setImageDescriptor(PluginUtils.getImageDescriptor(
+ "icons/register_ecores.png"));
+ }
+
+ private void hookDoubleClickAction() {
+ this.viewer.addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(final DoubleClickEvent event) {
+ final ISelection selection = event.getSelection();
+
+ if (selection instanceof TreeSelection) {
+ final Object firstElement = ((TreeSelection) selection).getFirstElement();
+
+ if (firstElement instanceof EObject) {
+ Shell parentShell = null;
+
+ String displayDialogStyle = (Activator.getDefault()
+ .getPreferenceStore()
+ .getString(MetaModelViewerPreferenceConstants.P_DIALOG_DISPLAY));
+
+ if ((displayDialogStyle != null) &&
+ displayDialogStyle.equals(
+ MetaModelViewerPreferenceConstants.V_ON_TOP)) {
+ parentShell = new Shell(SWT.ON_TOP);
+ } else {
+ parentShell = new Shell();
+ }
+
+ // final String name = ((firstElement instanceof EClass) ? ((EClass) firstElement).getName() :
+ // "");
+ //
+ // parentShell.setText("Details of : " + ((EClass) firstElement).eClass().getName() + " " +
+ // name);
+ //
+ //
+ // final TaskBar systemTaskBar = parentShell.getDisplay().getSystemTaskBar();
+ // final TaskItem taskItem = systemTaskBar.getItem(parentShell);
+ //
+ // taskItem.setData(parentShell);
+ // taskItem.setOverlayText(name);
+ // taskItem.setText(name);
+ new SelectedElementContentDialog(parentShell,
+ getSite(), (EObject) firstElement).open();
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ @Override
+ public void setFocus() {
+ this.viewer.getControl().setFocus();
+ }
+
+ public Action getFilterClassesAction() {
+ return this.filterClassesAction;
+ }
+
+ public Action getFilterAttributesAction() {
+ return this.filterAttributesAction;
+ }
+
+ public boolean isFilterForEClassifiersBoolean() {
+ return this.filterForEClassifiersBoolean;
+ }
+
+ public boolean isFilterForAttributesBoolean() {
+ return this.filterForAttributesBoolean;
+ }
+
+ public void setFilterClassesAction(final Action filterClassesAction) {
+ this.filterClassesAction = filterClassesAction;
+ }
+
+ public void setFilterAttributesAction(final Action filterAttributesAction) {
+ this.filterAttributesAction = filterAttributesAction;
+ }
+
+ public void setFilterForEClassifiersBoolean(
+ final boolean filterForEClassifiersBoolean) {
+ this.filterForEClassifiersBoolean = filterForEClassifiersBoolean;
+
+ this.patternFilter.setFilterForEClassifiersBoolean(filterForEClassifiersBoolean);
+ }
+
+ public void setFilterForAttributesBoolean(
+ final boolean filterForAttributesBoolean) {
+ this.filterForAttributesBoolean = filterForAttributesBoolean;
+
+ this.patternFilter.setFilterForAttributesBoolean(filterForAttributesBoolean);
+ }
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/views/providers/ViewContentProvider.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/views/providers/ViewContentProvider.java
new file mode 100644
index 0000000..8ec9390
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/views/providers/ViewContentProvider.java
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.views.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.app4mc.emfutils.metamodelviewer.utils.SubClassesListBuilder;
+import org.eclipse.app4mc.emfutils.metamodelviewer.utils.SuperClassesListBuilder;
+import org.eclipse.app4mc.emfutils.metamodelviewer.utils.TypeElement;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+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.ENamedElement;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypeParameter;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.sphinx.emf.metamodel.IMetaModelDescriptor;
+
+public class ViewContentProvider implements ITreeContentProvider {
+
+ @Override
+ public Object[] getElements(final Object parent) {
+ if (parent instanceof IMetaModelDescriptor) {
+
+ final Collection<EPackage> ePackages = ((IMetaModelDescriptor) parent).getEPackages();
+
+ return ePackages.toArray();
+ }
+ else if (parent instanceof EPackage) {
+
+ final EList<EPackage> eSubpackages = ((EPackage) parent).getESubpackages();
+ final EList<EClassifier> eClassifiers = ((EPackage) parent).getEClassifiers();
+
+ final ArrayList<EPackage> arrayList1 = new ArrayList<EPackage>();
+
+ arrayList1.addAll(eSubpackages);
+
+
+ Collections.sort(arrayList1, this.comparator);
+
+ final ArrayList<EClassifier> arrayList2 = new ArrayList<EClassifier>();
+
+ arrayList2.addAll(eClassifiers);
+
+ Collections.sort(arrayList2, this.comparator);
+
+ final List<ENamedElement> combinedList = new ArrayList<ENamedElement>();
+
+ combinedList.addAll(arrayList1);
+ combinedList.addAll(arrayList2);
+
+ return combinedList.toArray();
+
+ }
+ else if (parent instanceof Entry) {
+ return new Object[] { ((Entry<?, ?>) parent).getValue() };
+ }
+
+ return getChildren(parent);
+ }
+
+ @Override
+ public Object getParent(final Object child) {
+
+ if (child instanceof EPackage) {
+ return ((EPackage) child).eContainer();
+ }
+ else if (child instanceof EClass) {
+ return ((EClass) child).eContainer();
+ }
+ else if (child instanceof EStructuralFeature) {
+ return ((EStructuralFeature) child).eContainer();
+ }
+
+ return null;
+ }
+
+ @Override
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public Object[] getChildren(final Object parent) {
+ if (parent instanceof EPackage) {
+
+ final EList<EPackage> eSubpackages = ((EPackage) parent).getESubpackages();
+ final EList<EClassifier> eClassifiers = ((EPackage) parent).getEClassifiers();
+
+ final ArrayList<EPackage> arrayList1 = new ArrayList<EPackage>();
+
+ arrayList1.addAll(eSubpackages);
+
+
+ Collections.sort(arrayList1, this.comparator);
+
+ final ArrayList<EClassifier> arrayList2 = new ArrayList<EClassifier>();
+
+ arrayList2.addAll(eClassifiers);
+
+ Collections.sort(arrayList2, this.comparator);
+
+ final List<ENamedElement> combinedList = new ArrayList<ENamedElement>();
+
+ combinedList.addAll(arrayList1);
+ combinedList.addAll(arrayList2);
+
+ return combinedList.toArray();
+
+ }
+ else if (parent instanceof EClass) {
+
+ final EList<EStructuralFeature> eAllStructuralFeatures = ((EClass) parent).getEAllStructuralFeatures();
+
+ final List list = new ArrayList();
+
+ list.addAll(eAllStructuralFeatures);
+
+
+ Collections.sort(list, this.comparator);
+
+ int index = 0;
+
+ final SuperClassesListBuilder superClassList = new SuperClassesListBuilder((EClass) parent);
+
+ if (superClassList.getAllSuperClasses().size() > 0) {
+ list.add(index++, superClassList);
+ }
+
+ final SubClassesListBuilder SubClassesListBuilder = new SubClassesListBuilder((EClass) parent);
+
+ if (SubClassesListBuilder.getAllSubClasses().size() > 0) {
+
+ list.add(index++, SubClassesListBuilder);
+ }
+
+ return list.toArray();
+ }
+ else if (parent instanceof EDataType) {
+
+ if (parent instanceof EEnum) {
+
+ final EList<EEnumLiteral> eLiterals = ((EEnum) parent).getELiterals();
+
+ final List<ENamedElement> list = new ArrayList<ENamedElement>();
+
+ list.addAll(eLiterals);
+
+ Collections.sort(list, this.comparator);
+
+ return list.toArray();
+ }
+
+ final EList<ETypeParameter> eTypeParameters = ((EDataType) parent).getETypeParameters();
+
+ final List<ENamedElement> list = new ArrayList<ENamedElement>();
+
+ list.addAll(eTypeParameters);
+
+ Collections.sort(list, this.comparator);
+
+ return list.toArray();
+ }
+ else if (parent instanceof EEnum) {
+
+ final EList<EEnumLiteral> eLiterals = ((EEnum) parent).getELiterals();
+
+ final List<ENamedElement> list = new ArrayList<ENamedElement>();
+
+ list.addAll(eLiterals);
+
+ Collections.sort(list, this.comparator);
+
+ return list.toArray();
+ }
+ else if (parent instanceof SuperClassesListBuilder) {
+ final Set<EClass> allSuperClasses = ((SuperClassesListBuilder) parent).getAllSuperClasses();
+ final ArrayList<ENamedElement> arrayList = new ArrayList<ENamedElement>(allSuperClasses);
+ Collections.sort(arrayList, this.comparator);
+ return arrayList.toArray();
+ }
+ else if (parent instanceof SubClassesListBuilder) {
+ final Set<EClass> allSubClasses = ((SubClassesListBuilder) parent).getAllSubClasses();
+ final ArrayList<ENamedElement> arrayList = new ArrayList<ENamedElement>(allSubClasses);
+ Collections.sort(arrayList, this.comparator);
+ return arrayList.toArray();
+ }
+ else if (parent instanceof EStructuralFeature) {
+ final EClassifier eType = ((EStructuralFeature) parent).getEType();
+ return new Object[] { new TypeElement(eType) };
+ }
+ else if (parent instanceof TypeElement) {
+ final EClassifier eType = ((TypeElement) parent).getClassifier();
+ return new Object[] { eType };
+ }
+ return new Object[0];
+ }
+
+ @Override
+ public boolean hasChildren(final Object parent) {
+ if (parent instanceof EPackage) {
+ return true;
+ }
+ else if (parent instanceof EClass) {
+ return true;
+ }
+ else if (parent instanceof EDataType) {
+
+ if (parent instanceof EEnum) {
+ return ((EEnum) parent).getELiterals().size() > 0;
+ }
+ return ((EDataType) parent).getETypeParameters().size() > 0;
+ }
+ else if (parent instanceof EEnum) {
+ return ((EEnum) parent).getELiterals().size() > 0;
+ }
+
+ else if (parent instanceof EStructuralFeature) {
+ return true;
+ }
+
+ else if (parent instanceof SuperClassesListBuilder) {
+ return ((SuperClassesListBuilder) parent).getAllSuperClasses().size() > 0;
+ }
+ else if (parent instanceof SubClassesListBuilder) {
+ return ((SubClassesListBuilder) parent).getAllSubClasses().size() > 0;
+ }
+ else if (parent instanceof EEnumLiteral) {
+ return false;
+ }
+ else if (parent instanceof TypeElement) {
+ return true;
+ }
+ return true;
+ }
+
+ @Override
+ public void dispose() {
+ // Auto-generated method stub
+
+ }
+
+ @Override
+ public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
+ // Auto-generated method stub
+
+ }
+
+ final Comparator<ENamedElement> comparator = new Comparator<ENamedElement>() {
+
+ @Override
+ public int compare(final ENamedElement arg0, final ENamedElement arg1) {
+ return arg0.getName().compareTo(arg1.getName());
+ }
+ };
+
+}
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/views/providers/ViewLabelProvider.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/views/providers/ViewLabelProvider.java
new file mode 100644
index 0000000..2daa435
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.metamodelviewer/src/org/eclipse/app4mc/emfutils/metamodelviewer/views/providers/ViewLabelProvider.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.metamodelviewer.views.providers;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.app4mc.emfutils.metamodelviewer.base.Activator;
+import org.eclipse.app4mc.emfutils.metamodelviewer.utils.SubClassesListBuilder;
+import org.eclipse.app4mc.emfutils.metamodelviewer.utils.SuperClassesListBuilder;
+import org.eclipse.app4mc.emfutils.metamodelviewer.utils.TypeElement;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+public class ViewLabelProvider extends LabelProvider {
+
+
+ private final Image classImage;
+ private final Image enumImage;
+ private final Image containmentImage;
+ private final Image superClassListImage;
+ private final Image SubClassesListBuilderImage;
+ private final Image attributeImage;
+ private final Image attribute_referenceImage;
+ private final Image abstractClassImage;
+ private final Image interfaceImage;
+ private final Image eTypeImage;
+
+ public ViewLabelProvider() {
+
+ this.classImage = getImage("icons/class_obj.png");
+ this.enumImage = getImage("icons/enum_obj.png");
+ this.containmentImage = getImage("icons/attribute_containment.png");
+ this.superClassListImage = getImage("icons/super_co.gif");
+ this.SubClassesListBuilderImage = getImage("icons/downward_co.gif");
+ this.attributeImage = getImage("icons/attribute.png");
+ this.attribute_referenceImage = getImage("icons/attribute_reference.png");
+ this.abstractClassImage = getImage("icons/abstract_class_obj.png");
+ this.interfaceImage = getImage("icons/interface_obj.png");
+ this.eTypeImage = getImage("icons/type_obj.gif");
+ }
+
+
+ private Image getImage(final String location) {
+
+ final URL entry = Activator.getDefault().getBundle().getEntry(location);
+
+ if (entry != null) {
+
+ URL fileURL;
+ try {
+ fileURL = FileLocator.toFileURL(entry);
+ if (fileURL != null) {
+ return new Image(Display.getDefault(), new ImageData(fileURL.getFile()));
+ }
+ }
+ catch (final IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ return null;
+ }
+
+
+ @Override
+ public String getText(final Object child) {
+
+ if (child instanceof EPackage) {
+ return ((EPackage) child).getName();
+ }
+ else if (child instanceof EClass) {
+ return ((EClass) child).getName();
+ }
+ else if (child instanceof EDataType) {
+ return ((EDataType) child).getName();
+ }
+ else if (child instanceof EEnum) {
+ return "Enum : " + ((EEnum) child).getName();
+ }
+ else if (child instanceof EEnumLiteral) {
+ return ((EEnumLiteral) child).getName();
+ }
+ else if (child instanceof EStructuralFeature) {
+ final EStructuralFeature eStFeature = (EStructuralFeature) child;
+
+ final int lowerBound = eStFeature.getLowerBound();
+ final int upperBound = eStFeature.getUpperBound();
+
+ final String lowerBoundString = lowerBound == -1 ? "*" : lowerBound + "";
+
+ final String upperBoundString = upperBound == -1 ? "*" : upperBound + "";
+
+ final String multiplicity = "[" + lowerBoundString + " " + upperBoundString + "]";
+
+ return eStFeature.getName() + " " + multiplicity + " " + eStFeature.getEType().getName();
+ }
+ else if (child instanceof SuperClassesListBuilder) {
+ return "Super Classes";
+ }
+ else if (child instanceof SubClassesListBuilder) {
+ return "All-Sub Classes";
+ }
+ else if (child instanceof TypeElement) {
+ return "<--EType-->";
+ }
+ return child.toString();
+ }
+
+ @Override
+ public Image getImage(final Object obj) {
+ String imageKey = ISharedImages.IMG_OBJ_ELEMENT;
+ if (obj instanceof EPackage) {
+ imageKey = ISharedImages.IMG_OBJ_FOLDER;
+ }
+ else if (obj instanceof EStructuralFeature && obj instanceof EReference) {
+
+ if (((EReference) obj).isContainment()) {
+ return this.containmentImage;
+ }
+
+ return this.attribute_referenceImage;
+ }
+ else if (obj instanceof EAttribute) {
+ return this.attributeImage;
+
+ }
+ else if (obj instanceof EDataType) {
+ imageKey = ISharedImages.IMG_OBJ_ELEMENT;
+
+ if (obj instanceof EEnum) {
+ return this.enumImage;
+ }
+
+ }
+ else if (obj instanceof EClass) {
+ if (((EClass) obj).isAbstract() && ((EClass) obj).isInterface()) {
+ return this.interfaceImage;
+ }
+ if (((EClass) obj).isAbstract()) {
+ return this.abstractClassImage;
+ }
+
+ return this.classImage;
+ }
+ else if (obj instanceof EEnum) {
+ return this.enumImage;
+ }
+ else if (obj instanceof SuperClassesListBuilder) {
+ return this.superClassListImage;
+ }
+ else if (obj instanceof SubClassesListBuilder) {
+
+ return this.SubClassesListBuilderImage;
+ }
+ else if (obj instanceof TypeElement) {
+
+ return this.eTypeImage;
+ }
+ return PlatformUI.getWorkbench().getSharedImages().getImage(imageKey);
+ }
+}
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.classpath b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.classpath
new file mode 100644
index 0000000..eca7bdb
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.classpath
@@ -0,0 +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.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.gitignore b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.gitignore
new file mode 100644
index 0000000..84a4913
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.gitignore
@@ -0,0 +1,2 @@
+/target
+/bin
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.project b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.project
new file mode 100644
index 0000000..02349ae
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.app4mc.emfutils.resourceset.mapper</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/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.settings/org.eclipse.jdt.core.prefs b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/META-INF/MANIFEST.MF b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..832959d
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Mapper
+Bundle-SymbolicName: org.eclipse.app4mc.emfutils.resourceset.mapper;singleton:=true
+Bundle-Version: 0.8.0
+Bundle-Activator: org.eclipse.app4mc.emfutils.resourceset.mapper.Activator
+Bundle-Vendor: Eclipse.org
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.sphinx.emf
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/build.properties b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/plugin.xml b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/plugin.xml
new file mode 100644
index 0000000..6d62458
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/plugin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup class="org.eclipse.app4mc.emfutils.resourceset.mapper.ResourceSetMapper"/>
+ </extension>
+
+</plugin>
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/pom.xml b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/pom.xml
new file mode 100644
index 0000000..8b91e5b
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/pom.xml
@@ -0,0 +1,82 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <relativePath>../../build/org.eclipse.app4mc.emfutils.extractor.build</relativePath>
+ <groupId>org.eclipse.app4mc.emfutils.content.extractor</groupId>
+ <artifactId>org.eclipse.app4mc.emfutils.extractor.build</artifactId>
+ <version>0.8.0</version>
+ </parent>
+
+ <artifactId>org.eclipse.app4mc.emfutils.resourceset.mapper</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>xtend-gen</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.4.1</version>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>xtend-gen</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>xtend-gen</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ <version>2.7.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>xtend-gen</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/src/org/eclipse/app4mc/emfutils/resourceset/mapper/Activator.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/src/org/eclipse/app4mc/emfutils/resourceset/mapper/Activator.java
new file mode 100644
index 0000000..eac27cf
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/src/org/eclipse/app4mc/emfutils/resourceset/mapper/Activator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.resourceset.mapper;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/src/org/eclipse/app4mc/emfutils/resourceset/mapper/ResourceSetMapper.java b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/src/org/eclipse/app4mc/emfutils/resourceset/mapper/ResourceSetMapper.java
new file mode 100644
index 0000000..8370088
--- /dev/null
+++ b/eclipse-tools/emf-graphical-viewer/plugins/org.eclipse.app4mc.emfutils.resourceset.mapper/src/org/eclipse/app4mc/emfutils/resourceset/mapper/ResourceSetMapper.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Robert Bosch GmbH.
+ * 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:
+ * Robert Bosch GmbH - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.app4mc.emfutils.resourceset.mapper;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.sphinx.emf.metamodel.IMetaModelDescriptor;
+import org.eclipse.sphinx.emf.metamodel.MetaModelDescriptorRegistry;
+import org.eclipse.ui.IStartup;
+
+public class ResourceSetMapper implements IStartup {
+
+ @Override
+ public void earlyStartup() {
+
+ List<IMetaModelDescriptor> descriptors = MetaModelDescriptorRegistry.INSTANCE
+ .getDescriptors(MetaModelDescriptorRegistry.ANY_MM);
+
+ for (IMetaModelDescriptor iMetaModelDescriptor : descriptors) {
+
+ ResourceSet resourceSet=new ResourceSetImpl();
+
+ for (EPackage ePackage : iMetaModelDescriptor.getEPackages()) {
+
+ Resource eResource = ePackage.eResource();
+
+ if(eResource.getResourceSet()==null){
+
+ ((ResourceSetImpl)resourceSet).getResources().add(eResource);
+
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/general-tools/.gitignore b/general-tools/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/general-tools/.gitignore