use of org.eclipse.core.variables.IStringVariableManager in project linuxtools by eclipse.
the class OpenGCDialog method handleBrowse.
protected void handleBrowse(String msg, Text text) {
FileDialog dialog = new FileDialog(this.getShell(), SWT.OPEN);
dialog.setText(msg);
String t = text.getText();
IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
try {
t = mgr.performStringSubstitution(t, false);
} catch (CoreException e) {
// do nothing: never occurs
}
File f = new File(t);
t = f.getParent();
if (t == null || t.length() == 0) {
t = this.gcFile.removeLastSegments(1).toOSString();
}
dialog.setFilterPath(t);
String s = dialog.open();
if (s != null)
text.setText(s);
}
use of org.eclipse.core.variables.IStringVariableManager in project linuxtools by eclipse.
the class OpenGmonDialog method validateBinary.
private void validateBinary() {
binValue = binText.getText();
IStringVariableManager mgr = VariablesPlugin.getDefault().getStringVariableManager();
try {
binValue = mgr.performStringSubstitution(binValue, false);
} catch (CoreException e) {
// do nothing: never occurs
}
File f = new File(binValue);
if (f.exists()) {
binaryValid = true;
getButton(IDialogConstants.OK_ID).setEnabled(binaryValid);
// $NON-NLS-1$
errorLabel.setText("");
} else {
binaryValid = false;
getButton(IDialogConstants.OK_ID).setEnabled(false);
if (!binValue.equals("")) {
// $NON-NLS-1$
// $NON-NLS-1$ //$NON-NLS-2$
errorLabel.setText("\"" + binText.getText() + "\" " + Messages.OpenGmonDialog_DOES_NOT_EXIST);
} else {
errorLabel.setText(Messages.OpenGmonDialog_PLEASE_ENTER_BINARY_FILE);
}
return;
}
}
use of org.eclipse.core.variables.IStringVariableManager in project webtools.sourceediting by eclipse.
the class ResourceSelectionBlock method getResource.
/**
* Returns the selected workspace container,or <code>null</code>
*/
protected IResource getResource() {
String path = getText();
if (path.length() > 0) {
IResource res = null;
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
try {
if (// $NON-NLS-1$
path.startsWith("${workspace_loc:")) {
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
path = manager.performStringSubstitution(path, false);
}
File f = new File(path);
if (resourceType == IResource.FOLDER) {
IContainer[] containers = root.findContainersForLocationURI(f.toURI());
if (containers.length > 0) {
res = containers[0];
}
} else if (resourceType == IResource.FILE) {
IFile[] files = root.findFilesForLocationURI(f.toURI());
if (files.length > 0) {
res = files[0];
}
}
return res;
} catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
return null;
}
use of org.eclipse.core.variables.IStringVariableManager in project usbdm-eclipse-plugins by podonoghue.
the class ManagedCommandLineGenerator method generateCommandLineInfo.
@Override
public IManagedCommandLineInfo generateCommandLineInfo(ITool tool, String commandName, String[] flags, String outputFlag, String outputPrefix, String output, String[] inputResources, String commandLinePattern) {
if ((commandLinePattern == null) || (commandLinePattern.length() == 0)) {
commandLinePattern = DEFAULT_PATTERN;
}
// System.err.println("ManagedCommandLineGenerator.generateCommandLineInfo(output=\'"+output.toString()+"\')");
output = quoteToken(output);
String inputsStr = stringArrayToString(inputResources, false);
String flagsStr = stringArrayToString(flags, false);
// System.err.println("ManagedCommandLineGenerator.generateCommandLineInfo(inputsStr=\'"+inputsStr+"\')");
// System.err.println("ManagedCommandLineGenerator.generateCommandLineInfo(flagsStr =\'"+flagsStr+"\')");
// System.err.println("ManagedCommandLineGenerator.generateCommandLineInfo(output =\'"+output+"\')");
RelacementPair[] replacementPair = { new RelacementPair("COMMAND", commandName), new RelacementPair("FLAGS", flagsStr), new RelacementPair("OUTPUT_FLAG", outputFlag), new RelacementPair("OUTPUT_PREFIX", outputPrefix), new RelacementPair("OUTPUT", output), new RelacementPair("INPUTS", inputsStr) };
String command = commandLinePattern;
for (RelacementPair pair : replacementPair) {
// System.err.println("/'" + makeVariable(pair.key)+ "/'==>/'" + pair.value + "/'");
command = command.replace(makeVariable(pair.key), pair.value);
command = command.replace(makeVariable(pair.key).toLowerCase(), pair.value);
}
try {
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
// System.err.println("ManagedCommandLineGenerator.generateCommandLineInfo() Before newCommandName = \'" + newCommandName);
commandName = manager.performStringSubstitution(commandName);
} catch (CoreException e1) {
e1.printStackTrace();
}
// System.err.println("ManagedCommandLineGenerator.generateCommandLineInfo() commandName = \'"+commandName+"\'");
return new ManagedCommandLineInfo(command.trim(), commandLinePattern, commandName, flagsStr, outputFlag, outputPrefix, output, inputsStr);
}
use of org.eclipse.core.variables.IStringVariableManager in project usbdm-eclipse-plugins by podonoghue.
the class UsbdmBuiltinSpecsDetector method resolveCommand.
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector#resolveCommand(java.lang.String)
*/
@Override
protected String resolveCommand(String languageId) throws CoreException {
String commandLine = super.resolveCommand(languageId);
System.err.println("UsbdmBuiltinSpecsDetector.resolveCommand() => (Before)commandLine = \'" + commandLine + "\'");
try {
// Do variable substitution
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
// IValueVariable variable;
// variable = manager.getValueVariable(UsbdmConstants.CODESOURCERY_ARM_PATH_KEY);
// if (variable != null) {
// String codesourceryPath = variable.getValue();
// codesourceryPath = codesourceryPath.replace('\\', '/');
// System.err.println("UsbdmBuiltinSpecsDetector.resolveCommand() => ${"+UsbdmConstants.CODESOURCERY_ARM_PATH_KEY+"} = \'" + codesourceryPath + "\'");
// commandLine = commandLine.replace("${"+UsbdmConstants.CODESOURCERY_ARM_PATH_KEY+"}", codesourceryPath+"/x/");
// }
// variable = manager.getValueVariable(UsbdmConstants.CODESOURCERY_COLDFIRE_PATH_KEY);
// if (variable != null) {
// String codesourceryPath = variable.getValue();
// codesourceryPath = codesourceryPath.replace('\\', '/');
// System.err.println("UsbdmBuiltinSpecsDetector.resolveCommand() => ${"+UsbdmConstants.CODESOURCERY_COLDFIRE_PATH_KEY+"} = \'" + codesourceryPath + "\'");
// commandLine = commandLine.replace("${"+UsbdmConstants.CODESOURCERY_COLDFIRE_PATH_KEY+"}", codesourceryPath+"/x/");
// }
commandLine = manager.performStringSubstitution(commandLine);
} catch (CoreException e1) {
e1.printStackTrace();
}
System.err.println("UsbdmBuiltinSpecsDetector.resolveCommand() => (After)commandLine = \'" + commandLine + "\'");
return commandLine;
}
Aggregations