Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2015-06-01 11:06:26 -0400
committerEd Merks2015-06-01 11:06:26 -0400
commit1921e7b317f4c0685468374a609b4e337ed62094 (patch)
treeca2a50ada4aa16c05412232eb7f4187e1e46ed81
parent2549be6056a7ff9f36d677dd608a349f3566543e (diff)
downloadorg.eclipse.oomph-1921e7b317f4c0685468374a609b4e337ed62094.tar.gz
org.eclipse.oomph-1921e7b317f4c0685468374a609b4e337ed62094.tar.xz
org.eclipse.oomph-1921e7b317f4c0685468374a609b4e337ed62094.zip
[468959] Support an extensible product catalog
https://bugs.eclipse.org/bugs/show_bug.cgi?id=468959
-rw-r--r--plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/AbstractSetupTaskContext.java58
-rw-r--r--plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupTaskPerformer.java3
-rw-r--r--plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/SelfProductCatalogURIHandlerImpl.java8
-rw-r--r--plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java17
-rw-r--r--plugins/org.eclipse.oomph.setup.ui/src/org/eclipse/oomph/setup/ui/wizards/ProgressPage.java15
-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/InstallationTaskImpl.java6
-rw-r--r--plugins/org.eclipse.oomph.util/src/org/eclipse/oomph/util/OS.java22
-rw-r--r--setups/OomphInstaller.setup14
9 files changed, 121 insertions, 24 deletions
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 68b47a4aa..c9203c2d5 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
@@ -12,10 +12,14 @@
*/
package org.eclipse.oomph.setup.internal.core;
+import org.eclipse.oomph.base.Annotation;
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.AnnotationConstants;
import org.eclipse.oomph.setup.Installation;
+import org.eclipse.oomph.setup.ProductVersion;
+import org.eclipse.oomph.setup.Scope;
import org.eclipse.oomph.setup.SetupTaskContext;
import org.eclipse.oomph.setup.Trigger;
import org.eclipse.oomph.setup.User;
@@ -26,6 +30,7 @@ import org.eclipse.oomph.util.OS;
import org.eclipse.oomph.util.OfflineMode;
import org.eclipse.oomph.util.StringUtil;
+import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.URIConverter;
@@ -227,7 +232,8 @@ public abstract class AbstractSetupTaskContext extends StringExpander implements
return null;
}
- return new File(installationLocation, getOS().getEclipseDir());
+ String relativeProductFolder = getRelativeProductFolder();
+ return new File(installationLocation, relativeProductFolder);
}
public File getProductConfigurationLocation()
@@ -241,6 +247,56 @@ public abstract class AbstractSetupTaskContext extends StringExpander implements
return new File(productLocation, InstallationTaskImpl.CONFIGURATION_FOLDER_NAME);
}
+ public String getRelativeProductFolder()
+ {
+ String productFolderName = getProductFolderName();
+ return getOS().getRelativeProductFolder(productFolderName);
+ }
+
+ private String getProductFolderName()
+ {
+ Installation installation = getInstallation();
+ ProductVersion productVersion = installation.getProductVersion();
+
+ OS os = getOS();
+ String osgiOS = os.getOsgiOS();
+ String osgiWS = os.getOsgiWS();
+ String osgiArch = os.getOsgiArch();
+ String[] keys = new String[] { //
+ "folderName." + osgiOS + '.' + osgiWS + '.' + osgiArch, //
+ "folderName." + osgiOS + '.' + osgiWS, //
+ "folderName." + osgiOS, //
+ "folderName", //
+ };
+
+ return getProductFolderName(productVersion, keys);
+ }
+
+ private String getProductFolderName(Scope scope, String[] keys)
+ {
+ if (scope == null)
+ {
+ return "";
+ }
+
+ Annotation annotation = scope.getAnnotation(AnnotationConstants.ANNOTATION_BRANDING_INFO);
+ if (annotation != null)
+ {
+ EMap<String, String> details = annotation.getDetails();
+
+ for (String key : keys)
+ {
+ String folderName = details.get(key);
+ if (folderName != null)
+ {
+ return folderName;
+ }
+ }
+ }
+
+ return getProductFolderName(scope.getParentScope(), keys);
+ }
+
public String getLauncherName()
{
if (launcherName == null)
diff --git a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupTaskPerformer.java b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupTaskPerformer.java
index 2cd4a36c6..7d53a17e2 100644
--- a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupTaskPerformer.java
+++ b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupTaskPerformer.java
@@ -1963,8 +1963,9 @@ public class SetupTaskPerformer extends AbstractSetupTaskContext
}
String uniqueInstallationID = installationID;
+ String relativeProductFolder = getRelativeProductFolder();
- for (int i = 2; new File(installRoot + "/" + uniqueInstallationID + "/" + getOS().getEclipseDir()).exists(); ++i)
+ for (int i = 2; new File(installRoot + "/" + uniqueInstallationID + "/" + relativeProductFolder).exists(); ++i)
{
uniqueInstallationID = installationID + i;
}
diff --git a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/SelfProductCatalogURIHandlerImpl.java b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/SelfProductCatalogURIHandlerImpl.java
index f63a50854..d1381a9e7 100644
--- a/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/SelfProductCatalogURIHandlerImpl.java
+++ b/plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/util/SelfProductCatalogURIHandlerImpl.java
@@ -10,10 +10,13 @@
*/
package org.eclipse.oomph.setup.internal.core.util;
+import org.eclipse.oomph.base.Annotation;
+import org.eclipse.oomph.base.BaseFactory;
import org.eclipse.oomph.p2.P2Factory;
import org.eclipse.oomph.p2.Repository;
import org.eclipse.oomph.p2.Requirement;
import org.eclipse.oomph.p2.core.P2Util;
+import org.eclipse.oomph.setup.AnnotationConstants;
import org.eclipse.oomph.setup.InstallationTask;
import org.eclipse.oomph.setup.Product;
import org.eclipse.oomph.setup.ProductCatalog;
@@ -136,6 +139,11 @@ public class SelfProductCatalogURIHandlerImpl extends URIHandlerImpl
selfProductVersion.setDescription("The self product version");
selfProduct.getVersions().add(selfProductVersion);
+ Annotation annotation = BaseFactory.eINSTANCE.createAnnotation();
+ annotation.setSource(AnnotationConstants.ANNOTATION_BRANDING_INFO);
+ annotation.getDetails().put("folderName", SetupContext.PRODUCT_LOCATION.segment(SetupContext.PRODUCT_ROOT_LOCATION.segmentCount()));
+ selfProductVersion.getAnnotations().add(annotation);
+
P2Task selfP2Task = SetupP2Factory.eINSTANCE.createP2Task();
selfProductVersion.getSetupTasks().add(selfP2Task);
diff --git a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java
index 0f9e019c6..7bc944c8d 100644
--- a/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java
+++ b/plugins/org.eclipse.oomph.setup.installer/src/org/eclipse/oomph/setup/internal/installer/SimpleVariablePage.java
@@ -115,8 +115,6 @@ public class SimpleVariablePage extends SimpleInstallerPage
private static final boolean EXIT_AFTER_LAUNCH = !PropertiesUtil.isProperty("oomph.no.exit.after.launch");
- private static final String SETUP_LOG_FILE = OS.INSTANCE.getEclipseDir() + "/configuration/org.eclipse.oomph.setup/setup.log";
-
private static final Preference PREF_INSTALL_ROOT = SetupInstallerPlugin.INSTANCE.getConfigurationPreference("installRoot");
private static final File FILE_INSTALL_ROOT = new File(SetupInstallerPlugin.INSTANCE.getUserLocation().toFile(), PREF_INSTALL_ROOT.key() + ".txt");
@@ -481,7 +479,8 @@ public class SimpleVariablePage extends SimpleInstallerPage
{
if (readmePath != null)
{
- java.net.URI readmeURI = new File(installFolder, OS.INSTANCE.getEclipseDir() + "/" + readmePath).toURI();
+ String relativeProductFolder = performer.getRelativeProductFolder();
+ java.net.URI readmeURI = new File(installFolder, relativeProductFolder + "/" + readmePath).toURI();
dialog.showReadme(readmeURI);
}
}
@@ -1063,15 +1062,21 @@ public class SimpleVariablePage extends SimpleInstallerPage
return errorMessage;
}
+ private File getLogFile()
+ {
+ String relativeProductFolder = performer.getRelativeProductFolder();
+ return new File(installFolder, relativeProductFolder + "/configuration/org.eclipse.oomph.setup/setup.log");
+ }
+
private void openInstallLog()
{
- File installationLogFile = new File(installFolder, SETUP_LOG_FILE);
+ File installationLogFile = getLogFile();
dialog.showInstallationLog(installationLogFile);
}
private boolean isInstallLogAvailable()
{
- return new File(installFolder, SETUP_LOG_FILE).exists();
+ return getLogFile().exists();
}
/**
@@ -1129,7 +1134,7 @@ public class SimpleVariablePage extends SimpleInstallerPage
/**
* @author Eike Stepper
*/
- private final class SimplePrompter extends HashMap<String, String>implements SetupPrompter
+ private final class SimplePrompter extends HashMap<String, String> implements SetupPrompter
{
private static final long serialVersionUID = 1L;
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 282ef0447..023d67091 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
@@ -350,8 +350,8 @@ public class ProgressPage extends SetupWizardPage
}
else
{
- launchButton = addCheckButton("Restart automatically if needed", "Restart the current product if the installation has been changed by setup tasks", false,
- "restartIfNeeded");
+ launchButton = addCheckButton("Restart automatically if needed", "Restart the current product if the installation has been changed by setup tasks",
+ false, "restartIfNeeded");
}
launchAutomatically = launchButton.getSelection();
@@ -839,7 +839,8 @@ public class ProgressPage extends SetupWizardPage
{
if (restart)
{
- setMessage("Task execution has successfully completed but requires a restart. Press Finish to restart now or Cancel to restart later.",
+ setMessage(
+ "Task execution has successfully completed but requires a restart. Press Finish to restart now or Cancel to restart later.",
IMessageProvider.WARNING);
setButtonState(IDialogConstants.CANCEL_ID, true);
@@ -854,8 +855,8 @@ public class ProgressPage extends SetupWizardPage
setButtonState(IDialogConstants.CANCEL_ID, false);
}
- shell.setData(PROGRESS_STATUS,
- new Status(IStatus.OK, SetupEditPlugin.INSTANCE.getSymbolicName(), "Task execution has successfully completed"));
+ shell.setData(PROGRESS_STATUS, new Status(IStatus.OK, SetupEditPlugin.INSTANCE.getSymbolicName(),
+ "Task execution has successfully completed"));
}
}
else
@@ -921,10 +922,10 @@ public class ProgressPage extends SetupWizardPage
{
performer.log("Launching the installed product...");
- String eclipseDir = os.getEclipseDir();
+ String relativeProductFolder = performer.getRelativeProductFolder();
String relativeExecutableFolder = os.getRelativeExecutableFolder();
String executableName = os.getExecutableName(performer.getLauncherName());
- File eclipseLocation = new File(performer.getInstallationLocation(), eclipseDir);
+ File eclipseLocation = new File(performer.getInstallationLocation(), relativeProductFolder);
File executableFolder = new File(eclipseLocation, relativeExecutableFolder);
String executable = new File(executableFolder, executableName).getAbsolutePath();
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 f5d9619ab..ca49ed583 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
@@ -59,6 +59,8 @@ public interface SetupTaskContext extends ProgressLog
public File getWorkspaceLocation();
+ public String getRelativeProductFolder();
+
public OS getOS();
public URIConverter getURIConverter();
diff --git a/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/InstallationTaskImpl.java b/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/InstallationTaskImpl.java
index 49de3d4d1..ff8716dac 100644
--- a/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/InstallationTaskImpl.java
+++ b/plugins/org.eclipse.oomph.setup/src/org/eclipse/oomph/setup/impl/InstallationTaskImpl.java
@@ -14,7 +14,6 @@ import org.eclipse.oomph.setup.InstallationTask;
import org.eclipse.oomph.setup.SetupPackage;
import org.eclipse.oomph.setup.SetupTaskContext;
import org.eclipse.oomph.setup.Trigger;
-import org.eclipse.oomph.util.OS;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.URI;
@@ -211,11 +210,10 @@ public class InstallationTaskImpl extends SetupTaskImpl implements InstallationT
public boolean isNeeded(SetupTaskContext context) throws Exception
{
- OS os = context.getOS();
-
+ String relativeProductFolder = context.getRelativeProductFolder();
Map<URI, URI> map = context.getURIConverter().getURIMap();
map.put(URI.createURI("configuration:/"),
- context.getTrigger() == Trigger.BOOTSTRAP ? URI.createFileURI(getLocation() + "/" + os.getEclipseDir() + "/" + CONFIGURATION_FOLDER_NAME + "/")
+ context.getTrigger() == Trigger.BOOTSTRAP ? URI.createFileURI(getLocation() + "/" + relativeProductFolder + "/" + CONFIGURATION_FOLDER_NAME + "/")
: getStaticConfigurationLocation().appendSegment(""));
return false;
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 4ba04529e..3723492a5 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
@@ -159,9 +159,14 @@ public abstract class OS
return false;
}
- public String getEclipseDir()
+ public String getRelativeProductFolder(String folderName)
{
- return "eclipse";
+ if (StringUtil.isEmpty(folderName))
+ {
+ return "eclipse";
+ }
+
+ return folderName;
}
public abstract String getRelativeExecutableFolder();
@@ -339,9 +344,18 @@ public abstract class OS
}
@Override
- public String getEclipseDir()
+ public String getRelativeProductFolder(String folderName)
{
- return "Eclipse.app/Contents/Eclipse";
+ if (StringUtil.isEmpty(folderName))
+ {
+ folderName = "Eclipse.app";
+ }
+ else if (!folderName.endsWith(".app"))
+ {
+ folderName += ".app";
+ }
+
+ return folderName + "/Contents/Eclipse";
}
@Override
diff --git a/setups/OomphInstaller.setup b/setups/OomphInstaller.setup
index c87acafe5..b27f4c2d3 100644
--- a/setups/OomphInstaller.setup
+++ b/setups/OomphInstaller.setup
@@ -7,8 +7,20 @@
xmlns:setup.p2="http://www.eclipse.org/oomph/setup/p2/1.0"
name="oomph.installer"
label="Oomph's Eclipse Installer">
+ <annotation
+ source="http://www.eclipse.org/oomph/setup/BrandingInfo">
+ <detail
+ key="folderName">
+ <value>eclipse-installer</value>
+ </detail>
+ <detail
+ key="folderName.macosx">
+ <value>Eclipse Installer</value>
+ </detail>
+ </annotation>
<version name="mars"
- label="Mars">
+ label="Mars"
+ requiredJavaVersion="1.7">
<setupTask
xsi:type="setup.p2:P2Task"
label="Eclipse Installer">

Back to the top