Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2015-06-01 07:22:38 -0400
committerEd Merks2015-06-01 07:22:38 -0400
commit2549be6056a7ff9f36d677dd608a349f3566543e (patch)
tree850c74a111538d148ff94b7a96176f2bd902726c
parentc483f6c4ccad12436dab3f049b0a39c9cc81f071 (diff)
downloadorg.eclipse.oomph-2549be6056a7ff9f36d677dd608a349f3566543e.tar.gz
org.eclipse.oomph-2549be6056a7ff9f36d677dd608a349f3566543e.tar.xz
org.eclipse.oomph-2549be6056a7ff9f36d677dd608a349f3566543e.zip
[468959] Support an extensible product catalog
https://bugs.eclipse.org/bugs/show_bug.cgi?id=468959
-rw-r--r--features/org.eclipse.oomph.setup.installer-feature/feature.xml32
-rw-r--r--plugins/org.eclipse.oomph.p2.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.oomph.p2.core/src/org/eclipse/oomph/p2/core/P2Util.java121
-rw-r--r--plugins/org.eclipse.oomph.p2.tests/META-INF/MANIFEST.MF7
-rw-r--r--plugins/org.eclipse.oomph.p2.tests/src/org/eclipse/oomph/p2/tests/AbstractP2Test.java125
-rw-r--r--plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/AbstractSetupTaskContext.java61
-rw-r--r--plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupContext.java21
-rw-r--r--plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/UserURIHandlerImpl.java76
-rw-r--r--plugins/org.eclipse.oomph.setup.p2/src/org/eclipse/oomph/setup/p2/impl/P2TaskImpl.java4
-rw-r--r--plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/CatalogSelector.java12
-rw-r--r--plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProductPage.java712
-rw-r--r--plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProgressPage.java8
-rw-r--r--plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProjectPage.java49
-rw-r--r--plugins/org.eclipse.oomph.setup/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/SetupTaskContext.java2
-rw-r--r--plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/EclipseIniTaskImpl.java18
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java35
-rw-r--r--products/org.eclipse.oomph.setup.installer.product/Installer.product8
-rw-r--r--products/org.eclipse.oomph.setup.installer.product/pom.xml8
-rw-r--r--setups/OomphInstaller.setup27
20 files changed, 1074 insertions, 257 deletions
diff --git a/features/org.eclipse.oomph.setup.installer-feature/feature.xml b/features/org.eclipse.oomph.setup.installer-feature/feature.xml
index d4ec5456c..fd743b227 100644
--- a/features/org.eclipse.oomph.setup.installer-feature/feature.xml
+++ b/features/org.eclipse.oomph.setup.installer-feature/feature.xml
@@ -36,6 +36,38 @@
id="org.eclipse.oomph.p2"
version="0.0.0"/>
+ <includes
+ id="org.eclipse.ecf.core.feature"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.emf.common"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.emf.common.ui"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.emf.ecore"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.emf.edit"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.emf.edit.ui"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.rcp"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.equinox.p2.core.feature"
+ version="0.0.0"/>
+
<plugin
id="org.eclipse.oomph.setup"
download-size="0"
diff --git a/plugins/org.eclipse.oomph.p2.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.oomph.p2.core/META-INF/MANIFEST.MF
index 50de0f56f..d40bc33db 100644
--- a/plugins/org.eclipse.oomph.p2.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.oomph.p2.core/META-INF/MANIFEST.MF
@@ -11,14 +11,13 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.oomph.p2.core;version="1.1.0";x-internal:=true,
org.eclipse.oomph.p2.internal.core;version="1.1.0";x-internal:=true
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.core.variables;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.core.variables;bundle-version="[3.0.0,4.0.0)";resolution:=optional,
org.eclipse.emf.ecore.xmi;bundle-version="[2.10.0,3.0.0)",
org.eclipse.equinox.p2.core;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.engine;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.metadata;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.metadata.repository;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.repository;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
- org.eclipse.equinox.p2.repository.tools;bundle-version="[2.0.0,3.0.0)",
org.eclipse.equinox.p2.artifact.repository;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.director;bundle-version="[2.0.0,3.0.0)",
org.eclipse.equinox.p2.operations;bundle-version="[2.0.0,3.0.0)",
diff --git a/plugins/org.eclipse.oomph.p2.core/src/org/eclipse/oomph/p2/core/P2Util.java b/plugins/org.eclipse.oomph.p2.core/src/org/eclipse/oomph/p2/core/P2Util.java
index 52d064902..7083ae43f 100644
--- a/plugins/org.eclipse.oomph.p2.core/src/org/eclipse/oomph/p2/core/P2Util.java
+++ b/plugins/org.eclipse.oomph.p2.core/src/org/eclipse/oomph/p2/core/P2Util.java
@@ -12,16 +12,10 @@ package org.eclipse.oomph.p2.core;
import org.eclipse.oomph.p2.internal.core.AgentImpl;
import org.eclipse.oomph.p2.internal.core.AgentManagerImpl;
-import org.eclipse.oomph.p2.internal.core.P2CorePlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.p2.core.IAgentLocation;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.internal.repository.mirroring.Mirroring;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.ILicense;
@@ -33,35 +27,21 @@ import org.eclipse.equinox.p2.metadata.MetadataFactory;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.metadata.expression.IMatchExpression;
import org.eclipse.equinox.p2.query.IQueryResult;
-import org.eclipse.equinox.p2.query.QueryUtil;
-import org.eclipse.equinox.p2.repository.IRepository;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
-import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
-import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
-import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
-import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import java.io.File;
import java.net.URI;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
/**
* @author Eike Stepper
*/
-@SuppressWarnings("restriction")
public final class P2Util
{
- private static final String SIMPLE_METADATA_REPOSITORY = IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY;
-
- private static final String SIMPLE_ARTIFACT_REPOSITORY = IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY;
-
private P2Util()
{
}
@@ -120,107 +100,6 @@ public final class P2Util
};
}
- public static void mirrorRepository(URI sourceURI, URI targetURI, VersionedIdFilter filter, IProgressMonitor monitor) throws CoreException
- {
- mirrorMetadataRepository(sourceURI, targetURI, filter, monitor);
- mirrorArtifactRepository(sourceURI, targetURI, filter, monitor);
- }
-
- public static void mirrorMetadataRepository(URI sourceURI, URI targetURI, VersionedIdFilter filter, IProgressMonitor monitor) throws CoreException
- {
- List<URI> repositoriesToRemove = new ArrayList<URI>();
- repositoriesToRemove.add(targetURI);
-
- IMetadataRepositoryManager manager = getAgentManager().getCurrentAgent().getMetadataRepositoryManager();
- if (!manager.contains(sourceURI))
- {
- repositoriesToRemove.add(sourceURI);
- }
-
- try
- {
- IMetadataRepository sourceRepository = manager.loadRepository(sourceURI, 0, monitor);
- String name = sourceRepository.getName();
- if (name == null)
- {
- name = sourceURI.toString();
- }
-
- IMetadataRepository targetRepository = manager.createRepository(targetURI, name, SIMPLE_METADATA_REPOSITORY, sourceRepository.getProperties());
- targetRepository.setProperty(IRepository.PROP_COMPRESSED, "true");
-
- List<IInstallableUnit> ius = new ArrayList<IInstallableUnit>();
- for (IInstallableUnit iu : asIterable(sourceRepository.query(QueryUtil.createIUAnyQuery(), null)))
- {
- if (filter == null || filter.matches(iu))
- {
- ius.add(iu);
- }
- }
-
- targetRepository.addInstallableUnits(ius);
- }
- finally
- {
- for (URI uri : repositoriesToRemove)
- {
- manager.removeRepository(uri);
- }
- }
- }
-
- public static void mirrorArtifactRepository(URI sourceURI, URI targetURI, VersionedIdFilter filter, IProgressMonitor monitor) throws CoreException
- {
- List<URI> repositoriesToRemove = new ArrayList<URI>();
- repositoriesToRemove.add(targetURI);
-
- Agent agent = getAgentManager().getCurrentAgent();
- IArtifactRepositoryManager manager = agent.getArtifactRepositoryManager();
- if (!manager.contains(sourceURI))
- {
- repositoriesToRemove.add(sourceURI);
- }
-
- try
- {
- IArtifactRepository sourceRepository = manager.loadRepository(sourceURI, 0, monitor);
- String name = sourceRepository.getName();
- if (name == null)
- {
- name = sourceURI.toString();
- }
-
- IArtifactRepository targetRepository = manager.createRepository(targetURI, name, SIMPLE_ARTIFACT_REPOSITORY, sourceRepository.getProperties());
- targetRepository.setProperty(IRepository.PROP_COMPRESSED, "true");
-
- List<IArtifactKey> keys = new ArrayList<IArtifactKey>();
- for (IArtifactKey key : asIterable(sourceRepository.query(ArtifactKeyQuery.ALL_KEYS, null)))
- {
- if (filter == null || filter.matches(key))
- {
- keys.add(key);
- }
- }
-
- Transport transport = (Transport)agent.getProvisioningAgent().getService(Transport.SERVICE_NAME);
-
- Mirroring mirror = new Mirroring(sourceRepository, targetRepository, true);
- mirror.setCompare(false);
- mirror.setTransport(transport);
- mirror.setArtifactKeys(keys.toArray(new IArtifactKey[keys.size()]));
-
- IStatus result = mirror.run(true, false);
- P2CorePlugin.INSTANCE.coreException(result);
- }
- finally
- {
- for (URI uri : repositoriesToRemove)
- {
- manager.removeRepository(uri);
- }
- }
- }
-
@SuppressWarnings("unused")
private static InstallableUnitDescription createDescription(IInstallableUnit iu)
{
diff --git a/plugins/org.eclipse.oomph.p2.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.oomph.p2.tests/META-INF/MANIFEST.MF
index 76ed3c1c4..b6b37e00c 100644
--- a/plugins/org.eclipse.oomph.p2.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.oomph.p2.tests/META-INF/MANIFEST.MF
@@ -17,9 +17,10 @@ Require-Bundle: org.eclipse.equinox.p2.core;bundle-version="[2.0.0,3.0.0)";visib
org.eclipse.equinox.p2.touchpoint.eclipse;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.touchpoint.natives;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.director;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+ org.eclipse.equinox.p2.repository.tools;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.oomph.p2.core;bundle-version="[1.1.0,2.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.operations;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.equinox.p2.transport.ecf;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
- org.eclipse.ecf.provider.filetransfer.httpclient4;bundle-version="[1.0.0,2.0.0)";resolution:=optional;x-installation:=greedy;visibility:=reexport,
- org.eclipse.oomph.tests;bundle-version="[1.1.0,2.0.0)";visibility:=reexport,
- org.eclipse.oomph.p2.core;bundle-version="[1.1.0,2.0.0)";visibility:=reexport
+ org.eclipse.ecf.provider.filetransfer.httpclient4;bundle-version="[1.0.0,2.0.0)";resolution:=optional;visibility:=reexport;x-installation:=greedy,
+ org.eclipse.oomph.tests;bundle-version="[1.1.0,2.0.0)";visibility:=reexport
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.oomph.p2.tests/src/org/eclipse/oomph/p2/tests/AbstractP2Test.java b/plugins/org.eclipse.oomph.p2.tests/src/org/eclipse/oomph/p2/tests/AbstractP2Test.java
index e33ab1a00..aba5b6de0 100644
--- a/plugins/org.eclipse.oomph.p2.tests/src/org/eclipse/oomph/p2/tests/AbstractP2Test.java
+++ b/plugins/org.eclipse.oomph.p2.tests/src/org/eclipse/oomph/p2/tests/AbstractP2Test.java
@@ -19,20 +19,37 @@ import org.eclipse.oomph.p2.core.P2Util;
import org.eclipse.oomph.p2.core.P2Util.VersionedIdFilter;
import org.eclipse.oomph.p2.core.ProfileTransaction;
import org.eclipse.oomph.p2.internal.core.AgentManagerImpl;
+import org.eclipse.oomph.p2.internal.core.P2CorePlugin;
import org.eclipse.oomph.tests.AbstractTest;
import org.eclipse.oomph.util.PropertiesUtil;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.p2.repository.Transport;
+import org.eclipse.equinox.p2.internal.repository.mirroring.Mirroring;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IVersionedId;
+import org.eclipse.equinox.p2.query.QueryUtil;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.junit.BeforeClass;
import java.io.File;
import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author Eike Stepper
*/
+@SuppressWarnings("restriction")
public abstract class AbstractP2Test extends AbstractTest
{
private static final String TMP = PropertiesUtil.getProperty("java.io.tmpdir");
@@ -41,6 +58,112 @@ public abstract class AbstractP2Test extends AbstractTest
private static final String PLATFORM = "p2-test-mirror-001-platform";
+ private static final String SIMPLE_METADATA_REPOSITORY = IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY;
+
+ private static final String SIMPLE_ARTIFACT_REPOSITORY = IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY;
+
+ public static void mirrorArtifactRepository(URI sourceURI, URI targetURI, VersionedIdFilter filter, IProgressMonitor monitor) throws CoreException
+ {
+ List<URI> repositoriesToRemove = new ArrayList<URI>();
+ repositoriesToRemove.add(targetURI);
+
+ Agent agent = P2Util.getAgentManager().getCurrentAgent();
+ IArtifactRepositoryManager manager = agent.getArtifactRepositoryManager();
+ if (!manager.contains(sourceURI))
+ {
+ repositoriesToRemove.add(sourceURI);
+ }
+
+ try
+ {
+ IArtifactRepository sourceRepository = manager.loadRepository(sourceURI, 0, monitor);
+ String name = sourceRepository.getName();
+ if (name == null)
+ {
+ name = sourceURI.toString();
+ }
+
+ IArtifactRepository targetRepository = manager.createRepository(targetURI, name, SIMPLE_ARTIFACT_REPOSITORY, sourceRepository.getProperties());
+ targetRepository.setProperty(IRepository.PROP_COMPRESSED, "true");
+
+ List<IArtifactKey> keys = new ArrayList<IArtifactKey>();
+ for (IArtifactKey key : P2Util.asIterable(sourceRepository.query(ArtifactKeyQuery.ALL_KEYS, null)))
+ {
+ if (filter == null || filter.matches(key))
+ {
+ keys.add(key);
+ }
+ }
+
+ Transport transport = (Transport)agent.getProvisioningAgent().getService(Transport.SERVICE_NAME);
+
+ Mirroring mirror = new Mirroring(sourceRepository, targetRepository, true);
+ mirror.setCompare(false);
+ mirror.setTransport(transport);
+ mirror.setArtifactKeys(keys.toArray(new IArtifactKey[keys.size()]));
+
+ IStatus result = mirror.run(true, false);
+ P2CorePlugin.INSTANCE.coreException(result);
+ }
+ finally
+ {
+ for (URI uri : repositoriesToRemove)
+ {
+ manager.removeRepository(uri);
+ }
+ }
+ }
+
+ public static void mirrorRepository(URI sourceURI, URI targetURI, VersionedIdFilter filter, IProgressMonitor monitor) throws CoreException
+
+ {
+ mirrorMetadataRepository(sourceURI, targetURI, filter, monitor);
+ mirrorArtifactRepository(sourceURI, targetURI, filter, monitor);
+ }
+
+ public static void mirrorMetadataRepository(URI sourceURI, URI targetURI, VersionedIdFilter filter, IProgressMonitor monitor) throws CoreException
+ {
+ List<URI> repositoriesToRemove = new ArrayList<URI>();
+ repositoriesToRemove.add(targetURI);
+
+ IMetadataRepositoryManager manager = P2Util.getAgentManager().getCurrentAgent().getMetadataRepositoryManager();
+ if (!manager.contains(sourceURI))
+ {
+ repositoriesToRemove.add(sourceURI);
+ }
+
+ try
+ {
+ IMetadataRepository sourceRepository = manager.loadRepository(sourceURI, 0, monitor);
+ String name = sourceRepository.getName();
+ if (name == null)
+ {
+ name = sourceURI.toString();
+ }
+
+ IMetadataRepository targetRepository = manager.createRepository(targetURI, name, SIMPLE_METADATA_REPOSITORY, sourceRepository.getProperties());
+ targetRepository.setProperty(IRepository.PROP_COMPRESSED, "true");
+
+ List<IInstallableUnit> ius = new ArrayList<IInstallableUnit>();
+ for (IInstallableUnit iu : P2Util.asIterable(sourceRepository.query(QueryUtil.createIUAnyQuery(), null)))
+ {
+ if (filter == null || filter.matches(iu))
+ {
+ ius.add(iu);
+ }
+ }
+
+ targetRepository.addInstallableUnits(ius);
+ }
+ finally
+ {
+ for (URI uri : repositoriesToRemove)
+ {
+ manager.removeRepository(uri);
+ }
+ }
+ }
+
private static final VersionedIdFilter CDO_FILTER = new VersionedIdFilter()
{
public boolean matches(IVersionedId versionedId)
@@ -81,7 +204,7 @@ public abstract class AbstractP2Test extends AbstractTest
if (!local.isDirectory())
{
LOGGER.setTaskName("Creating test mirror of " + repo + " under " + local);
- P2Util.mirrorRepository(new URI(repo), local.toURI(), filter, LOGGER);
+ mirrorRepository(new URI(repo), local.toURI(), filter, LOGGER);
LOGGER.setTaskName(null);
}
}
diff --git a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/AbstractSetupTaskContext.java b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/AbstractSetupTaskContext.java
index e053aa7fd..68b47a4aa 100644
--- a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/AbstractSetupTaskContext.java
+++ b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/AbstractSetupTaskContext.java
@@ -14,6 +14,7 @@ package org.eclipse.oomph.setup.internal.core;
import org.eclipse.oomph.internal.setup.SetupPrompter;
import org.eclipse.oomph.internal.setup.SetupProperties;
+import org.eclipse.oomph.p2.core.P2Util;
import org.eclipse.oomph.setup.Installation;
import org.eclipse.oomph.setup.SetupTaskContext;
import org.eclipse.oomph.setup.Trigger;
@@ -28,15 +29,24 @@ import org.eclipse.oomph.util.StringUtil;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.ITouchpointData;
+import org.eclipse.equinox.p2.metadata.ITouchpointInstruction;
+import org.eclipse.equinox.p2.query.QueryUtil;
import java.io.File;
import java.io.IOException;
+import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* @author Eike Stepper
@@ -45,6 +55,8 @@ public abstract class AbstractSetupTaskContext extends StringExpander implements
{
private static final Map<String, StringFilter> STRING_FILTER_REGISTRY = new HashMap<String, StringFilter>();
+ private static final Pattern setLauncherNamePattern = Pattern.compile("setLauncherName\\(name:([^)]*)\\)");
+
private SetupPrompter prompter;
private Trigger trigger;
@@ -61,6 +73,8 @@ public abstract class AbstractSetupTaskContext extends StringExpander implements
private Map<Object, Object> map = new LinkedHashMap<Object, Object>();
+ private String launcherName;
+
protected AbstractSetupTaskContext(URIConverter uriConverter, SetupPrompter prompter, Trigger trigger, SetupContext setupContext)
{
this.uriConverter = uriConverter;
@@ -227,6 +241,53 @@ public abstract class AbstractSetupTaskContext extends StringExpander implements
return new File(productLocation, InstallationTaskImpl.CONFIGURATION_FOLDER_NAME);
}
+ public String getLauncherName()
+ {
+ if (launcherName == null)
+ {
+ IProfile profile = (IProfile)get(IProfile.class);
+ if (profile == null)
+ {
+ profile = P2Util.getAgentManager().getCurrentAgent().getCurrentProfile();
+ }
+
+ launcherName = getLauncherName(profile);
+ }
+
+ return launcherName;
+ }
+
+ private static String getLauncherName(IProfile profile)
+ {
+ for (IInstallableUnit iu : P2Util.asIterable(profile.query(QueryUtil.createIUAnyQuery(), null)))
+ {
+ Collection<ITouchpointData> touchpointDatas = iu.getTouchpointData();
+ if (touchpointDatas != null)
+ {
+ for (ITouchpointData touchpointData : touchpointDatas)
+ {
+ ITouchpointInstruction instruction = touchpointData.getInstruction("configure");
+ if (instruction != null)
+ {
+ String body = instruction.getBody();
+ if (body != null)
+ {
+ Matcher matcher = setLauncherNamePattern.matcher(body);
+ if (matcher.matches())
+ {
+ return matcher.group(1);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ SetupCorePlugin.INSTANCE.log("Could not determine the launcher name from " + profile.getProfileId(), IStatus.ERROR);
+
+ return "eclipse";
+ }
+
public Workspace getWorkspace()
{
return setupContext.getWorkspace();
diff --git a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupContext.java b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupContext.java
index 636b8dc50..677154012 100644
--- a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupContext.java
+++ b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupContext.java
@@ -213,8 +213,14 @@ public class SetupContext
URI uri = installation.eResource().getURI();
if (uri.segmentCount() > 3)
{
- URI executable = uri.trimSegments(3).appendSegments(URI.createURI(OS.INSTANCE.getEclipseExecutable()).segments());
- if (resourceSet.getURIConverter().exists(executable, null))
+ String eclipseLauncher = PropertiesUtil.getProperty("eclipse.launcher");
+ if (eclipseLauncher == null)
+ {
+ throw new IllegalStateException("There is no eclipse.launcher property defined");
+ }
+
+ File eclipseLauncherExecutable = new File(eclipseLauncher);
+ if (eclipseLauncherExecutable.exists())
{
effectiveInstallation = installation;
}
@@ -754,8 +760,15 @@ public class SetupContext
{
private static URI getStaticWorkspaceLocationURI()
{
- IWorkspaceRoot workspaceRoot = EcorePlugin.getWorkspaceRoot();
- return URI.createFileURI(workspaceRoot.getLocation().toOSString());
+ try
+ {
+ IWorkspaceRoot workspaceRoot = EcorePlugin.getWorkspaceRoot();
+ return URI.createFileURI(workspaceRoot.getLocation().toOSString());
+ }
+ catch (Throwable throwable)
+ {
+ return null;
+ }
}
}
}
diff --git a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/UserURIHandlerImpl.java b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/UserURIHandlerImpl.java
index 418df730e..a687933c9 100644
--- a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/UserURIHandlerImpl.java
+++ b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/UserURIHandlerImpl.java
@@ -10,16 +10,25 @@
*/
package org.eclipse.oomph.setup.internal.core.util;
-import org.eclipse.oomph.setup.Project;
+import org.eclipse.oomph.setup.InstallationTask;
+import org.eclipse.oomph.setup.ProductCatalog;
import org.eclipse.oomph.setup.SetupFactory;
+import org.eclipse.oomph.setup.SetupPackage;
+import org.eclipse.oomph.setup.SetupTask;
import org.eclipse.oomph.setup.User;
import org.eclipse.oomph.setup.internal.core.SetupContext;
import org.eclipse.oomph.setup.internal.core.SetupCorePlugin;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.resource.impl.URIHandlerImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
import java.io.IOException;
import java.io.InputStream;
@@ -33,11 +42,9 @@ import java.util.regex.Pattern;
*/
public class UserURIHandlerImpl extends URIHandlerImpl
{
- private static final Pattern NAME_PATTERN = Pattern.compile("name='([^']*)'");
+ private static final String FEATURE_PATTERN_SUFFIX = "='([^']*)'";
- private static final Pattern LABEL_PATTERN = Pattern.compile("label='([^']*)'");
-
- private static final Pattern DESCRIPTION_PATTERN = Pattern.compile("description='([^']*)'");
+ private static final Pattern CLASS_PATTERN = Pattern.compile("class" + FEATURE_PATTERN_SUFFIX);
public UserURIHandlerImpl()
{
@@ -130,20 +137,55 @@ public class UserURIHandlerImpl extends URIHandlerImpl
String query = uri.query();
if (query != null)
{
- Project project = SetupFactory.eINSTANCE.createProject();
+ Resource resource = SetupCoreUtil.createResourceSet().createResource(normalizedURI);
+
String decodedQuery = URI.decode(query);
- Matcher nameMatcher = NAME_PATTERN.matcher(decodedQuery);
- nameMatcher.find();
- project.setName(nameMatcher.group(1));
- Matcher labelMatcher = LABEL_PATTERN.matcher(decodedQuery);
- labelMatcher.find();
- project.setLabel(labelMatcher.group(1));
- Matcher descriptionMatcher = DESCRIPTION_PATTERN.matcher(decodedQuery);
- descriptionMatcher.find();
- project.setDescription(descriptionMatcher.group(1));
- Resource resource = SetupCoreUtil.createResourceSet().createResource(normalizedURI);
- resource.getContents().add(project);
+ Matcher classMatcher = CLASS_PATTERN.matcher(decodedQuery);
+ URI classURI = URI.createURI(classMatcher.find() ? classMatcher.group(1) : SetupPackage.eNS_URI + "#//Project");
+
+ EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(classURI.trimFragment().toString());
+ if (ePackage == null)
+ {
+ throw new IllegalArgumentException("No package registered for " + classURI);
+ }
+
+ EObject eObject = ePackage.eResource().getEObject(classURI.fragment());
+ if (eObject instanceof EClass)
+ {
+ EClass eClass = (EClass)eObject;
+ EObject instance = EcoreUtil.create(eClass);
+
+ for (EAttribute eAttribute : eClass.getEAllAttributes())
+ {
+ if (!eAttribute.isMany())
+ {
+ Pattern pattern = Pattern.compile(eAttribute.getName() + FEATURE_PATTERN_SUFFIX);
+ Matcher matcher = pattern.matcher(decodedQuery);
+ if (matcher.find())
+ {
+ String value = matcher.group(1);
+ instance.eSet(eAttribute, EcoreUtil.createFromString(eAttribute.getEAttributeType(), value));
+ }
+ }
+ }
+
+ if (instance instanceof ProductCatalog)
+ {
+ ProductCatalog productCatalog = (ProductCatalog)instance;
+ EList<SetupTask> setupTasks = productCatalog.getSetupTasks();
+ InstallationTask installationTask = SetupFactory.eINSTANCE.createInstallationTask();
+ installationTask.setID("installation");
+ setupTasks.add(installationTask);
+ }
+
+ resource.getContents().add(instance);
+ }
+ else
+ {
+ throw new IllegalArgumentException("No class registered for " + classURI);
+ }
+
return saveResource(resource);
}
diff --git a/plugins/org.eclipse.oomph.setup.p2/src/org/eclipse/oomph/setup/p2/impl/P2TaskImpl.java b/plugins/org.eclipse.oomph.setup.p2/src/org/eclipse/oomph/setup/p2/impl/P2TaskImpl.java
index 0608ec556..d07357b37 100644
--- a/plugins/org.eclipse.oomph.setup.p2/src/org/eclipse/oomph/setup/p2/impl/P2TaskImpl.java
+++ b/plugins/org.eclipse.oomph.setup.p2/src/org/eclipse/oomph/setup/p2/impl/P2TaskImpl.java
@@ -713,6 +713,10 @@ public class P2TaskImpl extends SetupTaskImpl implements P2Task
context.log("No software updates are available");
}
}
+ else
+ {
+ context.put(IProfile.class, profile);
+ }
}
finally
{
diff --git a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/CatalogSelector.java b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/CatalogSelector.java
index af373ea0b..596479246 100644
--- a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/CatalogSelector.java
+++ b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/CatalogSelector.java
@@ -60,6 +60,16 @@ public class CatalogSelector
return catalogManager.getSelectedCatalogs(product);
}
+ public List<? extends Scope> getCatalogs()
+ {
+ return catalogManager.getCatalogs(product);
+ }
+
+ public void select(Scope catalog, boolean on)
+ {
+ catalogManager.selectCatalog(product, catalog, on);
+ }
+
public void configure(final ToolItem toolItem)
{
final ToolBar toolBar = toolItem.getParent();
@@ -98,7 +108,7 @@ public class CatalogSelector
public void widgetSelected(SelectionEvent e)
{
boolean on = item.getSelection();
- catalogManager.selectCatalog(product, catalog, on);
+ select(catalog, on);
}
});
}
diff --git a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProductPage.java b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProductPage.java
index 3ff9cf315..0cff8a4fc 100644
--- a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProductPage.java
+++ b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProductPage.java
@@ -12,6 +12,8 @@ package org.eclipse.oomph.setup.ui.wizards;
import org.eclipse.oomph.base.Annotation;
import org.eclipse.oomph.base.provider.BaseEditUtil;
+import org.eclipse.oomph.base.util.BaseResource;
+import org.eclipse.oomph.base.util.BaseUtil;
import org.eclipse.oomph.internal.ui.AccessUtil;
import org.eclipse.oomph.jreinfo.JRE;
import org.eclipse.oomph.jreinfo.JREManager;
@@ -27,11 +29,14 @@ import org.eclipse.oomph.p2.internal.ui.P2UIPlugin;
import org.eclipse.oomph.setup.AnnotationConstants;
import org.eclipse.oomph.setup.CatalogSelection;
import org.eclipse.oomph.setup.Product;
+import org.eclipse.oomph.setup.ProductCatalog;
import org.eclipse.oomph.setup.ProductVersion;
+import org.eclipse.oomph.setup.Scope;
import org.eclipse.oomph.setup.SetupFactory;
import org.eclipse.oomph.setup.SetupPackage;
import org.eclipse.oomph.setup.internal.core.SetupContext;
import org.eclipse.oomph.setup.internal.core.util.CatalogManager;
+import org.eclipse.oomph.setup.internal.core.util.SetupCoreUtil;
import org.eclipse.oomph.setup.provider.CatalogSelectionItemProvider;
import org.eclipse.oomph.setup.provider.IndexItemProvider;
import org.eclipse.oomph.setup.provider.InstallationItemProvider;
@@ -51,21 +56,44 @@ import org.eclipse.oomph.util.OomphPlugin.BundleFile;
import org.eclipse.oomph.util.PropertiesUtil;
import org.eclipse.oomph.util.StringUtil;
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.ui.dialogs.ResourceDialog;
+import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.EMap;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.UniqueEList;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.command.DragAndDropCommand;
+import org.eclipse.emf.edit.command.DragAndDropFeedback;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
+import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -76,20 +104,30 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.LocationAdapter;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.dnd.URLTransfer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Tree;
@@ -98,7 +136,11 @@ import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Set;
/**
* @author Eike Stepper
@@ -170,12 +212,27 @@ public class ProductPage extends SetupWizardPage
BaseEditUtil.replaceReflectiveItemProvider(adapterFactory);
ResourceSet resourceSet = getResourceSet();
- resourceSet.eAdapters().add(new AdapterFactoryEditingDomain.EditingDomainProvider(new AdapterFactoryEditingDomain(adapterFactory, null, resourceSet)));
+ final AdapterFactoryEditingDomain editingDomain = new AdapterFactoryEditingDomain(adapterFactory, new BasicCommandStack()
+ {
+ @Override
+ public void execute(Command command)
+ {
+ super.execute(command);
+ final Collection<?> affectedObjects = command.getAffectedObjects();
+ UIUtil.asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ productViewer.setSelection(new StructuredSelection(affectedObjects.toArray()), true);
+ }
+ });
+ }
+ }, resourceSet);
Composite mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayout(UIUtil.createGridLayout(1));
- Control productSash = createProductSash(mainComposite);
+ Control productSash = createProductSash(mainComposite, editingDomain);
productSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Composite lowerComposite = new Composite(mainComposite, SWT.NONE);
@@ -402,7 +459,7 @@ public class ProductPage extends SetupWizardPage
return mainComposite;
}
- private SashForm createProductSash(Composite composite)
+ private SashForm createProductSash(Composite composite, final AdapterFactoryEditingDomain editingDomain)
{
SashForm sashForm = new SashForm(composite, SWT.SMOOTH | SWT.VERTICAL);
@@ -422,6 +479,53 @@ public class ProductPage extends SetupWizardPage
ToolBar filterToolBar = new ToolBar(filterComposite, SWT.FLAT | SWT.RIGHT);
+ final ToolItem addProductButton = new ToolItem(filterToolBar, SWT.NONE);
+ addProductButton.setToolTipText("Add user products");
+ addProductButton.setImage(SetupUIPlugin.INSTANCE.getSWTImage("add_project"));
+ addProductButton.setEnabled(false);
+ AccessUtil.setKey(addProductButton, "addProduct");
+
+ final Set<ProductCatalog> userProductCatalogs = new HashSet<ProductCatalog>();
+ addProductButton.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ ResourceDialog dialog = new AddUserProductDialog(getShell(), userProductCatalogs, catalogSelector, editingDomain);
+ dialog.open();
+ }
+ });
+
+ final ToolItem removeProductButton = new ToolItem(filterToolBar, SWT.NONE);
+ removeProductButton.setToolTipText("Remove the selected user products");
+ removeProductButton.setImage(SetupUIPlugin.INSTANCE.getSWTImage("remove_project"));
+ removeProductButton.setEnabled(false);
+ AccessUtil.setKey(removeProductButton, "removeProduct");
+
+ final List<Product> userProducts = new ArrayList<Product>();
+ final SelectionAdapter removeProductSelectionAdapter = new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent event)
+ {
+ List<ProductCatalog> parents = new UniqueEList<ProductCatalog>();
+ for (Product product : userProducts)
+ {
+ ProductCatalog parentProductCatalog = product.getProductCatalog();
+ parentProductCatalog.getProducts().remove(product);
+ parents.add(parentProductCatalog);
+ }
+
+ for (ProductCatalog parent : parents)
+ {
+ BaseUtil.saveEObject(parent);
+ }
+
+ productViewer.setSelection(new StructuredSelection(parents));
+ }
+ };
+ removeProductButton.addSelectionListener(removeProductSelectionAdapter);
+
final ToolItem collapseAllButton = new ToolItem(filterToolBar, SWT.NONE);
collapseAllButton.setToolTipText("Collapse All");
collapseAllButton.setImage(SetupUIPlugin.INSTANCE.getSWTImage("collapse-all"));
@@ -487,6 +591,47 @@ public class ProductPage extends SetupWizardPage
}
});
+ int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
+ Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance(),
+ URLTransfer.getInstance() };
+ productViewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, productViewer)
+ {
+ @Override
+ protected Collection<?> getDragSource(DropTargetEvent event)
+ {
+ // Check whether the current data type can be transfered locally.
+ //
+ URLTransfer urlTransfer = URLTransfer.getInstance();
+ if (urlTransfer.isSupportedType(event.currentDataType))
+ {
+ // Motif kludge: we would get something random instead of null.
+ //
+ if (IS_MOTIF)
+ {
+ return null;
+ }
+
+ // Transfer the data and, if non-null, extract it.
+ //
+ Object object = urlTransfer.nativeToJava(event.currentDataType);
+ return object == null ? null : extractDragSource(object);
+ }
+
+ return super.getDragSource(event);
+ }
+
+ @Override
+ protected Collection<?> extractDragSource(Object object)
+ {
+ if (object instanceof String)
+ {
+ return Collections.singleton(URI.createURI((String)object));
+ }
+
+ return super.extractDragSource(object);
+ }
+ });
+
final Tree productTree = productViewer.getTree();
productTree.setLayoutData(new GridData(GridData.FILL_BOTH));
@@ -513,16 +658,6 @@ public class ProductPage extends SetupWizardPage
final CatalogSelection selection = catalogManager.getSelection();
productViewer.setInput(selection);
- // productTree.setFocus();
- // UIUtil.timerExec(1000, new Runnable()
- // {
- // public void run()
- // {
- // ITreeContentProvider contentProvider = (ITreeContentProvider)productViewer.getContentProvider();
- // selectFirstLeaf(selection, contentProvider);
- // }
- // });
-
collapseAllButton.addSelectionListener(new SelectionAdapter()
{
@Override
@@ -557,6 +692,46 @@ public class ProductPage extends SetupWizardPage
{
public void selectionChanged(SelectionChangedEvent event)
{
+ userProductCatalogs.clear();
+ userProducts.clear();
+
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ for (Object value : selection.toArray())
+ {
+ if (value instanceof Product)
+ {
+ Product product = (Product)value;
+ ProductCatalog productCatalog = product.getProductCatalog();
+ if (isUserProductCatalog(productCatalog))
+ {
+ userProductCatalogs.add(productCatalog);
+ userProducts.add(product);
+ }
+ }
+ else if (value instanceof ProductCatalog)
+ {
+ ProductCatalog productCatalog = (ProductCatalog)value;
+ if (isUserProductCatalog(productCatalog))
+ {
+ userProductCatalogs.add(productCatalog);
+ }
+ }
+ }
+
+ removeProductButton.setEnabled(!userProducts.isEmpty());
+
+ boolean hasUserProductCatalogs = false;
+ for (Scope scope : catalogSelector.getCatalogs())
+ {
+ if (isUserProductCatalog(scope))
+ {
+ hasUserProductCatalogs = true;
+ break;
+ }
+ }
+
+ addProductButton.setEnabled(hasUserProductCatalogs);
+
updateDetails(false);
}
});
@@ -564,20 +739,6 @@ public class ProductPage extends SetupWizardPage
return sashForm;
}
- // private void selectFirstLeaf(Object object, ITreeContentProvider contentProvider)
- // {
- // Object[] children = contentProvider.getChildren(object);
- // if (children != null && children.length != 0)
- // {
- // Object firstChild = children[0];
- // selectFirstLeaf(firstChild, contentProvider);
- // }
- // else
- // {
- // productViewer.setSelection(new StructuredSelection(object));
- // }
- // }
-
@Override
public void leavePage(boolean forward)
{
@@ -681,6 +842,18 @@ public class ProductPage extends SetupWizardPage
}
}
+ private static boolean isUserProductCatalog(Scope scope)
+ {
+ if (scope instanceof ProductCatalog)
+ {
+ ProductCatalog productCatalog = (ProductCatalog)scope;
+ Resource resource = productCatalog.eResource();
+ return resource != null && "user".equals(resource.getURI().scheme());
+ }
+
+ return false;
+ }
+
private String getDescriptionHTML(Product product)
{
String imageURI = getProductImageURI(product);
@@ -692,7 +865,8 @@ public class ProductPage extends SetupWizardPage
label = product.getName();
}
- return "<html><body style=\"margin:5px;\"><img src=\"" + imageURI
+ return "<html><body style=\"margin:5px;\"><img src=\""
+ + imageURI
+ "\" width=\"42\" height=\"42\" align=\"absmiddle\"></img><b>&nbsp;&nbsp;&nbsp;<span style=\"font-family:'Arial',Verdana,sans-serif; font-size:100%\">"
+ safe(label) + "</b><br/><hr/></span><span style=\"font-family:'Arial',Verdana,sans-serif; font-size:75%\">" + safe(description)
+ "</span></body></html>";
@@ -992,31 +1166,138 @@ public class ProductPage extends SetupWizardPage
@Override
public Adapter createProductCatalogAdapter()
{
- if (productCatalogItemProvider == null)
+ return new ProductCatalogItemProvider(this)
{
- productCatalogItemProvider = new ProductCatalogItemProvider(this)
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object)
{
- @Override
- public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object)
+ if (childrenFeatures == null)
{
- if (childrenFeatures == null)
- {
- childrenFeatures = new ArrayList<EStructuralFeature>();
- childrenFeatures.add(PRODUCT_CATALOG__PRODUCTS);
- }
-
- return childrenFeatures;
+ childrenFeatures = new ArrayList<EStructuralFeature>();
+ childrenFeatures.add(PRODUCT_CATALOG__PRODUCTS);
}
- @Override
- protected Object overlayImage(Object object, Object image)
+ return childrenFeatures;
+ }
+
+ @Override
+ protected Command createPrimaryDragAndDropCommand(EditingDomain domain, Object owner, float location, int operations, int operation,
+ Collection<?> collection)
+ {
+ final ProductCatalog targetProductCatalog = (ProductCatalog)owner;
+ Resource directResource = ((InternalEObject)targetProductCatalog).eDirectResource();
+ if (directResource != null && "user".equals(directResource.getURI().scheme()))
{
- return image;
+ final ResourceSet resourceSet = domain.getResourceSet();
+ return new DragAndDropCommand(domain, resourceSet, location, operations, operation, collection)
+ {
+ final Set<Product> products = new LinkedHashSet<Product>();
+
+ final Set<Product> affectedObjects = new LinkedHashSet<Product>();
+
+ @Override
+ public void execute()
+ {
+ EList<Product> targetProducts = targetProductCatalog.getProducts();
+ LOOP: for (Product product : products)
+ {
+ if (operation != DROP_LINK)
+ {
+ if (product.eContainer() != null)
+ {
+ product = EcoreUtil.copy(product);
+ }
+ else
+ {
+ Resource resource = product.eResource();
+ resource.getContents().clear();
+ resourceSet.getResources().remove(resource);
+ }
+ }
+
+ affectedObjects.add(product);
+
+ String name = product.getName();
+ for (Product otherProduct : targetProducts)
+ {
+ if (name.equals(otherProduct.getName()))
+ {
+ targetProducts.set(targetProducts.indexOf(otherProduct), product);
+ continue LOOP;
+ }
+ }
+
+ targetProducts.add(product);
+ }
+
+ BaseUtil.saveEObject(targetProductCatalog);
+ }
+
+ @Override
+ protected boolean prepare()
+ {
+ products.clear();
+
+ for (Object value : collection)
+ {
+ if (value instanceof URI)
+ {
+ URI uri = (URI)value;
+ BaseResource resource = BaseUtil.loadResourceSafely(resourceSet, uri);
+ Product product = (Product)EcoreUtil.getObjectByType(resource.getContents(), SetupPackage.Literals.PRODUCT);
+ if (product != null && product.getName() != null && (operation == DROP_COPY || product.eContainer() == null))
+ {
+ products.add(product);
+ }
+ }
+ else if (value instanceof Product)
+ {
+ Product product = (Product)value;
+ if (product.getName() != null && (operation == DROP_COPY || product.eContainer() == null))
+ {
+ products.add(product);
+ }
+ }
+ }
+
+ if (operation == DROP_MOVE)
+ {
+ operation = DROP_LINK;
+ }
+
+ return !products.isEmpty();
+ }
+
+ @Override
+ public Collection<?> getAffectedObjects()
+ {
+ return affectedObjects;
+ }
+
+ @Override
+ public void redo()
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
}
- };
- }
- return productCatalogItemProvider;
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
+ protected Command createDragAndDropCommand(EditingDomain domain, final ResourceSet resourceSet, float location, int operations, int operation,
+ Collection<URI> collection)
+ {
+ return createPrimaryDragAndDropCommand(domain, getTarget(), location, operations, operation, collection);
+ }
+
+ @Override
+ protected Object overlayImage(Object object, Object image)
+ {
+ return image;
+ }
+ };
}
@Override
@@ -1038,6 +1319,13 @@ public class ProductPage extends SetupWizardPage
}
@Override
+ protected Command createDragAndDropCommand(EditingDomain domain, ResourceSet resourceSet, float location, int operations, int operation,
+ Collection<URI> collection)
+ {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @Override
protected Object overlayImage(Object object, Object image)
{
return image;
@@ -1078,4 +1366,338 @@ public class ProductPage extends SetupWizardPage
return installationItemProvider;
}
}
+
+ /**
+ * @author Eike Stepper
+ */
+ private static final class AddUserProductDialog extends ResourceDialog
+ {
+ private final Set<ProductCatalog> productCatalogs;
+
+ private CatalogSelector catalogSelector;
+
+ private final AdapterFactoryEditingDomain editingDomain;
+
+ private ComboViewer catalogViewer;
+
+ public AddUserProductDialog(Shell parent, Set<ProductCatalog> productCatalog, CatalogSelector catalogSelector, AdapterFactoryEditingDomain editingDomain)
+ {
+ super(parent, "Add User Products", SWT.OPEN | SWT.MULTI);
+ productCatalogs = productCatalog;
+ this.catalogSelector = catalogSelector;
+ this.editingDomain = editingDomain;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite main = new Composite(parent, SWT.NONE);
+ main.setLayout(UIUtil.createGridLayout(1));
+ main.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Composite upperComposite = new Composite(main, 0);
+ GridLayout upperLayout = new GridLayout(2, false);
+ upperLayout.marginTop = 10;
+ upperLayout.marginWidth = 10;
+ upperComposite.setLayout(upperLayout);
+ upperComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ applyDialogFont(upperComposite);
+
+ Label label = new Label(upperComposite, SWT.NONE);
+ label.setText("Catalog:");
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+
+ catalogViewer = new ComboViewer(upperComposite, SWT.READ_ONLY);
+ catalogViewer.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ catalogViewer.setContentProvider(ArrayContentProvider.getInstance());
+ catalogViewer.setLabelProvider(new LabelProvider()
+ {
+ @Override
+ public String getText(Object element)
+ {
+ return SetupCoreUtil.getLabel((Scope)element);
+ }
+ });
+
+ List<? extends Scope> catalogs = new ArrayList<Scope>(catalogSelector.getCatalogs());
+ for (Iterator<? extends Scope> it = catalogs.iterator(); it.hasNext();)
+ {
+ if (!isUserProductCatalog(it.next()))
+ {
+ it.remove();
+ }
+ }
+
+ catalogViewer.setInput(catalogs);
+
+ if (catalogs.size() == 1)
+ {
+ catalogViewer.setSelection(new StructuredSelection(catalogs.get(0)));
+ }
+ else if (productCatalogs.size() == 1 && catalogs.containsAll(productCatalogs))
+ {
+ catalogViewer.setSelection(new StructuredSelection(productCatalogs.iterator().next()));
+ }
+
+ catalogViewer.addSelectionChangedListener(new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ validate();
+ }
+ });
+
+ Composite lowerComposite = new Composite(main, 0);
+ GridLayout lowerLayout = new GridLayout();
+ lowerLayout.marginHeight = 0;
+ lowerLayout.marginWidth = 0;
+ lowerLayout.verticalSpacing = 0;
+ lowerComposite.setLayout(lowerLayout);
+ lowerComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ applyDialogFont(lowerComposite);
+
+ parent.getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ validate();
+ }
+ });
+
+ return super.createDialogArea(lowerComposite);
+ }
+
+ @Override
+ protected void prepareBrowseFileSystemButton(Button browseFileSystemButton)
+ {
+ browseFileSystemButton.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent event)
+ {
+ FileDialog fileDialog = new FileDialog(getShell(), style);
+ fileDialog.setFilterExtensions(new String[] { "*.setup" });
+ fileDialog.open();
+
+ String filterPath = fileDialog.getFilterPath();
+ String[] fileNames = fileDialog.getFileNames();
+ StringBuffer uris = new StringBuffer();
+
+ for (int i = 0, len = fileNames.length; i < len; i++)
+ {
+ uris.append(URI.createFileURI(filterPath + File.separator + fileNames[i]).toString());
+ uris.append(" ");
+ }
+
+ uriField.setText((uriField.getText() + " " + uris.toString()).trim());
+ }
+ });
+ }
+
+ @Override
+ protected void prepareBrowseWorkspaceButton(Button browseWorkspaceButton)
+ {
+ browseWorkspaceButton.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent event)
+ {
+ StringBuffer uris = new StringBuffer();
+
+ IFile[] files = WorkspaceResourceDialog.openFileSelection(getShell(), null, null, true, getContextSelection(),
+ Collections.<ViewerFilter> singletonList(new ViewerFilter()
+ {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element)
+ {
+ if (element instanceof IFile)
+ {
+ IFile file = (IFile)element;
+ return "setup".equals(file.getFileExtension());
+ }
+
+ return true;
+ }
+ }));
+
+ for (int i = 0, len = files.length; i < len; i++)
+ {
+ uris.append(URI.createURI(files[i].getLocationURI().toString(), true));
+ uris.append(" ");
+ }
+
+ uriField.setText((uriField.getText() + " " + uris.toString()).trim());
+ }
+
+ private String getContextPath()
+ {
+ return context != null && context.isPlatformResource() ? URI.createURI(".").resolve(context).path().substring(9) : null;
+ }
+
+ private Object[] getContextSelection()
+ {
+ String path = getContextPath();
+ if (path != null)
+ {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IResource resource = root.findMember(path);
+ if (resource != null && resource.isAccessible())
+ {
+ return new Object[] { resource };
+ }
+ }
+ return null;
+ }
+ });
+ }
+
+ protected void validate()
+ {
+ Button button = getButton(IDialogConstants.OK_ID);
+ if (button != null)
+ {
+ button.setEnabled(getSelectedCatalog() != null);
+ }
+ }
+
+ @Override
+ protected boolean processResources()
+ {
+ List<Product> validProducts = new ArrayList<Product>();
+ List<Product> invalidProducts = new ArrayList<Product>();
+ List<URI> invalidURIs = new ArrayList<URI>();
+ ResourceSet resourceSet = editingDomain.getResourceSet();
+ for (URI uri : getURIs())
+ {
+ BaseResource resource = BaseUtil.loadResourceSafely(resourceSet, uri);
+ Product product = (Product)EcoreUtil.getObjectByType(resource.getContents(), SetupPackage.Literals.PRODUCT);
+ if (product == null)
+ {
+ invalidURIs.add(uri);
+ }
+ else if (product.eContainer() != null)
+ {
+ invalidProducts.add(product);
+ }
+ else
+ {
+ validProducts.add(product);
+ }
+ }
+
+ if (!validProducts.isEmpty())
+ {
+ ProductCatalog selectedCatalog = getSelectedCatalog();
+ if (!catalogSelector.getSelectedCatalogs().contains(selectedCatalog))
+ {
+ catalogSelector.select(selectedCatalog, true);
+ }
+
+ Command command = DragAndDropCommand.create(editingDomain, selectedCatalog, 0.5F, DragAndDropFeedback.DROP_LINK, DragAndDropFeedback.DROP_LINK,
+ validProducts);
+ editingDomain.getCommandStack().execute(command);
+ return true;
+ }
+
+ StringBuilder message = new StringBuilder();
+
+ int invalidURIsSize = invalidURIs.size();
+ if (invalidURIsSize != 0)
+ {
+ if (invalidURIsSize == 1)
+ {
+ message.append("The URI ");
+ }
+ else
+ {
+ message.append("The URIs ");
+ }
+
+ for (int i = 0; i < invalidURIsSize; ++i)
+ {
+ if (i != 0)
+ {
+ message.append(", ");
+
+ if (i + 1 == invalidURIsSize)
+ {
+ message.append(" and ");
+ }
+ }
+
+ message.append('\'');
+ message.append(invalidURIs.get(i));
+ message.append('\'');
+ }
+
+ if (invalidURIsSize == 1)
+ {
+ message.append(" does not contain a valid product.");
+ }
+ else
+ {
+ message.append(" do not contain valid products.");
+ }
+ }
+
+ int invalidProductsSize = invalidProducts.size();
+ if (invalidProductsSize != 0)
+ {
+ if (message.length() != 0)
+ {
+ message.append("\n\n");
+ }
+
+ if (invalidProductsSize == 1)
+ {
+ message.append("The product ");
+ }
+ else
+ {
+ message.append("The products ");
+ }
+
+ for (int i = 0; i < invalidProductsSize; ++i)
+ {
+ if (i != 0)
+ {
+ message.append(", ");
+
+ if (i + 1 == invalidProductsSize)
+ {
+ message.append(" and ");
+ }
+ }
+
+ message.append('\'');
+ message.append(invalidProducts.get(i).getLabel());
+ message.append('\'');
+ }
+
+ if (invalidProductsSize == 1)
+ {
+ message.append(" is already contained in the index.");
+ }
+ else
+ {
+ message.append(" are already contained in the index.");
+ }
+ }
+
+ if (message.length() == 0)
+ {
+ message.append("No URIs were specified. Hit Cancel to terminate the dialog.");
+ }
+
+ ErrorDialog.openError(getShell(), "Error Adding Products", null, new Status(IStatus.ERROR, SetupUIPlugin.INSTANCE.getSymbolicName(), message.toString()));
+ return false;
+ }
+
+ private ProductCatalog getSelectedCatalog()
+ {
+ IStructuredSelection selection = (IStructuredSelection)catalogViewer.getSelection();
+ ProductCatalog selectedCatalog = (ProductCatalog)selection.getFirstElement();
+ return selectedCatalog;
+ }
+ }
}
diff --git a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProgressPage.java b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProgressPage.java
index 57f8554bc..282ef0447 100644
--- a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProgressPage.java
+++ b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProgressPage.java
@@ -922,12 +922,14 @@ public class ProgressPage extends SetupWizardPage
performer.log("Launching the installed product...");
String eclipseDir = os.getEclipseDir();
- String eclipseExecutable = os.getEclipseExecutable();
+ String relativeExecutableFolder = os.getRelativeExecutableFolder();
+ String executableName = os.getExecutableName(performer.getLauncherName());
File eclipseLocation = new File(performer.getInstallationLocation(), eclipseDir);
- String eclipsePath = new File(eclipseLocation, eclipseExecutable).getAbsolutePath();
+ File executableFolder = new File(eclipseLocation, relativeExecutableFolder);
+ String executable = new File(executableFolder, executableName).getAbsolutePath();
List<String> command = new ArrayList<String>();
- command.add(eclipsePath);
+ command.add(executable);
File ws = performer.getWorkspaceLocation();
if (ws != null)
diff --git a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProjectPage.java b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProjectPage.java
index 3a061bd13..155faa8b4 100644
--- a/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProjectPage.java
+++ b/plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProjectPage.java
@@ -219,8 +219,6 @@ public class ProjectPage extends SetupWizardPage
}
}, resourceSet);
- resourceSet.eAdapters().add(new AdapterFactoryEditingDomain.EditingDomainProvider(editingDomain));
-
SashForm sashForm = new SashForm(parent, SWT.SMOOTH | SWT.VERTICAL);
Composite upperComposite = new Composite(sashForm, SWT.NONE);
@@ -236,7 +234,7 @@ public class ProjectPage extends SetupWizardPage
ToolBar filterToolBar = new ToolBar(filterComposite, SWT.FLAT | SWT.RIGHT);
- ToolItem addProjectButton = new ToolItem(filterToolBar, SWT.NONE);
+ final ToolItem addProjectButton = new ToolItem(filterToolBar, SWT.NONE);
addProjectButton.setToolTipText("Add user projects");
addProjectButton.setImage(SetupUIPlugin.INSTANCE.getSWTImage("add_project"));
AccessUtil.setKey(addProjectButton, "addProject");
@@ -1561,19 +1559,16 @@ public class ProjectPage extends SetupWizardPage
}
});
- List<? extends Scope> selectedCatalogs = catalogSelector.getSelectedCatalogs();
- catalogViewer.setInput(selectedCatalogs);
+ List<? extends Scope> catalogs = catalogSelector.getCatalogs();
+ catalogViewer.setInput(catalogs);
- if (projectCatalogs.size() == 1)
+ if (catalogs.size() == 1)
{
- for (Scope scope : selectedCatalogs)
- {
- if (projectCatalogs.contains(scope))
- {
- catalogViewer.setSelection(new StructuredSelection(scope));
- break;
- }
- }
+ catalogViewer.setSelection(new StructuredSelection(catalogs.get(0)));
+ }
+ else if (projectCatalogs.size() == 1 && catalogs.containsAll(projectCatalogs))
+ {
+ catalogViewer.setSelection(new StructuredSelection(projectCatalogs.iterator().next()));
}
catalogViewer.addSelectionChangedListener(new ISelectionChangedListener()
@@ -1643,19 +1638,19 @@ public class ProjectPage extends SetupWizardPage
IFile[] files = WorkspaceResourceDialog.openFileSelection(getShell(), null, null, true, getContextSelection(),
Collections.<ViewerFilter> singletonList(new ViewerFilter()
- {
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element)
- {
- if (element instanceof IFile)
{
- IFile file = (IFile)element;
- return "setup".equals(file.getFileExtension());
- }
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element)
+ {
+ if (element instanceof IFile)
+ {
+ IFile file = (IFile)element;
+ return "setup".equals(file.getFileExtension());
+ }
- return true;
- }
- }));
+ return true;
+ }
+ }));
for (int i = 0, len = files.length; i < len; i++)
{
@@ -1725,6 +1720,10 @@ public class ProjectPage extends SetupWizardPage
if (!validProjects.isEmpty())
{
ProjectCatalog selectedCatalog = getSelectedCatalog();
+ if (!catalogSelector.getSelectedCatalogs().contains(selectedCatalog))
+ {
+ catalogSelector.select(selectedCatalog, true);
+ }
Command command = DragAndDropCommand.create(editingDomain, selectedCatalog, 0.5F, DragAndDropFeedback.DROP_LINK, DragAndDropFeedback.DROP_LINK,
validProjects);
diff --git a/plugins/org.eclipse.oomph.setup/META-INF/MANIFEST.MF b/plugins/org.eclipse.oomph.setup/META-INF/MANIFEST.MF
index eb2563dc2..51e41b7c4 100644
--- a/plugins/org.eclipse.oomph.setup/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.oomph.setup/META-INF/MANIFEST.MF
@@ -8,7 +8,7 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)";resolution:=optional,
- org.eclipse.core.variables;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.core.variables;bundle-version="[3.0.0,4.0.0)";resolution:=optional,
org.eclipse.oomph.preferences;bundle-version="[1.1.0,2.0.0)",
org.eclipse.emf.ecore.xmi;bundle-version="[2.10.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.edit;bundle-version="[2.10.0,3.0.0)",
diff --git a/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/SetupTaskContext.java b/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/SetupTaskContext.java
index 62a5d02d2..f5d9619ab 100644
--- a/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/SetupTaskContext.java
+++ b/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/SetupTaskContext.java
@@ -72,4 +72,6 @@ public interface SetupTaskContext extends ProgressLog
public Object put(Object key, Object value);
public Set<Object> keySet();
+
+ public String getLauncherName();
}
diff --git a/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/EclipseIniTaskImpl.java b/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/EclipseIniTaskImpl.java
index 01c06a0f1..77ad056de 100644
--- a/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/EclipseIniTaskImpl.java
+++ b/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/EclipseIniTaskImpl.java
@@ -13,8 +13,8 @@ package org.eclipse.oomph.setup.impl;
import org.eclipse.oomph.setup.EclipseIniTask;
import org.eclipse.oomph.setup.SetupPackage;
import org.eclipse.oomph.setup.SetupTaskContext;
+import org.eclipse.oomph.setup.Trigger;
import org.eclipse.oomph.util.IOUtil;
-import org.eclipse.oomph.util.OS;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
@@ -330,8 +330,13 @@ public class EclipseIniTaskImpl extends SetupTaskImpl implements EclipseIniTask
public boolean isNeeded(SetupTaskContext context) throws Exception
{
- OS os = context.getOS();
- file = new File(context.getProductLocation(), os.getEclipseIni());
+ // Return early for bootstrap because the launcher name can't be determined until after the p2 task has performed.
+ if (context.getTrigger() == Trigger.BOOTSTRAP)
+ {
+ return true;
+ }
+
+ file = new File(context.getProductLocation(), context.getLauncherName() + ".ini");
boolean result = !file.exists() || createNewContent(context);
// Ensure that the perform recomputes the contents because they could be modified by other tasks between now and when doPeform is called.
@@ -342,6 +347,11 @@ public class EclipseIniTaskImpl extends SetupTaskImpl implements EclipseIniTask
public void perform(SetupTaskContext context) throws Exception
{
+ if (file == null)
+ {
+ file = new File(context.getProductLocation(), context.getLauncherName() + ".ini");
+ }
+
if (!file.exists())
{
context.log("Skipping because " + file + " does not exist");
@@ -354,7 +364,7 @@ public class EclipseIniTaskImpl extends SetupTaskImpl implements EclipseIniTask
// Write the ini file with the system's default encoding; the native launcher reads it so.
IOUtil.writeLines(file, null, contents);
- context.setRestartNeeded("The eclipse.ini file has changed.");
+ context.setRestartNeeded("The " + file.getName() + " file has changed.");
}
}
diff --git a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java
index 7956f2979..4ba04529e 100644
--- a/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java
+++ b/plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java
@@ -164,9 +164,12 @@ public abstract class OS
return "eclipse";
}
- public abstract String getEclipseExecutable();
+ public abstract String getRelativeExecutableFolder();
- public abstract String getEclipseIni();
+ public String getExecutableName(String launcherName)
+ {
+ return launcherName;
+ }
public abstract String getGitPrefix();
@@ -246,15 +249,15 @@ public abstract class OS
}
@Override
- public String getEclipseExecutable()
+ public String getRelativeExecutableFolder()
{
- return "eclipse.exe";
+ return "";
}
@Override
- public String getEclipseIni()
+ public String getExecutableName(String launcherName)
{
- return "eclipse.ini";
+ return super.getExecutableName(launcherName) + ".exe";
}
@Override
@@ -342,15 +345,9 @@ public abstract class OS
}
@Override
- public String getEclipseExecutable()
- {
- return "../MacOS/eclipse";
- }
-
- @Override
- public String getEclipseIni()
+ public String getRelativeExecutableFolder()
{
- return "eclipse.ini";
+ return "../MacOS";
}
@Override
@@ -403,15 +400,9 @@ public abstract class OS
}
@Override
- public String getEclipseExecutable()
- {
- return "eclipse";
- }
-
- @Override
- public String getEclipseIni()
+ public String getRelativeExecutableFolder()
{
- return "eclipse.ini";
+ return "";
}
@Override
diff --git a/products/org.eclipse.oomph.setup.installer.product/Installer.product b/products/org.eclipse.oomph.setup.installer.product/Installer.product
index cd8f47b4b..aea87f01c 100644
--- a/products/org.eclipse.oomph.setup.installer.product/Installer.product
+++ b/products/org.eclipse.oomph.setup.installer.product/Installer.product
@@ -46,14 +46,6 @@ Eclipse Installer
<features>
<feature id="org.eclipse.oomph.setup.installer"/>
- <feature id="org.eclipse.emf.common"/>
- <feature id="org.eclipse.emf.common.ui"/>
- <feature id="org.eclipse.emf.ecore"/>
- <feature id="org.eclipse.emf.edit"/>
- <feature id="org.eclipse.emf.edit.ui"/>
- <feature id="org.eclipse.e4.rcp"/>
- <feature id="org.eclipse.rcp"/>
- <feature id="org.eclipse.equinox.p2.core.feature"/>
</features>
<configurations>
diff --git a/products/org.eclipse.oomph.setup.installer.product/pom.xml b/products/org.eclipse.oomph.setup.installer.product/pom.xml
index 98029a6fd..15df8d112 100644
--- a/products/org.eclipse.oomph.setup.installer.product/pom.xml
+++ b/products/org.eclipse.oomph.setup.installer.product/pom.xml
@@ -28,6 +28,14 @@
<build>
<plugins>
<plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-repository-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <includeAllDependencies>true</includeAllDependencies>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
<version>${tycho-version}</version>
diff --git a/setups/OomphInstaller.setup b/setups/OomphInstaller.setup
new file mode 100644
index 000000000..c87acafe5
--- /dev/null
+++ b/setups/OomphInstaller.setup
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<setup:Product
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
+ xmlns:setup.p2="http://www.eclipse.org/oomph/setup/p2/1.0"
+ name="oomph.installer"
+ label="Oomph's Eclipse Installer">
+ <version name="mars"
+ label="Mars">
+ <setupTask
+ xsi:type="setup.p2:P2Task"
+ label="Eclipse Installer">
+ <requirement
+ name="org.eclipse.oomph.setup.installer.product"/>
+ <repository
+ url="http://download.eclipse.org/oomph/products/repository"/>
+ </setupTask>
+ <setupTask
+ xsi:type="setup:EclipseIniTask"
+ option="-Dxyz"
+ value="=true"
+ vm="true"/>
+ </version>
+ <description>Oomph's Eclipse Installer product</description>
+</setup:Product>

Back to the top