JBoss Tools SVN: r24759 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-09-07 08:16:11 -0400 (Tue, 07 Sep 2010)
New Revision: 24759
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/XMLContentDescriber.java
Log:
https://jira.jboss.org/browse/JBIDE-3875
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/XMLContentDescriber.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/XMLContentDescriber.java 2010-09-07 11:49:23 UTC (rev 24758)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editor/XMLContentDescriber.java 2010-09-07 12:16:11 UTC (rev 24759)
@@ -19,6 +19,7 @@
import org.jboss.tools.common.CommonPlugin;
import org.jboss.tools.common.model.loaders.EntityRecognizerContext;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.common.model.util.ClassLoaderUtil;
import org.jboss.tools.common.util.FileUtil;
/**
@@ -26,6 +27,10 @@
*/
public class XMLContentDescriber extends org.eclipse.core.runtime.content.XMLContentDescriber implements ITextContentDescriber {
+ static {
+ ClassLoaderUtil.init();
+ }
+
public int describe(InputStream contents, IContentDescription description) throws IOException {
super.describe(contents, description);
contents.reset();
15 years, 7 months
JBoss Tools SVN: r24758 - /.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2010-09-07 07:49:23 -0400 (Tue, 07 Sep 2010)
New Revision: 24758
Added:
org.jboss.tools.smooks.templating.test/
Log:
15 years, 7 months
JBoss Tools SVN: r24757 - /.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2010-09-07 06:52:16 -0400 (Tue, 07 Sep 2010)
New Revision: 24757
Added:
org.jboss.tools.smooks.templating/
Log:
15 years, 7 months
JBoss Tools SVN: r24756 - /.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2010-09-07 05:53:25 -0400 (Tue, 07 Sep 2010)
New Revision: 24756
Added:
org.jboss.tools.smooks.ui/
Log:
15 years, 7 months
JBoss Tools SVN: r24755 - branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-09-07 05:30:46 -0400 (Tue, 07 Sep 2010)
New Revision: 24755
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/IGoogleEclipsePluginConstants.java
Log:
[JBIDE-6954] various cleanups, proper exception handling now
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-07 08:33:04 UTC (rev 24754)
+++ branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java 2010-09-07 09:30:46 UTC (rev 24755)
@@ -11,7 +11,11 @@
package org.jboss.tools.gwt.core;
import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.text.MessageFormat;
import java.util.List;
import java.util.zip.ZipInputStream;
@@ -19,6 +23,7 @@
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.Assert;
@@ -43,15 +48,18 @@
import org.eclipse.jst.javaee.web.WebApp;
import org.eclipse.jst.javaee.web.WebFactory;
import org.eclipse.jst.javaee.web.WelcomeFileList;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.log.LogHelper;
import org.jboss.tools.common.model.project.ProjectHome;
+import org.jboss.tools.common.util.FileUtil;
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.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Version;
import org.osgi.service.prefs.BackingStoreException;
/**
@@ -66,7 +74,6 @@
addGwtNature(javaProject, monitor);
addClasspathContainer(javaProject, monitor);
- addModuleCoreNature(project, monitor);
IPath webContentPath = getWebContentFolder(project, monitor);
createWebApplicationPreferences(project, webContentPath, javaProject, monitor);
@@ -93,12 +100,6 @@
EclipseUtil.addNatureToProject(javaProject.getProject(), IGoogleEclipsePluginConstants.GWT_NATURE);
}
- private void addModuleCoreNature(IProject project, IProgressMonitor monitor) throws CoreException {
- monitor.subTask("Adding module core nature");
-
- ModuleCoreNature.addModuleCoreNatureIfNecessary(project, monitor);
- }
-
private void addClasspathContainer(IJavaProject javaProject, IProgressMonitor monitor) throws CoreException {
monitor.subTask("Adding gwt container to classpath");
@@ -115,7 +116,8 @@
IScopeContext projectScope = new ProjectScope(project);
IEclipsePreferences preferences = projectScope.getNode(IGoogleEclipsePluginConstants.GDT_PLUGIN_ID);
- preferences.put(IGoogleEclipsePluginConstants.WAR_SRCDIR_KEY, webContentPath.makeRelativeTo(project.getFullPath()).toString());
+ preferences.put(IGoogleEclipsePluginConstants.WAR_SRCDIR_KEY,
+ webContentPath.makeRelativeTo(project.getFullPath()).toString());
preferences.put(IGoogleEclipsePluginConstants.WAR_SRCDIR_ISOUTPUT_KEY,
IGoogleEclipsePluginConstants.WAR_SRCDIR_ISOUTPUT_DEFAULTVALUE);
preferences.flush();
@@ -125,11 +127,13 @@
}
}
- private void configureOutputFolder(IPath webContentProjectPath, final IJavaProject javaProject, IProgressMonitor monitor)
+ private void configureOutputFolder(IPath webContentProjectPath, final IJavaProject javaProject,
+ IProgressMonitor monitor)
throws CoreException, JavaModelException {
IProject project = javaProject.getProject();
monitor.subTask("Configuring output folder");
- IPath outputFolderProjectPath = webContentProjectPath.append(new Path(IGoogleEclipsePluginConstants.OUTPUT_FOLDER_DEFAULTVALUE));
+ IPath outputFolderProjectPath = webContentProjectPath.append(new Path(
+ IGoogleEclipsePluginConstants.OUTPUT_FOLDER_DEFAULTVALUE));
final IFolder outputWorkspaceFolder = project.getWorkspace().getRoot().getFolder(outputFolderProjectPath);
project.getWorkspace().run(
new IWorkspaceRunnable() {
@@ -165,6 +169,7 @@
*/
unzipSrc(srcPaths.get(0), javaProject);
unzipWebContent(webContentPath, javaProject);
+ copyGwtServlet(javaProject, webContentPath, monitor);
} catch (IOException e) {
throw new CoreException(StatusUtils.getErrorStatus(GWTCoreActivator.PLUGIN_ID,
@@ -192,6 +197,51 @@
ProjectUtils.unzipToFolder(zipInputStream, ProjectUtils.getFile(webContentPath, javaProject.getProject()));
}
+ private void copyGwtServlet(IJavaProject javaProject, IPath webContentPath, IProgressMonitor monitor) throws IOException, CoreException {
+ FileUtil.copy(getGwtServletJar(), getGwtServletDestination(javaProject, webContentPath, monitor));
+ }
+
+ private FileOutputStream getGwtServletDestination(IJavaProject javaProject, IPath webContentPath, IProgressMonitor monitor)
+ throws CoreException, FileNotFoundException {
+ IPath webInfLibPath = webContentPath.append(new Path(IGoogleEclipsePluginConstants.WEB_INF_LIB));
+ IWorkspaceRoot workspaceRoot = javaProject.getProject().getWorkspace().getRoot();
+ ProjectUtils.create(workspaceRoot.getFolder(webInfLibPath), monitor);
+ IPath gwtServletFilePath = webInfLibPath.append(IGoogleEclipsePluginConstants.GWT_SERVLET_NAME);
+ File file = new File(workspaceRoot.getFile(gwtServletFilePath).getLocationURI());
+ return new FileOutputStream(file);
+ }
+
+ private InputStream getGwtServletJar() throws CoreException, IOException {
+ Bundle gwtBundle = getGwtSdkBundle(GWTCoreActivator.getDefault().getBundle().getBundleContext());
+ Assert.isTrue(gwtBundle != null,
+ MessageFormat.format("GWT SDK bundle was not found. Could not copy {0}", IGoogleEclipsePluginConstants.GWT_SERVLET_NAME));
+ String gwtSdkVersion = getGwtServletFolder(gwtBundle);
+ IPath gwtServletPath = new Path(gwtSdkVersion).append(IGoogleEclipsePluginConstants.GWT_SERVLET_NAME);
+ return gwtBundle.getEntry(gwtServletPath.toFile().toString()).openStream();
+ }
+
+ private String getGwtServletFolder(Bundle bundle) {
+ Version bundleVersion = bundle.getVersion();
+ return new StringBuilder()
+ .append("gwt")
+ .append("-")
+ .append(bundleVersion.getMajor())
+ .append(".")
+ .append(bundleVersion.getMinor())
+ .append(".")
+ .append(bundleVersion.getMicro())
+ .toString();
+ }
+
+ private Bundle getGwtSdkBundle(BundleContext bundleContext) {
+ for (Bundle bundle : bundleContext.getBundles()) {
+ if (bundle.getSymbolicName().contains(IGoogleEclipsePluginConstants.GWT_SDK_BUNDLENAME)) {
+ return bundle;
+ }
+ }
+ return null;
+ }
+
/**
* Configures the web xml. Adds the gwt servlet, servlet mapping and welcome
* page.
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-07 08:33:04 UTC (rev 24754)
+++ branches/jbosstools-3.2.0.M2/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/IGoogleEclipsePluginConstants.java 2010-09-07 09:30:46 UTC (rev 24755)
@@ -55,4 +55,11 @@
public static final String SERVLET_MAPPING = "/gwt_jboss/greet"; //$NON-NLS-1$
public static final String WELCOME_FILE = "Gwt_jboss.html"; //$NON-NLS-1$
+
+ public static final String GWT_SDK_BUNDLENAME = "com.google.gwt.eclipse.sdkbundle"; //$NON-NLS-1$
+
+ public static final String GWT_SERVLET_NAME = "gwt-servlet.jar"; //$NON-NLS-1$
+
+ public static final String WEB_INF_LIB = "/WEB-INF/lib"; //$NON-NLS-1$;
+
}
15 years, 7 months
JBoss Tools SVN: r24754 - in trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-09-07 04:33:04 -0400 (Tue, 07 Sep 2010)
New Revision: 24754
Added:
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ResourceUtils.java
trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ZipUtils.java
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/util/ProjectUtils.java
Log:
[JBIDE-6987] fixed the deployment assembly
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-07 07:33:12 UTC (rev 24753)
+++ trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/GWTInstallFacetDelegate.java 2010-09-07 08:33:04 UTC (rev 24754)
@@ -56,6 +56,8 @@
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.gwt.core.internal.GWTCoreActivator;
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.StatusUtils;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -67,6 +69,8 @@
*/
public class GWTInstallFacetDelegate implements IDelegate {
+ private static final String GWTSERVLETJAR_FOLDER_PATTERN = "gwt-{0}.{1}.{2}";
+
public void execute(IProject project, IProjectFacetVersion projectFacetVersion, Object config,
IProgressMonitor monitor) throws CoreException {
IJavaProject javaProject = JavaCore.create(project);
@@ -79,10 +83,11 @@
createWebApplicationPreferences(project, webContentPath, javaProject, monitor);
configureOutputFolder(webContentPath, javaProject, monitor);
- List<IPath> srcFolderPaths = ProjectUtils.getSourceFolders(javaProject);
GWTInstallDataModelProvider dataModel = (GWTInstallDataModelProvider) config;
- createSample(srcFolderPaths, webContentPath, dataModel, javaProject, monitor);
-
+ if (dataModel.isGenerateSampleCode()) {
+ List<IPath> srcFolderPaths = ProjectUtils.getSourceFolders(javaProject);
+ createSample(srcFolderPaths, webContentPath, javaProject, monitor);
+ }
configureWebXml(project, monitor);
}
@@ -139,15 +144,15 @@
new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
if (!outputWorkspaceFolder.exists()) {
- ProjectUtils.create(outputWorkspaceFolder, monitor);
+ ResourceUtils.create(outputWorkspaceFolder, monitor);
}
javaProject.setOutputLocation(outputWorkspaceFolder.getFullPath(), monitor);
}
}, monitor);
}
- private void createSample(final List<IPath> srcPaths, final IPath webContentPath,
- GWTInstallDataModelProvider dataModel, final IJavaProject javaProject, IProgressMonitor monitor)
+ private void createSample(final List<IPath> srcPaths, final IPath webContentPath, final IJavaProject javaProject,
+ IProgressMonitor monitor)
throws CoreException {
if (srcPaths.size() <= 0) {
@@ -156,56 +161,52 @@
return;
}
- if (dataModel.isGenerateSampleCode()) {
- monitor.subTask("Creating sample code");
+ monitor.subTask("Creating sample code");
- javaProject.getProject().getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- /**
- * TODO: it is not secure to take the first
- * source-folder that was found (there might be several
- * of them).
- */
- unzipSrc(srcPaths.get(0), javaProject);
- unzipWebContent(webContentPath, javaProject);
- copyGwtServlet(javaProject, webContentPath, monitor);
+ javaProject.getProject().getWorkspace().run(new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ try {
+ /**
+ * TODO: it is not secure to take the first source-folder
+ * that was found (there might be several of them).
+ */
+ unzipSrc(srcPaths.get(0), javaProject);
+ unzipWebContent(webContentPath, javaProject);
+ copyGwtServlet(javaProject, webContentPath, monitor);
- } catch (IOException e) {
- throw new CoreException(StatusUtils.getErrorStatus(GWTCoreActivator.PLUGIN_ID,
+ } catch (IOException e) {
+ throw new CoreException(StatusUtils.getErrorStatus(GWTCoreActivator.PLUGIN_ID,
"Could not unzip samples", e));
- }
}
+ }
+ }, monitor);
- }, monitor);
-
- javaProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
- }
+ javaProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
private void unzipSrc(final IPath srcFolderPath, final IJavaProject javaProject) throws IOException {
ZipInputStream inputStream = new ZipInputStream(new BufferedInputStream(
- ProjectUtils.checkedGetResourceStream(IGoogleEclipsePluginConstants.SAMPLE_HELLO_SRC_ZIP_FILENAME,
- getClass())));
- ProjectUtils.unzipToFolder(inputStream, ProjectUtils.getFile(srcFolderPath, javaProject.getProject()));
+ getClass().getResourceAsStream(IGoogleEclipsePluginConstants.SAMPLE_HELLO_SRC_ZIP_FILENAME)));
+ ZipUtils.unzipToFolder(inputStream, ResourceUtils.getFile(srcFolderPath, javaProject.getProject()));
}
private void unzipWebContent(IPath webContentPath, IJavaProject javaProject) throws IOException {
ZipInputStream zipInputStream = new ZipInputStream(new BufferedInputStream(
- ProjectUtils.checkedGetResourceStream(
- IGoogleEclipsePluginConstants.SAMPLE_HELLO_WEBCONTENT_ZIP_FILENAME, getClass())));
- ProjectUtils.unzipToFolder(zipInputStream, ProjectUtils.getFile(webContentPath, javaProject.getProject()));
+ getClass().getResourceAsStream(IGoogleEclipsePluginConstants.SAMPLE_HELLO_WEBCONTENT_ZIP_FILENAME)));
+ ZipUtils.unzipToFolder(zipInputStream, ResourceUtils.getFile(webContentPath, javaProject.getProject()));
}
- private void copyGwtServlet(IJavaProject javaProject, IPath webContentPath, IProgressMonitor monitor) throws IOException, CoreException {
+ private void copyGwtServlet(IJavaProject javaProject, IPath webContentPath, IProgressMonitor monitor)
+ throws IOException, CoreException {
FileUtil.copy(getGwtServletJar(), getGwtServletDestination(javaProject, webContentPath, monitor));
}
- private FileOutputStream getGwtServletDestination(IJavaProject javaProject, IPath webContentPath, IProgressMonitor monitor)
+ private FileOutputStream getGwtServletDestination(IJavaProject javaProject, IPath webContentPath,
+ IProgressMonitor monitor)
throws CoreException, FileNotFoundException {
IPath webInfLibPath = webContentPath.append(new Path(IGoogleEclipsePluginConstants.WEB_INF_LIB));
IWorkspaceRoot workspaceRoot = javaProject.getProject().getWorkspace().getRoot();
- ProjectUtils.create(workspaceRoot.getFolder(webInfLibPath), monitor);
+ ResourceUtils.create(workspaceRoot.getFolder(webInfLibPath), monitor);
IPath gwtServletFilePath = webInfLibPath.append(IGoogleEclipsePluginConstants.GWT_SERVLET_NAME);
File file = new File(workspaceRoot.getFile(gwtServletFilePath).getLocationURI());
return new FileOutputStream(file);
@@ -214,23 +215,17 @@
private InputStream getGwtServletJar() throws CoreException, IOException {
Bundle gwtBundle = getGwtSdkBundle(GWTCoreActivator.getDefault().getBundle().getBundleContext());
Assert.isTrue(gwtBundle != null,
- MessageFormat.format("GWT SDK bundle was not found. Could not copy {0}", IGoogleEclipsePluginConstants.GWT_SERVLET_NAME));
+ MessageFormat.format("GWT SDK bundle was not found. Could not copy {0}",
+ IGoogleEclipsePluginConstants.GWT_SERVLET_NAME));
String gwtSdkVersion = getGwtServletFolder(gwtBundle);
IPath gwtServletPath = new Path(gwtSdkVersion).append(IGoogleEclipsePluginConstants.GWT_SERVLET_NAME);
return gwtBundle.getEntry(gwtServletPath.toFile().toString()).openStream();
}
-
+
private String getGwtServletFolder(Bundle bundle) {
Version bundleVersion = bundle.getVersion();
- return new StringBuilder()
- .append("gwt")
- .append("-")
- .append(bundleVersion.getMajor())
- .append(".")
- .append(bundleVersion.getMinor())
- .append(".")
- .append(bundleVersion.getMicro())
- .toString();
+ return MessageFormat.format(GWTSERVLETJAR_FOLDER_PATTERN, bundleVersion.getMajor(), bundleVersion.getMinor(),
+ bundleVersion.getMicro());
}
private Bundle getGwtSdkBundle(BundleContext bundleContext) {
@@ -252,31 +247,14 @@
* the monitor to inform on progress
*/
protected void configureWebXml(final IProject project, IProgressMonitor monitor) {
- IModelProvider modelProvider = ModelProviderManager.getModelProvider(project);
- Object modelObject = modelProvider.getModelObject();
- if (!(modelObject instanceof WebApp)) {
- // TODO log
- return;
- }
-
monitor.subTask("configuring web.xml");
- IPath webXmlPath = ProjectUtils.getWebXmlPath();
- boolean exists = project.getProjectRelativePath().append(webXmlPath).toFile().exists();
- if (!exists) {
- webXmlPath = IModelProvider.FORCESAVE;
- }
+ IModelProvider modelProvider = ModelProviderManager.getModelProvider(project);
+ IPath webXmlPath = ProjectUtils.getWebXmlPath(project);
modelProvider.modify(new Runnable() {
public void run() {
- IModelProvider modelProvider = ModelProviderManager.getModelProvider(project);
- Object modelObject = modelProvider.getModelObject();
- if (!(modelObject instanceof WebApp)) {
- // TODO log
- return;
- }
- WebApp webApp = (WebApp) modelObject;
-
+ WebApp webApp = ProjectUtils.getWebApp(project);
Servlet servlet = createServlet(
IGoogleEclipsePluginConstants.SERVLET_NAME,
IGoogleEclipsePluginConstants.SERVLET_CLASS,
Modified: trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ProjectUtils.java
===================================================================
--- trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ProjectUtils.java 2010-09-07 07:33:12 UTC (rev 24753)
+++ trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ProjectUtils.java 2010-09-07 08:33:04 UTC (rev 24754)
@@ -11,29 +11,21 @@
package org.jboss.tools.gwt.core.util;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.AssertionFailedException;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.j2ee.model.IModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.javaee.web.WebApp;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
@@ -53,11 +45,13 @@
/** the folder that holds the web configurations and deployed classes */
public static final String WEB_INF_FOLDER = "WEB-INF";
- /** Signals the end of a stream. */
- private static final int EOS = -1;
-
- public static IPath getWebXmlPath() {
- return new Path(WEB_INF_FOLDER).append(WEB_XML_FILE);
+ public static IPath getWebXmlPath(IProject project) {
+ IPath webXmlPath = new Path(WEB_INF_FOLDER).append(WEB_XML_FILE);
+ boolean exists = project.getProjectRelativePath().append(webXmlPath).toFile().exists();
+ if (!exists) {
+ webXmlPath = IModelProvider.FORCESAVE;
+ }
+ return webXmlPath;
}
/**
@@ -106,53 +100,6 @@
}
/**
- * Unzips the given ZipInputStream to the given folder.
- *
- * @param zipInputStream
- * the zip input stream
- * @param dirToExtractTo
- * the dir to extract to
- * @throws IOException
- * Signals that an I/O exception has occurred.
- *
- * @see ZipInputStream
- * @see File
- */
- public static final void unzipToFolder(ZipInputStream zipInputStream, File dirToExtractTo) throws IOException {
- Assert.isLegal(zipInputStream != null);
- Assert.isLegal(!dirToExtractTo.exists() || dirToExtractTo.isDirectory());
- try {
- for (ZipEntry zipEntry = null; (zipEntry = zipInputStream.getNextEntry()) != null;) {
- File file = new File(dirToExtractTo, zipEntry.getName());
- if (zipEntry.isDirectory()) {
- if (!file.exists()) {
- file.mkdirs();
- }
- } else {
- if (!file.getParentFile().exists()) {
- file.getParentFile().mkdirs();
- }
- writeTo(zipInputStream, file);
- }
- }
- } finally {
- zipInputStream.close();
- }
- }
-
- private static void writeTo(InputStream inputStream, File file) throws IOException {
- BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file));
- byte[] buffer = new byte[8192];
- try {
- for (int read = 0; (read = inputStream.read(buffer)) != EOS;) {
- outputStream.write(buffer, 0, read);
- }
- } finally {
- outputStream.close();
- }
- }
-
- /**
* Returns the (paths of) the source folders for the given java project. The
* paths returned are relative to the workspace.
*
@@ -177,56 +124,13 @@
return srcFolderList;
}
- /**
- * Returns a file for the given path in the given project.
- *
- * @param path
- * the path to return the file for
- * @param project
- * the project the path's located in
- * @return the file that represents the given path in the given project
- */
- public static File getFile(IPath path, IProject project) {
- IFolder folder = project.getWorkspace().getRoot().getFolder(path);
- return folder.getLocation().toFile();
- }
- /**
- * Returns a resource as stream while checking whether the resource exists.
- *
- * @param resourceName
- * the resource name
- * @return the input stream
- *
- * @throws AssertionFailedException
- * if the resource's not found
- */
- public static InputStream checkedGetResourceStream(String resourceName, Class<?> clazz) {
- InputStream inputStream = clazz.getResourceAsStream(resourceName);
- Assert.isTrue(inputStream != null, MessageFormat.format("Could not find the zip file {0}", resourceName));
- return inputStream;
- }
- /**
- * Creates the given resource and all its parents (recursively)
- *
- * @param resource
- * @param monitor
- * @throws CoreException
- */
- public static void create(IResource resource, IProgressMonitor monitor) throws CoreException {
- if (resource.exists())
- return;
- create(resource.getParent(), monitor);
-
- switch (resource.getType()) {
- case IResource.FOLDER:
- ((IFolder) resource).create(IResource.NONE, true, null);
- break;
- case IResource.PROJECT:
- ((IProject) resource).create(monitor);
- ((IProject) resource).open(monitor);
- break;
- }
+ public static WebApp getWebApp(IProject project) {
+ IModelProvider modelProvider = ModelProviderManager.getModelProvider(project);
+ Object modelObject = modelProvider.getModelObject();
+ Assert.isTrue(modelObject instanceof WebApp, MessageFormat.format(
+ "Could not get webapp model for project {0}. The given project is not a web app.", project.getName()));
+ return (WebApp) modelObject;
}
}
Added: trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ResourceUtils.java
===================================================================
--- trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ResourceUtils.java (rev 0)
+++ trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ResourceUtils.java 2010-09-07 08:33:04 UTC (rev 24754)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.util;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ResourceUtils {
+
+ /**
+ * Returns a file for the given path in the given project.
+ *
+ * @param path
+ * the path to return the file for
+ * @param project
+ * the project the path's located in
+ * @return the file that represents the given path in the given project
+ */
+ public static File getFile(IPath path, IProject project) {
+ IFolder folder = project.getWorkspace().getRoot().getFolder(path);
+ return folder.getLocation().toFile();
+ }
+
+ /**
+ * Creates the given resource and all its parents (recursively)
+ *
+ * @param resource
+ * @param monitor
+ * @throws CoreException
+ */
+ public static void create(IResource resource, IProgressMonitor monitor) throws CoreException {
+ if (resource.exists())
+ return;
+ create(resource.getParent(), monitor);
+
+ switch (resource.getType()) {
+ case IResource.FOLDER:
+ ((IFolder) resource).create(IResource.NONE, true, null);
+ break;
+ case IResource.PROJECT:
+ ((IProject) resource).create(monitor);
+ ((IProject) resource).open(monitor);
+ break;
+ }
+ }
+}
Property changes on: trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ResourceUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ZipUtils.java
===================================================================
--- trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ZipUtils.java (rev 0)
+++ trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ZipUtils.java 2010-09-07 08:33:04 UTC (rev 24754)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.util;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class ZipUtils {
+
+ /** Signals the end of a stream. */
+ private static final int EOS = -1;
+
+
+ /**
+ * Unzips the given ZipInputStream to the given folder.
+ *
+ * @param zipInputStream
+ * the zip input stream
+ * @param dirToExtractTo
+ * the dir to extract to
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ *
+ * @see ZipInputStream
+ * @see File
+ */
+ public static final void unzipToFolder(ZipInputStream zipInputStream, File dirToExtractTo) throws IOException {
+ Assert.isLegal(zipInputStream != null);
+ Assert.isLegal(!dirToExtractTo.exists() || dirToExtractTo.isDirectory());
+ try {
+ for (ZipEntry zipEntry = null; (zipEntry = zipInputStream.getNextEntry()) != null;) {
+ File file = new File(dirToExtractTo, zipEntry.getName());
+ if (zipEntry.isDirectory()) {
+ if (!file.exists()) {
+ file.mkdirs();
+ }
+ } else {
+ if (!file.getParentFile().exists()) {
+ file.getParentFile().mkdirs();
+ }
+ writeTo(zipInputStream, file);
+ }
+ }
+ } finally {
+ zipInputStream.close();
+ }
+ }
+
+ private static void writeTo(InputStream inputStream, File file) throws IOException {
+ BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file));
+ byte[] buffer = new byte[8192];
+ try {
+ for (int read = 0; (read = inputStream.read(buffer)) != EOS;) {
+ outputStream.write(buffer, 0, read);
+ }
+ } finally {
+ outputStream.close();
+ }
+ }
+}
Property changes on: trunk/gwt/plugins/org.jboss.tools.gwt.core/src/org/jboss/tools/gwt/core/util/ZipUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 7 months
JBoss Tools SVN: r24753 - in branches/jbosstools-3.2.0.M2/xulrunner/plugins: org.mozilla.xulrunner.carbon.macosx/META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-09-07 03:33:12 -0400 (Tue, 07 Sep 2010)
New Revision: 24753
Modified:
branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/META-INF/MANIFEST.MF
branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml
branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/META-INF/MANIFEST.MF
branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml
Log:
[https://jira.jboss.org/browse/JBIDE-6965 VPE editor does not work in JBT 3.2.0.M2] version for mac plugins updates to 1.9.1.2a to let fix xulrunner problem when updating from M1 to M2 development build
Modified: branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/META-INF/MANIFEST.MF 2010-09-07 07:27:17 UTC (rev 24752)
+++ branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/META-INF/MANIFEST.MF 2010-09-07 07:33:12 UTC (rev 24753)
@@ -2,6 +2,6 @@
Bundle-ManifestVersion: 2
Bundle-Name: Mozilla Xulrunner
Bundle-SymbolicName: org.mozilla.xulrunner.carbon.macosx;singleton:=true
-Bundle-Version: 1.9.1.2
+Bundle-Version: 1.9.1.2a
Bundle-Vendor: mozilla.org
Eclipse-PlatformFilter: (& (osgi.ws=carbon) (osgi.os=macosx) (|(osgi.arch=x86)(osgi.arch=ppc)))
Modified: branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml
===================================================================
--- branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml 2010-09-07 07:27:17 UTC (rev 24752)
+++ branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml 2010-09-07 07:33:12 UTC (rev 24753)
@@ -8,7 +8,7 @@
</parent>
<groupId>org.jboss.tools.xulrunner.plugins</groupId>
<artifactId>org.mozilla.xulrunner.carbon.macosx</artifactId>
- <version>1.9.1.2</version>
+ <version>1.9.1.2a</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
Modified: branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/META-INF/MANIFEST.MF 2010-09-07 07:27:17 UTC (rev 24752)
+++ branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/META-INF/MANIFEST.MF 2010-09-07 07:33:12 UTC (rev 24753)
@@ -2,6 +2,6 @@
Bundle-ManifestVersion: 2
Bundle-Name: Mozilla Xulrunner
Bundle-SymbolicName: org.mozilla.xulrunner.cocoa.macosx;singleton:=true
-Bundle-Version: 1.9.1.2
+Bundle-Version: 1.9.1.2a
Bundle-Vendor: mozilla.org
Eclipse-PlatformFilter: (& (osgi.ws=cocoa) (osgi.os=macosx) (|(osgi.arch=x86)(osgi.arch=ppc)))
Modified: branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml
===================================================================
--- branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml 2010-09-07 07:27:17 UTC (rev 24752)
+++ branches/jbosstools-3.2.0.M2/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml 2010-09-07 07:33:12 UTC (rev 24753)
@@ -8,7 +8,7 @@
</parent>
<groupId>org.jboss.tools.xulrunner.plugins</groupId>
<artifactId>org.mozilla.xulrunner.cocoa.macosx</artifactId>
- <version>1.9.1.2</version>
+ <version>1.9.1.2a</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
15 years, 7 months
JBoss Tools SVN: r24752 - in trunk/xulrunner/plugins: org.mozilla.xulrunner.carbon.macosx/META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-09-07 03:27:17 -0400 (Tue, 07 Sep 2010)
New Revision: 24752
Modified:
trunk/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/META-INF/MANIFEST.MF
trunk/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml
trunk/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/META-INF/MANIFEST.MF
trunk/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml
Log:
https://jira.jboss.org/browse/JBIDE-6965 VPE editor does not work in JBT 3.2.0.M2
Modified: trunk/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/META-INF/MANIFEST.MF
===================================================================
--- trunk/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/META-INF/MANIFEST.MF 2010-09-06 21:35:03 UTC (rev 24751)
+++ trunk/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/META-INF/MANIFEST.MF 2010-09-07 07:27:17 UTC (rev 24752)
@@ -2,6 +2,6 @@
Bundle-ManifestVersion: 2
Bundle-Name: Mozilla Xulrunner
Bundle-SymbolicName: org.mozilla.xulrunner.carbon.macosx;singleton:=true
-Bundle-Version: 1.9.1.2
+Bundle-Version: 1.9.1.2a
Bundle-Vendor: mozilla.org
Eclipse-PlatformFilter: (& (osgi.ws=carbon) (osgi.os=macosx) (|(osgi.arch=x86)(osgi.arch=ppc)))
Modified: trunk/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml
===================================================================
--- trunk/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml 2010-09-06 21:35:03 UTC (rev 24751)
+++ trunk/xulrunner/plugins/org.mozilla.xulrunner.carbon.macosx/pom.xml 2010-09-07 07:27:17 UTC (rev 24752)
@@ -8,7 +8,7 @@
</parent>
<groupId>org.jboss.tools.xulrunner.plugins</groupId>
<artifactId>org.mozilla.xulrunner.carbon.macosx</artifactId>
- <version>1.9.1.2</version>
+ <version>1.9.1.2a</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
Modified: trunk/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/META-INF/MANIFEST.MF
===================================================================
--- trunk/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/META-INF/MANIFEST.MF 2010-09-06 21:35:03 UTC (rev 24751)
+++ trunk/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/META-INF/MANIFEST.MF 2010-09-07 07:27:17 UTC (rev 24752)
@@ -2,6 +2,6 @@
Bundle-ManifestVersion: 2
Bundle-Name: Mozilla Xulrunner
Bundle-SymbolicName: org.mozilla.xulrunner.cocoa.macosx;singleton:=true
-Bundle-Version: 1.9.1.2
+Bundle-Version: 1.9.1.2a
Bundle-Vendor: mozilla.org
Eclipse-PlatformFilter: (& (osgi.ws=cocoa) (osgi.os=macosx) (|(osgi.arch=x86)(osgi.arch=ppc)))
Modified: trunk/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml
===================================================================
--- trunk/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml 2010-09-06 21:35:03 UTC (rev 24751)
+++ trunk/xulrunner/plugins/org.mozilla.xulrunner.cocoa.macosx/pom.xml 2010-09-07 07:27:17 UTC (rev 24752)
@@ -8,7 +8,7 @@
</parent>
<groupId>org.jboss.tools.xulrunner.plugins</groupId>
<artifactId>org.mozilla.xulrunner.cocoa.macosx</artifactId>
- <version>1.9.1.2</version>
+ <version>1.9.1.2a</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
15 years, 7 months
JBoss Tools SVN: r24751 - trunk/maven/plugins/org.jboss.tools.maven.core.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2010-09-06 17:35:03 -0400 (Mon, 06 Sep 2010)
New Revision: 24751
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml
Log:
https://jira.jboss.org/browse/JBIDE-7010 JBoss Maven Integration Facet has too strong constraints
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml 2010-09-06 20:53:19 UTC (rev 24750)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/plugin.xml 2010-09-06 21:35:03 UTC (rev 24751)
@@ -15,12 +15,30 @@
<project-facet-version facet="jboss.m2" version="1.0">
<constraint>
<or>
- <requires facet="jst.ear" version="[5.0"/>
- <requires facet="jst.ejb" version="[3.0"/>
- <requires facet="jst.web" version="[2.5"/>
- <requires facet="jst.utility" version="[1.0"/>
- <requires facet="jst.appclient" version="[1.2"/>
- <requires facet="jst.connector" version="[1.0"/>
+ <requires
+ facet="jst.ear"
+ soft="true"
+ version="[5.0"/>
+ <requires
+ facet="jst.ejb"
+ soft="true"
+ version="[3.0"/>
+ <requires
+ facet="jst.web"
+ soft="true"
+ version="[2.5"/>
+ <requires
+ facet="jst.utility"
+ soft="true"
+ version="[1.0"/>
+ <requires
+ facet="jst.appclient"
+ soft="true"
+ version="[1.2"/>
+ <requires
+ facet="jst.connector"
+ soft="true"
+ version="[1.0"/>
</or>
</constraint>
</project-facet-version>
15 years, 7 months
JBoss Tools SVN: r24750 - trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2010-09-06 16:53:19 -0400 (Mon, 06 Sep 2010)
New Revision: 24750
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
Log:
https://jira.jboss.org/browse/JBIDE-7006 Fix incompatibilities between JBoss Maven Integration and latest m2eclipse
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2010-09-06 19:15:50 UTC (rev 24749)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2010-09-06 20:53:19 UTC (rev 24750)
@@ -5,6 +5,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
@@ -311,19 +313,55 @@
public static void updateMavenProjectConfiguration(IProject project)
throws CoreException {
ResolverConfiguration resolverConfiguration = new ResolverConfiguration();
- resolverConfiguration.setIncludeModules(false);
+ //resolverConfiguration.setIncludeModules(false);
// FIXME
resolverConfiguration.setResolveWorkspaceProjects(true);
resolverConfiguration.setActiveProfiles(""); //$NON-NLS-1$
IProjectConfigurationManager configurationManager = MavenPlugin
.getDefault().getProjectConfigurationManager();
- IMavenConfiguration mavenConfiguration = MavenPlugin.lookup(IMavenConfiguration.class);
+ //IMavenConfiguration mavenConfiguration = MavenPlugin.lookup(IMavenConfiguration.class);
+ //IMavenConfiguration mavenConfiguration = MavenPlugin.getDefault().getMavenConfiguration();
+ IMavenConfiguration mavenConfiguration = getMavenConfiguration();
configurationManager.updateProjectConfiguration(project,
resolverConfiguration, //
mavenConfiguration
.getGoalOnUpdate(), new NullProgressMonitor());
}
+ private static IMavenConfiguration getMavenConfiguration() {
+ Class clazz = MavenPlugin.class;
+ try {
+ Method method = clazz.getMethod ("getMavenConfiguration", new Class[0]); //$NON-NLS-1$
+ Object configuration = method.invoke (MavenPlugin.getDefault(), new Object[0]);
+ return (IMavenConfiguration) configuration;
+ } catch (SecurityException e) {
+ log(e);
+ } catch (NoSuchMethodException e) {
+ try {
+ Method method = clazz.getMethod ("lookup", new Class[] {Class.class}); //$NON-NLS-1$
+ Object configuration = method.invoke (null, new Object[] {IMavenConfiguration.class});
+ return (IMavenConfiguration) configuration;
+ } catch (SecurityException e1) {
+ log(e1);
+ } catch (IllegalArgumentException e1) {
+ log(e1);
+ } catch (NoSuchMethodException e1) {
+ log(e1);
+ } catch (IllegalAccessException e1) {
+ log(e1);
+ } catch (InvocationTargetException e1) {
+ log(e1);
+ }
+ } catch (IllegalArgumentException e) {
+ log(e);
+ } catch (IllegalAccessException e) {
+ log(e);
+ } catch (InvocationTargetException e) {
+ log(e);
+ }
+ return null;
+ }
+
public static void addMavenWarPlugin(Build build, IProject project) throws JavaModelException {
org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
plugin.setGroupId("org.apache.maven.plugins"); //$NON-NLS-1$
15 years, 7 months