/** * Returns the wrapped exception. * @return the wrapped exception. */ public Exception exception() { return (Exception)getCause(); } }
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 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() ); } }
/** * @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; } }
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; }
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; }
@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); } }
@Override public void put(final IXtextWebDocument document, final IServiceContext serviceContext) throws IOException { try { try { final URI uri = this.resourceBaseProvider.getFileURI(document.getResourceId()); final OutputStream outputStream = document.getResource().getResourceSet().getURIConverter().createOutputStream(uri); String _encoding = this.encodingProvider.getEncoding(uri); final OutputStreamWriter writer = new OutputStreamWriter(outputStream, _encoding); writer.write(document.getText()); writer.close(); } catch (final Throwable _t) { if (_t instanceof WrappedException) { final WrappedException exception = (WrappedException)_t; throw exception.getCause(); } else { throw Exceptions.sneakyThrow(_t); } } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } } }
@Override public XtextWebDocument get(final String resourceId, final IServiceContext serviceContext) throws IOException { try { try { final ResourceSet resourceSet = this.resourceSetProvider.get(resourceId, serviceContext); final URI uri = URI.createURI(resourceId); Resource _resource = resourceSet.getResource(uri, true); final XtextResource resource = ((XtextResource) _resource); XtextWebDocument _get = this.documentProvider.get(resourceId, serviceContext); final Procedure1<XtextWebDocument> _function = new Procedure1<XtextWebDocument>() { @Override public void apply(final XtextWebDocument it) { it.setInput(resource); } }; return ObjectExtensions.<XtextWebDocument>operator_doubleArrow(_get, _function); } catch (final Throwable _t) { if (_t instanceof WrappedException) { final WrappedException exception = (WrappedException)_t; throw exception.getCause(); } else { throw Exceptions.sneakyThrow(_t); } } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
@Override public XtextWebDocument get(final String resourceId, final IServiceContext serviceContext) throws IOException { try { try { final URI uri = this.resourceBaseProvider.getFileURI(resourceId); if ((uri == null)) { throw new IOException("The requested resource does not exist."); } final ResourceSet resourceSet = this.resourceSetProvider.get(resourceId, serviceContext); Resource _resource = resourceSet.getResource(uri, true); final XtextResource resource = ((XtextResource) _resource); XtextWebDocument _get = this.documentProvider.get(resourceId, serviceContext); final Procedure1<XtextWebDocument> _function = (XtextWebDocument it) -> { it.setInput(resource); }; return ObjectExtensions.<XtextWebDocument>operator_doubleArrow(_get, _function); } catch (final Throwable _t) { if (_t instanceof WrappedException) { final WrappedException exception = (WrappedException)_t; throw exception.getCause(); } else { throw Exceptions.sneakyThrow(_t); } } } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
if (ex.getCause() instanceof FileNotFoundException) return null; else throw ex;
changedURI = ((LoadOperationException) ex).getUri(); Throwable cause = ex.getCause(); boolean wasResourceNotFound = false; if (cause instanceof CoreException) {