use of org.eclipse.wst.xsl.launching.config.BaseLaunchHelper in project webtools.sourceediting by eclipse.
the class XSLLaunchShortcut method findOrCreateLaunchConfiguration.
private ILaunchConfiguration findOrCreateLaunchConfiguration() throws CoreException {
ILaunchConfiguration[] configs = getLaunchManager().getLaunchConfigurations(getConfigurationType());
List<ILaunchConfiguration> candidateConfigs = new ArrayList<ILaunchConfiguration>(configs.length);
for (ILaunchConfiguration config : configs) {
String inputFile = config.getAttribute(XSLLaunchConfigurationConstants.ATTR_INPUT_FILE, (String) null);
try {
inputFile = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(inputFile);
} catch (CoreException e) {
// just ignore this one
continue;
}
Path path = new Path(inputFile);
// the source xml file must be the same
if (path.equals(xmlFilePath)) {
BaseLaunchHelper lh = new BaseLaunchHelper(config);
// all the selected stylesheets must be in the pipeline
boolean found = false;
for (IFile stylesheet : xslFiles) {
found = false;
for (Iterator<LaunchTransform> iter = lh.getPipeline().getTransformDefs().iterator(); iter.hasNext(); ) {
LaunchTransform lt = iter.next();
if (lt.getLocation().equals(stylesheet.getLocation())) {
found = true;
break;
}
}
if (!found)
break;
}
if (found)
candidateConfigs.add(config);
}
}
ILaunchConfiguration config = null;
int candidateCount = candidateConfigs.size();
if (candidateCount == 1)
config = candidateConfigs.get(0);
else if (candidateCount > 1)
config = chooseConfiguration(candidateConfigs);
else
config = createConfiguration();
return config;
}
use of org.eclipse.wst.xsl.launching.config.BaseLaunchHelper in project webtools.sourceediting by eclipse.
the class XSLDebugUILaunchListener method launchesTerminated.
public void launchesTerminated(ILaunch[] launches) {
for (ILaunch launch : launches) {
ILaunchConfigurationType configType = null;
try {
configType = launch.getLaunchConfiguration().getType();
} catch (CoreException e) {
// do nothing
}
if (configType != null && XSL_LAUNCH_CONFIGURATION_TYPE.equals(configType.getIdentifier())) {
try {
BaseLaunchHelper launchHelper = new BaseLaunchHelper(launch.getLaunchConfiguration());
File file = launchHelper.getTarget();
IFile ifile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(file.getAbsolutePath()));
if (ifile != null) {
// refresh this workspace file..
try {
ifile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
} catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
openFileIfRequired(launchHelper);
} catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
}
}
Aggregations