Author: adietish
Date: 2010-09-02 14:10:42 -0400 (Thu, 02 Sep 2010)
New Revision: 24672
Modified:
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/plugin.xml
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGoogleEclipsePluginConstants.java
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ProjectUtils.java
Log:
[JBIDE-6954] added runtime extension point, web content folder now gets created. 1 error
left (web-inf still not created)
Modified: branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/plugin.xml
===================================================================
---
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/plugin.xml 2010-09-02
17:40:36 UTC (rev 24671)
+++
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/plugin.xml 2010-09-02
18:10:42 UTC (rev 24672)
@@ -57,5 +57,15 @@
</config-factory>
</action>
</extension>
-
+ <extension
point="org.eclipse.wst.common.project.facet.core.runtimes">
+ <supported>
+ <runtime-component
+ any="true">
+ </runtime-component>
+ <facet
+ id="jboss.gwt"
+ version="[1.3.3">
+ </facet>
+ </supported>
+ </extension>
</plugin>
Modified:
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java
===================================================================
---
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java 2010-09-02
17:40:36 UTC (rev 24671)
+++
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java 2010-09-02
18:10:42 UTC (rev 24672)
@@ -50,6 +50,7 @@
import org.jboss.tools.common.log.LogHelper;
import org.jboss.tools.gwt.core.internal.GWTCoreActivator;
import org.jboss.tools.gwt.core.util.ProjectUtils;
+import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.service.prefs.BackingStoreException;
/**
@@ -60,12 +61,9 @@
public void execute(IProject project, IProjectFacetVersion projectFacetVersion, Object
config,
IProgressMonitor monitor) throws CoreException {
try {
-
- GWTInstallDataModelProvider dataModel = (GWTInstallDataModelProvider) config;
IJavaProject javaProject = JavaCore.create(project);
addNature(javaProject, monitor);
-
addClasspathContainer(javaProject, monitor);
IPath webContentPath = ProjectUtils.getWebContentRootPath(javaProject.getProject());
@@ -73,25 +71,16 @@
MessageFormat
.format("no web content folder was found in project {0}",
javaProject.getElementName()));
- IScopeContext projectScope = new ProjectScope(project);
- createWebApplicationPreferences(
- projectScope.getNode(IGoogleEclipsePluginConstants.GDT_PLUGIN_ID),
- webContentPath, javaProject, monitor);
-
+ createWebApplicationPreferences(project, webContentPath, javaProject, monitor);
configureOutputFolder(webContentPath, javaProject, monitor);
List<IPath> srcFolderPaths = ProjectUtils.getSourceFolders(javaProject);
- Assert.isTrue(srcFolderPaths.size() > 0,
- MessageFormat.format("no source folders were found in project {0}",
javaProject.getElementName()));
+ GWTInstallDataModelProvider dataModel = (GWTInstallDataModelProvider) config;
createSample(srcFolderPaths, webContentPath, dataModel, javaProject, monitor);
configureWebXml(project, monitor);
-
- } catch (BackingStoreException e) {
- LogHelper.logError(GWTCoreActivator.getDefault(), "Could not store
preferences.", e);
} catch (Exception e) {
-
- LogHelper.logError(GWTCoreActivator.getDefault(), "Could not create gwt
facet.", e);
+ throw new CoreException(StatusUtils.getErrorStatus(GWTCoreActivator.PLUGIN_ID,
"Could not create gwt facet.", e));
}
}
@@ -109,12 +98,15 @@
ProjectUtils.addClasspathEntry(javaProject, entry, monitor);
}
- private void createWebApplicationPreferences(IEclipsePreferences preferences, IPath
webContentPath,
+ private void createWebApplicationPreferences(IProject project, IPath webContentPath,
IJavaProject javaProject, IProgressMonitor monitor) throws BackingStoreException,
CoreException {
monitor.subTask("creating web application preferences");
- preferences.put(IGoogleEclipsePluginConstants.WAR_SRCDIR_KEY,
webContentPath.makeRelativeTo(
- javaProject.getPath()).toString());
+ IScopeContext projectScope = new ProjectScope(project);
+ IEclipsePreferences preferences =
projectScope.getNode(IGoogleEclipsePluginConstants.GDT_PLUGIN_ID);
+
+ preferences.put(IGoogleEclipsePluginConstants.WAR_SRCDIR_KEY,
+ webContentPath.makeRelativeTo(javaProject.getPath()).toString());
preferences.put(IGoogleEclipsePluginConstants.WAR_SRCDIR_ISOUTPUT_KEY,
IGoogleEclipsePluginConstants.WAR_SRCDIR_ISOUTPUT_DEFAULTVALUE);
preferences.flush();
@@ -128,7 +120,7 @@
IFolder outputWorkspaceFolder =
javaProject.getProject().getWorkspace().getRoot().getFolder(
outputFolderProjectPath);
if (!outputWorkspaceFolder.exists()) {
- outputWorkspaceFolder.create(false, true, monitor);
+ outputWorkspaceFolder.create(true, true, monitor);
}
javaProject.setOutputLocation(outputWorkspaceFolder.getFullPath(), new
NullProgressMonitor());
}
@@ -137,8 +129,12 @@
GWTInstallDataModelProvider dataModel, final IJavaProject javaProject,
IProgressMonitor monitor)
throws IOException, CoreException {
- if (dataModel.isGenerateSampleCode()) {
+ if (srcPaths.size() <= 0) {
+ LogHelper.logWarning(GWTCoreActivator.PLUGIN_ID, MessageFormat.format("no source
folders were found in project {0}", javaProject.getElementName()));
+ return;
+ }
+ if (dataModel.isGenerateSampleCode()) {
monitor.subTask("creating sample code");
javaProject.getProject().getWorkspace().run(new IWorkspaceRunnable() {
@@ -153,7 +149,7 @@
unzipWebContent(webContentPath, javaProject);
} catch (IOException e) {
- LogHelper.logError(GWTCoreActivator.getDefault(), "Could not create gwt
facet", e);
+ LogHelper.logError(GWTCoreActivator.PLUGIN_ID, "Could not create gwt
facet", e);
}
}
@@ -228,7 +224,6 @@
}, webXmlPath);
}
- @SuppressWarnings("unchecked")
private void createServletMapping(String urlPattern, Servlet servlet, WebApp webApp) {
ServletMapping mapping = WebFactory.eINSTANCE.createServletMapping();
mapping.setServletName(servlet.getServletName());
@@ -238,7 +233,6 @@
webApp.getServletMappings().add(mapping);
}
- @SuppressWarnings("unchecked")
private Servlet createServlet(String servletName, String servletClass, WebApp webApp) {
Servlet servlet = WebFactory.eINSTANCE.createServlet();
servlet.setServletName(servletName);
@@ -247,7 +241,6 @@
return servlet;
}
- @SuppressWarnings("unchecked")
private void addWelcomePage(String welcomeFileUrl, WebApp webApp) {
List<WelcomeFileList> welcomeList = webApp.getWelcomeFileLists();
WelcomeFileList welcomeFileList = null;
Modified:
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGoogleEclipsePluginConstants.java
===================================================================
---
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGoogleEclipsePluginConstants.java 2010-09-02
17:40:36 UTC (rev 24671)
+++
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGoogleEclipsePluginConstants.java 2010-09-02
18:10:42 UTC (rev 24672)
@@ -18,7 +18,7 @@
*/
public class IGoogleEclipsePluginConstants {
- public static final String GWT_NATURE =
"com.google.gwt.eclipse.core.gwtNature";
+ public static final String GWT_NATURE =
"com.google.gwt.eclipse.core.gwtNature"; //$NON-NLS-1$
/** The gwt class path container id. */
public static final String GWT_CONTAINER_ID =
"com.google.gwt.eclipse.core.GWT_CONTAINER"; //$NON-NLS-1$
Modified:
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ProjectUtils.java
===================================================================
---
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ProjectUtils.java 2010-09-02
17:40:36 UTC (rev 24671)
+++
branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ProjectUtils.java 2010-09-02
18:10:42 UTC (rev 24672)
@@ -39,7 +39,7 @@
/**
* A class that holds various utility methods that help to deal with projects.
*
- * @author adietish.
+ * @author Andre Dietisheim
*
* @see IProject
*/
@@ -90,8 +90,9 @@
* @return the path of the web content folder (relative to the workspace)
*/
public static IPath getWebContentRootPath(IProject project) {
- if (!ModuleCoreNature.isFlexibleProject(project))
+ if (!ModuleCoreNature.isFlexibleProject(project)) {
return project.getFullPath();
+ }
IPath path = null;
IVirtualComponent component = ComponentCore.createComponent(project);
if (component != null && component.exists()) {