1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 17:25:38 +02:00

Bug 497437 - Fix issues with null target.

Avoid assert in enablement on null target. Fix order of initialization
of null target in ILaunchTarget interface.

Change-Id: I4c85433743bbb16c54514005b27e0414bb27c510
This commit is contained in:
Doug Schaefer 2016-07-11 14:15:36 -04:00
parent 62545585be
commit ebecae3167
3 changed files with 12 additions and 9 deletions

View file

@ -83,8 +83,12 @@ public class LaunchConfigProviderInfo {
}
public boolean enabled(Object element) {
if (expression == null)
if (expression == null) {
return true;
}
if (element == null) {
return true;
}
try {
EvaluationResult result = expression.evaluate(new EvaluationContext(null, element));
return (result == EvaluationResult.TRUE);

View file

@ -13,12 +13,6 @@ import org.eclipse.launchbar.core.target.ILaunchTargetWorkingCopy;
import org.osgi.service.prefs.Preferences;
public class LaunchTarget extends PlatformObject implements ILaunchTarget {
public static final ILaunchTarget NULL_TARGET = new LaunchTarget("null", "---") {
@Override
public ILaunchTargetWorkingCopy getWorkingCopy() {
throw new UnsupportedOperationException("getWorkingCopy is not supported for NULL_TARGET");
};
};
private final String typeId;
private final String id;
final Preferences attributes;
@ -27,7 +21,7 @@ public class LaunchTarget extends PlatformObject implements ILaunchTarget {
* This should only be used to create the null target. There are no attributes supported on the
* null target.
*/
private LaunchTarget(String typeId, String id) {
public LaunchTarget(String typeId, String id) {
this.typeId = typeId;
this.id = id;
this.attributes = null;

View file

@ -26,7 +26,12 @@ public interface ILaunchTarget extends IAdaptable {
/**
* The null target, which is the default when no other target is available.
*/
public static final ILaunchTarget NULL_TARGET = LaunchTarget.NULL_TARGET;
public static final ILaunchTarget NULL_TARGET = new LaunchTarget("null", "---") { //$NON-NLS-1$ //$NON-NLS-2$
@Override
public ILaunchTargetWorkingCopy getWorkingCopy() {
throw new UnsupportedOperationException("getWorkingCopy is not supported for NULL_TARGET");
};
};
/**
* The id for the target. It is unique for each type.