use of com.avaloq.tools.ddk.check.runtime.configuration.IModelLocation in project dsl-devkit by dsldevkit.
the class PlatformPluginAwareEditorOpener method open.
/**
* If a platform plugin URI is given, a read-only Xtext editor is opened and returned. {@inheritDoc}
*
* @see {@link org.eclipse.emf.common.util.URI#isPlatformPlugin()}
*/
@Override
public IEditorPart open(final URI uri, final EReference crossReference, final int indexInList, final boolean select) {
IEditorPart result = super.open(uri, crossReference, indexInList, select);
if (result == null && (uri.isPlatformPlugin() || OSGI_RESOURCE_URL_PROTOCOL.equals(uri.scheme()))) {
final IModelLocation modelLocation = getModelLocation(uri.trimFragment());
if (modelLocation != null) {
PlatformPluginStorage storage = new PlatformPluginStorage(modelLocation);
IEditorInput editorInput = new XtextReadonlyEditorInput(storage);
IWorkbenchPage activePage = workbench.getActiveWorkbenchWindow().getActivePage();
try {
IEditorPart editor = IDE.openEditor(activePage, editorInput, editorID);
selectAndReveal(editor, uri, crossReference, indexInList, select);
return EditorUtils.getXtextEditor(editor);
} catch (WrappedException e) {
// $NON-NLS-1$ //$NON-NLS-2$
LOG.error("Error while opening editor part for EMF URI '" + uri + "'", e.getCause());
} catch (PartInitException partInitException) {
// $NON-NLS-1$ //$NON-NLS-2$
LOG.error("Error while opening editor part for EMF URI '" + uri + "'", partInitException);
}
}
}
return result;
}
use of com.avaloq.tools.ddk.check.runtime.configuration.IModelLocation in project dsl-devkit by dsldevkit.
the class CatalogFromExtensionPointScopeHelper method createExtensionScope.
/**
* Creates an extension scope for each registered check catalog.
*
* @param parent
* the parent scope
* @param context
* the context object
* @return the check catalog scope
*/
public IScope createExtensionScope(final IScope parent, final Resource context) {
IScope result = parent;
NavigableSet<IModelLocation> locations = ICheckCatalogRegistry.INSTANCE.getAllCheckModelLocations();
for (IModelLocation locationData : locations.descendingSet()) {
// The UI proposes parent scope contents after each scope in the chain, so this scope chain must be created in reverse.
result = new CatalogFromExtensionPointScope(result, locationData, (XtextResourceSet) context.getResourceSet());
}
return result;
}
Aggregations