Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2012-08-14 10:56:54 +0000
committerLars Vogel2012-08-14 10:56:54 +0000
commit673ee15d64dbefff3a437efed5a323082f90fe9d (patch)
treeb81bd2cf4b8423b0d58f2f432c1f2c04550b62c0
parent9322664d0f0a292f2fe0df0c62445aef74d14195 (diff)
downloadorg.eclipse.e4.tools-673ee15d64dbefff3a437efed5a323082f90fe9d.tar.gz
org.eclipse.e4.tools-673ee15d64dbefff3a437efed5a323082f90fe9d.tar.xz
org.eclipse.e4.tools-673ee15d64dbefff3a437efed5a323082f90fe9d.zip
Bug 387017 - [Tooling] Eclipse 4 application wizard should not display
the applicationXMI property Removes the applicationXMI property as we offer a good default behavior.
-rw-r--r--bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java147
-rw-r--r--bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java3
2 files changed, 69 insertions, 81 deletions
diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java
index f1288fc5..d5df9c94 100644
--- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java
+++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/E4NewProjectWizard.java
@@ -93,6 +93,7 @@ import org.osgi.framework.Version;
*/
public class E4NewProjectWizard extends NewPluginProjectWizard {
+ private static final String APPLICATION_MODEL = "Application.e4xmi";
private PluginFieldData fPluginData;
private NewApplicationWizardPage fApplicationPage;
private IProjectProvider fProjectProvider;
@@ -238,12 +239,6 @@ public class E4NewProjectWizard extends NewPluginProjectWizard {
e.addToken(cssEntry);
}
- String xmiPath = map
- .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY);
- if( xmiPath != null ) {
- e.addToken(xmiPath);
- }
-
model.save();
}
}
@@ -269,13 +264,6 @@ public class E4NewProjectWizard extends NewPluginProjectWizard {
String applicationName = map
.get(NewApplicationWizardPage.APPLICATION);
- String xmiPath = map
- .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY);
- if (xmiPath != null) {
- xmiPath = productName + "/" + xmiPath;
- map.put(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY,
- xmiPath);
- }
String cssValue = map
.get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY);
if (cssValue != null) {
@@ -348,8 +336,6 @@ public class E4NewProjectWizard extends NewPluginProjectWizard {
// If the project has invalid characters, the plug-in name would replace them with underscores, product name does the same
String pluginName = map.get(NewApplicationWizardPage.PRODUCT_NAME);
- String xmiPath = map
- .get(NewApplicationWizardPage.APPLICATION_XMI_PROPERTY);
// If there's no Activator created we create default package
if (!fPluginData.doGenerateClass()) {
@@ -379,7 +365,73 @@ public class E4NewProjectWizard extends NewPluginProjectWizard {
e1.printStackTrace();
}
- if (xmiPath != null && xmiPath.trim().length() > 0) {
+ createApplicationModel(project, pluginName, fragment);
+
+ String cssPath = map
+ .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY);
+ if (cssPath != null && cssPath.trim().length() > 0) {
+ IFile file = project.getFile(cssPath);
+
+ try {
+ prepareFolder(file.getParent(), monitor);
+
+ URL corePath = ResourceLocator
+ .getProjectTemplateFiles("css/default.css");
+ file.create(corePath.openStream(), true, monitor);
+ } catch (Exception e) {
+ PDEPlugin.logException(e);
+ }
+ }
+
+ // IFolder folder = project.getFolder("icons");
+ // try {
+ // folder.create(true, true, monitor);
+ // Bundle bundle = Platform
+ // .getBundle("org.eclipse.e4.tools.ui.designer");
+ //
+ // for (String fileName : new String[] { "sample.gif", "save_edit.gif"
+ // }) {
+ // URL sampleUrl = bundle.getEntry("resources/icons/" + fileName);
+ // sampleUrl = FileLocator.resolve(sampleUrl);
+ // InputStream inputStream = sampleUrl.openStream();
+ // IFile file = folder.getFile(fileName);
+ // file.create(inputStream, true, monitor);
+ // }
+ // } catch (Exception e) {
+ // PDEPlugin.logException(e);
+ // }
+
+ String template_id = "common";
+ Set<String> binaryExtentions = new HashSet<String>();
+ binaryExtentions.add(".gif");
+ binaryExtentions.add(".png");
+
+ Map<String, String> keys = new HashMap<String, String>();
+ keys.put("projectName", pluginName);
+ keys.put("packageName", fragment.getElementName() + ".handlers");
+
+ try {
+ URL corePath = ResourceLocator.getProjectTemplateFiles(template_id);
+ IRunnableWithProgress op = new TemplateOperation(corePath, project,
+ keys, binaryExtentions);
+ getContainer().run(false, true, op);
+ } catch (Exception e) {
+ PDEPlugin.logException(e);
+ }
+
+ try {
+ URL corePath = ResourceLocator.getProjectTemplateFiles("src");
+ IRunnableWithProgress op = new TemplateOperation(corePath,
+ (IContainer) fragment.getResource(), keys, binaryExtentions);
+ getContainer().run(false, true, op);
+ } catch (Exception e) {
+ PDEPlugin.logException(e);
+ }
+ }
+
+ private void createApplicationModel(IProject project, String pluginName,
+ IPackageFragment fragment) {
+ if (APPLICATION_MODEL != null && APPLICATION_MODEL.trim().length() > 0) {
// Create a resource set
//
ResourceSet resourceSet = new ResourceSetImpl();
@@ -387,7 +439,7 @@ public class E4NewProjectWizard extends NewPluginProjectWizard {
// Get the URI of the model file.
//
URI fileURI = URI.createPlatformResourceURI(project.getName() + "/"
- + xmiPath, true);
+ + APPLICATION_MODEL, true);
// Create a resource for this file.
//
@@ -579,67 +631,6 @@ public class E4NewProjectWizard extends NewPluginProjectWizard {
PDEPlugin.logException(e);
}
}
-
- String cssPath = map
- .get(NewApplicationWizardPage.APPLICATION_CSS_PROPERTY);
- if (cssPath != null && cssPath.trim().length() > 0) {
- IFile file = project.getFile(cssPath);
-
- try {
- prepareFolder(file.getParent(), monitor);
-
- URL corePath = ResourceLocator
- .getProjectTemplateFiles("css/default.css");
- file.create(corePath.openStream(), true, monitor);
- } catch (Exception e) {
- PDEPlugin.logException(e);
- }
- }
-
- // IFolder folder = project.getFolder("icons");
- // try {
- // folder.create(true, true, monitor);
- // Bundle bundle = Platform
- // .getBundle("org.eclipse.e4.tools.ui.designer");
- //
- // for (String fileName : new String[] { "sample.gif", "save_edit.gif"
- // }) {
- // URL sampleUrl = bundle.getEntry("resources/icons/" + fileName);
- // sampleUrl = FileLocator.resolve(sampleUrl);
- // InputStream inputStream = sampleUrl.openStream();
- // IFile file = folder.getFile(fileName);
- // file.create(inputStream, true, monitor);
- // }
- // } catch (Exception e) {
- // PDEPlugin.logException(e);
- // }
-
- String template_id = "common";
- Set<String> binaryExtentions = new HashSet<String>();
- binaryExtentions.add(".gif");
- binaryExtentions.add(".png");
-
- Map<String, String> keys = new HashMap<String, String>();
- keys.put("projectName", pluginName);
- keys.put("packageName", fragment.getElementName() + ".handlers");
-
- try {
- URL corePath = ResourceLocator.getProjectTemplateFiles(template_id);
- IRunnableWithProgress op = new TemplateOperation(corePath, project,
- keys, binaryExtentions);
- getContainer().run(false, true, op);
- } catch (Exception e) {
- PDEPlugin.logException(e);
- }
-
- try {
- URL corePath = ResourceLocator.getProjectTemplateFiles("src");
- IRunnableWithProgress op = new TemplateOperation(corePath,
- (IContainer) fragment.getResource(), keys, binaryExtentions);
- getContainer().run(false, true, op);
- } catch (Exception e) {
- PDEPlugin.logException(e);
- }
}
private MCommand createCommand(String commandId, String name,
diff --git a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java
index 0fa47ba5..886986f7 100644
--- a/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java
+++ b/bundles/org.eclipse.e4.tools/src/org/eclipse/e4/internal/tools/wizards/project/NewApplicationWizardPage.java
@@ -48,7 +48,6 @@ import org.eclipse.ui.branding.IProductConstants;
*/
public class NewApplicationWizardPage extends WizardPage {
public static final String E4_APPLICATION = "org.eclipse.e4.ui.workbench.swt.E4Application";
- public static final String APPLICATION_XMI_PROPERTY = "applicationXMI";
public static final String APPLICATION_CSS_PROPERTY = "applicationCSS";
public static final String PRODUCT_NAME = "productName";
public static final String APPLICATION = "application";
@@ -367,8 +366,6 @@ public class NewApplicationWizardPage extends WizardPage {
new PropertyData(IProductConstants.APP_NAME, "Application Name:",
projectProvider.getProjectName(), String.class,
true),
- new PropertyData(APPLICATION_XMI_PROPERTY, "Application UI:",
- "Application.e4xmi", String.class, true),
new PropertyData(APPLICATION_CSS_PROPERTY, "CSS Style:",
"css/default.css", String.class, true),
new PropertyData(IProductConstants.ABOUT_TEXT, "About Message:", "",

Back to the top