Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2015-05-29 12:26:45 +0000
committerJuergen Haug2015-05-29 12:35:17 +0000
commita536a5baffe631964f650c0f625d7beb20ccc62e (patch)
tree4ace16e21de2ff24915e67465d9206a26a8ba24e
parent3957be7c99f1c9c77ea615d308ed0bc5bc852650 (diff)
downloadorg.eclipse.etrice-a536a5baffe631964f650c0f625d7beb20ccc62e.tar.gz
org.eclipse.etrice-a536a5baffe631964f650c0f625d7beb20ccc62e.tar.xz
org.eclipse.etrice-a536a5baffe631964f650c0f625d7beb20ccc62e.zip
[wizard] auto runtime/modellib import
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/.classpath1
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/.gitignore1
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/plugin.xml48
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/src/org/eclipse/etrice/ui/runtime/NonDeletingWizardInstaller.java85
5 files changed, 134 insertions, 5 deletions
diff --git a/plugins/org.eclipse.etrice.ui.runtime/.classpath b/plugins/org.eclipse.etrice.ui.runtime/.classpath
index bc74aabe3..121e527a9 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/.classpath
+++ b/plugins/org.eclipse.etrice.ui.runtime/.classpath
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
diff --git a/plugins/org.eclipse.etrice.ui.runtime/.gitignore b/plugins/org.eclipse.etrice.ui.runtime/.gitignore
new file mode 100644
index 000000000..ae3c17260
--- /dev/null
+++ b/plugins/org.eclipse.etrice.ui.runtime/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/plugins/org.eclipse.etrice.ui.runtime/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.ui.runtime/META-INF/MANIFEST.MF
index 0640eeb74..9bfa2f878 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.ui.runtime/META-INF/MANIFEST.MF
@@ -6,6 +6,8 @@ Bundle-Version: 0.5.0.qualifier
Bundle-Vendor: Eclipse eTrice (Incubation)
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.eclipse.emf.common.ui;bundle-version="2.7.0"
+ org.eclipse.emf.common.ui,
+ org.eclipse.emf.common,
+ org.eclipse.core.resources
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.etrice.ui.runtime/plugin.xml b/plugins/org.eclipse.etrice.ui.runtime/plugin.xml
index ad8745893..79afdc328 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/plugin.xml
+++ b/plugins/org.eclipse.etrice.ui.runtime/plugin.xml
@@ -29,7 +29,7 @@
<extension point="org.eclipse.ui.newWizards">
<wizard id="org.eclipse.etrice.ui.runtime.NewCModelLibWizard"
name="eTrice C ModelLib"
- class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard"
+ class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller"
category="org.eclipse.etrice.core.ui.wizardCategory"
icon="icons/genproject.gif"
project="true">
@@ -39,6 +39,11 @@
<extension point="org.eclipse.emf.common.ui.examples">
<example wizardID="org.eclipse.etrice.ui.runtime.NewCModelLibWizard" pageImage="icons/genproject.gif">
<projectDescriptor name="org.eclipse.etrice.modellib.c" contentURI="contents/org.eclipse.etrice.modellib.c.zip" description="eTrice ModelLib for C"/>
+ <projectDescriptor
+ contentURI="contents/org.eclipse.etrice.runtime.c.zip"
+ description="eTrice Runtime for C"
+ name="org.eclipse.etrice.runtime.c">
+ </projectDescriptor>
</example>
</extension>
@@ -97,7 +102,7 @@
<extension point="org.eclipse.ui.newWizards">
<wizard id="org.eclipse.etrice.ui.runtime.NewJavaModelLibWizard"
name="eTrice Java ModelLib"
- class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard"
+ class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller"
category="org.eclipse.etrice.core.ui.wizardCategory"
icon="icons/genproject.gif"
project="true">
@@ -107,6 +112,11 @@
<extension point="org.eclipse.emf.common.ui.examples">
<example wizardID="org.eclipse.etrice.ui.runtime.NewJavaModelLibWizard" pageImage="icons/genproject.gif">
<projectDescriptor name="org.eclipse.etrice.modellib.java" contentURI="contents/org.eclipse.etrice.modellib.java.zip" description="eTrice ModelLib for Java"/>
+ <projectDescriptor
+ contentURI="contents/org.eclipse.etrice.runtime.java.zip"
+ description="eTrice Runtime for Java"
+ name="org.eclipse.etrice.runtime.java">
+ </projectDescriptor>
</example>
</extension>
@@ -120,7 +130,7 @@
<extension point="org.eclipse.ui.newWizards">
<wizard id="org.eclipse.etrice.ui.runtime.NewJavaTutorialWizard"
name="eTrice Java Tutorials"
- class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard"
+ class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller"
category="org.eclipse.etrice.core.ui.exampleWizardCategory"
icon="icons/genproject.gif"
project="true">
@@ -130,6 +140,16 @@
<extension point="org.eclipse.emf.common.ui.examples">
<example wizardID="org.eclipse.etrice.ui.runtime.NewJavaTutorialWizard" pageImage="icons/genproject.gif">
<projectDescriptor name="org.eclipse.etrice.tutorials.java" contentURI="contents/org.eclipse.etrice.tutorials.java.zip" description="eTrice Java Tutorials"/>
+ <projectDescriptor
+ contentURI="contents/org.eclipse.etrice.modellib.java.zip"
+ description="eTrice ModelLib for Java"
+ name="org.eclipse.etrice.modellib.java">
+ </projectDescriptor>
+ <projectDescriptor
+ contentURI="contents/org.eclipse.etrice.runtime.java.zip"
+ description="eTrice Runtime for Java"
+ name="org.eclipse.etrice.runtime.java">
+ </projectDescriptor>
</example>
</extension>
@@ -137,7 +157,7 @@
<extension point="org.eclipse.ui.newWizards">
<wizard id="org.eclipse.etrice.ui.runtime.NewCTutorialWizard"
name="eTrice C Tutorials"
- class="org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard"
+ class="org.eclipse.etrice.ui.runtime.NonDeletingWizardInstaller"
category="org.eclipse.etrice.core.ui.exampleWizardCategory"
icon="icons/genproject.gif"
project="true">
@@ -147,6 +167,16 @@
<extension point="org.eclipse.emf.common.ui.examples">
<example wizardID="org.eclipse.etrice.ui.runtime.NewCTutorialWizard" pageImage="icons/genproject.gif">
<projectDescriptor name="org.eclipse.etrice.tutorials.c" contentURI="contents/org.eclipse.etrice.tutorials.c.zip" description="eTrice C Tutorials"/>
+ <projectDescriptor
+ contentURI="contents/org.eclipse.etrice.runtime.c.zip"
+ description="eTrice Runtime for C"
+ name="org.eclipse.etrice.runtime.c">
+ </projectDescriptor>
+ <projectDescriptor
+ contentURI="contents/org.eclipse.etrice.modellib.c.zip"
+ description="eTrice ModelLib for C"
+ name="org.eclipse.etrice.modellib.c">
+ </projectDescriptor>
</example>
</extension>
@@ -164,6 +194,16 @@
<extension point="org.eclipse.emf.common.ui.examples">
<example wizardID="org.eclipse.etrice.ui.runtime.NewTrafficlightlWizard" pageImage="icons/genproject.gif">
<projectDescriptor name="org.eclipse.etrice.tutorials.simulators.trafficlight" contentURI="contents/org.eclipse.etrice.tutorials.simulators.trafficlight.zip" description="eTrice Traffic Light GUI"/>
+ <projectDescriptor
+ contentURI="contents/org.eclipse.etrice.modellib.java.zip"
+ description="eTrice ModelLib for Java"
+ name="org.eclipse.etrice.modellib.java">
+ </projectDescriptor>
+ <projectDescriptor
+ contentURI="contents/org.eclipse.etrice.runtime.java.zip"
+ description="eTrice Runtime for Java"
+ name="org.eclipse.etrice.runtime.java">
+ </projectDescriptor>
</example>
</extension>
diff --git a/plugins/org.eclipse.etrice.ui.runtime/src/org/eclipse/etrice/ui/runtime/NonDeletingWizardInstaller.java b/plugins/org.eclipse.etrice.ui.runtime/src/org/eclipse/etrice/ui/runtime/NonDeletingWizardInstaller.java
new file mode 100644
index 000000000..8f7209dff
--- /dev/null
+++ b/plugins/org.eclipse.etrice.ui.runtime/src/org/eclipse/etrice/ui/runtime/NonDeletingWizardInstaller.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2015 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.ui.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.ui.CommonUIPlugin;
+import org.eclipse.emf.common.ui.wizard.ExampleInstallerWizard;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+public class NonDeletingWizardInstaller extends ExampleInstallerWizard {
+
+ protected boolean isPerformingFinish = false;
+
+ @Override
+ protected Diagnostic deleteExistingProjects(IProgressMonitor monitor) {
+ return Diagnostic.OK_INSTANCE;
+ }
+
+ @Override
+ public boolean performFinish() {
+ isPerformingFinish = true;
+ return super.performFinish();
+ }
+
+ @Override
+ protected List<ProjectDescriptor> getProjectDescriptors() {
+ if(!isPerformingFinish)
+ return super.getProjectDescriptors();
+
+ List<ProjectDescriptor> newProjects = new ArrayList<ProjectDescriptor>();
+ for(ProjectDescriptor desc : super.getProjectDescriptors())
+ if(!desc.getProject().exists())
+ newProjects.add(desc);
+
+ return newProjects;
+ }
+
+ @Override
+ public void addPages() {
+ projectPage = new CustomProjectPage("projectPage", CommonUIPlugin.INSTANCE.getString("_UI_ProjectPage_title"),
+ null);
+ projectPage.setDescription(CommonUIPlugin.INSTANCE.getString("_UI_ProjectPage_description"));
+ addPage(projectPage);
+ }
+
+ class CustomProjectPage extends ProjectPage {
+
+ public CustomProjectPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ @Override
+ protected void itemSelected() {
+ renameButton.setEnabled(false);
+
+ ProjectDescriptor projectDescriptor = getSelectedProjectDescriptor();
+ if (projectDescriptor != null) {
+ boolean exists = projectDescriptor.getProject().exists();
+ String description = projectDescriptor.getDescription() != null ? projectDescriptor.getDescription()
+ : "";
+ if (exists) {
+ String renameMessage = "* A project with this name already exists in the workspace and will not be added.";
+ description = description == "" ? renameMessage : CommonUIPlugin.INSTANCE.getString(
+ "_UI_ProjectDescriptionAndRename_message", new String[] { description, renameMessage });
+ }
+ descriptionText.setText(description);
+ }
+ }
+
+ }
+}

Back to the top