Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2011-01-12 15:05:23 +0000
committerTomasz Zarna2011-01-12 15:05:23 +0000
commitf205fdc1510fda699e4accdebf8579c8aca40319 (patch)
tree38e27c1994c2458ed97a3f3e8f8e9b63269320e6
parentefdedbd6b3ab9c3b9fdfc0390b6a694ddc2deba9 (diff)
downloadeclipse.platform.team-f205fdc1510fda699e4accdebf8579c8aca40319.tar.gz
eclipse.platform.team-f205fdc1510fda699e4accdebf8579c8aca40319.tar.xz
eclipse.platform.team-f205fdc1510fda699e4accdebf8579c8aca40319.zip
bug 330490: API and UI to configure SCM URLs for import - Fix v01
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSScmUrlImportWizardPage.java262
-rw-r--r--bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.team.ui/plugin.properties1
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml1
-rw-r--r--bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd112
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IScmUrlImportWizardPage.java50
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/TeamUI.java51
11 files changed, 499 insertions, 5 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index b1407773b..70e6db432 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -2057,6 +2057,13 @@
<keywordReference id="org.eclipse.team.cvs.ui.cvs.annotate"/>
</page>
</extension>
+ <extension
+ point="org.eclipse.team.ui.scmUrlImportPages">
+ <scmUrlImportPage
+ page="org.eclipse.team.internal.ccvs.ui.wizards.CVSScmUrlImportWizardPage"
+ repository="org.eclipse.team.cvs.core.cvsnature">
+ </scmUrlImportPage>
+ </extension>
<!-- Commented out awaiting menu support from UI
<extension
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
index dee1c2540..7d36a5879 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1187,5 +1187,11 @@ public class CVSUIMessages extends NLS {
public static String ClipboardDiffOperation_Clipboard;
public static String CVSAction_doNotShowThisAgain;
+ public static String CVSScmUrlImportWizardPage_0;
+ public static String CVSScmUrlImportWizardPage_1;
+ public static String CVSScmUrlImportWizardPage_2;
+ public static String CVSScmUrlImportWizardPage_3;
+ public static String CVSScmUrlImportWizardPage_4;
+
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
index 486344efd..1002ace04 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -79,6 +79,8 @@ public interface IHelpContextIds {
public static final String COMMIT_FILE_TYPES_PAGE = PREFIX + "commit_file_types_page_context"; //$NON-NLS-1$
public static final String COMMIT_COMMENT_PAGE = PREFIX + "commit_comment_page_context"; //$NON-NLS-1$
+ public static final String CVS_SCM_URL_IMPORT_PAGE = PREFIX + "cvs_scm_url_import_page"; //$NON-NLS-1$
+
// Preference Pages
public static final String PREF_DEBUG_PROTOCOL = PREFIX + "debug_protocol_pref"; //$NON-NLS-1$
public static final String PREF_PRUNE = PREFIX + "prune_empty_directories_pref"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index dbcf8986e..29647fa1e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -1209,3 +1209,9 @@ RemoveRootAction_RepositoryRemovalDialogMessageSingle=Are you sure you want to d
RemoveRootAction_RepositoryRemovalDialogMessageMultiple=Are you sure you want to discard these {0} repositories?
AddAction_confirmAddingResourcesTitle=Confirm adding resources to Version Control
AddAction_confirmAddingResourcesMessage=Are you sure you want to add selected resources to the version control?
+
+CVSScmUrlImportWizardPage_0=Import Projects from CVS
+CVSScmUrlImportWizardPage_1=Import CVS projects corresponding to plug-ins and fragments in the file system.
+CVSScmUrlImportWizardPage_2=Import from &HEAD
+CVSScmUrlImportWizardPage_3=Import specific &version(s) shown below
+CVSScmUrlImportWizardPage_4=Total: {0}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSScmUrlImportWizardPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSScmUrlImportWizardPage.java
new file mode 100644
index 000000000..24cacd067
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CVSScmUrlImportWizardPage.java
@@ -0,0 +1,262 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.wizards;
+
+import java.net.URI;
+
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.team.internal.ccvs.core.filesystem.CVSURI;
+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
+import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
+import org.eclipse.team.internal.ui.SWTUtils;
+import org.eclipse.team.ui.IScmUrlImportWizardPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+public class CVSScmUrlImportWizardPage extends WizardPage implements IScmUrlImportWizardPage {
+
+ private URI[] scmUris;
+ private Button useHead;
+ private TableViewer bundlesViewer;
+ private Label counterLabel;
+
+ private static final String CVS_PAGE_USE_HEAD = "org.eclipse.team.cvs.ui.import.page.head"; //$NON-NLS-1$
+
+ class CvsLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element) {
+ return PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ return getStyledText(element).getString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.StyledCellLabelProvider#update(org.eclipse.jface.viewers.ViewerCell)
+ */
+ public void update(ViewerCell cell) {
+ StyledString string = getStyledText(cell.getElement());
+ cell.setText(string.getString());
+ cell.setStyleRanges(string.getStyleRanges());
+ cell.setImage(getImage(cell.getElement()));
+ super.update(cell);
+ }
+
+ private StyledString getStyledText(Object element) {
+ StyledString styledString = new StyledString();
+ if (element instanceof URI) {
+ URI scmUrl = (URI) element;
+ String project = getProject(scmUrl);
+ String version = getTag(scmUrl);
+ String host = getServer(scmUrl);
+ styledString.append(project);
+ if (version != null && !useHead.getSelection()) {
+ styledString.append(' ');
+ styledString.append(version, StyledString.DECORATIONS_STYLER);
+ }
+ styledString.append(' ');
+ styledString.append('[', StyledString.DECORATIONS_STYLER);
+ styledString.append(host, StyledString.DECORATIONS_STYLER);
+ styledString.append(']', StyledString.DECORATIONS_STYLER);
+ return styledString;
+ }
+ styledString.append(element.toString());
+ return styledString;
+ }
+ }
+
+ /**
+ * Constructs the page.
+ */
+ public CVSScmUrlImportWizardPage() {
+ super("cvs", CVSUIMessages.CVSScmUrlImportWizardPage_0, null); //$NON-NLS-1$
+ setDescription(CVSUIMessages.CVSScmUrlImportWizardPage_1);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite comp = SWTUtils.createHVFillComposite(parent, SWTUtils.MARGINS_NONE, 1);
+ Composite group = SWTUtils.createHFillComposite(comp, SWTUtils.MARGINS_NONE, 1);
+
+ Button versions = SWTUtils.createRadioButton(group, CVSUIMessages.CVSScmUrlImportWizardPage_3);
+ useHead = SWTUtils.createRadioButton(group, CVSUIMessages.CVSScmUrlImportWizardPage_2);
+ SelectionListener listener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ bundlesViewer.refresh(true);
+ }
+ };
+ versions.addSelectionListener(listener);
+ useHead.addSelectionListener(listener);
+
+ Table table = new Table(comp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 200;
+ gd.widthHint = 225;
+ table.setLayoutData(gd);
+
+ bundlesViewer = new TableViewer(table);
+ bundlesViewer.setLabelProvider(new CvsLabelProvider());
+ bundlesViewer.setContentProvider(new ArrayContentProvider());
+ bundlesViewer.setComparator(new ViewerComparator());
+ counterLabel = new Label(comp, SWT.NONE);
+ counterLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ setControl(comp);
+ setPageComplete(true);
+
+ // initialize versions versus HEAD
+ IDialogSettings settings = getWizard().getDialogSettings();
+ boolean head = false;
+ boolean found = false;
+ if (settings != null) {
+ String string = settings.get(CVS_PAGE_USE_HEAD);
+ if (string != null) {
+ found = true;
+ head = settings.getBoolean(CVS_PAGE_USE_HEAD);
+ }
+ }
+
+ if (!found) {
+ for (int i = 0; i < scmUris.length; i++) {
+ URI scmUrl = scmUris[i];
+ if (getTag(scmUrl) != null) {
+ head = false;
+ break;
+ }
+ }
+ }
+ useHead.setSelection(head);
+ versions.setSelection(!head);
+
+ if (scmUris != null) {
+ bundlesViewer.setInput(scmUris);
+ updateCount();
+ }
+
+ // TODO:
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.CVS_SCM_URL_IMPORT_PAGE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.IScmUrlImportWizardPage#finish()
+ */
+ public boolean finish() {
+ boolean head = false;
+ if (getControl() != null) {
+ head = useHead.getSelection();
+ // store settings
+ IDialogSettings settings = getWizard().getDialogSettings();
+ if (settings != null) {
+ settings.put(CVS_PAGE_USE_HEAD, head);
+ }
+ } else {
+ // use whatever was used last time
+ IDialogSettings settings = getWizard().getDialogSettings();
+ if (settings != null) {
+ head = settings.getBoolean(CVS_PAGE_USE_HEAD);
+ }
+ }
+
+ if (head) {
+ // modify tags on bundle import descriptions
+ for (int i = 0; i < scmUris.length; i++) {
+ URI scmUri = scmUris[i];
+ scmUris[i] = removeTag(scmUri);
+ }
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.IScmUrlImportWizardPage#getSelection()
+ */
+ public URI[] getSelection() {
+ return scmUris;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.IScmUrlImportWizardPage#getSelection()
+ */
+ public void setSelection(URI[] scmUris) {
+ this.scmUris = scmUris;
+ // fill viewer
+ if (bundlesViewer != null) {
+ bundlesViewer.setInput(scmUris);
+ updateCount();
+ }
+ }
+
+ /**
+ * Updates the count of bundles that will be imported
+ */
+ private void updateCount() {
+ counterLabel.setText(NLS.bind(CVSUIMessages.CVSScmUrlImportWizardPage_4, new Integer(scmUris.length)));
+ counterLabel.getParent().layout();
+ }
+
+ private static String getProject(URI scmUri) {
+ // TODO: remove once bug 332732 is fixed
+ CVSURI cvsUri = CVSURI.fromUri(scmUri);
+ if (cvsUri.getProjectName() == null)
+ return cvsUri.getPath().lastSegment();
+ return cvsUri.getProjectName();
+ }
+
+ private static String getTag(URI scmUri) {
+ return CVSURI.fromUri(scmUri).getTag().getName();
+ }
+
+ private static URI removeTag(URI scmUri) {
+ // TODO: move to CVSURI
+ StringBuffer sb = new StringBuffer();
+ sb.append(scmUri.getScheme()).append(':');
+ String ssp = scmUri.getSchemeSpecificPart();
+ int j = ssp.indexOf(';');
+ if (j != -1) {
+ sb.append(ssp.substring(0, j));
+ String[] params = ssp.substring(j).split(";"); //$NON-NLS-1$
+ for (int k = 0; k < params.length; k++) {
+ // PDE way of providing tags
+ if (params[k].startsWith("tag=")) { //$NON-NLS-1$
+ // remove
+ } else if (params[k].startsWith("version=")) { //$NON-NLS-1$
+ // remove
+ } else {
+ sb.append(params[k]);
+ }
+ }
+ } else {
+ sb.append(ssp);
+ }
+ return URI.create(sb.toString());
+ }
+
+ private static String getServer(URI scmUri) {
+ return CVSURI.fromUri(scmUri).getRepository().getHost();
+ }
+
+}
diff --git a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF
index 6da90f51e..c2ea2e96b 100644
--- a/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.team.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.team.ui; singleton:=true
-Bundle-Version: 3.5.200.qualifier
+Bundle-Version: 3.6.100.qualifier
Bundle-Activator: org.eclipse.team.internal.ui.TeamUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.team.ui/plugin.properties b/bundles/org.eclipse.team.ui/plugin.properties
index 0b8476ba3..fc7136ae5 100644
--- a/bundles/org.eclipse.team.ui/plugin.properties
+++ b/bundles/org.eclipse.team.ui/plugin.properties
@@ -15,6 +15,7 @@ Team=Team
configurationWizards=Configuration Wizards
synchronizeParticipants=Synchronize Participants
synchronizeWizards=Synchronize Wizards
+scmUrlImportPages=SCM URLs Import Pages
logicalViews=Logical Synchronize Views
PreferenceKeywords.Team=team apply patch synchronize compare
diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml
index efd2a8e28..f5b450718 100644
--- a/bundles/org.eclipse.team.ui/plugin.xml
+++ b/bundles/org.eclipse.team.ui/plugin.xml
@@ -7,6 +7,7 @@
<extension-point id="synchronizeWizards" name="%synchronizeWizards" schema="schema/synchronizeWizards.exsd"/>
<extension-point id="teamContentProviders" name="%TeamContentProvider" schema="schema/teamContentProviders.exsd"/>
<extension-point id="teamDecorators" name="%TeamDecorators" schema="schema/teamDecorators.exsd"/>
+ <extension-point id="scmUrlImportPages" name="%scmUrlImportPages" schema="schema/scmUrlImportPages.exsd"/>
<!-- **************** PREFERENCES ******************* -->
<extension
diff --git a/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd b/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd
new file mode 100644
index 000000000..ca8377baa
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/schema/scmUrlImportPages.exsd
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.team.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.team.ui" id="scmUrlImportPages" name="%ScmUrlImportPage"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="scmUrlImportPage"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="scmUrlImportPage">
+ <complexType>
+ <attribute name="page" type="string" use="required">
+ <annotation>
+ <documentation>
+ A wizard page that can be displayed by wizards that import projects basing on information from SCM URLs.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.team.ui.IScmUrlImportWizardPage"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="repository" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.team.core.repository/repository/@id"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IScmUrlImportWizardPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IScmUrlImportWizardPage.java
new file mode 100644
index 000000000..82b3cf390
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IScmUrlImportWizardPage.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.ui;
+
+import java.net.URI;
+
+import org.eclipse.jface.wizard.IWizardPage;
+
+/**
+ * TODO: <strong>EXPERIMENTAL</strong>
+ *
+ * @since 3.6
+ */
+public interface IScmUrlImportWizardPage extends IWizardPage {
+
+ public static final String ATT_EXTENSION = "scmUrlImportPages"; //$NON-NLS-1$
+ public static final String ATT_PAGE = "page"; //$NON-NLS-1$
+
+ /**
+ * TODO:
+ *
+ * @return if the operation was successful. The wizard will only close when
+ * <code>true</code> is returned.
+ */
+ public boolean finish();
+
+ /**
+ * TODO:
+ *
+ * @return the SCM URLs edited or created on the page.
+ */
+ public URI[] getSelection();
+
+ /**
+ * TODO:
+ *
+ * @param scmUrls
+ * the SCM URLs edited on the page.
+ */
+ public void setSelection(URI[] scmUrls);
+
+}
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
index bd581b83a..4f7b1dd08 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,14 @@
*******************************************************************************/
package org.eclipse.team.ui;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.team.core.ProjectSetCapability;
+import org.eclipse.team.core.RepositoryProviderType;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.history.GenericHistoryView;
import org.eclipse.team.internal.ui.registry.TeamContentProviderManager;
@@ -127,7 +134,7 @@ public class TeamUI {
/**
* Return the team content provider manager which gives access to the team
- * content proivders registered with the
+ * content providers registered with the
* <code>org.eclipse.team.ui.teamContentProviders</code> extension point.
*
* @return the team content provider manager
@@ -136,4 +143,44 @@ public class TeamUI {
public static ITeamContentProviderManager getTeamContentProviderManager() {
return TeamContentProviderManager.getInstance();
}
+
+ /**
+ * TODO:
+ * <strong>EXPERIMENTAL</strong>
+ * @throws CoreException
+ * @since 3.6
+ */
+ public static IScmUrlImportWizardPage[] getPages(URI[] scmUris) throws CoreException {
+ // TODO: check scmUrls
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(TeamUIPlugin.PLUGIN_ID, IScmUrlImportWizardPage.ATT_EXTENSION);
+ if (elements.length > 0) {
+ Set/*<IConfigurationElement>*/ pages = new HashSet();
+ for (int i = 0; i < elements.length; i++) {
+ String repository = elements[i].getAttribute("repository"); //$NON-NLS-1$
+ RepositoryProviderType providerType = RepositoryProviderType.getProviderType(repository);
+ String scheme = providerType.getFileSystemScheme();
+ Set schemeUris = new HashSet();
+ for (int j = 0; j < scmUris.length; j++) {
+ URI scmUrl = scmUris[j];
+ if (scmUrl != null) {
+ if (ProjectSetCapability.SCHEME_SCM.equals(scmUrl.getScheme())) {
+ if (scmUrl.getSchemeSpecificPart().startsWith(scheme)) {
+ schemeUris.add(scmUrl);
+ }
+ }
+ }
+ }
+ if (schemeUris.size() > 0) {
+ Object ext = TeamUIPlugin.createExtension(elements[i], IScmUrlImportWizardPage.ATT_PAGE);
+ if (ext instanceof IScmUrlImportWizardPage) {
+ IScmUrlImportWizardPage page = (IScmUrlImportWizardPage) ext;
+ page.setSelection((URI[]) schemeUris.toArray(new URI[0]));
+ pages.add(page);
+ }
+ }
+ }
+ return (IScmUrlImportWizardPage[]) pages.toArray(new IScmUrlImportWizardPage[0]);
+ }
+ return null;
+ }
}

Back to the top