Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 5349 Details for
Bug 38048
IProjectSetSerializer cannot be used in headless environment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
new serializer support for team.ui
bug_38048_new_serializer_team_ui.txt (text/plain), 8.66 KB, created by
Dan Rubel
on 2003-07-04 11:28:20 EDT
(
hide
)
Description:
new serializer support for team.ui
Filename:
MIME Type:
Creator:
Dan Rubel
Created:
2003-07-04 11:28:20 EDT
Size:
8.66 KB
patch
obsolete
>Index: org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java,v >retrieving revision 1.2 >diff -u -r1.2 ProjectSetExportWizard.java >--- org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java 26 Jun 2003 14:21:22 -0000 1.2 >+++ org/eclipse/team/internal/ui/wizards/ProjectSetExportWizard.java 4 Jul 2003 14:19:16 -0000 >@@ -32,15 +32,15 @@ > 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.ProjectSetCapability; >+import org.eclipse.team.core.ProjectSetSerializer; > import org.eclipse.team.core.RepositoryProvider; > import org.eclipse.team.core.RepositoryProviderType; >-import org.eclipse.team.core.Team; > import org.eclipse.team.core.TeamException; > import org.eclipse.team.internal.ui.Policy; > import org.eclipse.team.internal.ui.TeamUIPlugin; > import org.eclipse.team.ui.ISharedImages; >+import org.eclipse.team.ui.UIProjectSetSerializationContext; > import org.eclipse.ui.IExportWizard; > import org.eclipse.ui.IWorkbench; > >@@ -123,6 +123,7 @@ > writer.newLine(); > > // For each provider id, do the writing >+ UIProjectSetSerializationContext context = new UIProjectSetSerializationContext(getShell()); > Iterator it = map.keySet().iterator(); > monitor.beginTask(null, 1000 * map.keySet().size()); > while (it.hasNext()) { >@@ -133,9 +134,9 @@ > writer.newLine(); > List list = (List)map.get(id); > IProject[] projectArray = (IProject[])list.toArray(new IProject[list.size()]); >- IProjectSetSerializer serializer = Team.getProjectSetSerializer(id); >+ ProjectSetSerializer serializer = RepositoryProviderType.getProviderType(id).getProjectSetSerializer(); > if (serializer != null) { >- String[] references = serializer.asReference(projectArray, shell, new SubProgressMonitor(monitor, 990)); >+ String[] references = serializer.asReference(projectArray, context, new SubProgressMonitor(monitor, 990)); > for (int i = 0; i < references.length; i++) { > writer.write("\t\t<project reference=\""); //$NON-NLS-1$ > writer.write(references[i]); >Index: org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java,v >retrieving revision 1.2 >diff -u -r1.2 ProjectSetImportWizard.java >--- org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java 26 Jun 2003 14:21:22 -0000 1.2 >+++ org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java 4 Jul 2003 14:19:17 -0000 >@@ -28,12 +28,15 @@ > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.wizard.Wizard; > import org.eclipse.team.core.IProjectSetSerializer; >+import org.eclipse.team.core.ProjectSetSerializer; >+import org.eclipse.team.core.RepositoryProviderType; > import org.eclipse.team.core.Team; > import org.eclipse.team.core.TeamException; > import org.eclipse.team.internal.ui.Policy; > import org.eclipse.team.internal.ui.ProjectSetContentHandler; > import org.eclipse.team.internal.ui.TeamUIPlugin; > import org.eclipse.team.ui.ISharedImages; >+import org.eclipse.team.ui.UIProjectSetSerializationContext; > import org.eclipse.ui.IImportWizard; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkingSet; >@@ -93,13 +96,14 @@ > newProjects.addAll(Arrays.asList(projects)); > } > } else { >+ UIProjectSetSerializationContext context = new UIProjectSetSerializationContext(getShell()); > Iterator it = map.keySet().iterator(); > while (it.hasNext()) { > String id = (String)it.next(); > List references = (List)map.get(id); >- IProjectSetSerializer serializer = Team.getProjectSetSerializer(id); >+ ProjectSetSerializer serializer = RepositoryProviderType.getProviderType(id).getProjectSetSerializer(); > if (serializer != null) { >- IProject[] projects = serializer.addToWorkspace((String[])references.toArray(new String[references.size()]), filename, getShell(), monitor); >+ IProject[] projects = serializer.addToWorkspace((String[])references.toArray(new String[references.size()]), context, monitor); > if (projects != null) > newProjects.addAll(Arrays.asList(projects)); > } >Index: src/org/eclipse/team/ui/UIProjectSetSerializationContext.java >=================================================================== >RCS file: src/org/eclipse/team/ui/UIProjectSetSerializationContext.java >diff -N src/org/eclipse/team/ui/UIProjectSetSerializationContext.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/ui/UIProjectSetSerializationContext.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,111 @@ >+package org.eclipse.team.ui; >+ >+import java.util.Arrays; >+import java.util.List; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.jface.util.Assert; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.team.core.ProjectSetSerializationContext; >+import org.eclipse.team.core.TeamException; >+import org.eclipse.team.internal.ui.dialogs.IPromptCondition; >+import org.eclipse.team.internal.ui.dialogs.PromptingDialog; >+ >+/** >+ * The UI based context in which project serialization occurs. >+ * The class may be subclasses to represent different UI based serialization contexts. >+ * It is recommended that all UI based serialization contexts >+ * use this class directly or indirectly as their superclass. >+ * >+ * @since 3.0 >+ */ >+public class UIProjectSetSerializationContext extends ProjectSetSerializationContext { >+ >+ /** >+ * The parent shell for this UI context >+ */ >+ private final Shell shell; >+ >+ /** >+ * Construct a new instance >+ * >+ * @param shell The parent shell for this UI context >+ */ >+ public UIProjectSetSerializationContext(Shell shell) { >+ Assert.isNotNull(shell); >+ this.shell = shell; >+ } >+ >+ /** >+ * Answer the shell associated with this UI context. >+ * >+ * @return the shell (not <code>null</code>) >+ */ >+ public Shell getShell() { >+ return shell; >+ } >+ >+ /** >+ * Answer the shell associated with this UI context. >+ * >+ * @return the shell (not <code>null</code>) >+ * >+ * @see ProjectSetSerializationContext#getIProjectSetSerializerContext() >+ * >+ * @deprecated >+ * This method exist solely for backward compatibility >+ * with the {@link IProjectSetSerializer} interface >+ * and should not be used for any other purpose. >+ */ >+ public Object getIProjectSetSerializerContext() { >+ return getShell(); >+ } >+ >+ /** >+ * Given an array of projects that currently exist in the workspace >+ * prompt the user to determine which of those projects should be overwritten. >+ * <p> >+ * This default implementation prompts the user >+ * to determine which projects should be overwritten. >+ * Subclasses may override this as appropriate. >+ * >+ * @param projects >+ * an array of projects currently existing in the workspace >+ * that are desired to be overwritten. >+ * (not <code>null</code>, contains no <code>null</code>s) >+ * @return >+ * an array of zero or more projects that should be overwritten >+ * or <code>null</code> if the operation is to be canceled >+ * >+ * @see org.eclipse.team.core.ProjectSetSerializationContext#confirmOverwrite(org.eclipse.core.resources.IProject[]) >+ */ >+ public IProject[] confirmOverwrite(final IProject[] projects) throws TeamException { >+ IPromptCondition prompt = new IPromptCondition() { >+ List resources = Arrays.asList(projects); >+ public boolean needsPrompt(IResource resource) { >+ return resources.contains(resource); >+ } >+ public String promptMessage(IResource resource) { >+ return "Overwrite " + resource.getName(); >+ } >+ }; >+ PromptingDialog dialog = >+ new PromptingDialog( >+ getShell(), >+ projects, >+ prompt, >+ "Overwrite projects?"); >+ IResource[] resourcesToOverwrite; >+ try { >+ resourcesToOverwrite = dialog.promptForMultiple(); >+ } catch (InterruptedException e) { >+ // Return null indicating that the user canceled the operation >+ return null; >+ } >+ IProject[] projectsToOverwrite = new IProject[resourcesToOverwrite.length]; >+ System.arraycopy(resourcesToOverwrite, 0, projectsToOverwrite, 0, resourcesToOverwrite.length); >+ return projectsToOverwrite; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 38048
:
5348
|
5349
|
5350
|
5351
|
7396