Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Bergmayr2015-07-31 08:50:03 -0400
committerAlex Bergmayr2015-07-31 08:50:03 -0400
commit31245ca47c863216d15dcd3c86b83b0a5fc324ee (patch)
tree6de5d4de026908b799c381c5f75b7d2d6a4df7f6 /proprietary/bundles/org.eclipse.upr.platform.java.ui
parentd754246c1bc2dc9db9b392f1e00d69a6fb5ac42e (diff)
downloadupr-master.tar.gz
upr-master.tar.xz
upr-master.zip
Added initial JUMP contributionHEADmaster
Diffstat (limited to 'proprietary/bundles/org.eclipse.upr.platform.java.ui')
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/.classpath7
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/.gitignore1
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/.project28
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/META-INF/MANIFEST.MF22
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/about.html22
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/build.properties18
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/plugin.properties17
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/plugin.xml37
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/pom.xml27
-rw-r--r--proprietary/bundles/org.eclipse.upr.platform.java.ui/src/org/eclipse/upr/platform/java/ui/RunHandler.java153
11 files changed, 339 insertions, 0 deletions
diff --git a/proprietary/bundles/org.eclipse.upr.platform.java.ui/.classpath b/proprietary/bundles/org.eclipse.upr.platform.java.ui/.classpath
new file mode 100644
index 0000000..098194c
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/.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.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/proprietary/bundles/org.eclipse.upr.platform.java.ui/.gitignore b/proprietary/bundles/org.eclipse.upr.platform.java.ui/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/proprietary/bundles/org.eclipse.upr.platform.java.ui/.project b/proprietary/bundles/org.eclipse.upr.platform.java.ui/.project
new file mode 100644
index 0000000..28f81c0
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.upr.platform.java.ui</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/proprietary/bundles/org.eclipse.upr.platform.java.ui/.settings/org.eclipse.jdt.core.prefs b/proprietary/bundles/org.eclipse.upr.platform.java.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f42de36
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/.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/proprietary/bundles/org.eclipse.upr.platform.java.ui/META-INF/MANIFEST.MF b/proprietary/bundles/org.eclipse.upr.platform.java.ui/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a8f74f2
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.upr.platform.java.ui;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7,
+ JavaSE-1.8
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.ui.console,
+ org.eclipse.upr.platform.java.cm2up;bundle-version="0.9.0",
+ org.eclipse.upr.platform.java.code2cm;bundle-version="0.9.0",
+ org.eclipse.jdt.core;bundle-version="3.10.0",
+ org.eclipse.emf.ecore;bundle-version="2.10.2",
+ org.eclipse.modisco.infra.discovery.core;bundle-version="0.12.2",
+ org.eclipse.upr.platform.java.configuration;bundle-version="0.9.0",
+ org.eclipse.m2m.atl.engine.emfvm;bundle-version="3.6.0"
+Bundle-ActivationPolicy: lazy
diff --git a/proprietary/bundles/org.eclipse.upr.platform.java.ui/about.html b/proprietary/bundles/org.eclipse.upr.platform.java.ui/about.html
new file mode 100644
index 0000000..6f6b96c
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/about.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>February 24, 2005</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/proprietary/bundles/org.eclipse.upr.platform.java.ui/build.properties b/proprietary/bundles/org.eclipse.upr.platform.java.ui/build.properties
new file mode 100644
index 0000000..67491c2
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/build.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# Copyright (c) 2015 TU Wien.
+# 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:
+# Alexander Bergmayr (TU Wien) - initial API and implementation
+#
+# Initially developed in the context of ARTIST EU project www.artist-project.eu
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties
diff --git a/proprietary/bundles/org.eclipse.upr.platform.java.ui/plugin.properties b/proprietary/bundles/org.eclipse.upr.platform.java.ui/plugin.properties
new file mode 100644
index 0000000..cb42d9c
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/plugin.properties
@@ -0,0 +1,17 @@
+# <copyright>
+# Copyright (c) 2015 TU Wien.
+# 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:
+# Alexander Bergmayr (TU Wien) - initial API and implementation
+#
+# Initially developed in the context of ARTIST EU project www.artist-project.eu
+# </copyright>
+#
+# $Id$
+
+pluginName = Java Code Model to UML Profile UI (Incubation)
+providerName = Eclipse UPR
diff --git a/proprietary/bundles/org.eclipse.upr.platform.java.ui/plugin.xml b/proprietary/bundles/org.eclipse.upr.platform.java.ui/plugin.xml
new file mode 100644
index 0000000..e9654ce
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/plugin.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.ui.category.project"
+ defaultHandler="org.eclipse.upr.platform.java.ui.RunHandler"
+ id="org.eclipse.upr.platform.java.ui.command.run"
+ name="Run Jump">
+ </command>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.jdt.ui.PackageExplorer">
+ <command
+ commandId="org.eclipse.upr.platform.java.ui.command.run"
+ label="Run Jump">
+ <visibleWhen checkEnabled="false">
+ <with
+ variable="selection">
+ <iterate
+ ifEmpty="false">
+ <instanceof
+ value="org.eclipse.jdt.core.IJavaProject">
+ </instanceof>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+</plugin>
diff --git a/proprietary/bundles/org.eclipse.upr.platform.java.ui/pom.xml b/proprietary/bundles/org.eclipse.upr.platform.java.ui/pom.xml
new file mode 100644
index 0000000..76d75ee
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/pom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 TU Wien.
+ 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:
+ Alexander Bergmayr (TU Wien) - initial API and implementation
+
+ Initially developed in the context of ARTIST EU project www.artist-project.eu
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.upr.jump</groupId>
+ <artifactId>org.eclipse.upr.platform.jump.build</artifactId>
+ <relativePath>../../build/org.eclipse.upr.platform.jump.build/pom.xml</relativePath>
+ <version>0.9.0</version>
+ </parent>
+ <groupId>org.eclipse.upr.jump</groupId>
+ <artifactId>org.eclipse.upr.platform.java.ui</artifactId>
+ <version>0.9.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/proprietary/bundles/org.eclipse.upr.platform.java.ui/src/org/eclipse/upr/platform/java/ui/RunHandler.java b/proprietary/bundles/org.eclipse.upr.platform.java.ui/src/org/eclipse/upr/platform/java/ui/RunHandler.java
new file mode 100644
index 0000000..594d7ce
--- /dev/null
+++ b/proprietary/bundles/org.eclipse.upr.platform.java.ui/src/org/eclipse/upr/platform/java/ui/RunHandler.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Vienna University of Technology.
+ * 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:
+ * Alexander Bergmayr (Vienna University of Technology) - initial API and implementation
+ *
+ * Initially developed in the context of ARTIST EU project www.artist-project.eu
+ *******************************************************************************/
+
+package org.eclipse.upr.platform.java.ui;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.IConsoleView;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.upr.platform.java.cm2up.ResourceBasedCodeModel2UMLProfile;
+import org.eclipse.upr.platform.java.cm2up.util.CodeModel2UMLProfileUtil;
+import org.eclipse.upr.platform.java.code2cm.JavaDiscoverer;
+import org.eclipse.upr.platform.java.jumpcfg.util.JConfigurationUtil;
+
+public class RunHandler extends AbstractHandler {
+
+ private final static String JUMP_CONSOLE = "Jump";
+ private final static String TARGET_VIEW_ID = "org.eclipse.jdt.ui.PackageExplorer";
+
+ private MessageConsole console;
+
+ public RunHandler() {
+ try {
+ this.console = this.findConsole(RunHandler.JUMP_CONSOLE);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
+ * ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) {
+ try {
+ this.showConsole(event);
+ this.clearConsole();
+
+ IJavaProject project = this.getSelectedProject(event);
+
+ MessageConsoleStream outStream = console.newMessageStream();
+ outStream.println("Generating UML Profile for "
+ + project.getElementName());
+
+ Resource codeModel = JavaDiscoverer.INSTANCE.runDiscovery(project);
+
+ ResourceBasedCodeModel2UMLProfile runner = new ResourceBasedCodeModel2UMLProfile();
+ runner.setUmlProfilePath(project
+ .getPath()
+ .append(project.getElementName().concat(
+ CodeModel2UMLProfileUtil.UML_PROFILE_PATH_SEGMENT)).toString());
+ runner.setTraceModelPath(project
+ .getPath()
+ .append(project.getElementName().concat(
+ CodeModel2UMLProfileUtil.TRACE_PATH_SEGMENT)).toString());
+ runner.loadModels(codeModel,
+ JConfigurationUtil.getDefaultConfiguration(),
+ CodeModel2UMLProfileUtil.JP_Model_Path,
+ CodeModel2UMLProfileUtil.JPT_Model_Path,
+ CodeModel2UMLProfileUtil.MC_Model_Path,
+ CodeModel2UMLProfileUtil.UPT_Model_Path,
+ CodeModel2UMLProfileUtil.EPT_Model_Path);
+ runner.doCodeModel2UMLProfile(new NullProgressMonitor());
+ runner.saveUMLProfileModel();
+
+ outStream.println("Done ;)");
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ return null;
+ }
+
+ private IJavaProject getSelectedProject(ExecutionEvent event)
+ throws ExecutionException, CoreException {
+ IWorkbenchWindow window = HandlerUtil
+ .getActiveWorkbenchWindowChecked(event);
+ ISelectionService service = window.getSelectionService();
+ IStructuredSelection structureSelection = (IStructuredSelection) service
+ .getSelection(RunHandler.TARGET_VIEW_ID);
+
+ // check if it is a IJavaProject and return it
+ Object selection = structureSelection.getFirstElement();
+ if (selection instanceof IJavaProject) {
+ return (IJavaProject) selection;
+ }
+ throw new RuntimeException("No project selected");
+ }
+
+ private MessageConsole findConsole(String name) {
+ ConsolePlugin plugin = ConsolePlugin.getDefault();
+ IConsoleManager conMan = plugin.getConsoleManager();
+
+ // search existing consoles
+ IConsole[] existing = conMan.getConsoles();
+ for (int i = 0; i < existing.length; i++) {
+ if (name.equals(existing[i].getName())) {
+ return (MessageConsole) existing[i];
+ }
+ }
+
+ // no console found, so create a new one
+ MessageConsole myConsole = new MessageConsole(name, null);
+ conMan.addConsoles(new IConsole[] { myConsole });
+ conMan.showConsoleView(myConsole);
+ return myConsole;
+ }
+
+ private void clearConsole() {
+ this.console.clearConsole();
+ }
+
+ private void showConsole(ExecutionEvent event) throws PartInitException,
+ ExecutionException {
+ IWorkbenchWindow window = HandlerUtil
+ .getActiveWorkbenchWindowChecked(event);
+ IWorkbenchPage page = window.getActivePage();
+ String id = IConsoleConstants.ID_CONSOLE_VIEW;
+ IConsoleView view = (IConsoleView) page.showView(id);
+ view.display(this.console);
+ }
+
+}

Back to the top