Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 160522 Details for
Bug 195729
Provide a way to import plug-ins from CVS from the plug-ins tab
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
bundle-importer-exts.patch (text/plain), 94.29 KB, created by
Darin Wright
on 2010-03-01 15:10:35 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Darin Wright
Created:
2010-03-01 15:10:35 EST
Size:
94.29 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.core >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF,v >retrieving revision 1.55 >diff -u -r1.55 MANIFEST.MF >--- META-INF/MANIFEST.MF 24 Feb 2010 22:22:38 -0000 1.55 >+++ META-INF/MANIFEST.MF 1 Mar 2010 20:01:35 -0000 >@@ -9,6 +9,7 @@ > Export-Package: > org.eclipse.pde.core, > org.eclipse.pde.core.build, >+ org.eclipse.pde.core.importing, > org.eclipse.pde.core.plugin, > org.eclipse.pde.core.project, > org.eclipse.pde.internal.core;x-friends:="org.eclipse.pde.ui,org.eclipse.pde.runtime,org.eclipse.pde.launching", >@@ -21,6 +22,7 @@ > org.eclipse.pde.internal.core.feature;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.core.ibundle;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.core.ifeature;x-friends:="org.eclipse.pde.ui", >+ org.eclipse.pde.internal.core.importing;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.core.iproduct;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.core.ischema;x-friends:="org.eclipse.pde.ui", > org.eclipse.pde.internal.core.isite;x-friends:="org.eclipse.pde.ui", >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/plugin.properties,v >retrieving revision 1.35 >diff -u -r1.35 plugin.properties >--- plugin.properties 27 May 2009 20:25:45 -0000 1.35 >+++ plugin.properties 1 Mar 2010 20:01:35 -0000 >@@ -18,6 +18,9 @@ > expoint.source.name = Code Source Locations > expoint.javadoc.name = Javadoc Locations > expoint.target.name = Target Profiles >+expoint.bundleImporters.name = Bundle Importers >+ >+bundleImporter.cvs = CVS Bundle Importer > > target.name.0 = Base RCP (with Source) > target.name.1 = Base RCP (Binary Only) >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/plugin.xml,v >retrieving revision 1.77 >diff -u -r1.77 plugin.xml >--- plugin.xml 27 May 2009 20:25:45 -0000 1.77 >+++ plugin.xml 1 Mar 2010 20:01:35 -0000 >@@ -15,6 +15,7 @@ > <extension-point id="source" name="%expoint.source.name" schema="schema/source.exsd"/> > <extension-point id="javadoc" name="%expoint.javadoc.name" schema="schema/javadoc.exsd"/> > <extension-point id="targets" name="%expoint.target.name" schema="schema/targets.exsd"/> >+ <extension-point id="bundleImporters" name="%expoint.bundleImporters.name" schema="schema/bundleImporters.exsd"/> > > <extension > point="org.eclipse.jdt.core.classpathVariableInitializer"> >@@ -334,5 +335,13 @@ > </describer> > </content-type> > </extension> >+ <extension >+ point="org.eclipse.pde.core.bundleImporters"> >+ <importer >+ class="org.eclipse.pde.internal.core.importing.CvsBundleImporterDelegate" >+ name="%bundleImporter.cvs" >+ id="org.eclipse.pde.core.cvs.importer"> >+ </importer> >+ </extension> > > </plugin> >Index: schema/bundleImporters.exsd >=================================================================== >RCS file: schema/bundleImporters.exsd >diff -N schema/bundleImporters.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/bundleImporters.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,153 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.pde.core" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.pde.core" id="bundleImporters" name="Bundle Importers"/> >+ </appInfo> >+ <documentation> >+ A bundle importer is capable of creating a project in the workspace based on specific entries contained in a bundle manifest. An importer can register for one or more bundle headers, identified by name. By default, a bundle importer is registered for the 'Eclipse-SourceReferences' header. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appInfo> >+ <meta.element /> >+ </appInfo> >+ </annotation> >+ <complexType> >+ <sequence minOccurs="1" maxOccurs="unbounded"> >+ <element ref="importer"/> >+ </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="importer"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ Fully qualified name of a Java class providing an implementation of <code>org.eclipse.pde.core.importing.IBundleImporterDelegate</code> for this handler. >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.pde.core.importing.IBundleImporterDelegate"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string" use="required"> >+ <annotation> >+ <documentation> >+ Unique identifier for this project factory extension. >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="description" type="string"> >+ <annotation> >+ <documentation> >+ A short description of this importer suitable for display to the end user. >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string" use="required"> >+ <annotation> >+ <documentation> >+ The name of this bundle importer, suitable for display to an end user. >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ 3.6 >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ The following is an example of a bundle importer extension. >+ >+<p> >+<pre> >+ <extension point="org.eclipse.pde.core.bundleImporters"> >+ <importer >+ id="com.example.ExampleIdentifier" >+ class="com.example.ExampleBundleImporter"> >+ </importer> >+ </extension> >+</pre> >+</p> >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiinfo"/> >+ </appInfo> >+ <documentation> >+ Value of a importer's <b>class</b> attribute must be a fully qualified name of a Java class that implements the interface <b>org.eclipse.pde.core.importing.IBundleImporterDelegate</b>. >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ PDE provides a bundle importer extension capable of importing projects from CVS referenced by 'Eclipse-SourceReferences' headers. >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ Copyright (c) 2010 IBM Corporation and others. >+<br> >+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 >+<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. >+ </documentation> >+ </annotation> >+ >+</schema> >Index: src/org/eclipse/pde/core/importing/BundleImportDescription.java >=================================================================== >RCS file: src/org/eclipse/pde/core/importing/BundleImportDescription.java >diff -N src/org/eclipse/pde/core/importing/BundleImportDescription.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/core/importing/BundleImportDescription.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,107 @@ >+/******************************************************************************* >+ * 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.pde.core.importing; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+/** >+ * Describes how a bundle import will be executed. A bundle importer delegate >+ * creates bundle import descriptions when it validates bundle manifests for >+ * importing. When asked to import bundles, it is passed back the instances >+ * of bundle import descriptions is created. However, the target project >+ * may have been modified and properties may have been modified. >+ * <p> >+ * Clients may instantiate this class. Clients may subclass this class to >+ * implement model specific behavior and include model specific data in import >+ * descriptions. >+ * </p> >+ * @since 3.6 >+ */ >+public class BundleImportDescription { >+ >+ private String project; >+ private Map manifest; >+ private Map properties; >+ >+ /** >+ * Constructs a bundle import description with given project and manifest. >+ * >+ * @param project the project the bundle should be imported into which may >+ * or may not exist >+ * @param manifest bundle manifest headers and values >+ */ >+ public BundleImportDescription(String project, Map manifest) { >+ this.project = project; >+ this.manifest = manifest; >+ } >+ >+ /** >+ * Sets or removes a client property. >+ * >+ * @param key property key >+ * @param value property value or <code>null</code> to remove the property >+ */ >+ public synchronized void setProperty(String key, Object value) { >+ if (properties == null) { >+ properties = new HashMap(); >+ } >+ if (value == null) { >+ properties.remove(key); >+ } else { >+ properties.put(key, value); >+ } >+ >+ } >+ >+ /** >+ * Returns the specified client property, or <code>null</code> if none. >+ * >+ * @param key property key >+ * @return property value or <code>null</code> >+ */ >+ public synchronized Object getProperty(String key) { >+ if (properties == null) { >+ return null; >+ } >+ return properties.get(key); >+ } >+ >+ /** >+ * Returns the project name the bundle will be imported into. The project >+ * may or may not exist before the import. However, when the import operation >+ * beings, the project will not exist. >+ * >+ * @return target project >+ */ >+ public synchronized String getProject() { >+ return project; >+ } >+ >+ /** >+ * Returns the manifest of the bundle to be imported. >+ * >+ * @return bundle manifest keys and values >+ */ >+ public Map getManifest() { >+ return manifest; >+ } >+ >+ /** >+ * Sets the project name that is the target of the import operation. >+ * >+ * @param project target project >+ */ >+ public synchronized void setProject(String project) { >+ this.project = project; >+ } >+ >+} >Index: src/org/eclipse/pde/core/importing/IBundleImporter.java >=================================================================== >RCS file: src/org/eclipse/pde/core/importing/IBundleImporter.java >diff -N src/org/eclipse/pde/core/importing/IBundleImporter.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/core/importing/IBundleImporter.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,47 @@ >+/******************************************************************************* >+ * 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.pde.core.importing; >+ >+/** >+ * A bundle importer represents an instance of a bundle importer extension. >+ * Clients contributing a bundle importer extension contribute an implementation >+ * of {@link IBundleImporterDelegate} rather than this interface. >+ * <p> >+ * Clients contributing a bundle importer extension are intended to implement >+ * {@link IBundleImporterDelegate}. >+ * </p> >+ * @since 3.6 >+ * @noextend This interface is not intended to be extended by clients. >+ * @noimplement This interface is not intended to be implemented by clients. >+ */ >+public interface IBundleImporter extends IBundleImporterDelegate { >+ >+ /** >+ * Returns this impoter's unique identifier. >+ * >+ * @return identifier >+ */ >+ public String getId(); >+ >+ /** >+ * Returns a short description of this importer, or <code>null</code> if unspecified. >+ * >+ * @return description or <code>null</code> >+ */ >+ public String getDescription(); >+ >+ /** >+ * Returns a human readable name for this importer. >+ * >+ * @return name >+ */ >+ public String getName(); >+} >Index: src/org/eclipse/pde/core/importing/IBundleImporterDelegate.java >=================================================================== >RCS file: src/org/eclipse/pde/core/importing/IBundleImporterDelegate.java >diff -N src/org/eclipse/pde/core/importing/IBundleImporterDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/core/importing/IBundleImporterDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,61 @@ >+/******************************************************************************* >+ * 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.pde.core.importing; >+ >+import java.util.Map; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+ >+/** >+ * A bundle importer delegate is contributed by a bundle importer extension and is capable >+ * of importing projects into the workspace from a repository based on bundle manifest entries. >+ * <p> >+ * Following is an example extension: >+ * <pre> >+ * <extension point="org.eclipse.pde.core.bundleImporters"> >+ * <importer >+ * id="com.example.ExampleIdentifier" >+ * class="com.example.ExampleBundleImporterDelegate"> >+ * </importer> >+ * </extension> >+ * </pre> >+ * </p> >+ * <p> >+ * Clients contributing bundle importer extensions are intended to implement this interface. >+ * </p> >+ * @since 3.6 >+ * @noextend This interface is not intended to be extended by clients. >+ */ >+public interface IBundleImporterDelegate { >+ >+ /** >+ * Returns an array of objects describing how each given bundle (manifest headers and values) >+ * can be imported into a workspace project. A <code>null</code> entry in the returned array >+ * indicates the corresponding bundle cannot be imported by this delegate. >+ * >+ * @param manifest manifest headers and values of the associated bundle >+ * @return array of bundle import descriptions that may contain <code>null</code> entries >+ */ >+ public BundleImportDescription[] validateImport(Map[] manifests); >+ >+ /** >+ * Imports bundles into the workspace creating a project for each import description. >+ * Reports progress to the given monitor, if not <code>null</code>. >+ * >+ * @param descriptions description of bundles to import >+ * @param options bundle import options to consider or <code>null</code> if none >+ * @param monitor progress monitor or <code>null</code> >+ * @return collection of projects created in the workspace or <code>null</code> if none >+ * @throws CoreException if unable to import projects >+ */ >+ public IProject[] performImport(BundleImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException; >+} >Index: src/org/eclipse/pde/internal/core/ICoreConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java,v >retrieving revision 1.82 >diff -u -r1.82 ICoreConstants.java >--- src/org/eclipse/pde/internal/core/ICoreConstants.java 19 Feb 2010 14:54:20 -0000 1.82 >+++ src/org/eclipse/pde/internal/core/ICoreConstants.java 1 Mar 2010 20:01:36 -0000 >@@ -152,6 +152,7 @@ > public static final String ECLIPSE_SOURCE_BUNDLE = "Eclipse-SourceBundle"; //$NON-NLS-1$ > public static final String ECLIPSE_SYSTEM_BUNDLE = "Eclipse-SystemBundle"; //$NON-NLS-1$ > public static final String ECLIPSE_BUNDLE_SHAPE = "Eclipse-BundleShape"; //$NON-NLS-1$ >+ public static final String ECLIPSE_SOURCE_REFERENCES = "Eclipse-SourceReferences"; //$NON-NLS-1$ > public static final String SERVICE_COMPONENT = "Service-Component"; //$NON-NLS-1$ > > // Equinox-specific system properties >@@ -192,6 +193,7 @@ > > // Extension point identifiers > public static final String EXTENSION_POINT_SOURCE = PDECore.PLUGIN_ID + ".source"; //$NON-NLS-1$ >+ public static final String EXTENSION_POINT_BUNDLE_IMPORTERS = PDECore.PLUGIN_ID + ".bundleImporters"; //$NON-NLS-1$ > > // file extensions > >Index: src/org/eclipse/pde/internal/core/importing/BundleImporterExtension.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/importing/BundleImporterExtension.java >diff -N src/org/eclipse/pde/internal/core/importing/BundleImporterExtension.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/importing/BundleImporterExtension.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,91 @@ >+/******************************************************************************* >+ * 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.pde.internal.core.importing; >+ >+import java.util.Map; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.*; >+import org.eclipse.pde.core.importing.*; >+import org.eclipse.pde.internal.core.PDECore; >+ >+/** >+ * A bundle importer extension. >+ * >+ * @since 3.6 >+ */ >+public class BundleImporterExtension implements IBundleImporter { >+ >+ private IBundleImporterDelegate delegate; >+ private IConfigurationElement element; >+ >+ /** >+ * Constructs a bundle importer extension on the given element. >+ * >+ * @param element contribution >+ */ >+ public BundleImporterExtension(IConfigurationElement element) { >+ this.element = element; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.project.IBundleImporterDelegate#validateImport(java.util.Map[]) >+ */ >+ public BundleImportDescription[] validateImport(Map[] manifests) { >+ try { >+ return getDelegate().validateImport(manifests); >+ } catch (CoreException e) { >+ PDECore.log(e); >+ return null; >+ } >+ } >+ >+ /** >+ * Returns underlying delegate. >+ * >+ * @return delegate >+ * @exception CoreException if unable to instantiate delegate >+ */ >+ private synchronized IBundleImporterDelegate getDelegate() throws CoreException { >+ if (delegate == null) { >+ delegate = (IBundleImporterDelegate) element.createExecutableExtension("class"); //$NON-NLS-1$ >+ } >+ return delegate; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.importing.IBundleImporterDelegate#performImport(org.eclipse.pde.core.importing.BundleImportDescription[], org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IProject[] performImport(BundleImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException { >+ return getDelegate().performImport(descriptions, monitor); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.project.IBundleImporter#getId() >+ */ >+ public String getId() { >+ return element.getAttribute("id"); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.project.IBundleImporter#getDescription() >+ */ >+ public String getDescription() { >+ return element.getAttribute("description"); //$NON-NLS-1$ >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.project.IBundleImporter#getName() >+ */ >+ public String getName() { >+ return element.getAttribute("name"); //$NON-NLS-1$ >+ } >+ >+} >Index: src/org/eclipse/pde/internal/core/importing/CvsBundleImportDescription.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/importing/CvsBundleImportDescription.java >diff -N src/org/eclipse/pde/internal/core/importing/CvsBundleImportDescription.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/importing/CvsBundleImportDescription.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * 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.pde.internal.core.importing; >+ >+import java.util.Map; >+import org.eclipse.pde.core.importing.BundleImportDescription; >+ >+/** >+ * Describes a bundle to be imported by CVS. >+ * @since 3.6 >+ */ >+public class CvsBundleImportDescription extends BundleImportDescription { >+ >+ String tag; >+ String server; >+ String path; >+ String module; >+ String protocol; >+ >+ /** >+ * @param project >+ * @param manifest >+ */ >+ public CvsBundleImportDescription(String project, Map manifest, String protocol, String server, String path, String module, String tag) { >+ super(project, manifest); >+ this.protocol = protocol; >+ this.server = server; >+ this.path = path; >+ this.module = module; >+ this.tag = tag; >+ } >+ >+ public void setTag(String tag) { >+ this.tag = tag; >+ } >+ >+ public String getTag() { >+ return tag; >+ } >+ >+ public String getServer() { >+ return server; >+ } >+ >+} >Index: src/org/eclipse/pde/internal/core/importing/CvsBundleImporterDelegate.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/core/importing/CvsBundleImporterDelegate.java >diff -N src/org/eclipse/pde/internal/core/importing/CvsBundleImporterDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/core/importing/CvsBundleImporterDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,199 @@ >+/******************************************************************************* >+ * 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.pde.internal.core.importing; >+ >+import java.util.*; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.*; >+import org.eclipse.osgi.util.ManifestElement; >+import org.eclipse.pde.core.importing.BundleImportDescription; >+import org.eclipse.pde.core.importing.IBundleImporterDelegate; >+import org.eclipse.pde.internal.core.ICoreConstants; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.team.core.*; >+import org.osgi.framework.BundleException; >+import org.osgi.framework.Constants; >+ >+/** >+ * Handles SCM CVS headers of the following form. Tag and project name can be specified >+ * as extra attributes. When a tag is unspecified, the HEAD tag is used. When a project >+ * name is unspecified, it is generated by the module name. >+ * <pre> >+ * scm:cvs<delimiter><method><delimiter>path_to_repository<delimiter>module_name[;tag=version][;project=name] >+ * scm:psf<delimiter><method><delimiter>path_to_repository<delimiter>module_name[;tag=version][;project=name] >+ * </pre> >+ * @since 3.6 >+ */ >+/** >+ * >+ */ >+public class CvsBundleImporterDelegate implements IBundleImporterDelegate { >+ >+ private static Set SUPPORTED_VALUES; >+ >+ private static final String SCM = "scm:"; //$NON-NLS-1$ >+ private static final String CVS = "cvs"; //$NON-NLS-1$ >+// private static final String PSF = "psf"; //$NON-NLS-1$ >+ private static final String COLON = ":"; //$NON-NLS-1$ >+ private static final String PIPE = "|"; //$NON-NLS-1$ >+ >+ private static final String ATTR_TAG = "tag"; //$NON-NLS-1$ >+ private static final String ATTR_PROJECT = "project"; //$NON-NLS-1$ >+ >+ private static RepositoryProviderType CVS_PROVIDER_TYPE = RepositoryProviderType.getProviderType("org.eclipse.team.cvs.core.cvsnature"); //$NON-NLS-1$ >+ >+ static { >+ SUPPORTED_VALUES = new HashSet(); >+ SUPPORTED_VALUES.add(SCM + CVS + COLON); >+ SUPPORTED_VALUES.add(SCM + CVS + PIPE); >+// SUPPORTED_VALUES.add(SCM + PSF + COLON); >+// SUPPORTED_VALUES.add(SCM + PSF + PIPE); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.project.IBundleImporterDelegate#validateImport(java.util.Map[]) >+ */ >+ public BundleImportDescription[] validateImport(Map[] manifests) { >+ BundleImportDescription[] results = new BundleImportDescription[manifests.length]; >+ if (CVS_PROVIDER_TYPE != null) { >+ for (int i = 0; i < manifests.length; i++) { >+ Map manifest = manifests[i]; >+ String value = (String) manifest.get(ICoreConstants.ECLIPSE_SOURCE_REFERENCES); >+ if (value != null && value.length() > 8) { >+ String prefix = value.substring(0, 8); >+ if (SUPPORTED_VALUES.contains(prefix)) { >+ try { >+ ManifestElement[] elements = ManifestElement.parseHeader(ICoreConstants.ECLIPSE_SOURCE_REFERENCES, value); >+ for (int j = 0; j < elements.length; j++) { >+ ManifestElement element = elements[j]; >+ String url = element.getValue(); >+ String tag = element.getAttribute(ATTR_TAG); >+ String project = element.getAttribute(ATTR_PROJECT); >+ if (project == null) { >+ String bsn = (String) manifests[i].get(Constants.BUNDLE_SYMBOLICNAME); >+ if (bsn != null) { >+ ManifestElement[] bsnElement = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, bsn); >+ project = bsnElement[0].getValue(); >+ } >+ } >+ results[i] = createImportDescription(url, manifest, tag, project); >+ } >+ } catch (BundleException e) { >+ PDECore.log(e); >+ } >+ } >+ } >+ } >+ } >+ return results; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.importing.IBundleImporterDelegate#performImport(org.eclipse.pde.core.importing.BundleImportDescription[], org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public IProject[] performImport(BundleImportDescription[] descriptions, IProgressMonitor monitor) throws CoreException { >+ List references = new ArrayList(); >+ // collect and validate all header values >+ for (int i = 0; i < descriptions.length; i++) { >+ references.add(createPSF((CvsBundleImportDescription) descriptions[i])); >+ } >+ // create projects >+ if (!references.isEmpty()) { >+ SubMonitor subMonitor = SubMonitor.convert(monitor, "Importing projects from CVS...", references.size()); >+ ProjectSetCapability psfCapability = CVS_PROVIDER_TYPE.getProjectSetCapability(); >+ if (psfCapability != null) { >+ // TODO: specify shell >+ psfCapability.addToWorkspace((String[]) references.toArray(new String[references.size()]), new ProjectSetSerializationContext(), subMonitor); >+ } else { >+ //TODO: error >+ } >+ subMonitor.done(); >+ } >+ return null; >+ } >+ >+ /** >+ * Constructs a CVS project set import description from an SCMURL. >+ * >+ * @param url >+ * @param manifest bundle manifest >+ * @param tag attribute value or <code>null</code> >+ * @param project suggested project name or <code>null</code> >+ * @return corresponding CVS project set reference >+ */ >+ private BundleImportDescription createImportDescription(String url, Map manifest, String tag, String project) { >+ // format is 1.0,protocol:host:cvs folder,project name [, tag] >+ String suffix = url.substring(8); >+ String sep = url.substring(7, 8); >+ String[] pieces = suffix.split(sep); >+ String protocol = pieces[0]; >+ // the last piece is the module name >+ String module = pieces[pieces.length - 1]; >+ // path is the second last piece >+ String path = pieces[pieces.length - 2]; >+ // there might be a user:password:server:port >+ int index = pieces.length - 3; // start looking at the third last piece and work backwards >+ // if it's a port number, keep moving back >+ String server = null; >+ try { >+ Integer.parseInt(pieces[index]); >+ index--; >+ server = pieces[index]; >+ } catch (NumberFormatException e) { >+ server = pieces[index]; >+ } >+ // trim any user/password >+ index = server.indexOf('@'); >+ if (index >= 0) { >+ server = server.substring(index + 1); >+ } >+ if (project == null) { >+ // use module name as default >+ int slash = pieces[3].lastIndexOf('/'); >+ if (slash >= 0) { >+ project = pieces[3].substring(slash + 1); >+ } else { >+ project = pieces[3]; >+ } >+ } >+ return new CvsBundleImportDescription(project, manifest, protocol, server, path, module, tag); >+ } >+ >+ /** >+ * Constructs a CVS project set import description from an SCMURL. >+ * >+ * @param url >+ * @param tag attribute value or <code>null</code> >+ * @param project suggested project name or <code>null</code> >+ * @return corresponding CVS project set reference >+ */ >+ private String createPSF(CvsBundleImportDescription description) { >+ // format is 1.0,protocol:host:cvs folder,project name [, tag] >+ StringBuffer buffer = new StringBuffer(); >+ buffer.append("1.0,:"); //$NON-NLS-1$ >+ buffer.append(description.protocol); // protocol >+ buffer.append(COLON); >+ buffer.append(description.server); >+ buffer.append(COLON); >+ buffer.append(description.path); >+ buffer.append(','); >+ buffer.append(description.module); >+ buffer.append(','); >+ buffer.append(description.getProject()); >+ String tag = description.tag; >+ if (tag != null) { >+ buffer.append(','); >+ buffer.append(tag); >+ } >+ return buffer.toString(); >+ } >+ >+} >Index: src/org/eclipse/pde/internal/core/project/BundleProjectService.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/project/BundleProjectService.java,v >retrieving revision 1.1 >diff -u -r1.1 BundleProjectService.java >--- src/org/eclipse/pde/internal/core/project/BundleProjectService.java 20 Jan 2010 19:18:22 -0000 1.1 >+++ src/org/eclipse/pde/internal/core/project/BundleProjectService.java 1 Mar 2010 20:01:37 -0000 >@@ -10,11 +10,28 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.core.project; > >+import org.eclipse.pde.internal.core.importing.BundleImporterExtension; >+ >+import org.eclipse.pde.core.importing.BundleImportDescription; >+import org.eclipse.pde.core.importing.IBundleImporter; >+ >+import java.io.*; >+import java.util.*; >+import java.util.jar.JarFile; >+import java.util.zip.ZipEntry; >+import java.util.zip.ZipFile; > import org.eclipse.core.resources.IProject; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.*; > import org.eclipse.osgi.service.resolver.VersionRange; >+import org.eclipse.osgi.util.ManifestElement; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.pde.core.plugin.IPluginModelBase; > import org.eclipse.pde.core.project.*; >+import org.eclipse.pde.internal.core.ICoreConstants; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.target.Messages; >+import org.eclipse.pde.internal.core.target.provisional.IResolvedBundle; >+import org.osgi.framework.BundleException; > import org.osgi.framework.Version; > > /** >@@ -25,8 +42,20 @@ > */ > public final class BundleProjectService implements IBundleProjectService { > >+ /** >+ * Property key used in {@link BundleImportDescription}s. >+ */ >+ public static final String BUNDLE_IMPORTER = "BUNDLE_IMPORTER"; //$NON-NLS-1$ >+ >+ /** >+ * Property key used in {@link BundleImportDescription}s. >+ */ >+ public static final String PLUGIN = "PLUGIN"; //$NON-NLS-1$ >+ > private static IBundleProjectService fgDefault; > >+ private List fProjectFactories; >+ > /** > * Returns the bundle project service. > * >@@ -146,4 +175,133 @@ > public void setBundleRoot(IProject project, IPath bundleRoot) throws CoreException { > PDEProject.setBundleRoot(project, project.getFolder(bundleRoot)); > } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.project.IBundleProjectService#getSourceReferenceHandler(java.lang.String) >+ */ >+ public IBundleImporter getSourceReferenceHandler(String id) { >+ >+ return null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.core.project.IBundleProjectService#getBundleImporters() >+ */ >+ public synchronized IBundleImporter[] getBundleImporters() { >+ if (fProjectFactories == null) { >+ fProjectFactories = new ArrayList(); >+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(ICoreConstants.EXTENSION_POINT_BUNDLE_IMPORTERS); >+ if (point != null) { >+ IConfigurationElement[] infos = point.getConfigurationElements(); >+ for (int i = 0; i < infos.length; i++) { >+ fProjectFactories.add(new BundleImporterExtension(infos[i])); >+ } >+ } >+ } >+ return (IBundleImporter[]) fProjectFactories.toArray(new IBundleImporter[fProjectFactories.size()]); >+ } >+ >+ /** >+ * Creates and returns a map of bundle import descriptions for the given bundles. >+ * The map is of {@link IBundleImporter} -> arrays of {@link BundleImportDescription}. >+ * Adds 'BUNDLE_IMPORTER' property to each description that maps to the importer that >+ * created each description. >+ * Adds 'PLUGIN' property that maps to the original plug-in model. >+ * >+ * @param models plug-in models >+ * @return import instructions >+ * @exception CoreException if unable to read manifest >+ */ >+ public Map getImportDescriptions(IPluginModelBase[] models) throws CoreException { >+ // build manifests >+ List manifests = new ArrayList(); >+ List plugins = new ArrayList(); >+ for (int i = 0; i < models.length; i++) { >+ String location = models[i].getInstallLocation(); >+ if (location != null) { >+ Map manifest = loadManifest(new File(location)); >+ if (manifest != null) { >+ manifests.add(manifest); >+ plugins.add(models[i]); >+ } >+ } >+ } >+ if (!manifests.isEmpty()) { >+ Map[] marray = (Map[]) manifests.toArray(new Map[manifests.size()]); >+ Map result = new HashMap(); >+ IBundleImporter[] importers = getBundleImporters(); >+ for (int i = 0; i < importers.length; i++) { >+ IBundleImporter importer = importers[i]; >+ BundleImportDescription[] descriptions = importer.validateImport(marray); >+ List valid = new ArrayList(); >+ for (int j = 0; j < descriptions.length; j++) { >+ BundleImportDescription description = descriptions[j]; >+ if (description != null) { >+ valid.add(description); >+ description.setProperty(BUNDLE_IMPORTER, importer); >+ description.setProperty(PLUGIN, plugins.get(j)); >+ } >+ } >+ result.put(importer, valid.toArray(new BundleImportDescription[valid.size()])); >+ } >+ return result; >+ } >+ return null; >+ } >+ >+ /** >+ * Parses a bunlde's manifest into a dictionary and returns the map >+ * or <code>null</code> if none. The bundle may be in a jar >+ * or in a directory at the specified location. >+ * >+ * @param bundleLocation root location of the bundle >+ * @return bundle manifest dictionary or <code>null</code> >+ * @throws CoreException if manifest has invalid syntax or is missing >+ */ >+ private Map loadManifest(File bundleLocation) throws CoreException { >+ ZipFile jarFile = null; >+ InputStream manifestStream = null; >+ String extension = new Path(bundleLocation.getName()).getFileExtension(); >+ try { >+ if (extension != null && extension.equals("jar") && bundleLocation.isFile()) { //$NON-NLS-1$ >+ jarFile = new ZipFile(bundleLocation, ZipFile.OPEN_READ); >+ ZipEntry manifestEntry = jarFile.getEntry(JarFile.MANIFEST_NAME); >+ if (manifestEntry != null) { >+ manifestStream = jarFile.getInputStream(manifestEntry); >+ } >+ } else { >+ File file = new File(bundleLocation, JarFile.MANIFEST_NAME); >+ if (file.exists()) { >+ manifestStream = new FileInputStream(file); >+ } >+ } >+ if (manifestStream == null) { >+ return null; >+ } >+ return ManifestElement.parseBundleManifest(manifestStream, new Hashtable(10)); >+ } catch (BundleException e) { >+ throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, IResolvedBundle.STATUS_INVALID_MANIFEST, NLS.bind(Messages.DirectoryBundleContainer_3, bundleLocation.getAbsolutePath()), e)); >+ } catch (IOException e) { >+ throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, IResolvedBundle.STATUS_INVALID_MANIFEST, NLS.bind(Messages.DirectoryBundleContainer_3, bundleLocation.getAbsolutePath()), e)); >+ } finally { >+ closeZipFileAndStream(manifestStream, jarFile); >+ } >+ } >+ >+ private void closeZipFileAndStream(InputStream stream, ZipFile jarFile) { >+ try { >+ if (stream != null) { >+ stream.close(); >+ } >+ } catch (IOException e) { >+ PDECore.log(e); >+ } >+ try { >+ if (jarFile != null) { >+ jarFile.close(); >+ } >+ } catch (IOException e) { >+ PDECore.log(e); >+ } >+ } > } >#P org.eclipse.pde.ui >Index: .settings/org.eclipse.jdt.ui.prefs >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/.settings/org.eclipse.jdt.ui.prefs,v >retrieving revision 1.2 >diff -u -r1.2 org.eclipse.jdt.ui.prefs >--- .settings/org.eclipse.jdt.ui.prefs 3 Jan 2008 02:25:12 -0000 1.2 >+++ .settings/org.eclipse.jdt.ui.prefs 1 Mar 2010 20:01:38 -0000 >@@ -1,11 +1,11 @@ >-#Sun Dec 23 21:49:35 CST 2007 >+#Sun Feb 28 21:27:07 CST 2010 > eclipse.preferences.version=1 > editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true > formatter_profile=_core > formatter_settings_version=11 > org.eclipse.jdt.ui.ignorelowercasenames=true > org.eclipse.jdt.ui.importorder=; >-org.eclipse.jdt.ui.ondemandthreshold=3 >+org.eclipse.jdt.ui.ondemandthreshold=12 > org.eclipse.jdt.ui.staticondemandthreshold=99 > sp_cleanup.add_default_serial_version_id=true > sp_cleanup.add_generated_serial_version_id=false >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/plugin.properties,v >retrieving revision 1.232 >diff -u -r1.232 plugin.properties >--- plugin.properties 8 Oct 2009 20:19:27 -0000 1.232 >+++ plugin.properties 1 Mar 2010 20:01:38 -0000 >@@ -19,6 +19,7 @@ > expoint.templates.name = Extension Templates > expoint.samples.name = Code Samples > expoint.osgiLauncher.name = OSGi Launcher >+expoint.bundleImportPages.name = Bundle Import Pages > > RunPDELaunchShortcut.description=Runs a separate Eclipse application > DebugPDELaunchShortcut.description=Debugs a separate Eclipse application >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/plugin.xml,v >retrieving revision 1.472 >diff -u -r1.472 plugin.xml >--- plugin.xml 22 Sep 2009 19:01:03 -0000 1.472 >+++ plugin.xml 1 Mar 2010 20:01:38 -0000 >@@ -20,6 +20,7 @@ > <extension-point id="samples" name="%expoint.samples.name" schema="schema/samples.exsd"/> > <extension-point id="targetProvisioners" name="%extension-point.name.0" schema="schema/targetProvisioners.exsd"/> > <extension-point id="launchShortcuts" name="%extension-point.name.1" schema="schema/launchShortcuts.exsd"/> >+ <extension-point id="bundleImportPages" name="%expoint.bundleImportPages.name" schema="schema/bundleImportPages.exsd"/> > > <!-- Extensions --> > <extension >@@ -2024,5 +2025,13 @@ > id="org.eclipse.pde.launching.ORGANIZE_MANIFESTS" > plugin="org.eclipse.pde.launching"> > </statusHandler> >- </extension> >+ </extension> >+ <extension >+ point="org.eclipse.pde.ui.bundleImportPages"> >+ <page >+ bundleImporter="org.eclipse.pde.core.cvs.importer" >+ class="org.eclipse.pde.internal.ui.wizards.imports.CVSBundleImportPage" >+ id="org.eclipse.pde.ui.cvs.import.page"> >+ </page> >+ </extension> > </plugin> >Index: schema/bundleImportPages.exsd >=================================================================== >RCS file: schema/bundleImportPages.exsd >diff -N schema/bundleImportPages.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/bundleImportPages.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,144 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.pde.ui" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.pde.ui" id="bundleImportPages" name="%expoint.bundleImportPages.name"/> >+ </appInfo> >+ <documentation> >+ A bundle import page provides a wizard page that can be used in the Plug-in import wizard to configure settings for bundles to be imported by a <code>org.eclipse.pde.core.bundleImporters</code> extension. >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appInfo> >+ <meta.element /> >+ </appInfo> >+ </annotation> >+ <complexType> >+ <sequence> >+ <element ref="page" minOccurs="1" maxOccurs="unbounded"/> >+ </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="page"> >+ <complexType> >+ <attribute name="id" type="string" use="required"> >+ <annotation> >+ <documentation> >+ unique identifier for this bundle import page >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ Fully qualified name of a Java class providing an implementation of <code>org.eclipse.pde.ui.IBundeImportWizardPage</code>. >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.pde.ui.IBundeImportWizardPage"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="bundleImporter" type="string" use="required"> >+ <annotation> >+ <documentation> >+ Identifier of the <code>org.eclipse.pde.core.bundleImporters</code> extension that this page provides a user interface for. >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="identifier" basedOn="org.eclipse.pde.core.bundleImporters/importer/@id"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ 3.6 >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ The following is an example of a bundle import wizard page extension. >+ >+<p> >+<pre> >+ <extension point="org.eclipse.pde.core.bundleImporters"> >+ <importer >+ id="com.example.ExampleIdentifier" >+ class="com.example.ExampleBundleImportWizardpage" >+ bundleImporter="com.example.bundleImporter"> >+ </importer> >+ </extension> >+</pre> >+</p> >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiinfo"/> >+ </appInfo> >+ <documentation> >+ Value of a page's <b>class</b> attribute must be a fully qualified name of a Java class that implements the interface <b>org.eclipse.pde.ui.IBundeImportWizardPage</b>. >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ PDE provides a wizard page for editing properties of bundles that can be imported by the CVS bundle importer. >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ Copyright (c) 2010 IBM Corporation and others. >+<br> >+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 >+<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. >+ </documentation> >+ </annotation> >+ >+</schema> >Index: src/org/eclipse/pde/internal/ui/IPDEUIConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/IPDEUIConstants.java,v >retrieving revision 1.36 >diff -u -r1.36 IPDEUIConstants.java >--- src/org/eclipse/pde/internal/ui/IPDEUIConstants.java 22 Sep 2009 19:01:02 -0000 1.36 >+++ src/org/eclipse/pde/internal/ui/IPDEUIConstants.java 1 Mar 2010 20:01:39 -0000 >@@ -50,4 +50,9 @@ > */ > String GENERATED_CONFIG = "pde.generated.config"; //$NON-NLS-1$ > >+ /** >+ * Extension point identifier for <code>org.eclipse.pde.ui.bundleImportPages</code>. >+ */ >+ public static final String EXTENSION_POINT_BUNDLE_IMPORT_PAGES = PLUGIN_ID + ".bundleImportPages"; //$NON-NLS-1$ >+ > } >Index: src/org/eclipse/pde/internal/ui/wizards/imports/BaseImportWizardSecondPage.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/BaseImportWizardSecondPage.java,v >retrieving revision 1.41 >diff -u -r1.41 BaseImportWizardSecondPage.java >--- src/org/eclipse/pde/internal/ui/wizards/imports/BaseImportWizardSecondPage.java 27 Jan 2010 17:45:03 -0000 1.41 >+++ src/org/eclipse/pde/internal/ui/wizards/imports/BaseImportWizardSecondPage.java 1 Mar 2010 20:01:39 -0000 >@@ -17,16 +17,28 @@ > import org.eclipse.jface.wizard.WizardPage; > import org.eclipse.pde.core.IModelProviderEvent; > import org.eclipse.pde.core.IModelProviderListener; >-import org.eclipse.pde.core.plugin.*; >+import org.eclipse.pde.core.plugin.IFragment; >+import org.eclipse.pde.core.plugin.IFragmentModel; >+import org.eclipse.pde.core.plugin.IPlugin; >+import org.eclipse.pde.core.plugin.IPluginImport; >+import org.eclipse.pde.core.plugin.IPluginLibrary; >+import org.eclipse.pde.core.plugin.IPluginModel; >+import org.eclipse.pde.core.plugin.IPluginModelBase; > import org.eclipse.pde.internal.core.ClasspathUtilCore; > import org.eclipse.pde.internal.core.PDECore; >-import org.eclipse.pde.internal.ui.*; >+import org.eclipse.pde.internal.ui.PDEPlugin; >+import org.eclipse.pde.internal.ui.PDEUIMessages; >+import org.eclipse.pde.internal.ui.SWTFactory; > import org.eclipse.pde.internal.ui.elements.DefaultContentProvider; > import org.eclipse.pde.internal.ui.wizards.ListUtil; > import org.eclipse.swt.SWT; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; >-import org.eclipse.swt.widgets.*; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableItem; > import org.osgi.framework.Version; > > public abstract class BaseImportWizardSecondPage extends WizardPage implements IModelProviderListener { >@@ -37,6 +49,7 @@ > protected PluginImportWizardFirstPage fPage1; > protected IPluginModelBase[] fModels = new IPluginModelBase[0]; > private Object fImportSource; >+ private int fImportType; > protected Button fAddFragmentsButton; > private Button fAutoBuildButton; > protected TableViewer fImportListViewer; >@@ -108,6 +121,7 @@ > if (fRefreshNeeded) { > fRefreshNeeded = false; > fImportSource = fPage1.getImportSource(); >+ fImportType = fPage1.getImportType(); > return true; > } > Object currSource = fPage1.getImportSource(); >@@ -115,6 +129,15 @@ > fImportSource = fPage1.getImportSource(); > return true; > } >+ // If the import type was changed to/from repository need refresh to filter available models >+ int currType = fPage1.getImportType(); >+ if (currType != fImportType) { >+ if (currType == PluginImportOperation.IMPORT_FROM_REPOSITORY || fImportType == PluginImportOperation.IMPORT_FROM_REPOSITORY) { >+ fImportType = currType; >+ return true; >+ } >+ fImportType = currType; >+ } > return fPage1.isRefreshNeeded(); > } > >Index: src/org/eclipse/pde/internal/ui/wizards/imports/CVSBundleImportPage.java >=================================================================== >RCS file: src/org/eclipse/pde/internal/ui/wizards/imports/CVSBundleImportPage.java >diff -N src/org/eclipse/pde/internal/ui/wizards/imports/CVSBundleImportPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/internal/ui/wizards/imports/CVSBundleImportPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,85 @@ >+/******************************************************************************* >+ * 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.pde.internal.ui.wizards.imports; >+ >+import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.pde.core.importing.BundleImportDescription; >+import org.eclipse.pde.internal.core.importing.CvsBundleImportDescription; >+import org.eclipse.pde.internal.ui.SWTFactory; >+import org.eclipse.pde.ui.IBundeImportWizardPage; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+ >+/** >+ * >+ */ >+public class CVSBundleImportPage extends WizardPage implements IBundeImportWizardPage { >+ >+ private BundleImportDescription[] descriptions; >+ >+ private Button useHead; >+ >+ /** >+ * Constructs the page. >+ */ >+ public CVSBundleImportPage() { >+ super("cvs", "Import Projects from CVS", null); >+ setDescription("Import CVS projects corresponding to plug-ins and fragments in the file system."); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public void createControl(Composite parent) { >+ Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH); >+ useHead = SWTFactory.createCheckButton(comp, "Import from &HEAD", null, false, 1); >+ setControl(comp); >+ setPageComplete(true); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean) >+ */ >+ public void setVisible(boolean visible) { >+ super.setVisible(visible); >+ setPageComplete(true); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.ui.IBundeImportWizardPage#finish() >+ */ >+ public boolean finish() { >+ if (useHead.getSelection()) { >+ // modify tags on bundle import descriptions >+ for (int i = 0; i < descriptions.length; i++) { >+ CvsBundleImportDescription description = (CvsBundleImportDescription) descriptions[i]; >+ description.setTag(null); >+ } >+ } >+ return true; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.ui.IBundeImportWizardPage#getSelection() >+ */ >+ public BundleImportDescription[] getSelection() { >+ return descriptions; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.pde.ui.IBundeImportWizardPage#setSelection(org.eclipse.pde.core.importing.BundleImportDescription[]) >+ */ >+ public void setSelection(BundleImportDescription[] descriptions) { >+ this.descriptions = descriptions; >+ } >+ >+} >Index: src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java,v >retrieving revision 1.138 >diff -u -r1.138 PluginImportOperation.java >--- src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java 20 Jan 2010 20:15:27 -0000 1.138 >+++ src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java 1 Mar 2010 20:01:40 -0000 >@@ -12,21 +12,57 @@ > > import java.io.File; > import java.io.IOException; >-import java.util.*; >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.Enumeration; >+import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Hashtable; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+import java.util.Map.Entry; >+import java.util.Set; > import java.util.zip.ZipException; > import java.util.zip.ZipFile; >-import org.eclipse.core.resources.*; >-import org.eclipse.core.runtime.*; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IProjectDescription; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IncrementalProjectBuilder; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.resources.WorkspaceJob; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.MultiStatus; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.SubProgressMonitor; > import org.eclipse.core.runtime.jobs.Job; >-import org.eclipse.jdt.core.*; >+import org.eclipse.jdt.core.IClasspathEntry; >+import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jface.window.Window; > import org.eclipse.osgi.service.resolver.BundleDescription; > import org.eclipse.osgi.util.ManifestElement; > import org.eclipse.osgi.util.NLS; > import org.eclipse.pde.core.build.IBuild; > import org.eclipse.pde.core.build.IBuildEntry; >-import org.eclipse.pde.core.plugin.*; >-import org.eclipse.pde.internal.core.*; >+import org.eclipse.pde.core.importing.BundleImportDescription; >+import org.eclipse.pde.core.importing.IBundleImporter; >+import org.eclipse.pde.core.plugin.IPluginBase; >+import org.eclipse.pde.core.plugin.IPluginLibrary; >+import org.eclipse.pde.core.plugin.IPluginModelBase; >+import org.eclipse.pde.core.plugin.PluginRegistry; >+import org.eclipse.pde.internal.core.ClasspathComputer; >+import org.eclipse.pde.internal.core.ClasspathUtilCore; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.SourceLocationManager; > import org.eclipse.pde.internal.core.build.WorkspaceBuildModel; > import org.eclipse.pde.internal.core.bundle.WorkspaceBundleModel; > import org.eclipse.pde.internal.core.ibundle.IBundle; >@@ -38,7 +74,9 @@ > import org.eclipse.team.core.RepositoryProvider; > import org.eclipse.team.core.TeamException; > import org.eclipse.ui.progress.UIJob; >-import org.eclipse.ui.wizards.datatransfer.*; >+import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider; >+import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider; >+import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider; > import org.osgi.framework.BundleException; > > /** >@@ -51,6 +89,7 @@ > public static final int IMPORT_BINARY = 1; > public static final int IMPORT_BINARY_WITH_LINKS = 2; > public static final int IMPORT_WITH_SOURCE = 3; >+ public static final int IMPORT_FROM_REPOSITORY = 4; > > private static final String DEFAULT_SOURCE_DIR = "src"; //$NON-NLS-1$ > private static final String DEFAULT_LIBRARY_NAME = "."; //$NON-NLS-1$ >@@ -60,6 +99,9 @@ > private Hashtable fProjectClasspaths = new Hashtable(); > private boolean fForceAutobuild; > >+ // used when importing from a repository >+ private Map fImportDescriptions; >+ > /** > * Used to find source locations when not found in default locations. > * Possibly <code>null</code> >@@ -117,28 +159,39 @@ > if (monitor.isCanceled()) { > return Status.CANCEL_STATUS; > } >+ // TODO: more than one importer > >- for (int i = 0; i < fModels.length; i++) { >- monitor.setTaskName(NLS.bind(PDEUIMessages.PluginImportOperation_Importing_plugin, fModels[i].getPluginBase().getId())); >- try { >- importPlugin(fModels[i], fImportType, new SubProgressMonitor(monitor, 1)); >- } catch (CoreException e) { >- multiStatus.merge(e.getStatus()); >+ if (fImportType == IMPORT_FROM_REPOSITORY) { >+ Iterator iterator = fImportDescriptions.entrySet().iterator(); >+ while (iterator.hasNext()) { >+ Entry entry = (Entry) iterator.next(); >+ IBundleImporter importer = (IBundleImporter) entry.getKey(); >+ BundleImportDescription[] descriptions = (BundleImportDescription[]) entry.getValue(); >+ importer.performImport(descriptions, new SubProgressMonitor(monitor, descriptions.length)); > } >- if (monitor.isCanceled()) { >+ } else { >+ for (int i = 0; i < fModels.length; i++) { >+ monitor.setTaskName(NLS.bind(PDEUIMessages.PluginImportOperation_Importing_plugin, fModels[i].getPluginBase().getId())); > try { >- setClasspaths(new SubProgressMonitor(monitor, 3)); >- } catch (JavaModelException e) { >- /* Do nothing as we are already cancelled */ >+ importPlugin(fModels[i], fImportType, new SubProgressMonitor(monitor, 1)); >+ } catch (CoreException e) { >+ multiStatus.merge(e.getStatus()); >+ } >+ if (monitor.isCanceled()) { >+ try { >+ setClasspaths(new SubProgressMonitor(monitor, 3)); >+ } catch (JavaModelException e) { >+ /* Do nothing as we are already cancelled */ >+ } >+ return Status.CANCEL_STATUS; > } >- return Status.CANCEL_STATUS; > } >- } >- monitor.setTaskName(PDEUIMessages.PluginImportOperation_Set_up_classpaths); >- try { >- setClasspaths(new SubProgressMonitor(monitor, 1)); >- } catch (JavaModelException e) { >- multiStatus.merge(e.getStatus()); >+ monitor.setTaskName(PDEUIMessages.PluginImportOperation_Set_up_classpaths); >+ try { >+ setClasspaths(new SubProgressMonitor(monitor, 1)); >+ } catch (JavaModelException e) { >+ multiStatus.merge(e.getStatus()); >+ } > } > if (!ResourcesPlugin.getWorkspace().isAutoBuilding() && fForceAutobuild) > runBuildJob(); >@@ -166,9 +219,9 @@ > ArrayList pluginsWithSameSymbolicName = (ArrayList) workspacePluginMap.get(symbolicName); > if (pluginsWithSameSymbolicName == null) { > pluginsWithSameSymbolicName = new ArrayList(); >+ workspacePluginMap.put(symbolicName, pluginsWithSameSymbolicName); > } > pluginsWithSameSymbolicName.add(plugin); >- workspacePluginMap.put(symbolicName, pluginsWithSameSymbolicName); > } > monitor.worked(1); > >@@ -259,6 +312,7 @@ > * environment is supported and also checks if the project already exists and > * needs to be replaced. > * @param model model representing the plugin to import >+ * @param instructions instructions for how to import from repository > * @param monitor progress monitor > * @throws CoreException if a problem occurs while importing a plugin > */ >@@ -1146,4 +1200,13 @@ > return new File(model.getInstallLocation()).isFile(); > } > >+ /** >+ * Sets the import descriptions to use when importing from a repository. >+ * >+ * @param descriptions map of {@link IBundleImporter} to arrays of {@link BundleImportDescription}. >+ */ >+ public void setImportDescriptions(Map descriptions) { >+ fImportDescriptions = descriptions; >+ } >+ > } >Index: src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizard.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizard.java,v >retrieving revision 1.57 >diff -u -r1.57 PluginImportWizard.java >--- src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizard.java 22 Sep 2009 19:01:03 -0000 1.57 >+++ src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizard.java 1 Mar 2010 20:01:40 -0000 >@@ -10,20 +10,28 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.ui.wizards.imports; > >-import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper; >- >-import java.util.*; >+import java.util.HashSet; >+import java.util.Iterator; >+import java.util.Map; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; >-import org.eclipse.debug.core.*; >-import org.eclipse.jface.dialogs.*; >+import org.eclipse.debug.core.DebugPlugin; >+import org.eclipse.debug.core.ILaunch; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchManager; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.IDialogSettings; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.wizard.IWizardPage; > import org.eclipse.jface.wizard.Wizard; > import org.eclipse.osgi.service.resolver.BundleDescription; > import org.eclipse.pde.core.plugin.IPluginModelBase; > import org.eclipse.pde.internal.core.SourceLocationManager; >-import org.eclipse.pde.internal.ui.*; >+import org.eclipse.pde.internal.launching.launcher.BundleLauncherHelper; >+import org.eclipse.pde.internal.ui.PDEPlugin; >+import org.eclipse.pde.internal.ui.PDEPluginImages; >+import org.eclipse.pde.internal.ui.PDEUIMessages; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IImportWizard; > import org.eclipse.ui.IWorkbench; >@@ -84,7 +92,11 @@ > return false; > > } >- doImportOperation(getShell(), page1.getImportType(), models, page2.forceAutoBuild(), launchedConfiguration > 0, page1.getAlternateSourceLocations()); >+ // finish contributed pages >+ if (!page1.finishPages()) { >+ return false; >+ } >+ doImportOperation(getShell(), page1.getImportType(), models, page2.forceAutoBuild(), launchedConfiguration > 0, page1.getAlternateSourceLocations(), page1.getImportDescriptions()); > return true; > } > >@@ -129,7 +141,7 @@ > } > > public static void doImportOperation(Shell shell, int importType, IPluginModelBase[] models, boolean forceAutobuild) { >- doImportOperation(shell, importType, models, forceAutobuild, false, null); >+ doImportOperation(shell, importType, models, forceAutobuild, false, null, null); > } > > /** >@@ -143,8 +155,9 @@ > * source locations should be used (from active target platform). > * > */ >- private static void doImportOperation(Shell shell, int importType, IPluginModelBase[] models, boolean forceAutobuild, boolean launchedConfiguration, SourceLocationManager alternateSource) { >+ private static void doImportOperation(Shell shell, int importType, IPluginModelBase[] models, boolean forceAutobuild, boolean launchedConfiguration, SourceLocationManager alternateSource, Map importerToDescriptions) { > PluginImportOperation job = new PluginImportOperation(models, importType, forceAutobuild); >+ job.setImportDescriptions(importerToDescriptions); > job.setAlternateSource(alternateSource); > job.setPluginsInUse(launchedConfiguration); > job.setRule(ResourcesPlugin.getWorkspace().getRoot()); >@@ -159,14 +172,27 @@ > } > return page2; > } >+ if (page.equals(page3)) { >+ return page1.getNextPage(page); >+ } > return null; > } > > public IWizardPage getPreviousPage(IWizardPage page) { >- return page.equals(page1) ? null : page1; >+ if (page.equals(page1)) { >+ return null; >+ } >+ if (page.equals(page2) || page.equals(page3)) { >+ return page1; >+ } >+ IWizardPage prev = page1.getPreviousPage(page); >+ if (prev == null) { >+ return page3; >+ } >+ return prev; > } > > public boolean canFinish() { >- return !page1.isCurrentPage() && page1.getNextPage().isPageComplete(); >+ return !page1.isCurrentPage() && page1.getNextPage().isPageComplete() && page1.arePagesComplete(); > } > } >Index: src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizardDetailedPage.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizardDetailedPage.java,v >retrieving revision 1.96 >diff -u -r1.96 PluginImportWizardDetailedPage.java >--- src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizardDetailedPage.java 14 Dec 2009 17:31:14 -0000 1.96 >+++ src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizardDetailedPage.java 1 Mar 2010 20:01:41 -0000 >@@ -13,31 +13,57 @@ > *******************************************************************************/ > package org.eclipse.pde.internal.ui.wizards.imports; > >-import java.util.*; >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.HashSet; > import java.util.List; >+import java.util.Set; > import java.util.regex.Pattern; > import org.eclipse.core.resources.IProject; >-import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.dialogs.IDialogSettings; >-import org.eclipse.jface.viewers.*; >+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.IStructuredContentProvider; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.SelectionChangedEvent; >+import org.eclipse.jface.viewers.TableViewer; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerFilter; > import org.eclipse.osgi.util.NLS; > import org.eclipse.pde.core.plugin.IPluginModelBase; > import org.eclipse.pde.internal.core.PDECore; > import org.eclipse.pde.internal.core.WorkspaceModelManager; > import org.eclipse.pde.internal.core.plugin.AbstractPluginModelBase; > import org.eclipse.pde.internal.core.util.PatternConstructor; >-import org.eclipse.pde.internal.ui.*; >+import org.eclipse.pde.internal.ui.IHelpContextIds; >+import org.eclipse.pde.internal.ui.PDEPlugin; >+import org.eclipse.pde.internal.ui.PDEUIMessages; >+import org.eclipse.pde.internal.ui.SWTFactory; > import org.eclipse.pde.internal.ui.elements.DefaultContentProvider; > import org.eclipse.pde.internal.ui.util.SWTUtil; > import org.eclipse.pde.internal.ui.util.SourcePluginFilter; > import org.eclipse.pde.internal.ui.wizards.ListUtil; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.ScrolledComposite; >-import org.eclipse.swt.events.*; >+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.*; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableItem; >+import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.progress.WorkbenchJob; > import org.osgi.framework.Version; >@@ -57,6 +83,7 @@ > private VersionFilter fVersionFilter; > private AvailableFilter fAvailableFilter; > private SourcePluginFilter fSourceFilter; >+ private ViewerFilter fRepositoryFilter; > // fSelected is used to track the selection in a hash set so we can efficiently > // filter selected items out of the available item list > private Set fSelected; >@@ -71,6 +98,18 @@ > > private static final String SETTINGS_SHOW_LATEST = "showLatestPluginsOnly"; //$NON-NLS-1$ > >+ private class RepositoryFilter extends ViewerFilter { >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) >+ */ >+ public boolean select(Viewer viewer, Object parentElement, Object element) { >+ if (fPage1.getImportType() == PluginImportOperation.IMPORT_FROM_REPOSITORY) { >+ return fPage1.repositoryModels.contains(element); >+ } >+ return true; >+ } >+ } >+ > private class AvailableFilter extends ViewerFilter { > private Pattern fPattern; > >@@ -201,6 +240,8 @@ > fAvailableListViewer.addFilter(fVersionFilter); > } > fAvailableListViewer.addFilter(fSourceFilter); >+ fRepositoryFilter = new RepositoryFilter(); >+ fAvailableListViewer.addFilter(fRepositoryFilter); > > fFilterJob = new WorkbenchJob("FilterJob") { //$NON-NLS-1$ > public IStatus runInUIThread(IProgressMonitor monitor) { >@@ -403,10 +444,10 @@ > > public void setVisible(boolean visible) { > super.setVisible(visible); >- if (visible) >+ if (visible) { > fFilterText.setFocus(); >- setPageComplete(visible && fImportListViewer.getTable().getItemCount() > 0); >- >+ setPageComplete(fImportListViewer.getTable().getItemCount() > 0); >+ } > } > > protected void refreshPage() { >Index: src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizardFirstPage.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizardFirstPage.java,v >retrieving revision 1.72 >diff -u -r1.72 PluginImportWizardFirstPage.java >--- src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizardFirstPage.java 2 Nov 2009 18:47:44 -0000 1.72 >+++ src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportWizardFirstPage.java 1 Mar 2010 20:01:41 -0000 >@@ -14,26 +14,73 @@ > import java.lang.reflect.InvocationTargetException; > import java.net.MalformedURLException; > import java.net.URL; >-import java.util.*; >+import java.util.ArrayList; >+import java.util.Collections; >+import java.util.Comparator; >+import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Iterator; > import java.util.List; >-import org.eclipse.core.runtime.*; >+import java.util.Map; >+import java.util.Map.Entry; >+import java.util.Set; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtensionPoint; >+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.core.runtime.SubProgressMonitor; > import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.dialogs.IDialogSettings; > import org.eclipse.jface.operation.IRunnableWithProgress; >-import org.eclipse.jface.preference.*; >+import org.eclipse.jface.preference.IPreferenceNode; >+import org.eclipse.jface.preference.PreferenceDialog; >+import org.eclipse.jface.preference.PreferenceManager; > import org.eclipse.jface.window.Window; >+import org.eclipse.jface.wizard.IWizardPage; >+import org.eclipse.jface.wizard.Wizard; > import org.eclipse.jface.wizard.WizardPage; >-import org.eclipse.pde.core.plugin.*; >-import org.eclipse.pde.internal.core.*; >-import org.eclipse.pde.internal.core.target.provisional.*; >-import org.eclipse.pde.internal.ui.*; >+import org.eclipse.pde.core.importing.BundleImportDescription; >+import org.eclipse.pde.core.importing.IBundleImporter; >+import org.eclipse.pde.core.plugin.IPluginBase; >+import org.eclipse.pde.core.plugin.IPluginModelBase; >+import org.eclipse.pde.core.plugin.PluginRegistry; >+import org.eclipse.pde.core.plugin.TargetPlatform; >+import org.eclipse.pde.internal.core.ICoreConstants; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.PDEPreferencesManager; >+import org.eclipse.pde.internal.core.PDEState; >+import org.eclipse.pde.internal.core.SourceLocationKey; >+import org.eclipse.pde.internal.core.SourceLocationManager; >+import org.eclipse.pde.internal.core.project.BundleProjectService; >+import org.eclipse.pde.internal.core.target.provisional.IBundleContainer; >+import org.eclipse.pde.internal.core.target.provisional.IResolvedBundle; >+import org.eclipse.pde.internal.core.target.provisional.ITargetDefinition; >+import org.eclipse.pde.internal.core.target.provisional.ITargetHandle; >+import org.eclipse.pde.internal.core.target.provisional.ITargetPlatformService; >+import org.eclipse.pde.internal.ui.IHelpContextIds; >+import org.eclipse.pde.internal.ui.IPDEUIConstants; >+import org.eclipse.pde.internal.ui.PDEPlugin; >+import org.eclipse.pde.internal.ui.PDEUIMessages; >+import org.eclipse.pde.internal.ui.SWTFactory; > import org.eclipse.pde.internal.ui.preferences.TargetPlatformPreferenceNode; >+import org.eclipse.pde.ui.IBundeImportWizardPage; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.BusyIndicator; >-import org.eclipse.swt.events.*; >+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.*; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Combo; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.DirectoryDialog; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.PlatformUI; > import org.osgi.framework.Version; > >@@ -65,6 +112,7 @@ > private Button binaryButton; > private Button binaryWithLinksButton; > private Button sourceButton; >+ private Button repositoryButton; > > public static String TARGET_PLATFORM = "targetPlatform"; //$NON-NLS-1$ > private IPluginModelBase[] models = new IPluginModelBase[0]; >@@ -75,6 +123,26 @@ > private PDEState state; > private boolean canceled = false; > >+ /** >+ * Models that can be imported from a repository >+ */ >+ protected Set repositoryModels = null; >+ >+ /** >+ * Maps bundle importers to import instructions >+ */ >+ private Map importerToInstructions = null; >+ >+ /** >+ * Map of bundle importer extension id to associated wizard page >+ */ >+ private Map importIdToWizardPage = new HashMap(); >+ >+ /** >+ * Array of next wizard pages (in order) >+ */ >+ private List nextPages = new ArrayList(); >+ > public PluginImportWizardFirstPage(String name) { > super(name); > setTitle(PDEUIMessages.ImportWizard_FirstPage_title); >@@ -120,6 +188,7 @@ > binaryButton = SWTFactory.createRadioButton(options, PDEUIMessages.ImportWizard_FirstPage_binary); > binaryWithLinksButton = SWTFactory.createRadioButton(options, PDEUIMessages.ImportWizard_FirstPage_binaryLinks); > sourceButton = SWTFactory.createRadioButton(options, PDEUIMessages.ImportWizard_FirstPage_source); >+ repositoryButton = SWTFactory.createRadioButton(options, "Projects from a &repository"); > } > > /** >@@ -156,8 +225,10 @@ > binaryButton.setSelection(true); > } else if (importType == PluginImportOperation.IMPORT_BINARY_WITH_LINKS) { > binaryWithLinksButton.setSelection(true); >- } else { >+ } else if (importType == PluginImportOperation.IMPORT_WITH_SOURCE) { > sourceButton.setSelection(true); >+ } else { >+ repositoryButton.setSelection(true); > } > > boolean scan = true; >@@ -384,7 +455,9 @@ > if (binaryWithLinksButton.getSelection()) { > return PluginImportOperation.IMPORT_BINARY_WITH_LINKS; > } >- >+ if (repositoryButton.getSelection()) { >+ return PluginImportOperation.IMPORT_FROM_REPOSITORY; >+ } > return PluginImportOperation.IMPORT_WITH_SOURCE; > } > >@@ -481,13 +554,19 @@ > > /** > * Resolves the target platform >+ * @param type import type > */ >- private void resolveTargetPlatform() { >+ private void resolveTargetPlatform(final int type) { > IRunnableWithProgress op = new IRunnableWithProgress() { >- public void run(IProgressMonitor monitor) { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException { > models = PluginRegistry.getExternalModels(); > state = PDECore.getDefault().getModelManager().getState(); > alternateSource = null; >+ try { >+ buildImportDescriptions(monitor, type); >+ } catch (CoreException e) { >+ throw new InvocationTargetException(e); >+ } > monitor.done(); > } > }; >@@ -516,7 +595,7 @@ > } > ITargetDefinition target = service.newTarget(); // temporary target > target.setBundleContainers(new IBundleContainer[] {container}); >- resolveTargetDefinition(target); >+ resolveTargetDefinition(target, getImportType()); > } > } > >@@ -524,10 +603,11 @@ > * Resolves the plug-in locations for a target definition. > * > * @param target target definition >+ * @param type import operation type > */ >- private void resolveTargetDefinition(final ITargetDefinition target) { >+ private void resolveTargetDefinition(final ITargetDefinition target, final int type) { > IRunnableWithProgress op = new IRunnableWithProgress() { >- public void run(IProgressMonitor monitor) { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException { > monitor.beginTask(PDEUIMessages.PluginImportWizardFirstPage_1, 100); > SubProgressMonitor pm = new SubProgressMonitor(monitor, 50); > target.resolve(pm); >@@ -567,6 +647,11 @@ > } > } > alternateSource = new AlternateSourceLocations((IPluginModelBase[]) sourceModels.toArray(new IPluginModelBase[sourceModels.size()]), (IResolvedBundle[]) sourceBundles.toArray(new IResolvedBundle[sourceBundles.size()])); >+ try { >+ buildImportDescriptions(pm, type); >+ } catch (CoreException e) { >+ throw new InvocationTargetException(e); >+ } > pm.done(); > canceled = monitor.isCanceled(); > monitor.done(); >@@ -580,16 +665,177 @@ > } > } > >+ private void buildImportDescriptions(IProgressMonitor monitor, int type) throws CoreException { >+ // build import instructions >+ BundleProjectService service = (BundleProjectService) BundleProjectService.getDefault(); >+ if (type == PluginImportOperation.IMPORT_FROM_REPOSITORY) { >+ if (models != null) { >+ repositoryModels = new HashSet(); >+ importerToInstructions = service.getImportDescriptions(models); >+ Iterator iterator = importerToInstructions.entrySet().iterator(); >+ while (iterator.hasNext()) { >+ if (!monitor.isCanceled()) { >+ Entry entry = (Entry) iterator.next(); >+ BundleImportDescription[] descriptions = (BundleImportDescription[]) entry.getValue(); >+ for (int i = 0; i < descriptions.length; i++) { >+ repositoryModels.add(descriptions[i].getProperty(BundleProjectService.PLUGIN)); >+ } >+ } >+ } >+ } >+ } >+ if (monitor.isCanceled()) { >+ importerToInstructions.clear(); >+ repositoryModels.clear(); >+ } else { >+ // contributed wizard pages >+ Iterator iterator = importerToInstructions.entrySet().iterator(); >+ nextPages.clear(); >+ while (iterator.hasNext()) { >+ Entry entry = (Entry) iterator.next(); >+ IBundleImporter importer = (IBundleImporter) entry.getKey(); >+ IBundeImportWizardPage page = (IBundeImportWizardPage) importIdToWizardPage.get(importer.getId()); >+ if (page == null) { >+ page = getPage(importer.getId()); >+ if (page != null) { >+ importIdToWizardPage.put(importer.getId(), page); >+ ((Wizard) getWizard()).addPage(page); >+ } >+ } >+ if (page != null) { >+ nextPages.add(page); >+ page.setSelection((BundleImportDescription[]) entry.getValue()); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Returns whether the contributed pages are complete. >+ * >+ * @return whether the contributed pages are complete >+ */ >+ boolean arePagesComplete() { >+ Iterator iterator = nextPages.iterator(); >+ while (iterator.hasNext()) { >+ IBundeImportWizardPage page = (IBundeImportWizardPage) iterator.next(); >+ if (!page.isPageComplete()) { >+ return false; >+ } >+ } >+ return true; >+ } >+ >+ /** >+ * Finishes contributed pages. >+ * >+ * @return whether finish was successful >+ */ >+ boolean finishPages() { >+ Iterator iterator = nextPages.iterator(); >+ while (iterator.hasNext()) { >+ IBundeImportWizardPage page = (IBundeImportWizardPage) iterator.next(); >+ if (!page.finish()) { >+ return false; >+ } >+ } >+ return true; >+ } >+ >+ /** >+ * Returns a map of importers to their bundle import descriptions to process. >+ * >+ * @return map of bundle import descriptions to process, by importers >+ */ >+ Map getImportDescriptions() { >+ Map map = new HashMap(); >+ IBundleImporter[] importers = ((BundleProjectService) BundleProjectService.getDefault()).getBundleImporters(); >+ for (int i = 0; i < importers.length; i++) { >+ IBundleImporter importer = importers[i]; >+ if (importerToInstructions.containsKey(importer)) { >+ IBundeImportWizardPage page = (IBundeImportWizardPage) importIdToWizardPage.get(importer.getId()); >+ if (page != null && nextPages.contains(page)) { >+ map.put(importer, page.getSelection()); >+ } >+ } >+ } >+ return map; >+ } >+ >+ /** >+ * Returns the next page to display or <code>null</code> if none. >+ * >+ * @param page current page >+ * @return next page or <code>null</code> >+ */ >+ IWizardPage getNextPage(IWizardPage page) { >+ if (nextPages.isEmpty()) { >+ return null; >+ } >+ if (page instanceof IBundeImportWizardPage) { >+ int index = nextPages.indexOf(page); >+ if (index >= 0 && index < (nextPages.size() - 2)) { >+ return (IWizardPage) nextPages.get(index + 1); >+ } >+ } >+ if (page instanceof PluginImportWizardDetailedPage) { >+ return (IWizardPage) nextPages.get(0); >+ } >+ return null; >+ } >+ >+ /** >+ * Returns the previous page to display or <code>null</code> if none. >+ * >+ * @param page current page >+ * @return previous page or <code>null</code> >+ */ >+ IWizardPage getPreviousPage(IWizardPage page) { >+ if (page instanceof IBundeImportWizardPage) { >+ int index = nextPages.indexOf(page); >+ if (index > 0) { >+ return (IWizardPage) nextPages.get(index - 1); >+ } >+ } >+ return null; >+ } >+ >+ /** >+ * Creates and returns a wizard page associated with the given bundle importer extension identifier >+ * or <code>null</code> of none. >+ * >+ * @param importerId org.eclipse.pde.core.bundleImporters extension identifier >+ * @return associated bundle import wizard page or <code>null</code> >+ */ >+ private IBundeImportWizardPage getPage(String importerId) { >+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(IPDEUIConstants.EXTENSION_POINT_BUNDLE_IMPORT_PAGES); >+ if (point != null) { >+ IConfigurationElement[] infos = point.getConfigurationElements(); >+ for (int i = 0; i < infos.length; i++) { >+ IConfigurationElement element = infos[i]; >+ String id = element.getAttribute("bundleImporter"); //$NON-NLS-1$ >+ if (id != null && importerId.equals(id)) { >+ try { >+ return (IBundeImportWizardPage) element.createExecutableExtension("class"); //$NON-NLS-1$ >+ } catch (CoreException e) { >+ PDEPlugin.log(e); >+ } >+ } >+ } >+ } >+ return null; >+ } >+ > /** > * @return the complete set of {@link IPluginModelBase}s for the given drop location > */ > public IPluginModelBase[] getModels() { > switch (getImportOrigin()) { > case FROM_ACTIVE_PLATFORM : >- resolveTargetPlatform(); >+ resolveTargetPlatform(getImportType()); > break; > case FROM_TARGET_DEFINITION : >- resolveTargetDefinition(getTargetDefinition()); >+ resolveTargetDefinition(getTargetDefinition(), getImportType()); > break; > case FROM_DIRECTORY : > resolveArbitraryLocation(getDropLocation()); >Index: src/org/eclipse/pde/ui/IBundeImportWizardPage.java >=================================================================== >RCS file: src/org/eclipse/pde/ui/IBundeImportWizardPage.java >diff -N src/org/eclipse/pde/ui/IBundeImportWizardPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/ui/IBundeImportWizardPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * 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.pde.ui; >+ >+import org.eclipse.jface.wizard.IWizardPage; >+import org.eclipse.pde.core.importing.BundleImportDescription; >+ >+/** >+ * A wizard page contributed by a <code>org.eclipse.pde.ui.bundleImportPages</code> >+ * extension. >+ * >+ * @since 3.6 >+ * >+ */ >+public interface IBundeImportWizardPage extends IWizardPage { >+ /** >+ * Called when the import wizard is closed by selecting >+ * the finish button. >+ * Implementers may store the page result (new/changed bundle >+ * import descriptions in getSelection) here. >+ * >+ * @return if the operation was successful. The wizard will only close >+ * when <code>true</code> is returned. >+ */ >+ public boolean finish(); >+ >+ /** >+ * Returns the bundle import descriptions edited or created on the page >+ * after the wizard has closed. >+ * Returns bundle import descriptions initially set using >+ * <code>setSelection</code>if the wizard has not been >+ * closed yet. >+ * >+ * @return the bundle import descriptions edited or created on the page. >+ */ >+ public BundleImportDescription[] getSelection(); >+ >+ /** >+ * Sets the bundle import descriptions to be edited on the page. >+ * The passed descriptions can be edited and should be >+ * returned in getSelection(). >+ * >+ * @param descriptions the bundle import descriptions edited on the page. >+ */ >+ public void setSelection(BundleImportDescription[] descriptions); >+} >#P org.eclipse.pde.ui.tests >Index: src/org/eclipse/pde/ui/tests/project/TestBundleImporters.java >=================================================================== >RCS file: src/org/eclipse/pde/ui/tests/project/TestBundleImporters.java >diff -N src/org/eclipse/pde/ui/tests/project/TestBundleImporters.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/pde/ui/tests/project/TestBundleImporters.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,100 @@ >+/******************************************************************************* >+ * 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.pde.ui.tests.project; >+ >+import java.util.HashMap; >+import java.util.Map; >+import junit.framework.TestCase; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.pde.core.importing.BundleImportDescription; >+import org.eclipse.pde.core.importing.IBundleImporter; >+import org.eclipse.pde.internal.core.ICoreConstants; >+import org.eclipse.pde.internal.core.project.BundleProjectService; >+ >+/** >+ * Tests for bundle importers. >+ * >+ * @since 3.6 >+ */ >+public class TestBundleImporters extends TestCase { >+ >+ /** >+ * Returns the CVS importer or <code>null</code> >+ * >+ * @return CVS importer or <code>null</code> >+ */ >+ protected IBundleImporter getCVSImporter() { >+ IBundleImporter[] importers = ((BundleProjectService)BundleProjectService.getDefault()).getBundleImporters(); >+ for (int i = 0; i < importers.length; i++) { >+ if (importers[i].getId().equals("org.eclipse.pde.core.cvs.importer")) { >+ return importers[i]; >+ } >+ } >+ return null; >+ } >+ >+ /** >+ * Tests that a project can be created from a reference with no tag or project attributes. >+ * >+ * @throws CoreException >+ */ >+ public void testProjectSCMURL() throws CoreException { >+ IBundleImporter handler = getCVSImporter(); >+ assertNotNull("Missing CVS source reference handler", handler); >+ >+ String header = "scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt:org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.publisher"; >+ Map manifest = new HashMap(); >+ manifest.put(ICoreConstants.ECLIPSE_SOURCE_REFERENCES, header); >+ BundleImportDescription[] descriptions = handler.validateImport(new Map[]{manifest}); >+ handler.performImport(descriptions, null); >+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.equinox.p2.publisher"); >+ assertTrue("Project was not created", project.exists()); >+ } >+ >+ /** >+ * Tests that a project can be created from a reference with a tag attribute. >+ * >+ * @throws CoreException >+ */ >+ public void testProjectSCMURLwithTag() throws CoreException { >+ IBundleImporter handler = getCVSImporter(); >+ assertNotNull("Missing CVS source reference handler", handler); >+ >+ String header = "scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt:org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.publisher;tag=v20100215;project=one.two.three"; >+ Map manifest = new HashMap(); >+ manifest.put(ICoreConstants.ECLIPSE_SOURCE_REFERENCES, header); >+ BundleImportDescription[] descriptions = handler.validateImport(new Map[]{manifest}); >+ handler.performImport(descriptions, null); >+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("one.two.three"); >+ assertTrue("Project was not created", project.exists()); >+ } >+ >+ /** >+ * Tests that a project can be created from a reference with a project attribute. >+ * >+ * @throws CoreException >+ */ >+ public void testProjectSCMURLwithProject() throws CoreException { >+ IBundleImporter handler = getCVSImporter(); >+ assertNotNull("Missing CVS source reference handler", handler); >+ >+ String header = "scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt:org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.publisher;project=a.b.c"; >+ Map manifest = new HashMap(); >+ manifest.put(ICoreConstants.ECLIPSE_SOURCE_REFERENCES, header); >+ BundleImportDescription[] descriptions = handler.validateImport(new Map[]{manifest}); >+ handler.performImport(descriptions, null); >+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("a.b.c"); >+ assertTrue("Project was not created", project.exists()); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 195729
:
73261
|
160522
|
160533
|
160644
|
160671
|
165142
|
165144