/** * Laods the package and any sub-packages from their serialized form. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void loadPackage() { if (isLoaded) return; isLoaded = true; URL url = getClass().getResource(packageFilename); if (url == null) { throw new RuntimeException("Missing serialized package: " + packageFilename); } URI uri = URI.createURI(url.toString()); Resource resource = new EcoreResourceFactoryImpl().createResource(uri); try { resource.load(null); } catch (IOException exception) { throw new WrappedException(exception); } initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0)); createResource(eNS_URI); }
/** * Returns the wrapped exception. * @return the wrapped exception. */ public Exception exception() { return (Exception)getCause(); } }
/** * Return true if the WrappedException is actually a Resource Not Found. * * @param wrappedEx * @return <code>true</code> is exception wrappers a resource not found. * @since 1.0.0 */ public static boolean isResourceNotFound(WrappedException wrappedEx) { Exception excep = wrappedEx.exception(); while (excep instanceof WrappedException) { excep = ((WrappedException) excep).exception(); } return primIsResourceNotFound(excep); }
/** * Handles an exception thrown during command execution by logging it with the plugin. */ protected void handleError(Exception exception) { CommonPlugin.INSTANCE.log (new WrappedException (CommonPlugin.INSTANCE.getString("_UI_IgnoreException_exception"), exception).fillInStackTrace()); }
/** * Laods the package and any sub-packages from their serialized form. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void loadPackage() { if (isLoaded) return; isLoaded = true; URL url = getClass().getResource(packageFilename); if (url == null) { throw new RuntimeException("Missing serialized package: " + packageFilename); } URI uri = URI.createURI(url.toString()); Resource resource = new EcoreResourceFactoryImpl().createResource(uri); try { resource.load(null); } catch (IOException exception) { throw new WrappedException(exception); } initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0)); createResource(eNS_URI); }
public void elementChanged(ElementChangedEvent event) { if (workspace != null && workspace.isAutoBuilding()) { try { if (event.getDelta() != null) { Set<IJavaProject> javaProjects = getJavaProjectsWithClasspathChange(event.getDelta()); if (!javaProjects.isEmpty()) { Set<IProject> projects = Sets.newHashSet(Iterables.filter(Iterables.transform(javaProjects, new Function<IJavaProject, IProject>() { public IProject apply(IJavaProject from) { return from.getProject(); } }), Predicates.notNull())); buildManager.scheduleBuildIfNecessary(projects); } } } catch (WrappedException e) { log.error(e.getCause().getMessage(), e.getCause()); } catch (RuntimeException e) { log.error(e.getMessage(), e); } } }
public RuleFailedException extractRuleFailedException(Exception e) { if (e instanceof WrappedException) { WrappedException wrappedException = (WrappedException) e; Exception exception = wrappedException.exception(); if (exception instanceof RuleFailedException) { return (RuleFailedException) exception; } } else if (e instanceof RuleFailedException) { return (RuleFailedException) e; } return newRuleFailedException(e); }
/** * Laods the package and any sub-packages from their serialized form. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void loadPackage() { if (isLoaded) return; isLoaded = true; URL url = getClass().getResource(packageFilename); if (url == null) { throw new RuntimeException("Missing serialized package: " + packageFilename); } URI uri = URI.createURI(url.toString()); Resource resource = new EcoreResourceFactoryImpl().createResource(uri); try { resource.load(null); } catch (IOException exception) { throw new WrappedException(exception); } initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0)); createResource(eNS_URI); }
public LoadResult next() { URI uri = queue.poll(); try { Resource resource = parent.getResource(uri, true); return new LoadResult(resource, uri); } catch(WrappedException e) { throw new LoadOperationException(uri, (Exception) e.getCause() ); } }
public boolean isFileNotFound(WrappedException wrappedEx) { return WorkbenchResourceHelperBase.isResourceNotFound(wrappedEx) || wrappedEx.exception() instanceof FileNotFoundException; } });
/** * Laods the package and any sub-packages from their serialized form. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void loadPackage() { if (isLoaded) return; isLoaded = true; URL url = getClass().getResource(packageFilename); if (url == null) { throw new RuntimeException("Missing serialized package: " + packageFilename); } URI uri = URI.createURI(url.toString()); Resource resource = new EcoreResourceFactoryImpl().createResource(uri); try { resource.load(null); } catch (IOException exception) { throw new WrappedException(exception); } initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0)); createResource(eNS_URI); }
/** * @since 2.2 */ protected EObject findEObjectByURI(final URI uri, XtextResource resource) { if (uri.fragment() != null){ try { EObject result = resource.getEObject(uri.fragment()); return result; } catch (WrappedException e){ logger.error("Error while resolving EObject with URI '" + uri + "'" , e.getCause()); } } return null; } }
/** * Laods the package and any sub-packages from their serialized form. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void loadPackage() { if (isLoaded) return; isLoaded = true; URL url = getClass().getResource(packageFilename); if (url == null) { throw new RuntimeException("Missing serialized package: " + packageFilename); } URI uri = URI.createURI(url.toString()); Resource resource = new EcoreResourceFactoryImpl().createResource(uri); try { resource.load(null); } catch (IOException exception) { throw new WrappedException(exception); } initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0)); createResource(eNS_URI); }
protected IEditorPart openDefaultEditor(URI uri, EReference crossReference, int indexInList, boolean select) { Iterator<Pair<IStorage, IProject>> storages = mapper.getStorages(uri.trimFragment()).iterator(); if (storages != null && storages.hasNext()) { try { IStorage storage = storages.next().getFirst(); IEditorPart editor = null; if (storage instanceof IFile) { editor = openDefaultEditor((IFile) storage); } else { editor = openDefaultEditor(storage, uri); } selectAndReveal(editor, uri, crossReference, indexInList, select); return editor; } catch (WrappedException e) { logger.error("Error while opening editor part for EMF URI '" + uri + "'", e.getCause()); } catch (PartInitException partInitException) { logger.error("Error while opening editor part for EMF URI '" + uri + "'", partInitException); } } return null; }
/** * Laods the package and any sub-packages from their serialized form. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void loadPackage() { if (isLoaded) return; isLoaded = true; URL url = getClass().getResource(packageFilename); if (url == null) { throw new RuntimeException("Missing serialized package: " + packageFilename); } URI uri = URI.createURI(url.toString()); Resource resource = new EcoreResourceFactoryImpl().createResource(uri); try { resource.load(null); } catch (IOException exception) { throw new WrappedException(exception); } initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0)); createResource(eNS_URI); }
public IEditorPart open(URI uri, EReference crossReference, int indexInList, boolean select) { Iterator<Pair<IStorage, IProject>> storages = mapper.getStorages(uri.trimFragment()).iterator(); if (storages != null && storages.hasNext()) { try { IStorage storage = storages.next().getFirst(); // TODO we should create a JarEntryEditorInput if storage is a NonJavaResource from jdt to match the editor input used when double clicking on the same resource in a jar. IEditorInput editorInput = (storage instanceof IFile) ? new FileEditorInput((IFile) storage) : new XtextReadonlyEditorInput(storage); IWorkbenchPage activePage = workbench.getActiveWorkbenchWindow().getActivePage(); IEditorPart editor = IDE.openEditor(activePage, editorInput, editorID); selectAndReveal(editor, uri, crossReference, indexInList, select); return EditorUtils.getXtextEditor(editor); } catch (WrappedException e) { logger.error("Error while opening editor part for EMF URI '" + uri + "'", e.getCause()); } catch (PartInitException partInitException) { logger.error("Error while opening editor part for EMF URI '" + uri + "'", partInitException); } } return null; }
public Object createInstance() { try { return element.createExecutableExtension(attributeName); } catch (CoreException e) { throw new WrappedException(e); } } }
@Override public final void handle(IMessage message) { try { message.reply(handlerDispatcher.invoke(message.body(eventInterface, classLoader))); } catch (WrappedException e) { message.fail(e.getCause()); } catch (ApiException e) { message.fail(e); } catch (Throwable e) { message.fail(e); } }
public static <T> T throwUncheckedException(Throwable e) { if (e instanceof RuntimeException) throw (RuntimeException) e; if (e instanceof Error) throw (Error) e; if (e instanceof Exception) throw new WrappedException((Exception) e); throw new RuntimeException(e); }