Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.ui/src')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java142
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java71
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizard.java234
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizardMainPage.java185
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java264
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java115
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java198
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java48
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPromptCondition.java31
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java184
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java211
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java84
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java165
-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.java200
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java156
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PromptingDialog.java111
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamPreferencePage.java120
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java257
-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/TextPreferencePage.java396
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIConstants.java79
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java59
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java394
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties292
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java735
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java80
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java166
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java472
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java288
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java556
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java393
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java77
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java78
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java105
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java400
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java147
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java190
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java204
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java179
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java198
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java161
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java149
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java147
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java195
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java125
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java78
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java149
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java181
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java92
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java562
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java54
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java25
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java68
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java187
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java40
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java51
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java102
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java61
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java59
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java89
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java191
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java158
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java235
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java95
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java199
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java112
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java36
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java26
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java131
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java40
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html16
74 files changed, 0 insertions, 12374 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java
deleted file mode 100644
index d52b40ce1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * ConfigurationWizardElement represents an item in the configuration wizard table,
- * declared by an extension to the configurationWizards extension point.
- */
-public class ConfigurationWizardElement extends WorkbenchAdapter implements IAdaptable {
- private String id;
- private String name;
- private ImageDescriptor imageDescriptor;
- private String description;
- private IConfigurationElement configurationElement;
-
- /**
- * Creates a new instance of this class
- *
- * @param name the name of the element
- */
- public ConfigurationWizardElement(String name) {
- this.name = name;
- }
- /**
- * Create an the instance of the object described by the configuration
- * element. That is, create the instance of the class the isv supplied in
- * the extension point.
- *
- * @throws CoreException if an error occurs creating the extension
- */
- public Object createExecutableExtension() throws CoreException {
- return TeamUIPlugin.createExtension(configurationElement, ConfigureProjectWizard.ATT_CLASS);
- }
- /*
- * Method declared on IAdaptable.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) {
- return this;
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
- /**
- * Returns the configuration element
- *
- * @return the configuration element
- */
- public IConfigurationElement getConfigurationElement() {
- return configurationElement;
- }
- /**
- * Returns the description parameter of this element
- *
- * @return the description of this elemnet
- */
- public String getDescription() {
- return description;
- }
- /**
- * Returns the image for the given element
- *
- * @param element the element to get the image for
- * @return the image for the given element
- */
- public ImageDescriptor getImageDescriptor(Object element) {
- return imageDescriptor;
- }
- /**
- * Returns the label for the given element
- *
- * @param element the element to get the label for
- * @return the label for the given element
- */
- public String getLabel(Object element) {
- return name;
- }
- /**
- * Returns the id as specified in the extension.
- *
- * @return java.lang.String
- */
- public String getID() {
- return id;
- }
- /**
- * Returns the image for this element.
- *
- * @return the image for this element
- */
- public ImageDescriptor getImageDescriptor() {
- return imageDescriptor;
- }
- /**
- * Set the configuration element
- *
- * @param newConfigurationElement the new configuration element
- */
- public void setConfigurationElement(IConfigurationElement newConfigurationElement) {
- configurationElement = newConfigurationElement;
- }
- /**
- * Set the description parameter of this element
- *
- * @param value the new desrciption
- */
- public void setDescription(String value) {
- description = value;
- }
- /**
- * Sets the id parameter of this element
- *
- * @param value the new ID
- */
- public void setID(String value) {
- id = value;
- }
- /**
- * Sets the image for this element.
- *
- * @param value the new image
- */
- public void setImageDescriptor(ImageDescriptor value) {
- imageDescriptor = value;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java
deleted file mode 100644
index aad74335b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardNode;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * ConfigurationWizardNode represents the objects in the
- * table in the Configuration wizard.
- */
-public class ConfigurationWizardNode implements IWizardNode {
- // The element this node represents
- ConfigurationWizardElement element;
- // The wizard this node is in
- IWizard wizard;
-
- /**
- * Create a new ConfigurationWizardNode
- *
- * @param element the configuration wizard element for this node
- */
- public ConfigurationWizardNode(ConfigurationWizardElement element) {
- this.element = element;
- }
- /*
- * Method declared on IWizardNode.
- */
- public void dispose() {
- if (wizard != null) {
- wizard.dispose();
- wizard = null;
- }
- }
- /*
- * Method declared on IWizardNode.
- */
- public Point getExtent() {
- return new Point(-1, -1);
- }
- /*
- * Method declared on IWizardNode.
- */
- public IWizard getWizard() {
- if (wizard == null) {
- try {
- wizard = (IWizard)element.createExecutableExtension();
- } catch (CoreException e) {
- System.out.println(Policy.bind("ConfigurationWizard.exceptionCreatingWizard")); //$NON-NLS-1$
- }
- }
- return wizard;
- }
- /*
- * Method declared on IWizardNode.
- */
- public boolean isContentCreated() {
- return wizard != null;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizard.java
deleted file mode 100644
index c6da4a11b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizard.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-
-import org.eclipse.core.resources.IProject;
-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.IPluginRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.ui.IConfigurationWizard;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.internal.model.AdaptableList;
-
-/**
- * The wizard for associating projects with team providers
- */
-public class ConfigureProjectWizard extends Wizard implements IConfigurationWizard {
- protected IWorkbench workbench;
- protected IProject project;
- protected IConfigurationWizard wizard;
-
- protected ConfigureProjectWizardMainPage mainPage;
- private String pluginId = UIConstants.PLUGIN_ID;
-
- protected final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$
- protected final static String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
- protected final static String ATT_NAME = "name"; //$NON-NLS-1$
- protected final static String ATT_CLASS = "class"; //$NON-NLS-1$
- protected final static String ATT_ICON = "icon"; //$NON-NLS-1$
- protected final static String ATT_ID = "id"; //$NON-NLS-1$
-
- public ConfigureProjectWizard() {
- setNeedsProgressMonitor(true);
- setWindowTitle(getWizardWindowTitle()); //$NON-NLS-1$
- }
-
- protected String getExtensionPoint() {
- return UIConstants.PT_CONFIGURATION;
- }
-
- protected String getWizardWindowTitle() {
- return Policy.bind("ConfigureProjectWizard.title"); //$NON-NLS-1$
- }
-
- protected String getWizardLabel() {
- return Policy.bind("ConfigureProjectWizard.configureProject"); //$NON-NLS-1$
- }
-
- protected String getWizardDescription() {
- return Policy.bind("ConfigureProjectWizard.description"); //$NON-NLS-1$
- }
-
- /*
- * @see Wizard#addPages
- */
- public void addPages() {
- AdaptableList wizards = getAvailableWizards();
- if (wizards.size() == 1) {
- // If there is only one wizard, skip the first page.
- // Only skip the first page if the one wizard has at least one page.
- ConfigurationWizardElement element = (ConfigurationWizardElement)wizards.getChildren()[0];
- try {
- this.wizard = (IConfigurationWizard)element.createExecutableExtension();
- wizard.init(workbench, project);
- wizard.addPages();
- if (wizard.getPageCount() > 0) {
- wizard.setContainer(getContainer());
- IWizardPage[] pages = wizard.getPages();
- for (int i = 0; i < pages.length; i++) {
- addPage(pages[i]);
- }
- return;
- }
- } catch (CoreException e) {
- TeamUIPlugin.log(e.getStatus());
- return;
- }
- }
- mainPage = new ConfigureProjectWizardMainPage("configurePage1", getWizardLabel(), TeamImages.getImageDescriptor(UIConstants.IMG_WIZBAN_SHARE), wizards); //$NON-NLS-1$
- mainPage.setDescription(getWizardDescription());
- mainPage.setProject(project);
- mainPage.setWorkbench(workbench);
- addPage(mainPage);
- }
- public IWizardPage getNextPage(IWizardPage page) {
- if (wizard != null) {
- return wizard.getNextPage(page);
- }
- return super.getNextPage(page);
- }
- public boolean canFinish() {
- // If we are on the first page, never allow finish unless the selected wizard has no pages.
- if (getContainer().getCurrentPage() == mainPage) {
- if (mainPage.getSelectedWizard() != null && mainPage.getNextPage() == null) {
- return true;
- }
- return false;
- }
- if (wizard != null) {
- return wizard.canFinish();
- }
- return super.canFinish();
- }
- /*
- * @see Wizard#performFinish
- */
- public boolean performFinish() {
- // There is only one wizard with at least one page
- if (wizard != null) {
- return wizard.performFinish();
- }
- // If we are on the first page and the selected wizard has no pages then
- // allow it to finish.
- if (getContainer().getCurrentPage() == mainPage) {
- IConfigurationWizard noPageWizard = mainPage.getSelectedWizard();
- if (noPageWizard != null) {
- if (noPageWizard.canFinish())
- {
- return noPageWizard.performFinish();
- }
- }
- }
- // If the wizard has pages and there are several
- // wizards registered then the registered wizard
- // will call it's own performFinish().
- return true;
- }
- /**
- * Returns the configuration wizards that are available for invocation.
- *
- * @return the available wizards
- */
- protected AdaptableList getAvailableWizards() {
- AdaptableList result = new AdaptableList();
- IPluginRegistry registry = Platform.getPluginRegistry();
- IExtensionPoint point = registry.getExtensionPoint(pluginId, getExtensionPoint());
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] elements = extensions[i].getConfigurationElements();
- for (int j = 0; j < elements.length; j++) {
- IConfigurationElement element = elements[j];
- if (element.getName().equals(TAG_WIZARD)) {
- ConfigurationWizardElement wizard = createWizardElement(element);
- if (wizard != null) {
- result.add(wizard);
- }
- }
- }
- }
- }
-
- return result;
- }
- /**
- * Returns a new ConfigurationWizardElement configured according to the parameters
- * contained in the passed Registry.
- *
- * May answer null if there was not enough information in the Extension to create
- * an adequate wizard
- *
- * @param element the element for which to create a wizard element
- * @return the wizard element for the given element
- */
- protected ConfigurationWizardElement createWizardElement(IConfigurationElement element) {
- // WizardElements must have a name attribute
- String nameString = element.getAttribute(ATT_NAME);
- if (nameString == null) {
- // Missing attribute
- return null;
- }
- ConfigurationWizardElement result = new ConfigurationWizardElement(nameString);
- if (initializeWizard(result, element)) {
- // initialization was successful
- return result;
- }
- return null;
- }
- /**
- * Initialize the passed element's properties based on the contents of
- * the passed registry. Answer a boolean indicating whether the element
- * was able to be adequately initialized.
- *
- * @param element the element to initialize the properties for
- * @param extension the registry to get properties from
- * @return whether initialization was successful
- */
- protected boolean initializeWizard(ConfigurationWizardElement element, IConfigurationElement config) {
- element.setID(config.getAttribute(ATT_ID));
- String description = ""; //$NON-NLS-1$
- IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION);
- if (children.length >= 1) {
- description = children[0].getValue();
- }
-
- element.setDescription(description);
-
- // apply CLASS and ICON properties
- element.setConfigurationElement(config);
- String iconName = config.getAttribute(ATT_ICON);
- if (iconName != null) {
- IExtension extension = config.getDeclaringExtension();
- element.setImageDescriptor(TeamImages.getImageDescriptorFromExtension(extension, iconName));
- }
- // ensure that a class was specified
- if (element.getConfigurationElement() == null) {
- // Missing attribute
- return false;
- }
- setForcePreviousAndNextButtons(true);
- return true;
- }
- /*
- * Method declared on IConfigurationWizard
- */
- public void init(IWorkbench workbench, IProject project) {
- this.workbench = workbench;
- this.project = project;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizardMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizardMainPage.java
deleted file mode 100644
index e6f21d13d..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigureProjectWizardMainPage.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.wizard.IWizardPage;
-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.Table;
-import org.eclipse.team.ui.IConfigurationWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * The main page of the configure project wizard. It contains a table
- * which lists possible team providers with which to configure the project.
- * The user may select one and press "Next", which will display a provider-
- * specific wizard page.
- */
-public class ConfigureProjectWizardMainPage extends WizardPage {
- private Table table;
- private TableViewer viewer;
- private AdaptableList wizards;
- private IWorkbench workbench;
- private IProject project;
- private String description;
-
- private IConfigurationWizard selectedWizard;
-
- /**
- * Create a new ConfigureProjectWizardMainPage
- *
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page title
- * @param wizards the wizards to populate the table with
- */
- public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards) {
- this(pageName,title,titleImage,wizards,Policy.bind("ConfigureProjectWizardMainPage.selectRepository")); //$NON-NLS-1$
- }
-
- /**
- * Create a new ConfigureProjectWizardMainPage
- *
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page title
- * @param wizards the wizards to populate the table with
- * @param description The string to use as a description label
- */
- public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards, String description) {
- super(pageName, title, titleImage);
- this.wizards = wizards;
- this.description = description;
- }
-
- public IConfigurationWizard getSelectedWizard() {
- return selectedWizard;
- }
- /*
- * @see WizardPage#canFlipToNextPage
- */
- public boolean canFlipToNextPage() {
- return selectedWizard != null && selectedWizard.getPageCount() > 0;
- }
- /*
- * @see WizardPage#createControl
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- setControl(composite);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARE_PROJECT_PAGE);
-
- Label label = new Label(composite, SWT.LEFT);
- label.setText(description);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
-
- table = new Table(composite, SWT.SINGLE | SWT.BORDER);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = table.getItemHeight() * 7;
- table.setLayoutData(data);
- viewer = new TableViewer(table);
- viewer.setContentProvider(new WorkbenchContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- // Initialize the wizard so we can tell whether to enable the Next button
- ISelection selection = event.getSelection();
- if (selection == null || !(selection instanceof IStructuredSelection)) {
- selectedWizard = null;
- setPageComplete(false);
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- if (ss.size() != 1) {
- selectedWizard = null;
- setPageComplete(false);
- return;
- }
- ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement();
- try {
- selectedWizard = (IConfigurationWizard)selectedElement.createExecutableExtension();
- selectedWizard.init(workbench, project);
- } catch (CoreException e) {
- return;
- }
- selectedWizard.addPages();
-
- // Ask the container to update button enablement
- setPageComplete(true);
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- getWizard().getContainer().showPage(getNextPage());
- }
- });
- viewer.setInput(wizards);
- }
- /**
- * The <code>WizardSelectionPage</code> implementation of
- * this <code>IWizardPage</code> method returns the first page
- * of the currently selected wizard if there is one.
- *
- * @see WizardPage#getNextPage
- */
- public IWizardPage getNextPage() {
- if (selectedWizard == null) return null;
- return selectedWizard.getStartingPage();
- }
- /**
- * Set the workbench to the argument
- *
- * @param workbench the workbench to set
- */
- public void setWorkbench(IWorkbench workbench) {
- this.workbench = workbench;
- }
- /**
- * Set the project to the argument
- *
- * @param project the project to set
- */
- public void setProject(IProject project) {
- this.project = project;
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- table.setFocus();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java
deleted file mode 100644
index 62990d572..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialog.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A simple superclass for detail button dialogs.
- */
-abstract public class DetailsDialog extends Dialog {
- /**
- * The Details button.
- */
- private Button detailsButton;
-
- /**
- * The Ok button.
- */
- private Button okButton;
-
- /**
- * The title of the dialog.
- */
- private String title;
-
- /**
- * The error message
- */
- private Label errorMessageLabel;
-
- /**
- * The SWT list control that displays the error details.
- */
- private Composite detailsComposite;
-
- /**
- * Indicates whether the error details viewer is currently created.
- */
- private boolean detailsCreated = false;
-
- /**
- * The key for the image to be displayed (one of the image constants on Dialog)
- */
- private String imageKey = null;
-
- /**
- * Creates a details pane dialog.
- * Note that the dialog will have no visual representation (no widgets)
- * until it is told to open.
- *
- * @param parentShell the shell under which to create this dialog
- * @param dialogTitle the title to use for this dialog
- * @param message the message to show in this dialog
- * @param status the error to show to the user
- * @param displayMask the mask to use to filter the displaying of child items,
- * as per <code>IStatus.matches</code>
- * @see org.eclipse.core.runtime.IStatus#matches
- */
- public DetailsDialog(Shell parentShell, String dialogTitle) {
- super(parentShell);
- this.title = dialogTitle;
- setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- * Handles the pressing of the Ok or Details button in this dialog.
- * If the Ok button was pressed then close this dialog. If the Details
- * button was pressed then toggle the displaying of the error details area.
- * Note that the Details button will only be visible if the error being
- * displayed specifies child details.
- */
- protected void buttonPressed(int id) {
- if (id == IDialogConstants.DETAILS_ID) { // was the details button pressed?
- toggleDetailsArea();
- } else {
- super.buttonPressed(id);
- }
- }
-
- /* (non-Javadoc)
- * Method declared in Window.
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(title);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Details buttons
- if(includeOkButton()) {
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- }
- if (includeCancelButton()) {
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
- detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false);
- updateEnablements();
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- * Creates and returns the contents of the upper part
- * of the dialog (above the button bar).
- */
- final protected Control createDialogArea(Composite parent) {
- // create composite
- Composite composite = (Composite)super.createDialogArea(parent);
-
- // create image
- Image image = JFaceResources.getImageRegistry().get(getImageKey());
- if (image != null) {
- // create a composite to split the dialog area in two
- Composite top = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.numColumns = 2;
- top.setLayout(layout);
- top.setLayoutData(new GridData(GridData.FILL_BOTH));
- top.setFont(parent.getFont());
-
- // add the image to the left of the composite
- Label label = new Label(top, 0);
- image.setBackground(label.getBackground());
- label.setImage(image);
- label.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_CENTER |
- GridData.VERTICAL_ALIGN_CENTER));
-
- // add a composite to the right to contain the custom components
- Composite right = new Composite(top, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- right.setLayout(layout);
- right.setLayoutData(new GridData(GridData.FILL_BOTH));
- right.setFont(parent.getFont());
- createMainDialogArea(right);
- } else {
- createMainDialogArea(composite);
- }
-
- errorMessageLabel = new Label(composite, SWT.NONE);
- errorMessageLabel.setLayoutData(new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.HORIZONTAL_ALIGN_FILL));
- errorMessageLabel.setFont(parent.getFont());
- errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
-
- return composite;
- }
-
- /**
- * Creates the dialog's top composite
- *
- * @param parent the parent composite
- */
- abstract protected void createMainDialogArea(Composite parent);
-
- /**
- * Create this dialog's drop-down list component.
- *
- * @param parent the parent composite
- * @return the drop-down list component
- */
- abstract protected Composite createDropDownDialogArea(Composite parent);
-
- /**
- * Toggles the unfolding of the details area. This is triggered by
- * the user pressing the details button.
- */
- private void toggleDetailsArea() {
- Point windowSize = getShell().getSize();
- Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- if (detailsCreated) {
- detailsComposite.dispose();
- detailsCreated = false;
- detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
- } else {
- detailsComposite = createDropDownDialogArea((Composite)getContents());
- detailsCreated = true;
- detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
- }
-
- Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
- }
-
- final protected void setErrorMessage(String error) {
- if(errorMessageLabel != null) {
- if(error == null || error.length() == 0) {
- errorMessageLabel.setText(""); //$NON-NLS-1$
- } else {
- errorMessageLabel.setText(error);
- }
- errorMessageLabel.update();
- }
- }
-
- final protected void setPageComplete(boolean complete) {
- if(okButton != null ) {
- okButton.setEnabled(complete);
- }
- }
-
- abstract protected void updateEnablements();
-
- protected boolean includeCancelButton() {
- return true;
- }
-
- protected boolean includeOkButton() {
- return true;
- }
-
- /**
- * Returns the imageKey.
- * @return String
- */
- protected String getImageKey() {
- return imageKey;
- }
-
-
- /**
- * Sets the imageKey.
- * @param imageKey The imageKey to set
- */
- protected void setImageKey(String imageKey) {
- this.imageKey = imageKey;
- }
-
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java
deleted file mode 100644
index 34119fa12..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/DetailsDialogWithProjects.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.IDialogConstants;
-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.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Display a message with a details that can contain a list of projects
- */
-public class DetailsDialogWithProjects extends DetailsDialog {
-
- private String message;
- private String detailsTitle;
- private IProject[] projects;
-
- private Button actionButton;
- private org.eclipse.swt.widgets.List detailsList;
-
- private boolean includeCancelButton;
-
- /**
- * Constructor for DetailsDialogWithProjects.
- * @param parentShell
- * @param dialogTitle
- */
- public DetailsDialogWithProjects(Shell parentShell, String dialogTitle, String dialogMessage, String detailsTitle, IProject[] projects, boolean includeCancelButton, String imageKey) {
- super(parentShell, dialogTitle);
- setImageKey(imageKey);
- this.message = dialogMessage;
- this.detailsTitle = detailsTitle;
- this.projects = projects;
- this.includeCancelButton = includeCancelButton;
- }
-
- /**
- * @see DetailsDialog#createMainDialogArea(Composite)
- */
- protected void createMainDialogArea(Composite composite) {
- Label label = new Label(composite, SWT.WRAP);
- label.setText(message); //$NON-NLS-1$
- GridData data = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- label.setLayoutData(data);
- label.setFont(composite.getFont());
- updateEnablements();
- }
-
- /**
- * @see DetailsDialog#createDropDownDialogArea(Composite)
- */
- protected Composite createDropDownDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData data = new GridData ();
- data.heightHint = 75;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- detailsList.setLayoutData(data);
-
- if (detailsTitle != null) {
- detailsList.add(detailsTitle);
- }
-
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- detailsList.add(projects[i].getName()); //$NON-NLS-1$
- }
- return composite;
- }
-
- /**
- * @see DetailsDialog#updateEnablements()
- */
- protected void updateEnablements() {
- setPageComplete(true);
- }
-
- /**
- * @see DetailsDialog#includeCancelButton()
- */
- protected boolean includeCancelButton() {
- return includeCancelButton;
- }
-
-}
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
deleted file mode 100644
index 217ed6dd7..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - 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.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.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class ExportProjectSetMainPage extends TeamWizardPage {
- Text fileText;
- String file = ""; //$NON-NLS-1$
- 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);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.EXPORT_PROJECT_SET_PAGE);
-
- createLabel(composite, Policy.bind("ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2")); //$NON-NLS-1$
-
- table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- tableViewer = new CheckboxTableViewer(table);
- table.setLayout(new TableLayout());
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 300;
- table.setLayoutData(data);
- 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);
- }
- updateEnablement();
- }
- });
- 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 = 3;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- inner.setLayout(layout);
-
- createLabel(inner, Policy.bind("ExportProjectSetMainPage.&File_name__1")); //$NON-NLS-1$
- fileText = createTextField(inner);
- if (file != null) fileText.setText(file);
- 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$
- 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(), SWT.SAVE);
- d.setFilterExtensions(new String[] {"*.psf"}); //$NON-NLS-1$
- d.setFilterNames(new String[] {Policy.bind("ExportProjectSetMainPage.Project_Set_Files_3")}); //$NON-NLS-1$
- d.setFileName(Policy.bind("ExportProjectSetMainPage.default")); //$NON-NLS-1$
- d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$
- 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 (selectedProjects.size() == 0) {
- setMessage(null);
- complete = false;
- } else 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"), ERROR); //$NON-NLS-1$
- complete = false;
- } else {
- complete = true;
- }
- }
- if (complete) {
- setMessage(null);
- }
- setPageComplete(complete);
- }
-
- public String getFileName() {
- return file;
- }
- public void setFileName(String file) {
- if (file != null) {
- this.file = file;
- }
- }
-
- public IProject[] getSelectedProjects() {
- return (IProject[])selectedProjects.toArray(new IProject[selectedProjects.size()]);
- }
- public void setSelectedProjects(IProject[] selectedProjects) {
- this.selectedProjects.addAll(Arrays.asList(selectedProjects));
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- fileText.setFocus();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java
deleted file mode 100644
index 5ed5e1da6..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IHelpContextIds.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-public interface IHelpContextIds {
- public static final String PREFIX = TeamUIPlugin.ID + "."; //$NON-NLS-1$
-
- // Preference Pages
- public static final String TEAM_PREFERENCE_PAGE = PREFIX + "team_preference_page_context"; //$NON-NLS-1$
- public static final String IGNORE_PREFERENCE_PAGE = PREFIX + "ignore_preference_page_context"; //$NON-NLS-1$
- public static final String FILE_TYPE_PREFERENCE_PAGE = PREFIX + "file_type_preference_page_context"; //$NON-NLS-1$
-
- // Wizard Pages
- public static final String SHARE_PROJECT_PAGE = PREFIX + "share_project_page_context"; //$NON-NLS-1$
- public static final String IMPORT_PROJECT_SET_PAGE = PREFIX + "import_project_set_page_context"; //$NON-NLS-1$
- public static final String EXPORT_PROJECT_SET_PAGE = PREFIX + "export_project_set_page_context"; //$NON-NLS-1$
- public static final String TARGET_NEW_SITE_PAGE = PREFIX + "target_new_site_page_context"; //$NON-NLS-1$
- public static final String TARGET_MAPPING_SELECTION_PAGE = PREFIX + "target_mapping_selection_page_context"; //$NON-NLS-1$
-
- // Catchup Release Viewers
- public static final String TARGET_CATCHUP_RELEASE_VIEWER = PREFIX + "target_catchup_release_viewer_context"; //$NON-NLS-1$
-
- // Target Actions
- public static final String SYNC_GET_ACTION = PREFIX + "sync_get_action_context"; //$NON-NLS-1$
- public static final String SYNC_PUT_ACTION = PREFIX + "sync_put_action_context"; //$NON-NLS-1$
-
- // Views
- public static final String SITE_EXPLORER_VIEW = PREFIX + "site_explorer_view_context"; //$NON-NLS-1$
- public static final String SYNC_VIEW = PREFIX + "sync_view_context"; //$NON-NLS-1$
-
- // Site Explorer View Actions
- public static final String ADD_SITE_ACTION = PREFIX + "add_site_action_context"; //$NON-NLS-1$
- public static final String NEW_FOLDER_ACTION = PREFIX + "new_folder_action_context"; //$NON-NLS-1$
-
- // Sync View Actions
- public static final String OPEN_ACTION = PREFIX + "open_action_context"; //$NON-NLS-1$
- public static final String EXPANDALL_ACTION = PREFIX + "expandall_action_context"; //$NON-NLS-1$
- public static final String REMOVE_ACTION = PREFIX + "remove_action_context"; //$NON-NLS-1$
- public static final String NAVIGATOR_SHOW_ACTION = PREFIX + "navigator_show_action_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPromptCondition.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPromptCondition.java
deleted file mode 100644
index 60234a5f2..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IPromptCondition.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * Input to a confirm prompt
- *
- * @see PromptingDialog
- */
-public interface IPromptCondition {
- /**
- * Answers <code>true</code> if a prompt is required for this resource and
- * false otherwise.
- */
- public boolean needsPrompt(IResource resource);
-
- /**
- * Answers the message to include in the prompt.
- */
- public String promptMessage(IResource resource);
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java
deleted file mode 100644
index 5ae0ce0c3..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/IgnorePreferencePage.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.util.PropertyChangeEvent;
-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.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.team.core.IIgnoreInfo;
-import org.eclipse.team.core.Team;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-public class IgnorePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private Table ignoreTable;
- private Button addButton;
- private Button removeButton;
- public void init(IWorkbench workbench) {
- setDescription(Policy.bind("IgnorePreferencePage.description")); //$NON-NLS-1$
- }
-
- /**
- * Creates preference page controls on demand.
- *
- * @param parent the parent for the preference page
- */
- protected Control createContents(Composite ancestor) {
- noDefaultAndApplyButton();
-
- Composite parent = new Composite(ancestor, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- parent.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- parent.setLayoutData(data);
-
- // set F1 help
- WorkbenchHelp.setHelp(parent, IHelpContextIds.IGNORE_PREFERENCE_PAGE);
-
- Label l1 = new Label(parent, SWT.NULL);
- l1.setText(Policy.bind("IgnorePreferencePage.ignorePatterns")); //$NON-NLS-1$
- data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- data.horizontalSpan = 2;
- l1.setLayoutData(data);
-
- ignoreTable = new Table(parent, SWT.CHECK | SWT.BORDER);
- GridData gd = new GridData(GridData.FILL_BOTH);
- //gd.widthHint = convertWidthInCharsToPixels(30);
- gd.heightHint = 300;
- ignoreTable.setLayoutData(gd);
- ignoreTable.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- handleSelection();
- }
- });
-
- Composite buttons = new Composite(parent, SWT.NULL);
- buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttons.setLayout(layout);
-
- addButton = new Button(buttons, SWT.PUSH);
- addButton.setText(Policy.bind("IgnorePreferencePage.add")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- addButton.setLayoutData(data);
- addButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- addIgnore();
- }
- });
-
-
- removeButton = new Button(buttons, SWT.PUSH);
- removeButton.setText(Policy.bind("IgnorePreferencePage.remove")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- removeButton.setLayoutData(data);
- removeButton.setEnabled(false);
- removeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- removeIgnore();
- }
- });
-
- fillTable();
- Dialog.applyDialogFont(ancestor);
- return parent;
- }
- /**
- * Do anything necessary because the OK button has been pressed.
- *
- * @return whether it is okay to close the preference page
- */
- public boolean performOk() {
- int count = ignoreTable.getItemCount();
- String[] patterns = new String[count];
- boolean[] enabled = new boolean[count];
- TableItem[] items = ignoreTable.getItems();
- for (int i = 0; i < count; i++) {
- patterns[i] = items[i].getText();
- enabled[i] = items[i].getChecked();
- }
- Team.setAllIgnores(patterns, enabled);
- TeamUIPlugin.broadcastPropertyChange(new PropertyChangeEvent(this, TeamUI.GLOBAL_IGNORES_CHANGED, null, null));
- return true;
- }
-
- private void fillTable() {
- IIgnoreInfo[] ignore = Team.getAllIgnores();
- for (int i = 0; i < ignore.length; i++) {
- IIgnoreInfo info = ignore[i];
- TableItem item = new TableItem(ignoreTable, SWT.NONE);
- item.setText(info.getPattern());
- item.setChecked(info.getEnabled());
- }
- }
-
- private void addIgnore() {
- InputDialog dialog = new InputDialog(getShell(), Policy.bind("IgnorePreferencePage.enterPatternShort"), Policy.bind("IgnorePreferencePage.enterPatternLong"), null, null); //$NON-NLS-1$ //$NON-NLS-2$
- dialog.open();
- if (dialog.getReturnCode() != InputDialog.OK) return;
- String pattern = dialog.getValue();
- if (pattern.equals("")) return; //$NON-NLS-1$
- // Check if the item already exists
- TableItem[] items = ignoreTable.getItems();
- for (int i = 0; i < items.length; i++) {
- if (items[i].getText().equals(pattern)) {
- MessageDialog.openWarning(getShell(), Policy.bind("IgnorePreferencePage.patternExistsShort"), Policy.bind("IgnorePreferencePage.patternExistsLong")); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- }
- TableItem item = new TableItem(ignoreTable, SWT.NONE);
- item.setText(pattern);
- item.setChecked(true);
- }
-
- private void removeIgnore() {
- int[] selection = ignoreTable.getSelectionIndices();
- ignoreTable.remove(selection);
- }
- private void handleSelection() {
- if (ignoreTable.getSelectionCount() > 0) {
- removeButton.setEnabled(true);
- } else {
- removeButton.setEnabled(false);
- }
- }
-}
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
deleted file mode 100644
index c10b0721d..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ImportProjectSetMainPage.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - 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.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-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;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class ImportProjectSetMainPage extends TeamWizardPage {
- Text fileText;
- String file = ""; //$NON-NLS-1$
- Button browseButton;
- Button createWorkingSetButton;
- Text workingSetNameField;
-
- private boolean createWorkingSet = false;
- private String workingSetName = ""; //$NON-NLS-1$
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 80;
-
- 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);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.IMPORT_PROJECT_SET_PAGE);
-
- Composite inner = new Composite(composite, SWT.NULL);
- inner.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- inner.setLayout(layout);
-
- createLabel(inner, Policy.bind("ImportProjectSetMainPage.Project_Set_File_Name__2")); //$NON-NLS-1$
- fileText = createTextField(inner);
- if (file != null) fileText.setText(file);
- 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());
- d.setFilterExtensions(new String[] {"*.psf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$
- d.setFilterNames(new String[] {Policy.bind("ImportProjectSetMainPage.Project_Set_Files_2"), Policy.bind("ImportProjectSetMainPage.allFiles")}); //$NON-NLS-1$ //$NON-NLS-2$
- d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$
- String f = d.open();
- if (f != null) {
- fileText.setText(f);
- file = f;
- }
- }
- });
-
- createWorkinSetCreationArea(inner, 3);
- setControl(composite);
- updateEnablement();
- }
-
- /**
- * Method createWorkinSetCreationArea.
- * @param inner
- */
- private void createWorkinSetCreationArea(Composite composite, int numColumns) {
-
- createWorkingSetButton = new Button(composite, SWT.CHECK | SWT.RIGHT);
- createWorkingSetButton.setText(Policy.bind("ImportProjectSetMainPage.createWorkingSetLabel")); //$NON-NLS-1$
- createWorkingSetButton.setSelection(createWorkingSet);
- GridData data = new GridData();
- data.horizontalSpan = numColumns;
- createWorkingSetButton.setLayoutData(data);
-
- final Label label = new Label(composite, SWT.NONE);
- label.setText(Policy.bind("ImportProjectSetMainPage.workingSetLabel")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalSpan = 1;
- label.setLayoutData(data);
- label.setEnabled(createWorkingSet);
-
- workingSetNameField = new Text(composite, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- data.horizontalSpan = 1;
- workingSetNameField.setLayoutData(data);
- workingSetNameField.setEnabled(createWorkingSet);
-
- createWorkingSetButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- createWorkingSet = createWorkingSetButton.getSelection();
- label.setEnabled(createWorkingSet);
- workingSetNameField.setEnabled(createWorkingSet);
- updateEnablement();
- }
- });
- workingSetNameField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- updateEnablement();
- }
- });
- }
-
- private boolean validateWorkingSetName() {
- if (createWorkingSet) {
- workingSetName = workingSetNameField.getText();
- if (workingSetName.length() == 0) {
- setMessage(Policy.bind("ImportProjectSetMainPage.workingSetNameEmpty"), ERROR); //$NON-NLS-1$
- return false;
- } else {
- // todo: verify name doesn't already exist
- IWorkingSet existingSet = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName);
- if (existingSet != null) {
- setMessage(Policy.bind("ImportProjectSetMainPage.workingSetNameExists"), WARNING); //$NON-NLS-1$
- return true;
- }
- }
- }
- setMessage(null);
- return true;
- }
-
- private void updateEnablement() {
- boolean complete;
- setMessage(null);
- if (file.length() == 0) {
- 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"), ERROR); //$NON-NLS-1$
- complete = false;
- } else if (f.isDirectory()) {
- setMessage(Policy.bind("ImportProjectSetMainPage.You_have_specified_a_folder_5"), ERROR); //$NON-NLS-1$
- complete = false;
- } else {
- complete = validateWorkingSetName();
- }
- }
- setPageComplete(complete);
- }
-
- public String getFileName() {
- return file;
- }
- public void setFileName(String file) {
- if (file != null) {
- this.file = file;
- }
- }
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- fileText.setFocus();
- }
- }
-
- /**
- * @return String
- */
- public String getWorkingSetName() {
- if (!createWorkingSet) return null;
- return workingSetName;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java
deleted file mode 100644
index c07f3f45c..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/NatureToPropertyAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class NatureToPropertyAction extends TeamAction {
-
- /**
- * @see org.eclipse.team.internal.ui.actions.TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return true;
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- final Shell shell = getShell();
- IProject[] projects = getSelectedProjects();
- List statii = new ArrayList();
- for (int i = 0; i < projects.length; i++) {
- IFile file = projects[i].getFile(".project"); //$NON-NLS-1$
- IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] {file}, shell);
- if (status.getCode() == IStatus.OK) {
- RepositoryProvider.convertNatureToProperty(projects[i], true);
- } else {
- statii.add(status);
- RepositoryProvider.convertNatureToProperty(projects[i], false);
- }
- }
- if (!statii.isEmpty()) {
- final IStatus[] statusArray = (IStatus[])statii.toArray(new IStatus[statii.size()]);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- if (statusArray.length == 1) {
- ErrorDialog.openError(shell, Policy.bind("NatureToPropertyAction.label"), Policy.bind("NatureToPropertyAction.message"), statusArray[0]); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- ErrorDialog.openError(shell, Policy.bind("NatureToPropertyAction.label"), Policy.bind("NatureToPropertyAction.message"), new MultiStatus(TeamUIPlugin.ID, 0, statusArray, Policy.bind("NatureToPropertyAction.multiMessage"), null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- });
- for (int i = 0; i < statusArray.length; i++) {
- TeamUIPlugin.log(statusArray[i]);
- }
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("NatureToPropertyAction.label"), PROGRESS_DIALOG); //$NON-NLS-1$
- }
-}
-
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
deleted file mode 100644
index 81f11045d..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Policy.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
-import org.eclipse.team.internal.core.NullSubProgressMonitor;
-
-/**
- * Policy implements NLS convenience methods for the plugin and
- * makes progress monitor policy decisions
- */
-public class Policy {
- // The resource bundle to get strings from
- protected static ResourceBundle bundle = null;
-
- /**
- * Creates a NLS catalog for the given locale.
- *
- * @param bundleName the name of the bundle
- */
- public static void localize(String bundleName) {
- bundle = ResourceBundle.getBundle(bundleName);
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string.
- *
- * @param id the id to look up
- * @param binding the string to bind to the result
- * @return the bound string
- */
- public static String bind(String id, String binding) {
- return bind(id, new String[] { binding });
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given strings.
- *
- * @param id the id to look up
- * @param binding1 the first string to bind to the result
- * @param binding2 the second string to bind to the result
- * @return the bound string
- */
- public static String bind(String id, String binding1, String binding2) {
- return bind(id, new String[] { binding1, binding2 });
- }
-
- /**
- * Gets a string from the resource bundle. We don't want to crash because of a missing String.
- * Returns the key if not found.
- *
- * @param key the id to look up
- * @return the string with the given key
- */
- public static String bind(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it with the given arguments. If the key is
- * not found, return the key.
- *
- * @param key the id to look up
- * @param args the strings to bind to the result
- * @return the bound string
- */
- public static String bind(String key, Object[] args) {
- try {
- return MessageFormat.format(bind(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Checks if the progress monitor is canceled.
- *
- * @param monitor the onitor to check for cancellation
- * @throws OperationCanceledException if the monitor is canceled
- */
- public static void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
- /**
- * Returns a monitor for the given monitor
- *
- * @param monitor the monitor to return a monitor for
- * @return a monitor for the given monitor
- */
- public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
- if (monitor == null) {
- return new NullProgressMonitor();
- }
- return monitor;
- }
-
- public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks);
- }
-
- public static IProgressMonitor subInfiniteMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new InfiniteSubProgressMonitor(monitor, ticks);
- }
-
- public static IProgressMonitor subNullMonitorFor(IProgressMonitor monitor) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new NullSubProgressMonitor(monitor);
- }
-
- public static String toTruncatedPath(IPath path, int split) {
- // Search backwards until split separators are found
- int count = 0;
- String stringPath = path.toString();
- int index = stringPath.length();
- while (count++ < split && index != -1) {
- index = stringPath.lastIndexOf(IPath.SEPARATOR, index - 1);
- }
- if (index == -1) {
- return stringPath;
- } else {
- return "..." + stringPath.substring(index); //$NON-NLS-1$
- }
- }
-}
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
deleted file mode 100644
index f3f05277f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - 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")) { //$NON-NLS-1$
- map = new HashMap();
- inPsf = true;
- String version = atts.getValue("version"); //$NON-NLS-1$
- isVersionOne = version.equals("1.0"); //$NON-NLS-1$
- return;
- }
- if (isVersionOne) return;
- if (localName.equals("provider")) { //$NON-NLS-1$
- 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"); //$NON-NLS-1$
- references = new ArrayList();
- return;
- }
- if (localName.equals("project")) { //$NON-NLS-1$
- 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"); //$NON-NLS-1$
- 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")) { //$NON-NLS-1$
- inPsf = false;
- return;
- }
- if (isVersionOne) return;
- if (localName.equals("provider")) { //$NON-NLS-1$
- map.put(id, references);
- references = null;
- inProvider = false;
- return;
- }
- if (localName.equals("project")) { //$NON-NLS-1$
- 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
deleted file mode 100644
index 639213d6e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetExportWizard.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-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.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-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.ProjectSetCapability;
-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.ui.TeamImages;
-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"), TeamImages.getImageDescriptor(UIConstants.IMG_PROJECTSET_EXPORT_BANNER)); //$NON-NLS-1$ //$NON-NLS-2$
- IProject[] projects = (IProject[])selection.toList().toArray(new IProject[0]);
- mainPage.setSelectedProjects(projects);
- mainPage.setFileName(ProjectSetImportWizard.lastFile);
- 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 {
- String filename = mainPage.getFileName();
- Path path = new Path(filename);
- if (path.getFileExtension() == null) {
- filename = filename + ".psf"; //$NON-NLS-1$
- }
- ProjectSetImportWizard.lastFile = filename;
- File file = new File(filename);
- File parentFile = file.getParentFile();
- if (parentFile != null && !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;
- }
- }
-
- // Hash the projects by provider
- IProject[] projects = mainPage.getSelectedProjects();
- Map map = new HashMap();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if (provider != null) {
- String id = provider.getID();
- List list = (List)map.get(id);
- if (list == null) {
- list = new ArrayList();
- map.put(id, list);
- }
- list.add(project);
- }
- }
-
- Shell shell = getShell();
-
- BufferedWriter writer = null;
- try {
- writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); //$NON-NLS-1$
-
- writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$
- writer.newLine();
- writer.write("<psf version=\"2.0\">"); //$NON-NLS-1$
- writer.newLine();
-
- // For each provider id, do the writing
- Iterator it = map.keySet().iterator();
- monitor.beginTask(null, 1000 * map.keySet().size());
- while (it.hasNext()) {
- String id = (String)it.next();
- writer.write("\t<provider id=\""); //$NON-NLS-1$
- writer.write(id);
- writer.write("\">"); //$NON-NLS-1$
- writer.newLine();
- 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, 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]);
- writer.write("\"/>"); //$NON-NLS-1$
- writer.newLine();
- }
- }
- writer.write("\t</provider>"); //$NON-NLS-1$
- writer.newLine();
- }
- writer.write("</psf>"); //$NON-NLS-1$
- writer.newLine();
- result[0] = true;
- } catch (IOException e) {
- throw new InvocationTargetException(e);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- if (writer != null) {
- try {
- writer.close();
- } catch (IOException e) {
- throw new InvocationTargetException(e);
- }
- }
- }
-
- // notify provider types of the project set write
- for (Iterator iter = map.keySet().iterator();iter.hasNext();) {
- String id = (String) iter.next();
- RepositoryProviderType type = RepositoryProviderType.getProviderType(id);
- if (type != null) {
- ProjectSetCapability capability = type.getProjectSetCapability();
- if (capability != null) {
- capability.projectSetCreated(file, shell, new SubProgressMonitor(monitor, 10));
- }
- }
- }
-
- monitor.done();
- }
- });
- } 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
deleted file mode 100644
index 11c83b197..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImportWizard.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - 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.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.xerces.parsers.SAXParser;
-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.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.team.ui.TeamImages;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class ProjectSetImportWizard extends Wizard implements IImportWizard {
- ImportProjectSetMainPage mainPage;
- public static String lastFile;
-
- 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"), TeamImages.getImageDescriptor(UIConstants.IMG_PROJECTSET_IMPORT_BANNER)); //$NON-NLS-1$ //$NON-NLS-2$
- mainPage.setFileName(lastFile);
- addPage(mainPage);
- }
- public boolean performFinish() {
-
- // check if the desired working set exists
- final String workingSetName = mainPage.getWorkingSetName();
- if (workingSetName != null) {
- IWorkingSet existingSet = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSet(workingSetName);
- if (existingSet != null &&
- !MessageDialog.openConfirm(getShell(), Policy.bind("ProjectSetImportWizard.workingSetExistsTitle"), Policy.bind("ProjectSetImportWizard.workingSetExistsMessage", workingSetName))) //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- }
-
- final boolean[] result = new boolean[] {false};
- try {
- getContainer().run(true, true, new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException {
- InputStreamReader reader = null;
- try {
- String filename = mainPage.getFileName();
- lastFile = filename;
- 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();
- List newProjects = new ArrayList();
- if (map.size() == 0 && handler.isVersionOne) {
- IProjectSetSerializer serializer = Team.getProjectSetSerializer("versionOneSerializer"); //$NON-NLS-1$
- if (serializer != null) {
- IProject[] projects = serializer.addToWorkspace(new String[0], filename, getShell(), monitor);
- if (projects != null)
- newProjects.addAll(Arrays.asList(projects));
- }
- } 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) {
- IProject[] projects = serializer.addToWorkspace((String[])references.toArray(new String[references.size()]), filename, getShell(), monitor);
- if (projects != null)
- newProjects.addAll(Arrays.asList(projects));
- }
- }
- }
- if (workingSetName != null)
- createWorkingSet(workingSetName, (IProject[]) newProjects.toArray(new IProject[newProjects.size()]));
- result[0] = true;
- } catch (IOException e) {
- throw new InvocationTargetException(e);
- } catch (SAXException e) {
- throw new InvocationTargetException(e);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException 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];
- }
-
- private void createWorkingSet(String workingSetName, IProject[] projects) {
- IWorkingSetManager manager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
- IWorkingSet oldSet = manager.getWorkingSet(workingSetName);
- if (oldSet == null) {
- IWorkingSet newSet = manager.createWorkingSet(workingSetName, projects);
- manager.addWorkingSet(newSet);
- }else {
- oldSet.setElements(projects);
- }
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PromptingDialog.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PromptingDialog.java
deleted file mode 100644
index fd33ae38b..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/PromptingDialog.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A confirmation dialog helper that will either show a 'yes/no/yes to all/cancel'
- * dialog to confirm an action performed on several resources or if only one
- * resource is specified 'ok/cancel' will be shown.
- */
-public class PromptingDialog {
- private IResource[] resources;
- private Shell shell;
- private String[] buttons;
- private boolean confirmOverwrite = true;
- private IPromptCondition condition;
- private String title;
- private boolean hasMultipleResources;
-
- /**
- * Prompt for the given resources using the specific condition. The prompt dialog will
- * have the title specified.
- */
- public PromptingDialog(Shell shell, IResource[] resources, IPromptCondition condition, String title) {
- this.condition = condition;
- this.resources = resources;
- this.title = title;
- this.shell = shell;
- this.hasMultipleResources = resources.length > 1;
- if (hasMultipleResources) {
- buttons = new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL};
- } else {
- buttons = new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL};
- }
- }
-
- /**
- * Call to calculate and show prompt. If no resources satisfy the prompt condition
- * a dialog won't be shown. The resources for which the user confirmed the action
- * are returned.
- */
- public IResource[] promptForMultiple() throws InterruptedException {
- List targetResources = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (condition.needsPrompt(resource) && confirmOverwrite) {
- if (confirmOverwrite(condition.promptMessage(resource))) {
- targetResources.add(resource);
- }
- } else {
- targetResources.add(resource);
- }
- }
- return (IResource[]) targetResources.toArray(new IResource[targetResources.size()]);
- }
-
- /**
- * Opens the confirmation dialog based on the prompt condition settings.
- */
- private boolean confirmOverwrite(String msg) throws InterruptedException {
- if (!confirmOverwrite) {
- return true;
- }
- final MessageDialog dialog =
- new MessageDialog(shell, title, null, msg, MessageDialog.QUESTION, buttons, 0);
-
- // run in syncExec because callback is from an operation,
- // which is probably not running in the UI thread.
- shell.getDisplay().syncExec(
- new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- if (hasMultipleResources) {
- switch (dialog.getReturnCode()) {
- case 0://Yes
- return true;
- case 1://Yes to all
- confirmOverwrite = false;
- return true;
- case 2://No
- return false;
- case 3://Cancel
- default:
- throw new InterruptedException();
- }
- } else {
- return dialog.getReturnCode() == 0;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamPreferencePage.java
deleted file mode 100644
index 0cd120529..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamPreferencePage.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-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.Control;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class TeamPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- Button syncModeButton;
-
- public TeamPreferencePage() {
- setDescription(Policy.bind("TeamPreferencePage.General_settings_for_Team_support_1")); //$NON-NLS-1$
- }
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.TEAM_PREFERENCE_PAGE);
-
- // GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- // GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
-
- // Create the checkbox for sync mode
- syncModeButton = createCheckBox(composite, Policy.bind("TeamPreferencePage.&Use_Incoming/Outgoing_mode_when_synchronizing_2")); //$NON-NLS-1$
-
- initializeValues();
- Dialog.applyDialogFont(parent);
- return composite;
- }
- /**
- * Creates an new checkbox instance and sets the default
- * layout data.
- *
- * @param group the composite in which to create the checkbox
- * @param label the string to set into the checkbox
- * @return the new checkbox
- */
- private Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- button.setLayoutData(data);
- return button;
- }
- /**
- * Returns preference store that belongs to the our plugin.
- * This is important because we want to store
- * our preferences separately from the desktop.
- *
- * @return the preference store for this plugin
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return TeamUIPlugin.getPlugin().getPreferenceStore();
- }
- /**
- * Defaults was clicked. Restore the CVS preferences to
- * their default values
- */
- protected void performDefaults() {
- super.performDefaults();
- IPreferenceStore store = getPreferenceStore();
- syncModeButton.setSelection(store.getDefaultBoolean(UIConstants.PREF_ALWAYS_IN_INCOMING_OUTGOING));
- }
- /**
- * OK was clicked. Store the CVS preferences.
- *
- * @return whether it is okay to close the preference page
- */
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
- store.setValue(UIConstants.PREF_ALWAYS_IN_INCOMING_OUTGOING, syncModeButton.getSelection());
- TeamUIPlugin.getPlugin().savePluginPreferences();
- return true;
- }
- /**
- * Initializes states of the controls from the preference store.
- */
- private void initializeValues() {
- IPreferenceStore store = getPreferenceStore();
- syncModeButton.setSelection(store.getBoolean(UIConstants.PREF_ALWAYS_IN_INCOMING_OUTGOING));
- }
- /**
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
deleted file mode 100644
index 51e5c4280..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIPlugin.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * TeamUIPlugin is the plugin for generic, non-provider specific,
- * team UI functionality in the workbench.
- */
-public class TeamUIPlugin extends AbstractUIPlugin {
-
- private static TeamUIPlugin instance;
- public static final String ID = "org.eclipse.team.ui"; //$NON-NLS-1$
-
- private static List propertyChangeListeners = new ArrayList(5);
-
- /**
- * Creates a new TeamUIPlugin.
- *
- * @param descriptor the plugin descriptor
- */
- public TeamUIPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- instance = this;
- }
- /**
- * Creates an extension. If the extension plugin has not
- * been loaded a busy cursor will be activated during the duration of
- * the load.
- *
- * @param element the config element defining the extension
- * @param classAttribute the name of the attribute carrying the class
- * @return the extension object
- */
- public static Object createExtension(final IConfigurationElement element, final String classAttribute) throws CoreException {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- IPluginDescriptor plugin = element.getDeclaringExtension().getDeclaringPluginDescriptor();
- if (plugin.isPluginActivated()) {
- return element.createExecutableExtension(classAttribute);
- } else {
- final Object [] ret = new Object[1];
- final CoreException [] exc = new CoreException[1];
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- ret[0] = element.createExecutableExtension(classAttribute);
- } catch (CoreException e) {
- exc[0] = e;
- }
- }
- });
- if (exc[0] != null)
- throw exc[0];
- else
- return ret[0];
- }
- }
-
- /**
- * Convenience method to get the currently active workbench page. Note that
- * the active page may not be the one that the usr perceives as active in
- * some situations so this method of obtaining the activae page should only
- * be used if no other method is available.
- *
- * @return the active workbench page
- */
- public static IWorkbenchPage getActivePage() {
- IWorkbenchWindow window = getPlugin().getWorkbench().getActiveWorkbenchWindow();
- if (window == null) return null;
- return window.getActivePage();
- }
-
- /**
- * Return the default instance of the receiver. This represents the runtime plugin.
- *
- * @return the singleton plugin instance
- */
- public static TeamUIPlugin getPlugin() {
- return instance;
- }
- /**
- * Initializes the preferences for this plugin if necessary.
- */
- protected void initializePreferences() {
- IPreferenceStore store = getPreferenceStore();
- store.setDefault(UIConstants.PREF_ALWAYS_IN_INCOMING_OUTGOING, false);
- }
-
- /**
- * Convenience method for logging statuses to the plugin log
- *
- * @param status the status to log
- */
- public static void log(IStatus status) {
- getPlugin().getLog().log(status);
- }
-
- public static void runWithProgress(Shell parent, boolean cancelable,
- final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- boolean createdShell = false;
- try {
- if (parent == null || parent.isDisposed()) {
- Display display = Display.getCurrent();
- if (display == null) {
- // cannot provide progress (not in UI thread)
- runnable.run(new NullProgressMonitor());
- return;
- }
- // get the active shell or a suitable top-level shell
- parent = display.getActiveShell();
- if (parent == null) {
- parent = new Shell(display);
- createdShell = true;
- }
- }
- // pop up progress dialog after a short delay
- final Exception[] holder = new Exception[1];
- BusyIndicator.showWhile(parent.getDisplay(), new Runnable() {
- public void run() {
- try {
- runnable.run(new NullProgressMonitor());
- } catch (InvocationTargetException e) {
- holder[0] = e;
- } catch (InterruptedException e) {
- holder[0] = e;
- }
- }
- });
- if (holder[0] != null) {
- if (holder[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException) holder[0];
- } else {
- throw (InterruptedException) holder[0];
- }
- }
- //new TimeoutProgressMonitorDialog(parent, TIMEOUT).run(true /*fork*/, cancelable, runnable);
- } finally {
- if (createdShell) parent.dispose();
- }
- }
-
- /**
- * Creates a progress monitor and runs the specified runnable.
- *
- * @param parent the parent Shell for the dialog
- * @param cancelable if true, the dialog will support cancelation
- * @param runnable the runnable
- *
- * @exception InvocationTargetException when an exception is thrown from the runnable
- * @exception InterruptedException when the progress monitor is cancelled
- */
- public static void runWithProgressDialog(Shell parent, boolean cancelable,
- final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
-
- new ProgressMonitorDialog(parent).run(cancelable, cancelable, runnable);
- }
-
- /**
- * @see Plugin#startup()
- */
- public void startup() throws CoreException {
- Policy.localize("org.eclipse.team.internal.ui.messages"); //$NON-NLS-1$
- initializePreferences();
- }
-
- /*
- * This method is only for use by the Target Management feature (see bug
- * 16509).
- *
- * @param t
- */
- public static void handle(Throwable t) {
- IStatus error = null;
- if (t instanceof InvocationTargetException) {
- t = ((InvocationTargetException)t).getTargetException();
- }
- if (t instanceof CoreException) {
- error = ((CoreException)t).getStatus();
- } else if (t instanceof TeamException) {
- error = ((TeamException)t).getStatus();
- } else {
- error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal"), t); //$NON-NLS-1$
- }
-
- Shell shell = new Shell(Display.getDefault());
-
- if (error.getSeverity() == IStatus.INFO) {
- MessageDialog.openInformation(shell, Policy.bind("information"), error.getMessage()); //$NON-NLS-1$
- } else {
- ErrorDialog.openError(shell, Policy.bind("exception"), null, error); //$NON-NLS-1$
- }
- shell.dispose();
- // Let's log non-team exceptions
- if (!(t instanceof TeamException)) {
- TeamUIPlugin.log(error);
- }
- }
-
- /**
- * Register for changes made to Team properties.
- */
- public static void addPropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
- }
-
- /**
- * Deregister as a Team property changes.
- */
- public static void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
- }
-
- /**
- * Broadcast a Team property change.
- */
- public static void broadcastPropertyChange(PropertyChangeEvent event) {
- for (Iterator it = propertyChangeListeners.iterator(); it.hasNext();) {
- IPropertyChangeListener listener = (IPropertyChangeListener)it.next();
- listener.propertyChange(event);
- }
- }
-}
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
deleted file mode 100644
index a49356e60..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamWizardPage.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - 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/TextPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java
deleted file mode 100644
index de6924434..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.graphics.Image;
-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.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.team.core.IFileTypeInfo;
-import org.eclipse.team.core.Team;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-/**
- * This preference page displays all patterns which determine whether a resource
- * is to be treated as a text file or not. The page allows the user to add or
- * remove entries from this table, and change their values from Text to Binary.
- */
-public class TextPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- // Some string constants for display purposes
- private static final String TEXT = Policy.bind("TextPreferencePage.text"); //$NON-NLS-1$
- private static final String BINARY = Policy.bind("TextPreferencePage.binary"); //$NON-NLS-1$
-
- // The name of the parameter in the file registry
- private static final String TYPE = "type"; //$NON-NLS-1$
-
- // The input for the table viewer
- private List input;
-
- // Widgets
- private TableViewer viewer;
- private Button removeButton;
- private Button changeButton;
-
- /**
- * TableEntry is a pair of strings representing an entry in the table
- */
- class TableEntry {
- String ext;
- String value;
- public TableEntry(String ext, String value) {
- this.ext = ext;
- this.value = value;
- }
- public String getExtension() {
- return ext;
- }
- public String getValue() {
- return value;
- }
- public void setValue(String value) {
- this.value = value;
- }
- }
- /**
- * TableLabelProvider provides labels for TableEntrys.
- */
- class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
- public String getColumnText(Object element, int columnIndex) {
- TableEntry entry = (TableEntry)element;
- switch (columnIndex) {
- case 0:
- return entry.getExtension();
- case 1:
- return entry.getValue();
- default:
- return null;
- }
- }
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
- };
-
- /*
- * Method declared on IWorkbenchPreferencePage
- */
- public void init(IWorkbench workbench) {
- }
- /*
- * @see PreferencePage#createControl
- */
- protected Control createContents(Composite ancestor) {
- noDefaultAndApplyButton();
-
- Composite parent = new Composite(ancestor, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- parent.setLayout(layout);
-
- // set F1 help
- WorkbenchHelp.setHelp(parent, IHelpContextIds.FILE_TYPE_PREFERENCE_PAGE);
-
- Label l1 = new Label(parent, SWT.NULL);
- l1.setText(Policy.bind("TextPreferencePage.description")); //$NON-NLS-1$
- GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- data.horizontalSpan = 2;
- l1.setLayoutData(data);
-
- viewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- Table table = viewer.getTable();
- new TableEditor(table);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.widthHint = convertWidthInCharsToPixels(30);
- /*
- * The hardcoded hint does not look elegant, but in reality
- * it does not make anything bound to this 100-pixel value,
- * because in any case the tree on the left is taller and
- * that's what really determines the height.
- */
- gd.heightHint = 100;
- table.setLayoutData(gd);
- table.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- handleSelection();
- }
- });
- // Create the table columns
- new TableColumn(table, SWT.NULL);
- new TableColumn(table, SWT.NULL);
- TableColumn[] columns = table.getColumns();
- columns[0].setText(Policy.bind("TextPreferencePage.extension")); //$NON-NLS-1$
- columns[1].setText(Policy.bind("TextPreferencePage.contents")); //$NON-NLS-1$
-
- CellEditor editor = new ComboBoxCellEditor(table, new String[] {TEXT, BINARY});
- viewer.setCellEditors(new CellEditor[] {null, editor});
- viewer.setColumnProperties(new String[] {"extension", "contents"}); //$NON-NLS-1$ //$NON-NLS-2$
- viewer.setCellModifier(new ICellModifier() {
- public Object getValue(Object element, String property) {
- String value = ((TableEntry)element).getValue();
- if (value.equals(TEXT)) {
- return new Integer(0);
- } else {
- return new Integer(1);
- }
- }
- public boolean canModify(Object element, String property) {
- return true;
- }
- public void modify(Object element, String property, Object value) {
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- TableEntry entry = (TableEntry)selection.getFirstElement();
- if (((Integer)value).intValue() == 0) {
- entry.setValue(TEXT);
- } else {
- entry.setValue(BINARY);
- }
- viewer.refresh(entry);
- }
- });
- viewer.setLabelProvider(new TableLabelProvider());
- viewer.setContentProvider(new IStructuredContentProvider() {
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- public Object[] getElements(Object inputElement) {
- if (inputElement == null) return null;
- return ((List)inputElement).toArray();
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if (selection == null || !(selection instanceof IStructuredSelection)) {
- return;
- }
- viewer.editElement(((IStructuredSelection)selection).getFirstElement(), 1);
- }
- });
- viewer.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- TableEntry entry1 = (TableEntry)e1;
- TableEntry entry2 = (TableEntry)e2;
- return super.compare(viewer, entry1.getExtension(), entry2.getExtension());
- }
- });
- TableLayout tl = new TableLayout();
- tl.addColumnData(new ColumnWeightData(50));
- tl.addColumnData(new ColumnWeightData(50));
- table.setLayout(tl);
-
- Composite buttons = new Composite(parent, SWT.NULL);
- buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttons.setLayout(layout);
-
- Button addButton = new Button(buttons, SWT.PUSH);
- addButton.setText(Policy.bind("TextPreferencePage.add")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- addButton.setLayoutData(data);
- addButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- addPattern();
- }
- });
-
- removeButton= new Button(buttons, SWT.PUSH);
- removeButton.setText(Policy.bind("TextPreferencePage.remove")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- removeButton.setLayoutData(data);
- removeButton.setEnabled(false);
- removeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- removePattern();
- }
- });
-
- changeButton = new Button(buttons, SWT.PUSH);
- changeButton.setText(Policy.bind("TextPreferencePage.change")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, changeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- changeButton.setLayoutData(data);
- changeButton.setEnabled(false);
- changeButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event e) {
- changePattern();
- }
- });
-
- fillTable();
- Dialog.applyDialogFont(parent);
- return parent;
- }
- /**
- * Do anything necessary because the OK button has been pressed.
- *
- * @return whether it is okay to close the preference page
- */
- public boolean performOk() {
- int size = input.size();
- String[] extensions = new String[size];
- int[] types = new int[size];
- int i = 0;
-
- Iterator it = input.iterator();
- while (it.hasNext()) {
- TableEntry entry = (TableEntry)it.next();
- String value = entry.getValue();
- if (value.equals(TEXT)) {
- types[i] = Team.TEXT;
- } else {
- types[i] = Team.BINARY;
- }
- extensions[i] = entry.getExtension();
- i++;
- }
- Team.setAllTypes(extensions, types);
- return true;
- }
- /**
- * Fill the table with the values from the file type registry
- */
- private void fillTable() {
- this.input = new ArrayList();
- IFileTypeInfo[] infos = Team.getAllTypes();
- for (int i = 0; i < infos.length; i++) {
- IFileTypeInfo info = infos[i];
- int type = info.getType();
- switch (type) {
- case Team.TEXT:
- input.add(new TableEntry(info.getExtension(), TEXT));
- break;
- case Team.BINARY:
- input.add(new TableEntry(info.getExtension(), BINARY));
- break;
- }
- }
- viewer.setInput(input);
- }
- /**
- * Add a new item to the table with the default type of Text.
- */
- private void addPattern() {
- InputDialog dialog = new InputDialog(getShell(), Policy.bind("TextPreferencePage.enterExtensionShort"), Policy.bind("TextPreferencePage.enterExtensionLong"), null, null); //$NON-NLS-1$ //$NON-NLS-2$
- dialog.open();
- if (dialog.getReturnCode() != InputDialog.OK) return;
- String pattern = dialog.getValue();
- if (pattern.equals("")) return; //$NON-NLS-1$
- // Check if the item already exists
- Iterator it = input.iterator();
- while (it.hasNext()) {
- TableEntry entry = (TableEntry)it.next();
- if (entry.getExtension().equals(pattern)) {
- MessageDialog.openWarning(getShell(), Policy.bind("TextPreferencePage.extensionExistsShort"), Policy.bind("TextPreferencePage.extensionExistsLong")); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- }
- input.add(new TableEntry(pattern, TEXT));
- viewer.refresh();
- }
- /**
- * Remove the selected items from the table
- */
- private void removePattern() {
- ISelection selection = viewer.getSelection();
- if (selection == null || !(selection instanceof IStructuredSelection)) {
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- Iterator it = ss.iterator();
- while (it.hasNext()) {
- TableEntry entry = (TableEntry)it.next();
- input.remove(entry);
- }
- viewer.refresh();
- }
- /**
- * Toggle the selected items' content types
- */
- private void changePattern() {
- ISelection selection = viewer.getSelection();
- if (selection == null || !(selection instanceof IStructuredSelection)) {
- return;
- }
- IStructuredSelection ss = (IStructuredSelection)selection;
- Iterator it = ss.iterator();
- while (it.hasNext()) {
- TableEntry entry = (TableEntry)it.next();
- String string = entry.getValue();
- if (string.equals(TEXT)) {
- entry.setValue(BINARY);
- } else {
- entry.setValue(TEXT);
- }
- viewer.refresh(entry);
- }
- }
- /**
- * The table viewer selection has changed. Update the remove and change button enablement.
- */
- private void handleSelection() {
- boolean empty = viewer.getSelection().isEmpty();
- removeButton.setEnabled(!empty);
- changeButton.setEnabled(!empty);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIConstants.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIConstants.java
deleted file mode 100644
index 7b7f3f21a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/UIConstants.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui;
-
-
-/**
- * Central location for constants used by the Team user interface.
- */
-public interface UIConstants {
- // plugin id
- public final String PLUGIN_ID = "org.eclipse.team.ui"; //$NON-NLS-1$
-
- // extension points
- public final String PT_CONFIGURATION ="configurationWizards"; //$NON-NLS-1$
- public final String PT_TARGETCONFIG ="targetConfigWizards"; //$NON-NLS-1$
- public final String PT_DECORATORS = "decorators"; //$NON-NLS-1$
-
- // image paths
- public final String ICON_PATH = "icons/full/"; //$NON-NLS-1$
-
- // local toolbars (colour)
- public final String IMG_DLG_SYNC_INCOMING = "clcl16/incom_synch.gif"; //$NON-NLS-1$
- public final String IMG_DLG_SYNC_OUTGOING = "clcl16/outgo_synch.gif"; //$NON-NLS-1$
- public final String IMG_DLG_SYNC_CONFLICTING = "clcl16/conflict_synch.gif"; //$NON-NLS-1$
- public final String IMG_REFRESH = "clcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_IGNORE_WHITESPACE = "clcl16/ignorews_edit.gif"; //$NON-NLS-1$
- public final String IMG_CONTENTS = "clcl16/contents.gif"; //$NON-NLS-1$
-
- // local toolbars (disabled)
- public final String IMG_DLG_SYNC_INCOMING_DISABLED = "dlcl16/incom_synch.gif"; //$NON-NLS-1$
- public final String IMG_DLG_SYNC_OUTGOING_DISABLED = "dlcl16/outgo_synch.gif"; //$NON-NLS-1$
- public final String IMG_DLG_SYNC_CONFLICTING_DISABLED = "dlcl16/conflict_synch.gif"; //$NON-NLS-1$
- public final String IMG_REFRESH_DISABLED = "dlcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_IGNORE_WHITESPACE_DISABLED = "dlcl16/ignorews_edit.gif"; //$NON-NLS-1$
- public final String IMG_CONTENTS_DISABLED = "dlcl16/contents.gif"; //$NON-NLS-1$
-
- // local toolbars (enabled)
- public final String IMG_DLG_SYNC_INCOMING_ENABLED = "elcl16/incom_synch.gif"; //$NON-NLS-1$
- public final String IMG_DLG_SYNC_OUTGOING_ENABLED = "elcl16/outgo_synch.gif"; //$NON-NLS-1$
- public final String IMG_DLG_SYNC_CONFLICTING_ENABLED = "elcl16/conflict_synch.gif"; //$NON-NLS-1$
- public final String IMG_REFRESH_ENABLED = "elcl16/refresh.gif"; //$NON-NLS-1$
- public final String IMG_IGNORE_WHITESPACE_ENABLED = "elcl16/ignorews_edit.gif"; //$NON-NLS-1$
- public final String IMG_CONTENTS_ENABLED = "elcl16/contents.gif"; //$NON-NLS-1$
-
- // sync view modes
- public final String IMG_SYNC_MODE_CATCHUP = "clcl16/catchup_rls.gif"; //$NON-NLS-1$
- public final String IMG_SYNC_MODE_RELEASE = "clcl16/release_rls.gif"; //$NON-NLS-1$
- public final String IMG_SYNC_MODE_FREE = "clcl16/catchuprelease_rls.gif"; //$NON-NLS-1$
-
- // sync view modes (disabled)
- public final String IMG_SYNC_MODE_CATCHUP_DISABLED = "dlcl16/catchup_rls.gif"; //$NON-NLS-1$
- public final String IMG_SYNC_MODE_RELEASE_DISABLED = "dlcl16/release_rls.gif"; //$NON-NLS-1$
- public final String IMG_SYNC_MODE_FREE_DISABLED = "dlcl16/catchuprelease_rls.gif"; //$NON-NLS-1$
-
- // sync view modes (enabled)
- public final String IMG_SYNC_MODE_CATCHUP_ENABLED = "elcl16/catchup_rls.gif"; //$NON-NLS-1$
- public final String IMG_SYNC_MODE_RELEASE_ENABLED = "elcl16/release_rls.gif"; //$NON-NLS-1$
- public final String IMG_SYNC_MODE_FREE_ENABLED = "elcl16/catchuprelease_rls.gif"; //$NON-NLS-1$
-
- // wizard banners
- public final String IMG_WIZBAN_SHARE = "wizban/share_wizban.gif"; //$NON-NLS-1$
- public final String IMG_PROJECTSET_IMPORT_BANNER = "wizban/import_projectset_wizban.gif"; //$NON-NLS-1$
- public final String IMG_PROJECTSET_EXPORT_BANNER = "wizban/export_projectset_wizban.gif"; //$NON-NLS-1$
-
- // preferences
- public final String PREF_ALWAYS_IN_INCOMING_OUTGOING = "pref_always_in_incoming_outgoing"; //$NON-NLS-1$
-
- //objects
- public final String IMG_SITE_ELEMENT = "clcl16/site_element.gif"; //$NON-NLS-1$
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java
deleted file mode 100644
index d9d93cadc..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.actions;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ui.ConfigureProjectWizard;
-import org.eclipse.team.internal.ui.Policy;
-
-/**
- * Action for configuring a project. Configuring involves associating
- * the project with a Team provider and performing any provider-specific
- * configuration that is necessary.
- */
-public class ConfigureProjectAction extends TeamAction {
- /*
- * Method declared on IActionDelegate.
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IProject project = getSelectedProjects()[0];
- ConfigureProjectWizard wizard = new ConfigureProjectWizard();
- wizard.init(null, project);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.open();
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- }
- }
- }, Policy.bind("ConfigureProjectAction.configureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() {
- IProject[] selectedProjects = getSelectedProjects();
- if (selectedProjects.length != 1) return false;
- if (!selectedProjects[0].isAccessible()) return false;
- if (RepositoryProvider.getProvider(selectedProjects[0]) == null) return true;
- return false;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java
deleted file mode 100644
index d30b66b22..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/DeconfigureProjectAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.actions;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * Action for deconfiguring a project. Deconfiguring involves removing
- * associated provider for the project.
- */
-public class DeconfigureProjectAction extends TeamAction {
- /*
- * Method declared on IActionDelegate.
- */
- public void run(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- // should we use the id for the provider type and remove from the nature. Or would
- // this operation be provider specific?
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- }
- }
- }, Policy.bind("DeconfigureProjectAction.deconfigureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() {
- IProject[] selectedProjects = getSelectedProjects();
- if (selectedProjects.length != 1) return false;
- if (RepositoryProvider.getProvider(selectedProjects[0]) != null) return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
deleted file mode 100644
index ba96f5280..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.actions;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.ActionDelegate;
-
-/**
- * The abstract superclass of all Team actions. This class contains some convenience
- * methods for getting selected objects and mapping selected objects to their
- * providers.
- *
- * Team providers may subclass this class when creating their actions.
- * Team providers may also instantiate or subclass any of the
- * subclasses of TeamAction provided in this package.
- */
-public abstract class TeamAction extends ActionDelegate implements IObjectActionDelegate {
- // The current selection
- protected IStructuredSelection selection;
-
- // The shell, required for the progress dialog
- protected Shell shell;
-
- // Constants for determining the type of progress. Subclasses may
- // pass one of these values to the run method.
- public final static int PROGRESS_DIALOG = 1;
- public final static int PROGRESS_BUSYCURSOR = 2;
-
- private IWorkbenchPart targetPart;
-
- /**
- * Returns the selected projects.
- *
- * @return the selected projects
- */
- protected IProject[] getSelectedProjects() {
- ArrayList projects = null;
- if (!selection.isEmpty()) {
- projects = new ArrayList();
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof IProject) {
- projects.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(IResource.class);
- if (adapter instanceof IProject) {
- projects.add(adapter);
- continue;
- }
- }
- }
- }
- if (projects != null && !projects.isEmpty()) {
- IProject[] result = new IProject[projects.size()];
- projects.toArray(result);
- return result;
- }
- return new IProject[0];
- }
- /**
- * Returns the selected resources.
- *
- * @return the selected resources
- */
- protected IResource[] getSelectedResources() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof IResource) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(IResource.class);
- if (adapter instanceof IResource) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- IResource[] result = new IResource[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new IResource[0];
- }
-
- /**
- * Convenience method for getting the current shell.
- *
- * @return the shell
- */
- protected Shell getShell() {
- if (shell != null) {
- return shell;
- } else {
- return TeamUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell();
- }
- }
- /**
- * Convenience method for running an operation with progress and
- * error feedback.
- *
- * @param runnable the runnable which executes the operation
- * @param problemMessage the message to display in the case of errors
- * @param progressKind one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG
- */
- final protected void run(final IRunnableWithProgress runnable, final String problemMessage, int progressKind) {
- final Exception[] exceptions = new Exception[] {null};
- switch (progressKind) {
- case PROGRESS_BUSYCURSOR :
- BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
- public void run() {
- try {
- runnable.run(new NullProgressMonitor());
- } catch (InvocationTargetException e) {
- exceptions[0] = e;
- } catch (InterruptedException e) {
- exceptions[0] = null;
- }
- }
- });
- break;
- default :
- case PROGRESS_DIALOG :
- try {
- new ProgressMonitorDialog(getShell()).run(true, true, runnable);
- } catch (InvocationTargetException e) {
- exceptions[0] = e;
- } catch (InterruptedException e) {
- exceptions[0] = null;
- }
- break;
- }
- if (exceptions[0] != null) {
- handle(exceptions[0], null, problemMessage);
- }
- }
-
- /*
- * Method declared on IActionDelegate.
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- this.selection = (IStructuredSelection) selection;
- if (action != null) {
- setActionEnablement(action);
- }
- }
- }
-
- /**
- * Method invoked from <code>selectionChanged(IAction, ISelection)</code>
- * to set the enablement status of the action. The instance variable
- * <code>selection</code> will contain the latest selection so the methods
- * <code>getSelectedResources()</code> and <code>getSelectedProjects()</code>
- * will provide the proper objects.
- *
- * This method can be overridden by subclasses but should not be invoked by them.
- */
- protected void setActionEnablement(IAction action) {
- try {
- action.setEnabled(isEnabled());
- } catch (TeamException e) {
- if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
- // Enable the action to allow the user to discover the problem
- action.setEnabled(true);
- } else {
- action.setEnabled(false);
- // We should not open a dialog when determining menu enablements so log it instead
- TeamPlugin.log(e.getStatus());
- }
- }
- }
-
- /*
- * Method declared on IObjectActionDelegate.
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- this.shell = targetPart.getSite().getShell();
- this.targetPart = targetPart;
- }
- /**
- * Shows the given errors to the user.
- *
- * @param status the status containing the error
- * @param title the title of the error dialog
- * @param message the message for the error dialog
- * @param shell the shell to open the error dialog in
- */
- protected void handle(Exception exception, String title, String message) {
- IStatus status = null;
- boolean log = false;
- boolean dialog = false;
- if (exception instanceof TeamException) {
- status = ((TeamException)exception).getStatus();
- log = false;
- dialog = true;
- } else if (exception instanceof InvocationTargetException) {
- Throwable t = ((InvocationTargetException)exception).getTargetException();
- if (t instanceof TeamException) {
- status = ((TeamException)t).getStatus();
- log = false;
- dialog = true;
- } else if (t instanceof CoreException) {
- status = ((CoreException)t).getStatus();
- log = true;
- dialog = true;
- } else if (t instanceof InterruptedException) {
- return;
- } else {
- status = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("TeamAction.internal"), t); //$NON-NLS-1$
- log = true;
- dialog = true;
- }
- }
- if (status == null) return;
- if (!status.isOK()) {
- IStatus toShow = status;
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- if (children.length == 1) {
- toShow = children[0];
- }
- }
- if (title == null) {
- title = status.getMessage();
- }
- if (message == null) {
- message = status.getMessage();
- }
- if (dialog) {
- ErrorDialog.openError(getShell(), title, message, toShow);
- }
- if (log) {
- TeamUIPlugin.log(toShow);
- }
- }
- }
- /**
- * Concrete action enablement code.
- * Subclasses must implement.
- *
- * @return whether the action is enabled
- * @throws TeamException if an error occurs during enablement detection
- */
- abstract protected boolean isEnabled() throws TeamException;
-
- /**
- * Convenience method that maps the selected resources to their providers.
- * The returned Hashtable has keys which are ITeamProviders, and values
- * which are Lists of IResources that are shared with that provider.
- *
- * @return a hashtable mapping providers to their selected resources
- */
- protected Hashtable getProviderMapping() {
- return getProviderMapping(getSelectedResources());
- }
- /**
- * Convenience method that maps the given resources to their providers.
- * The returned Hashtable has keys which are ITeamProviders, and values
- * which are Lists of IResources that are shared with that provider.
- *
- * @return a hashtable mapping providers to their resources
- */
- protected Hashtable getProviderMapping(IResource[] resources) {
- Hashtable result = new Hashtable();
- for (int i = 0; i < resources.length; i++) {
- RepositoryProvider provider = RepositoryProvider.getProvider(resources[i].getProject());
- List list = (List)result.get(provider);
- if (list == null) {
- list = new ArrayList();
- result.put(provider, list);
- }
- list.add(resources[i]);
- }
- return result;
- }
-
- /**
- * Convenience method that maps the selected resources to their target providers.
- * The returned Hashtable has keys which are TargetProviders, and values
- * which are Lists of IResources that are shared with that provider.
- *
- * @return a hashtable mapping providers to their selected resources
- */
- protected Hashtable getTargetProviderMapping() throws TeamException {
- return getTargetProviderMapping(getSelectedResources());
- }
- /**
- * Convenience method that maps the given resources to their target providers.
- * The returned Hashtable has keys which are TargetProviders, and values
- * which are Lists of IResources that are shared with that provider.
- *
- * @return a hashtable mapping providers to their resources
- */
- protected Hashtable getTargetProviderMapping(IResource[] resources) throws TeamException {
- Hashtable result = new Hashtable();
- for (int i = 0; i < resources.length; i++) {
- TargetProvider provider = TargetManager.getProvider(resources[i].getProject());
- List list = (List)result.get(provider);
- if (list == null) {
- list = new ArrayList();
- result.put(provider, list);
- }
- list.add(resources[i]);
- }
- return result;
- }
-
- /**
- * @return IWorkbenchPart
- */
- protected IWorkbenchPart getTargetPart() {
- return targetPart;
- }
-
- /**
- * Return the path that was active when the menu item was selected.
- * @return IWorkbenchPage
- */
- protected IWorkbenchPage getTargetPage() {
- if (getTargetPart() == null) return TeamUIPlugin.getActivePage();
- return getTargetPart().getSite().getPage();
- }
-
- /**
- * Show the view with the given ID in the perspective from which the action
- * was executed. Returns null if the view is not registered.
- *
- * @param viewId
- * @return IViewPart
- */
- protected IViewPart showView(String viewId) {
- try {
- return getTargetPage().showView(viewId);
- } catch (PartInitException pe) {
- return null;
- }
- }
-}
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
deleted file mode 100644
index d1192a348..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ /dev/null
@@ -1,292 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-###############################################
-# Message catalog for org.eclipse.team.ui
-###############################################
-
-AuthenticatedTargetSitePropertiesPage.Server=Server hostname:
-AuthenticatedTargetSitePropertiesPage.User=&User:
-AuthenticatedTargetSitePropertiesPage.Password=&Password:
-AuthenticatedTargetSitePropertiesPage.Error=Error Occurred
-
-ProjectTargetMappingPropertiesPage.Error=A Bad Thing (tm) happened.
-ProjectTargetMappingPropertiesPage.URL=Target site URL:
-ProjectTargetMappingPropertiesPage.FolderName=Deployment path:
-ProjectTargetMappingPropertiesPage.ChangeBtn=&Change these settings...
-
-CatchupReleaseViewer.open=&Show Content Comparison
-CatchupReleaseViewer.expand=&Expand All
-CatchupReleaseViewer.ignoreWhiteSpace=&Ignore White Space
-CatchupReleaseViewer.refreshAction=&Refresh With Remote
-CatchupReleaseViewer.showIncomingAction=Show Incoming
-CatchupReleaseViewer.showInNavigator=Show in &Navigator
-CatchupReleaseViewer.showOnlyConflictsAction=Show Only Conflicts
-CatchupReleaseViewer.showOutgoingAction=Show Outgoing
-CatchupReleaseViewer.removeFromView=Remove &From View
-CatchupReleaseViewer.copyAllRightToLeft=Copy &All Changes From Right To Left
-CatchupReleaseViewer.Compare_File_Contents_1=Compare File Contents
-CatchupReleaseViewer.Copying_right_contents_into_workspace_2=Copying right contents into workspace
-CatchupReleaseViewer.MakingLocalLikeRemote=Processing {0}
-
-ConfigureProjectAction.configureProject=Configure Project
-ConfigureProjectWizard.configureProject=Share Project
-ConfigureProjectWizard.description=Select the repository plug-in that will be used to share the selected project.
-ConfigureProjectWizard.title=Share Project
-ConfigureProjectWizardMainPage.selectRepository=Select a repository type:
-ConfigureProjectWizardMainPage.selectTarget=Select a site type:
-
-ConfigurationWizard.exceptionCreatingWizard=Exception creating wizard.
-
-DeconfigureProjectAction.deconfigureProject=Deconfigure Project
-
-IgnorePreferencePage.description=Use this page to specify a list of resource name patterns to exclude from version control.
-IgnorePreferencePage.add=&Add...
-IgnorePreferencePage.enterPatternLong=Please enter a pattern:
-IgnorePreferencePage.enterPatternShort=Enter Ignore Pattern
-IgnorePreferencePage.ignorePatterns=&Ignore Patterns:
-IgnorePreferencePage.patternExistsLong=The entered pattern already exists.
-IgnorePreferencePage.patternExistsShort=Pattern Already Exists
-IgnorePreferencePage.remove=&Remove
-
-MergeResource.commonFile=Common file: {0}
-MergeResource.noCommonFile=No common file
-MergeResource.noRepositoryFile=No remote file
-MergeResource.repositoryFile=Remote file: {0}
-MergeResource.workspaceFile=Workspace file: {0}
-
-nothingToSynchronize=Nothing to Synchronize
-simpleInternal=Internal error
-exception=An exception occurred
-
-SyncCompareInput.nothingText=Workspace resources are the same as remote.
-SyncCompareInput.refresh=Error During Refresh with Remote
-SyncCompareInput.synchronize=Synchronize
-SyncCompareInput.taskTitle=Synchronizing with Remote...
-
-SyncSet.conflicts={0} conflicts,
-SyncSet.incomings={0} incoming change(s),
-SyncSet.noConflicts=No conflicts,
-SyncSet.noIncomings=no incoming changes,
-SyncSet.noOutgoings=no outgoing changes.
-SyncSet.outgoings={0} outgoing change(s).
-
-SyncView.freeModeAction=Incoming/Outgoing Mode
-SyncView.freeModeTitle=Synchronize - Incoming/Outgoing Mode
-SyncView.freeModeToolTip=Incoming/Outgoing Mode
-SyncView.incomingModeAction=Incoming Mode
-SyncView.incomingModeTitle=Synchronize - Incoming Mode
-SyncView.incomingModeToolTip=Incoming Mode
-SyncView.outgoingModeAction=Outgoing Mode
-SyncView.outgoingModeTitle=Synchronize - Outgoing Mode
-SyncView.outgoingModeToolTip=Outgoing Mode
-SyncView.same=Workspace resources are the same as remote.
-SyncView.text=Synchronize resources with their remote to display them here.
-SyncView.unableSynchronize=Unable to Synchronize
-SyncView.saveTitle=Save Resource
-SyncView.saveMessage=Resource has been modified. Save changes?
-SyncView.errorSaving=Error while saving modified resources
-SyncView.cantSaveError=Can't save changes: {0}
-SyncView.dirtyIndicatorInTitle=*{0}
-
-
-TeamAction.internal=Internal error occurred.
-TeamFile.saveChanges=Unable to save changes to file: {0}
-TeamFile.modified={0}*
-
-TextPreferencePage.add=&Add...
-TextPreferencePage.binary=Binary
-TextPreferencePage.change=&Change
-TextPreferencePage.contents=Contents
-TextPreferencePage.description=&File extensions with known content:
-TextPreferencePage.enterExtensionLong=Please enter a file extension:
-TextPreferencePage.enterExtensionShort=Enter File Extension
-TextPreferencePage.extension=Extension
-TextPreferencePage.extensionExistsLong=The entered extension already exists.
-TextPreferencePage.extensionExistsShort=Extension Already Exists
-TextPreferencePage.remove=&Remove
-TextPreferencePage.text=ASCII
-
-TextPreferencePage.columnExtension=extension
-TextPreferencePage.columnContents=contents
-
-ExportProjectSetMainPage.Select_the_projects_to_include_in_the_project_set__2=&Select the projects to include in the Team Project Set:
-ExportProjectSetMainPage.Project_Set_File_Name__3=Select the export destination:
-ExportProjectSetMainPage.Browse_4=B&rowse...
-ExportProjectSetMainPage.You_have_specified_a_folder_5=You have specified a folder
-
-ImportProjectSetMainPage.Project_Set_File_Name__2=F&ile name:
-ImportProjectSetMainPage.Browse_3=B&rowse...
-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
-ImportProjectSetMainPage.workingSetNameEmpty=The working set name must not be empty
-ImportProjectSetMainPage.workingSetNameExists=The specified working set already exists
-ImportProjectSetMainPage.createWorkingSetLabel=&Create a working set containing the imported projects
-ImportProjectSetMainPage.workingSetLabel=&Working Set Name:
-
-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=Team Project Set
-ProjectSetExportWizard.Export_a_Project_Set_3=Export a Team 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=Team Project Set
-ProjectSetImportWizard.Import_a_Project_Set_3=Import a Team Project Set
-ProjectSetImportWizard.workingSetExistsTitle=Working Set Exists
-ProjectSetImportWizard.workingSetExistsMessage=Working set ''{0}'' already exists. Overwrite?
-
-ExportProjectSetMainPage.Project_Set_Files_3=Team Project Set Files (*.psf)
-ExportProjectSetMainPage.default=projectSet.psf
-ImportProjectSetMainPage.allFiles=All Files (*.*)
-ImportProjectSetMainPage.Project_Set_Files_2=Team Project Set Files (*.psf)
-ExportProjectSetMainPage.&File_name__1=&File name:
-TeamPreferencePage.General_settings_for_Team_support_1=General settings for Team support
-TeamPreferencePage.&Use_Incoming/Outgoing_mode_when_synchronizing_2=&Use Incoming/Outgoing mode when synchronizing
-
-TargetSiteExportWizard.Target_Site=Target Site
-TargetSiteExportWizard.Export_a_Target_Site=Export a target site
-TargetSiteExportWizard.Creation_Question=Should I?
-TargetSiteExportWizard.Create_dir=Would you like to create the directory, since it does not currently exist?
-TargetSiteExportWizard.Export_Problems=Bad things happened!
-TargetSiteExportWizard.Directory_creation_error=I was unable to create a new directory. Make sure you have write permissions in the appropriate area of the filesystem.
-TargetSiteExportWizard.Overwrite_Question=Do you really want to?
-TargetSiteExportWizard.Overwrite_file=Would you like to overwrite the file you have selected?
-
-ExportTargetSiteMainPage.Select_Sites=Select the sites to export
-ExportTargetSiteMainPage.folder_specified=You cannot export to a directory!
-ExportTargetSiteMainPage.Target_Site_Filename=Target site Filename
-ExportTargetSiteMainPage.File_name=File name
-ExportTargetSiteMainPage.Browse=Browse
-ExportTargetSiteMainPage.Target_Site_Files=Target site files
-ExportTargetSiteMainPage.default=targetSite.tsf
-
-ImportTargetSiteMainPage.nonexistent_file=No such file exists on your filesystem!
-ImportTargetSiteMainPage.folder_specified=That is a directory, not a file!
-ImportTargetSiteMainPage.File_name=File name
-ImportTargetSiteMainPage.Browse=Browse
-ImportTargetSiteMainPage.Target_Site_Files=Target site files
-
-NatureToPropertyAction.label=Convert Nature
-NatureToPropertyAction.message=Could not remove the nature from one or more of the selected projects.
-NatureToPropertyAction.multiMessage=Could not write .project file
-
-TargetSiteImportWizard.Target_Site=Target Site
-TargetSiteImportWizard.Import_Target_Site=Import a Target site
-
-###############################################
-# Target Management Messages
-###############################################
-
-TargetSiteCreationWizard.windowTitleProject=Target a Site
-TargetSiteCreationWizard.windowTitleNoProject=New Site
-TargetSiteCreationWizard.label=Create a site connection
-TargetSiteCreationWizard.description=Select the type of site you want to target.
-
-TargetSiteCreationWizard.mappingPageTitle=Specify the location on the site
-TargetSiteCreationWizard.siteSelectionPage=Select or create a site
-
-SiteSelectionPage.description=Select an existing site or create a new site where you want to upload your resources to.
-SiteSelectionPage.label=Select an existing site or create a new one:
-SiteSelectionPage.useExisting=&Use Existing Site
-SiteSelectionPage.createNew=&Create a new Site
-SiteSelectionPage.disconnectTarget=&Disconnect from Site
-
-GetAsProject.thisResourceExists=The resource ''{0}'' already exists in the workspace. Overwrite?
-GetAsProject.thisExternalFileExists=The folder ''{0}'' exists in the local file system. Overwrite?
-GetAsProject.confirmOverwrite=Confirm Overwrite
-GetAsProject.taskName1=Downloading ''{0}''
-GetAsProject.taskNameN=Downloading {0} folders
-GetAsProject.errorCreatingProject=Error creating project: {0}
-GetAsProject.errorGettingResources=Error getting resources
-
-GetAs.checkoutFailed=Problems encountered receiving the remote folder
-GetAs.enterProjectTitle=Downloading ''{0}'' As...
-GetAs.taskname=Downloading ''{0}'' as ''{1}''
-
-Error=Error
-
-CreateNewFolderAction.errorCreatingFolder=Error creating the remote folder.
-CreateNewFolderAction.title=New Remote Folder
-CreateNewFolderAction.message=Enter the name for the new remote folder:
-CreateNewFolderAction.newFolderName=New Folder
-
-GetAction.title=Download
-GetAction.working=Downloading from ''{0}''...
-
-PutAction.title=Upload
-PutAction.working=Uploading to ''{0}''...
-
-SiteExplorerView.addSiteAction=Target &Site
-SiteExplorerView.addSiteActionTooltip=Add a Site
-SiteExplorerView.newFolderAction=Fo&lder...
-SiteExplorerView.newMenu=&New
-SiteExplorerView.Name_1=Name
-SiteExplorerView.Size_2=Size
-SiteExplorerView.Modified_3=Modified
-SiteExplorerView.URL_4=URL
-SiteExplorerView.mappedProjects={0} is mapped to {1}
-SiteExplorerView.projectsAlreadyMapped=The selected sites are being used by projects in your workspace. You must disconnect the projects from the Sites before discarding them.
-SiteExplorerView.unmapProjectsAndDisconnect=Disconnect projects from these sites then discard the sites
-SiteExplorerView.unmapDialogTitle=Warning
-
-CreateNewFolderAction.creatingFolder=Creating Folder
-CreateNewFolderAction.suggestedNameProgress=Retrieving existing folder names...
-CreateNewFolderAction.suggestedNameConcat={0}_{1}
-
-SiteExplorerView.promptForDeletingSites=Are you sure you want to discard {0} site(s)?
-SiteExplorerView.promptForDeletingSitesTitle=Confirm Discarding Sites
-
-SiteExplorerViewLabelProvider.fileSize={0} KB
-
-MappingSelectionPage.description=Specify the location on the site where you want to target your resources.
-MappingSelectionPage.label=Select the site or a folder:
-MappingSelectionPage.newFolderLabel=&Create Folder...
-MappingSelectionPage.mappingTitle=Select the location on the site
-
-ConfigureTargetWizardQuestion_2=Question
-ConfigureTargetWizardError_6=Error
-ConfigureTargetWizardError_mapping_the_project_with_this_site_7=Error mapping the project with this site
-ConfigureTargetWizardURL_doesn__t_exist_on_the_server_8=URL doesn\'t exist on the server
-ConfigureTargetWizardValidating_connection_to_Site..._9=Validating connection to Site...
-ConfigureTargetWizardConnection_Error_10=Connection Error
-ConfigureTargetWizard.alreadyMapped=''{0}'' is already targeted to ''{1}''. Are you sure you want to change this?
-ConfigureTargetWizard.errorOccurred=An error occurred connecting to ''{0}''.\n\nCode: {1}\nMessage: {2}\n\nDo you still want to keep this target?
-ConfigureTargetWizard.errorUnmappingProject=An error occurred trying to disconnect this project.
-
-GetAction.Exception_getting_provider_2=Exception getting provider
-GetAction.confirmFileOverwrite=You have local changes which you are about to overwrite. Do you wish to continue?
-GetAction.confirmFileOverwriteTitle=Confirm Overwrite
-
-TargetSyncAction.errorEncountered=An error occurred performing the action
-
-GetSyncAction.Getting..._1=Downloading...
-PutAction.Exception_getting_provider_2=Exception getting provider
-PutSyncAction.Putting..._1=Uploading...
-
-TargetCatchupReleaseViewer.Get_1=&Download
-TargetCatchupReleaseViewer.Put_2=&Upload
-
-SiteSelectionPage.siteLabelCurrentWithMapping={0} (currently as {1})
-SiteSelectionPage.siteLabelCurrent={0} (current)
-
-UploadAction.Exception_getting_provider=Exception getting provider
-UploadAction.working=Uploading to ''{0}''...
-UploadAction.noDirtyTitle=No Dirty Resources Found
-UploadAction.noDirtyMessage=There were no dirty resources found to upload.
-UploadAction.confirmDeletionTitle=Confirm Deletion
-UploadAction.confirmFileDeletionMessage=File ''{0}'' has been deleted locally. Do you want to delete it remotely?
-UploadAction.problemMessage=Problems occurred uploading.
-
-
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java
deleted file mode 100644
index ed0bd047f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/CatchupReleaseViewer.java
+++ /dev/null
@@ -1,735 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-
-import org.eclipse.compare.BufferedContent;
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IEditableContent;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.NavigationAction;
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.structuremergeviewer.DiffContainer;
-import org.eclipse.compare.structuremergeviewer.DiffElement;
-import org.eclipse.compare.structuremergeviewer.DiffTreeViewer;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.team.core.sync.ILocalSyncElement;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.UIConstants;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.views.navigator.ResourceNavigator;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * This viewer adds a custom filter and some merge actions.
- * Note this is a layer breaker and needs to be refactored. Viewers should
- * not contain references to workbench actions. Actions should be contributed
- * by the view.
- */
-public abstract class CatchupReleaseViewer extends DiffTreeViewer {
-
- class ShowInNavigatorAction extends Action implements ISelectionChangedListener {
- IViewSite viewSite;
- public ShowInNavigatorAction(IViewSite viewSite, String title) {
- super(title, null);
- this.viewSite = viewSite;
- }
- public void run() {
- showSelectionInNavigator(viewSite);
- }
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- if (selection.size() == 0) {
- setEnabled(false);
- return;
- }
- for (Iterator iter = selection.iterator(); iter.hasNext();) {
- ITeamNode node = (ITeamNode)iter.next();
- if(!node.getResource().isAccessible()) {
- setEnabled(false);
- return;
- }
- }
- setEnabled(true);
- }
- };
-
- /**
- * This filter hides all empty categories tree nodes.
- */
- class CategoryFilter extends ViewerFilter {
- static final int SHOW_INCOMING = 1;
- static final int SHOW_OUTGOING = 2;
- static final int SHOW_CONFLICTS = 4;
- static final int SHOW_PSEUDO_CONFLICTS = 8;
-
- private int showMask = 0;
-
- CategoryFilter(int showMask) {
- // Mask for all categories to show
- this.showMask = showMask;
- }
- int getMask() {
- return showMask;
- }
- void setMask(int mask) {
- this.showMask = mask;
- }
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- // If this element has visible children, always show it.
- // This is not great -- O(n^2) filtering
- if (hasFilteredChildren(element)) {
- return true;
- }
- if (element instanceof ITeamNode) {
- // Filter out pseudo conflicts if requested
- int kind = ((ITeamNode)element).getKind();
- if ((showMask & SHOW_PSEUDO_CONFLICTS) == 0 && (kind & IRemoteSyncElement.PSEUDO_CONFLICT) != 0) {
- return false;
- }
- int change = ((ITeamNode)element).getKind() & IRemoteSyncElement.CHANGE_MASK;
- int direction = ((ITeamNode)element).getChangeDirection();
- switch (direction) {
- case ITeamNode.INCOMING:
- return (showMask & SHOW_INCOMING) != 0;
- case ITeamNode.OUTGOING:
- return (showMask & SHOW_OUTGOING) != 0;
- case Differencer.CONFLICTING:
- return (showMask & SHOW_CONFLICTS) != 0;
- default:
- return change != 0;
- }
- }
- // No children are visible, and this folder has no changes, so don't show it.
- return false;
- }
- public boolean isFilterProperty(Object element, String property) {
- return property.equals(PROP_KIND);
- }
- }
-
- class FilterAction extends Action {
- /**
- * Must subclass constructor to make it accessible to container class
- */
- FilterAction(String title, ImageDescriptor image) {
- super(title, image);
- }
- public void run() {
- updateFilters();
- }
- }
- class SyncSorter extends ViewerSorter {
- public int compare(Viewer viewer, Object e1, Object e2) {
- boolean oneIsFile = e1 instanceof TeamFile;
- boolean twoIsFile = e2 instanceof TeamFile;
- if (oneIsFile != twoIsFile) {
- return oneIsFile ? 1 : -1;
- }
- return super.compare(viewer, e1, e2);
- }
- }
-
- class RemoveFromTreeAction extends Action {
- public RemoveFromTreeAction(String title, ImageDescriptor image) {
- super(title, image);
- }
- public void run() {
- ISelection s = getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return;
- }
- // mark all selected nodes as in sync
- for (Iterator it = ((IStructuredSelection)s).iterator(); it.hasNext();) {
- Object element = it.next();
- setAllChildrenInSync((IDiffElement)element);
- }
- refresh();
- }
- public void update() {
- // Update action enablement
- setEnabled(!getSelection().isEmpty());
- }
- }
- class ExpandAllAction extends Action {
- public ExpandAllAction(String title, ImageDescriptor image) {
- super(title, image);
- }
- public void run() {
- expandSelection();
- }
- public void update() {
- setEnabled(!getSelection().isEmpty());
- }
- }
- class OpenAction extends Action {
- public OpenAction(String title, ImageDescriptor image) {
- super(title, image);
- }
- public void run() {
- openSelection();
- }
- public void update() {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- if (ss.size() == 1) {
- Object element = ss.getFirstElement();
- setEnabled(element instanceof TeamFile);
- return;
- }
- }
- setEnabled(false);
- }
- }
-
- // The current sync mode
- private int syncMode = SyncView.SYNC_NONE;
-
- // Actions
- private FilterAction showIncoming;
- private FilterAction showOutgoing;
- private FilterAction showOnlyConflicts;
- private Action refresh;
- private OpenAction open;
- private ExpandAllAction expandAll;
- private RemoveFromTreeAction removeFromTree;
- private ShowInNavigatorAction showInNavigator;
- private Action ignoreWhiteSpace;
- private Action toggleGranularity;
-
- private NavigationAction showPrevious;
- private NavigationAction showNext;
-
- // Property constant for diff mode kind
- static final String PROP_KIND = "team.ui.PropKind"; //$NON-NLS-1$
-
- private Action copyAllRightToLeft;
-
- private boolean compareFileContents = false;
-
- /**
- * Creates a new catchup/release viewer.
- */
- protected CatchupReleaseViewer(Composite parent, SyncCompareInput model) {
- super(parent, model.getCompareConfiguration());
- setSorter(new SyncSorter());
- initializeActions(model);
- }
-
- /**
- * Contributes actions to the provided toolbar
- */
- void contributeToActionBars(IActionBars actionBars) {
- IToolBarManager toolBar = actionBars.getToolBarManager();
-
- toolBar.add(new Separator());
- toolBar.add(showOnlyConflicts);
-
- toolBar.add(new Separator());
- toolBar.add(showNext);
- toolBar.add(showPrevious);
-
- // Drop down menu
- IMenuManager menu = actionBars.getMenuManager();
- if (syncMode == SyncView.SYNC_BOTH) {
- menu.add(showIncoming);
- menu.add(showOutgoing);
- }
- menu.add(toggleGranularity);
- menu.add(ignoreWhiteSpace);
- menu.add(refresh);
- }
-
- /**
- * Contributes actions to the popup menu.
- */
- protected void fillContextMenu(IMenuManager manager) {
- open.update();
- manager.add(open);
- manager.add(new Separator());
- expandAll.update();
- manager.add(expandAll);
- removeFromTree.update();
- manager.add(removeFromTree);
- if (showInNavigator != null) {
- manager.add(showInNavigator);
- }
- if (syncMode == SyncView.SYNC_COMPARE) {
- if(copyAllRightToLeft.isEnabled()) {
- manager.add(copyAllRightToLeft);
- }
- }
- }
-
- protected void openSelection() {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection) {
- Iterator elements = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- openSelection(next);
- }
- }
- }
-
- /**
- * Method openSelection.
- * @param next
- */
- private void openSelection(Object next) {
- if (next instanceof TeamFile) {
- handleOpen(null);
- }
- }
-
- /**
- * Expands to infinity all items in the selection.
- */
- protected void expandSelection() {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection) {
- Iterator elements = ((IStructuredSelection)selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- expandToLevel(next, ALL_LEVELS);
- }
- }
- }
-
- protected int getSyncMode() {
- return syncMode;
- }
-
- /**
- * Returns true if the given element has filtered children, and false otherwise.
- */
- protected boolean hasFilteredChildren(Object element) {
- return getFilteredChildren(element).length > 0;
- }
-
- /**
- * Creates the actions for this viewer.
- */
- private void initializeActions(final SyncCompareInput diffModel) {
- // Mask actions
- ImageDescriptor image = TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING_ENABLED);
- showIncoming = new FilterAction(Policy.bind("CatchupReleaseViewer.showIncomingAction"), image); //$NON-NLS-1$
- showIncoming.setToolTipText(Policy.bind("CatchupReleaseViewer.showIncomingAction")); //$NON-NLS-1$
- showIncoming.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING_DISABLED));
- showIncoming.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING));
-
- image = TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING_ENABLED);
- showOutgoing = new FilterAction(Policy.bind("CatchupReleaseViewer.showOutgoingAction"), image); //$NON-NLS-1$
- showOutgoing.setToolTipText(Policy.bind("CatchupReleaseViewer.showOutgoingAction")); //$NON-NLS-1$
- showOutgoing.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING_DISABLED));
- showOutgoing.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING));
-
- //show only conflicts is not a HideAction because it doesnt flip bits, it sets an exact mask
- image = TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING_ENABLED);
- showOnlyConflicts = new FilterAction(Policy.bind("CatchupReleaseViewer.showOnlyConflictsAction"), image); //$NON-NLS-1$
- showOnlyConflicts.setToolTipText(Policy.bind("CatchupReleaseViewer.showOnlyConflictsAction")); //$NON-NLS-1$
- showOnlyConflicts.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING_DISABLED));
- showOnlyConflicts.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING));
-
- //refresh action
- image = TeamImages.getImageDescriptor(UIConstants.IMG_REFRESH_ENABLED);
- refresh = new Action(Policy.bind("CatchupReleaseViewer.refreshAction"), image) { //$NON-NLS-1$
- public void run() {
- diffModel.refresh();
- }
- };
- refresh.setToolTipText(Policy.bind("CatchupReleaseViewer.refreshAction")); //$NON-NLS-1$
- refresh.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_REFRESH_DISABLED));
- refresh.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_REFRESH));
-
- // Open Action
- open = new OpenAction(Policy.bind("CatchupReleaseViewer.open"), null); //$NON-NLS-1$
- WorkbenchHelp.setHelp(open, IHelpContextIds.OPEN_ACTION);
-
- // Expand action
- expandAll = new ExpandAllAction(Policy.bind("CatchupReleaseViewer.expand"), null); //$NON-NLS-1$
- WorkbenchHelp.setHelp(expandAll, IHelpContextIds.EXPANDALL_ACTION);
-
- // Toggle granularity
- image = TeamImages.getImageDescriptor(UIConstants.IMG_CONTENTS_ENABLED);
- toggleGranularity = new Action(Policy.bind("CatchupReleaseViewer.Compare_File_Contents_1"), image) { //$NON-NLS-1$
- public void run() {
- compareFileContents = isChecked();
- diffModel.setSyncGranularity(compareFileContents ? ILocalSyncElement.GRANULARITY_CONTENTS : ILocalSyncElement.GRANULARITY_TIMESTAMP);
- updateFilters();
- }
- };
- compareFileContents = diffModel.getSyncGranularity() != IRemoteSyncElement.GRANULARITY_TIMESTAMP;
- toggleGranularity.setChecked(compareFileContents);
- toggleGranularity.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_CONTENTS_DISABLED));
- toggleGranularity.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_CONTENTS));
-
- removeFromTree = new RemoveFromTreeAction(Policy.bind("CatchupReleaseViewer.removeFromView"), null); //$NON-NLS-1$
- WorkbenchHelp.setHelp(removeFromTree, IHelpContextIds.REMOVE_ACTION);
-
- copyAllRightToLeft = new Action(Policy.bind("CatchupReleaseViewer.copyAllRightToLeft"), null) { //$NON-NLS-1$
- public void run() {
- ISelection s = getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return;
- }
- // action is only enabled for 1 element. the for loop
- final Object element = ((IStructuredSelection)s).getFirstElement();
- if(element instanceof DiffElement) {
- try {
- new ProgressMonitorDialog(getTree().getShell()).run(true /* fork */, true /* cancellable */, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(null, 1000);
- monitor.setTaskName(Policy.bind("CatchupReleaseViewer.Copying_right_contents_into_workspace_2")); //$NON-NLS-1$
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask(null, 100);
- copyAllRightToLeft((DiffElement)element, monitor);
- } finally {
- monitor.done();
- }
- }
- }, Policy.subInfiniteMonitorFor(monitor, 1000));
- } catch(CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch(InvocationTargetException e) {
- ErrorDialog.openError(TeamUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("CatchupReleaseViewer.errorCopyAllRightToLeft"), null, null); //$NON-NLS-1$
- } catch(InterruptedException e) {
- }
- }
- refresh();
- }
- public boolean isEnabled() {
- ISelection s = getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return false;
- }
- return ((IStructuredSelection)s).size() == 1;
- }
- };
-
- // Show in navigator
- if (diffModel.getViewSite() != null) {
- showInNavigator = new ShowInNavigatorAction(diffModel.getViewSite(), Policy.bind("CatchupReleaseViewer.showInNavigator")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(showInNavigator, IHelpContextIds.NAVIGATOR_SHOW_ACTION);
- addSelectionChangedListener(showInNavigator);
- }
-
- // Ignore white space
- image = TeamImages.getImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE_ENABLED);
- ignoreWhiteSpace = new Action(Policy.bind("CatchupReleaseViewer.ignoreWhiteSpace"), image) { //$NON-NLS-1$
- public void run() {
- diffModel.setIgnoreWhitespace(isChecked());
- }
- };
- ignoreWhiteSpace.setId("team.ignoreWhiteSpace"); //$NON-NLS-1$
- boolean ignore = CompareUIPlugin.getDefault().getPreferenceStore().getBoolean(CompareConfiguration.IGNORE_WHITESPACE);
- ignoreWhiteSpace.setChecked(ignore);
- ignoreWhiteSpace.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE_DISABLED));
- ignoreWhiteSpace.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE));
-
- // Show next and previous change
- showNext = new NavigationAction(true);
- showPrevious = new NavigationAction(false);
- showNext.setCompareEditorInput(diffModel);
- showPrevious.setCompareEditorInput(diffModel);
-
- // Add a double-click listener for expanding/contracting
- getTree().addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(Event e) {
- mouseDoubleClicked(e);
- }
- });
-
- // Add an F5 listener for refresh
- getTree().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.F5) {
- diffModel.refresh();
- }
- }
- });
-
- // Set an initial filter -- show all changes
- showIncoming.setChecked(true);
- showOutgoing.setChecked(true);
- showOnlyConflicts.setChecked(false);
- setFilters(CategoryFilter.SHOW_INCOMING| CategoryFilter.SHOW_CONFLICTS | CategoryFilter.SHOW_OUTGOING);
- }
-
- /**
- * Method setAllChildrenInSync.
- * @param iDiffElement
- */
- private void setAllChildrenInSync(IDiffElement element) {
- if(element instanceof DiffContainer) {
- DiffContainer container = (DiffContainer)element;
- IDiffElement[] children = container.getChildren();
- for (int i = 0; i < children.length; i++) {
- setAllChildrenInSync(children[i]);
- }
- }
- ((DiffElement)element).setKind(IRemoteSyncElement.IN_SYNC);
- }
-
- protected void copyAllRightToLeft(IDiffElement element, IProgressMonitor monitor) throws CoreException {
- Policy.checkCanceled(monitor);
-
- if(element instanceof DiffContainer) {
- DiffContainer container = (DiffContainer)element;
- IDiffElement[] children = container.getChildren();
- for (int i = 0; i < children.length; i++) {
- copyAllRightToLeft(children[i], monitor);
- }
- } else if(element instanceof TeamFile) {
- TeamFile file = (TeamFile)element;
- if(file.getKind() != IRemoteSyncElement.IN_SYNC) {
- monitor.subTask(
- Policy.bind("CatchupReleaseViewer.MakingLocalLikeRemote", //$NON-NLS-1$
- Policy.toTruncatedPath(file.getMergeResource().getResource().getFullPath(), 3)));
- file.setProgressMonitor(Policy.subNullMonitorFor(monitor));
-
- if(file.getRight() == null || file.getLeft() == null) {
- file.copy(false /* right to left */);
- }
- ITypedElement te = file.getLeft();
- ITypedElement rte = file.getRight();
- if(te instanceof IEditableContent) {
- IEditableContent editable = (IEditableContent)te;
- if(editable.isEditable()) {
- if(rte instanceof BufferedContent) {
- editable.setContent(((BufferedContent)rte).getContent());
- }
- }
- }
- file.setProgressMonitor(null);
- monitor.worked(1);
- }
- }
- }
-
- /*
- * Method declared on ContentViewer.
- */
- protected void inputChanged(Object input, Object oldInput) {
- super.inputChanged(input, oldInput);
- // Update the refresh action
- if (refresh != null) {
- Tree tree = getTree();
- if (tree != null) {
- refresh.setEnabled(input != null);
- }
- }
- }
-
- /**
- * Shows the selected resource(s) in the resource navigator.
- */
- private void showSelectionInNavigator(IViewSite viewSite) {
- ISelection selection = getSelection();
- if (!(selection instanceof IStructuredSelection)) {
- return;
- }
- // Create a selection of IResource objects
- Object[] selected = ((IStructuredSelection)selection).toArray();
- IResource[] resources = new IResource[selected.length];
- for (int i = 0; i < selected.length; i++) {
- resources[i] = ((ITeamNode)selected[i]).getResource();
- }
- ISelection resourceSelection = new StructuredSelection(resources);
-
- // Show the resource selection in the navigator
- try {
- IViewPart part = viewSite.getPage().showView(IPageLayout.ID_RES_NAV);
- if (part instanceof ResourceNavigator) {
- ((ResourceNavigator)part).selectReveal(resourceSelection);
- }
- } catch (PartInitException e) {
- TeamUIPlugin.log(e.getStatus());
- }
- }
-
- /**
- * The mouse has been double-clicked in the tree, perform appropriate
- * behaviour.
- */
- private void mouseDoubleClicked(Event e) {
- // Only act on single selection
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structured = (IStructuredSelection)selection;
- if (structured.size() == 1) {
- Object first = structured.getFirstElement();
- if (first instanceof IDiffContainer) {
- // Try to expand/contract
- setExpandedState(first, !getExpandedState(first));
- }
- }
- }
- }
-
- /**
- * @see org.eclipse.jface.viewers.StructuredViewer#handleOpen(SelectionEvent)
- */
- protected void handleOpen(SelectionEvent event) {
- ISelection selection = getSelection();
- if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- IStructuredSelection structured = (IStructuredSelection)selection;
- Object selected = structured.getFirstElement();
- if (selected instanceof TeamFile) {
- updateLabels(((TeamFile)selected).getMergeResource());
- }
- }
- super.handleOpen(event);
- }
-
- /**
- * Subclasses may override to provide different labels for the compare configuration.
- */
- protected void updateLabels(MergeResource resource) {
- resource.setLabels(getCompareConfiguration());
- }
-
- /**
- * Set the filter mask to be the exact mask specified.
- */
- private void setFilters(int maskToHide) {
- ViewerFilter[] filters = getFilters();
- if (filters != null) {
- for (int i = 0; i < filters.length; i++) {
- if (filters[i] instanceof CategoryFilter) {
- CategoryFilter filter = (CategoryFilter)filters[i];
- // Set the exact match to be applied on the filter
- filter.setMask(maskToHide);
- refresh();
- return;
- }
- }
- }
- // No category filter found -- add one
- addFilter(new CategoryFilter(maskToHide));
- }
-
- /**
- * The sync mode has changed. Update the filters.
- */
- public void syncModeChanged(int mode) {
- this.syncMode = mode;
- updateFilters();
- }
-
- /**
- * Sets the viewer filtering based on the current state
- * of the filter actions.
- */
- void updateFilters() {
- //do nothing if viewer is disposed
- Control control = getControl();
- if (control == null || control.isDisposed())
- return;
-
- //always show conflicts
- int filters = CategoryFilter.SHOW_CONFLICTS;
-
- //determine what other filters to apply based on current action states
- switch (syncMode) {
- case SyncView.SYNC_INCOMING:
- case SyncView.SYNC_MERGE:
- if (!showOnlyConflicts.isChecked()) {
- filters |= CategoryFilter.SHOW_INCOMING;
- }
- break;
- case SyncView.SYNC_OUTGOING:
- if (!showOnlyConflicts.isChecked()) {
- filters |= CategoryFilter.SHOW_OUTGOING;
- }
- break;
- case SyncView.SYNC_BOTH:
- boolean conflictsOnly = showOnlyConflicts.isChecked();
- //if showing only conflicts, don't allow these actions to happen
- showIncoming.setEnabled(!conflictsOnly);
- showOutgoing.setEnabled(!conflictsOnly);
- if (!conflictsOnly) {
- if (showIncoming.isChecked()) {
- filters |= CategoryFilter.SHOW_INCOMING;
- }
- if (showOutgoing.isChecked()) {
- filters |= CategoryFilter.SHOW_OUTGOING;
- }
- }
- break;
- }
-
- //determine whether to show pseudo conflicts
- if (!compareFileContents) {
- filters |= CategoryFilter.SHOW_PSEUDO_CONFLICTS;
- }
- setFilters(filters);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java
deleted file mode 100644
index 1fbc6dee3..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ChangedTeamContainer.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * A node in a sync tree that represents a changed folder
- * (incoming/outgoing creation or deletion).
- */
-public class ChangedTeamContainer extends UnchangedTeamContainer {
- private MergeResource mergeResource;
-
- /**
- * ChangedTeamContainer constructor
- */
- public ChangedTeamContainer(IDiffContainer parent, MergeResource resource, int description) {
- super(parent, resource.getResource(), description);
- this.mergeResource = resource;
- }
-
- /*
- * Method declared on ITeamNode.
- */
- public int getChangeDirection() {
- return getKind() & Differencer.DIRECTION_MASK;
- }
-
- public int getChangeType() {
- return getKind() & Differencer.CHANGE_TYPE_MASK;
- }
-
- public String getName() {
- return mergeResource.getName();
- }
-
- /**
- * Returns the team resource managed by this object.
- */
- public MergeResource getMergeResource() {
- return mergeResource;
- }
-
- /*
- * Method declared on IDiffContainer
- */
- public void removeToRoot(IDiffElement child) {
- // Don't want to remove empty changed containers
- remove(child);
- }
-
- /**
- * For debugging purposes only.
- */
- public String toString() {
- return "ChangedTeamContainer(" + getResource().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void makeInSync() {
- setKind(Differencer.NO_CHANGE);
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java
deleted file mode 100644
index c7890a721..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/ITeamNode.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * Interface for a sync node that responds to team commands.
- */
-public interface ITeamNode extends IDiffElement {
- // Possible values for the change direction
- static final int INCOMING = Differencer.RIGHT;
- static final int OUTGOING = Differencer.LEFT;
- static final int CONFLICTING = Differencer.CONFLICTING;
- static final int NO_CHANGE = Differencer.NO_CHANGE;
-
- /**
- * Returns the change direction for this resource. One of:
- * INCOMING, OUTGOING, CONFLICTING, NO_CHANGE.
- */
- public int getChangeDirection();
-
- /**
- * Returns the type of change for this resource. One of:
- * CHANGE, DELETION, ADDITION
- */
- public int getChangeType();
-
- /**
- * Returns the core resource represented by this node.
- */
- public IResource getResource();
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java
deleted file mode 100644
index 5f71df9b0..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/MergeResource.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import java.io.InputStream;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ui.Policy;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * Encapsulates information about a resource that requires
- * contact with the Team API.
- */
-public class MergeResource {
- private IRemoteSyncElement syncTree;
-
- /**
- * Creates a new merge resource based on the given sync information.
- */
- public MergeResource(IRemoteSyncElement syncTree) {
- this.syncTree = syncTree;
- }
-
- /**
- * Returns an InputStream for the base revision of this incoming resource.
- */
- public InputStream getBaseRevision() throws CoreException {
- IRemoteResource remote = syncTree.getBase();
- if (remote != null && !remote.isContainer()) {
- try {
- return remote.getContents(new NullProgressMonitor());
- } catch (TeamException exception) {
- // The remote resource has gone.
- return null;
- }
- }
- return null;
- }
-
- public String getExtension() {
- if (syncTree.isContainer()) {
- return ITypedElement.FOLDER_TYPE;
- }
- String name = getName();
- if (name != null) {
- int index = name.lastIndexOf('.');
- if (index == -1)
- return ""; //$NON-NLS-1$
- if (index == (name.length() - 1))
- return ""; //$NON-NLS-1$
- return name.substring(index + 1);
- }
- return ITypedElement.FOLDER_TYPE;
- }
-
- /**
- * Returns an InputStream for the latest repository version of this incoming resource.
- */
- public InputStream getLatestRevision() throws CoreException {
- IRemoteResource remote = syncTree.getRemote();
- try {
- return remote.getContents(new NullProgressMonitor());
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
- }
- }
-
- /**
- * Returns an InputStream for the local resource.
- */
- public InputStream getLocalStream() throws CoreException {
- IResource left = syncTree.getLocal();
- if (left == null) return null;
- if (left.exists() && left.getType() == IResource.FILE) {
- return ((IFile)left).getContents(true);
- }
- return null;
- }
-
- public String getName() {
- return syncTree.getName();
- }
-
- /*
- * @see IMergeResource#getResource.
- */
- public IResource getResource() {
- return syncTree.getLocal();
- }
-
- public IRemoteSyncElement getSyncElement() {
- return syncTree;
- }
-
- /**
- * Returns true if this merge resource has a base resource,
- * and false otherwise.
- */
- public boolean hasBaseRevision() {
- return syncTree.getBase() != null;
- }
-
- /**
- * Returns true if this merge resource has a latest revision,
- * and false otherwise.
- */
- public boolean hasLatestRevision() {
- return syncTree.getRemote() != null;
- }
-
- /**
- * Is this a leaf node, i.e. a file?
- */
- public boolean isLeaf() {
- return !syncTree.isContainer();
- }
-
- /**
- * Updates the given compare configuration with appropriate left, right
- * and ancestor labels for this resource.
- */
- public void setLabels(CompareConfiguration config) {
- String name = getName();
- config.setLeftLabel(Policy.bind("MergeResource.workspaceFile", name)); //$NON-NLS-1$
-
-
- IRemoteResource remote = syncTree.getRemote();
- if (remote != null) {
- config.setRightLabel(Policy.bind("MergeResource.repositoryFile", name)); //$NON-NLS-1$
- // config.setRightLabel(TeamUIPlugin.getResourceString("MergeResource.repositoryFile", new Object[] {name, remote.getVersionName()} ));
- } else {
- config.setRightLabel(Policy.bind("MergeResource.noRepositoryFile")); //$NON-NLS-1$
- }
-
- IRemoteResource base = syncTree.getBase();
- if (base != null) {
- config.setAncestorLabel(Policy.bind("MergeResource.commonFile", name)); //$NON-NLS-1$
- // config.setAncestorLabel(TeamUIPlugin.getResourceString("MergeResource.commonFile", new Object[] {name, common.getVersionName()} ));
- } else {
- config.setAncestorLabel(Policy.bind("MergeResource.noCommonFile")); //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java
deleted file mode 100644
index ffb2c206e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncCompareInput.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.compare.structuremergeviewer.DiffContainer;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.ILocalSyncElement;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.IViewSite;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * Performs a catchup or release operation on an array of resources.
- */
-public abstract class SyncCompareInput extends CompareEditorInput {
- private IRemoteSyncElement[] trees;
- private CatchupReleaseViewer catchupReleaseViewer;
- private DiffNode diffRoot;
- private Shell shell;
- private IViewSite viewSite;
- private int granularity;
-
- private ICompareInputChangeListener listener = new ICompareInputChangeListener() {
- public void compareInputChanged(ICompareInput source) {
- SyncCompareInput.this.compareInputChanged(source);
- }
- };
-
- /**
- * Subclasses may override but must call super.
- */
- protected void compareInputChanged(ICompareInput source) {
- catchupReleaseViewer.update(source, new String[] {CatchupReleaseViewer.PROP_KIND});
- updateStatusLine();
- }
-
- /**
- * Creates a new catchup or release operation.
- */
- public SyncCompareInput(int granularity) {
- super(new CompareConfiguration());
- privateSetSyncGranularity(granularity);
- }
-
- /**
- * Creates a new catchup or release operation.
- */
- public SyncCompareInput() {
- this(ILocalSyncElement.GRANULARITY_TIMESTAMP);
- }
-
- protected abstract IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException;
-
- /*
- * @see CompareEditorInput#createContents
- */
- public Control createContents(Composite parent) {
- Control result = super.createContents(parent);
- initialSelectionAndExpansionState();
- return result;
- }
-
- /**
- * Subclasses must create and return a new CatchupReleaseViewer, and set the viewer
- * using setViewer().
- */
- public abstract Viewer createDiffViewer(Composite parent);
-
- /**
- * Returns the root node of the diff tree.
- */
- public DiffNode getDiffRoot() {
- return diffRoot;
- }
-
- /**
- * Returns the first diff element that is still unresolved in the
- * subtree rooted at the given root element.
- * Returns null if everything is resolved.
- */
- private IDiffElement getFirstChange(IDiffElement root) {
- if (root instanceof ITeamNode) {
- ITeamNode node = (ITeamNode)root;
- if (node instanceof TeamFile) {
- return node;
- }
- }
- if (root instanceof IDiffContainer) {
- IDiffElement[] children = ((IDiffContainer)root).getChildren();
- IDiffElement result = null;
- for (int i = 0; i < children.length; i++) {
- result = getFirstChange(children[i]);
- if (result != null) {
- return result;
- }
- }
- }
- return null;
- }
-
- protected Shell getShell() {
- return shell;
- }
-
- /**
- * Returns the name of this operation.
- * It is dipslayed in the CompareEditor's title bar.
- */
- public String getTitle() {
- return Policy.bind("SyncCompareInput.synchronize"); //$NON-NLS-1$
- }
-
- /**
- * Returns the compare viewer;
- */
- public CatchupReleaseViewer getViewer() {
- return catchupReleaseViewer;
- }
-
- /**
- * Returns the view site, or null if this is a merge.
- */
- public IViewSite getViewSite() {
- return viewSite;
- }
-
- /**
- * Returns true if the model has incoming or conflicting changes.
- */
- boolean hasIncomingChanges() {
- if (diffRoot == null) {
- return false;
- }
- SyncSet set = new SyncSet(new StructuredSelection(diffRoot.getChildren()));
- return set.hasIncomingChanges() || set.hasConflicts();
- }
-
- /**
- * Set an appropriate initial selection and expansion state.
- */
- private void initialSelectionAndExpansionState() {
- // Select the next change
- IDiffElement next = getFirstChange(diffRoot);
- if (next != null) {
- catchupReleaseViewer.setSelection(new StructuredSelection(next), true);
- } else {
- catchupReleaseViewer.collapseAll();
- catchupReleaseViewer.setSelection(new StructuredSelection());
- }
- }
-
- /**
- * Performs a compare on the given selection.
- * This method is called before the CompareEditor has been opened.
- * If the result of the diff is empty (or an error has occured)
- * no CompareEditor is opened but an Alert is shown.
- */
- public Object prepareInput(final IProgressMonitor pm) throws InterruptedException, InvocationTargetException {
- if (pm.isCanceled()) {
- throw new InterruptedException();
- }
-
- try {
- pm.beginTask(Policy.bind("SyncCompareInput.taskTitle"), 100); //$NON-NLS-1$
-
- // Estimate 70% of the time is creating the sync elements
- this.trees = createSyncElements(Policy.subMonitorFor(pm, 70));
- setMessage(null);
- if (trees.length == 0) {
- return null;
- }
- final TeamException[] exceptions = new TeamException[1];
-
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // collect changes and build the diff tree
- diffRoot = new DiffNode(0);
- try {
- doServerDelta(monitor);
- } catch (TeamException e) {
- exceptions[0] = e;
- }
- }
- };
- if (pm.isCanceled()) {
- throw new InterruptedException();
- }
- // Estimate 30% of the time is doing the server delta
- ResourcesPlugin.getWorkspace().run(runnable, Policy.subMonitorFor(pm, 30));
- if (exceptions[0] != null) throw exceptions[0];
- if (pm.isCanceled()) {
- throw new InterruptedException();
- }
-
- if (!diffRoot.hasChildren()) {
- diffRoot = null;
- }
-
- updateStatusLine();
-
- return diffRoot;
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- void doServerDelta(IProgressMonitor pm) throws TeamException {
- pm.beginTask(null, trees.length * 1000);
- pm.setTaskName(Policy.bind("SyncCompareInput.taskTitle")); //$NON-NLS-1$
- for (int i = 0; i < trees.length; i++) {
- IRemoteSyncElement tree = trees[i];
- IProgressMonitor monitor = Policy.subMonitorFor(pm, 1000);
- monitor.beginTask(null, 1000);
- IDiffElement localRoot = collectResourceChanges(null, tree, monitor);
- monitor.done();
- makeParents(localRoot);
- }
- }
-
- /*
- * This method expects to be past a monitor that has already had it's beginTask invoked
- * and has enough ticks to allow 1 unit of work per resource in the tree and an additional
- * unit for each folder.
- */
- protected IDiffElement collectResourceChanges(IDiffContainer parent, IRemoteSyncElement tree, IProgressMonitor pm) throws TeamException {
- int type = tree.getSyncKind(getSyncGranularity(), Policy.subMonitorFor(pm, 1));
- MergeResource mergeResource = new MergeResource(tree);
-
- if (tree.isContainer()) {
- IDiffContainer element = new ChangedTeamContainer(parent, mergeResource, type);
- ILocalSyncElement[] children = tree.members(Policy.subMonitorFor(pm, 1));
- for (int i = 0; i < children.length; i++) {
- collectResourceChanges(element, (IRemoteSyncElement)children[i], pm);
- }
- return element;
- } else {
- TeamFile file = new TeamFile(parent, mergeResource, type, shell);
- file.addCompareInputChangeListener(listener);
- return file;
- }
- }
-
- public int getSyncGranularity() {
- return granularity;
- }
-
- public void setSyncGranularity(int granularity) {
- privateSetSyncGranularity(granularity);
- refresh();
- }
-
- private void privateSetSyncGranularity(int granularity) {
- this.granularity = granularity;
- if (granularity != IRemoteSyncElement.GRANULARITY_TIMESTAMP) {
- if (isIgnoreWhitespace()) {
- this.granularity = IRemoteSyncElement.GRANULARITY_CONTENTS_IGNORE_WHITESPACE;
- } else {
- this.granularity = IRemoteSyncElement.GRANULARITY_CONTENTS;
- }
- }
- }
-
- public void setIgnoreWhitespace(boolean ignore) {
- // Set the ignore whitespace
- Boolean value = ignore ? Boolean.TRUE : Boolean.FALSE;
- getCompareConfiguration().setProperty(CompareConfiguration.IGNORE_WHITESPACE, value);
- // Set the granularity (which queries the ignore whitespace setting)
- privateSetSyncGranularity(getSyncGranularity());
- // Refresh if the granularity is file contents
- if (granularity != IRemoteSyncElement.GRANULARITY_TIMESTAMP) {
- refresh();
- }
- }
-
- public boolean isIgnoreWhitespace() {
- Object o = getCompareConfiguration().getProperty(CompareConfiguration.IGNORE_WHITESPACE);
- if (o instanceof Boolean) {
- return ((Boolean)o).booleanValue();
- }
- return CompareUIPlugin.getDefault().getPreferenceStore().getBoolean(CompareConfiguration.IGNORE_WHITESPACE);
- }
-
- /**
- * Builds a DiffFolder tree under the given root for the given resource.
- */
- private DiffContainer buildPath(DiffContainer root, IContainer resource) {
- DiffContainer parent = root;
- if (resource.getType() == IResource.ROOT) {
- return root;
- }
- if (resource.getType() != IResource.PROJECT) {
- parent = buildPath(root, resource.getParent());
- }
-
- DiffContainer c = (DiffContainer)parent.findChild(resource.getName());
- if (c == null) {
- c = new UnchangedTeamContainer(parent, resource);
- }
- return c;
- }
-
- void makeParents(IDiffElement element) {
- IContainer parent = ((ITeamNode)element).getResource().getParent();
- DiffContainer container = buildPath(diffRoot, parent);
- container.add(element);
- }
-
- /**
- * Performs a refresh, with progress and cancelation.
- */
- public void refresh() {
- final Object[] input = new Object[1];
- IRunnableWithProgress op = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- input[0] = prepareInput(monitor);
- }
- };
- try {
- run(op, Policy.bind("SyncCompareInput.refresh")); //$NON-NLS-1$
- } catch (InterruptedException e) {
- return;
- }
-
- catchupReleaseViewer.setInput(input[0]);
- if (input[0] == null) {
- MessageDialog.openInformation(shell, Policy.bind("nothingToSynchronize"), Policy.bind("SyncCompareInput.nothingText")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- protected void run(IRunnableWithProgress op, String problemMessage) throws InterruptedException {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
- try {
- dialog.run(true, true, op);
- } catch (InvocationTargetException e) {
- Throwable throwable = e.getTargetException();
- IStatus error = null;
- if (throwable instanceof TeamException) {
- error = ((TeamException)throwable).getStatus();
- } else if (throwable instanceof CoreException) {
- error = ((CoreException)throwable).getStatus();
- } else {
- error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal") , throwable); //$NON-NLS-1$
- }
- ErrorDialog.openError(shell, problemMessage, null, error);
- TeamUIPlugin.log(error);
- // Throw an interrupted exception so we drop out of the sync
- throw new InterruptedException();
- }
- }
-
- public void setViewSite(IViewSite viewSite) {
- this.viewSite = viewSite;
- this.shell = viewSite.getShell();
- }
-
- public void setViewer(CatchupReleaseViewer viewer) {
- this.catchupReleaseViewer = viewer;
- }
-
- /**
- * Updates the status line.
- */
- public void updateStatusLine() {
- if (viewSite != null && !shell.isDisposed()) {
- Runnable update = new Runnable() {
- public void run() {
- if (!shell.isDisposed()) {
- IStatusLineManager statusLine = viewSite.getActionBars().getStatusLineManager();
- if (diffRoot == null) {
- statusLine.setMessage(null);
- statusLine.setErrorMessage(null);
- return;
- }
- SyncSet set = getSyncSet(new StructuredSelection(diffRoot.getChildren()));
- if (set.hasConflicts()) {
- statusLine.setMessage(null);
- statusLine.setErrorMessage(set.getStatusLineMessage());
- } else {
- statusLine.setErrorMessage(null);
- statusLine.setMessage(set.getStatusLineMessage());
- }
- viewSite.getActionBars().updateActionBars();
- }
- }
- };
- // Post or run the update
- if (shell.getDisplay() != Display.getCurrent()) {
- shell.getDisplay().asyncExec(update);
- } else {
- update.run();
- }
- }
- }
-
- protected SyncSet getSyncSet(IStructuredSelection selection) {
- return new SyncSet(selection);
- }
- public boolean saveIfNecessary() {
- if (! isSaveNeeded()) return true;
-
- final boolean[] result = new boolean[] { false };
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- try {
- result[0] = MessageDialog.openQuestion(getShell(), Policy.bind("SyncView.saveTitle"),//$NON-NLS-1$
- Policy.bind("SyncView.saveMessage"));//$NON-NLS-1$
- if (result[0]) {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- saveChanges(monitor);
- }
- }, new NullProgressMonitor());
- }
- } catch (CoreException e) {
- IStatus status = e.getStatus();
- ErrorDialog.openError(getShell(), status.getMessage(), Policy.bind("SyncView.errorSaving"), status);//$NON-NLS-1$
- result[0] = false;
- }
- }
- });
- return result[0];
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java
deleted file mode 100644
index 55808a083..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncSet.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ui.Policy;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * This class contains a set of resources that are slated to be
- * synchronized. It performs various operations on the
- * set in preparation for catchup/release.
- */
-public class SyncSet {
- private HashSet set;
-
- /**
- * Creates a new sync set on the nodes in the given selection.
- */
- public SyncSet(IStructuredSelection nodeSelection) {
- this.set = new HashSet(nodeSelection.size() + 1);
- collectNodes(nodeSelection);
- }
-
- /**
- * Collects all nodes to which this action will apply. This means
- * all nodes in the selection, plus all their children.
- */
- private void collectNodes(IStructuredSelection selection) {
- Object[] nodes = selection.toArray();
- for (int i = 0; i < nodes.length; i++) {
- recursivelyAdd((ITeamNode)nodes[i]);
- }
- }
-
- /**
- * Adds all parent creations for the given node to the sync set.
- */
- private void collectParentCreations(ITeamNode node) {
- IDiffElement parent = node.getParent();
- if (parent != null && parent instanceof ITeamNode) {
- if (parent.getKind() != IRemoteSyncElement.IN_SYNC) {
- set.add(parent);
- collectParentCreations((ITeamNode)parent);
- }
- }
- }
-
- /**
- * Returns all nodes in the set that have changes
- */
- public ITeamNode[] getChangedNodes() {
- ArrayList nodeList = new ArrayList(set.size());
- for (Iterator it = set.iterator(); it.hasNext();) {
- ITeamNode node = (ITeamNode)it.next();
- int dir = node.getChangeDirection();
- // We assume changed nodes of the wrong type have been culled
- // during set creation.
- if (dir != Differencer.NO_CHANGE) {
- nodeList.add(node);
- }
- }
- ITeamNode[] nodes = new ITeamNode[nodeList.size()];
- nodeList.toArray(nodes);
- return nodes;
- }
-
- /**
- * Returns the resources from all the nodes in this set.
- */
- public IResource[] getResources() {
- ITeamNode[] changed = getChangedNodes();
- IResource[] resources = new IResource[changed.length];
- for (int i = 0; i < changed.length; i++) {
- resources[i] = changed[i].getResource();
- }
- return resources;
- }
-
- /**
- * Returns a message for the status line describing this sync set.
- */
- public String getStatusLineMessage() {
- int incoming = 0;
- int outgoing = 0;
- int conflicts = 0;
- for (Iterator it = set.iterator(); it.hasNext();) {
- ITeamNode next = (ITeamNode)it.next();
- switch (next.getChangeDirection()) {
- case IRemoteSyncElement.INCOMING:
- incoming++;
- break;
- case IRemoteSyncElement.OUTGOING:
- outgoing++;
- break;
- case IRemoteSyncElement.CONFLICTING:
- conflicts++;
- break;
- }
- }
- StringBuffer result = new StringBuffer();
-
- if (conflicts == 0) {
- result.append(Policy.bind("SyncSet.noConflicts")); //$NON-NLS-1$
- } else {
- result.append(Policy.bind("SyncSet.conflicts", new Object[] {Integer.toString(conflicts)} )); //$NON-NLS-1$
- }
- if (incoming == 0) {
- result.append(Policy.bind("SyncSet.noIncomings")); //$NON-NLS-1$
- } else {
- result.append(Policy.bind("SyncSet.incomings", new Object[] {Integer.toString(incoming)} )); //$NON-NLS-1$
- }
- if (outgoing == 0) {
- result.append(Policy.bind("SyncSet.noOutgoings")); //$NON-NLS-1$
- } else {
- result.append(Policy.bind("SyncSet.outgoings", new Object[] {Integer.toString(outgoing)} )); //$NON-NLS-1$
- }
- return result.toString();
- }
-
- /**
- * Returns true if there are any conflicting nodes in the set, and
- * false otherwise.
- */
- public boolean hasConflicts() {
- for (Iterator it = set.iterator(); it.hasNext();) {
- if (((ITeamNode)it.next()).getChangeDirection() == IRemoteSyncElement.CONFLICTING) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns true if this sync set has incoming changes.
- * Note that conflicts are not considered to be incoming changes.
- */
- public boolean hasIncomingChanges() {
- for (Iterator it = set.iterator(); it.hasNext();) {
- if (((ITeamNode)it.next()).getChangeDirection() == IRemoteSyncElement.INCOMING) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns true if this sync set has outgoing changes.
- * Note that conflicts are not considered to be outgoing changes.
- */
- public boolean hasOutgoingChanges() {
- for (Iterator it = set.iterator(); it.hasNext();) {
- if (((ITeamNode)it.next()).getChangeDirection() == IRemoteSyncElement.OUTGOING) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns true if this sync set has auto-mergeable conflicts.
- */
- public boolean hasAutoMergeableConflicts() {
- for (Iterator it = set.iterator(); it.hasNext();) {
- ITeamNode node = (ITeamNode)it.next();
- if ((node.getKind() & IRemoteSyncElement.AUTOMERGE_CONFLICT) != 0) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Adds the given node, plus all its children, to the given set.
- */
- private void recursivelyAdd(ITeamNode node) {
- // Add the node and recurse
- if (set.add(node)) {
- if (node instanceof IDiffContainer) {
- IDiffElement[] children = ((IDiffContainer)node).getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof ITeamNode) {
- recursivelyAdd((ITeamNode)children[i]);
- }
- }
- }
- // Add any created parents (can't release or load a
- // resource creation without including new parents)
- collectParentCreations(node);
- }
- }
-
- /**
- * Removes all conflicting nodes from this set.
- */
- public void removeConflictingNodes() {
- for (Iterator it = set.iterator(); it.hasNext();) {
- ITeamNode node = (ITeamNode)it.next();
- if (node.getChangeDirection() == IRemoteSyncElement.CONFLICTING) {
- it.remove();
- }
- }
- }
- /**
- * Removes all outgoing nodes from this set.
- */
- public void removeOutgoingNodes() {
- for (Iterator it = set.iterator(); it.hasNext();) {
- ITeamNode node = (ITeamNode)it.next();
- if (node.getChangeDirection() == IRemoteSyncElement.OUTGOING) {
- it.remove();
- }
- }
- }
- /**
- * Removes all incoming nodes from this set.
- */
- public void removeIncomingNodes() {
- for (Iterator it = set.iterator(); it.hasNext();) {
- ITeamNode node = (ITeamNode)it.next();
- if (node.getChangeDirection() == IRemoteSyncElement.INCOMING) {
- it.remove();
- }
- }
- }
- /**
- * Removes all nodes from this set that are not auto-mergeable conflicts
- */
- public void removeNonMergeableNodes() {
- for (Iterator it = set.iterator(); it.hasNext();) {
- ITeamNode node = (ITeamNode)it.next();
- if ((node.getKind() & IRemoteSyncElement.MANUAL_CONFLICT) != 0) {
- it.remove();
- } else if (node.getChangeDirection() != ITeamNode.CONFLICTING) {
- it.remove();
- }
- }
- }
-
- /**
- * Removes all nodes that aren't applicable for the direction.
- */
- public void removeNonApplicableNodes(int direction) {
- for (Iterator it = set.iterator(); it.hasNext();) {
- ITeamNode node = (ITeamNode)it.next();
- int nodeDirection = node.getKind() & IRemoteSyncElement.DIRECTION_MASK;
- if (nodeDirection != IRemoteSyncElement.CONFLICTING) {
- if (nodeDirection != direction) {
- it.remove();
- }
- }
- }
- }
-
- /**
- * Remove the given node from the sync set
- */
- public void remove(ITeamNode node) {
- set.remove(node);
- }
-
- protected HashSet getSyncSet() {
- return set;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java
deleted file mode 100644
index 9cb9d34cb..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/SyncView.java
+++ /dev/null
@@ -1,556 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.IPropertyChangeNotifier;
-import org.eclipse.compare.NavigationAction;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.UIConstants;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.ISaveablePart;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.ShowInContext;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * This class provides a view for performing synchronizations
- * between the local workspace and a repository.
- */
-public class SyncView extends ViewPart implements ISaveablePart, IPropertyChangeListener {
- public static final String VIEW_ID = "org.eclipse.team.ui.sync.SyncView"; //$NON-NLS-1$
- private SyncCompareInput input;
- private Composite top;
-
- // The possible sync modes
- public static final int SYNC_NONE = 0;
- public static final int SYNC_INCOMING = 1;
- public static final int SYNC_OUTGOING = 2;
- public static final int SYNC_BOTH = 3;
- public static final int SYNC_MERGE = 4;
- public static final int SYNC_COMPARE = 5;
-
- // Titles cached for efficiency
- private final String CATCHUP_TITLE = Policy.bind("SyncView.incomingModeTitle"); //$NON-NLS-1$
- private final String RELEASE_TITLE = Policy.bind("SyncView.outgoingModeTitle"); //$NON-NLS-1$
- private final String FREE_TITLE = Policy.bind("SyncView.freeModeTitle"); //$NON-NLS-1$
-
- private int currentSyncMode = SYNC_NONE;
-
- private String viewTitle = ""; //$NON-NLS-1$
-
- /**
- * Action for toggling the sync mode.
- */
- class SyncModeAction extends Action {
- // The sync mode that this action enables
- private int syncMode;
- public SyncModeAction(String title, ImageDescriptor image, int mode) {
- super(title, image);
- this.syncMode = mode;
- }
- public void run() {
- SyncView.this.setSyncMode(syncMode);
- }
- }
-
- private SyncModeAction incomingMode;
- private SyncModeAction outgoingMode;
- private SyncModeAction freeMode;
- private NavigationAction next;
- private NavigationAction previous;
-
- private class PartListener implements IPartListener {
- public void partActivated(IWorkbenchPart part) {
- }
- public void partBroughtToTop(IWorkbenchPart part) {
- }
- public void partClosed(IWorkbenchPart part) {
- }
- public void partDeactivated(IWorkbenchPart part) {
- if (part == SyncView.this && input != null) {
- input.saveIfNecessary();
- }
- }
- public void partOpened(IWorkbenchPart part) {
- }
- }
-
- private IPartListener partListener;
-
- /**
- * Creates a new view.
- */
- public SyncView() {
- super();
- }
-
- /*
- * @see IWorkbenchPart#createPartControl
- */
- public void createPartControl(Composite parent) {
- top = new Composite(parent, SWT.NONE);
-
- //XXX Set the control data to be this part, so the compare
- //frames that will eventually live in this widget hierarchy
- //have some way to access the action bars for hooking global
- //actions. See corresponding XXX comment in CompareEditor#findActionBars
- top.setData(this);
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- top.setLayout(layout);
- top.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- showDefaultContents();
-
- initializeSyncModes();
- // add part listener
- partListener = new PartListener();
- getViewSite().getWorkbenchWindow().getPartService().addPartListener(partListener);
- WorkbenchHelp.setHelp(top, IHelpContextIds.SYNC_VIEW);
- }
-
- public void dispose() {
- // remove part listener
- if (partListener != null) {
- getViewSite().getWorkbenchWindow().getPartService().removePartListener(partListener);
- partListener = null;
- }
-
- if (input instanceof IPropertyChangeNotifier)
- ((IPropertyChangeNotifier)input).removePropertyChangeListener(this);
- super.dispose();
- }
-
- /**
- * Makes the sync view visible in the active page. If there isn't a sync
- * view registered <code>null</code> is returned. Otherwise the opened view
- * part is returned.
- */
- public static SyncView findViewInActivePage(IWorkbenchPage activePage) {
- try {
- if (activePage == null) {
- activePage = TeamUIPlugin.getActivePage();
- if (activePage == null) return null;
- }
- IViewPart part = activePage.findView(VIEW_ID);
- if (part == null)
- part = activePage.showView(VIEW_ID);
- return (SyncView)part;
- } catch (PartInitException pe) {
- return null;
- }
- }
-
- /**
- * Sets up the sync modes and the actions for switching between them.
- */
- private void initializeSyncModes() {
- // Create the actions
- incomingMode = new SyncModeAction(
- Policy.bind("SyncView.incomingModeAction"), //$NON-NLS-1$
- TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP_ENABLED),
- SYNC_INCOMING);
- incomingMode.setToolTipText(Policy.bind("SyncView.incomingModeToolTip")); //$NON-NLS-1$
- incomingMode.setChecked(false);
- incomingMode.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP_DISABLED));
- incomingMode.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP));
-
- outgoingMode = new SyncModeAction(
- Policy.bind("SyncView.outgoingModeAction"), //$NON-NLS-1$
- TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE_ENABLED),
- SYNC_OUTGOING);
- outgoingMode.setToolTipText(Policy.bind("SyncView.outgoingModeToolTip")); //$NON-NLS-1$
- outgoingMode.setChecked(false);
- outgoingMode.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE_DISABLED));
- outgoingMode.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE));
-
- freeMode = new SyncModeAction(
- Policy.bind("SyncView.freeModeAction"), //$NON-NLS-1$
- TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE_ENABLED),
- SYNC_BOTH);
- freeMode.setToolTipText(Policy.bind("SyncView.freeModeToolTip")); //$NON-NLS-1$
- freeMode.setChecked(false);
- freeMode.setDisabledImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE_DISABLED));
- freeMode.setHoverImageDescriptor(TeamImages.getImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE));
-
- // Set up global actions for next and previous
- next = new NavigationAction(true);
- previous = new NavigationAction(false);
- IActionBars actionBars = getViewSite().getActionBars();
- if (actionBars != null) {
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.NEXT, next);
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, previous);
- actionBars.updateActionBars();
- }
- }
-
- private boolean isEmpty(DiffNode node) {
- if (node == null) return true;
- if (node.getKind() != 0) return false;
- IDiffElement[] children = node.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (!isEmpty(children[i])) return false;
- }
- return true;
- }
- private boolean isEmpty(IDiffElement element) {
- if (element.getKind() != 0) return false;
- if (element instanceof DiffNode) {
- IDiffElement[] children = ((DiffNode)element).getChildren();
- for (int i = 0; i < children.length; i++) {
- if (!isEmpty(children[i])) return false;
- }
- }
- return true;
- }
-
- /**
- * Runs an operation and handles progress and exceptions. Returns true
- * if the operation was successful, and false if there were errors or
- * the user canceled.
- */
- private boolean run(IRunnableWithProgress op) {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(getSite().getShell());
- try {
- dialog.run(true, true, op);
- return true;
- } catch (InvocationTargetException e) {
- Throwable throwable = e.getTargetException();
- IStatus error = null;
- if (throwable instanceof TeamException) {
- error = ((TeamException)throwable).getStatus();
- } else if (throwable instanceof CoreException) {
- error = ((CoreException)throwable).getStatus();
- } else {
- error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal"), throwable); //$NON-NLS-1$
- }
- ErrorDialog.openError(getSite().getShell(), Policy.bind("SyncView.unableSynchronize"), null, error); //$NON-NLS-1$
- TeamUIPlugin.log(error);
- } catch (InterruptedException e) {
- }
- return false;
- }
-
- /**
- * Asks the part to take focus within the workbench.
- */
- public void setFocus() {
- if (top != null && !top.isDisposed()) {
- top.setFocus();
- }
- }
-
- /**
- * Activates the given sync mode.
- */
- void setSyncMode(int mode) {
- // Implement radio button behaviour
- switch (mode) {
- case SYNC_INCOMING:
- incomingMode.setChecked(true);
- outgoingMode.setChecked(false);
- freeMode.setChecked(false);
- setTitleWithDirtyIndicator(CATCHUP_TITLE);
- break;
- case SYNC_OUTGOING:
- outgoingMode.setChecked(true);
- incomingMode.setChecked(false);
- freeMode.setChecked(false);
- setTitleWithDirtyIndicator(RELEASE_TITLE);
- break;
- case SYNC_BOTH:
- freeMode.setChecked(true);
- outgoingMode.setChecked(false);
- incomingMode.setChecked(false);
- setTitleWithDirtyIndicator(FREE_TITLE);
- break;
- }
- // Only update actions if there is valid input
- if (input != null && input.getDiffRoot() != null && mode != currentSyncMode) {
- currentSyncMode = mode;
- input.getViewer().syncModeChanged(mode);
- updateActions();
- }
- }
-
- /**
- * Shows default contents for the view if there is nothing to synchronize.
- */
- private void showDefaultContents() {
- Label label = new Label(top, SWT.WRAP);
- label.setLayoutData(new GridData(GridData.FILL_BOTH));
- label.setText(Policy.bind("SyncView.text")); //$NON-NLS-1$
- }
-
- /**
- * Shows synchronization information for the given resources in the sync view.
- * @deprecated
- */
- public void showSync(SyncCompareInput input) {
- showSync(input, null);
- }
-
- /**
- * Shows synchronization information for the given resources in the sync
- * view.
- * @param input the diff tree to be displayed
- * @param page the page on which to open the sync view
- */
- public void showSync(SyncCompareInput input, IWorkbenchPage page) {
- next.setCompareEditorInput(input);
- previous.setCompareEditorInput(input);
- IActionBars actionBars = getViewSite().getActionBars();
- actionBars.updateActionBars();
-
- input.setViewSite(getViewSite());
- this.input = input;
- currentSyncMode = SYNC_NONE;
-
- // listen to property notifications from our input, this
- // is to support global save enablement.
- if (input instanceof IPropertyChangeNotifier)
- ((IPropertyChangeNotifier)input).addPropertyChangeListener(this);
-
- // Remove old viewer
- Control[] oldChildren = top.getChildren();
- if (oldChildren != null) {
- for (int i = 0; i < oldChildren.length; i++) {
- oldChildren[i].dispose();
- }
- }
- // Remove actions from toolbar
- IActionBars bars = getViewSite().getActionBars();
- bars.getToolBarManager().removeAll();
- bars.getToolBarManager().update(false);
- bars.getMenuManager().removeAll();
- bars.getMenuManager().update();
- bars.updateActionBars();
-
- // Display the default contents while running the diff
- showDefaultContents();
- top.layout();
-
- // Run the diff and stop if cancel or error occurred.
- if (!run(input)) return;
-
- // Check for problem message
- if (input.getMessage() != null) {
- MessageDialog.openInformation(getSite().getShell(), Policy.bind("SyncView.unableSynchronize"), input.getMessage()); //$NON-NLS-1$
- return;
- }
-
- // Check for empty comparison
- if (isEmpty(input.getDiffRoot())) {
- MessageDialog.openInformation(getSite().getShell(), Policy.bind("nothingToSynchronize"), Policy.bind("SyncView.same")); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
-
- // Remove the default contents
- oldChildren = top.getChildren();
- if (oldChildren != null) {
- for (int i = 0; i < oldChildren.length; i++) {
- oldChildren[i].dispose();
- }
- }
-
- // Show the result
- Control control = input.createContents(top);
- control.setLayoutData(new GridData(GridData.FILL_BOTH));
- /*TreeViewer viewer = input.getViewer();
- if (viewer != null) {
- Control viewerControl = viewer.getControl();
- if (viewerControl != null && !viewerControl.isDisposed()) {
- WorkbenchHelp.setHelp(viewerControl, new ViewContextComputer(this, ITeamHelpContextIds.SYNC_VIEW));
- }
- }*/
-
- top.layout();
-
- // Set the sync mode depending on user preference
- if (TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean(UIConstants.PREF_ALWAYS_IN_INCOMING_OUTGOING)) {
- freeMode.run();
- } else {
- if (input.hasIncomingChanges()) {
- incomingMode.run();
- } else {
- outgoingMode.run();
- }
- }
- // Reveal if fast view
- try {
- if (page == null) page = TeamUIPlugin.getActivePage();
- if (page != null) page.showView(VIEW_ID);
- } catch (PartInitException e) {
- TeamUIPlugin.log(e.getStatus());
- }
- }
-
- /**
- * Updates the actions for this view's action bar.
- */
- private void updateActions() {
- IActionBars bars = getViewSite().getActionBars();
- IToolBarManager toolBar = bars.getToolBarManager();
- IMenuManager menu = bars.getMenuManager();
- toolBar.removeAll();
- menu.removeAll();
-
- toolBar.add(incomingMode);
- toolBar.add(outgoingMode);
- toolBar.add(freeMode);
- input.getViewer().contributeToActionBars(bars);
-
- toolBar.update(false);
- menu.update(false);
- bars.updateActionBars();
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class key) {
- if (key == IShowInSource.class) {
- return new IShowInSource() {
- public ShowInContext getShowInContext() {
- if (input == null || input.getViewer() == null) return null;
- return new ShowInContext(null, input.getViewer().getSelection());
- }
- };
- }
- return super.getAdapter(key);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor) {
-
- WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor pm) throws CoreException {
- if (input instanceof CompareEditorInput)
- ((CompareEditorInput)input).saveChanges(pm);
- }
- };
-
- Shell shell= getSite().getShell();
-
- try {
-
- operation.run(monitor);
-
- firePropertyChange(PROP_DIRTY);
-
- } catch (InterruptedException x) {
- } catch (OperationCanceledException x) {
- } catch (InvocationTargetException x) {
- String reason= x.getTargetException().getMessage();
- ErrorDialog.openError(getSite().getShell(), Policy.bind("SyncView.cantSaveError", reason), null, null); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#doSaveAs()
- */
- public void doSaveAs() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isDirty()
- */
- public boolean isDirty() {
- if (input instanceof CompareEditorInput)
- return ((CompareEditorInput)input).isSaveNeeded();
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded()
- */
- public boolean isSaveOnCloseNeeded() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (isDirty()) {
- firePropertyChange(PROP_DIRTY);
- }
- setTitleWithDirtyIndicator(null);
- }
-
- private void setTitleWithDirtyIndicator(String title) {
- if(title != null) {
- viewTitle = title;
- }
- if(isDirty()) {
- setTitle(Policy.bind("SyncView.dirtyIndicatorInTitle", viewTitle)); //$NON-NLS-1$
- } else {
- setTitle(viewTitle);
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java
deleted file mode 100644
index f9ec2fc2a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TeamFile.java
+++ /dev/null
@@ -1,393 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.structuremergeviewer.DiffElement;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.core.TeamPlugin;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * A sync node for a version-controlled file, where the left
- * side is the local file, the right side is the remote file,
- * and the ancestor is the common file.
- */
-public class TeamFile extends DiffElement implements ICompareInput, ITeamNode, IAdaptable {
-
- private MergeResource mergeResource;
-
- private Shell shell;
- private ListenerList listeners;
-
- private TypedBufferedContent localByteContents;
- private TypedBufferedContent commonByteContents;
- private TypedBufferedContent remoteByteContents;
-
- boolean hasBeenSaved = false;
-
- private IProgressMonitor monitor;
-
- /**
- * Creates a new file node.
- */
- public TeamFile(IDiffContainer parent, MergeResource res, int changeType, Shell shell) {
- super(parent, changeType);
- Assert.isNotNull(res);
- this.mergeResource = res;
- this.shell = shell;
-
- commonByteContents = new TypedBufferedContent(this, false) {
- public InputStream createStream() throws CoreException {
- return mergeResource.getBaseRevision();
- }
- };
- remoteByteContents = new TypedBufferedContent(this, false) {
- protected InputStream createStream() throws CoreException {
- return mergeResource.getLatestRevision();
- }
- };
-
- if(getResource().exists()) {
- localByteContents = getLocalTypedContent();
- } else {
- localByteContents = null;
- }
- }
-
- public void addCompareInputChangeListener(ICompareInputChangeListener l) {
- if (listeners == null) {
- listeners = new ListenerList();
- }
- listeners.add(l);
- }
-
- /*
- * @see ICompareInput#copy(boolean)
- */
- public void copy(boolean leftToRight) {
- if (leftToRight) return;
- ITypedElement right = getRight();
- ITypedElement left = getLeft();
- try {
- if (left == null) {
- // Addition
- saveChanges(new ByteArrayInputStream(new byte[0]));
- localByteContents = getLocalTypedContent();
- } else {
- // deletion
- saveChanges(null);
- localByteContents = null;
- }
- } catch(CoreException e) {
- TeamPlugin.log(e.getStatus());
- }
- }
-
- public boolean equals(Object other) {
- if (other != null && other.getClass() == getClass()) {
- TeamFile file = (TeamFile) other;
- return mergeResource.equals(file.mergeResource);
- }
- return super.equals(other);
- }
-
- /*
- * @see ICompareInput#getAncestor
- */
- public ITypedElement getAncestor() {
- if (mergeResource.hasBaseRevision()) {
- return commonByteContents;
- }
- return null;
- }
-
- /*
- * Method declared on ITeamNode.
- */
- public int getChangeDirection() {
- return getKind() & Differencer.DIRECTION_MASK;
- }
-
- /*
- * @see ITeamNode#getChangeType()
- */
- public int getChangeType() {
- return getKind() & Differencer.CHANGE_TYPE_MASK;
- }
-
- /*
- * @see ITypedInput#getType
- */
- public Image getImage() {
- return CompareUI.getImage(getType());
- }
-
- /*
- * @see ICompareInput#getLeft
- */
- public ITypedElement getLeft() {
- return localByteContents;
- }
-
- /*
- * @see ITypedInput#getName
- */
- public String getName() {
- if(hasBeenSaved) {
- return Policy.bind("TeamFile.modified", mergeResource.getName()); //$NON-NLS-1$
- } else {
- return mergeResource.getName();
- }
- }
-
- /*
- * @see ICompareInput#getRight
- */
- public ITypedElement getRight() {
- if (mergeResource.hasLatestRevision()) {
- return remoteByteContents;
- } else {
- return null;
- }
- }
-
- /*
- * @see ITypedInput#getType
- */
- public String getType() {
- return mergeResource.getExtension();
- }
-
- /*
- * @see ICompareInput#removeCompareInputChangeListener(ICompareInputChangeListener)
- */
- public void removeCompareInputChangeListener(ICompareInputChangeListener listener) {
- if (listeners != null) {
- listeners.remove(listener);
- }
- }
-
- /*
- * @see Object
- */
- public int hashCode() {
- return mergeResource.hashCode();
- }
-
- /**
- * Returns the team resource managed by this object.
- * Guaranteed to be non-null.
- */
- public MergeResource getMergeResource() {
- return mergeResource;
- }
-
- /**
- * Returns the core resource managed by this object.
- * Guaranteed to be non-null.
- */
- public IResource getResource() {
- return mergeResource.getResource();
- }
-
- /**
- * For debugging purposes only.
- */
- public String toString() {
- return "TeamFile(" + mergeResource.getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- protected TypedBufferedContent getLocalTypedContent() {
- // don't allow editing of outgoing deletion content. To revert from the deletion the
- // user should use the appropriate sync view action.
- boolean outgoingDeletion = getChangeDirection() == IRemoteSyncElement.OUTGOING && getChangeType() == IRemoteSyncElement.DELETION;
- final String name = getName();
- return new TypedBufferedContent(this, !outgoingDeletion) {
- protected InputStream createStream() throws CoreException {
- return mergeResource.getLocalStream();
- }
- public void setContent(byte[] contents) {
- try {
- if(contents==null) {
- saveChanges(new ByteArrayInputStream(new byte[0]));
- } else {
- saveChanges(new ByteArrayInputStream(contents));
- }
- } catch(CoreException e) {
- ErrorDialog.openError(TeamUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell(), Policy.bind("TeamFile.saveChanges", name), null, e.getStatus()); //$NON-NLS-1$
- }
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- fireContentChanged();
- }
- });
- }
- public ITypedElement replace(ITypedElement child, ITypedElement other) {
- return null;
- }
- };
- }
-
- /**
- * The local resource has beed modified (i.e. merged).
- */
- public void merged() {
- // calculate the new sync state based on the type of change that was merged. This
- // logic cannot be in the IRemoteSyncElement because there is no way to update the
- // base before calling getSyncKind() again.
- if(getChangeDirection()==INCOMING) {
- switch(getChangeType()) {
- case Differencer.ADDITION:
- case Differencer.CHANGE:
- setKind(OUTGOING | Differencer.CHANGE);
- break;
- case Differencer.DELETION:
- setKind(CONFLICTING | Differencer.CHANGE);
- }
- } else {
- setKind(OUTGOING | (getKind() & Differencer.CHANGE_TYPE_MASK));
- }
- hasBeenSaved = false;
- }
-
- public void setProgressMonitor(IProgressMonitor monitor) {
- this.monitor = monitor;
- }
-
- private void saveChanges(final InputStream is) throws CoreException {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IFile file = (IFile) getResource();
- if (is != null) {
- if (!file.exists()) {
- createParents(getParent(), getResource().getParent());
- file.create(is, false, monitor);
- } else {
- file.setContents(is, false, true, monitor);
- }
- } else {
- file.delete(false, true, monitor);
- deleteParents(getParent(), getResource().getParent());
- }
- hasBeenSaved = true;
-
- // update the UI with the sync state change.
- fireThreeWayInputChange();
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- }
-
- private void createParents(IDiffContainer parentNode, IContainer parentFolder) throws CoreException {
- if(!parentFolder.exists() && parentFolder.getType() != IResource.PROJECT) {
- createParents(parentNode.getParent(), parentFolder.getParent());
- ((IFolder)parentFolder).create(false /* force */, true, null);
- if(parentNode instanceof ChangedTeamContainer) {
- ((ChangedTeamContainer)parentNode).setKind(IRemoteSyncElement.IN_SYNC);
- }
- }
- }
-
- private void deleteParents(IDiffContainer parentNode, IContainer parentFolder) throws CoreException {
- if(parentFolder.members().length == 0 && parentFolder.getType() != IResource.PROJECT) {
- IContainer parent = parentFolder.getParent();
- parentFolder.delete(false, null);
- if(parentNode instanceof ChangedTeamContainer) {
- ((ChangedTeamContainer)parentNode).setKind(IRemoteSyncElement.IN_SYNC);
- }
- deleteParents(parentNode.getParent(), parent);
- }
- }
-
- private void run(IRunnableWithProgress runnable) throws CoreException {
- try {
- if(monitor == null) {
- new ProgressMonitorDialog(shell).run(false, false, runnable);
- } else {
- runnable.run(monitor);
- }
- } catch (InvocationTargetException e) {
- if (e.getTargetException() instanceof CoreException) {
- throw (CoreException)e.getTargetException();
- } else {
- throw new CoreException(new Status(IStatus.ERROR, TeamUIPlugin.ID, 0, Policy.bind("simpleInternal"), e.getTargetException())); //$NON-NLS-1$
- }
- } catch (InterruptedException e) {
- // Ignore
- }
- }
-
- private void fireThreeWayInputChange() {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (listeners != null) {
- Object[] listenerArray = listeners.getListeners();
- // Iterate backwards so that the model gets updated last
- // it might want to remove the node completely, which might
- // upset other listeners.
- for (int i = listenerArray.length; --i >= 0;)
- ((ICompareInputChangeListener) listenerArray[i]).compareInputChanged(TeamFile.this);
- }
- }
- });
- }
-
- public boolean hasBeenSaved() {
- return hasBeenSaved;
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IResource.class)
- return mergeResource.getResource();
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java
deleted file mode 100644
index f891b81b0..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/TypedBufferedContent.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import org.eclipse.compare.BufferedContent;
-import org.eclipse.compare.IEditableContent;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * A content buffer for resources on a server.
- */
-abstract class TypedBufferedContent extends BufferedContent implements ITypedElement, IEditableContent {
- private ITeamNode node;
- private boolean editable;
-
- /**
- * Creates a new content buffer for the given team node.
- */
- TypedBufferedContent(ITeamNode node, boolean editable) {
- this.node = node;
- this.editable = editable;
- }
-
- public Image getImage() {
- return node.getImage();
- }
-
- public String getName() {
- return node.getName();
- }
-
- public String getType() {
- return node.getType();
- }
-
- /**
- * Returns true if this object can be modified.
- * If it returns <code>false</code> the other methods must not be called.
- *
- * @return <code>true</code> if this object can be modified.
- */
- public boolean isEditable() {
- return editable;
- }
-
- /**
- * This is not the definitive API!
- * This method is called on a parent to
- * - add a child,
- * - remove a child,
- * - copy the contents of a child
- *
- * What to do is encoded in the two arguments as follows:
- * add: child == null other != null
- * remove: child != null other == null
- * copy: child != null other != null
- */
- public ITypedElement replace(ITypedElement child, ITypedElement other) {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java
deleted file mode 100644
index 3b6a7a8de..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/UnchangedTeamContainer.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.sync;
-
-
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.ResourceNode;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * <b>Note:</b> This class/interface is part of an interim API that is still under
- * development and expected to change significantly before reaching stability.
- * It is being made available at this early stage to solicit feedback from pioneering
- * adopters on the understanding that any code that uses this API will almost
- * certainly be broken (repeatedly) as the API evolves.
- *
- * A node in a diff tree that represents a folder with no changes
- * to itself, it is only a placeholder for changes in its children.
- */
-public class UnchangedTeamContainer extends DiffNode implements ITeamNode {
- private IResource resource;
-
- public UnchangedTeamContainer(IDiffContainer parent, IResource resource) {
- this(parent, resource, Differencer.NO_CHANGE);
- }
-
- public UnchangedTeamContainer(IDiffContainer parent, IResource resource, int description) {
- super(parent, description);
- setLeft(new ResourceNode(resource));
- this.resource = resource;
- }
-
- /*
- * Method declared on ITeamNode
- */
- public int getChangeDirection() {
- return ITeamNode.NO_CHANGE;
- }
-
- /*
- * @see ITeamNode#getChangeType()
- */
- public int getChangeType() {
- return ITeamNode.NO_CHANGE;
- }
-
- public Image getImage() {
- return CompareUI.getImage(getType());
- }
-
- public String getName() {
- return resource.getName();
- }
-
- /**
- * Returns the resource underlying this diff node.
- */
- public IResource getResource() {
- return resource;
- }
-
- public String getType() {
- return ITypedElement.FOLDER_TYPE;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java
deleted file mode 100644
index 1214b376c..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/AuthenticatedTargetSitePropertiesPage.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.ErrorDialog;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.AuthenticatedSite;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class AuthenticatedTargetSitePropertiesPage extends PropertyPage {
- public static final int WIDTH_HINT = 250;
-
- private Site site;
- private Text nameText, passwordText;
-
- /**
- * Initializes the page
- */
- private void initialize() {
- IAdaptable element = getElement();
- if (element instanceof SiteElement) {
- site = ((SiteElement)element).getSite();
- } else {
- SiteElement adapter = (SiteElement)element.getAdapter(SiteElement.class);
- if (adapter != null) {
- site = adapter.getSite();
- }
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- initialize();
- Composite container = new Composite(parent, SWT.NONE);
- container.setLayout(new GridLayout(2, false));
-
- Label serverLabel = new Label(container, SWT.NONE);
- serverLabel.setText(Policy.bind("AuthenticatedTargetSitePropertiesPage.Server")); //$NON-NLS-1$
- serverLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Label serverText = new Label(container, SWT.NONE);
- serverText.setText(site.getURL().getHost());
- GridData data = new GridData();
- data.widthHint = WIDTH_HINT;
- serverText.setLayoutData(data);
-
- Label nameLabel = new Label(container, SWT.NONE);
- nameLabel.setText(Policy.bind("AuthenticatedTargetSitePropertiesPage.User")); //$NON-NLS-1$
- nameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- nameText = new Text(container, SWT.SINGLE | SWT.BORDER);
- data = new GridData();
- data.widthHint = WIDTH_HINT;
- nameText.setLayoutData(data);
- String name=((AuthenticatedSite)site).getUsername();
- if (name!=null) nameText.setText(name);
-
- Label passwordLabel = new Label(container, SWT.NONE);
- passwordLabel.setText(Policy.bind("AuthenticatedTargetSitePropertiesPage.Password")); //$NON-NLS-1$
- passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- passwordText = new Text(container, SWT.SINGLE | SWT.BORDER);
- passwordText.setEchoChar('*');
- passwordText.setText(""); //$NON-NLS-1$
- data = new GridData();
- data.widthHint = WIDTH_HINT;
- passwordText.setLayoutData(data);
-
- return container;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- String name = nameText.getText();
- String password = passwordText.getText();
- try {
- if (name!=null && name.length()>0) ((AuthenticatedSite)site).setUsername(name);
- if (password!=null && password.length()>0) ((AuthenticatedSite)site).setPassword(password);
- return true;
- } catch (TeamException e) {
- ErrorDialog.openError(getShell(), Policy.bind("AuthenticatedTargetSitePropertiesPage.Error"), null, e.getStatus()); //$NON-NLS-1$
- return false;
- }
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java
deleted file mode 100644
index 08b5ad7c6..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ConfigureTargetWizard.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-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.IPath;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.IRemoteTargetResource;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.ConfigurationWizardElement;
-import org.eclipse.team.internal.ui.ConfigureProjectWizardMainPage;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.UIConstants;
-import org.eclipse.team.ui.IConfigurationWizard;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.internal.model.AdaptableList;
-
-public class ConfigureTargetWizard extends Wizard implements IConfigurationWizard {
- protected IWorkbench workbench;
- protected IProject project;
- protected IConfigurationWizard wizard;
-
- protected ConfigureProjectWizardMainPage mainPage;
- protected static MappingSelectionPage mappingPage;
-
- private String pluginId = UIConstants.PLUGIN_ID;
-
- protected final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$
- protected final static String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
- protected final static String ATT_NAME = "name"; //$NON-NLS-1$
- protected final static String ATT_CLASS = "class"; //$NON-NLS-1$
- protected final static String ATT_ICON = "icon"; //$NON-NLS-1$
- protected final static String ATT_ID = "id"; //$NON-NLS-1$
-
- public ConfigureTargetWizard() {
- setNeedsProgressMonitor(true);
- setWindowTitle(getWizardWindowTitle()); //$NON-NLS-1$
- }
-
- public static final String MAPPING_PAGE_NAME = "mapping-page"; //$NON-NLS-1$
-
- protected SiteSelectionPage siteSelectionPage = null;
- /**
- * @see ConfigureProjectWizard#getExtensionPoint()
- */
- protected String getExtensionPoint() {
- return UIConstants.PT_TARGETCONFIG;
- }
-
- /**
- * @see ConfigureProjectWizard#getWizardDescription()
- */
- protected String getWizardDescription() {
- return Policy.bind("TargetSiteCreationWizard.description"); //$NON-NLS-1$
- }
-
- /**
- * @see ConfigureProjectWizard#getWizardLabel()
- */
- protected String getWizardLabel() {
- return Policy.bind("TargetSiteCreationWizard.label"); //$NON-NLS-1$
- }
-
- /**
- * @see ConfigureProjectWizard#getWizardWindowTitle()
- */
- protected String getWizardWindowTitle() {
- if(project != null) {
- return Policy.bind("TargetSiteCreationWizard.windowTitleProject"); //$NON-NLS-1$
- } else {
- return Policy.bind("TargetSiteCreationWizard.windowTitleNoProject"); //$NON-NLS-1$
- }
- }
-
- /*
- * @see Wizard#addPages
- */
- public void addPages() {
- Site[] sites = TargetManager.getSites();
- AdaptableList wizards = getAvailableWizards();
-
- if(sites.length > 0 && project != null) {
- TargetProvider provider = null;
- try {
- provider = TargetManager.getProvider(project);
- } catch (TeamException e) {
- TeamUIPlugin.log(e.getStatus());
- }
- siteSelectionPage = new SiteSelectionPage("site-selection-page", Policy.bind("TargetSiteCreationWizard.siteSelectionPage"), TeamImages.getImageDescriptor(UIConstants.IMG_WIZBAN_SHARE), provider); //$NON-NLS-1$ //$NON-NLS-2$
- addPage(siteSelectionPage);
- }
-
- if(project != null) {
- mappingPage = new MappingSelectionPage(ConfigureTargetWizard.MAPPING_PAGE_NAME, Policy.bind("MappingSelectionPage.mappingTitle"), TeamImages.getImageDescriptor(UIConstants.IMG_WIZBAN_SHARE)); //$NON-NLS-1$
- mappingPage.setWizard(this);
- }
-
- try {
- if(wizards.size() == 1) {
- ConfigurationWizardElement element = (ConfigurationWizardElement)wizards.getChildren()[0];
- this.wizard = (IConfigurationWizard)element.createExecutableExtension();
- wizard.init(workbench, project);
- wizard.addPages();
- if (wizard.getPageCount() > 0) {
- wizard.setContainer(getContainer());
- IWizardPage[] pages = wizard.getPages();
- for (int i = 0; i < pages.length; i++) {
- addPage(pages[i]);
- }
- }
- } else {
- mainPage = new ConfigureProjectWizardMainPage("target-selection-page", getWizardLabel(), TeamImages.getImageDescriptor(UIConstants.IMG_WIZBAN_SHARE), wizards, Policy.bind("ConfigureProjectWizardMainPage.selectTarget")); //$NON-NLS-1$ //$NON-NLS-2$
- mainPage.setDescription(getWizardDescription());
- mainPage.setProject(project);
- mainPage.setWorkbench(workbench);
- addPage(mainPage);
- }
- } catch (CoreException e) {
- TeamUIPlugin.log(e.getStatus());
- return;
- }
- }
-
- public IWizardPage getNextPage(IWizardPage page) {
- if(page == siteSelectionPage) {
- if(siteSelectionPage.isDisconnect()) {
- return null;
- }
- if(siteSelectionPage.getSite() != null) {
- mappingPage.setSite(siteSelectionPage.getSite());
- mappingPage.setPreviousPage(page);
- return mappingPage;
- } else if(mainPage != null) {
- return mainPage;
- } else if(wizard != null) {
- return wizard.getStartingPage();
- }
- }
- if(wizard != null) {
- return wizard.getNextPage(page);
- }
- return super.getNextPage(page);
- }
-
- public static MappingSelectionPage getMappingPage() {
- return mappingPage;
- }
-
- public boolean canFinish() {
- // If we are on the first page, never allow finish unless the selected wizard has no pages.
- IWizardPage currentPage = getContainer().getCurrentPage();
- if (currentPage == mainPage) {
- if (mainPage.getSelectedWizard() != null && mainPage.getNextPage() == null) {
- return true;
- }
- return false;
- } else if(currentPage == siteSelectionPage) {
- if(siteSelectionPage.getSite() != null || siteSelectionPage.isDisconnect()) {
- return true;
- } else {
- return false;
- }
- }
-
- MappingSelectionPage mappingPage = getMappingPage();
- if(mappingPage != null && currentPage == mappingPage) {
- return mappingPage.isPageComplete();
- }
- if(wizard != null) {
- return wizard.canFinish();
- }
- return super.canFinish();
- }
-
- /*
- * @see Wizard#performFinish
- */
- public boolean performFinish() {
- // handles finish on site selection page and on mapping page
- IWizardPage currentPage = getContainer().getCurrentPage();
- if(currentPage == siteSelectionPage || currentPage == getMappingPage()) {
- Site site;
- if(currentPage == siteSelectionPage) {
- // if the user selected the disconnect option then disconnect
- // this project from the target
- if(siteSelectionPage.isDisconnect()) {
- try {
- TargetManager.unmap(project);
- } catch (TeamException e) {
- ErrorDialog.openError(getShell(), Policy.bind("Error"), Policy.bind("ConfigureTargetWizard.errorUnmappingProject"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- }
- return true;
- }
- site = siteSelectionPage.getSite();
- } else {
- site = getMappingPage().getSite();
- }
- // a site has been selected on either the site selection page or the
- // mapping page. Use this site information to map the project to the
- // target.
- IPath path = Path.EMPTY;
- if(getMappingPage() != null) {
- path = getMappingPage().getMapping();
- }
- if(! setMapping(getContainer(), project, site, path))
- return false; //mapping failed so fail finish
- }
-
- // allow target wizard to finish
- if (wizard != null) {
- return wizard.performFinish();
- }
- return true;
- }
-
- public static boolean setMapping(IWizardContainer container, IProject project, Site site, IPath path) {
- if(validateSite(site, container)) {
- if(TargetManager.getSite(site.getType(), site.getURL()) == null) {
- TargetManager.addSite(site);
- }
- try {
- TargetProvider provider = TargetManager.getProvider(project);
- if(provider != null) {
- if(!provider.getSite().equals(site) && !MessageDialog.openQuestion(container.getShell(),
- Policy.bind("ConfigureTargetWizardQuestion_2"), //$NON-NLS-1$
- Policy.bind("ConfigureTargetWizard.alreadyMapped", project.getName(), provider.getURL().toExternalForm()))) { //$NON-NLS-1$
- return false;
- }
- TargetManager.unmap(project);
- }
- TargetManager.map(project, site, path);
- return true;
- } catch (TeamException e) {
- ErrorDialog.openError(container.getShell(), Policy.bind("ConfigureTargetWizardError_6"), Policy.bind("ConfigureTargetWizardError_mapping_the_project_with_this_site_7"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- }
- } else {
- return false;
- }
- }
-
- public static boolean validateSite(final Site site, final IWizardContainer container) {
- final boolean[] valid = new boolean[] {true};
- final String[] message = new String[] {Policy.bind("ConfigureTargetWizardURL_doesn__t_exist_on_the_server_8")}; //$NON-NLS-1$
- final int[] code = new int[] {-1};
- try {
- container.run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(Policy.bind("ConfigureTargetWizardValidating_connection_to_Site..._9"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- IRemoteTargetResource remote = site.getRemoteResource();
- valid[0] = remote.canBeReached(monitor);
- } catch(TeamException e) {
- message[0] = e.getStatus().getMessage();
- code[0] = e.getStatus().getCode();
- valid[0] = false;
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InvocationTargetException e) {
- valid[0] = false;
- message[0] = e.getTargetException().getMessage();
- } catch (InterruptedException e) {
- return false;
- }
- if(! valid[0]) {
- if(! MessageDialog.openQuestion(container.getShell(),
- Policy.bind("ConfigureTargetWizardConnection_Error_10"), //$NON-NLS-1$
- Policy.bind("ConfigureTargetWizard.errorOccurred", new Object[] {site.getURL().toExternalForm(), new Integer(code[0]), message[0]}))) { //$NON-NLS-1$
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns the configuration wizards that are available for invocation.
- *
- * @return the available wizards
- */
- protected AdaptableList getAvailableWizards() {
- AdaptableList result = new AdaptableList();
- IPluginRegistry registry = Platform.getPluginRegistry();
- IExtensionPoint point = registry.getExtensionPoint(pluginId, getExtensionPoint());
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] elements = extensions[i].getConfigurationElements();
- for (int j = 0; j < elements.length; j++) {
- IConfigurationElement element = elements[j];
- if (element.getName().equals(TAG_WIZARD)) {
- ConfigurationWizardElement wizard = createWizardElement(element);
- if (wizard != null) {
- result.add(wizard);
- }
- }
- }
- }
- }
-
- return result;
- }
- /**
- * Returns a new ConfigurationWizardElement configured according to the parameters
- * contained in the passed Registry.
- *
- * May answer null if there was not enough information in the Extension to create
- * an adequate wizard
- *
- * @param element the element for which to create a wizard element
- * @return the wizard element for the given element
- */
- protected ConfigurationWizardElement createWizardElement(IConfigurationElement element) {
- // WizardElements must have a name attribute
- String nameString = element.getAttribute(ATT_NAME);
- if (nameString == null) {
- // Missing attribute
- return null;
- }
- ConfigurationWizardElement result = new ConfigurationWizardElement(nameString);
- if (initializeWizard(result, element)) {
- // initialization was successful
- return result;
- }
- return null;
- }
- /**
- * Initialize the passed element's properties based on the contents of
- * the passed registry. Answer a boolean indicating whether the element
- * was able to be adequately initialized.
- *
- * @param element the element to initialize the properties for
- * @param extension the registry to get properties from
- * @return whether initialization was successful
- */
- protected boolean initializeWizard(ConfigurationWizardElement element, IConfigurationElement config) {
- element.setID(config.getAttribute(ATT_ID));
- String description = ""; //$NON-NLS-1$
- IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION);
- if (children.length >= 1) {
- description = children[0].getValue();
- }
-
- element.setDescription(description);
-
- // apply CLASS and ICON properties
- element.setConfigurationElement(config);
- String iconName = config.getAttribute(ATT_ICON);
- if (iconName != null) {
- IExtension extension = config.getDeclaringExtension();
- element.setImageDescriptor(TeamImages.getImageDescriptorFromExtension(extension, iconName));
- }
- // ensure that a class was specified
- if (element.getConfigurationElement() == null) {
- // Missing attribute
- return false;
- }
- setForcePreviousAndNextButtons(true);
- return true;
- }
- /*
- * Method declared on IConfigurationWizard
- */
- public void init(IWorkbench workbench, IProject project) {
- this.workbench = workbench;
- this.project = project;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java
deleted file mode 100644
index 92a9334d4..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/CreateNewFolderAction.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.core.target.IRemoteTargetResource;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-
-/**
- * Action to create a new remote folder.
- */
-public class CreateNewFolderAction extends TargetAction {
-
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedRemoteFolders().length == 1;
- }
-
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- try {
- TeamUIPlugin.runWithProgressDialog(getShell(), true /* cancelable */, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- createDir(getShell(), getSelectedRemoteFolders()[0], new String());
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- });
- } catch (InvocationTargetException e) {
- handle(e, Policy.bind("Error"), Policy.bind("CreateNewFolderAction.errorCreatingFolder")); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (InterruptedException e) {
- }
- }
-
- /**
- * Throws a TeamException if one occured.
- * Returns null if the operation was cancelled or an exception occured
- */
- public static IRemoteTargetResource createDir(final Shell shell, final IRemoteTargetResource parent, final String defaultName) throws TeamException {
- final IRemoteTargetResource[] newFolder = new IRemoteTargetResource[] {null};
- try {
- TeamUIPlugin.runWithProgressDialog(shell, true, new IRunnableWithProgress() {
- public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(Policy.bind("CreateNewFolderAction.creatingFolder"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- final String[] folderName = new String[] {null};
- final String suggestedName = getSuggestedFolderName(parent, Policy.subMonitorFor(monitor, 0), defaultName);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- InputDialog dialog = new InputDialog(shell,
- Policy.bind("CreateNewFolderAction.title"), //$NON-NLS-1$
- Policy.bind("CreateNewFolderAction.message"), //$NON-NLS-1$
- suggestedName,
- null);
- Policy.checkCanceled(monitor);
- if(dialog.open() == InputDialog.OK) {
- folderName[0] = dialog.getValue();
- }
- }
- });
- if(folderName[0] != null) {
- newFolder[0] = parent.getFolder(folderName[0]);
- newFolder[0].mkdirs(Policy.subMonitorFor(monitor, 0));
- }
- } catch(TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch(InvocationTargetException e) {
- if (e.getTargetException() instanceof TeamException) {
- throw (TeamException)e.getTargetException();
- }
- TeamUIPlugin.handle(e);
- } catch(InterruptedException e) {
- }
- return newFolder[0];
- }
-
- protected static String getSuggestedFolderName(IRemoteTargetResource parent, IProgressMonitor monitor, String defaultName) throws TeamException {
- IRemoteResource[] members;
- monitor.subTask(Policy.bind("CreateNewFolderAction.suggestedNameProgress")); //$NON-NLS-1$
- members = parent.members(monitor);
- ArrayList names = new ArrayList();
-
- String suggestedFolderName = defaultName;
-
- boolean nameUsed = false;
-
- for (int i = 0; i < members.length; i++) {
- String existingName = members[i].getName();
- names.add(existingName); // cache them for next round since faster
- if(existingName.equals(suggestedFolderName)) {
- nameUsed = true;
- }
- }
-
- if(!nameUsed)
- return suggestedFolderName;
-
- //Otherwise, keep proposing new names by incrementing a postfix name index until we find one not used
- int postfix = 1;
-
- String baseName = suggestedFolderName;
-
- do {
- nameUsed = false;
- for (int i = 0; i < members.length && !nameUsed; i++) {
- suggestedFolderName = Policy.bind("CreateNewFolderAction.suggestedNameConcat", baseName, String.valueOf(postfix)); //$NON-NLS-1$
- String existingName = (String) names.get(i);
-
- if(existingName.equals(suggestedFolderName)) {
- postfix = postfix + 1;
- nameUsed = true;
- }
- }
- } while(nameUsed);
- return suggestedFolderName;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java
deleted file mode 100644
index d5db55b42..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/DiscardSiteAction.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-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.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.DetailsDialog;
-import org.eclipse.team.internal.ui.Policy;
-
-/**
- * Discards a remembered Site from Target Management. Before a Site can be
- * discarded all resources using this site must be deconfigured. This action will
- * prompt the user if a Site cannot be discarded because of existing connections.
- */
-public class DiscardSiteAction extends TargetAction {
-
- private class AlreadyMappedDialog extends DetailsDialog {
- private IProject[] projects;
- private org.eclipse.swt.widgets.List detailsList;
- private Button unmap;
-
- public AlreadyMappedDialog(Shell shell, IProject[] projects) {
- super(shell, Policy.bind("SiteExplorerView.unmapDialogTitle")); //$NON-NLS-1$
- setImageKey(DLG_IMG_WARNING);
- this.projects = projects;
- }
-
- protected Composite createDropDownDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData data = new GridData ();
- data.heightHint = 75;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- detailsList.setLayoutData(data);
-
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- TargetProvider target;
- try {
- target = TargetManager.getProvider(project);
- } catch (TeamException e) {
- continue;
- }
- detailsList.add(Policy.bind("SiteExplorerView.mappedProjects", project.getName(), target.getURL().toExternalForm())); //$NON-NLS-1$
- }
- return composite;
- }
-
- protected void createMainDialogArea(Composite composite) {
- Label label = new Label(composite, SWT.WRAP);
- label.setText(Policy.bind("SiteExplorerView.projectsAlreadyMapped")); //$NON-NLS-1$
- GridData data = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- label.setLayoutData(data);
- label.setFont(composite.getFont());
-
- unmap = new Button(composite, SWT.CHECK);
- unmap.setText(Policy.bind("SiteExplorerView.unmapProjectsAndDisconnect")); //$NON-NLS-1$
- unmap.setSelection(false);
- unmap.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- updateEnablements();
- }
- });
- setPageComplete(false);
- updateEnablements();
- }
-
- protected void updateEnablements() {
- setPageComplete(unmap.getSelection());
- }
- }
-
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedSites().length > 0;
- }
-
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- deletedSelected();
- }
-
- private void deletedSelected() {
- try {
- Site[] sites = getSelectedSites();
- if(sites.length > 0) {
-
- // sites are already mapped, ask if they want to unmap projects first
- IProject[] mappedProjects = projectsMappedToSite(sites);
- if( mappedProjects.length > 0 ) {
- AlreadyMappedDialog dialog = new AlreadyMappedDialog(getShell(), mappedProjects);
- if(dialog.open() == AlreadyMappedDialog.OK) {
- for (int i = 0; i < mappedProjects.length; i++) {
- TargetManager.unmap(mappedProjects[i]);
- }
- } else {
- // nothing to do
- return;
- }
- } else {
- MessageDialog d = new MessageDialog(getShell(),
- Policy.bind("SiteExplorerView.promptForDeletingSitesTitle"), //$NON-NLS-1$
- null,
- Policy.bind("SiteExplorerView.promptForDeletingSites", new Integer(sites.length).toString()), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.CANCEL_LABEL }, 0);
- if( d.open() != MessageDialog.OK ) {
- return;
- }
- }
- // sites aren't mapped, just ask then delete them form the view
- // and from the target manager.
- for (int i = 0; i < sites.length; i++) {
- TargetManager.removeSite(sites[i]);
- sites[i].dispose();
- }
- }
- } catch (TeamException e) {
- ErrorDialog.openError(getShell(),
- Policy.bind("Error"), //$NON-NLS-1$
- Policy.bind("CreateNewFolderAction.errorDeletingSites"), //$NON-NLS-1$
- e.getStatus());
- }
- }
-
- private IProject[] projectsMappedToSite(Site[] sites) throws TeamException {
- List mappedProjects = new ArrayList();
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- TargetProvider target = TargetManager.getProvider(project);
- for (int j = 0; j < sites.length; j++) {
- if(target != null && target.getSite().equals(sites[j])) {
- mappedProjects.add(project);
- }
- }
- }
- return (IProject[]) mappedProjects.toArray(new IProject[mappedProjects.size()]);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java
deleted file mode 100644
index dc456aa9f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ExportTargetSiteMainPage.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.TableLayout;
-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.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamWizardPage;
-
-/**
- * This page allows the user to save the settings used by Target sites to a file.
- */
-public class ExportTargetSiteMainPage extends TeamWizardPage {
- private List selectedSites = new ArrayList();
- private Text fileText;
- private String fileName = ""; //$NON-NLS-1$
- private Table table;
- private Button browseButton;
-
- /**
- * Constructor for ExportTargetSiteMainPage.
- * @param pageName The name of the page.
- */
- public ExportTargetSiteMainPage(String pageName) {
- super(pageName);
- }
-
- /**
- * Constructor for ExportTargetSiteMainPage.
- * @param pageName The name of the page
- * @param title The title of the page
- * @param titleImage The image for the page
- */
- public ExportTargetSiteMainPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1);
- initializeDialogUnits(composite);
- createLabel(composite, Policy.bind("ExportTargetSiteMainPage.Select_Sites")); //$NON-NLS-1$
-
- //TODO: add F1 help.
-
- table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- table.setLayout(new TableLayout());
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 300;
- table.setLayoutData(data);
- table.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- if (event.detail == SWT.CHECK) {
- TableItem item = (TableItem) event.item;
- if (item.getChecked()) {
- selectedSites.add(item.getData());
- } else {
- selectedSites.remove(item.getData());
- }
- updateEnablement();
- }
- }
- });
- createLabel(composite, Policy.bind("ExportTargetSiteMainPage.Target_Site_Filename")); //$NON-NLS-1$
-
- Composite inner = new Composite(composite, SWT.NULL);
- inner.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- inner.setLayout(layout);
-
- createLabel(inner, Policy.bind("ExportTargetSiteMainPage.File_name")); //$NON-NLS-1$
- fileText = createTextField(inner);
- if (fileName != null)
- fileText.setText(fileName);
- fileText.addListener(SWT.Modify, new Listener() {
- public void handleEvent(Event event) {
- fileName = fileText.getText();
- updateEnablement();
- }
- });
-
- browseButton = new Button(inner, SWT.PUSH);
- browseButton.setText(Policy.bind("ExportTargetSiteMainPage.Browse")); //$NON-NLS-1$
- 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(), SWT.SAVE);
- d.setFilterExtensions(new String[] { "*.tsf" }); //$NON-NLS-1$
- d.setFilterNames(new String[] { Policy.bind("ExportTargetSiteMainPage.Target_Site_Files")}); //$NON-NLS-1$
- d.setFileName(Policy.bind("ExportTargetSiteMainPage.default")); //$NON-NLS-1$
- d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$
- String f = d.open();
- if (f != null) {
- fileText.setText(f);
- fileName = f;
- }
- }
- });
-
- initializeSites();
- setControl(composite);
- updateEnablement();
- }
-
- public void setSelectedSites(Site[] selectedSites) {
- this.selectedSites.addAll(Arrays.asList(selectedSites));
- }
-
- public void setFileName(String file) {
- if (file != null) {
- this.fileName = file;
- }
- }
-
- private void initializeSites() {
- List siteList = new ArrayList();
- Site[] workspaceSites = TargetManager.getSites();
- for (int i = 0; i < workspaceSites.length; i++) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setData(workspaceSites[i]);
- item.setText(workspaceSites[i].getDisplayName());
- }
- }
-
- /**
- * Returns the fileName.
- * @return String
- */
- public String getFileName() {
- return fileName;
- }
-
- public Site[] getSelectedSites() {
- return (Site[]) selectedSites.toArray(new Site[selectedSites.size()]);
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- fileText.setFocus();
- }
- }
-
- private void updateEnablement() {
- boolean complete;
- if (selectedSites.size() == 0) {
- setMessage(null);
- complete = false;
- } else if (fileName.length() == 0) {
- setMessage(null);
- complete = false;
- } else {
- File f = new File(fileName);
- if (f.isDirectory()) {
- setMessage(Policy.bind("ExportTargetSiteMainPage.folder_specified"), ERROR); //$NON-NLS-1$
- complete = false;
- } else {
- complete = true;
- }
- }
- if (complete) {
- setMessage(null);
- }
- setPageComplete(complete);
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java
deleted file mode 100644
index df8b5526a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAction.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-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.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.DetailsDialog;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * Action for getting the contents of the selected resources
- */
-public class GetAction extends TargetAction {
-
- private class OutgoingChangesDialog extends DetailsDialog {
- private IResource[] outgoingChanges;
- private org.eclipse.swt.widgets.List detailsList;
-
- public OutgoingChangesDialog(Shell shell, IResource[] outgoingChanges) {
- super(shell, Policy.bind("GetAction.confirmFileOverwriteTitle")); //$NON-NLS-1$
- setImageKey(DLG_IMG_QUESTION);
- this.outgoingChanges = outgoingChanges;
- }
-
- protected Composite createDropDownDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- GridData data = new GridData ();
- data.heightHint = 75;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- detailsList.setLayoutData(data);
-
- for (int i = 0; i < outgoingChanges.length; i++) {
- detailsList.add(outgoingChanges[i].getFullPath().toString()); //$NON-NLS-1$
- }
- return composite;
- }
-
- protected void createMainDialogArea(Composite parent) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(Policy.bind("GetAction.confirmFileOverwrite")); //$NON-NLS-1$
- GridData data = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- label.setLayoutData(data);
- label.setFont(parent.getFont());
- setPageComplete(true);
- }
-
- protected void updateEnablements() {
- }
- }
-
- public void run(IAction action) {
- if(promptForOutgoingChanges()) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- Hashtable table = getTargetProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask(null, keySet.size() * 1000);
-
- // perform the get on each provider
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- TargetProvider provider = (TargetProvider)iterator.next();
- monitor.setTaskName(Policy.bind("GetAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.get(providerResources, Policy.subInfiniteMonitorFor(monitor, 1000));
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("GetAction.title"), PROGRESS_DIALOG); //$NON-NLS-1$
- }
- }
-
- private boolean promptForOutgoingChanges() {
- try {
- // find any outgoing changes that will be overwritten and prompt
- Hashtable table = getTargetProviderMapping();
- Set keySet = table.keySet();
-
- Iterator iterator = keySet.iterator();
- List outgoingChanges = new ArrayList();
- while (iterator.hasNext()) {
- TargetProvider provider = (TargetProvider)iterator.next();
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- outgoingChanges.addAll(Arrays.asList(findResourcesWithOutgoingChanges(providerResources)));
- }
- if(! outgoingChanges.isEmpty()) {
- final OutgoingChangesDialog dialog = new OutgoingChangesDialog(getShell(),
- (IResource[]) outgoingChanges.toArray(new IResource[outgoingChanges.size()]));
- final boolean okToContinue[] = {true};
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- if(dialog.open() != OutgoingChangesDialog.OK) {
- okToContinue[0] = false;
- }
- }
- });
- return okToContinue[0];
- }
- return true;
- } catch(CoreException e) {
- TeamUIPlugin.handle(e);
- } catch(TeamException e) {
- TeamUIPlugin.handle(e);
- }
- return false;
- }
-
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- TargetProvider provider = TargetManager.getProvider(resource.getProject());
- if(provider == null)
- return false;
- if(! provider.canPut(resource))
- return false; //if one can't don't allow for any
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java
deleted file mode 100644
index 79e5db948..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsAction.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-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.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.core.target.IRemoteTargetResource;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.PromptingDialog;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.NewProjectAction;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.ProjectLocationSelectionDialog;
-
-/**
- * Action to transfer a remote folder and it's contents into the workspace. If
- * the remote folder doesn't have a .project then the project creation wizard
- * is shown to configure a new project, otherwise the a prompt is shown to choose
- * the project name and location.
- *
- * @see GetAsProjectAction
- */
-public class GetAsAction extends GetAsProjectAction {
- public void run(IAction action) {
-
- final IRemoteTargetResource[] folders = getSelectedRemoteFolders();
- if (folders.length != 1) return;
- final IRemoteTargetResource remoteFolder = folders[0];
- final String remoteName = remoteFolder.getName();
-
- // Fetch the members of the folder to see if they contain a .project file.
- final boolean[] hasProjectMetaFile = new boolean[] { false };
- final boolean[] errorOccured = new boolean[] { false };
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- hasProjectMetaFile[0] = hasProjectMetaFile(remoteFolder, monitor);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, Policy.bind("GetAs.checkoutFailed"), PROGRESS_DIALOG); //$NON-NLS-1$
- if (errorOccured[0]) return;
-
- // Prompt outside a workspace runnable so that the project creation delta can be heard
- IProject newProject = null;
- if ( ! hasProjectMetaFile[0]) {
- newProject = getNewProject(remoteFolder.getName());
- if (newProject == null) return;
- }
-
- final IProject createdProject = newProject;
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- IProject project;
- if (hasProjectMetaFile[0]) {
- // Prompt for name
- final Shell shell = getShell();
- final int[] result = new int[] { Dialog.OK };
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(remoteName);
- final ProjectLocationSelectionDialog dialog = new ProjectLocationSelectionDialog(shell, project);
- dialog.setTitle(Policy.bind("GetAs.enterProjectTitle", remoteName)); //$NON-NLS-1$
-
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- result[0] = dialog.open();
- }
- });
- if (result[0] != Dialog.OK) return;
-
- Object[] destinationPaths = dialog.getResult();
- if (destinationPaths == null) return;
- String newName = (String) destinationPaths[0];
- IPath newLocation = new Path((String) destinationPaths[1]);
-
- // prompt if the project exists locally
- project = ResourcesPlugin.getWorkspace().getRoot().getProject(newName);
- PromptingDialog prompt = new PromptingDialog(getShell(), new IResource[] { project },
- getOverwriteLocalAndFileSystemPrompt(), Policy.bind("GetAsProject.confirmOverwrite"));//$NON-NLS-1$
- if (prompt.promptForMultiple().length == 0) return;
-
- monitor.beginTask(null, 100);
- monitor.setTaskName(Policy.bind("GetAs.taskname", remoteFolder.getName(), newName)); //$NON-NLS-1$
-
- // create the project
- try {
- if (newLocation.equals(Platform.getLocation())) {
- // create in default location
- project.create(Policy.subMonitorFor(monitor, 3));
- } else {
- // create in some other location
- IProjectDescription desc = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName());
- desc.setLocation(newLocation);
- project.create(desc, Policy.subMonitorFor(monitor, 3));
- }
- project.open(Policy.subMonitorFor(monitor, 2));
- } catch (CoreException e) {
- throw new TeamException(e.getStatus());
- }
- } else {
- project = createdProject;
- monitor.beginTask(null, 95);
- monitor.setTaskName(Policy.bind("GetAs.taskname", remoteFolder.getName(), createdProject.getName())); //$NON-NLS-1$
- }
-
- get(project, remoteFolder, Policy.subInfiniteMonitorFor(monitor, 95));
-
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("GetAs.checkoutFailed"), PROGRESS_DIALOG); //$NON-NLS-1$
- }
-
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedRemoteFolders().length == 1;
- }
-
- /**
- * Get a new project.
- *
- * The suggestedName is not currently used but is a desired capability.
- */
- private IProject getNewProject(String suggestedName) {
- NewProjectListener listener = new NewProjectListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE);
- (new NewProjectAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow())).run();
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
- return listener.getNewProject();
- }
-
- protected boolean hasProjectMetaFile(IRemoteTargetResource remote, IProgressMonitor monitor) throws TeamException {
- IRemoteResource[] children = remote.members(monitor);
- for (int i = 0; i < children.length; i++) {
- if(children[i].getName().equals(".project")) { //$NON-NLS-1$
- return true;
- }
- }
- return false;
- }
-
- class NewProjectListener implements IResourceChangeListener {
- private IProject newProject = null;
- /**
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta root = event.getDelta();
- IResourceDelta[] projectDeltas = root.getAffectedChildren();
- for (int i = 0; i < projectDeltas.length; i++) {
- IResourceDelta delta = projectDeltas[i];
- IResource resource = delta.getResource();
- if (delta.getKind() == IResourceDelta.ADDED) {
- newProject = (IProject)resource;
- }
- }
- }
- /**
- * Gets the newProject.
- * @return Returns a IProject
- */
- public IProject getNewProject() {
- return newProject;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java
deleted file mode 100644
index db1349183..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetAsProjectAction.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ui.*;
-import org.eclipse.team.internal.core.target.IRemoteTargetResource;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.core.target.UrlUtil;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.PromptingDialog;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-
-/**
- * Action to transfer a remote folder and it's contents into the workspace. The
- * resulting project is named with the remote folder name and the kind of project
- * is determined by the remote .project file. If the remote folder doesn't not
- * contain a .project, then the project default simple type is used.
- *
- * @see GetAsAction
- */
-public class GetAsProjectAction extends TargetAction {
-
- public void run(IAction action) {
-
- final IRemoteTargetResource[] remoteFolders = getSelectedRemoteFolders();
-
- Set targetProjects = new HashSet();
- for (int i = 0; i < remoteFolders.length; i++) {
- String projectName = remoteFolders[i].getName();
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- targetProjects.add(project);
- }
- final IResource[] projects = (IResource[]) targetProjects.toArray(new IResource[targetProjects.size()]);
- PromptingDialog prompt = new PromptingDialog(getShell(), projects,
- getOverwriteLocalAndFileSystemPrompt(),
- Policy.bind("GetAsProject.confirmOverwrite"));//$NON-NLS-1$
-
- try {
- if (prompt.promptForMultiple().length != projects.length) return;
- } catch (InterruptedException e) {
- return;
- }
-
- try {
- TeamUIPlugin.runWithProgressDialog(getShell(), true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- monitor.beginTask(getTaskName(remoteFolders), remoteFolders.length * 100);
- monitor.setTaskName(getTaskName(remoteFolders));
- for (int i = 0; i < remoteFolders.length; i++) {
- IProject project = (IProject)projects[i];
- IRemoteTargetResource remote = remoteFolders[i];
- IProgressMonitor subMonitor = Policy.subInfiniteMonitorFor(monitor, 100);
- get(project, remote, subMonitor);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InvocationTargetException e) {
- handle(e, Policy.bind("Error"), Policy.bind("GetAsProject.errorGettingResources")); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (InterruptedException e) {
- return;
- }
- }
-
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- return getSelectedRemoteFolders().length > 0;
- }
-
- protected void get(IProject project, IRemoteTargetResource remote, IProgressMonitor monitor) throws TeamException {
- try {
- monitor.beginTask(null, 100);
- try {
- if(!project.exists()) {
- project.create(Policy.subMonitorFor(monitor, 5));
- }
- if(!project.isOpen()) {
- project.open(Policy.subMonitorFor(monitor, 5));
- }
- } catch (CoreException e) {
- ErrorDialog.openError(getShell(), Policy.bind("Error"), Policy.bind("GetAsProject.errorCreatingProject"), e.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
- Site site = remote.getSite();
- TargetProvider provider = TargetManager.getProvider(project);
- if(provider != null) {
- TargetManager.unmap(project);
- }
- TargetManager.map(project, site, UrlUtil.getTrailingPath(remote.getURL(), site.getURL()));
- provider = TargetManager.getProvider(project);
- provider.get(project, remote, Policy.subMonitorFor(monitor, 90));
- } finally {
- monitor.done();
- }
- }
-
- protected static String getTaskName(IRemoteTargetResource[] remoteFolders) {
- if (remoteFolders.length == 1) {
- IRemoteTargetResource folder = remoteFolders[0];
- return Policy.bind("GetAsProject.taskName1", folder.getURL().toExternalForm()); //$NON-NLS-1$
- }
- else {
- return Policy.bind("GetAsProject.taskNameN", new Integer(remoteFolders.length).toString()); //$NON-NLS-1$
- }
- }
-
- protected IPromptCondition getOverwriteLocalAndFileSystemPrompt() {
- return new IPromptCondition() {
- // prompt if resource in workspace exists or exists in local file system
- public boolean needsPrompt(IResource resource) {
- File localLocation = getFileLocation(resource);
- if(resource.exists() || localLocation.exists()) {
- return true;
- }
- return false;
- }
- public String promptMessage(IResource resource) {
- File localLocation = getFileLocation(resource);
- if(resource.exists()) {
- return Policy.bind("GetAsProject.thisResourceExists", resource.getName());//$NON-NLS-1$
- } else {
- return Policy.bind("GetAsProject.thisExternalFileExists", resource.getName());//$NON-NLS-1$
- }//$NON-NLS-1$
- }
- private File getFileLocation(IResource resource) {
- return new File(resource.getParent().getLocation().toFile(), resource.getName());
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java
deleted file mode 100644
index f2129f36a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/GetSyncAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class GetSyncAction extends TargetSyncAction {
-
- public GetSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SYNC_GET_ACTION);
- }
-
- /**
- * @see TargetSyncAction#isEnabled(ITeamNode)
- */
- protected boolean isEnabled(ITeamNode node) {
- // Get action is enabled for any changed nodes.
- SyncSet set = new SyncSet(new StructuredSelection(node));
- return set.hasIncomingChanges() || set.hasConflicts();
- }
-
- /**
- * @see TargetSyncAction#removeNonApplicableNodes(SyncSet, int)
- */
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeOutgoingNodes();
- }
-
- /**
- * @see TargetSyncAction#run(SyncSet, IProgressMonitor)
- */
- protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) {
- try {
- ITeamNode[] changed = syncSet.getChangedNodes();
- if (changed.length == 0) {
- return syncSet;
- }
- List fileResources = new ArrayList();
- List folderDeletions = new ArrayList();
- List folderAdditions = new ArrayList();
- //Find the incoming file changes the potential incoming folder deletions:
- for (int i = 0; i < changed.length; i++) {
- if (changed[i].getChangeDirection()==ITeamNode.INCOMING || changed[i].getChangeDirection()==ITeamNode.CONFLICTING) {
- if (changed[i].getResource().getType()==IResource.FILE) fileResources.add(changed[i].getResource());
- else if (changed[i].getChangeType()==Differencer.DELETION
- && /*don't delete nonexistant folders*/changed[i].getResource().exists())
- folderDeletions.add(changed[i].getResource());
- else {
- //If the new remote folders have no children then we'd better explicitly create them locally:
- IResource resource=changed[i].getResource();
- if (getRemoteResourceFor(resource).members(monitor).length==0)
- folderAdditions.add(changed[i].getResource());
- }
- }
- }
- get((IResource[])fileResources.toArray(new IResource[fileResources.size()]), monitor);
- get((IResource[])folderAdditions.toArray(new IResource[folderDeletions.size()]), monitor);
- if (folderDeletions.size()>0) {
- //Prune the list of potential incoming folder deletions, retaining only those that don't have local content:
- boolean delete;
- Iterator iter=folderDeletions.iterator();
- for (IContainer container=(IContainer)iter.next(); iter.hasNext(); container=(IContainer)iter.next()) {
- delete=true;
- IResource[] children=container.members();
- for (int j = 0; j < children.length; j++) {
- if (!folderDeletions.contains(children[j])) {
- delete=false;
- break;
- }
- }
- if (!delete) iter.remove();
- }
- get((IResource[])folderDeletions.toArray(new IResource[folderDeletions.size()]), monitor);
- }
- } catch (final TeamException e) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- }
- });
- return null;
- } catch (final CoreException e) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- }
- });
- return null;
- }
- return syncSet;
- }
-
- /**
- * Put the given resources to their associated providers.
- *
- * @param resources the resources to commit
- * @param monitor the progress monitor
- */
- public void get(IResource[] resources, IProgressMonitor monitor) throws TeamException {
- monitor = Policy.monitorFor(monitor);
- try {
- Hashtable table = getTargetProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000);
- TargetProvider provider = (TargetProvider)iterator.next();
- monitor.setTaskName(Policy.bind("GetAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.get(providerResources, subMonitor);
- }
- } finally {
- monitor.done();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java
deleted file mode 100644
index b667a277c..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ImportTargetSiteMainPage.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-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.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamWizardPage;
-
-public class ImportTargetSiteMainPage extends TeamWizardPage {
- private Text fileText;
- private String file = ""; //$NON-NLS-1$
- private Button browseButton;
-
- /**
- * @see org.eclipse.jface.wizard.WizardPage#WizardPage(String, String, ImageDescriptor)
- */
- public ImportTargetSiteMainPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- 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("ImportTargetSiteMainPage.nonexistent_file"), ERROR); //$NON-NLS-1$
- complete = false;
- } else if (f.isDirectory()) {
- setMessage(Policy.bind("ImportTargetSiteMainPage.folder_specified"), ERROR); //$NON-NLS-1$
- complete = false;
- } else {
- complete = true;
- }
- }
- if (complete) {
- setMessage(null);
- }
- setPageComplete(complete);
- }
-
- /**
- * single-use mutator
- * @param file The name to use for the file.
- */
- public void setFileName(String file) {
- if (file != null) {
- this.file = file;
- }
- }
-
- /**
- * Method getFileName.
- * @return String
- */
- public String getFileName() {
- return file;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- fileText.setFocus();
- }
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1);
- initializeDialogUnits(composite);
-
- //TODO: add F1 help.
-
- Composite inner = new Composite(composite, SWT.NULL);
- inner.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- inner.setLayout(layout);
-
- createLabel(inner, Policy.bind("ImportTargetSiteMainPage.File_name")); //$NON-NLS-1$
- fileText = createTextField(inner);
- if (file != null) fileText.setText(file);
- 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("ImportTargetSiteMainPage.Browse")); //$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());
- d.setFilterExtensions(new String[] {"*.tsf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$
- d.setFilterNames(new String[] {Policy.bind("ImportTargetSiteMainPage.Target_Site_Files"), Policy.bind("ImportTargetSiteMainPage.allFiles")}); //$NON-NLS-1$ //$NON-NLS-2$
- d.setFilterPath(new File(".").getAbsolutePath()); //$NON-NLS-1$
- String f = d.open();
- if (f != null) {
- fileText.setText(f);
- file = f;
- }
- }
- });
-
- setControl(composite);
- updateEnablement();
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java
deleted file mode 100644
index 511836e2f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/MappingSelectionPage.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.IRemoteTargetResource;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.UrlUtil;
-import org.eclipse.team.internal.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class MappingSelectionPage extends TargetWizardPage {
- private IPath path = Path.EMPTY;
- private Site site;
- private TreeViewer viewer;
- private Text textPath;
-
- public MappingSelectionPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- setDescription(Policy.bind("MappingSelectionPage.description")); //$NON-NLS-1$
- }
-
- public void setSite(Site site) {
- this.site = site;
- }
-
- public Site getSite() {
- return site;
- }
-
- public void createControl(Composite p) {
- Composite composite = createComposite(p, 1);
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.TARGET_MAPPING_SELECTION_PAGE);
-
- createLabel(composite, Policy.bind("MappingSelectionPage.label")); //$NON-NLS-1$
-
- viewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE);
-
- GridData data = new GridData (GridData.FILL_BOTH);
- viewer.getTree().setLayoutData(data);
- viewer.setContentProvider(new SiteLazyContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setSorter(new SiteViewSorter());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateTextPath();
- }
- });
-
- // include only folders in view
- viewer.addFilter(new ViewerFilter() {
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if(element instanceof RemoteResourceElement) {
- return ((RemoteResourceElement)element).getRemoteResource().isContainer();
- }
- return false;
- }
- });
-
- Button newFolderButton = new Button(composite, SWT.PUSH);
- newFolderButton.setText(Policy.bind("MappingSelectionPage.newFolderLabel")); //$NON-NLS-1$
- newFolderButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent (Event event) {
- Shell shell = getShell();
- try {
- // assume that only one folder is selected in the folder tree
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- Object currentSelection = selection.getFirstElement();
- final IRemoteTargetResource selectedFolder = getSelectedRemoteFolder(selection);
- String defaultName = ((ConfigureTargetWizard) getWizard()).project.getName();
-
- IRemoteTargetResource newFolder = CreateNewFolderAction.createDir(getShell(), selectedFolder, defaultName);
- if (newFolder == null)
- return;
-
- RemoteResourceElement newFolderUIElement = new RemoteResourceElement(newFolder);
-
- ((RemoteResourceElement)currentSelection).setCachedChildren(null);
- viewer.refresh(currentSelection);
- viewer.setExpandedState(currentSelection, true);
- viewer.setSelection(new StructuredSelection(newFolderUIElement));
- } catch (TeamException e) {
- TeamUIPlugin.handle(e);
- return;
- }
- }
- });
- setViewerInput();
- setControl(composite);
- setPageComplete(true);
- }
-
- private IRemoteTargetResource getSelectedRemoteFolder(IStructuredSelection selection) {
- if (!selection.isEmpty()) {
- final List filesSelection = new ArrayList();
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof RemoteResourceElement) {
- return ((RemoteResourceElement)o).getRemoteResource();
- } else if(o instanceof SiteElement) {
- try {
- return ((SiteElement)o).getSite().getRemoteResource();
- } catch (TeamException e) {
- return null;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Method updateTextPath.
- */
- private void updateTextPath() {
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if (!selection.isEmpty()) {
- final List filesSelection = new ArrayList();
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof RemoteResourceElement) {
- RemoteResourceElement element = (RemoteResourceElement) o;
- URL remoteResourceURL;
- remoteResourceURL = element.getRemoteResource().getURL();
- this.path = UrlUtil.getTrailingPath(
- remoteResourceURL,
- this.site.getURL());
- return;
- }
- }
- }
- }
-
- public IPath getMapping() {
- return this.path;
- }
-
- /**
- * Attempt to set the viewer input.
- * Do nothing if we don't have enough info yet to set it.
- */
- private void setViewerInput() {
- if(this.site == null || viewer == null)
- return;
- viewer.setInput(new SiteRootsElement(new Site[] {site}, getContainer()));
- }
-
- /**
- * @see IDialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- if(visible) {
- setViewerInput();
- viewer.setSelection(new StructuredSelection(new SiteElement(site)));
- }
- super.setVisible(visible);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java
deleted file mode 100644
index 94d5d6f41..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/ProjectTargetMappingPropertiesPage.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.wizard.WizardDialog;
-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.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.core.target.UrlUtil;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class ProjectTargetMappingPropertiesPage extends PropertyPage {
- public static final int WIDTH_HINT = 250;
-
- private IProject proj;
- private Site site = null;
- private IPath mapping;
- private TargetProvider origProvider=null;
-
- private Label serverText,folderText;
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- initialize();
- Composite container = new Composite(parent, SWT.NONE);
- container.setLayout(new GridLayout(2, false));
-
- Label serverLabel = new Label(container, SWT.NONE);
- serverLabel.setText(Policy.bind("ProjectTargetMappingPropertiesPage.URL")); //$NON-NLS-1$
- serverText = new Label(container, SWT.NONE);
- serverText.setText(site.getURL().toString());
- GridData data = new GridData();
- data.widthHint = WIDTH_HINT;
- serverText.setLayoutData(data);
-
- Label folderLabel = new Label(container, SWT.NONE);
- folderLabel.setText(Policy.bind("ProjectTargetMappingPropertiesPage.FolderName")); //$NON-NLS-1$
- folderText = new Label(container, SWT.NONE);
- folderText.setText(mapping.toString());
- data = new GridData();
- data.widthHint = WIDTH_HINT;
- folderText.setLayoutData(data);
-
- Button change = new Button(container, SWT.PUSH);
- change.setText(Policy.bind("ProjectTargetMappingPropertiesPage.ChangeBtn")); //$NON-NLS-1$
- change.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- ConfigureTargetWizard wizard = new ConfigureTargetWizard();
- wizard.init(null, proj);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.open();
- refreshInfo();
- }
- });
-
- return container;
- }
-
- private void initialize() {
- IAdaptable element = getElement();
- if (element instanceof IProject) {
- proj = ((IProject) element).getProject();
- } else {
- IProject adapter = (IProject) element.getAdapter(IProject.class);
- if (adapter != null) {
- proj = adapter.getProject();
- }
- }
- try {
- TargetProvider provider = TargetManager.getProvider(proj);
- if (origProvider==null) origProvider=provider;
- site = provider.getSite();
- mapping = UrlUtil.getTrailingPath(provider.getURL(), site.getURL());
- } catch (TeamException e) {
- ErrorDialog.openError(getShell(), Policy.bind("ProjectTargetMappingPropertiesPage.Error"), null, e.getStatus()); //$NON-NLS-1$
- }
- }
-
- private void refreshInfo() {
- initialize();
- serverText.setText(site.getURL().toString());
- folderText.setText(mapping.toString());
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- super.performDefaults();
- IPath oldMapping = UrlUtil.getTrailingPath(origProvider.getURL(), origProvider.getSite().getURL());
- try {
- TargetManager.unmap(proj);
- TargetManager.map(proj, origProvider.getSite(), oldMapping);
- } catch (TeamException e) {
- ErrorDialog.openError(getShell(), Policy.bind("ProjectTargetMappingPropertiesPage.Error"), null, e.getStatus()); //$NON-NLS-1$
- }
- refreshInfo();
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java
deleted file mode 100644
index 6b81f47b1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-/**
- * Action for checking in the selected resources
- */
-public class PutAction extends TargetAction {
- /*
- * Method declared on IActionDelegate.
- */
- public void run(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- Hashtable table = getTargetProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000);
- TargetProvider provider = (TargetProvider)iterator.next();
- monitor.setTaskName(Policy.bind("PutAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
-
- provider.put(providerResources, subMonitor);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("PutAction.title"), PROGRESS_DIALOG); //$NON-NLS-1$
- }
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- TargetProvider provider = TargetManager.getProvider(resource.getProject());
- if(provider == null)
- return false;
- if(! provider.canGet(resource))
- return false; //if one can't don't allow for any
- }
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java
deleted file mode 100644
index ab141e082..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/PutSyncAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class PutSyncAction extends TargetSyncAction {
-
- public PutSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(model, sp, label, shell);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SYNC_PUT_ACTION);
- }
-
- /**
- * @see TargetSyncAction#isEnabled(ITeamNode)
- */
- protected boolean isEnabled(ITeamNode node) {
- // Put action is enabled for any changed nodes.
- return new SyncSet(new StructuredSelection(node)).getChangedNodes().length > 0;
- }
-
- /**
- * @see TargetSyncAction#removeNonApplicableNodes(SyncSet, int)
- */
- protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- if (syncMode == SyncView.SYNC_OUTGOING) {
- set.removeIncomingNodes();
- }
- }
-
- /**
- * @see TargetSyncAction#run(SyncSet, IProgressMonitor)
- */
- protected SyncSet run(SyncSet syncSet, IProgressMonitor monitor) {
- try {
- ITeamNode[] changed = syncSet.getChangedNodes();
- if (changed.length == 0) {
- return syncSet;
- }
- List fileResources = new ArrayList();
- List folderDeletions = new ArrayList();
- List folderAdditions = new ArrayList();
- //Find the outgoing file changes the potential outgoing folder deletions:
- for (int i = 0; i < changed.length; i++) {
- if (changed[i].getChangeDirection()==ITeamNode.OUTGOING || changed[i].getChangeDirection()==ITeamNode.CONFLICTING) {
- if (changed[i].getResource().getType()==IResource.FILE) fileResources.add(changed[i].getResource());
- else if (changed[i].getChangeType()==Differencer.DELETION)
- folderDeletions.add(changed[i].getResource());
- else if (((IContainer)(changed[i].getResource())).members().length==0)
- ////If the new local folders have no children then we'd better explicitly create them remotely:
- folderAdditions.add(changed[i].getResource());
- }
- }
- put((IResource[])fileResources.toArray(new IResource[fileResources.size()]), monitor);
- if (folderAdditions.size()>0)
- put((IResource[])folderAdditions.toArray(new IResource[folderDeletions.size()]), monitor);
- if (folderDeletions.size()>0) {
- //Prune the list of potential outgoing folder deletions, retaining only those that don't have remote content:
- boolean delete;
- Iterator iter=folderDeletions.iterator();
- for (IContainer i=(IContainer)iter.next(); iter.hasNext(); i=(IContainer)iter.next()) {
- delete=true;
- IRemoteResource[] children=getRemoteResourceFor(i).members(monitor);
- for (int j = 0; j < children.length; j++) {
- if (!folderDeletions.contains(children[j])) {
- delete=false;
- break;
- }
- }
- if (!delete) iter.remove();
- }
- put((IResource[])folderDeletions.toArray(new IResource[folderDeletions.size()]), monitor);
- }
- } catch (final TeamException e) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- }
- });
- return null;
- } catch (final CoreException e) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(getShell(), null, null, e.getStatus());
- }
- });
- return null;
- }
- return syncSet;
- }
-
- /**
- * Put the given resources to their associated providers.
- *
- * @param resources the resources to commit
- * @param monitor the progress monitor
- */
- public void put(IResource[] resources, IProgressMonitor monitor) throws TeamException {
- monitor = Policy.monitorFor(monitor);
- try {
- Hashtable table = getTargetProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000);
- TargetProvider provider = (TargetProvider)iterator.next();
- monitor.setTaskName(Policy.bind("PutAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.put(providerResources, subMonitor);
- }
- } finally {
- monitor.done();
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java
deleted file mode 100644
index 890c43176..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/RemoteResourceElement.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.core.target.IRemoteTargetResource;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Used to show IRemoteTargetResource instances in the UI. In addition these elements
- * support caching of values returned from IRemoteTargetResource methods, as such these
- * instances aren't as much proxies as the underlying remote handles.
- * <p>
- * Implementation in progress: support for configuring these elements with a custom
- * progress monitor that can be the target of long running operations. This will
- * allow showing progress in wizards and in the SiteExplorerView when navigating
- * remote servers.</p>
- */
-public class RemoteResourceElement implements IWorkbenchAdapter, IAdaptable {
-
- // remote resource this element represents
- private IRemoteTargetResource remote;
-
- // cache for the remote values
- private IRemoteResource[] children = null;
- private int size = 0;
- private String lastModified = null;
-
- // context in which to perform long-running operations
- private IRunnableContext runContext;
-
- public RemoteResourceElement(IRemoteTargetResource remote) {
- this.remote = remote;
- }
-
- public RemoteResourceElement(IRemoteTargetResource remote, IRunnableContext runContext) {
- this(remote);
- this.runContext = runContext;
- }
-
- public IRemoteTargetResource getRemoteResource() {
- return remote;
- }
-
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
- public Object[] getChildren(Object o) {
- final Object[][] result = new Object[1][];
- try {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- // progress for fetching remote children is always unknown
- // let's not bother even trying to guess.
- monitor.beginTask(null, IProgressMonitor.UNKNOWN);
- if(children == null) {
- setCachedChildren(remote.members(Policy.subMonitorFor(monitor, 50)));
- }
- List remoteElements = new ArrayList();
- for (int i = 0; i < children.length; i++) {
- IRemoteTargetResource child = (IRemoteTargetResource)children[i];
- RemoteResourceElement element = new RemoteResourceElement(child, runContext);
-
- // cache size and last modified
- element.setLastModified(child.getLastModified(Policy.subMonitorFor(monitor, 25)));
- element.setSize(child.getSize(Policy.subMonitorFor(monitor, 25)));
- remoteElements.add(element);
- }
- result[0] = (RemoteResourceElement[])remoteElements.toArray(new RemoteResourceElement[remoteElements.size()]);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- };
-
- if(runContext == null) {
- TeamUIPlugin.runWithProgress(null, true /*cancelable*/, runnable);
- } else {
- runContext.run(true, true, runnable);
- }
- } catch (InterruptedException e) {
- return new Object[0];
- } catch (InvocationTargetException e) {
- TeamUIPlugin.handle(e.getTargetException());
- return new Object[0];
- }
- return result[0];
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- if(remote.isContainer()) {
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- } else {
- return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(remote.getName());
- }
- }
-
- public String getLabel(Object o) {
- // would be nice to display more than just the name (e.g. timestamp, size...)
- return remote.getName();
- }
-
- public Object getParent(Object o) {
- return null;
- }
-
- public int hashCode() {
- return getRemoteResource().hashCode();
- }
-
- public boolean equals(Object obj) {
- if(this == obj)
- return true;
- if(!(obj instanceof RemoteResourceElement))
- return false;
- return ((RemoteResourceElement)obj).getRemoteResource().equals(getRemoteResource());
- }
-
- public void clearChildren() {
- children = null;
- }
-
- public IRemoteResource[] getCachedChildren() {
- return children;
- }
-
- public void setCachedChildren(IRemoteResource[] children) {
- this.children = children;
- }
-
- protected void setRemoteResource(IRemoteTargetResource remote) {
- this.remote = remote;
- }
-
- public String getLastModified() {
- return lastModified;
- }
-
- public int getSize() {
- return size;
- }
-
- public void setLastModified(String lastModified) {
- this.lastModified = lastModified;
- }
-
- public void setSize(int size) {
- this.size = size;
- }
-
- public String getName() {
- return remote.getName();
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java
deleted file mode 100644
index f1f87551f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteElement.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.IRemoteTargetResource;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.UIConstants;
-import org.eclipse.team.ui.TeamImages;
-
-/**
- * Used to show Site instances in the UI. Sites are really just remote
- * resources but are shown with a different icon and label.
- *
- * @see RemoteResourceElement
- */
-public class SiteElement extends RemoteResourceElement {
- private Site site;
-
- public SiteElement(Site site) {
- super(null);
- this.site = site;
- }
-
- public SiteElement(Site site, IRunnableContext runContext) {
- super(null, runContext);
- this.site = site;
- }
-
- public Site getSite() {
- return site;
- }
-
- public int hashCode() {
- return site.hashCode();
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- return TeamImages.getImageDescriptor(UIConstants.IMG_SITE_ELEMENT);
- }
-
- public String getLabel(Object o) {
- return getSite().getDisplayName();
- }
-
- public Object getParent(Object o) {
- return null;
- }
-
- public boolean equals(Object obj) {
- if(this == obj)
- return true;
- if(!(obj instanceof SiteElement))
- return false;
- Site otherSite = ((SiteElement)obj).getSite();
- return getSite().equals(otherSite);
- }
- /**
- * @see IWorkbenchAdapter#getChildren(Object)
- */
- public Object[] getChildren(Object o) {
- try {
- setRemoteResource(site.getRemoteResource());
- } catch (TeamException e) {
- TeamUIPlugin.handle(e);
- return new Object[0];
- }
- return super.getChildren(this);
- }
- /**
- * @see RemoteResourceElement#getRemoteResource()
- */
- public IRemoteTargetResource getRemoteResource() {
- try {
- return site.getRemoteResource();
- } catch (TeamException e) {
- TeamUIPlugin.handle(e);
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java
deleted file mode 100644
index 92693ec2c..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerView.java
+++ /dev/null
@@ -1,562 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.IRemoteTargetResource;
-import org.eclipse.team.internal.core.target.ISiteListener;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.UIConstants;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * Is a view that allows browsing remote target sites. It is modeled after
- * a file explorer: a tree of folders is show with a table of the folder's
- * contents.
- * <p>
- * Progress is shown in the main workbench window's status line progress
- * monitor.</p>
- *
- * @see Site
- * @see IRemoteTargetResource
- */
-public class SiteExplorerView extends ViewPart implements ISiteListener {
-
- public static final String VIEW_ID = "org.eclipse.team.ui.target.SiteExplorerView"; //$NON-NLS-1$
-
- // The tree viewer showing the folders and sites
- private TreeViewer folderTree;
-
- // The table view that shows the resources in the currently selected folder
- // from the folders tree.
- private TableViewer folderContentsTable;
-
- // The root
- private SiteRootsElement root;
-
- // Embedded progress monitor part used to display progress when contacting the server
- // Note: this feature is not enabled yet and is still under construction
- private IProgressMonitor progressMonitorPart;
-
- // The view's actions
- private Action addSiteAction;
- private Action newFolderAction;
- private PropertyDialogAction propertiesAction;
-
- /**
- * Sorter for the folderContents table
- */
- class FolderListingSorter extends ViewerSorter {
- private boolean reversed = false;
- private int columnNumber;
-
- public static final int NAME = 0;
- public static final int SIZE = 1;
- public static final int MODIFIED = 2;
-
- // column headings: "Name" "Size" "Modified"
- private int[][] SORT_ORDERS_BY_COLUMN = {
- {NAME}, /* name */
- {SIZE, NAME}, /* size */
- {MODIFIED, NAME, SIZE}, /* modified */
- };
-
- public FolderListingSorter(int columnNumber) {
- this.columnNumber = columnNumber;
- }
-
- public int compare(Viewer viewer, Object o1, Object o2) {
- RemoteResourceElement e1 = (RemoteResourceElement)o1;
- RemoteResourceElement e2 = (RemoteResourceElement)o2;
- int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
- int result = 0;
- for (int i = 0; i < columnSortOrder.length; ++i) {
- result = compareColumnValue(columnSortOrder[i], e1, e2);
- if (result != 0)
- break;
- }
- if (reversed)
- result = -result;
- return result;
- }
-
- int compareColumnValue(int columnNumber, RemoteResourceElement e1, RemoteResourceElement e2) {
- IRemoteTargetResource r1 = e1.getRemoteResource();
- IRemoteTargetResource r2 = e2.getRemoteResource();
- switch (columnNumber) {
- case NAME:
- if (r1.isContainer() && r2.isContainer())
- return compareNames(r1, r2);
- else if (r1.isContainer())
- return -1;
- else if (r2.isContainer())
- return 1;
- return compareNames(r1, r2);
- case SIZE:
- return new Integer(e1.getSize()).compareTo(new Integer(e2.getSize()));
- case MODIFIED:
- return getCollator().compare(e1.getLastModified(), e2.getLastModified());
- default:
- return 0;
- }
- }
-
- protected int compareNames(IRemoteTargetResource resource1, IRemoteTargetResource resource2) {
- return resource1.getName().compareTo(resource2.getName());
- }
-
- /**
- * Returns the number of the column by which this is sorting.
- */
- public int getColumnNumber() {
- return columnNumber;
- }
-
- /**
- * Returns true for descending, or false
- * for ascending sorting order.
- */
- public boolean isReversed() {
- return reversed;
- }
-
- /**
- * Sets the sorting order.
- */
- public void setReversed(boolean newReversed) {
- reversed = newReversed;
- }
- }
-
- /**
- * @see IWorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite top) {
- Composite p = new Composite(top, SWT.NULL);
- GridData data = new GridData (GridData.FILL_BOTH);
- p.setLayoutData(data);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- p.setLayout (gridLayout);
-
- SashForm sash = new SashForm(p, SWT.HORIZONTAL);
- data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = 3;
- sash.setLayoutData(data);
-
- folderTree = new TreeViewer(sash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- folderTree.setContentProvider(new SiteLazyContentProvider());
- folderTree.setLabelProvider(new WorkbenchLabelProvider());
-
- folderTree.setSorter(new SiteViewSorter());
- folderTree.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (event.keyCode == SWT.F5) {
- RemoteResourceElement[] selectedFolders = getSelectedRemoteFolder((IStructuredSelection)folderTree.getSelection());
- if(selectedFolders.length == 1) {
- selectedFolders[0].setCachedChildren(null);
- folderTree.refresh(selectedFolders[0]);
- updateFileTable(selectedFolders[0]);
- }
- }
- }
- });
-
- folderTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection();
- final RemoteResourceElement[] remoteFolders = getSelectedRemoteFolder(selection);
- if(remoteFolders.length == 1) {
- updateFileTable(remoteFolders[0]);
- }
- }
- });
-
- folderTree.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent e) {
- IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection();
- if(selection.size() == 1) {
- expandInTreeCurrentSelection(selection, true /*toggle expanded*/);
- }
- }
- });
-
- folderTree.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- String name1 = ""; //$NON-NLS-1$
- String name2 = ""; //$NON-NLS-1$
- if(e1 instanceof RemoteResourceElement) {
- name1 = ((RemoteResourceElement)e1).getRemoteResource().getName();
- } else if(e1 instanceof SiteElement) {
- name1 = ((SiteElement)e1).getSite().getURL().toExternalForm();
- }
- if(e2 instanceof RemoteResourceElement) {
- name2 = ((RemoteResourceElement)e2).getRemoteResource().getName();
- } else if(e2 instanceof SiteElement) {
- name2 = ((SiteElement)e2).getSite().getURL().toExternalForm();
- }
-
- return getCollator().compare(name1, name2);
- }
- });
-
- // show only folders in tree
- folderTree.addFilter(new ViewerFilter() {
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if(element instanceof RemoteResourceElement) {
- return ((RemoteResourceElement)element).getRemoteResource().isContainer();
- }
- return false;
- }
- });
-
- Table table = new Table(sash, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
-
- TableColumn tableColumn = new TableColumn(table, SWT.NULL);
- tableColumn.setText(Policy.bind("SiteExplorerView.Name_1")); //$NON-NLS-1$
- tableColumn.addSelectionListener(getColumnListener());
- layout.addColumnData(new ColumnWeightData(30, true));
-
- tableColumn = new TableColumn(table, SWT.NULL);
- tableColumn.setText(Policy.bind("SiteExplorerView.Size_2")); //$NON-NLS-1$
- tableColumn.setAlignment(SWT.RIGHT);
- tableColumn.addSelectionListener(getColumnListener());
- layout.addColumnData(new ColumnWeightData(10, true));
-
- tableColumn = new TableColumn(table, SWT.NULL);
- tableColumn.setText(Policy.bind("SiteExplorerView.Modified_3")); //$NON-NLS-1$
- tableColumn.addSelectionListener(getColumnListener());
- layout.addColumnData(new ColumnWeightData(30, true));
-
- tableColumn = new TableColumn(table, SWT.NULL);
- tableColumn.setText(Policy.bind("SiteExplorerView.URL_4")); //$NON-NLS-1$
- layout.addColumnData(new ColumnWeightData(30, true));
-
- folderContentsTable = new TableViewer(table);
- folderContentsTable.setContentProvider(new SiteLazyContentProvider());
- folderContentsTable.setLabelProvider(new SiteExplorerViewLabelProvider());
-
- folderContentsTable.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- if (event.keyCode == SWT.F5) {
- RemoteResourceElement folder = (RemoteResourceElement)folderContentsTable.getInput();
- if(folder != null) {
- folder.setCachedChildren(null);
- folderContentsTable.refresh();
- }
- }
- }
- });
-
- folderContentsTable.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent e) {
- IStructuredSelection selection = (IStructuredSelection)folderContentsTable.getSelection();
- if(selection.size() == 1) {
- final RemoteResourceElement[] remoteFolders = getSelectedRemoteFolder(selection);
- if(remoteFolders.length == 1) {
- IStructuredSelection treeSelection = (IStructuredSelection)folderTree.getSelection();
- expandInTreeCurrentSelection(treeSelection, false /*don't toggle*/);
- folderTree.setSelection(new StructuredSelection(remoteFolders[0]));
- }
- }
- }
- });
- FolderListingSorter sorter = new FolderListingSorter(FolderListingSorter.NAME);
- sorter.setReversed(false);
- folderContentsTable.setSorter(sorter);
-
- sash.setWeights(new int[] {33, 67});
-
- TargetManager.addSiteListener(this);
-
- root = new SiteRootsElement(getViewSite().getWorkbenchWindow());
- initalizeActions();
- folderTree.setInput(root);
-
- // F1 Help
- WorkbenchHelp.setHelp(folderTree.getControl(), IHelpContextIds.SITE_EXPLORER_VIEW);
- }
-
- private Shell getShell() {
- return folderTree.getTree().getShell();
- }
-
- private RemoteResourceElement[] getSelectedRemoteFolder(IStructuredSelection selection) {
- if (!selection.isEmpty()) {
- final List folders = new ArrayList();
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object o = it.next();
- if(o instanceof RemoteResourceElement) {
- folders.add(o);
- }
- }
- return (RemoteResourceElement[]) folders.toArray(new RemoteResourceElement[folders.size()]);
- }
- return new RemoteResourceElement[0];
- }
-
- private void expandInTreeCurrentSelection(IStructuredSelection selection, boolean toggle) {
- if (!selection.isEmpty()) {
- Iterator it = selection.iterator();
- while(it.hasNext()) {
- Object element = it.next();
- if(toggle) {
- folderTree.setExpandedState(element, !folderTree.getExpandedState(element));
- } else {
- folderTree.setExpandedState(element, true);
- }
- }
- }
- }
-
- /**
- * Method updateFileTable.
- */
- private void updateFileTable(RemoteResourceElement remoteFolder) {
- if(remoteFolder != null && !remoteFolder.equals(folderContentsTable.getInput())) {
- folderContentsTable.setInput(remoteFolder);
- }
- }
-
- private void initalizeActions() {
- final Shell shell = folderContentsTable.getTable().getShell();
- // Create actions
-
- // Refresh (toolbar)
- addSiteAction = new Action(Policy.bind("SiteExplorerView.addSiteAction"), TeamImages.getImageDescriptor(UIConstants.IMG_SITE_ELEMENT)) { //$NON-NLS-1$
- public void run() {
- ConfigureTargetWizard wizard = new ConfigureTargetWizard();
- wizard.init(null, null);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.open();
- }
- };
- addSiteAction.setToolTipText(Policy.bind("SiteExplorerView.addSiteActionTooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(addSiteAction, IHelpContextIds.ADD_SITE_ACTION);
-
- newFolderAction = new Action(Policy.bind("SiteExplorerView.newFolderAction"), WorkbenchImages.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_OBJ_FOLDER)) { //$NON-NLS-1$
- public void run() {
- final Shell shell = folderTree.getTree().getShell();
- try {
- // assume that only one folder is selected in the folder tree, this
- // is enforced by isEnable() method for this action
- IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection();
- Object currentSelection = selection.getFirstElement();
-
- RemoteResourceElement selectedFolder;
- if(!selection.isEmpty()) {
- selectedFolder = getSelectedRemoteFolder(selection)[0];
- } else {
- selectedFolder = (RemoteResourceElement)folderContentsTable.getInput();
- }
-
- IRemoteTargetResource newFolder = CreateNewFolderAction.createDir(shell, selectedFolder.getRemoteResource(), Policy.bind("CreateNewFolderAction.newFolderName")); //$NON-NLS-1$
- if (newFolder == null)
- return;
-
- // force a refresh
- selectedFolder.setCachedChildren(null);
-
- // select the newly added folder
- RemoteResourceElement newFolderUIElement = new RemoteResourceElement(newFolder);
- folderTree.refresh(currentSelection);
- expandInTreeCurrentSelection(new StructuredSelection(currentSelection), false);
- folderTree.setSelection(new StructuredSelection(newFolderUIElement));
- } catch (TeamException e) {
- TeamUIPlugin.handle(e);
- return;
- }
- }
- public boolean isEnabled() {
- return folderContentsTable.getInput() != null ||
- getSelectedRemoteFolder((IStructuredSelection)folderTree.getSelection()).length == 1;
- }
- };
- WorkbenchHelp.setHelp(newFolderAction, IHelpContextIds.NEW_FOLDER_ACTION);
-
- IActionBars bars = getViewSite().getActionBars();
- IToolBarManager tbm = bars.getToolBarManager();
- tbm.add(addSiteAction);
- tbm.update(false);
-
- // Properties
- propertiesAction = new PropertyDialogAction(shell, folderTree);
- getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PROPERTIES, propertiesAction);
- IStructuredSelection selection = (IStructuredSelection)folderTree.getSelection();
- if (selection.size() == 1 && selection.getFirstElement() instanceof SiteElement) {
- propertiesAction.setEnabled(true);
- } else {
- propertiesAction.setEnabled(false);
- }
- folderTree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection ss = (IStructuredSelection)event.getSelection();
- boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof SiteElement;
- propertiesAction.setEnabled(enabled);
- }
- });
-
- MenuManager treeMgr = new MenuManager();
- MenuManager tableMgr = new MenuManager();
- Tree tree = folderTree.getTree();
- Table table = folderContentsTable.getTable();
- Menu treeMenu = treeMgr.createContextMenu(tree);
- Menu tableMenu = tableMgr.createContextMenu(table);
- IMenuListener menuListener = new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- // Misc additions
- MenuManager sub = new MenuManager(Policy.bind("SiteExplorerView.newMenu"), IWorkbenchActionConstants.GROUP_ADD); //$NON-NLS-1$
- sub.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- manager.add(sub);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- sub.add(addSiteAction);
- sub.add(newFolderAction);
- manager.add(propertiesAction);
- }
- };
- treeMgr.addMenuListener(menuListener);
- treeMgr.setRemoveAllWhenShown(true);
- tableMgr.addMenuListener(menuListener);
- tableMgr.setRemoveAllWhenShown(true);
- tree.setMenu(treeMenu);
- table.setMenu(tableMenu);
- getSite().registerContextMenu(tableMgr, folderContentsTable);
- getSite().registerContextMenu(treeMgr, folderTree);
- }
-
- /**
- * Add the new site to the viewer and make it the current selection.
- *
- * @see ISiteListener#siteAdded(Site)
- */
- public void siteAdded(Site site) {
- SiteElement element = new SiteElement(site, getViewSite().getWorkbenchWindow());
- folderTree.add(root, element);
- folderTree.setSelection(new StructuredSelection(element));
- }
-
- /**
- * Remote the site from the viewer and select the next site in the
- * tree.
- *
- * @see ISiteListener#siteRemoved(Site)
- */
- public void siteRemoved(Site site) {
- folderTree.remove(new SiteElement(site));
- selectNextObjectInTreeViewer();
- }
-
- private void selectNextObjectInTreeViewer() {
- Object[] items = folderTree.getVisibleExpandedElements();
- if(items.length > 0) {
- folderTree.setSelection(new StructuredSelection(items[0]));
- } else {
- folderContentsTable.setInput(null);
- }
- }
-
- /**
- * Adds the listener that sets the sorter.
- */
- private SelectionListener getColumnListener() {
- /**
- * This class handles selections of the column headers.
- * Selection of the column header will cause resorting
- * of the shown tasks using that column's sorter.
- * Repeated selection of the header will toggle
- * sorting order (ascending versus descending).
- */
- return new SelectionAdapter() {
- /**
- * Handles the case of user selecting the
- * header area.
- * <p>If the column has not been selected previously,
- * it will set the sorter of that column to be
- * the current tasklist sorter. Repeated
- * presses on the same column header will
- * toggle sorting order (ascending/descending).
- */
- public void widgetSelected(SelectionEvent e) {
- // column selected - need to sort
- // only allow sorting on name for now
- int column = folderContentsTable.getTable().indexOf((TableColumn) e.widget);
- if(column == FolderListingSorter.NAME) {
- FolderListingSorter oldSorter = (FolderListingSorter)folderContentsTable.getSorter();
- if (oldSorter != null && column == oldSorter.getColumnNumber()) {
- oldSorter.setReversed(!oldSorter.isReversed());
- folderContentsTable.refresh();
- } else {
- folderContentsTable.setSorter(new FolderListingSorter(column));
- }
- }
- }
- };
- }
-
- /**
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- }
- /**
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- super.dispose();
- TargetManager.removeSiteListener(this);
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java
deleted file mode 100644
index a0f2e0ef9..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteExplorerViewLabelProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class SiteExplorerViewLabelProvider extends WorkbenchLabelProvider implements ITableLabelProvider {
-
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- return super.getImage(element);
- }
- return null;
- }
- public String getColumnText(Object element, int columnIndex) {
- switch (columnIndex) {
- case 0 :
- return super.getText(element);
- case 1 :
- if(element instanceof RemoteResourceElement) {
- RemoteResourceElement remote = ((RemoteResourceElement)element);
- if(remote.getRemoteResource().isContainer()) {
- return ""; //$NON-NLS-1$
- }
- int size = remote.getSize();
- int sizeKb = size / 1000;
- if(sizeKb == 0 && size % 1000 > 0) {
- sizeKb = 1;
- }
- return Policy.bind("SiteExplorerViewLabelProvider.fileSize", new Integer(sizeKb).toString()); //$NON-NLS-1$
- }
- case 2 :
- if(element instanceof RemoteResourceElement) {
- return ((RemoteResourceElement)element).getLastModified();
- }
- case 3 :
- if(element instanceof RemoteResourceElement) {
- return ((RemoteResourceElement)element).getRemoteResource().getURL().toExternalForm();
- }
- }
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java
deleted file mode 100644
index 0bdf305f0..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteLazyContentProvider.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-public class SiteLazyContentProvider extends WorkbenchContentProvider {
-
- public boolean hasChildren(Object element) {
- if (element == null) {
- return false;
- }
- // the + box will always appear, but then disappear
- // if not needed after you first click on it.
- return true; // just always return true to avoid going to server
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java
deleted file mode 100644
index d7022f3a4..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteRootsElement.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Used to show all Sites defined in the workbench.
- */
-public class SiteRootsElement implements IWorkbenchAdapter, IAdaptable {
- private Site[] sites = null;
-
- // progress monitoring support
- private IRunnableContext runContext;
-
- public SiteRootsElement(Site[] sites, IRunnableContext runContext) {
- this.sites = sites;
- this.runContext = runContext;
- }
-
- public SiteRootsElement(IRunnableContext runContext) {
- this(null, runContext);
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
-
- public Object[] getChildren(Object o) {
- Site[] childSites;
- if(sites == null) {
- childSites = TargetManager.getSites();
- } else {
- childSites = sites;
- }
- SiteElement[] siteElements = new SiteElement[childSites.length];
- for (int i = 0; i < childSites.length; i++) {
- siteElements[i] = new SiteElement(childSites[i], runContext);
- }
- return siteElements;
- }
-
- public String getLabel(Object o) {
- return null;
- }
-
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
- }
-
- public Object getParent(Object o) {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java
deleted file mode 100644
index 6e4681c4a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteSelectionPage.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.core.target.UrlUtil;
-import org.eclipse.team.internal.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * Wizard page that allows selecting an existing target provider site
- * or to create a new site.
- */
-public class SiteSelectionPage extends TargetWizardPage {
- private TableViewer table;
- private Button useExistingRepo;
- private Button useNewRepo;
- private Button disconnectTarget;
- private Site site;
- private TargetProvider currentProvider;
-
- private boolean disconnect = false;
-
- public SiteSelectionPage(String pageName, String title, ImageDescriptor titleImage, TargetProvider currentProvider) {
- super(pageName, title, titleImage);
- setDescription(Policy.bind("SiteSelectionPage.description")); //$NON-NLS-1$
- this.currentProvider = currentProvider;
- }
-
- protected TableViewer createTable(Composite parent) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
- table.setLayoutData(new GridData(GridData.FILL_BOTH));
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(100, true));
- table.setLayout(layout);
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setResizable(true);
-
- return new TableViewer(table);
- }
-
- public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 2);
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.TARGET_NEW_SITE_PAGE);
-
- Label description = new Label(composite, SWT.WRAP);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.widthHint = 350;
- description.setLayoutData(data);
- description.setText(Policy.bind("SiteSelectionPage.label")); //$NON-NLS-1$
-
- useExistingRepo = createRadioButton(composite, Policy.bind("SiteSelectionPage.useExisting"), 2); //$NON-NLS-1$
- table = createTable(composite);
- table.setContentProvider(new WorkbenchContentProvider());
- table.setLabelProvider(new WorkbenchLabelProvider() {
- protected String decorateText(String input, Object element) {
- if(currentProvider != null && element.equals(new SiteElement(currentProvider.getSite()))) {
- IPath mapping = UrlUtil.getTrailingPath(currentProvider.getURL(), currentProvider.getSite().getURL());
- if(mapping.isEmpty()) {
- return Policy.bind("SiteSelectionPage.siteLabelCurrent", super.decorateText(input, element)); //$NON-NLS-1$
- } else {
- return Policy.bind("SiteSelectionPage.siteLabelCurrentWithMapping", super.decorateText(input, element), mapping.toString()); //$NON-NLS-1$
- }
- }
- return super.decorateText(input, element);
- }
- });
-
- table.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- SiteElement siteElement = (SiteElement)((IStructuredSelection)table.getSelection()).getFirstElement();
- if(siteElement != null) {
- site = siteElement.getSite();
- setPageComplete(true);
- } else {
- setPageComplete(false);
- }
- }
- });
- useNewRepo = createRadioButton(composite, Policy.bind("SiteSelectionPage.createNew"), 2); //$NON-NLS-1$
-
- useExistingRepo.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- if (!useExistingRepo.getSelection()) {
- table.getTable().setEnabled(false);
- site = null;
- } else {
- table.getTable().setEnabled(true);
- SiteElement siteElement = (SiteElement)((IStructuredSelection)table.getSelection()).getFirstElement();
- if(siteElement != null) {
- site = siteElement.getSite();
- }
- }
- }
- });
-
- useNewRepo.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- SiteSelectionPage.this.setPageComplete(! useNewRepo.getSelection());
- }
- });
-
-
- if(currentProvider != null ) {
- disconnectTarget = createRadioButton(composite, Policy.bind("SiteSelectionPage.disconnectTarget"), 2); //$NON-NLS-1$
- disconnectTarget.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- disconnect = disconnectTarget.getSelection();
- SiteSelectionPage.this.setPageComplete(true);
- }
- });
- }
-
- setControl(composite);
- initializeValues();
- }
-
- /**
- * Initializes states of the controls.
- */
- private void initializeValues() {
- Site[] sites = TargetManager.getSites();
- table.setInput(new SiteRootsElement(null /* no progress monitoring required */));
- if (sites.length == 0) {
- useNewRepo.setSelection(true);
- } else {
- useExistingRepo.setSelection(true);
- if(currentProvider != null) {
- table.setSelection(new StructuredSelection(new SiteElement(currentProvider.getSite())));
- } else {
- table.setSelection(new StructuredSelection(new SiteElement(sites[0])));
- }
- }
- }
-
- public Site getSite() {
- return site;
- }
-
- public boolean isDisconnect() {
- return disconnect;
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage()
- */
- public boolean canFlipToNextPage() {
- if(isDisconnect()) {
- return false;
- } else {
- return true;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java
deleted file mode 100644
index c0e12ee71..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SiteViewSorter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.net.URL;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.team.internal.core.target.Site;
-
-public class SiteViewSorter extends ViewerSorter {
-
- public int category(Object element) {
- if (element instanceof Site) {
- return ((Site)element).getType().hashCode();
- }
- return 0;
- }
-
- public int compare(Viewer viewer, Object o1, Object o2) {
- int cat1 = category(o1);
- int cat2 = category(o2);
- if (cat1 != cat2) return cat1 - cat2;
-
- if (o1 instanceof Site && o2 instanceof Site) {
- URL site1 = ((Site)o1).getURL();
- URL site2 = ((Site)o2).getURL();
- return site1.toExternalForm().compareTo(site2.toExternalForm());
- }
- return super.compare(viewer, o1, o2);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java
deleted file mode 100644
index e4be4c143..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/SyncAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.sync.SyncCompareInput;
-import org.eclipse.team.internal.ui.sync.SyncView;
-
-/**
- * Action for catchup/release in popup menus.
- */
-public class SyncAction extends TeamAction {
-
- public void run(IAction action) {
- IResource[] resources = getSelectedResources();
- SyncView view = SyncView.findViewInActivePage(getTargetPage());
- if (view != null) {
- view.showSync(getCompareInput(resources), getTargetPage());
- }
- }
-
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- if (!resource.isAccessible()) return false;
- TargetProvider provider = TargetManager.getProvider(resource.getProject());
- if(provider == null) return false;
- }
- return true;
- }
-
- protected SyncCompareInput getCompareInput(IResource[] resources) {
- return new TargetSyncCompareInput(resources, IRemoteSyncElement.GRANULARITY_TIMESTAMP);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java
deleted file mode 100644
index b51073f49..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetAction.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.target.IRemoteTargetResource;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-public abstract class TargetAction extends TeamAction {
- /**
- * Get selected remote target folders
- */
- protected IRemoteTargetResource[] getSelectedRemoteFolders() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- IRemoteTargetResource remote = null;
- if (next instanceof RemoteResourceElement) {
- remote = ((RemoteResourceElement)next).getRemoteResource();
- } else if(next instanceof SiteElement) {
- try {
- remote = ((SiteElement)next).getSite().getRemoteResource();
- } catch (TeamException e) {
- TeamUIPlugin.handle(e);
- return new IRemoteTargetResource[0];
- }
- }
- if(remote != null && remote.isContainer()) {
- resources.add(remote);
- continue;
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- return (IRemoteTargetResource[])resources.toArray(new IRemoteTargetResource[resources.size()]);
- }
- return new IRemoteTargetResource[0];
- }
-
- /**
- * Get selected remote target folders
- */
- protected Site[] getSelectedSites() {
- ArrayList sites = new ArrayList();;
- if (!selection.isEmpty()) {
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- IRemoteTargetResource remote = null;
- if (next instanceof SiteElement) {
- sites.add(((SiteElement)next).getSite());
- }
- }
- }
- return (Site[])sites.toArray(new Site[sites.size()]);
- }
-
- protected IResource[] findResourcesWithOutgoingChanges(IResource[] resources) throws TeamException, CoreException {
- // Collect the dirty resource
- final List dirtyResources = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- final TargetProvider provider = TargetManager.getProvider(resource.getProject());
- resource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) {
- if (provider.isDirty(resource) || ! provider.hasBase(resource)) {
- dirtyResources.add(resource);
- }
- } else {
- // Check for outgoing folder deletions?
- }
- return true;
- }
- }, IResource.DEPTH_INFINITE, true /* include phantoms */);
- }
- return (IResource[]) dirtyResources.toArray(new IResource[dirtyResources.size()]);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java
deleted file mode 100644
index a2770d958..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetCatchupReleaseViewer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ui.IHelpContextIds;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.ui.help.WorkbenchHelp;
-public class TargetCatchupReleaseViewer extends CatchupReleaseViewer {
- private GetSyncAction getAction;
- private PutSyncAction putAction;
-
- public TargetCatchupReleaseViewer(Composite parent, TargetSyncCompareInput input) {
- super(parent, input);
- initializeActions(input);
- // set F1 help
- WorkbenchHelp.setHelp(this.getControl(), IHelpContextIds.TARGET_CATCHUP_RELEASE_VIEWER);
- }
-
- /**
- * Creates the actions for this viewer.
- */
- private void initializeActions(final TargetSyncCompareInput diffModel) {
- Shell shell = getControl().getShell();
- getAction = new GetSyncAction(diffModel, this, Policy.bind("TargetCatchupReleaseViewer.Get_1"), shell); //$NON-NLS-1$
- putAction = new PutSyncAction(diffModel, this, Policy.bind("TargetCatchupReleaseViewer.Put_2"), shell); //$NON-NLS-1$
- }
- protected void fillContextMenu(IMenuManager manager) {
- super.fillContextMenu(manager);
- manager.add(new Separator());
- switch (getSyncMode()) {
- case SyncView.SYNC_INCOMING:
- getAction.update(SyncView.SYNC_INCOMING);
- manager.add(getAction);
- break;
- case SyncView.SYNC_OUTGOING:
- putAction.update(SyncView.SYNC_INCOMING);
- manager.add(putAction);
- break;
- case SyncView.SYNC_BOTH:
- getAction.update(SyncView.SYNC_INCOMING);
- manager.add(getAction);
- putAction.update(SyncView.SYNC_INCOMING);
- manager.add(putAction);
- break;
- }
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java
deleted file mode 100644
index 1e3c15bba..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetProjectAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-public class TargetProjectAction extends TeamAction {
- /*
- * Method declared on IActionDelegate.
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- IProject project = getSelectedProjects()[0];
- ConfigureTargetWizard wizard = new ConfigureTargetWizard();
- wizard.init(null, project);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.open();
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- }
- }
- }, Policy.bind("ConfigureTargetAction.configureProject"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() {
- IProject[] selectedProjects = getSelectedProjects();
- if (selectedProjects.length != 1) return false;
- if (!selectedProjects[0].isAccessible()) return false;
-/* try {
- if (TargetManager.getProvider(selectedProjects[0]) == null) return true;
- } catch (TeamException e) {
- TeamPlugin.log(IStatus.ERROR, "Exception getting provider", e);
- return false;
- }
- return false;
-*/
- return true;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java
deleted file mode 100644
index 9212c6776..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteContentHandler.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class TargetSiteContentHandler extends DefaultHandler implements ContentHandler {
- private StringBuffer buffer;
- private List propList;
- private String target;
-
- /**
- * Constructor for TargetSiteContentHandler.
- */
- public TargetSiteContentHandler() {
- super();
- propList=new LinkedList();
- }
-
- /**
- * @see org.xml.sax.ContentHandler#characters(char[], int, int)
- */
- public void characters(char[] ch, int start, int length) throws SAXException {
- if (buffer!=null)
- buffer.append(ch, start, length);
- }
-
- /**
- * @see org.xml.sax.ContentHandler#endElement(String, String, String)
- */
- public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
- if (qName.equals("site")) { //$NON-NLS-1$
- Properties props=new Properties();
- byte[] bytes=buffer.toString().getBytes();
- InputStream iStream=new ByteArrayInputStream(bytes);
- try {
- props.load(iStream);
- props.setProperty("target", target); //$NON-NLS-1$
- propList.add(props);
- } catch (IOException e) {
- //TODO: log an error.
- }
- }
- }
-
- /**
- * Retrieve the property list that has been built up.
- * @return Properties[]
- */
- Properties[] getProperties() {
- return (Properties[]) propList.toArray(new Properties[propList.size()]);
- }
-
- /**
- * @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes)
- */
- public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
- if (qName.equals("site")) { //$NON-NLS-1$
- buffer = new StringBuffer();
- target=atts.getValue("target"); //$NON-NLS-1$
- }
- }
-
- /**
- * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
- */
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
- ;
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java
deleted file mode 100644
index e550b3df1..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteExportWizard.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-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.team.core.TeamException;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.ProjectSetImportWizard;
-import org.eclipse.team.internal.ui.UIConstants;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * This wizard allows the user to save the settings used by Target sites to a file.
- */
-public class TargetSiteExportWizard extends Wizard implements IExportWizard {
- private ExportTargetSiteMainPage mainPage;
- private IStructuredSelection selection;
- /**
- * Constructor for TargetSiteExportWizard.
- */
- public TargetSiteExportWizard() {
- setNeedsProgressMonitor(true);
- setWindowTitle(Policy.bind("TargetSiteExportWizard.Target_Site")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- final boolean[] result = new boolean[] { false };
- try {
- getContainer().run(false, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- String filename = mainPage.getFileName();
- Path path = new Path(filename);
- if (path.getFileExtension() == null) {
- filename = filename + ".tsf"; //$NON-NLS-1$
- }
- ProjectSetImportWizard.lastFile = filename;
- File file = new File(filename);
- File parentFile = file.getParentFile();
- if (parentFile != null && !parentFile.exists()) {
- boolean r = MessageDialog.openQuestion(
- getShell(),
- Policy.bind("TargetSiteExportWizard.Creation_Question"), //$NON-NLS-1$
- Policy.bind("TargetSiteExportWizard.Create_dir")); //$NON-NLS-1$
- if (!r) {
- result[0] = false;
- return;
- }
- r = parentFile.mkdirs();
- if (!r) {
- MessageDialog.openError(getShell(),
- Policy.bind("TargetSiteExportWizard.Export_Problems"), //$NON-NLS-1$
- Policy.bind("TargetSiteExportWizard.Directory_creation_error") //$NON-NLS-1$
- );
- result[0] = false;
- return;
- }
- }
- if (file.exists() && file.isFile()) {
- boolean r = MessageDialog.openQuestion(
- getShell(),
- Policy.bind("TargetSiteExportWizard.Overwrite_Question"), //$NON-NLS-1$
- Policy.bind("TargetSiteExportWizard.Overwrite_file") //$NON-NLS-1$
- );
- if (!r) {
- result[0] = false;
- return;
- }
- }
- BufferedWriter writer = null;
- try {
- OutputStream jout = new FileOutputStream(file);
-
- writer = new BufferedWriter(new OutputStreamWriter(jout, "UTF-8")); //$NON-NLS-1$
- writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$
- writer.newLine();
- writer.write("<tsf version=\"2.0\">"); //$NON-NLS-1$
- writer.newLine();
- writer.flush();
-
- Site[] sites = mainPage.getSelectedSites();
- Properties props;
- monitor.beginTask(null, 5 * sites.length);
- String target;
-
- //The 1st one needs to have a unique comment since it only requires an opening tag:
- props = sites[0].getConfiguration();
- monitor.worked(2);
- target=sites[0].getType();
- monitor.worked(1);
- props.store(jout, "<site target=\""+target+"\">"); //$NON-NLS-1$ //$NON-NLS-2$
- monitor.worked(2);
-
- // For each additional site, write the config to disk:
- for (int i = 1; i < sites.length; i++) {
- props = sites[i].getConfiguration();
- monitor.worked(2);
- target=sites[i].getType();
- monitor.worked(1);
- props.store(jout, "</site> <site target=\""+target+"\">"); //$NON-NLS-1$ //$NON-NLS-2$
- monitor.worked(2);
- }
- jout.flush();//This line may not actually be needed but it's not doing any harm either.
-
- writer.write("</site>"); //$NON-NLS-1$
- writer.newLine();
- writer.write("</tsf>"); //$NON-NLS-1$
- writer.newLine();
- result[0] = true;
- } catch (IOException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- if (writer != null) {
- try {
- writer.close();
- } catch (IOException 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];
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.selection = selection;
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#addPages()
- */
- public void addPages() {
- mainPage = new ExportTargetSiteMainPage("targetSiteMainPage", //$NON-NLS-1$
- Policy.bind("TargetSiteExportWizard.Export_a_Target_Site"), //$NON-NLS-1$
- TeamImages.getImageDescriptor(UIConstants.IMG_PROJECTSET_EXPORT_BANNER) //TODO: We need our own banner...
- );
- Site[] sites = (Site[]) selection.toList().toArray(new Site[0]);
- mainPage.setSelectedSites(sites);
- mainPage.setFileName(ProjectSetImportWizard.lastFile);
- addPage(mainPage);
- }
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java
deleted file mode 100644
index 1ea086e35..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSiteImportWizard.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-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.TeamException;
-import org.eclipse.team.internal.core.Assert;
-import org.eclipse.team.internal.core.target.ISiteFactory;
-import org.eclipse.team.internal.core.target.Site;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.UIConstants;
-import org.eclipse.team.ui.TeamImages;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-public class TargetSiteImportWizard extends Wizard implements IImportWizard {
- public static String lastFile;
-
- private ImportTargetSiteMainPage mainPage;
-
- /**
- * Retrieves the Site object that the TargetProvider is contained in.
- * @return Site
- */
- Site getSite(Properties properties) {
- try {
- URL url = new URL(properties.getProperty("location")); //$NON-NLS-1$
- return TargetManager.getSite(properties.getProperty("target"), url); //$NON-NLS-1$
- } catch (MalformedURLException e) {
- return null;
- }
- }
-
- public TargetSiteImportWizard() {
- setNeedsProgressMonitor(true);
- setWindowTitle(Policy.bind("TargetSiteImportWizard.Target_Site")); //$NON-NLS-1$
- }
-
- public void addPages() {
- mainPage = new ImportTargetSiteMainPage(
- "targetSiteMainPage", //$NON-NLS-1$
- Policy.bind("TargetSiteImportWizard.Import_Target_Site"), //$NON-NLS-1$
- TeamImages.getImageDescriptor(UIConstants.IMG_PROJECTSET_IMPORT_BANNER)
- );
- mainPage.setFileName(lastFile);
- addPage(mainPage);
- }
-
- /**
- * @see org.eclipse.jface.wizard.IWizard#performFinish()
- */
- public boolean performFinish() {
- try {
- getContainer().run(true, true, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- InputStreamReader reader = null;
- try {
- String filename = mainPage.getFileName();
- lastFile = filename;
- reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$
-
- SAXParserFactory factory = SAXParserFactory.newInstance();
- SAXParser parser;
- parser = factory.newSAXParser();
- TargetSiteContentHandler handler = new TargetSiteContentHandler();
- InputSource source = new InputSource(reader);
- parser.parse(source, handler);
-
- Properties[] propList = handler.getProperties();
- for (int i = 0; i < propList.length; i++) {
- String target = propList[i].getProperty("target"); //$NON-NLS-1$
- ISiteFactory siteFactory = TargetManager.getSiteFactory(target);
- Assert.isNotNull(siteFactory);
-
- final Site newsite = siteFactory.newSite(propList[i]);
- Site[] existingSites = TargetManager.getSites();
- boolean dupe = false;
- for (int j = 0; j < existingSites.length; j++) {
- if (existingSites[j].equals(newsite))
- dupe = true;
- }
- if (!dupe) {
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- TargetManager.addSite(newsite);
- }
- });
- }
- }
-
- } catch (IOException e) {
- throw new InvocationTargetException(e);
- } catch (ParserConfigurationException e) {
- throw new InvocationTargetException(e);
- } catch (SAXException e) {
- throw new InvocationTargetException(e);
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException 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 true;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchWizard#init(IWorkbench, IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {}
-
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java
deleted file mode 100644
index 4c8094e1a..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncAction.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.team.internal.ui.sync.ChangedTeamContainer;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.UnchangedTeamContainer;
-
-public abstract class TargetSyncAction extends Action {
- private TargetSyncCompareInput diffModel;
- private ISelectionProvider selectionProvider;
-
- protected int syncMode;
- private Shell shell;
-
- protected static IRemoteResource getRemoteResourceFor(IResource local) throws TeamException {
- return TargetManager.getProvider(local.getProject()).getRemoteResourceFor(local);
- }
-
- /**
- * Creates a TargetSyncAction which works on selection and doesn't commit changes.
- */
- public TargetSyncAction(TargetSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
- super(label);
- this.diffModel = model;
- this.selectionProvider = sp;
- this.shell = shell;
- }
-
- protected Shell getShell() {
- return shell;
- }
-
- protected TargetSyncCompareInput getDiffModel() {
- return diffModel;
- }
-
- /**
- * Returns true if at least one node can perform the specified action.
- */
- private boolean isEnabled(Object[] nodes) {
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i] instanceof ITeamNode) {
- ITeamNode node = (ITeamNode)nodes[i];
- if (isEnabled(node)) {
- return true;
- }
- } else {
- if (nodes[i] instanceof IDiffContainer)
- if (isEnabled(((IDiffContainer)nodes[i]).getChildren()))
- return true;
- }
- }
- return false;
- }
-
- protected abstract boolean isEnabled(ITeamNode node);
-
- /**
- * Perform the sychronization operation.
- */
- public void run() {
- ISelection s = selectionProvider.getSelection();
- if (!(s instanceof IStructuredSelection) || s.isEmpty()) {
- return;
- }
- final SyncSet set = new SyncSet((IStructuredSelection)s);
- removeNonApplicableNodes(set, syncMode);
- final SyncSet[] result = new SyncSet[1];
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- result[0] = TargetSyncAction.this.run(set, monitor);
- }
- };
- try {
- run(op, Policy.bind("TargetSyncAction.errorEncountered")); //$NON-NLS-1$
- } catch (InterruptedException e) {
- }
- if (result[0] != null) {
- // all returned nodes that have a changed sync kind are assumed
- // to have been operated on and will be removed from the diff tree.
- removeNodes(result[0].getChangedNodes());
-
- // any node that claims that it's IN_SYNC will be automatically
- // filtered from the diff tree - see DiffElement.setKind().
- diffModel.updateView();
- }
- }
-
- protected abstract void removeNonApplicableNodes(SyncSet set, int syncMode);
-
- /**
- * The given nodes have been synchronized. Remove them from
- * the sync set.
- *
- * For folders that are outgoing deletions, we may need to leave the
- * folder as is or adjust the sync kind depending on the sync kind of
- * the folder's children.
- *
- * @see CVSSyncCompareInput#collectResourceChanges(IDiffContainer, IRemoteSyncElement, IProgressMonitor)
- */
- private void removeNodes(final ITeamNode[] nodes) {
- // Update the model
- Set outgoingFolderDeletions = new HashSet();
- for (int i = 0; i < nodes.length; i++) {
- if (nodes[i].getClass() == UnchangedTeamContainer.class) {
- // Unchanged containers get removed automatically when all
- // children are removed
- continue;
- }
- if (nodes[i].getClass() == ChangedTeamContainer.class) {
- // If this node still has children, convert to an
- // unchanged container, then it will disappear when
- // all children have been removed.
- ChangedTeamContainer container = (ChangedTeamContainer)nodes[i];
- IDiffElement[] children = container.getChildren();
- if (children.length > 0) {
- IDiffContainer parent = container.getParent();
- UnchangedTeamContainer unchanged = new UnchangedTeamContainer(parent, container.getResource());
- for (int j = 0; j < children.length; j++) {
- unchanged.add(children[j]);
- }
- parent.removeToRoot(container);
- continue;
- }
- // No children, it will get removed below.
- }
- nodes[i].getParent().removeToRoot(nodes[i]);
- }
- }
-
- /**
- * Updates the action with the latest selection, setting enablement
- * as necessary.
- */
- public void update(int syncMode) {
- this.syncMode = syncMode;
- IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();
- setEnabled(isEnabled(selection.toArray()));
- }
-
- /**
- * Subclasses must implement this method, which performs action-specific code.
- *
- * It may return the sync set which was passed in, or null.
- */
- protected abstract SyncSet run(SyncSet syncSet, IProgressMonitor monitor);
-
- /**
- * Helper method to run a runnable in a progress monitor dialog, and display any errors.
- */
- protected void run(IRunnableWithProgress op, String problemMessage) throws InterruptedException {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
- try {
- dialog.run(true, true, op);
- } catch (InvocationTargetException e) {
- Throwable throwable = e.getTargetException();
- IStatus error = null;
- if (throwable instanceof CoreException) {
- error = ((CoreException)throwable).getStatus();
- } else {
- error = new Status(IStatus.ERROR, TeamUIPlugin.ID, 1, Policy.bind("simpleInternal") , throwable); //$NON-NLS-1$
- }
- ErrorDialog.openError(shell, problemMessage, error.getMessage(), error);
- TeamUIPlugin.log(error);
- }
- }
-
- /**
- * Helper method. Check if a save is necessary. If it is, prompt the user to save.
- * Return true if all necessary saves have been performed, false otherwise.
- */
- protected boolean saveIfNecessary() {
- return getDiffModel().saveIfNecessary();
- }
-
- /**
- * Convenience method that maps the given resources to their target providers.
- * The returned Hashtable has keys which are TargetProviders, and values
- * which are Lists of IResources that are shared with that provider.
- *
- * @return a hashtable mapping providers to their resources
- */
- protected Hashtable getTargetProviderMapping(IResource[] resources) throws TeamException {
- Hashtable result = new Hashtable();
- for (int i = 0; i < resources.length; i++) {
- TargetProvider provider = TargetManager.getProvider(resources[i].getProject());
- List list = (List)result.get(provider);
- if (list == null) {
- list = new ArrayList();
- result.put(provider, list);
- }
- list.add(resources[i]);
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java
deleted file mode 100644
index 55b00b9d5..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetSyncCompareInput.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.core.target.ITargetRunnable;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.sync.CatchupReleaseViewer;
-import org.eclipse.team.internal.ui.sync.SyncCompareInput;
-
-public class TargetSyncCompareInput extends SyncCompareInput {
-
- private IResource[] resources;
-
- protected TargetSyncCompareInput(IResource[] resources, int granularity) {
- super(granularity);
- this.resources = resources;
- }
-
- /**
- * @see SyncCompareInput#createSyncElements(IProgressMonitor)
- */
- protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
- monitor = Policy.monitorFor(monitor);
- try {
- monitor.beginTask(null, resources.length);
- IRemoteSyncElement[] elements = new IRemoteSyncElement[resources.length];
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- TargetProvider provider = TargetManager.getProvider(resource.getProject());
- elements[i] = provider.getRemoteSyncElement(resource);
- monitor.worked(1);
- }
- return elements;
- } finally {
- monitor.done();
- }
- }
-
- /**
- * @see CompareEditorInput#createDiffViewer(Composite)
- */
- public Viewer createDiffViewer(Composite parent) {
- CatchupReleaseViewer viewer = new TargetCatchupReleaseViewer(parent, this);
- setViewer(viewer);
- return viewer;
- }
-
- protected void updateView() {
- // Update the view
- if (getDiffRoot().hasChildren()) {
- getViewer().refresh();
- } else {
- getViewer().setInput(null);
- }
-
- // Update the status line
- updateStatusLine();
- }
-
- /**
- * @see SyncCompareInput#collectResourceChanges(IDiffContainer, IRemoteSyncElement, IProgressMonitor)
- */
- protected IDiffElement collectResourceChanges(
- final IDiffContainer parent,
- final IRemoteSyncElement tree,
- IProgressMonitor pm) throws TeamException {
-
- final IDiffElement[] result = new IDiffElement[] {null};
- TargetProvider provider = TargetManager.getProvider(tree.getLocal().getProject());
- provider.run(new ITargetRunnable() {
- public void run(IProgressMonitor monitor) throws TeamException {
- result[0] = TargetSyncCompareInput.super.collectResourceChanges(parent, tree, monitor);
- }
- }, pm);
- return result[0];
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java
deleted file mode 100644
index 3ee584f3f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/TargetWizardPage.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-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.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/*
- * Common superclass for wizard pages. Provides convenience methods
- * for widget creation.
- */
-public abstract class TargetWizardPage extends WizardPage {
-
- private static final int COMBO_HISTORY_LENGTH = 5;
-
- /*
- * WizardPage constructor comment.
- * @param pageName the name of the page
- */
- public TargetWizardPage(String pageName) {
- super(pageName);
- }
-
- /*
- * WizardPage constructor comment.
- * @param pageName the name of the page
- * @param title the title of the page
- * @param titleImage the image for the page
- */
- public TargetWizardPage(String pageName, String title, org.eclipse.jface.resource.ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- protected Button createRadioButton(Composite parent, String label, int span) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = span;
- button.setLayoutData(data);
- return button;
- }
-
- /*
- * Creates a new checkbox instance and sets the default layout data.
- *
- * @param group the composite in which to create the checkbox
- * @param label the string to set into the checkbox
- * @return the new checkbox
- */
- protected Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- button.setLayoutData(data);
- return button;
- }
-
- /*
- * Utility method that creates a combo box
- *
- * @param parent the parent for the new label
- * @return the new widget
- */
- protected Combo createCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- combo.setLayoutData(data);
- return combo;
- }
-
- /*
- * 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) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 1;
- data.horizontalAlignment = GridData.FILL;
- 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;
- }
-
- /*
- * Adds an entry to a history, while taking care of duplicate history items
- * and excessively long histories. The assumption is made that all histories
- * should be of length <code>ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- * @return the history with the new entry appended
- */
- protected String[] addToHistory(String[] history, String newEntry) {
- ArrayList l = new ArrayList(Arrays.asList(history));
- addToHistory(l, newEntry);
- String[] r = new String[l.size()];
- l.toArray(r);
- return r;
- }
-
- /*
- * Adds an entry to a history, while taking care of duplicate history items
- * and excessively long histories. The assumption is made that all histories
- * should be of length <code>ConfigurationWizardMainPage.COMBO_HISTORY_LENGTH</code>.
- *
- * @param history the current history
- * @param newEntry the entry to add to the history
- */
- protected void addToHistory(List history, String newEntry) {
- history.remove(newEntry);
- history.add(0,newEntry);
-
- // since only one new item was added, we can be over the limit
- // by at most one item
- if (history.size() > COMBO_HISTORY_LENGTH)
- history.remove(COMBO_HISTORY_LENGTH);
- }
-
- /*
- * Utility method to create an editable combo box
- *
- * @param parent the parent of the combo box
- * @return the created combo
- */
- protected Combo createEditableCombo(Composite parent) {
- Combo combo = new Combo(parent, SWT.NULL);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
- combo.setLayoutData(data);
- return combo;
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java
deleted file mode 100644
index a8becb796..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/target/UploadAction.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ui.target;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.core.InfiniteSubProgressMonitor;
-import org.eclipse.team.internal.core.target.TargetManager;
-import org.eclipse.team.internal.core.target.TargetProvider;
-import org.eclipse.team.internal.ui.IPromptCondition;
-import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.PromptingDialog;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-public class UploadAction extends TargetAction {
-
- /**
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IResource[] resources = getSelectedResources();
- if (resources.length == 0) return false;
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- TargetProvider provider = TargetManager.getProvider(resource.getProject());
- if(provider == null)
- return false;
- if(! provider.canPut(resource))
- return false; //if one can't don't allow for any
- // Don't want to go though the resources deeply to see if there are dirty children
- }
- return true;
- }
-
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- Hashtable table = getTargetProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- boolean hasOutgoing = false;
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1024);
- final TargetProvider provider = (TargetProvider)iterator.next();
- subMonitor.setTaskName(Policy.bind("UploadAction.working", provider.getURL().toExternalForm())); //$NON-NLS-1$
-
- IResource[] providerResources = (IResource[])((List)table.get(provider)).toArray(new IResource[0]);
- IResource[] outgoingChanges = findResourcesWithOutgoingChanges(providerResources);
- if (outgoingChanges.length > 0) {
- // Prompt for any outgoing deletions
- PromptingDialog prompt = new PromptingDialog(
- getShell(),
- outgoingChanges,
- new IPromptCondition() {
- public boolean needsPrompt(IResource resource) {
- return ! resource.exists();
- }
- public String promptMessage(IResource resource) {
- return Policy.bind("UploadAction.confirmFileDeletionMessage", resource.getFullPath().toString()); //$NON-NLS-1$
- }
- },
- Policy.bind("UploadAction.confirmDeletionTitle"));//$NON-NLS-1$
-
- // Put the resources that were selected
- hasOutgoing = true;
- provider.put(prompt.promptForMultiple(), subMonitor);
- }
- }
- if (!hasOutgoing) {
- getShell().getDisplay().syncExec(
- new Runnable() {
- public void run() {
- MessageDialog.openInformation(getShell(),
- Policy.bind("UploadAction.noDirtyTitle"), //$NON-NLS-1$
- Policy.bind("UploadAction.noDirtyMessage")); //$NON-NLS-1$
- }
- });
- };
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, Policy.bind("UploadAction.problemMessage"), PROGRESS_DIALOG); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java
deleted file mode 100644
index 4f218794f..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui;
-
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * IConfigurationWizard defines the interface that users of the extension
- * point org.eclipse.team.ui.configurationWizards must implement.
- */
-public interface IConfigurationWizard extends IWizard {
- /**
- * Initializes this creation wizard using the passed workbench and
- * object selection.
- * <p>
- * This method is called after the no argument constructor and
- * before other methods are called.
- * </p>
- *
- * @param workbench the current workbench
- * @param project the selected project
- */
- void init(IWorkbench workbench, IProject project);
-}
-
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java
deleted file mode 100644
index ebab3832e..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui;
-
-
-
-/**
- * Images that are available for providers to re-use. They include
- * common overlays and wizard images. A provider can use their own
- * custom images, these shared images are only available for
- * convenience.
- */
-public interface ISharedImages {
- public final String IMG_DIRTY_OVR = "ovr/dirty_ov.gif"; //$NON-NLS-1$
- public final String IMG_CHECKEDIN_OVR = "ovr/version_controlled.gif"; //$NON-NLS-1$
- public final String IMG_CHECKEDOUT_OVR = "ovr/checkedout_ov.gif"; //$NON-NLS-1$
-}
-
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java
deleted file mode 100644
index 75afb107d..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamImages.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.UIConstants;
-
-/**
- * TeamImages provides convenience methods for accessing shared images
- * provided by the org.eclipse.team.ui plug-in.
- */
-public class TeamImages {
- private static Hashtable imageDescriptors = new Hashtable(20);
-
- static {
- initializeImages();
- }
- /**
- * Creates an image and places it in the image registry.
- *
- * @param id the identifier for the image
- * @param baseURL the base URL for the image
- */
- protected static void createImageDescriptor(String id, URL baseURL) {
- URL url = null;
- try {
- url = new URL(baseURL, UIConstants.ICON_PATH + id);
- } catch (MalformedURLException e) {
- }
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- imageDescriptors.put(id, desc);
- }
- /**
- * Returns the image descriptor for the given image ID.
- * Returns null if there is no such image.
- *
- * @param id the identifier for the image to retrieve
- * @return the image associated with the given ID
- */
- public static ImageDescriptor getImageDescriptor(String id) {
- return (ImageDescriptor)imageDescriptors.get(id);
- }
- /**
- * Convenience method to get an image descriptor for an extension
- *
- * @param extension the extension declaring the image
- * @param subdirectoryAndFilename the path to the image
- * @return the image
- */
- public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) {
- IPluginDescriptor pluginDescriptor = extension.getDeclaringPluginDescriptor();
- URL path = pluginDescriptor.getInstallURL();
- URL fullPathString = null;
- try {
- fullPathString = new URL(path,subdirectoryAndFilename);
- return ImageDescriptor.createFromURL(fullPathString);
- } catch (MalformedURLException e) {
- }
- return null;
- }
- /**
- * Initializes the table of images used in this plugin.
- */
- private static void initializeImages() {
- URL baseURL = TeamUIPlugin.getPlugin().getDescriptor().getInstallURL();
-
- // View decoration overlays
- createImageDescriptor(ISharedImages.IMG_DIRTY_OVR, baseURL);
- createImageDescriptor(ISharedImages.IMG_CHECKEDIN_OVR, baseURL);
- createImageDescriptor(ISharedImages.IMG_CHECKEDOUT_OVR, baseURL);
-
- // Target Management Icons
- createImageDescriptor(UIConstants.IMG_SITE_ELEMENT, baseURL);
-
- // Sync View Icons
- createImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING, baseURL);
- createImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING, baseURL);
- createImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING, baseURL);
- createImageDescriptor(UIConstants.IMG_REFRESH, baseURL);
- createImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE, baseURL);
- createImageDescriptor(UIConstants.IMG_CONTENTS, baseURL);
-
- createImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING_DISABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING_DISABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING_DISABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_REFRESH_DISABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE_DISABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_CONTENTS_DISABLED, baseURL);
-
- createImageDescriptor(UIConstants.IMG_DLG_SYNC_INCOMING_ENABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_DLG_SYNC_OUTGOING_ENABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_DLG_SYNC_CONFLICTING_ENABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_REFRESH_ENABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_IGNORE_WHITESPACE_ENABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_CONTENTS_ENABLED, baseURL);
-
- createImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP, baseURL);
- createImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE, baseURL);
- createImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE, baseURL);
-
- createImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP_DISABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE_DISABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE_DISABLED, baseURL);
-
- createImageDescriptor(UIConstants.IMG_SYNC_MODE_CATCHUP_ENABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_SYNC_MODE_RELEASE_ENABLED, baseURL);
- createImageDescriptor(UIConstants.IMG_SYNC_MODE_FREE_ENABLED, baseURL);
-
- createImageDescriptor(UIConstants.IMG_WIZBAN_SHARE, baseURL);
-
- // Wizard banners
- createImageDescriptor(UIConstants.IMG_PROJECTSET_IMPORT_BANNER, baseURL);
- createImageDescriptor(UIConstants.IMG_PROJECTSET_EXPORT_BANNER, baseURL);
-
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java
deleted file mode 100644
index 160b048dc..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.ui;
-
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-
-/**
- * TeamUI contains public API for generic UI-based Team functionality
- */
-public class TeamUI {
- // property change types
- public static String GLOBAL_IGNORES_CHANGED = "global_ignores_changed"; //$NON-NLS-1$
-
- /**
- * Register for changes made to Team properties.
- *
- * @param listener the listener to add
- */
- public static void addPropertyChangeListener(IPropertyChangeListener listener) {
- TeamUIPlugin.addPropertyChangeListener(listener);
- }
-
- /**
- * Deregister as a Team property changes.
- *
- * @param listener the listener to remove
- */
- public static void removePropertyChangeListener(IPropertyChangeListener listener) {
- TeamUIPlugin.removePropertyChangeListener(listener);
- }
-}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html
deleted file mode 100644
index 110a89283..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/package.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Application programming interface for associating a repository provider with a project.
-<h2>
-Package Specification</h2>
-This package specifies the API for providing a configuration wizard that will
-associate and configure a particular repository provider with a project in the
-local workspace.
-</body>
-</html> \ No newline at end of file

Back to the top