mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +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:
parent
62545585be
commit
ebecae3167
3 changed files with 12 additions and 9 deletions
|
@ -83,8 +83,12 @@ public class LaunchConfigProviderInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean enabled(Object element) {
|
public boolean enabled(Object element) {
|
||||||
if (expression == null)
|
if (expression == null) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
if (element == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
EvaluationResult result = expression.evaluate(new EvaluationContext(null, element));
|
EvaluationResult result = expression.evaluate(new EvaluationContext(null, element));
|
||||||
return (result == EvaluationResult.TRUE);
|
return (result == EvaluationResult.TRUE);
|
||||||
|
|
|
@ -13,12 +13,6 @@ import org.eclipse.launchbar.core.target.ILaunchTargetWorkingCopy;
|
||||||
import org.osgi.service.prefs.Preferences;
|
import org.osgi.service.prefs.Preferences;
|
||||||
|
|
||||||
public class LaunchTarget extends PlatformObject implements ILaunchTarget {
|
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 typeId;
|
||||||
private final String id;
|
private final String id;
|
||||||
final Preferences attributes;
|
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
|
* This should only be used to create the null target. There are no attributes supported on the
|
||||||
* null target.
|
* null target.
|
||||||
*/
|
*/
|
||||||
private LaunchTarget(String typeId, String id) {
|
public LaunchTarget(String typeId, String id) {
|
||||||
this.typeId = typeId;
|
this.typeId = typeId;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.attributes = null;
|
this.attributes = null;
|
||||||
|
|
|
@ -26,7 +26,12 @@ public interface ILaunchTarget extends IAdaptable {
|
||||||
/**
|
/**
|
||||||
* The null target, which is the default when no other target is available.
|
* 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.
|
* The id for the target. It is unique for each type.
|
||||||
|
|
Loading…
Add table
Reference in a new issue