Author: adietish
Date: 2010-09-17 12:32:31 -0400 (Fri, 17 Sep 2010)
New Revision: 24998
Added:
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGWTDesignerConstants.java
Modified:
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java
Log:
[JBIDE-7092] the wizard now adds GWT Designer nature and facet if the GWT Designer
plugin's present
Modified:
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java
===================================================================
---
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java 2010-09-17
15:59:22 UTC (rev 24997)
+++
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java 2010-09-17
16:32:31 UTC (rev 24998)
@@ -17,6 +17,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipInputStream;
@@ -58,6 +59,7 @@
import org.jboss.tools.gwt.core.util.ProjectUtils;
import org.jboss.tools.gwt.core.util.ResourceUtils;
import org.jboss.tools.gwt.core.util.ZipUtils;
+import org.jboss.tools.usage.util.BundleUtils;
import org.jboss.tools.usage.util.StatusUtils;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -88,9 +90,31 @@
List<IPath> srcFolderPaths = ProjectUtils.getSourceFolders(javaProject);
createSample(srcFolderPaths, webContentPath, javaProject, monitor);
}
+
configureWebXml(project, monitor);
+
+ addGWTDesignerNatureAndBuilder(project, monitor);
}
+ private void addGWTDesignerNatureAndBuilder(IProject project, IProgressMonitor monitor)
throws CoreException {
+ if
(isGWTDesignerInstalled(GWTCoreActivator.getDefault().getBundle().getBundleContext())) {
+
+ monitor.subTask("Adding GWT Designer nature");
+ EclipseUtil.addNatureToProject(project.getProject(),
IGWTDesignerConstants.GWTDESIGNER_NATURE);
+
+ monitor.subTask("Adding GWT Designer builder");
+ EclipseUtil.addBuilderToProject(project.getProject(),
IGWTDesignerConstants.GWTDESIGNER_BUILDER);
+ }
+
+ }
+
+ private boolean isGWTDesignerInstalled(BundleContext bundleContext) {
+ ArrayList<Bundle> gwtDesignerBundles = new ArrayList<Bundle>();
+ BundleUtils.getBundles(
+ new
BundleUtils.BundleSymbolicNameFilter(IGWTDesignerConstants.GWTDESIGNER_PLUGIN_REGEXP),
gwtDesignerBundles, bundleContext.getBundles());
+ return gwtDesignerBundles.size() > 0;
+ }
+
private IPath getWebContentFolder(IProject project, IProgressMonitor monitor) throws
CoreException {
IPath webContentPath = ProjectHome.getFirstWebContentPath(project);
Assert.isTrue(webContentPath != null && !webContentPath.isEmpty(),
Added:
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGWTDesignerConstants.java
===================================================================
---
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGWTDesignerConstants.java
(rev 0)
+++
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGWTDesignerConstants.java 2010-09-17
16:32:31 UTC (rev 24998)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.gwt.core;
+
+/**
+ * A class that holds various constants that are used to handle GWT Designer
+ * plugin specific functionalities.
+ *
+ * @author adietish
+ */
+public class IGWTDesignerConstants {
+
+ public static final String GWTDESIGNER_NATURE =
"com.instantiations.designer.gwt.GWTNature"; //$NON-NLS-1$
+
+ public static final String GWTDESIGNER_BUILDER =
"com.instantiations.designer.gwt.GWTBuilder"; //$NON-NLS-1$
+
+ /** the plugin that contributes GWT Designer nature and builder */
+ public static final String GWTDESIGNER_PLUGIN_REGEXP =
"com\\.instantiations\\.designer\\.gwt";
+
+}
Property changes on:
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGWTDesignerConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain