summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorszarnekow2009-04-17 11:23:10 (EDT)
committer sefftinge2009-04-17 11:23:10 (EDT)
commitc9cb331fadea61eea80a5353f814c823a2634020 (patch)
tree9ea0f3dea0dace4b2d502a61a8b3f06424b167f7
parenta41f9e14e747efd1fa77441262f3bf78da43f97c (diff)
downloadorg.eclipse.xtext-c9cb331fadea61eea80a5353f814c823a2634020.zip
org.eclipse.xtext-c9cb331fadea61eea80a5353f814c823a2634020.tar.gz
org.eclipse.xtext-c9cb331fadea61eea80a5353f814c823a2634020.tar.bz2
Patch applied (https://bugs.eclipse.org/bugs/show_bug.cgi?id=272261)
-rw-r--r--plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/NewProjectWizard.xpt2
-rw-r--r--plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectCreator.xpt12
-rw-r--r--plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectInfo.xpt2
-rw-r--r--plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/SimpleProjectWizardFragment.java37
4 files changed, 32 insertions, 21 deletions
diff --git a/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/NewProjectWizard.xpt b/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/NewProjectWizard.xpt
index 5c53a89..90ab1a3 100644
--- a/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/NewProjectWizard.xpt
+++ b/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/NewProjectWizard.xpt
@@ -16,7 +16,7 @@
«EXTENSION org::eclipse::xtext::ui::generator::projectWizard::Extensions»
«DEFINE root FOR Grammar»
-«FILE projectWizardClassName().asPath()+".java" UI_SRC_GEN-»
+«FILE projectWizardClassName().asPath()+".java" SRC_GEN_UI-»
package «projectWizardClassName().toJavaPackage()»;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
diff --git a/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectCreator.xpt b/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectCreator.xpt
index bfe0962..c992d01 100644
--- a/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectCreator.xpt
+++ b/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectCreator.xpt
@@ -16,8 +16,8 @@
«EXTENSION org::eclipse::xtext::generator::Naming»
«DEFINE root(String generatorProjectName) FOR Grammar»
-«FILE projectCreatorClassName().asPath()+".java" UI_SRC_GEN-»
-package «projectCreatorClassName().toJavaPackage()».wizard;
+«FILE projectCreatorClassName().asPath()+".java" SRC_GEN_UI-»
+package «projectCreatorClassName().toJavaPackage()»;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
@@ -43,8 +43,9 @@ public class «projectCreatorClassName().toSimpleName()» extends DefaultProjectCr
private final List<String> SRC_FOLDER_LIST = Collections
.unmodifiableList(Arrays.asList(SRC_ROOT, SRC_GEN_ROOT));
- protected «projectInfoClassName()» getProjectInfo() {
- return («projectCreatorClassName()») getProjectInfo();
+ @Override
+ protected «projectInfoClassName().toSimpleName()» getProjectInfo() {
+ return («projectInfoClassName().toSimpleName()») super.getProjectInfo();
}
@Override
@@ -68,7 +69,8 @@ public class «projectCreatorClassName().toSimpleName()» extends DefaultProjectCr
"org.eclipse.emf.codegen.ecore;resolution:=optional",
"org.eclipse.xtend.util.stdlib",
DSL_GENERATOR_PROJECT_NAME)), null, null, null,
- monitor, null);
+ monitor, null,
+ new String[] {"org.eclipse.jdt.core.javanature", "org.eclipse.pde.PluginNature"});
if (dslProject == null) {
return;
diff --git a/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectInfo.xpt b/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectInfo.xpt
index c22915a..09cd298 100644
--- a/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectInfo.xpt
+++ b/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/ProjectInfo.xpt
@@ -15,7 +15,7 @@
«EXTENSION org::eclipse::xtext::generator::Naming»
«DEFINE root FOR Grammar»
-«FILE projectInfoClassName().asPath()+".java" UI_SRC_GEN-»
+«FILE projectInfoClassName().asPath()+".java" SRC_GEN_UI-»
package «projectInfoClassName().toJavaPackage()»;
import org.eclipse.xtext.ui.core.wizard.DefaultProjectInfo;
diff --git a/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/SimpleProjectWizardFragment.java b/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/SimpleProjectWizardFragment.java
index 34c51c9..cb2e399 100644
--- a/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/SimpleProjectWizardFragment.java
+++ b/plugins/org.eclipse.xtext.ui.generator/src/org/eclipse/xtext/ui/generator/projectWizard/SimpleProjectWizardFragment.java
@@ -10,9 +10,14 @@ package org.eclipse.xtext.ui.generator.projectWizard;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import org.eclipse.xtext.Grammar;
+import org.eclipse.xtext.GrammarUtil;
import org.eclipse.xtext.generator.AbstractGeneratorFragment;
+import org.eclipse.xtext.generator.BindFactory;
+import org.eclipse.xtext.generator.BindKey;
+import org.eclipse.xtext.generator.BindValue;
/**
* @author Sven Efftinge - Initial contribution and API
@@ -21,15 +26,23 @@ public class SimpleProjectWizardFragment extends AbstractGeneratorFragment {
@Override
public String[] getRequiredBundlesUi(Grammar grammar) {
- return new String[] {
- "org.eclipse.ui",
- "org.eclipse.core.runtime",
+ return new String[] {
+ "org.eclipse.ui",
+ "org.eclipse.core.runtime",
"org.eclipse.core.resources",
- "org.eclipse.ui.ide"
- };
+ "org.eclipse.ui.ide"
+ };
}
@Override
+ public Map<BindKey, BindValue> getGuiceBindingsUi(Grammar grammar) {
+ return new BindFactory()
+ .addTypeToType("org.eclipse.xtext.ui.core.wizard.IProjectCreator",
+ GrammarUtil.getNamespace(grammar)+".ui.wizard." + GrammarUtil.getName(grammar) + "ProjectCreator")
+ .getBindings();
+ }
+
+ @Override
protected List<Object> getParameters(Grammar grammar) {
return Collections.singletonList((Object) getGeneratorProjectName(grammar));
}
@@ -38,20 +51,16 @@ public class SimpleProjectWizardFragment extends AbstractGeneratorFragment {
if (generatorProjectName != null) {
return generatorProjectName;
}
- else {
- throw new IllegalStateException(getClass().getName()
- + " : The property 'generatorProjectName' is mandatory but has not been configured.");
- }
+ throw new IllegalStateException(getClass().getName()
+ + " : The property 'generatorProjectName' is mandatory but has not been configured.");
}
private String generatorProjectName;
- public void setGeneratorProjectName(String generatorProjetName) {
- if ("".equals(generatorProjectName.trim())) {
+ public void setGeneratorProjectName(String generatorProjectName) {
+ if (generatorProjectName == null || "".equals(generatorProjectName.trim())) {
return;
}
- else {
- this.generatorProjectName = generatorProjetName;
- }
+ this.generatorProjectName = generatorProjectName.trim();
}
}