use of org.eclipse.core.variables.IDynamicVariable in project egit by eclipse.
the class DynamicVariablesTest method assertVariable.
private void assertVariable(String expected, String variableName, String argument) throws CoreException {
IResource findMember = project.findMember(TEST_FILE);
SWTBotView explorerView = TestUtil.showExplorerView();
final ISelectionProvider selectionProvider = explorerView.getViewReference().getView(true).getSite().getSelectionProvider();
final StructuredSelection structuredSelection = new StructuredSelection(findMember);
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
@Override
public void run() {
selectionProvider.setSelection(structuredSelection);
}
});
IDynamicVariable dynamicVariable = VariablesPlugin.getDefault().getStringVariableManager().getDynamicVariable(variableName);
String value = dynamicVariable.getValue(argument);
assertEquals(expected, value);
}
use of org.eclipse.core.variables.IDynamicVariable in project webtools.servertools by eclipse.
the class Resolver method resolveProperty.
private String resolveProperty(String proppedString, HashMap cache) {
StringBuffer str = new StringBuffer(proppedString);
int start = str.indexOf(PROP_START);
int end = str.indexOf(PROP_END, start);
String key = str.substring(start + 2, end);
String value = (String) cache.get(key);
if (value == null) {
// look in eclipse variables
IDynamicVariable dv = VariablesPlugin.getDefault().getStringVariableManager().getDynamicVariable(key);
if (dv != null) {
try {
value = dv.getValue(null);
} catch (CoreException e) {
CorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, 1, "Can not resolve eclipse variable", // $NON-NLS-1$
e));
}
}
}
if (value == null)
return str.toString();
return str.replace(start, end + 1, value).toString();
}
Aggregations