Author: fbricon
Date: 2012-02-16 19:16:47 -0500 (Thu, 16 Feb 2012)
New Revision: 38850
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/AbstractJBossCentralProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewGwtProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewHtml5ProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeEarProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeWarProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewRichfacesProjectWizard.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewSpringMvcProjectWizard.java
Modified:
trunk/central/plugins/org.jboss.tools.central/plugin.xml
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard2.java
Log:
JBIDE-10212 : create wizards for the projects examples in JBoss Central - WIP
Modified: trunk/central/plugins/org.jboss.tools.central/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/plugin.xml 2012-02-16 22:43:35 UTC (rev
38849)
+++ trunk/central/plugins/org.jboss.tools.central/plugin.xml 2012-02-17 00:16:47 UTC (rev
38850)
@@ -194,4 +194,78 @@
icon="icons/examples_wiz.gif">
</image>
</extension>
+
+ <!-- new wizards -->
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.jboss.tools.central.ui.wizard.category"
+ name="JBoss Central">
+ </category>
+ <wizard
+ category="org.jboss.tools.central.ui.wizard.category"
+ id="org.jboss.tools.central.wizards.NewJavaeeWarProjectWizard"
+ class="org.jboss.tools.central.wizards.NewJavaeeWarProjectWizard"
+ icon="icons/newwebprj_wiz.gif"
+ name="Java EE Web Project"
+ project="true">
+ </wizard>
+ <wizard
+ category="org.jboss.tools.central.ui.wizard.category"
+ id="org.jboss.tools.central.wizards.NewJavaeeEarProjectWizard"
+ class="org.jboss.tools.central.wizards.NewJavaeeEarProjectWizard"
+ icon="icons/ear-wiz-icon.gif"
+ name="Java EE Project"
+ project="true">
+ </wizard>
+ <wizard
+ category="org.jboss.tools.central.ui.wizard.category"
+ id="org.jboss.tools.central.wizards.NewHtml5ProjectWizard"
+ class="org.jboss.tools.central.wizards.NewHtml5ProjectWizard"
+ icon="icons/html5.png"
+ name="HTML5 Project"
+ project="true">
+ </wizard>
+ <wizard
+ category="org.jboss.tools.central.ui.wizard.category"
+ id="org.jboss.tools.central.wizards.NewRichfacesProjectWizard"
+ class="org.jboss.tools.central.wizards.NewRichfacesProjectWizard"
+ icon="icons/rf_logo.png"
+ name="RichFaces Project"
+ project="true">
+ </wizard>
+ <wizard
+ category="org.jboss.tools.central.ui.wizard.category"
+ id="org.jboss.tools.central.wizards.NewSpringMvcProjectWizard"
+ class="org.jboss.tools.central.wizards.NewSpringMvcProjectWizard"
+ icon="icons/spring_wiz.gif"
+ name="Spring MVC Project"
+ project="true">
+ </wizard>
+ <wizard
+ category="org.jboss.tools.central.ui.wizard.category"
+ id="org.jboss.tools.central.wizards.NewGwtProjectWizard"
+ class="org.jboss.tools.central.wizards.NewGwtProjectWizard"
+ icon="icons/new-gdt-project.png"
+ name="GWT Web Project"
+ project="true">
+ </wizard>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.jboss.tools.common.ui.JBossPerspective">
+ <newWizardShortcut
id="org.jboss.tools.central.wizards.NewJavaeeWarProjectWizard" />
+ <newWizardShortcut
id="org.jboss.tools.central.wizards.NewJavaeeEarProjectWizard"/>
+ <newWizardShortcut
id="org.jboss.tools.central.wizards.NewHtml5ProjectWizard"/>
+ <newWizardShortcut
id="org.jboss.tools.central.wizards.NewRichfacesProjectWizard"/>
+ <newWizardShortcut
id="org.jboss.tools.central.wizards.NewSpringMvcProjectWizard"/>
+ <newWizardShortcut
id="org.jboss.tools.central.wizards.NewGwtProjectWizard"/>
+ </perspectiveExtension>
+ </extension>
+
+
+
+
</plugin>
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java 2012-02-16
22:43:35 UTC (rev 38849)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshTutorialsJob.java 2012-02-17
00:16:47 UTC (rev 38850)
@@ -99,9 +99,9 @@
return tutorialCategories;
}
- public List<ProjectExample> getWizardProjects() {
- return wizardProjects;
- }
+ public List<ProjectExample> getWizardProjects() {
+ return wizardProjects;
+ }
@Override
public boolean belongsTo(Object family) {
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/AbstractJBossCentralProjectWizard.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/AbstractJBossCentralProjectWizard.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/AbstractJBossCentralProjectWizard.java 2012-02-17
00:16:47 UTC (rev 38850)
@@ -0,0 +1,93 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.wizards;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.jboss.tools.central.jobs.RefreshTutorialsJob;
+import org.jboss.tools.project.examples.model.ProjectExample;
+import org.jboss.tools.project.examples.wizard.NewProjectExamplesWizard2;
+
+public abstract class AbstractJBossCentralProjectWizard extends NewProjectExamplesWizard2
{
+
+ private String exampleName = null;
+
+ public AbstractJBossCentralProjectWizard(String exampleName) {
+ super();
+ Assert.isNotNull(exampleName);
+ this.exampleName = exampleName;
+ ProjectExample example = lookupProjectExample();
+ initializeProjectExample(example);
+ }
+
+ protected ProjectExample lookupProjectExample() {
+
+ ProjectExample example = null;
+ RefreshTutorialsJob refreshTutorialsJob = RefreshTutorialsJob.INSTANCE;
+ List<ProjectExample> wizardProjects = refreshTutorialsJob.getWizardProjects();
+ if (wizardProjects == null || wizardProjects.isEmpty()) {
+ //FIXME needs to execute refreshTutorialsJob and wait, gracefully
+ //wizardProjects = refreshTutorialsJob.getWizardProjects();
+ }
+ if (wizardProjects != null) {
+ for (ProjectExample expl : wizardProjects) {
+ if (matches(expl)) {
+ example = expl;
+ break;
+ }
+ }
+ }
+ return example;
+ }
+
+ private boolean matches(ProjectExample expl) {
+ if (expl != null && exampleName.equals(expl.getName())) {
+ if (expl.getSite() != null && "Shared
examples".equals(expl.getSite().getName())){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void addPages() {
+ if (getProjectExample() == null) {
+ //TODO add error page
+ } else {
+ super.addPages();
+ }
+ }
+
+ /*
+ RunnableLookup lookup = new RunnableLookup(exampleName);
+ try {
+ new ProgressMonitorDialog(getShell()).run(true, true, lookup);
+ } catch (Exception e) {
+ JBossCentralActivator.log(e);
+ }
+
+ class RunnableLookup implements IRunnableWithProgress {
+
+ ProjectExample example;
+
+ public void run(IProgressMonitor monitor) {
+ List<ProjectExampleCategory> categories =
ProjectExampleUtil.getProjects(monitor);
+ for (ProjectExample expl : ProjectExampleUtil.getProjectsByTags(categories,
"wizard")) {
+ if (matches(expl)) {
+ example = expl;
+ break;
+ }
+ }
+ }
+ }
+ */
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewGwtProjectWizard.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewGwtProjectWizard.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewGwtProjectWizard.java 2012-02-17
00:16:47 UTC (rev 38850)
@@ -0,0 +1,18 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.wizards;
+
+public class NewGwtProjectWizard extends AbstractJBossCentralProjectWizard {
+
+ public NewGwtProjectWizard() {
+ super("gwt-webapp");
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewHtml5ProjectWizard.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewHtml5ProjectWizard.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewHtml5ProjectWizard.java 2012-02-17
00:16:47 UTC (rev 38850)
@@ -0,0 +1,18 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.wizards;
+
+public class NewHtml5ProjectWizard extends AbstractJBossCentralProjectWizard {
+
+ public NewHtml5ProjectWizard() {
+ super("jboss-javaee6-poh5-archetype");
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeEarProjectWizard.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeEarProjectWizard.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeEarProjectWizard.java 2012-02-17
00:16:47 UTC (rev 38850)
@@ -0,0 +1,18 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.wizards;
+
+public class NewJavaeeEarProjectWizard extends AbstractJBossCentralProjectWizard {
+
+ public NewJavaeeEarProjectWizard() {
+ super("multi-javaee6-archetype");
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeWarProjectWizard.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeWarProjectWizard.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewJavaeeWarProjectWizard.java 2012-02-17
00:16:47 UTC (rev 38850)
@@ -0,0 +1,18 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.wizards;
+
+public class NewJavaeeWarProjectWizard extends AbstractJBossCentralProjectWizard {
+
+ public NewJavaeeWarProjectWizard() {
+ super("jboss-javaee6-webapp");
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewRichfacesProjectWizard.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewRichfacesProjectWizard.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewRichfacesProjectWizard.java 2012-02-17
00:16:47 UTC (rev 38850)
@@ -0,0 +1,18 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.wizards;
+
+public class NewRichfacesProjectWizard extends AbstractJBossCentralProjectWizard {
+
+ public NewRichfacesProjectWizard() {
+ super("richfaces-archetype-simpleapp");
+ }
+}
Added:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewSpringMvcProjectWizard.java
===================================================================
---
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewSpringMvcProjectWizard.java
(rev 0)
+++
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/wizards/NewSpringMvcProjectWizard.java 2012-02-17
00:16:47 UTC (rev 38850)
@@ -0,0 +1,18 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.central.wizards;
+
+public class NewSpringMvcProjectWizard extends AbstractJBossCentralProjectWizard {
+
+ public NewSpringMvcProjectWizard() {
+ super("spring-mvc-webapp");
+ }
+}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard2.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard2.java 2012-02-16
22:43:35 UTC (rev 38849)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard2.java 2012-02-17
00:16:47 UTC (rev 38850)
@@ -48,6 +48,7 @@
//private NewProjectExamplesReadyPage readyPage;
List<IProjectExamplesWizardPage> contributedPages = new
LinkedList<IProjectExamplesWizardPage>();
private ProjectExample projectExample;
+
private boolean isCentral = false;
//private QuickFixPage quickFixPage;
@@ -59,16 +60,19 @@
public NewProjectExamplesWizard2(ProjectExample projectExample) {
super();
+ initializeProjectExample(projectExample);
+ }
+
+ protected void initializeProjectExample(ProjectExample projectExample) {
this.projectExample = projectExample;
this.isCentral = true;
setWindowTitle(Messages.NewProjectExamplesWizard_New_Project_Example);
setNeedsProgressMonitor(true);
}
-
+
/**
* Creates an empty wizard for creating a new resource in the workspace.
*/
-
@Override
public boolean performFinish() {
final List<ProjectExample> selectedProjects = new
ArrayList<ProjectExample>();
@@ -251,4 +255,9 @@
}
return true;
}
+
+ public ProjectExample getProjectExample() {
+ return projectExample;
+ }
+
}