use of org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector in project xtext-xtend by eclipse.
the class XtendFileHyperlink method linkActivated.
@Override
public void linkActivated() {
try {
try {
ISourceLocator _sourceLocator = this.getLaunch().getSourceLocator();
final ISourceLocator l = _sourceLocator;
boolean _matched = false;
if (l instanceof AbstractSourceLookupDirector) {
_matched = true;
final Object result = ((AbstractSourceLookupDirector) l).getSourceElement(this.fileName);
boolean _matched_1 = false;
if (result instanceof IFile) {
_matched_1 = true;
final IEditorPart editor = IDE.openEditor(this.workbench.getActiveWorkbenchWindow().getActivePage(), ((IFile) result));
boolean _matched_2 = false;
if (editor instanceof XtextEditor) {
_matched_2 = true;
final IRegion region = ((XtextEditor) editor).getDocument().getLineInformation((this.lineNumber - 1));
((XtextEditor) editor).selectAndReveal(region.getOffset(), region.getLength());
}
}
}
} catch (final Throwable _t) {
if (_t instanceof NumberFormatException) {
} else {
throw Exceptions.sneakyThrow(_t);
}
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector in project linuxtools by eclipse.
the class STCSourceNotFoundEditor method addSourceMappingToCommon.
private void addSourceMappingToCommon(IPath missingPath, IPath newSourcePath) throws CoreException {
AbstractSourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector();
addSourceMappingToDirector(missingPath, newSourcePath, director);
try {
InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).flush();
} catch (BackingStoreException e) {
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.STCSourceNotFoundEditor_failed_saving_settings_for_content_type + CDebugCorePlugin.PLUGIN_ID, e);
throw new CoreException(status);
}
}
use of org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector in project linuxtools by eclipse.
the class STLink2SourceSupport method findFileInCommonSourceLookup.
private static IEditorInput findFileInCommonSourceLookup(IPath path) {
try {
AbstractSourceLookupDirector director = CDebugCorePlugin.getDefault().getCommonSourceLookupDirector();
ISourceContainer[] c = director.getSourceContainers();
for (ISourceContainer sourceContainer : c) {
Object[] o = sourceContainer.findSourceElements(path.toOSString());
for (Object object : o) {
if (object instanceof IFile) {
return new FileEditorInput((IFile) object);
} else if (object instanceof LocalFileStorage) {
LocalFileStorage storage = (LocalFileStorage) object;
IFileStore ifs = EFS.getStore(storage.getFile().toURI());
return new FileStoreEditorInput(ifs);
}
}
}
} catch (CoreException e) {
// do nothing
}
return null;
}
Aggregations