summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (Ericsson)2012-11-27 10:41:54 (EST)
committerPascal Rapicault2012-11-27 11:10:11 (EST)
commit5f1e6d32abe31758d61924ab19d05dc78c8ef947 (patch)
tree929c005731d6f3b90cb604161a3b00ec78b19f8e
parentef6f9ae88e4a192e9f53f017db0e8a697b438e19 (diff)
downloadrt.equinox.p2-5f1e6d32abe31758d61924ab19d05dc78c8ef947.zip
rt.equinox.p2-5f1e6d32abe31758d61924ab19d05dc78c8ef947.tar.gz
rt.equinox.p2-5f1e6d32abe31758d61924ab19d05dc78c8ef947.tar.bz2
Bug 387115 - [import/export] Enable "Import->Install->Install Software Items from File" without explicit locationsv20121127-161011
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java30
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF2
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/P2ImportExport.java3
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/Constants.java3
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java64
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java19
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java12
-rwxr-xr-xbundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FWriter.java20
11 files changed, 126 insertions, 51 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
index 616116f..bc3401e 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportRemoteTests.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 WindRiver 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:
+ * WindRiver Corporation - initial API and implementation
+ *******************************************************************************/
package org.eclipse.equinox.p2.tests.importexport;
import java.io.*;
@@ -55,7 +65,7 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
assertNotNull("Fail to load remote repo", repo);
IInstallableUnit iu = AbstractProvisioningTest.createIU("A", Version.create("1.0.0"));
OutputStream output = new FileOutputStream(testFile);
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
assertTrue("Not expected return result.", status.isOK());
output.close();
InputStream input = new FileInputStream(testFile);
@@ -101,7 +111,7 @@ public class ImportExportRemoteTests extends ServerBasedTestCase {
assertNotNull("Fail to load remote repo", repo);
IInstallableUnit iu = AbstractProvisioningTest.createIU("A", Version.create("1.0.0"));
OutputStream output = new FileOutputStream(testFile);
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
assertTrue("Not expected return result.", status.isOK());
output.close();
InputStream input = new FileInputStream(testFile);
diff --git a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
index b6ae1a5..12f4c3b 100644
--- a/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests.ui/src/org/eclipse/equinox/p2/tests/importexport/ImportExportTests.java
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2011 WindRiver 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:
+ * WindRiver Corporation - initial API and implementation
+ * Ericsson AB (Pascal Rapicault) - Bug 387115 - Allow to export everything
+ *******************************************************************************/
package org.eclipse.equinox.p2.tests.importexport;
import java.io.*;
@@ -102,7 +113,7 @@ public class ImportExportTests extends AbstractProvisioningTest {
assertNotNull("Fail to load local repo", repo);
IInstallableUnit iu = createIU("A", Version.create("1.0.0"));
OutputStream output = new FileOutputStream(testFile);
- IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, null);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, false, null);
assertFalse("Not expected return result.", status.isOK());
assertTrue("Should be a multiple status", status.isMultiStatus());
boolean hasFeaturesIgnored = false;
@@ -115,4 +126,21 @@ public class ImportExportTests extends AbstractProvisioningTest {
testFile.delete();
}
}
+
+ public void testAllowExportFeaturesInstalledFromLocal() throws ProvisionException, OperationCanceledException, IOException {
+ File testFile = File.createTempFile("test", "p2f");
+ try {
+ IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) getAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
+ File localRepoFile = getTestData("Error load data", "testData/importexport/repo1");
+ IMetadataRepository repo = metaManager.loadRepository(localRepoFile.toURI(), null);
+ assertNotNull("Fail to load local repo", repo);
+ IInstallableUnit iu = createIU("A", Version.create("1.0.0"));
+ OutputStream output = new FileOutputStream(testFile);
+ IStatus status = importexportService.exportP2F(output, new IInstallableUnit[] {iu}, true, null);
+ assertTrue(status.isOK());
+ output.close();
+ } finally {
+ testFile.delete();
+ }
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF
index 2f1170d..16c4a3c 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.ui.importexport;singleton:=true
-Bundle-Version: 1.0.1.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/P2ImportExport.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/P2ImportExport.java
index 1c19bb4..5821f00 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/P2ImportExport.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/P2ImportExport.java
@@ -7,6 +7,7 @@
*
* Contributors:
* WindRiver Corporation - initial API and implementation
+ * Ericsson AB (Pascal Rapicault) - Bug 387115 - Allow to export everything
*******************************************************************************/
package org.eclipse.equinox.internal.p2.importexport;
@@ -26,7 +27,7 @@ public interface P2ImportExport {
*/
List<IUDetail> importP2F(InputStream input) throws IOException;
- IStatus exportP2F(OutputStream output, IInstallableUnit[] ius, IProgressMonitor monitor);
+ IStatus exportP2F(OutputStream output, IInstallableUnit[] ius, boolean allowEntriesWithoutRepo, IProgressMonitor monitor);
IStatus exportP2F(OutputStream output, List<IUDetail> ius, IProgressMonitor monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/Constants.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/Constants.java
index 558afa1..ca4eb72 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/Constants.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/Constants.java
@@ -7,9 +7,12 @@
*
* Contributors:
* WindRiver Corporation - initial API and implementation
+ * Ericsson AB (Pascal Rapicault) - Bug 387115 - Allow to export everything
*******************************************************************************/
package org.eclipse.equinox.internal.p2.importexport.internal;
public interface Constants {
public final static String Bundle_ID = "org.eclipse.equinox.p2.ui.importexport"; //$NON-NLS-1$
+
+ public final static String PREF_IU_WITHOUT_REPO = "allowIUWithoutRepository"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java
index accbfa7..1c268fc 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/ImportExportImpl.java
@@ -31,7 +31,6 @@ import org.eclipse.osgi.util.NLS;
public class ImportExportImpl implements P2ImportExport {
- private static final String SCHEME_FILE = "file"; //$NON-NLS-1$
public static final int IGNORE_LOCAL_REPOSITORY = 1;
public static final int CANNOT_FIND_REPOSITORY = 2;
@@ -53,26 +52,14 @@ public class ImportExportImpl implements P2ImportExport {
return parser.getIUs();
}
- public IStatus exportP2F(OutputStream output, IInstallableUnit[] ius, IProgressMonitor monitor) {
+ public IStatus exportP2F(OutputStream output, IInstallableUnit[] ius, boolean allowEntriesWithoutRepo, IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();
SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.Replicator_ExportJobName, 1000);
+
+ //Collect repos where the IUs are going to be searched
IMetadataRepositoryManager repoManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
- URI[] uris = repoManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL);
- Arrays.sort(uris, new Comparator<URI>() {
- public int compare(URI o1, URI o2) {
- String scheme1 = o1.getScheme();
- String scheme2 = o2.getScheme();
- if (scheme1.equals(scheme2))
- return 0;
- if (SCHEME_FILE.equals(scheme1)) {
- return 1;
- } else if (SCHEME_FILE.equals(scheme2)) {
- return -1;
- }
- return 0;
- }
- });
+ URI[] uris = repoManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_NON_LOCAL | IRepositoryManager.REPOSITORIES_NON_SYSTEM);
List<IMetadataRepository> repos = new ArrayList<IMetadataRepository>(uris.length);
for (URI uri : uris) {
try {
@@ -83,7 +70,7 @@ public class ImportExportImpl implements P2ImportExport {
}
}
subMonitor.setWorkRemaining(500);
- List<IUDetail> features = new ArrayList<IUDetail>(ius.length);
+ List<IUDetail> rootsToExport = new ArrayList<IUDetail>(ius.length);
SubMonitor sub2 = subMonitor.newChild(450, SubMonitor.SUPPRESS_ALL_LABELS);
sub2.setWorkRemaining(ius.length * 100);
MultiStatus queryRepoResult = new MultiStatus(Constants.Bundle_ID, 0, null, null);
@@ -93,34 +80,51 @@ public class ImportExportImpl implements P2ImportExport {
throw new OperationCanceledException();
SubMonitor sub3 = sub2.newChild(100);
sub3.setWorkRemaining(repos.size() * 100);
+
+ //Search for repo matching the given IU
for (IMetadataRepository repo : repos) {
- if (SCHEME_FILE.equals(repo.getLocation().getScheme()) && referredRepos.size() > 0)
- break;
IQueryResult<IInstallableUnit> result = repo.query(QueryUtil.createIUQuery(iu.getId(), new VersionRange(iu.getVersion(), true, null, true)), sub3.newChild(100));
if (!result.isEmpty())
referredRepos.add(repo.getLocation());
}
sub3.setWorkRemaining(1).worked(1);
- if (referredRepos.size() == 0) {
- queryRepoResult.add(new Status(IStatus.WARNING, Constants.Bundle_ID, CANNOT_FIND_REPOSITORY, NLS.bind(Messages.Replicator_NotFoundInRepository, iu.getProperty(IInstallableUnit.PROP_NAME, Locale.getDefault().toString())), null));
+
+ //Create object representing given IU
+ if (referredRepos.size() != 0 || (referredRepos.size() == 0 && allowEntriesWithoutRepo)) {
+ IUDetail iuToExport = new IUDetail(iu, referredRepos);
+ rootsToExport.add(iuToExport);
} else {
- if (SCHEME_FILE.equals(referredRepos.get(0).getScheme()))
+ if (isContainedInLocalRepo(iu))
queryRepoResult.add(new Status(IStatus.INFO, Constants.Bundle_ID, IGNORE_LOCAL_REPOSITORY, NLS.bind(Messages.Replicator_InstallFromLocal, iu.getProperty(IInstallableUnit.PROP_NAME, Locale.getDefault().toString())), null));
- else {
- IUDetail feature = new IUDetail(iu, referredRepos);
- features.add(feature);
- }
+ else
+ queryRepoResult.add(new Status(IStatus.WARNING, Constants.Bundle_ID, CANNOT_FIND_REPOSITORY, NLS.bind(Messages.Replicator_NotFoundInRepository, iu.getProperty(IInstallableUnit.PROP_NAME, Locale.getDefault().toString())), null));
}
}
subMonitor.setWorkRemaining(50);
- IStatus status = exportP2F(output, features, subMonitor);
+ //Serialize
+ IStatus status = exportP2F(output, rootsToExport, subMonitor);
if (status.isOK() && queryRepoResult.isOK())
return status;
MultiStatus rt = new MultiStatus(Constants.Bundle_ID, 0, new IStatus[] {queryRepoResult, status}, null, null);
return rt;
}
- public IStatus exportP2F(OutputStream output, List<IUDetail> features, IProgressMonitor monitor) {
+ private boolean isContainedInLocalRepo(IInstallableUnit iu) {
+ IMetadataRepositoryManager repoManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ URI[] uris = repoManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL | IRepositoryManager.REPOSITORIES_NON_SYSTEM);
+ for (URI uri : uris) {
+ try {
+ IMetadataRepository repo = repoManager.loadRepository(uri, null);
+ if (!repo.query(QueryUtil.createIUQuery(iu.getId(), new VersionRange(iu.getVersion(), true, null, true)), null).isEmpty())
+ return true;
+ } catch (ProvisionException e) {
+ // ignore
+ }
+ }
+ return false;
+ }
+
+ public IStatus exportP2F(OutputStream output, List<IUDetail> ius, IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();
SubMonitor sub = SubMonitor.convert(monitor, Messages.Replicator_SaveJobName, 100);
@@ -128,7 +132,7 @@ public class ImportExportImpl implements P2ImportExport {
throw new OperationCanceledException();
try {
P2FWriter writer = new P2FWriter(output, new ProcessingInstruction[] {ProcessingInstruction.makeTargetVersionInstruction(P2FConstants.P2F_ELEMENT, P2FConstants.CURRENT_VERSION)});
- writer.write(features);
+ writer.write(ius);
return Status.OK_STATUS;
} catch (UnsupportedEncodingException e) {
return new Status(IStatus.ERROR, Constants.Bundle_ID, e.getMessage(), e);
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java
index abc3e78..8a58647 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/AbstractPage.java
@@ -8,6 +8,7 @@
* Contributors:
* WindRiver Corporation - initial API and implementation
* IBM Corporation - Ongoing development
+ * Ericsson AB (Pascal Rapicault) - Bug 387115 - Allow to export everything
*******************************************************************************/
package org.eclipse.equinox.internal.p2.importexport.internal.wizard;
@@ -17,6 +18,8 @@ import java.util.List;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.equinox.internal.p2.importexport.P2ImportExport;
import org.eclipse.equinox.internal.p2.importexport.internal.Constants;
import org.eclipse.equinox.internal.p2.importexport.internal.Messages;
@@ -51,6 +54,7 @@ public abstract class AbstractPage extends WizardPage implements Listener {
protected String currentMessage;
protected Button destinationBrowseButton;
+ protected Button includeAllButton;
protected Combo destinationNameField;
protected P2ImportExport importexportService = null;
protected CheckboxTreeViewer viewer = null;
@@ -288,7 +292,7 @@ public abstract class AbstractPage extends WizardPage implements Listener {
Dialog.applyDialogFont(composite);
}
- protected void createDestinationGroup(Composite parent) {
+ protected void createDestinationGroup(Composite parent, boolean includeButton) {
Composite composite = new Composite(parent, SWT.BORDER);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
@@ -314,6 +318,19 @@ public abstract class AbstractPage extends WizardPage implements Listener {
destinationBrowseButton.setText(Messages.Page_BUTTON_BROWSER);
destinationBrowseButton.addListener(SWT.Selection, this);
destinationBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+
+ if (includeButton) {
+ includeAllButton = new Button(composite, SWT.CHECK);
+ includeAllButton.setText("Include entries that can't be found in repositories");
+ includeAllButton.setSelection(allowExportWithoutRepositoryReference());
+ GridData dataIncludeButton = new GridData();
+ dataIncludeButton.horizontalSpan = 3;
+ includeAllButton.setLayoutData(dataIncludeButton);
+ }
+ }
+
+ private boolean allowExportWithoutRepositoryReference() {
+ return Platform.getPreferencesService().getBoolean(Constants.Bundle_ID, Constants.PREF_IU_WITHOUT_REPO, false, new IScopeContext[] {DefaultScope.INSTANCE});
}
protected IUColumnConfig[] getColumnConfig() {
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java
index 401594a..7f08a67 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ExportPage.java
@@ -7,6 +7,7 @@
*
* Contributors:
* WindRiver Corporation - initial API and implementation
+ * Ericsson AB (Pascal Rapicault) - Bug 387115 - Allow to export everything
*******************************************************************************/
package org.eclipse.equinox.internal.p2.importexport.internal.wizard;
@@ -23,7 +24,6 @@ import org.eclipse.swt.widgets.*;
import org.eclipse.ui.PlatformUI;
public class ExportPage extends AbstractPage {
-
public ExportPage(String pageName) {
super(pageName);
setTitle(Messages.ExportPage_Title);
@@ -40,7 +40,7 @@ public class ExportPage extends AbstractPage {
label.setText(Messages.ExportPage_Label);
createInstallationTable(composite);
- createDestinationGroup(composite);
+ createDestinationGroup(composite, true);
}
}
@@ -52,6 +52,7 @@ public class ExportPage extends AbstractPage {
// about to invoke the operation so save our state
saveWidgetValues();
final Object[] checked = viewer.getCheckedElements();
+ final boolean includeAllEntries = includeAllButton.getSelection();
OutputStream stream = null;
try {
File target = new File(ExportPage.this.destinationNameField.getText());
@@ -66,7 +67,7 @@ public class ExportPage extends AbstractPage {
IInstallableUnit[] units = new IInstallableUnit[checked.length];
for (int i = 0; i < units.length; i++)
units[i] = ProvUI.getAdapter(checked[i], IInstallableUnit.class);
- IStatus status = importexportService.exportP2F(out, units, monitor);
+ IStatus status = importexportService.exportP2F(out, units, includeAllEntries, monitor);
if (status.isMultiStatus()) {
final StringBuilder sb = new StringBuilder();
for (IStatus child : status.getChildren()) {
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java
index 8109af9..e607102 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportFromInstallationPage.java
@@ -7,6 +7,7 @@
*
* Contributors:
* WindRiver Corporation - initial API and implementation
+ * Ericsson AB (Pascal Rapicault) - Bug 387115 - Allow to export everything
*******************************************************************************/
package org.eclipse.equinox.internal.p2.importexport.internal.wizard;
@@ -59,7 +60,7 @@ public class ImportFromInstallationPage extends AbstractImportPage implements IS
@Override
protected void createContents(Composite composite) {
- createDestinationGroup(composite);
+ createDestinationGroup(composite, true);
createInstallationTable(composite);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java
index c673b44..ad546c0 100644
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/internal/wizard/ImportPage.java
@@ -8,6 +8,7 @@
* Contributors:
* WindRiver Corporation - initial API and implementation
* IBM Corporation - Ongoing development
+ * Ericsson AB (Pascal Rapicault) - Bug 387115 - Allow to export everything
*******************************************************************************/
package org.eclipse.equinox.internal.p2.importexport.internal.wizard;
@@ -204,7 +205,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
@Override
protected void createContents(Composite composite) {
- createDestinationGroup(composite);
+ createDestinationGroup(composite, false);
createInstallationTable(composite);
createAdditionOptions(composite);
}
@@ -283,6 +284,7 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
try {
input = new BufferedInputStream(new FileInputStream(getDestinationValue()));
features = importexportService.importP2F(input);
+ contactAll.setSelection(hasEntriesWithoutRepo());
viewer.setInput(features.toArray(new IUDetail[features.size()]));
input.close();
} catch (VersionIncompatibleException e) {
@@ -296,6 +298,14 @@ public class ImportPage extends AbstractImportPage implements ISelectableIUsPage
viewer.setInput(null);
}
+ private boolean hasEntriesWithoutRepo() {
+ for (IUDetail entry : features) {
+ if (entry.getReferencedRepositories().size() == 0)
+ return true;
+ }
+ return false;
+ }
+
@Override
protected void setDestinationValue(String selectedFileName) {
oldDestination = getDestinationValue();
diff --git a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FWriter.java b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FWriter.java
index 13c5dc6..021dc52 100755
--- a/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FWriter.java
+++ b/bundles/org.eclipse.equinox.p2.ui.importexport/src/org/eclipse/equinox/internal/p2/importexport/persistence/P2FWriter.java
@@ -26,31 +26,31 @@ public class P2FWriter extends XMLWriter implements P2FConstants {
super(output, piElements);
}
- public void write(List<IUDetail> features) {
+ public void write(List<IUDetail> ius) {
start(P2F_ELEMENT);
attribute(VERSION_ATTRIBUTE, CURRENT_VERSION);
- writeFeatures(features);
+ writeIUs(ius);
end(P2F_ELEMENT);
flush();
}
- private void writeFeatures(List<IUDetail> features) {
+ private void writeIUs(List<IUDetail> ius) {
start(IUS_ELEMENT);
- attributeOptional(COLLECTION_SIZE_ATTRIBUTE, String.valueOf(features.size()));
- for (IUDetail feature : features)
- writeFeature(feature);
+ attributeOptional(COLLECTION_SIZE_ATTRIBUTE, String.valueOf(ius.size()));
+ for (IUDetail iu : ius)
+ writeIU(iu);
end(IUS_ELEMENT);
}
- private void writeFeature(IUDetail feature) {
- IInstallableUnit unit = feature.getIU();
+ private void writeIU(IUDetail iu) {
+ IInstallableUnit unit = iu.getIU();
start(IU_ELEMENT);
attribute(ID_ATTRIBUTE, unit.getId());
attribute(NAME_ATTRIBUTE, unit.getProperty(IInstallableUnit.PROP_NAME, Locale.getDefault().toString()));
attribute(VERSION_ATTRIBUTE, unit.getVersion().toString());
start(REPOSITORIES_ELEMENT);
- attribute(COLLECTION_SIZE_ATTRIBUTE, feature.getReferencedRepositories().size());
- for (URI uri : feature.getReferencedRepositories()) {
+ attribute(COLLECTION_SIZE_ATTRIBUTE, iu.getReferencedRepositories().size());
+ for (URI uri : iu.getReferencedRepositories()) {
start(REPOSITORY_ELEMENT);
String unencoded = URIUtil.toUnencodedString(uri);
attribute(LOCATION_ELEMENT, unencoded);