blob: 991cec1ecb29196fb5ba9e4111206a4392d8e3ab (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*******************************************************************************
* Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.te.ui.terminals.launcher;
import org.eclipse.core.expressions.Expression;
import org.eclipse.core.expressions.ExpressionConverter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.tcf.te.runtime.extensions.ExecutableExtension;
import org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate;
/**
* Abstract launcher delegate implementation.
*/
public abstract class AbstractLauncherDelegate extends ExecutableExtension implements ILauncherDelegate {
// The converted expression
private Expression expression;
// The hidden attribute
private boolean hidden;
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.extensions.ExecutableExtension#doSetInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
*/
@Override
public void doSetInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
super.doSetInitializationData(config, propertyName, data);
if (config == null) return;
// Read the sub elements of the extension
IConfigurationElement[] children = config.getChildren();
// The "enablement" element is the only expected one
if (children != null && children.length > 0) {
expression = ExpressionConverter.getDefault().perform(children[0]);
}
// Read "hidden" attribute
String value = config.getAttribute("hidden"); //$NON-NLS-1$
if (value != null && !"".equals(value.trim())) { //$NON-NLS-1$
hidden = Boolean.parseBoolean(value);
}
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getEnablement()
*/
@Override
public Expression getEnablement() {
return expression;
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#isHidden()
*/
@Override
public boolean isHidden() {
return hidden;
}
}
|