Author: snjeza
Date: 2010-12-11 06:56:32 -0500 (Sat, 11 Dec 2010)
New Revision: 27379
Added:
trunk/download.jboss.org/jbosstools/examples/nightly/project-examples-mav...
trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.2.xml
trunk/examples/plugins/org.jboss.tools.project.examples/schema/importProjectExample.exsd
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/AbstractImportProjectExample.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/IImportProjectExample.java
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/.project
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/build.properties
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/feature.properties
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/feature.xml
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/license.html
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/pom.xml
trunk/maven/plugins/org.jboss.tools.maven.project.examples/.classpath
trunk/maven/plugins/org.jboss.tools.maven.project.examples/.project
trunk/maven/plugins/org.jboss.tools.maven.project.examples/.settings/
trunk/maven/plugins/org.jboss.tools.maven.project.examples/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/
trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.html
trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.ini
trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.mappings
trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.properties
trunk/maven/plugins/org.jboss.tools.maven.project.examples/build.properties
trunk/maven/plugins/org.jboss.tools.maven.project.examples/jboss_about.png
trunk/maven/plugins/org.jboss.tools.maven.project.examples/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.project.examples/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExample.java
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/MavenProjectExamplesActivator.java
Modified:
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.properties
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF
trunk/examples/plugins/org.jboss.tools.project.examples/plugin.xml
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
trunk/maven/features/pom.xml
trunk/maven/plugins/org.jboss.tools.maven.cdi/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.hibernate/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.jsf/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.portlet/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.properties
trunk/maven/plugins/pom.xml
Log:
JBIDE-6214 Support project example with no Eclipse metadata, only pom.xml, in zip
Added:
trunk/download.jboss.org/jbosstools/examples/nightly/project-examples-mav...
===================================================================
---
trunk/download.jboss.org/jbosstools/examples/nightly/project-examples-mav...
(rev 0)
+++
trunk/download.jboss.org/jbosstools/examples/nightly/project-examples-mav... 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,19 @@
+<projects>
+
+ <project>
+ <category>Weld 1.0.1</category>
+ <name>weld-jsf-login</name>
+ <included-projects>
+ weld-examples-parent,weld-jsf-login
+ </included-projects>
+ <shortDescription>Weld JSF login example</shortDescription>
+ <description>
+The example demonstrates user login/logout for an application that uses JSF.
+It will create the weld-examples-parent and weld-jsf-login project in your workspace.
+ </description>
+ <size>17532</size>
+ <
url>http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/weld-ex...
+ <importType>maven</importType>
+ <importTypeDescription>The project example requires the m2eclipse-core,
m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
+ </project>
+</projects>
\ No newline at end of file
Added:
trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.2.xml
===================================================================
---
trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.2.xml
(rev 0)
+++
trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.2.xml 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,19 @@
+<projects>
+
+ <project>
+ <category>Weld 1.0.1</category>
+ <name>weld-jsf-login</name>
+ <included-projects>
+ weld-examples-parent,weld-jsf-login
+ </included-projects>
+ <shortDescription>Weld JSF login example</shortDescription>
+ <description>
+The example demonstrates user login/logout for an application that uses JSF.
+It will create the weld-examples-parent and weld-jsf-login project in your workspace.
+ </description>
+ <size>17532</size>
+ <
url>http://anonsvn.jboss.org/repos/jbosstools/workspace/snjeza/weld-ex...
+ <importType>maven</importType>
+ <importTypeDescription>The project example requires the m2eclipse-core,
m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
+ </project>
+</projects>
\ No newline at end of file
Modified:
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.properties
===================================================================
---
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.properties 2010-12-11
11:54:48 UTC (rev 27378)
+++
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.properties 2010-12-11
11:56:32 UTC (rev 27379)
@@ -1,4 +1,5 @@
BundleVendor = JBoss by Red Hat
BundleName = JBoss Tools Community Project Examples
JBoss_Tools_Community_Examples = JBoss Tools 3.1 Community Examples
+JBoss_Tools_Community_Maven_Examples = JBoss Tools 3.2 Community Maven Examples
JBoss_Tools_Community_BPEL_Examples=JBoss Tools Community BPEL Examples
Modified: trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml
===================================================================
---
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml 2010-12-11
11:54:48 UTC (rev 27378)
+++
trunk/examples/plugins/org.jboss.tools.community.project.examples/plugin.xml 2010-12-11
11:56:32 UTC (rev 27379)
@@ -18,4 +18,10 @@
false
</experimental>
</extension>
+ <extension
+ point="org.jboss.tools.project.examples.projectExamplesXml"
+ name="%JBoss_Tools_Community_Maven_Examples">
+
<
url>http://download.jboss.org/jbosstools/examples/project-examples-mav...
+ <experimental>false</experimental>
+ </extension>
</plugin>
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF 2010-12-11
11:54:48 UTC (rev 27378)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/META-INF/MANIFEST.MF 2010-12-11
11:56:32 UTC (rev 27379)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %BundleName
Bundle-SymbolicName: org.jboss.tools.project.examples;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.jboss.tools.project.examples.ProjectExamplesActivator
Bundle-Vendor: %BundleVendor
Require-Bundle: org.eclipse.ui,
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/plugin.xml
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/plugin.xml 2010-12-11 11:54:48
UTC (rev 27378)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/plugin.xml 2010-12-11 11:56:32
UTC (rev 27379)
@@ -2,6 +2,7 @@
<?eclipse version="3.2"?>
<plugin>
<extension-point id="projectExamplesXml"
name="%ProjectExamples" schema="schema/projectExamplesXml.exsd"/>
+ <extension-point id="importProjectExamples" name="Import Project
Examples" schema="schema/importProjectExample.exsd"/>
<extension point="org.eclipse.ui.newWizards">
<category
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/schema/importProjectExample.exsd
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/schema/importProjectExample.exsd
(rev 0)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/schema/importProjectExample.exsd 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.project.examples"
xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.project.examples"
id="importProjectExample" name="Import Project Example"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="importProjectExample"/>
+ </sequence>
+ <attribute name="point" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="importProjectExample">
+ <complexType>
+ <attribute name="name" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"
basedOn="org.jboss.tools.project.examples.model.AbstractImportProjectExample:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2010-12-11
11:54:48 UTC (rev 27378)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2010-12-11
11:56:32 UTC (rev 27379)
@@ -11,8 +11,9 @@
package org.jboss.tools.project.examples;
import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import org.eclipse.core.resources.IMarker;
@@ -20,13 +21,22 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.wst.validation.internal.operations.ValidationBuilder;
+import org.jboss.tools.project.examples.fixes.ProjectExamplesFix;
+import org.jboss.tools.project.examples.fixes.SeamRuntimeFix;
+import org.jboss.tools.project.examples.fixes.WTPRuntimeFix;
+import org.jboss.tools.project.examples.model.IImportProjectExample;
import org.jboss.tools.project.examples.model.Project;
import org.jboss.tools.project.examples.model.ProjectFix;
import org.osgi.framework.BundleContext;
@@ -44,6 +54,9 @@
public static final boolean SHOW_EXPERIMENTAL_SITES_VALUE = false;
public static final String SHOW_INVALID_SITES = "invalidSites"; //$NON-NLS-1$
public static final boolean SHOW_INVALID_SITES_VALUE = true;
+ private static final String IMPORT_PROJECT_EXAMPLES_EXTENSION_ID =
"org.jboss.tools.project.examples.importProjectExamples"; //$NON-NLS-1$
+ private static final String NAME = "name"; //$NON-NLS-1$
+ private static final String TYPE = "type"; //$NON-NLS-1$
// The shared instance
private static ProjectExamplesActivator plugin;
@@ -68,6 +81,7 @@
}
};
+ private Map<String, IImportProjectExample> importProjectExamplesMap;
/**
* The constructor
@@ -84,7 +98,7 @@
*/
public void start(BundleContext context) throws Exception {
super.start(context);
- this.context = context;
+ ProjectExamplesActivator.context = context;
plugin = this;
}
@@ -188,4 +202,62 @@
}
return projects.toArray(new IProject[0]);
}
+
+ public IImportProjectExample getImportProjectExample(String importType) {
+ initImportProjectExamples();
+ return importProjectExamplesMap.get(importType);
+ }
+
+ private void initImportProjectExamples() {
+ if (importProjectExamplesMap == null) {
+ importProjectExamplesMap = new HashMap<String,IImportProjectExample>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry
+ .getExtensionPoint(IMPORT_PROJECT_EXAMPLES_EXTENSION_ID);
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] configurationElements = extension
+ .getConfigurationElements();
+ for (int j = 0; j < configurationElements.length; j++) {
+ IConfigurationElement configurationElement = configurationElements[j];
+ IImportProjectExample importProjectExample;
+ try {
+ importProjectExample = (IImportProjectExample)
configurationElement.createExecutableExtension("class"); //$NON-NLS-1$
+ } catch (CoreException e) {
+ log(e);
+ continue;
+ }
+ String name = configurationElement.getAttribute(NAME);
+ String type = configurationElement.getAttribute(TYPE);
+ importProjectExample.setName(name);
+ importProjectExample.setType(type);
+ importProjectExamplesMap.put(type, importProjectExample);
+ }
+ }
+
+ }
+ }
+
+ public static void fix(Project project, IProgressMonitor monitor) {
+ List<ProjectFix> fixes = project.getFixes();
+ for (ProjectFix fix:fixes) {
+ ProjectExamplesFix projectExamplesFix = ProjectExamplesFixFactory.getProjectFix(fix);
+ if (projectExamplesFix != null) {
+ projectExamplesFix.fix(project, fix, monitor);
+ }
+ }
+ }
+
+ private static class ProjectExamplesFixFactory {
+ public static ProjectExamplesFix getProjectFix(ProjectFix fix) {
+ if (ProjectFix.WTP_RUNTIME.equals(fix.getType())) {
+ return new WTPRuntimeFix();
+ }
+ if (ProjectFix.SEAM_RUNTIME.equals(fix.getType())) {
+ return new SeamRuntimeFix();
+ }
+ return null;
+ }
+ }
}
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/AbstractImportProjectExample.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/AbstractImportProjectExample.java
(rev 0)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/AbstractImportProjectExample.java 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,49 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2010 JBoss by Red Hat 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.project.examples.model;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.tools.project.examples.ProjectExamplesActivator;
+
+/**
+ * @author snjeza
+ *
+ */
+
+public abstract class AbstractImportProjectExample implements
+ IImportProjectExample {
+
+ private String name;
+ private String type;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public void fix(Project project, IProgressMonitor monitor) {
+ ProjectExamplesActivator.fix(project, monitor);
+ }
+
+}
Added:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/IImportProjectExample.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/IImportProjectExample.java
(rev 0)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/IImportProjectExample.java 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,37 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2010 JBoss by Red Hat 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.project.examples.model;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @author snjeza
+ *
+ */
+public interface IImportProjectExample {
+
+ List<Project> importProject(Project projectDescription, File file,
+ IProgressMonitor monitor) throws Exception;
+
+ void fix(Project project, IProgressMonitor monitor);
+
+ void setName(String name);
+
+ void setType(String type);
+
+ String getName();
+
+ String getType();
+}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2010-12-11
11:54:48 UTC (rev 27378)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/Project.java 2010-12-11
11:56:32 UTC (rev 27379)
@@ -34,6 +34,8 @@
private List<ProjectFix> fixes = new ArrayList<ProjectFix>();
private List<ProjectFix> unsatisfiedFixes;
private String perspectiveId;
+ private String importType;
+ private String importTypeDescription;
public Project() {
name=""; //$NON-NLS-1$
@@ -42,6 +44,7 @@
url=""; //$NON-NLS-1$
welcome=false;
perspectiveId = null;
+ importType = null;
setCategory(Category.OTHER);
}
@@ -180,4 +183,20 @@
public void setPerspectiveId(String perspectiveId) {
this.perspectiveId = perspectiveId;
}
+
+ public String getImportType() {
+ return importType;
+ }
+
+ public void setImportType(String importType) {
+ this.importType = importType;
+ }
+
+ public String getImportTypeDescription() {
+ return importTypeDescription;
+ }
+
+ public void setImportTypeDescription(String importTypeDescription) {
+ this.importTypeDescription = importTypeDescription;
+ }
}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2010-12-11
11:54:48 UTC (rev 27378)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectUtil.java 2010-12-11
11:56:32 UTC (rev 27379)
@@ -294,6 +294,12 @@
if (nodeName.equals("perspectiveId")) { //$NON-NLS-1$
project.setPerspectiveId(getContent(child));
}
+ if (nodeName.equals("importType")) { //$NON-NLS-1$
+ project.setImportType(getContent(child));
+ }
+ if (nodeName.equals("importTypeDescription")) { //$NON-NLS-1$
+ project.setImportTypeDescription(getContent(child));
+ }
if (nodeName.equals("size")) { //$NON-NLS-1$
long size = 0;
try {
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2010-12-11
11:54:48 UTC (rev 27378)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizard.java 2010-12-11
11:56:32 UTC (rev 27379)
@@ -98,6 +98,7 @@
import org.jboss.tools.project.examples.dialog.MarkerDialog;
import org.jboss.tools.project.examples.fixes.SeamRuntimeFix;
import org.jboss.tools.project.examples.fixes.WTPRuntimeFix;
+import org.jboss.tools.project.examples.model.IImportProjectExample;
import org.jboss.tools.project.examples.model.Project;
import org.jboss.tools.project.examples.model.ProjectFix;
import org.jboss.tools.project.examples.model.ProjectUtil;
@@ -179,9 +180,28 @@
try {
int i = 0;
setName(Messages.NewProjectExamplesWizard_Importing);
- for (Project project : projects) {
- importProject(project, files.get(i++), monitor);
- fix(project, monitor);
+ for (final Project project : projects) {
+ if (project.getImportType() == null) {
+ importProject(project, files.get(i++), monitor);
+ ProjectExamplesActivator.fix(project, monitor);
+ } else {
+ IImportProjectExample importProjectExample =
+ ProjectExamplesActivator.getDefault().getImportProjectExample(project.getImportType());
+ if (importProjectExample == null) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+ MessageDialogWithToggle.openError(getShell(),
+ Messages.NewProjectExamplesWizard_Error,
+ "Cannot import a project of the '" + project.getImportType() +
"' type.");
+ }
+
+ });
+ return Status.OK_STATUS;
+ }
+ projects = importProjectExample.importProject(project, files.get(i++), monitor);
+ importProjectExample.fix(project, monitor);
+ }
}
} catch (final Exception e) {
@@ -203,7 +223,7 @@
};
workspaceJob.setUser(true);
- final boolean showQuickFix = page.showQuickFix();
+ final boolean showQuickFix = page.showQuickFix() && projects != null &&
projects.size() > 0;
if (showQuickFix) {
workspaceJob.addJobChangeListener(new IJobChangeListener() {
@@ -255,6 +275,7 @@
});
} else {
+ updatePerspective();
openWelcome();
}
workspaceJob.schedule();
@@ -529,20 +550,7 @@
});
}
-
- public static void fix(Project project, IProgressMonitor monitor) {
- List<ProjectFix> fixes = project.getFixes();
- for (ProjectFix fix:fixes) {
- if (ProjectFix.WTP_RUNTIME.equals(fix.getType())) {
- new WTPRuntimeFix().fix(project, fix, monitor);
- }
- if (ProjectFix.SEAM_RUNTIME.equals(fix.getType())) {
- new SeamRuntimeFix().fix(project, fix, monitor);
- }
- }
- }
-
public static void importProject(Project projectDescription, File file,
IProgressMonitor monitor) throws Exception {
if (projectDescription.getIncludedProjects() == null) {
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2010-12-11
11:54:48 UTC (rev 27378)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2010-12-11
11:56:32 UTC (rev 27379)
@@ -11,7 +11,6 @@
package org.jboss.tools.project.examples.wizard;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -64,6 +63,7 @@
import org.jboss.tools.project.examples.fixes.SeamRuntimeFix;
import org.jboss.tools.project.examples.fixes.WTPRuntimeFix;
import org.jboss.tools.project.examples.model.Category;
+import org.jboss.tools.project.examples.model.IImportProjectExample;
import org.jboss.tools.project.examples.model.Project;
import org.jboss.tools.project.examples.model.ProjectExampleSite;
import org.jboss.tools.project.examples.model.ProjectFix;
@@ -85,6 +85,7 @@
private Composite noteEmptyComposite;
private Composite noteComposite;
private List<Category> categories;
+ private Text descriptionText;
public NewProjectExamplesWizardPage() {
super("org.jboss.tools.project.examples"); //$NON-NLS-1$
@@ -150,12 +151,12 @@
Label descriptionLabel = new Label(composite,SWT.NONE);
descriptionLabel.setText(Messages.NewProjectExamplesWizardPage_Description);
- final Text descriptionText = new Text(composite,SWT.H_SCROLL | SWT.V_SCROLL
+ descriptionText = new Text(composite,SWT.H_SCROLL | SWT.V_SCROLL
| SWT.READ_ONLY | SWT.BORDER | SWT.WRAP);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gc = new GC(parent);
gd.heightHint = Dialog.convertHeightInCharsToPixels(gc
- .getFontMetrics(), 4);
+ .getFontMetrics(), 8);
gc.dispose();
descriptionText.setLayoutData(gd);
@@ -241,14 +242,12 @@
noteLabel.setImage(image);
noteText = new Text(messageComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP |
SWT.READ_ONLY);
- noteText.setText(""); //$NON-NLS-1$
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
gc = new GC(parent);
gd.heightHint = Dialog.convertHeightInCharsToPixels(gc
.getFontMetrics(), 3);
gc.dispose();
noteText.setLayoutData(gd);
- noteText.setText(Messages.NewProjectExamplesWizardPage_Note);
details = new Button(noteComposite, SWT.PUSH);
details.setText(Messages.NewProjectExamplesWizardPage_Details);
@@ -261,7 +260,7 @@
dialog.open();
}
});
-
+ setDefaultNote();
showQuickFixButton = new Button(composite,SWT.CHECK);
showQuickFixButton.setText(Messages.NewProjectExamplesWizardPage_Show_the_Quick_Fix_dialog);
showQuickFixButton.setSelection(true);
@@ -539,6 +538,21 @@
if (object instanceof Project) {
canFinish=true;
Project project = (Project) object;
+ String importType = project.getImportType();
+ if (importType != null && importType.length() > 0) {
+ IImportProjectExample importProjectExample =
ProjectExamplesActivator.getDefault().getImportProjectExample(importType);
+ if (importProjectExample == null) {
+ notesPageBook.showPage(noteComposite);
+ noteComposite.setVisible(true);
+ noteEmptyComposite.setVisible(false);
+ noteText.setText(project.getImportTypeDescription());
+ details.setEnabled(false);
+ canFinish = false;
+ break;
+ } else {
+ setDefaultNote();
+ }
+ }
if (force || project.getUnsatisfiedFixes() == null) {
List<ProjectFix> fixes = project.getFixes();
List<ProjectFix> unsatisfiedFixes = new ArrayList<ProjectFix>();
@@ -566,4 +580,9 @@
}
return canFinish;
}
+
+ private void setDefaultNote() {
+ noteText.setText(Messages.NewProjectExamplesWizardPage_Note);
+ details.setEnabled(true);
+ }
}
Added: trunk/maven/features/org.jboss.tools.maven.project.examples.feature/.project
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.project.examples.feature/.project
(rev 0)
+++
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/.project 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.project.examples.feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/build.properties
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.project.examples.feature/build.properties
(rev 0)
+++
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/build.properties 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ license.html,\
+ feature.properties
Added:
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/feature.properties
===================================================================
---
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/feature.properties
(rev 0)
+++
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/feature.properties 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,53 @@
+###############################################################################
+# Copyright (c) 2010 JBoss by Red Hat 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.
+##############################################################################
+# feature.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=JBoss Maven Project Examples
+
+# "providerName" property - name of the company that provides the feature
+providerName=JBoss by Red Hat
+
+# "updateSiteName" property - label for the update site
+updateSiteName=JBossTools Update Site
+
+# "description" property - description of the feature
+description=JBoss Maven Project Examples
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=Copyright (c) 2010 JBoss by Red Hat and others.\n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http\://www.eclipse.org/legal/epl-v10.html\n\nContributors\:\n\
+JBoss by Red Hat - Initial implementation.
+ ############### end of copyright property ####################################
+
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+# START NON-TRANSLATABLE
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=Red Hat, Inc. licenses these features and plugins to you under \
+certain open source licenses (or aggregations of such licenses), which \
+in a particular case may include the Eclipse Public License, the GNU \
+Lesser General Public License, and/or certain other open source \
+licenses. For precise licensing details, consult the corresponding \
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive, \
+Raleigh NC 27606 USA.
+# END NON-TRANSLATABLE
+########### end of license property ##########################################
Added: trunk/maven/features/org.jboss.tools.maven.project.examples.feature/feature.xml
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.project.examples.feature/feature.xml
(rev 0)
+++
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/feature.xml 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.jboss.tools.maven.project.examples.feature"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.jboss.tools.maven.project.examples">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <requires>
+ <import feature="org.maven.ide.eclipse.feature"
version="0.10.0" match="greaterOrEqual"/>
+ <import feature="org.maven.ide.eclipse.wtp.feature"
version="0.10.0" match="greaterOrEqual"/>
+ <import feature="org.jboss.tools.project.examples.feature"
version="1.2.0" match="greaterOrEqual"/>
+ </requires>
+
+ <plugin
+ id="org.jboss.tools.maven.project.examples"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
Added: trunk/maven/features/org.jboss.tools.maven.project.examples.feature/license.html
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.project.examples.feature/license.html
(rev 0)
+++
trunk/maven/features/org.jboss.tools.maven.project.examples.feature/license.html 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+
+<body>
+<p>Red Hat, Inc. licenses these features and plugins to you under
+certain open source licenses (or aggregations of such licenses), which
+in a particular case may include the Eclipse Public License, the GNU
+Lesser General Public License, and/or certain other open source
+licenses. For precise licensing details, consult the corresponding
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive,
+Raleigh NC 27606 USA.
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/maven/features/org.jboss.tools.maven.project.examples.feature/pom.xml
===================================================================
--- trunk/maven/features/org.jboss.tools.maven.project.examples.feature/pom.xml
(rev 0)
+++ trunk/maven/features/org.jboss.tools.maven.project.examples.feature/pom.xml 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,13 @@
+<project
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.features</groupId>
+ <artifactId>org.jboss.tools.maven.project.examples.feature</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-feature</packaging>
+</project>
Modified: trunk/maven/features/pom.xml
===================================================================
--- trunk/maven/features/pom.xml 2010-12-11 11:54:48 UTC (rev 27378)
+++ trunk/maven/features/pom.xml 2010-12-11 11:56:32 UTC (rev 27379)
@@ -13,6 +13,7 @@
<module>org.jboss.tools.maven.cdi.feature</module>
<module>org.jboss.tools.maven.hibernate.feature</module>
<module>org.jboss.tools.maven.portlet.feature</module>
+ <module>org.jboss.tools.maven.project.examples.feature</module>
</modules>
</project>
Modified: trunk/maven/plugins/org.jboss.tools.maven.cdi/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.cdi/plugin.properties 2010-12-11 11:54:48
UTC (rev 27378)
+++ trunk/maven/plugins/org.jboss.tools.maven.cdi/plugin.properties 2010-12-11 11:56:32
UTC (rev 27379)
@@ -1,4 +1,3 @@
-#Properties file for org.jboss.tools.maven.seam
Bundle-Vendor = JBoss by Red Hat
Bundle-Name = JBoss Maven CDI Configurator
CDI_Project_configurator = CDI Project configurator
Modified: trunk/maven/plugins/org.jboss.tools.maven.hibernate/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.hibernate/plugin.properties 2010-12-11
11:54:48 UTC (rev 27378)
+++ trunk/maven/plugins/org.jboss.tools.maven.hibernate/plugin.properties 2010-12-11
11:56:32 UTC (rev 27379)
@@ -1,4 +1,3 @@
-#Properties file for org.jboss.tools.maven.seam
Bundle-Vendor = JBoss by Red Hat
Bundle-Name = JBoss Maven Hibernate Configurator
Hibernate_Project_configurator = Hibernate Project configurator
Modified: trunk/maven/plugins/org.jboss.tools.maven.jsf/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jsf/plugin.properties 2010-12-11 11:54:48
UTC (rev 27378)
+++ trunk/maven/plugins/org.jboss.tools.maven.jsf/plugin.properties 2010-12-11 11:56:32
UTC (rev 27379)
@@ -1,4 +1,3 @@
-#Properties file for org.jboss.tools.maven.seam
Bundle-Vendor = JBoss by Red Hat
Bundle-Name = JBoss Maven JSF Configurator
JSF_Project_configurator = JSF Project configurator
Modified: trunk/maven/plugins/org.jboss.tools.maven.portlet/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.portlet/plugin.properties 2010-12-11
11:54:48 UTC (rev 27378)
+++ trunk/maven/plugins/org.jboss.tools.maven.portlet/plugin.properties 2010-12-11
11:56:32 UTC (rev 27379)
@@ -1,4 +1,3 @@
-#Properties file for org.jboss.tools.maven.seam
Bundle-Vendor = JBoss by Red Hat
Bundle-Name = JBoss Maven Portlet Configurator
Portlet_Project_configurator = Portlet Project configurator
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/.classpath
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/.classpath 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/.project
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/.project 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.project.examples</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/maven/plugins/org.jboss.tools.maven.project.examples/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.project.examples/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.project.examples/.settings/org.eclipse.jdt.core.prefs 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,73 @@
+#Fri Dec 10 14:03:48 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.jboss.tools.maven.project.examples;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.maven.project.examples.MavenProjectExamplesActivator
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.maven.core,
+ org.jboss.tools.project.examples,
+ org.eclipse.ui.ide
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-Vendor: %Bundle-Vendor
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.html
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.html
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.html 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
+<title>JBoss Maven Project Examples</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>JBoss Maven Project Examples</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a
href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a
href="http://www.jboss.org/tools">JBoss Tools project
page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a
href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License
- Version 1.0</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.ini
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.ini
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.ini 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog
(translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=jboss_about.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which
the
+# welcome page is to be opened.
+# optional
+
+
+
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.mappings
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.mappings
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.mappings 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/about.properties 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,2 @@
+blurb=JBoss Maven Project Examples\n\nVersion\: {featureVersion}\n\n(c) Copyright JBoss
by Red Hat, contributors and others 2004 - 2010. All rights reserved.\nVisit
http\://jboss.org/tools
+
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/build.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/build.properties 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ plugin.xml,\
+ about.html,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ jboss_about.png
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/jboss_about.png
===================================================================
(Binary files differ)
Property changes on:
trunk/maven/plugins/org.jboss.tools.maven.project.examples/jboss_about.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/plugin.properties
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.project.examples/plugin.properties 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,2 @@
+Bundle-Vendor = JBoss by Red Hat
+Bundle-Name = JBoss Maven Project Examples
Added: trunk/maven/plugins/org.jboss.tools.maven.project.examples/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/plugin.xml
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/plugin.xml 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.jboss.tools.project.examples.importProjectExamples">
+ <importProjectExample
+
class="org.jboss.tools.maven.project.examples.ImportMavenProjectExample"
+ name="Import Maven Project Examples"
+ type="maven">
+ </importProjectExample>
+ </extension>
+
+</plugin>
Added:
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExample.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExample.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExample.java 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,414 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2010 JBoss by Red Hat 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.maven.project.examples;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.maven.model.Model;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.progress.IProgressConstants;
+import org.jboss.tools.project.examples.model.AbstractImportProjectExample;
+import org.jboss.tools.project.examples.model.Project;
+import org.maven.ide.eclipse.MavenPlugin;
+import org.maven.ide.eclipse.actions.OpenMavenConsoleAction;
+import org.maven.ide.eclipse.core.IMavenConstants;
+import org.maven.ide.eclipse.core.MavenConsole;
+import org.maven.ide.eclipse.embedder.IMaven;
+import org.maven.ide.eclipse.embedder.MavenModelManager;
+import org.maven.ide.eclipse.project.AbstractProjectScanner;
+import org.maven.ide.eclipse.project.IMavenProjectImportResult;
+import org.maven.ide.eclipse.project.LocalProjectScanner;
+import org.maven.ide.eclipse.project.MavenProjectInfo;
+import org.maven.ide.eclipse.project.ProjectImportConfiguration;
+import org.maven.ide.eclipse.project.ResolverConfiguration;
+
+/**
+ * @author snjeza
+ *
+ */
+public class ImportMavenProjectExample extends AbstractImportProjectExample {
+
+ private static final String UNNAMED_PROJECTS = "UnnamedProjects";
//$NON-NLS-1$
+
+ private static final String JBOSS_TOOLS_MAVEN_PROJECTS =
"/.JBossToolsMavenProjects"; //$NON-NLS-1$
+
+ private boolean confirm;
+
+ @Override
+ public List<Project> importProject(Project projectDescription, File file,
+ IProgressMonitor monitor) throws Exception {
+ List<Project> projects = new ArrayList<Project>();
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IPath rootPath = workspaceRoot.getLocation();
+ IPath mavenProjectsRoot = rootPath.append(JBOSS_TOOLS_MAVEN_PROJECTS);
+ String projectName = projectDescription.getName();
+ if (projectName == null || projectName.isEmpty()) {
+ projectName = UNNAMED_PROJECTS;
+ }
+ IPath path = mavenProjectsRoot.append(projectName);
+ final File destination = new File(path.toOSString());
+ if (destination.exists()) {
+ final List<IProject> existingProjects = getExistingProjects(destination);
+ if (existingProjects.size() > 0) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ String title = "Overwrite";
+ String msg = getMessage(destination, existingProjects);
+ confirm = MessageDialog.openQuestion(getActiveShell(),
+ title, msg);
+ }
+ });
+ if (confirm) {
+ monitor.setTaskName("Deleting ...");
+ for (IProject project:existingProjects) {
+ monitor.setTaskName("Deleting " + project.getName());
+ project.delete(false, true, monitor);
+ }
+ } else {
+ return projects;
+ }
+ }
+ boolean deleted = deleteDirectory(destination, monitor);
+ if (monitor.isCanceled()) {
+ return projects;
+ }
+ if (!deleted) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ MessageDialog.openError(getActiveShell(),
+ "Error", "Cannot delete the '" + destination +
"' file.");
+ }
+ });
+ return projects;
+ }
+ }
+ boolean ok = extractFile(file, destination, monitor);
+ monitor.setTaskName("");
+ if (monitor.isCanceled()) {
+ return projects;
+ }
+ if (!ok) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ MessageDialog.openError(getActiveShell(),
+ "Error",
+ "Cannot extract the archive.");
+ }
+ });
+ return projects;
+ }
+
+ importMavenProjects(destination);
+ return projects;
+ }
+
+ private void importMavenProjects(final File destination) {
+ Job job = new WorkspaceJob("Importing Maven projects") {
+ public IStatus runInWorkspace(IProgressMonitor monitor) {
+ setProperty(IProgressConstants.ACTION_PROPERTY,
+ new OpenMavenConsoleAction());
+ MavenPlugin plugin = MavenPlugin.getDefault();
+ try {
+ AbstractProjectScanner<MavenProjectInfo> projectScanner =
getProjectScanner(destination);
+ projectScanner.run(monitor);
+ List<MavenProjectInfo> mavenProjects = projectScanner
+ .getProjects();
+ List<MavenProjectInfo> infos = new ArrayList<MavenProjectInfo>();
+ infos.addAll(mavenProjects);
+ addMavenProjects(infos, mavenProjects);
+ final List<IProject> existingProjects = new ArrayList<IProject>();
+ ProjectImportConfiguration importConfiguration = new ProjectImportConfiguration();
+ for(MavenProjectInfo info:infos) {
+ String projectName = getProjectName(info, importConfiguration);
+ IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project != null && project.exists()) {
+ existingProjects.add(project);
+ }
+ }
+ if (existingProjects.size() > 0) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ String message = getWorkspaceMessage(existingProjects);
+
+ confirm = MessageDialog.openConfirm(getActiveShell(),
+ "Confirmation", message);
+ }
+ });
+ if (confirm) {
+ for (IProject project:existingProjects) {
+ try {
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch (Exception e) {
+ // ignore
+ }
+ project.delete(true, true, monitor);
+ }
+ } else {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ plugin.getProjectConfigurationManager().importProjects(
+ infos, importConfiguration, monitor);
+ } catch (CoreException ex) {
+ plugin.getConsole().logError("Projects imported with errors");
+ return ex.getStatus();
+ } catch (InterruptedException e) {
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setRule(MavenPlugin.getDefault().getProjectConfigurationManager()
+ .getRule());
+ job.schedule();
+ }
+
+ private List<MavenProjectInfo> addMavenProjects(List<MavenProjectInfo>
infos, List<MavenProjectInfo> mavenProjects) {
+ if (mavenProjects == null || mavenProjects.isEmpty()) {
+ return mavenProjects;
+ }
+ for (MavenProjectInfo projectInfo:mavenProjects) {
+ Collection<MavenProjectInfo> projects = projectInfo.getProjects();
+ if (projects != null && !projects.isEmpty()) {
+ for(MavenProjectInfo info:projects) {
+ infos.add(info);
+ }
+ List<MavenProjectInfo> childProjects = new
ArrayList<MavenProjectInfo>();
+ childProjects.addAll(projects);
+ addMavenProjects(infos, childProjects);
+ }
+ }
+ return mavenProjects;
+ }
+
+ private AbstractProjectScanner<MavenProjectInfo> getProjectScanner(
+ File folder) {
+ File root = ResourcesPlugin.getWorkspace().getRoot().getLocation()
+ .toFile();
+ MavenPlugin mavenPlugin = MavenPlugin.getDefault();
+ MavenModelManager modelManager = mavenPlugin.getMavenModelManager();
+ MavenConsole console = mavenPlugin.getConsole();
+ return new LocalProjectScanner(root, folder.getAbsolutePath(), false,
+ modelManager, console);
+ }
+
+ private static Shell getActiveShell() {
+ return Display.getDefault().getActiveShell();
+ }
+
+ public boolean extractFile(File file, File destination,
+ IProgressMonitor monitor) {
+ ZipFile zipFile = null;
+ destination.mkdirs();
+ try {
+ zipFile = new ZipFile(file);
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ if (monitor.isCanceled()) {
+ return false;
+ }
+ ZipEntry entry = (ZipEntry) entries.nextElement();
+ if (entry.isDirectory()) {
+ monitor.setTaskName("Extracting " + entry.getName());
+ File dir = new File(destination, entry.getName());
+ dir.mkdirs();
+ continue;
+ }
+ monitor.setTaskName("Extracting " + entry.getName());
+ File entryFile = new File(destination, entry.getName());
+ entryFile.getParentFile().mkdirs();
+ InputStream in = null;
+ OutputStream out = null;
+ try {
+ in = zipFile.getInputStream(entry);
+ out = new FileOutputStream(entryFile);
+ copy(in, out);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ }
+ }
+ } catch (IOException e) {
+ MavenProjectExamplesActivator.log(e);
+ return false;
+ } finally {
+ if (zipFile != null) {
+ try {
+ zipFile.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ return true;
+ }
+
+ public static void copy(InputStream in, OutputStream out) throws IOException {
+ byte[] buffer = new byte[16 * 1024];
+ int len;
+ while ((len = in.read(buffer)) >= 0) {
+ out.write(buffer, 0, len);
+ }
+ }
+
+ private static boolean deleteDirectory(File path, IProgressMonitor monitor) {
+ if (path.exists()) {
+ File[] files = path.listFiles();
+ for (File file : files) {
+ if (monitor.isCanceled()) {
+ return false;
+ }
+ monitor.setTaskName("Deleting " + file);
+ if (file.isDirectory()) {
+ deleteDirectory(file, monitor);
+ } else {
+ file.delete();
+ }
+ }
+ }
+ return (path.delete());
+ }
+
+ private String getProjectName(MavenProjectInfo projectInfo,
+ ProjectImportConfiguration configuration) throws CoreException {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+
+ File pomFile = projectInfo.getPomFile();
+ Model model = projectInfo.getModel();
+ IMaven maven = MavenPlugin.getDefault().getMaven();
+ if (model == null) {
+ model = maven.readModel(pomFile);
+ projectInfo.setModel(model);
+ }
+
+ String projectName = configuration.getProjectName(model);
+
+ File projectDir = pomFile.getParentFile();
+ String projectParent = projectDir.getParentFile().getAbsolutePath();
+
+ if (projectInfo.getBasedirRename() == MavenProjectInfo.RENAME_REQUIRED) {
+ File newProject = new File(projectDir.getParent(), projectName);
+ if (!projectDir.equals(newProject)) {
+ projectDir = newProject;
+ }
+ } else {
+ if (projectParent.equals(root.getLocation().toFile()
+ .getAbsolutePath())) {
+ projectName = projectDir.getName();
+ }
+ }
+ return projectName;
+ }
+
+ private List<IProject> getExistingProjects(final File destination) {
+ List<IProject> existingProjects = new ArrayList<IProject>();
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (IProject project:projects) {
+ if (project != null && project.exists()) {
+ File projectFile = project.getLocation().toFile();
+ if (projectFile.getAbsolutePath().startsWith(destination.getAbsolutePath())) {
+ existingProjects.add(project);
+ }
+ }
+ }
+ return existingProjects;
+ }
+
+ private String getMessage(final File destination, List<IProject> projects) {
+ if (projects.size() > 0) {
+ StringBuilder builder = new StringBuilder();
+ if (projects.size() == 1) {
+ builder.append("\nThere is the '" + projects.get(0).getName() +
+ "' project on the destination location:\n\n");
+ builder.append("Would you like to overwrite it?");
+ } else {
+ builder.append("\nThere are the following projects on the destination
location:\n\n");
+ for (IProject project : projects) {
+ builder.append(project.getName());
+ builder.append("\n"); //$NON-NLS-1$
+ }
+ builder.append("\n"); //$NON-NLS-1$
+ builder.append("Would you like to overwrite them?");
+ }
+ return builder.toString();
+ }
+ return null;
+ }
+
+ private String getWorkspaceMessage(
+ final List<IProject> existingProjects) {
+ StringBuilder builder = new StringBuilder();
+ if (existingProjects.size() == 1) {
+ builder.append("There is the '" + existingProjects.get(0).getName() +
+ "' project in the workspace.\n\n");
+ builder.append("Would you like to delete it?");
+ } else {
+ builder.append("There are the following projects in the workspace:\n\n");
+ for (IProject project:existingProjects) {
+ builder.append(project.getName());
+ builder.append("\n"); //$NON-NLS-1$
+ }
+ builder.append("\n"); //$NON-NLS-1$
+ builder.append("Would you like to delete them?");
+ }
+ return builder.toString();
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/MavenProjectExamplesActivator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/MavenProjectExamplesActivator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/MavenProjectExamplesActivator.java 2010-12-11
11:56:32 UTC (rev 27379)
@@ -0,0 +1,62 @@
+package org.jboss.tools.maven.project.examples;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class MavenProjectExamplesActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID =
"org.jboss.tools.maven.project.examples"; //$NON-NLS-1$
+
+ // The shared instance
+ private static MavenProjectExamplesActivator plugin;
+
+ /**
+ * The constructor
+ */
+ public MavenProjectExamplesActivator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static MavenProjectExamplesActivator getDefault() {
+ return plugin;
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e
+ .getLocalizedMessage(), e);
+ getDefault().getLog().log(status);
+ }
+
+ public static void log(Throwable e, String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ getDefault().getLog().log(status);
+ }
+}
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.properties 2010-12-11 11:54:48 UTC
(rev 27378)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.properties 2010-12-11 11:56:32 UTC
(rev 27379)
@@ -1,4 +1,3 @@
-
Bundle-Vendor = JBoss by Red Hat
Bundle-Name = JBoss Maven Integration
JBoss_Maven_Integration = JBoss Maven Integration
\ No newline at end of file
Modified: trunk/maven/plugins/pom.xml
===================================================================
--- trunk/maven/plugins/pom.xml 2010-12-11 11:54:48 UTC (rev 27378)
+++ trunk/maven/plugins/pom.xml 2010-12-11 11:56:32 UTC (rev 27379)
@@ -14,6 +14,7 @@
<module>org.jboss.tools.maven.cdi</module>
<module>org.jboss.tools.maven.hibernate</module>
<module>org.jboss.tools.maven.portlet</module>
+ <module>org.jboss.tools.maven.project.examples</module>
</modules>
</project>