/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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 Object createInstance() { try { return element.createExecutableExtension(attributeName); } catch (CoreException e) { throw new WrappedException(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); }
/** * @since 2.3 * @deprecated Use com.google.common.io.ByteStreams.toByteArray(InputStream) instead */ @Deprecated public static byte[] readStreamIntoByteArray(InputStream inputStream) { try { return ByteStreams.toByteArray(inputStream); } catch (IOException e) { throw new WrappedException(e); } }
private void setSourceViewer(ITextEditor editor, SourceViewer viewer) { Field field = null; try { field = AbstractTextEditor.class.getDeclaredField("fSourceViewer"); //$NON-NLS-1$ field.setAccessible(true); field.set(editor, viewer); } catch (Exception exception) { throw new WrappedException(exception); } } }
public static String readStreamIntoString(InputStream inputStream) { Preconditions.checkNotNull(inputStream, "inputStream"); try { return new String(ByteStreams.toByteArray(inputStream)); } catch (IOException e) { throw new WrappedException(e); } }
public static void writeStringIntoFile(String filename, String content) { try { final File file = new File(filename); com.google.common.io.Files.write(content.getBytes(), file); } catch (IOException e) { throw new WrappedException(e); } } }
public static String readFileIntoString(String filename) { FileInputStream inputStream; try { inputStream = new FileInputStream(filename); return readStreamIntoString(inputStream); } catch (FileNotFoundException e) { throw new WrappedException(e); } }
public static String objToStr(Object obj, Predicate<EStructuralFeature> ignoredFeatures) { Appendable buf = new StringBuilder(1024); try { objToStrImpl(obj, "", buf, ignoredFeatures); } catch (Exception e) { throw new WrappedException(e); } return buf.toString(); }
public Resource resource(InputStream in, URI uriToUse, Map<?, ?> options, ResourceSet resourceSet) { Resource resource = resourceFactory.createResource(uriToUse); resourceSet.getResources().add(resource); try { resource.load(in, options); return resource; } catch (IOException e) { throw new WrappedException(e); } }
public void save(Iterable<IResourceDescription> descriptions) { Resource res = createResource(); if (res != null) { saveToResource(res, descriptions); try { res.save(null); } catch (IOException e) { throw new WrappedException(e); } } }
/** * 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()); }
private Resource load(Resource resource, boolean loadOnDemand) { if (!loadOnDemand) try { resource.load(resource.getResourceSet().getLoadOptions()); } catch (IOException e) { throw new WrappedException(e); } return resource; }
@Override public IParseResult doParse(Reader reader) { try { return parse(getDefaultRuleName(), new ANTLRReaderStream(reader)); } catch (IOException e) { throw new WrappedException(e); } }
public IParseResult parse(ParserRule rule, Reader reader) { try { IParseResult parseResult = parse(rule.getName(), new ANTLRReaderStream(reader)); return parseResult; } catch (IOException e) { throw new WrappedException(e); } }