Author: snjeza
Date: 2012-05-21 13:10:30 -0400 (Mon, 21 May 2012)
New Revision: 41217
Added:
workspace/snjeza/quickstarts/quickstart.zip
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java
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/messages.properties
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleUtil.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencesInitializer.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/Sites.java
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesMainPage.java
trunk/examples/tests/org.jboss.tools.project.examples.test/src/org/jboss/tools/project/examples/test/SiteTest.java
trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExampleDelegate.java
Log:
JBIDE-11727 - explore providing an .project_example.xml file in root of quickstarts
distributions for easy loading/detection in jboss tools
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/Messages.java 2012-05-21
17:10:30 UTC (rev 41217)
@@ -69,6 +69,7 @@
public static String ProjectExamplesPreferencePage_Output_directory;
public static String ProjectExamplesPreferencePage_Remove;
public static String ProjectExamplesPreferencePage_Show_experimental_sites;
+ public static String ProjectExamplesPreferencePage_Show_server_sites;
public static String ProjectExamplesPreferencePage_Show_invalid_sites;
public static String ProjectExamplesPreferencePage_Sites;
public static String ProjectExamplesPreferencePage_Use_default_workspace_location;
@@ -95,6 +96,7 @@
public static String SiteDialog_URL;
public static String Sites_Plugin_provided_sites;
public static String Sites_User_sites;
+ public static String Sites_Server_sites;
public static String InvalideSite;
public static String WTPRuntimeFix_Invalid_WTP_runtime_fix;
static {
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 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/ProjectExamplesActivator.java 2012-05-21
17:10:30 UTC (rev 41217)
@@ -162,8 +162,10 @@
public static final String ALL_RUNTIMES = Messages.ProjectExamplesActivator_All;
public static final String SHOW_EXPERIMENTAL_SITES = "showExperimentalSites";
//$NON-NLS-1$
+ public static final String SHOW_SERVER_SITES = "showServerSites";
//$NON-NLS-1$
public static final String USER_SITES = "userSites"; //$NON-NLS-1$
public static final boolean SHOW_EXPERIMENTAL_SITES_VALUE = false;
+ public static final boolean SHOW_SERVER_SITES_VALUE = false;
public static final String SHOW_INVALID_SITES = "invalidSites"; //$NON-NLS-1$
public static final boolean SHOW_INVALID_SITES_VALUE = true;
public static final String MAVEN_ARCHETYPE = "mavenArchetype"; //$NON-NLS-1$
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/messages.properties 2012-05-21
17:10:30 UTC (rev 41217)
@@ -32,7 +32,7 @@
NewProjectExamplesWizard_New_Project_Example=New Project Example
NewProjectExamplesWizard_OverwriteProject=Overwrite project ''{0}''
NewProjectExamplesWizard_Question=Question
-NewProjectExamplesWizardPage_Cannot_access_the_following_sites=Cannot access the
following sites\:\n\n
+NewProjectExamplesWizardPage_Cannot_access_the_following_sites=Cannot read the following
sites\:\n\n
NewProjectExamplesWizardPage_Description=Description:
NewProjectExamplesWizardPage_Details=Details...
NewProjectExamplesWizardPage_Import_Project_Example=Import Project Example
@@ -56,6 +56,7 @@
ProjectExamplesPreferencePage_Output_directory=Output directory
ProjectExamplesPreferencePage_Remove=Remove
ProjectExamplesPreferencePage_Show_experimental_sites=Show experimental sites
+ProjectExamplesPreferencePage_Show_server_sites=Show server sites
ProjectExamplesPreferencePage_Show_invalid_sites=Show invalid sites
ProjectExamplesPreferencePage_Sites=Sites
ProjectExamplesPreferencePage_Use_default_workspace_location=Use default location
@@ -83,5 +84,6 @@
SiteDialog_URL=URL:
Sites_Plugin_provided_sites=Plugin provided sites
Sites_User_sites=User sites
+Sites_Server_sites=Server sites
WTPRuntimeFix_Invalid_WTP_runtime_fix=Invalid WTP runtime fix in {0}.
InvalideSite=Invalid site: {0},url={1}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleUtil.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleUtil.java 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/model/ProjectExampleUtil.java 2012-05-21
17:10:30 UTC (rev 41217)
@@ -14,6 +14,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
+import java.io.FileFilter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -47,9 +48,14 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.tools.project.examples.Messages;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.filetransfer.ECFExamplesTransport;
@@ -66,6 +72,8 @@
*/
public class ProjectExampleUtil {
+ private static final String SERVER_PROJECT_EXAMPLE_XML =
".project_example.xml";
+
private static final String URL = "url"; //$NON-NLS-1$
private static final String NAME = "name"; //$NON-NLS-1$
@@ -137,6 +145,66 @@
return pluginSites;
}
+ public static Set<IProjectExampleSite> getServerSites() {
+ Set<IProjectExampleSite> sites = new HashSet<IProjectExampleSite>();
+ IPreferenceStore store = ProjectExamplesActivator.getDefault()
+ .getPreferenceStore();
+ if (!store.getBoolean(ProjectExamplesActivator.SHOW_SERVER_SITES)) {
+ return sites;
+ }
+ IServer[] servers = ServerCore.getServers();
+ for (IServer server:servers) {
+ IRuntime runtime = server.getRuntime();
+ if (runtime == null) {
+ continue;
+ }
+ IJBossServerRuntime jbossRuntime =
(IJBossServerRuntime)runtime.loadAdapter(IJBossServerRuntime.class, new
NullProgressMonitor());
+ if (jbossRuntime == null) {
+ continue;
+ }
+ IPath jbossLocation = runtime.getLocation();
+ if (jbossRuntime.getRuntime() == null) {
+ continue;
+ }
+ String name = jbossRuntime.getRuntime().getName() + " Project Examples";
+ File serverHome = jbossLocation.toFile();
+ File file = getFile(serverHome, true);
+ if (file != null) {
+ ProjectExampleSite site = new ProjectExampleSite();
+ site.setExperimental(false);
+ site.setName(name);
+ try {
+ site.setUrl(file.toURI().toURL());
+ sites.add(site);
+ } catch (MalformedURLException e) {
+ ProjectExamplesActivator.log(e.getMessage());
+ }
+ }
+ }
+ return sites;
+ }
+ private static File getFile(File serverHome, boolean b) {
+ if (!serverHome.isDirectory()) {
+ return null;
+ }
+ File[] directories = serverHome.listFiles(new FileFilter() {
+
+ @Override
+ public boolean accept(File pathname) {
+ return pathname.isDirectory();
+ }
+ });
+ if (directories != null && directories.length > 0) {
+ for (File directory:directories) {
+ File projectExampleFile = new File(directory, SERVER_PROJECT_EXAMPLE_XML);
+ if (projectExampleFile.isFile()) {
+ return projectExampleFile;
+ }
+ }
+ }
+ return null;
+ }
+
public static Set<IProjectExampleSite> getUserSites() {
Set<IProjectExampleSite> sites = new HashSet<IProjectExampleSite>();
ProjectExampleSite site = getSite(getProjectExamplesXml());
@@ -193,6 +261,7 @@
Set<IProjectExampleSite> sites = new HashSet<IProjectExampleSite>();
sites.addAll(getPluginSites());
sites.addAll(getUserSites());
+ sites.addAll(getServerSites());
return sites;
}
@@ -265,10 +334,17 @@
continue;
}
- DocumentBuilderFactory dbf = DocumentBuilderFactory
- .newInstance();
- DocumentBuilder db = dbf.newDocumentBuilder();
- Document doc = db.parse(file);
+ Document doc;
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory
+ .newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ doc = db.parse(file);
+ } catch (Exception e) {
+ ProjectExamplesActivator.log(e);
+ invalidSites.add(site);
+ continue;
+ }
NodeList projects = doc.getElementsByTagName("project"); //$NON-NLS-1$
int len = projects.getLength();
for (int i = 0; i < len; i++) {
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencePage.java 2012-05-21
17:10:30 UTC (rev 41217)
@@ -56,6 +56,7 @@
public static final String ID =
"org.jboss.tools.project.examples.preferences.projectExamplesPreferencePage";
//$NON-NLS-1$
private Button showExperimentalSites;
+ private Button showServerSites;
private Sites sites;
private TreeViewer viewer;
private ProjectExampleSite selectedSite;
@@ -145,6 +146,10 @@
showExperimentalSites.setText(Messages.ProjectExamplesPreferencePage_Show_experimental_sites);
showExperimentalSites.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES));
+ showServerSites = new Button(composite,SWT.CHECK);
+ showServerSites.setText(Messages.ProjectExamplesPreferencePage_Show_server_sites);
+ showServerSites.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_SERVER_SITES));
+
showInvalidSites = new Button(composite,SWT.CHECK);
showInvalidSites.setText(Messages.ProjectExamplesPreferencePage_Show_invalid_sites);
showInvalidSites.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_INVALID_SITES));
@@ -281,10 +286,12 @@
showQuickFix.setSelection(ProjectExamplesActivator.SHOW_QUICK_FIX_VALUE);
showExperimentalSites.setSelection(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES_VALUE);
+ showServerSites.setSelection(ProjectExamplesActivator.SHOW_SERVER_SITES_VALUE);
showInvalidSites.setSelection(ProjectExamplesActivator.SHOW_INVALID_SITES_VALUE);
isWorkspace.setSelection(ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT_VALUE);
outputDirectoryText.setText(""); //$NON-NLS-1$
sites.getUserSites().clear();
+ sites.getServerSites().clear();
storePreferences();
super.performDefaults();
}
@@ -302,6 +309,8 @@
store.setValue(ProjectExamplesActivator.SHOW_QUICK_FIX, showQuickFix.getSelection());
store.setValue(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES,
showExperimentalSites.getSelection());
+ store.setValue(ProjectExamplesActivator.SHOW_SERVER_SITES,
showServerSites.getSelection());
+
store.setValue(ProjectExamplesActivator.SHOW_INVALID_SITES,
showInvalidSites.getSelection());
store.setValue(ProjectExamplesActivator.PROJECT_EXAMPLES_DEFAULT,
isWorkspace.getSelection());
String value = outputDirectoryText.getText();
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencesInitializer.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencesInitializer.java 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/ProjectExamplesPreferencesInitializer.java 2012-05-21
17:10:30 UTC (rev 41217)
@@ -47,6 +47,10 @@
node.putBoolean(
ProjectExamplesActivator.SHOW_QUICK_FIX,
ProjectExamplesActivator.SHOW_QUICK_FIX_VALUE);
+
+ node.putBoolean(
+ ProjectExamplesActivator.SHOW_SERVER_SITES,
+ ProjectExamplesActivator.SHOW_SERVER_SITES_VALUE);
}
}
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/Sites.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/Sites.java 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/preferences/Sites.java 2012-05-21
17:10:30 UTC (rev 41217)
@@ -27,22 +27,32 @@
public class Sites {
private SiteCategory[] siteCategories;
private SiteCategory userSite;
+ private SiteCategory serverSite;
private Set<IProjectExampleSite> sites;
public SiteCategory[] getSiteCategories() {
if (siteCategories == null) {
- siteCategories = new SiteCategory[2];
+ siteCategories = new SiteCategory[3];
+
userSite = new SiteCategory(Messages.Sites_User_sites);
Set<IProjectExampleSite> userSites = ProjectExampleUtil.getUserSites();
userSite.setSites(userSites);
+
siteCategories[0]=userSite;
SiteCategory pluginSite = new SiteCategory(Messages.Sites_Plugin_provided_sites);
Set<IProjectExampleSite> pluginSites = ProjectExampleUtil.getPluginSites();
pluginSite.setSites(pluginSites);
siteCategories[1]=pluginSite;
+
+ serverSite = new SiteCategory(Messages.Sites_Server_sites);
+ Set<IProjectExampleSite> serverSites = ProjectExampleUtil.getServerSites();
+ serverSite.setSites(serverSites);
+ siteCategories[2]= serverSite;
+
sites = new HashSet<IProjectExampleSite>();
sites.addAll(pluginSites);
sites.addAll(userSites);
+ sites.addAll(serverSites);
}
return siteCategories;
}
@@ -64,4 +74,8 @@
public Set<IProjectExampleSite> getUserSites() {
return userSite.getSites();
}
+
+ public Set<IProjectExampleSite> getServerSites() {
+ return serverSite.getSites();
+ }
}
\ No newline at end of file
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesMainPage.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesMainPage.java 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesMainPage.java 2012-05-21
17:10:30 UTC (rev 41217)
@@ -109,6 +109,13 @@
final IPreferenceStore store =
ProjectExamplesActivator.getDefault().getPreferenceStore();
button.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES));
+ final Button serverButton = new Button(siteComposite,SWT.CHECK);
+ gd = new GridData(SWT.FILL, SWT.BEGINNING, false, false);
+ gd.horizontalSpan = 2;
+ serverButton.setLayoutData(gd);
+ serverButton.setText(Messages.ProjectExamplesPreferencePage_Show_server_sites);
+ serverButton.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_SERVER_SITES));
+
new Label(siteComposite,SWT.NONE).setText(Messages.NewProjectExamplesWizardPage_Site);
siteCombo = new Combo(siteComposite,SWT.READ_ONLY);
siteCombo.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
@@ -254,7 +261,30 @@
});
-
+ serverButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
+ store.setValue(ProjectExamplesActivator.SHOW_SERVER_SITES,
serverButton.getSelection());
+
+ //Store current combo selections
+ String selectedRuntime = targetRuntimeTypesCombo.getText();
+ String selectedSite = siteCombo.getText();
+
+ //Rebuild the combo lists
+ refresh(viewer, true);
+
+ //Restore the combo selections with initial values if possible
+ restoreCombo(targetRuntimeTypesCombo, selectedRuntime);
+ restoreCombo(siteCombo, selectedSite);
+
+ siteFilter.setSite(siteCombo.getText());
+ viewer.refresh();
+ }
+
+ });
+
targetRuntimeTypesCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Modified:
trunk/examples/tests/org.jboss.tools.project.examples.test/src/org/jboss/tools/project/examples/test/SiteTest.java
===================================================================
---
trunk/examples/tests/org.jboss.tools.project.examples.test/src/org/jboss/tools/project/examples/test/SiteTest.java 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/examples/tests/org.jboss.tools.project.examples.test/src/org/jboss/tools/project/examples/test/SiteTest.java 2012-05-21
17:10:30 UTC (rev 41217)
@@ -17,7 +17,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.jboss.tools.project.examples.model.IProjectExampleSite;
-import org.jboss.tools.project.examples.model.ProjectExampleSite;
import org.jboss.tools.project.examples.model.ProjectExampleUtil;
import org.junit.Test;
@@ -33,6 +32,7 @@
Set<IProjectExampleSite> sites = new HashSet<IProjectExampleSite>();
sites.addAll(ProjectExampleUtil.getPluginSites());
sites.addAll(ProjectExampleUtil.getUserSites());
+ sites.addAll(ProjectExampleUtil.getServerSites());
assertTrue(sites.size() > 0);
}
Modified: 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 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF 2012-05-21
17:10:30 UTC (rev 41217)
@@ -16,7 +16,8 @@
org.eclipse.ui.forms,
org.jboss.ide.eclipse.as.core;bundle-version="2.3.0",
org.eclipse.wst.server.core,
- org.jboss.tools.maven.ui;bundle-version="1.3.0"
+ org.jboss.tools.maven.ui;bundle-version="1.3.0",
+ org.eclipse.core.filesystem;bundle-version="1.3.100"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %Bundle-Vendor
Modified:
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExampleDelegate.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExampleDelegate.java 2012-05-21
17:08:42 UTC (rev 41216)
+++
trunk/maven/plugins/org.jboss.tools.maven.project.examples/src/org/jboss/tools/maven/project/examples/ImportMavenProjectExampleDelegate.java 2012-05-21
17:10:30 UTC (rev 41217)
@@ -17,12 +17,17 @@
import java.util.Map;
import org.apache.maven.model.Model;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
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.core.runtime.Platform;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.m2e.core.MavenPlugin;
@@ -34,6 +39,7 @@
import org.eclipse.m2e.core.ui.internal.actions.OpenMavenConsoleAction;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
import org.jboss.tools.maven.ui.Activator;
import org.jboss.tools.project.examples.ProjectExamplesActivator;
import org.jboss.tools.project.examples.model.ProjectExample;
@@ -98,7 +104,21 @@
return false;
}
}
- boolean ok = ProjectExamplesActivator.extractZipFile(file, destination, monitor);
+ boolean ok = false;
+ if (file.isFile()) {
+ ok = ProjectExamplesActivator.extractZipFile(file, destination, monitor);
+ }
+ if (file.isDirectory()) {
+ destination.mkdirs();
+ IFileStore descStore = EFS.getLocalFileSystem().fromLocalFile(destination);
+ IFileStore srcStore = EFS.getLocalFileSystem().fromLocalFile(file);
+ try {
+ srcStore.copy(descStore, EFS.OVERWRITE, monitor);
+ ok = true;
+ } catch (Exception e) {
+ MavenProjectExamplesActivator.log(e);
+ }
+ }
monitor.setTaskName("");
if (monitor.isCanceled()) {
return false;
@@ -110,7 +130,7 @@
public void run() {
MessageDialog.openError(getActiveShell(),
"Error",
- "Cannot extract the archive.");
+ "Cannot extract/copy the archive.");
}
});
return false;
@@ -156,7 +176,6 @@
private List<String> importMavenProjects(final File destination,
final ProjectExample projectDescription, IProgressMonitor monitor) {
List<String> projectNames = new ArrayList<String>();
- MavenPlugin plugin = MavenPlugin.getDefault();
try {
AbstractProjectScanner<MavenProjectInfo> projectScanner =
getProjectScanner(destination);
projectScanner.run(monitor);
@@ -299,7 +318,7 @@
if (project != null && project.exists()) {
File projectFile = project.getLocation().toFile();
File projectParent = projectFile.getParentFile();
- if (projectParent.equals(destination)) {
+ if (projectParent.equals(destination) || projectFile.equals(destination)) {
existingProjects.add(project);
}
}
Added: workspace/snjeza/quickstarts/quickstart.zip
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/quickstarts/quickstart.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream