Skip to content

Commit

Permalink
[567929] Allow Launch tasks to be run on every startup
Browse files Browse the repository at this point in the history
https://bugs.eclipse.org/bugs/show_bug.cgi?id=567929

Add new attribute runEveryStartup to Launch task.

Change-Id: I9c29b304bb57a745f1adfe82d37bd4d1cc427d20
Signed-off-by: Joe Shannon <joe.shannon@diamond.ac.uk>
  • Loading branch information
joeshannon committed Oct 22, 2020
1 parent 4f94716 commit c68076f
Show file tree
Hide file tree
Showing 19 changed files with 163 additions and 16 deletions.
Expand Up @@ -12,7 +12,7 @@
<feature
id="org.eclipse.oomph.setup.launching"
label="%featureName"
version="1.13.0.qualifier"
version="1.14.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.oomph.license"
license-feature-version="0.0.0">
Expand Down
2 changes: 1 addition & 1 deletion features/org.eclipse.oomph.setup.launching-feature/pom.xml
Expand Up @@ -20,6 +20,6 @@
</parent>
<groupId>org.eclipse.oomph.features</groupId>
<artifactId>org.eclipse.oomph.setup.launching</artifactId>
<version>1.13.0-SNAPSHOT</version>
<version>1.14.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
2 changes: 1 addition & 1 deletion features/org.eclipse.oomph.setup.sdk-feature/feature.xml
Expand Up @@ -12,7 +12,7 @@
<feature
id="org.eclipse.oomph.setup.sdk"
label="%featureName"
version="1.18.0.qualifier"
version="1.19.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.oomph.license"
license-feature-version="0.0.0">
Expand Down
2 changes: 1 addition & 1 deletion features/org.eclipse.oomph.setup.sdk-feature/pom.xml
Expand Up @@ -20,6 +20,6 @@
</parent>
<groupId>org.eclipse.oomph.features</groupId>
<artifactId>org.eclipse.oomph.setup.sdk</artifactId>
<version>1.18.0-SNAPSHOT</version>
<version>1.19.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
2 changes: 1 addition & 1 deletion features/org.eclipse.oomph.tests-feature/feature.xml
Expand Up @@ -12,7 +12,7 @@
<feature
id="org.eclipse.oomph.tests"
label="%featureName"
version="1.15.0.qualifier"
version="1.16.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.oomph.license"
license-feature-version="0.0.0">
Expand Down
2 changes: 1 addition & 1 deletion features/org.eclipse.oomph.tests-feature/pom.xml
Expand Up @@ -22,7 +22,7 @@ Eike Stepper - initial API and implementation

<groupId>org.eclipse.oomph.features</groupId>
<artifactId>org.eclipse.oomph.tests</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>

</project>
Expand Up @@ -2,15 +2,15 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.oomph.setup.launching.edit;singleton:=true
Bundle-Version: 1.11.0.qualifier
Bundle-Version: 1.12.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.oomph.setup.launching.provider.LaunchingEditPlugin$Implementation
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.oomph.setup.launching.provider;version="1.5.0";x-internal:=true
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.oomph.setup.launching;bundle-version="[1.12.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.setup.launching;bundle-version="[1.13.0,2.0.0)";visibility:=reexport,
org.eclipse.emf.edit;bundle-version="[2.10.0,3.0.0)";visibility:=reexport,
org.eclipse.oomph.base.edit;bundle-version="[1.13.0,2.0.0)";visibility:=reexport,
org.eclipse.oomph.setup.edit;bundle-version="[1.15.0,2.0.0)";visibility:=reexport
Expand Down
Expand Up @@ -30,3 +30,5 @@ _UI_LaunchTask_launcher_description = The name of a launch configuration or the
_UI_Unknown_feature = Unspecified


_UI_LaunchTask_runEveryStartup_feature = Run Every Startup
_UI_LaunchTask_runEveryStartup_description = Always run this launcher if triggered by STARTUP
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.setup.launching.edit/pom.xml
Expand Up @@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.oomph</groupId>
<artifactId>org.eclipse.oomph.setup.launching.edit</artifactId>
<version>1.11.0-SNAPSHOT</version>
<version>1.12.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Expand Up @@ -58,6 +58,7 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object)
super.getPropertyDescriptors(object);

addLauncherPropertyDescriptor(object);
addRunEveryStartupPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
Expand All @@ -76,6 +77,20 @@ protected void addLauncherPropertyDescriptor(Object object)
LaunchingPackage.Literals.LAUNCH_TASK__LAUNCHER, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}

/**
* This adds a property descriptor for the Run Every Startup feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addRunEveryStartupPropertyDescriptor(Object object)
{
itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(),
getString("_UI_LaunchTask_runEveryStartup_feature"), //$NON-NLS-1$
getString("_UI_LaunchTask_runEveryStartup_description"), //$NON-NLS-1$
LaunchingPackage.Literals.LAUNCH_TASK__RUN_EVERY_STARTUP, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
}

/**
* This returns LaunchTask.gif.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -128,6 +143,7 @@ public void notifyChanged(Notification notification)
switch (notification.getFeatureID(LaunchTask.class))
{
case LaunchingPackage.LAUNCH_TASK__LAUNCHER:
case LaunchingPackage.LAUNCH_TASK__RUN_EVERY_STARTUP:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
Expand Down
Expand Up @@ -2,14 +2,14 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.oomph.setup.launching;singleton:=true
Bundle-Version: 1.12.0.qualifier
Bundle-Version: 1.13.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.oomph.setup.launching;version="1.12.0";x-internal:=true,
org.eclipse.oomph.setup.launching.impl;version="1.12.0";x-internal:=true,
org.eclipse.oomph.setup.launching.util;version="1.12.0";x-internal:=true
Export-Package: org.eclipse.oomph.setup.launching;version="1.13.0";x-internal:=true,
org.eclipse.oomph.setup.launching.impl;version="1.13.0";x-internal:=true,
org.eclipse.oomph.setup.launching.util;version="1.13.0";x-internal:=true
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.10.0,3.0.0)";visibility:=reexport,
Expand Down
Expand Up @@ -19,5 +19,7 @@
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="launcher" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="runEveryStartup" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="false"/>
</eClassifiers>
</ecore:EPackage>
Expand Up @@ -12,6 +12,8 @@
<genClasses ecoreClass="Launching.ecore#//LaunchTask" labelFeature="#//launching/LaunchTask/launcher">
<genFeatures createChild="false" propertyDescription="The name of a launch configuration or the workspace absolute path of a launch configuration file"
ecoreFeature="ecore:EAttribute Launching.ecore#//LaunchTask/launcher"/>
<genFeatures createChild="false" propertyDescription="Always run this launcher if triggered by STARTUP"
ecoreFeature="ecore:EAttribute Launching.ecore#//LaunchTask/runEveryStartup"/>
</genClasses>
</genPackages>
</genmodel:GenModel>
2 changes: 1 addition & 1 deletion plugins/org.eclipse.oomph.setup.launching/pom.xml
Expand Up @@ -20,7 +20,7 @@
</parent>
<groupId>org.eclipse.oomph</groupId>
<artifactId>org.eclipse.oomph.setup.launching</artifactId>
<version>1.12.0-SNAPSHOT</version>
<version>1.13.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<build>
Expand Down
Expand Up @@ -22,6 +22,7 @@
* </p>
* <ul>
* <li>{@link org.eclipse.oomph.setup.launching.LaunchTask#getLauncher <em>Launcher</em>}</li>
* <li>{@link org.eclipse.oomph.setup.launching.LaunchTask#isRunEveryStartup <em>Run Every Startup</em>}</li>
* </ul>
*
* @see org.eclipse.oomph.setup.launching.LaunchingPackage#getLaunchTask()
Expand Down Expand Up @@ -56,4 +57,27 @@ public interface LaunchTask extends SetupTask
*/
void setLauncher(String value);

/**
* Returns the value of the '<em><b>Run Every Startup</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Run Every Startup</em>' attribute.
* @see #setRunEveryStartup(boolean)
* @see org.eclipse.oomph.setup.launching.LaunchingPackage#getLaunchTask_RunEveryStartup()
* @model default="false"
* @generated
*/
boolean isRunEveryStartup();

/**
* Sets the value of the '{@link org.eclipse.oomph.setup.launching.LaunchTask#isRunEveryStartup <em>Run Every Startup</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Run Every Startup</em>' attribute.
* @see #isRunEveryStartup()
* @generated
*/
void setRunEveryStartup(boolean value);

} // LaunchTask
Expand Up @@ -177,14 +177,23 @@ public interface LaunchingPackage extends EPackage
*/
int LAUNCH_TASK__LAUNCHER = SetupPackage.SETUP_TASK_FEATURE_COUNT + 0;

/**
* The feature id for the '<em><b>Run Every Startup</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LAUNCH_TASK__RUN_EVERY_STARTUP = SetupPackage.SETUP_TASK_FEATURE_COUNT + 1;

/**
* The number of structural features of the '<em>Launch Task</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int LAUNCH_TASK_FEATURE_COUNT = SetupPackage.SETUP_TASK_FEATURE_COUNT + 1;
int LAUNCH_TASK_FEATURE_COUNT = SetupPackage.SETUP_TASK_FEATURE_COUNT + 2;

/**
* Returns the meta object for class '{@link org.eclipse.oomph.setup.launching.LaunchTask <em>Launch Task</em>}'.
Expand All @@ -207,6 +216,17 @@ public interface LaunchingPackage extends EPackage
*/
EAttribute getLaunchTask_Launcher();

/**
* Returns the meta object for the attribute '{@link org.eclipse.oomph.setup.launching.LaunchTask#isRunEveryStartup <em>Run Every Startup</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Run Every Startup</em>'.
* @see org.eclipse.oomph.setup.launching.LaunchTask#isRunEveryStartup()
* @see #getLaunchTask()
* @generated
*/
EAttribute getLaunchTask_RunEveryStartup();

/**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -248,6 +268,14 @@ interface Literals
*/
EAttribute LAUNCH_TASK__LAUNCHER = eINSTANCE.getLaunchTask_Launcher();

/**
* The meta object literal for the '<em><b>Run Every Startup</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute LAUNCH_TASK__RUN_EVERY_STARTUP = eINSTANCE.getLaunchTask_RunEveryStartup();

}

} // LaunchingPackage
Expand Up @@ -50,6 +50,7 @@
* </p>
* <ul>
* <li>{@link org.eclipse.oomph.setup.launching.impl.LaunchTaskImpl#getLauncher <em>Launcher</em>}</li>
* <li>{@link org.eclipse.oomph.setup.launching.impl.LaunchTaskImpl#isRunEveryStartup <em>Run Every Startup</em>}</li>
* </ul>
*
* @generated
Expand Down Expand Up @@ -78,6 +79,26 @@ public class LaunchTaskImpl extends SetupTaskImpl implements LaunchTask
*/
protected String launcher = LAUNCHER_EDEFAULT;

/**
* The default value of the '{@link #isRunEveryStartup() <em>Run Every Startup</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isRunEveryStartup()
* @generated
* @ordered
*/
protected static final boolean RUN_EVERY_STARTUP_EDEFAULT = false;

/**
* The cached value of the '{@link #isRunEveryStartup() <em>Run Every Startup</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isRunEveryStartup()
* @generated
* @ordered
*/
protected boolean runEveryStartup = RUN_EVERY_STARTUP_EDEFAULT;

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand Down Expand Up @@ -124,6 +145,31 @@ public void setLauncher(String newLauncher)
}
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isRunEveryStartup()
{
return runEveryStartup;
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRunEveryStartup(boolean newRunEveryStartup)
{
boolean oldRunEveryStartup = runEveryStartup;
runEveryStartup = newRunEveryStartup;
if (eNotificationRequired())
{
eNotify(new ENotificationImpl(this, Notification.SET, LaunchingPackage.LAUNCH_TASK__RUN_EVERY_STARTUP, oldRunEveryStartup, runEveryStartup));
}
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Expand All @@ -136,6 +182,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType)
{
case LaunchingPackage.LAUNCH_TASK__LAUNCHER:
return getLauncher();
case LaunchingPackage.LAUNCH_TASK__RUN_EVERY_STARTUP:
return isRunEveryStartup();
}
return super.eGet(featureID, resolve, coreType);
}
Expand All @@ -153,6 +201,9 @@ public void eSet(int featureID, Object newValue)
case LaunchingPackage.LAUNCH_TASK__LAUNCHER:
setLauncher((String)newValue);
return;
case LaunchingPackage.LAUNCH_TASK__RUN_EVERY_STARTUP:
setRunEveryStartup((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
Expand All @@ -170,6 +221,9 @@ public void eUnset(int featureID)
case LaunchingPackage.LAUNCH_TASK__LAUNCHER:
setLauncher(LAUNCHER_EDEFAULT);
return;
case LaunchingPackage.LAUNCH_TASK__RUN_EVERY_STARTUP:
setRunEveryStartup(RUN_EVERY_STARTUP_EDEFAULT);
return;
}
super.eUnset(featureID);
}
Expand All @@ -186,6 +240,8 @@ public boolean eIsSet(int featureID)
{
case LaunchingPackage.LAUNCH_TASK__LAUNCHER:
return LAUNCHER_EDEFAULT == null ? launcher != null : !LAUNCHER_EDEFAULT.equals(launcher);
case LaunchingPackage.LAUNCH_TASK__RUN_EVERY_STARTUP:
return runEveryStartup != RUN_EVERY_STARTUP_EDEFAULT;
}
return super.eIsSet(featureID);
}
Expand All @@ -206,6 +262,8 @@ public String toString()
StringBuilder result = new StringBuilder(super.toString());
result.append(" (launcher: "); //$NON-NLS-1$
result.append(launcher);
result.append(", runEveryStartup: "); //$NON-NLS-1$
result.append(runEveryStartup);
result.append(')');
return result.toString();
}
Expand All @@ -220,7 +278,7 @@ public boolean isNeeded(SetupTaskContext context) throws Exception
{
String launcher = getLauncher();
Trigger trigger = context.getTrigger();
if (trigger == Trigger.STARTUP)
if (trigger == Trigger.STARTUP && !isRunEveryStartup())
{
// If we've performed this task at least once, don't do it automatically again.
String property = HISTORY.getProperty(launcher, null);
Expand Down

0 comments on commit c68076f

Please sign in to comment.