Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames2002-04-17 20:44:11 -0400
committerjames2002-04-17 20:44:11 -0400
commitbbe748e98d0588208785d10de478b4be9f5aebd2 (patch)
treea4542534a46cde29535d2096b2004dbfc60e889d
parent6de9d4ad62328bb67ebddd2d777901dd4e9f7af7 (diff)
downloadeclipse.platform.team-bbe748e98d0588208785d10de478b4be9f5aebd2.tar.gz
eclipse.platform.team-bbe748e98d0588208785d10de478b4be9f5aebd2.tar.xz
eclipse.platform.team-bbe748e98d0588208785d10de478b4be9f5aebd2.zip
First crack at serialized referencing
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml1
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java58
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/ISerializedReferencing.java35
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java10
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java28
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java180
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties2
-rw-r--r--bundles/org.eclipse.team.ui/.classpath1
-rw-r--r--bundles/org.eclipse.team.ui/.project49
-rw-r--r--bundles/org.eclipse.team.ui/icons/basic/clcl16/projectset.gifbin0 -> 165 bytes
-rw-r--r--bundles/org.eclipse.team.ui/icons/full/clcl16/projectset.gifbin0 -> 242 bytes
-rw-r--r--bundles/org.eclipse.team.ui/plugin.properties7
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml33
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java174
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java113
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java87
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java160
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java110
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamWizardPage.java107
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties20
22 files changed, 1111 insertions, 73 deletions
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index 842372ad4..444480926 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -19,6 +19,7 @@
<extension-point id="fileTypes" name="File Types Registry"/>
<extension-point id="ignore" name="Global Ignore Registry"/>
+<extension-point id="projectSets" name="Project Sets"/>
<!-- Define some example text extensions. This will be done
by other plugins later. -->
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java
new file mode 100644
index 000000000..8b33861e5
--- /dev/null
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/IProjectSetSerializer.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * IProjectSetSerializer manages the serializing and deserializing
+ * of references to projects. Given a project, it can produce a
+ * UTF-8 encoded String which can be stored in a file.
+ * Given this String, it can create in the workspace an IProject.
+ */
+
+public interface IProjectSetSerializer {
+
+ /**
+ * For every IProject in providerProjects, return an opaque
+ * UTF-8 encoded String to act as a reference to that project.
+ * The format of the String is specific to the provider.
+ * The format of the String must be such that
+ * IProjectSetSerializer.addToWorskpace() will be able to
+ * consume it and recreate a corresponding project.
+ * @see IProjectSetSerializer.addToWorkspace()
+ *
+ * @param providerProjects an array of projects that the serializer should create
+ * text references for
+ * @param context a UI context object
+ * @return an array of serialized reference strings uniquely identifying the projects
+ */
+ public String[] asReference(IProject[] providerProjects, Object context) throws TeamException;
+
+ /**
+ * For every String in referenceStrings, create in the workspace a
+ * corresponding IProject. Return an Array of the resulting IProjects.
+ * Result is unspecified in the case where an IProject of that name
+ * already exists. In the case of failure, a TeamException must be thrown.
+ * The opaque strings in referenceStrings are guaranteed to have been previously
+ * produced by IProjectSetSerializer.asReference().
+ * @see IProjectSetSerializer.asReference()
+ *
+ * @param referenceStrings an array of referene strings uniquely identifying the projects
+ * @param filename the name of the file that the references were read from. This is included
+ * in case the provider needs to deduce relative paths
+ * @param context a UI context object
+ * @param monitor a progress monitor
+ * @return an array of projects that were created
+ */
+ public IProject[] addToWorkspace(String[] referenceStrings, String filename, Object context, IProgressMonitor monitor) throws TeamException;
+}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ISerializedReferencing.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ISerializedReferencing.java
deleted file mode 100644
index a612fb6d8..000000000
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/ISerializedReferencing.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.team.core;
-
-import org.eclipse.core.resources.IProject;
-
-/**
- * ISerializedReferencing manages the serializing and deserializing
- * of references to projects. Given a project, it can produce a
- * UTF-8 encoded String which can be stored in a file.
- * Given this String, it can create in the workspace an IProject.
- */
-
-public interface ISerializedReferencing {
-
- /**
- * For every IProject in providerProjects, return an opaque
- * UTF-8 encoded String to act as a reference to that project.
- * The format of the String is specific to the provider.
- * The format of the String must be such that
- * ISerializedReferencing.addToWorskpace() will be able to
- * consume it and recreate a corresponding project.
- * @see ISerializedReferencing.addToWorkspace()
- */
- public String[] asReference(IProject[] providerProjects) throws TeamException;
-
- /**
- * For every String in referenceStrings, create in the workspace a
- * corresponding IProject. Return an Array of the resulting IProjects.
- * Result is unspecified in the case where an IProject of that name
- * already exists. In the case of failure, a TeamException must be thrown.
- * The opaque strings in referenceStrings are guaranteed to have been previously
- * produced by ISerializedReferencing.asReference().
- * @see ISerializedReferencing.asReference()
- */
- public IProject[] addToWorkspace(String[] referenceStrings) throws TeamException;
-}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
index cbafc0aa4..383644aec 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/RepositoryProvider.java
@@ -263,14 +263,4 @@ public abstract class RepositoryProvider implements IProjectNature {
public void setProject(IProject project) {
this.project = project;
}
-
- /**
- * Returns an object which can serialize and deserialize
- * references to projects.
- * Returns <code>null</code> if not supported.
- */
- public ISerializedReferencing getSerializedReferencing() {
- return null;
- }
-
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
index 795f9d1a1..04e8175db 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/Team.java
@@ -1,5 +1,3 @@
-package org.eclipse.team.core;
-
/*******************************************************************************
* Copyright (c) 2002 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
@@ -10,6 +8,7 @@ package org.eclipse.team.core;
* Contributors:
* IBM - Initial API and implementation
******************************************************************************/
+package org.eclipse.team.core;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@@ -501,4 +500,29 @@ public final class Team {
TeamPlugin.log(IStatus.WARNING, Policy.bind("TeamPlugin_setting_global_ignore_7"), ex); //$NON-NLS-1$
}
}
+
+ public static IProjectSetSerializer getProjectSetSerializer(String id) {
+ TeamPlugin plugin = TeamPlugin.getPlugin();
+ if (plugin != null) {
+ IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(TeamPlugin.PROJECT_SET_EXTENSION);
+ if (extension != null) {
+ IExtension[] extensions = extension.getExtensions();
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
+ for (int j = 0; j < configElements.length; j++) {
+ String extensionId = configElements[j].getAttribute("id"); //$NON-NLS-1$
+ if (extensionId != null && extensionId.equals(id)) {
+ try {
+ return (IProjectSetSerializer)configElements[j].createExecutableExtension("class"); //$NON-NLS-1$
+ } catch (CoreException e) {
+ TeamPlugin.log(e.getStatus());
+ return null;
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java
index 0ea307ea4..86cc8f3c6 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/TeamPlugin.java
@@ -40,7 +40,10 @@ final public class TeamPlugin extends Plugin {
// The id of the global ignore extension point
public static final String IGNORE_EXTENSION = "ignore"; //$NON-NLS-1$
-
+
+ // The id of the project set extension point
+ public static final String PROJECT_SET_EXTENSION = "projectSets"; //$NON-NLS-1$
+
// The one and only plug-in instance
private static TeamPlugin plugin;
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 757998337..685ea7dba 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -549,4 +549,8 @@
</perspectiveExtension>
</extension>
+ <!-- ************** Project Sets **************** -->
+ <extension point="org.eclipse.team.core.projectSets">
+ <projectSet id="org.eclipse.team.cvs.core.cvsnature" class="org.eclipse.team.internal.ccvs.ui.CVSProjectSetSerializer"/>
+ </extension>
</plugin>
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
new file mode 100644
index 000000000..5a43793da
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSProjectSetSerializer.java
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.team.core.IProjectSetSerializer;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.core.CVSProvider;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
+import org.eclipse.team.internal.ccvs.core.ICVSFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
+
+public class CVSProjectSetSerializer implements IProjectSetSerializer {
+
+ /**
+ * @see IProjectSetSerializer#asReference(IProject[])
+ *
+ * "1.0,repoLocation,module,projectName[,tag]"
+ */
+ public String[] asReference(IProject[] providerProjects, Object context) throws TeamException {
+ String[] result = new String[providerProjects.length];
+ for (int i = 0; i < providerProjects.length; i++) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("1.0,"); //$NON-NLS-1$
+
+ IProject project = providerProjects[i];
+ CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(project);
+ CVSWorkspaceRoot root = provider.getCVSWorkspaceRoot();
+ CVSRepositoryLocation location = CVSRepositoryLocation.fromString(root.getRemoteLocation().getLocation());
+ location.setUserMuteable(true);
+ String repoLocation = location.getLocation();
+ buffer.append(repoLocation);
+ buffer.append(","); //$NON-NLS-1$
+
+ ICVSFolder folder = root.getLocalRoot();
+ FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
+ String module = syncInfo.getRepository();
+ buffer.append(module);
+ buffer.append(","); //$NON-NLS-1$
+
+ String projectName = folder.getName();
+ buffer.append(projectName);
+ CVSTag tag = syncInfo.getTag();
+ if (tag != null) {
+ if (tag.getType() != CVSTag.DATE) {
+ buffer.append(","); //$NON-NLS-1$
+ String tagName = tag.getName();
+ buffer.append(tagName);
+ }
+ }
+ result[i] = buffer.toString();
+ }
+ return result;
+ }
+
+ /**
+ * @see IProjectSetSerializer#addToWorkspace(String[])
+ */
+ public IProject[] addToWorkspace(String[] referenceStrings, String filename, Object context, IProgressMonitor monitor) throws TeamException {
+ int size = referenceStrings.length;
+ CVSProvider provider = CVSProvider.getInstance();
+ IProject[] projects = new IProject[size];
+ try {
+ ICVSRepositoryLocation[] locations = new ICVSRepositoryLocation[size];
+ String[] modules = new String[size];
+ CVSTag[] tags = new CVSTag[size];
+
+ for (int i = 0; i < size; i++) {
+ StringTokenizer tokenizer = new StringTokenizer(referenceStrings[i], ","); //$NON-NLS-1$
+ String version = tokenizer.nextToken();
+ if (!version.equals("1.0")) { //$NON-NLS-1$
+ // Bail out, this is a newer version
+ return null;
+ }
+ String repo = tokenizer.nextToken();
+ locations[i] = CVSRepositoryLocation.fromString(repo);
+ modules[i] = tokenizer.nextToken();
+ String projectName = tokenizer.nextToken();
+ projects[i] = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (tokenizer.hasMoreTokens()) {
+ String tagName = tokenizer.nextToken();
+ tags[i] = new CVSTag(tagName, CVSTag.BRANCH);
+ }
+ }
+ // Check if any projects will be overwritten, and warn the user.
+ boolean yesToAll = false;
+ int action;
+ int num = size;
+ for (int i = 0; i < size; i++) {
+ Shell shell = null;
+ IProject project = projects[i];
+ if (project.exists()) {
+ if (shell == null) {
+ if (context instanceof Shell) {
+ shell = (Shell)context;
+ } else {
+ return null;
+ }
+ }
+ action = confirmOverwrite(project, yesToAll, shell);
+ yesToAll = action == 2;
+
+ // message dialog
+ switch (action) {
+ // no
+ case 1:
+ // Remove it from the set
+ locations[i] = null;
+ num--;
+ break;
+ // yes to all
+ case 2:
+ // yes
+ case 0:
+ break;
+ // cancel
+ case 3:
+ default:
+ return null;
+ }
+ }
+ }
+ monitor.beginTask("", 1000 * num); //$NON-NLS-1$
+ for (int i = 0; i < size; i++) {
+ if (locations[i] != null) {
+ provider.checkout(locations[i], projects[i], modules[i], tags[i], new SubProgressMonitor(monitor, 1000));
+ }
+ }
+ } finally {
+ monitor.done();
+ }
+ List result = new ArrayList();
+ for (int i = 0; i < projects.length; i++) {
+ if (projects[i] != null) result.add(projects[i]);
+ }
+ return (IProject[])result.toArray(new IProject[result.size()]);
+ }
+ private int confirmOverwrite(IProject project, boolean yesToAll, Shell shell) {
+ if (yesToAll) return 2;
+ if (!project.exists()) return 0;
+ final MessageDialog dialog =
+ new MessageDialog(shell, Policy.bind("CVSProjectSetSerializer.Confirm_Overwrite_Project_8"), null, Policy.bind("CVSProjectSetSerializer.The_project_{0}_already_exists._Do_you_wish_to_overwrite_it__9", project.getName()), MessageDialog.QUESTION, //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] {
+ IDialogConstants.YES_LABEL,
+ IDialogConstants.NO_LABEL,
+ IDialogConstants.YES_TO_ALL_LABEL,
+ IDialogConstants.CANCEL_LABEL},
+ 0);
+ final int[] result = new int[1];
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ result[0] = dialog.open();
+ }
+ });
+ return result[0];
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index ab3074f78..b5f943c98 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -665,3 +665,5 @@ BranchCategory.Branches_1=Branches
GroupedByVersionCategory.Versions_1=Versions
VersionCategory.Versions_1=Versions
HistoryView.[...]_4=[...]
+CVSProjectSetSerializer.Confirm_Overwrite_Project_8=Confirm Overwrite Project
+CVSProjectSetSerializer.The_project_{0}_already_exists._Do_you_wish_to_overwrite_it__9=The project {0} already exists. Do you wish to overwrite it?
diff --git a/bundles/org.eclipse.team.ui/.classpath b/bundles/org.eclipse.team.ui/.classpath
index eec652d16..b9991d9b2 100644
--- a/bundles/org.eclipse.team.ui/.classpath
+++ b/bundles/org.eclipse.team.ui/.classpath
@@ -8,5 +8,6 @@
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="src" path="/org.eclipse.swt"/>
<classpathentry kind="src" path="/org.eclipse.compare"/>
+ <classpathentry kind="src" path="/org.apache.xerces"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.team.ui/.project b/bundles/org.eclipse.team.ui/.project
index 2388e90e6..55c7e2e2a 100644
--- a/bundles/org.eclipse.team.ui/.project
+++ b/bundles/org.eclipse.team.ui/.project
@@ -1,24 +1,25 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.team.ui</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.compare</project>
- <project>org.eclipse.ui</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.swt</project>
- <project>org.eclipse.team.core</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.team.cvs.core.cvsnature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.team.ui</name>
+ <comment></comment>
+ <projects>
+ <project>org.apache.xerces</project>
+ <project>org.eclipse.compare</project>
+ <project>org.eclipse.core.resources</project>
+ <project>org.eclipse.core.runtime</project>
+ <project>org.eclipse.swt</project>
+ <project>org.eclipse.team.core</project>
+ <project>org.eclipse.ui</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.team.cvs.core.cvsnature</nature>
+ </natures>
+</projectDescription>
diff --git a/bundles/org.eclipse.team.ui/icons/basic/clcl16/projectset.gif b/bundles/org.eclipse.team.ui/icons/basic/clcl16/projectset.gif
new file mode 100644
index 000000000..954c7c44a
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/basic/clcl16/projectset.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/icons/full/clcl16/projectset.gif b/bundles/org.eclipse.team.ui/icons/full/clcl16/projectset.gif
new file mode 100644
index 000000000..9b55c268c
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/icons/full/clcl16/projectset.gif
Binary files differ
diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties
index c3c9300cf..554dda679 100644
--- a/bundles/org.eclipse.team.ui/plugin.properties
+++ b/bundles/org.eclipse.team.ui/plugin.properties
@@ -8,4 +8,9 @@ IgnorePreferencePage.name=Ignored Resources
ConfigureProject.label=&Share Project...
ConfigureProject.tooltip=Share the project with others using a version and configuration management provider.
-TeamGroupMenu.label=T&eam \ No newline at end of file
+TeamGroupMenu.label=T&eam
+
+ProjectSetImportWizard.description=A wizard that imports a project set
+ProjectSetImportWizard.name=Project Set
+ProjectSetExportWizard.name=Project Set
+ProjectSetExportWizard.description=A wizard that exports a project set
diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml
index c9f74cb1e..efc8bfa3d 100644
--- a/bundles/org.eclipse.team.ui/plugin.xml
+++ b/bundles/org.eclipse.team.ui/plugin.xml
@@ -11,6 +11,7 @@
<import plugin="org.eclipse.team.core"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.compare"/>
+ <import plugin="org.apache.xerces"/>
</requires>
<runtime>
@@ -87,4 +88,36 @@
class="org.eclipse.team.ui.sync.SyncView">
</view>
</extension>
+
+
+
+<!-- ****************** Import Wizards ********************* -->
+ <extension
+ point="org.eclipse.ui.importWizards">
+ <wizard
+ id="org.eclipse.team.ui.ProjectSetImportWizard"
+ name="%ProjectSetImportWizard.name"
+ class="org.eclipse.team.internal.ui.ProjectSetImportWizard"
+ icon="icons/full/clcl16/projectset.gif">
+ <description>
+ %ProjectSetImportWizard.description
+ </description>
+ <selection class="org.eclipse.core.resources.IProject"/>
+ </wizard>
+ </extension>
+
+<!-- ****************** Export Wizards ********************* -->
+ <extension
+ point="org.eclipse.ui.exportWizards">
+ <wizard
+ id="org.eclipse.team.ui.ProjectSetExportWizard"
+ name="%ProjectSetExportWizard.name"
+ class="org.eclipse.team.internal.ui.ProjectSetExportWizard"
+ icon="icons/full/clcl16/projectset.gif">
+ <description>
+ %ProjectSetExportWizard.description
+ </description>
+ <selection class="org.eclipse.core.resources.IProject"/>
+ </wizard>
+ </extension>
</plugin> \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java
new file mode 100644
index 000000000..b5285a8d0
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ui;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+public class ExportProjectSetMainPage extends TeamWizardPage {
+ Text fileText;
+ String file = "";
+ Button browseButton;
+ List selectedProjects = new ArrayList();
+
+ CheckboxTableViewer tableViewer;
+ Table table;
+
+ class ProjectContentProvider extends WorkbenchContentProvider {
+ public Object[] getElements(Object element) {
+ if (element instanceof IProject[]) return (IProject[]) element;
+ return null;
+ }
+ };
+
+ public ExportProjectSetMainPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ /*
+ * @see IDialogPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = createComposite(parent, 1);
+ initializeDialogUnits(composite);
+
+ createLabel(composite, Policy.bind("ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2")); //$NON-NLS-1$
+
+ table = new Table(composite, SWT.CHECK);
+ tableViewer = new CheckboxTableViewer(table);
+ table.setLayout(new TableLayout());
+ table.setLayoutData(new GridData(GridData.FILL_BOTH));
+ tableViewer.setContentProvider(new ProjectContentProvider());
+ tableViewer.setLabelProvider(new WorkbenchLabelProvider());
+ tableViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ IProject project = (IProject)event.getElement();
+ if (event.getChecked()) {
+ selectedProjects.add(project);
+ } else {
+ selectedProjects.remove(project);
+ }
+ }
+ });
+ createLabel(composite, Policy.bind("ExportProjectSetMainPage.Project_Set_File_Name__3")); //$NON-NLS-1$
+
+ Composite inner = new Composite(composite, SWT.NULL);
+ inner.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ inner.setLayout(layout);
+
+ fileText = createTextField(inner);
+ fileText.addListener(SWT.Modify, new Listener() {
+ public void handleEvent(Event event) {
+ file = fileText.getText();
+ updateEnablement();
+ }
+ });
+
+ browseButton = new Button(inner, SWT.PUSH);
+ browseButton.setText(Policy.bind("ExportProjectSetMainPage.Browse_4")); //$NON-NLS-1$
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ browseButton.setLayoutData(data);
+ browseButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ FileDialog d = new FileDialog(getShell());
+ String f = d.open();
+ if (f != null) {
+ fileText.setText(f);
+ file = f;
+ }
+ }
+ });
+
+ initializeProjects();
+ setControl(composite);
+ updateEnablement();
+ }
+
+ private void initializeProjects() {
+ List projectList = new ArrayList();
+ IProject[] workspaceProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (int i = 0; i < workspaceProjects.length; i++) {
+ if (RepositoryProvider.getProvider(workspaceProjects[i]) != null) {
+ projectList.add(workspaceProjects[i]);
+ }
+ }
+ tableViewer.setInput((IProject[]) projectList.toArray(new IProject[projectList.size()]));
+ // Check any necessary projects
+ if (selectedProjects != null) {
+ tableViewer.setCheckedElements((IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()]));
+ }
+ }
+ private void updateEnablement() {
+ boolean complete;
+
+ if (file.length() == 0) {
+ setMessage(null);
+ complete = false;
+ } else {
+ File f = new File(file);
+ if (f.isDirectory()) {
+ setMessage(Policy.bind("ExportProjectSetMainPage.You_have_specified_a_folder_5")); //$NON-NLS-1$
+ complete = false;
+ } else {
+ complete = true;
+ }
+ }
+ if (complete) {
+ setMessage(null);
+ }
+ setPageComplete(complete);
+ }
+
+ public String getFileName() {
+ return file;
+ }
+
+ public IProject[] getSelectedProjects() {
+ return (IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()]);
+ }
+ public void setSelectedProjects(IProject[] selectedProjects) {
+ this.selectedProjects.addAll(Arrays.asList(selectedProjects));
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java
new file mode 100644
index 000000000..db50b7ad5
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ui;
+
+import java.io.File;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+public class ImportProjectSetMainPage extends TeamWizardPage {
+ Text fileText;
+ String file = ""; //$NON-NLS-1$
+ Button browseButton;
+
+ public ImportProjectSetMainPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ /*
+ * @see IDialogPage#createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = createComposite(parent, 1);
+ initializeDialogUnits(composite);
+
+ createLabel(composite, Policy.bind("ImportProjectSetMainPage.Project_Set_File_Name__2")); //$NON-NLS-1$
+
+ Composite inner = new Composite(composite, SWT.NULL);
+ inner.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ inner.setLayout(layout);
+
+ fileText = createTextField(inner);
+ fileText.addListener(SWT.Modify, new Listener() {
+ public void handleEvent(Event event) {
+ file = fileText.getText();
+ updateEnablement();
+ }
+ });
+
+ browseButton = new Button(inner, SWT.PUSH);
+ browseButton.setText(Policy.bind("ImportProjectSetMainPage.Browse_3")); //$NON-NLS-1$
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
+ browseButton.setLayoutData(data);
+ browseButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ FileDialog d = new FileDialog(getShell());
+ String f = d.open();
+ if (f != null) {
+ fileText.setText(f);
+ file = f;
+ }
+ }
+ });
+
+ setControl(composite);
+ updateEnablement();
+ }
+
+ private void updateEnablement() {
+ boolean complete;
+
+ if (file.length() == 0) {
+ setMessage(null);
+ complete = false;
+ } else {
+ // See if the file exists
+ File f = new File(file);
+ if (!f.exists()) {
+ setMessage(Policy.bind("ImportProjectSetMainPage.The_specified_file_does_not_exist_4")); //$NON-NLS-1$
+ complete = false;
+ } else if (f.isDirectory()) {
+ setMessage(Policy.bind("ImportProjectSetMainPage.You_have_specified_a_folder_5")); //$NON-NLS-1$
+ complete = false;
+ } else {
+ complete = true;
+ }
+ }
+ if (complete) {
+ setMessage(null);
+ }
+ setPageComplete(complete);
+ }
+
+ public String getFileName() {
+ return file;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
new file mode 100644
index 000000000..5dc6a57c5
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class ProjectSetContentHandler extends DefaultHandler {
+ boolean inPsf = false;
+ boolean inProvider = false;
+ boolean inProject = false;
+ Map map;
+ String id;
+ List references;
+ boolean isVersionOne = false;
+
+ /**
+ * @see ContentHandler#startElement(String, String, String, Attributes)
+ */
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
+ if (localName.equals("psf")) {
+ map = new HashMap();
+ inPsf = true;
+ String version = atts.getValue("version");
+ isVersionOne = version.equals("1.0");
+ return;
+ }
+ if (isVersionOne) return;
+ if (localName.equals("provider")) {
+ if (!inPsf) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4")); //$NON-NLS-1$
+ inProvider = true;
+ id = atts.getValue("id");
+ references = new ArrayList();
+ return;
+ }
+ if (localName.equals("project")) {
+ if (!inProvider) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7")); //$NON-NLS-1$
+ inProject = true;
+ String reference = atts.getValue("reference");
+ references.add(reference);
+ return;
+ }
+ }
+
+ /**
+ * @see ContentHandler#endElement(String, String, String)
+ */
+ public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
+ if (localName.equals("psf")) {
+ inPsf = false;
+ return;
+ }
+ if (isVersionOne) return;
+ if (localName.equals("provider")) {
+ map.put(id, references);
+ references = null;
+ inProvider = false;
+ return;
+ }
+ if (localName.equals("project")) {
+ inProject = false;
+ return;
+ }
+ }
+
+ public Map getReferences() {
+ return map;
+ }
+
+ public boolean isVersionOne() {
+ return isVersionOne;
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java
new file mode 100644
index 000000000..1ef0859d3
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ui;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.team.core.IProjectSetSerializer;
+import org.eclipse.team.core.RepositoryProvider;
+import org.eclipse.team.core.Team;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.TeamPlugin;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+
+public class ProjectSetExportWizard extends Wizard implements IExportWizard {
+ ExportProjectSetMainPage mainPage;
+ IStructuredSelection selection;
+
+ public ProjectSetExportWizard() {
+ setNeedsProgressMonitor(true);
+ setWindowTitle(Policy.bind("ProjectSetExportWizard.Project_Set_1")); //$NON-NLS-1$
+ }
+
+ public void addPages() {
+ mainPage = new ExportProjectSetMainPage("projectSetMainPage", Policy.bind("ProjectSetExportWizard.Export_a_Project_Set_3"), null); //$NON-NLS-1$ //$NON-NLS-2$
+ IProject[] projects = (IProject[])selection.toList().toArray(new IProject[0]);
+ mainPage.setSelectedProjects(projects);
+ addPage(mainPage);
+ }
+ public boolean performFinish() {
+ final boolean[] result = new boolean[] {false};
+ try {
+ getContainer().run(false, false, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException {
+ try {
+ String filename = mainPage.getFileName();
+ File file = new File(filename);
+ File parentFile = file.getParentFile();
+ if (!parentFile.exists()) {
+ boolean r = MessageDialog.openQuestion(getShell(), Policy.bind("ProjectSetExportWizard.Question_4"), Policy.bind("ProjectSetExportWizard.Target_directory_does_not_exist._Would_you_like_to_create_it__5")); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!r) {
+ result[0] = false;
+ return;
+ }
+ r = parentFile.mkdirs();
+ if (!r) {
+ MessageDialog.openError(getShell(), Policy.bind("ProjectSetExportWizard.Export_Problems_6"), Policy.bind("ProjectSetExportWizard.An_error_occurred_creating_the_target_directory_7")); //$NON-NLS-1$ //$NON-NLS-2$
+ result[0] = false;
+ return;
+ }
+ }
+ if (file.exists() && file.isFile()) {
+ boolean r = MessageDialog.openQuestion(getShell(), Policy.bind("ProjectSetExportWizard.Question_8"), Policy.bind("ProjectSetExportWizard.Target_already_exists._Would_you_like_to_overwrite_it__9")); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!r) {
+ result[0] = false;
+ return;
+ }
+ }
+ OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); //$NON-NLS-1$
+
+ writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$
+ writer.write("<psf version=\"2.0\">\n"); //$NON-NLS-1$
+ IProject[] projects = mainPage.getSelectedProjects();
+
+ // Hash the projects by provider
+ Map map = new HashMap();
+ for (int i = 0; i < projects.length; i++) {
+ IProject project = projects[i];
+ RepositoryProvider provider = RepositoryProvider.getProvider(project);
+ String id = provider.getID();
+ List list = (List)map.get(id);
+ if (list == null) {
+ list = new ArrayList();
+ map.put(id, list);
+ }
+ list.add(project);
+ }
+
+ // For each provider id, do the writing
+ Shell shell = getShell();
+ Iterator it = map.keySet().iterator();
+ while (it.hasNext()) {
+ String id = (String)it.next();
+ writer.write("\t<provider id=\""); //$NON-NLS-1$
+ writer.write(id);
+ writer.write("\">\n"); //$NON-NLS-1$
+ List list = (List)map.get(id);
+ IProject[] projectArray = (IProject[])list.toArray(new IProject[list.size()]);
+ IProjectSetSerializer serializer = Team.getProjectSetSerializer(id);
+ if (serializer != null) {
+ String[] references = serializer.asReference(projectArray, shell);
+ for (int i = 0; i < references.length; i++) {
+ writer.write("\t\t<project reference=\""); //$NON-NLS-1$
+ writer.write(references[i]);
+ writer.write("\"/>\n"); //$NON-NLS-1$
+ }
+ }
+ writer.write("\t</provider>\n"); //$NON-NLS-1$
+ }
+ writer.write("</psf>\n"); //$NON-NLS-1$
+ writer.close();
+ result[0] = true;
+ } catch (FileNotFoundException e) {
+ throw new InvocationTargetException(e);
+ } catch (IOException e) {
+ throw new InvocationTargetException(e);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ return true;
+ } catch (InvocationTargetException e) {
+ Throwable target = e.getTargetException();
+ if (target instanceof TeamException) {
+ ErrorDialog.openError(getShell(), null, null, ((TeamException)target).getStatus());
+ return false;
+ }
+ if (target instanceof RuntimeException) {
+ throw (RuntimeException)target;
+ }
+ if (target instanceof Error) {
+ throw (Error)target;
+ }
+ }
+ return result[0];
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.selection = selection;
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java
new file mode 100644
index 000000000..42be6ee51
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ui;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.xerces.parsers.SAXParser;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.team.core.IProjectSetSerializer;
+import org.eclipse.team.core.Team;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class ProjectSetImportWizard extends Wizard implements IImportWizard {
+ ImportProjectSetMainPage mainPage;
+
+ public ProjectSetImportWizard() {
+ setNeedsProgressMonitor(true);
+ setWindowTitle(Policy.bind("ProjectSetImportWizard.Project_Set_1")); //$NON-NLS-1$
+ }
+
+ public void addPages() {
+ mainPage = new ImportProjectSetMainPage("projectSetMainPage", Policy.bind("ProjectSetImportWizard.Import_a_Project_Set_3"), null); //$NON-NLS-1$ //$NON-NLS-2$
+ addPage(mainPage);
+ }
+ public boolean performFinish() {
+ final boolean[] result = new boolean[] {false};
+ try {
+ getContainer().run(false, false, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException {
+ try {
+ String filename = mainPage.getFileName();
+ InputStreamReader reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$
+
+ SAXParser parser = new SAXParser();
+ ProjectSetContentHandler handler = new ProjectSetContentHandler();
+ parser.setContentHandler(handler);
+ InputSource source = new InputSource(reader);
+ parser.parse(source);
+
+ Map map = handler.getReferences();
+ if (map.size() == 0 && handler.isVersionOne) {
+ IProjectSetSerializer serializer = Team.getProjectSetSerializer("versionOneSerializer");
+ if (serializer != null) {
+ serializer.addToWorkspace(new String[0], filename, getShell(), monitor);
+ }
+ } else {
+ Iterator it = map.keySet().iterator();
+ while (it.hasNext()) {
+ String id = (String)it.next();
+ List references = (List)map.get(id);
+ IProjectSetSerializer serializer = Team.getProjectSetSerializer(id);
+ if (serializer != null) {
+ serializer.addToWorkspace((String[])references.toArray(new String[references.size()]), filename, getShell(), monitor);
+ }
+ }
+ }
+ reader.close();
+ result[0] = true;
+ } catch (IOException e) {
+ throw new InvocationTargetException(e);
+ } catch (SAXException e) {
+ throw new InvocationTargetException(e);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ return true;
+ } catch (InvocationTargetException e) {
+ Throwable target = e.getTargetException();
+ if (target instanceof TeamException) {
+ ErrorDialog.openError(getShell(), null, null, ((TeamException)target).getStatus());
+ return false;
+ }
+ if (target instanceof RuntimeException) {
+ throw (RuntimeException)target;
+ }
+ if (target instanceof Error) {
+ throw (Error)target;
+ }
+ }
+ return result[0];
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamWizardPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamWizardPage.java
new file mode 100644
index 000000000..7eb5198f5
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamWizardPage.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ui;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public abstract class TeamWizardPage extends WizardPage {
+ /**
+ * CVSWizardPage constructor comment.
+ * @param pageName the name of the page
+ */
+ public TeamWizardPage(String pageName) {
+ super(pageName);
+ }
+ /**
+ * CVSWizardPage constructor comment.
+ * @param pageName the name of the page
+ * @param title the title of the page
+ * @param titleImage the image for the page
+ */
+ public TeamWizardPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+ /**
+ * Creates composite control and sets the default layout data.
+ *
+ * @param parent the parent of the new composite
+ * @param numColumns the number of columns for the new composite
+ * @return the newly-created coposite
+ */
+ protected Composite createComposite(Composite parent, int numColumns) {
+ Composite composite = new Composite(parent, SWT.NULL);
+
+ // GridLayout
+ GridLayout layout = new GridLayout();
+ layout.numColumns = numColumns;
+ composite.setLayout(layout);
+
+ // GridData
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData(data);
+ return composite;
+ }
+ /**
+ * Utility method that creates a label instance
+ * and sets the default layout data.
+ *
+ * @param parent the parent for the new label
+ * @param text the text for the new label
+ * @return the new label
+ */
+ protected Label createLabel(Composite parent, String text) {
+ return createIndentedLabel(parent, text, 0);
+ }
+ /**
+ * Utility method that creates a label instance indented by the specified
+ * number of pixels and sets the default layout data.
+ *
+ * @param parent the parent for the new label
+ * @param text the text for the new label
+ * @param indent the indent in pixels, or 0 for none
+ * @return the new label
+ */
+ protected Label createIndentedLabel(Composite parent, String text, int indent) {
+ Label label = new Label(parent, SWT.LEFT);
+ label.setText(text);
+ GridData data = new GridData();
+ data.horizontalSpan = 1;
+ data.horizontalAlignment = GridData.FILL;
+ data.horizontalIndent = indent;
+ label.setLayoutData(data);
+ return label;
+ }
+ /**
+ * Create a text field specific for this application
+ *
+ * @param parent the parent of the new text field
+ * @return the new text field
+ */
+ protected Text createTextField(Composite parent) {
+ Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.verticalAlignment = GridData.CENTER;
+ data.grabExcessVerticalSpace = false;
+ data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
+ text.setLayoutData(data);
+ return text;
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index 0c8d2a310..ef5c62c57 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -103,3 +103,23 @@ UpdateAction.title=Get
UpdateAction.updating=Getting...
TextPreferencePage.columnExtension=extension
TextPreferencePage.columnContents=contents
+ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2=Select the projects to include in the project set:
+ExportProjectSetMainPage.Project_Set_File_Name__3=Project Set File Name:
+ExportProjectSetMainPage.Browse_4=Browse
+ExportProjectSetMainPage.You_have_specified_a_folder_5=You have specified a folder
+ImportProjectSetMainPage.Project_Set_File_Name__2=Project Set File Name:
+ImportProjectSetMainPage.Browse_3=Browse
+ImportProjectSetMainPage.The_specified_file_does_not_exist_4=The specified file does not exist
+ImportProjectSetMainPage.You_have_specified_a_folder_5=You have specified a folder
+ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4=Element provider must be contained in element psf
+ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7=Element project must be contained in element provider
+ProjectSetExportWizard.Project_Set_1=Project Set
+ProjectSetExportWizard.Export_a_Project_Set_3=Export a Project Set
+ProjectSetExportWizard.Question_4=Question
+ProjectSetExportWizard.Target_directory_does_not_exist._Would_you_like_to_create_it__5=Target directory does not exist. Would you like to create it?
+ProjectSetExportWizard.Export_Problems_6=Export Problems
+ProjectSetExportWizard.An_error_occurred_creating_the_target_directory_7=An error occurred creating the target directory
+ProjectSetExportWizard.Question_8=Question
+ProjectSetExportWizard.Target_already_exists._Would_you_like_to_overwrite_it__9=Target already exists. Would you like to overwrite it?
+ProjectSetImportWizard.Project_Set_1=Project Set
+ProjectSetImportWizard.Import_a_Project_Set_3=Import a Project Set

Back to the top