@Override public InputStream getContents() throws CoreException { return storage.getContents(); }
public IPath getFullPath() { return storage.getFullPath(); } public InputStream getContents() throws CoreException {
@Override public String getName() { return storage.getName(); }
@Override public String getToolTipText() { File file = fJarEntryFile.getAdapter(File.class); if (file != null) return file.getAbsolutePath(); return fJarEntryFile.getFullPath().toString(); }
public static SourceMap createFrom(IStorage storage) throws IOException, CoreException { Reader reader; if (storage instanceof IFile) { reader = new InputStreamReader(storage.getContents(), ((IFile) storage).getCharset()); } else { reader = new InputStreamReader(storage.getContents()); } try { String contents = Streams.loadAndClose(reader); return createFrom(storage.getFullPath(), contents); } catch (JSONException e) { throw new IOException(e); } finally { reader.close(); } }
@Override public IStorage call() throws Exception { for (Object resource: packagefragment.getNonJavaResources()) { IStorage fileorjarentry = (IStorage)resource; if (isDialectHelpXMLFile(fileorjarentry)) { logInfo("Help file found: " + fileorjarentry.getName()); dialectfilepaths.add(fileorjarentry.getFullPath()); return fileorjarentry; } } return null; } }));
private ISchedulingRule getSchedulingRule(IStorage storage) { if (storage instanceof ISchedulingRule) return (ISchedulingRule) storage; else if (storage != null) return storage.getAdapter(ISchedulingRule.class); return null; }
protected void createJarEntryContexts(InputContextManager manager, JarEntryEditorInput input) { IStorage storage = input.getStorage(); ZipFile zip = storage.getAdapter(ZipFile.class); try { if (zip == null) return; if (zip.getEntry(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR) != null) { input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR)); manager.putContext(input, new BundleInputContext(this, input, storage.getName().equals(ICoreConstants.MANIFEST_FILENAME))); } if (zip.getEntry(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR) != null) { input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR)); manager.putContext(input, new PluginInputContext(this, input, storage.getName().equals(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR), false)); } else if (zip.getEntry(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR) != null) { input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR)); manager.putContext(input, new PluginInputContext(this, input, storage.getName().equals(ICoreConstants.FRAGMENT_FILENAME_DESCRIPTOR), true)); } if (zip.getEntry(ICoreConstants.BUILD_FILENAME_DESCRIPTOR) != null) { input = new JarEntryEditorInput(new JarEntryFile(zip, ICoreConstants.BUILD_FILENAME_DESCRIPTOR)); manager.putContext(input, new BuildInputContext(this, input, storage.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR))); } } finally { try { if (zip != null) zip.close(); } catch (IOException e) { } } }
public boolean isReadOnly() { return storage.isReadOnly(); } public String getName() {
private IBaseModel createStorageModel(IStorageEditorInput input) throws CoreException { InputStream stream = null; IStorage storage = input.getStorage(); try { stream = new BufferedInputStream(storage.getContents()); } catch (CoreException e) { PDEPlugin.logException(e); return null; } ExternalFeatureModel model = new ExternalFeatureModel(); IPath path = input.getStorage().getFullPath(); model.setInstallLocation(path == null ? "" : path.removeLastSegments(1).toOSString()); //$NON-NLS-1$ try { model.load(stream, false); } catch (CoreException e) { // Errors in the file return null; } finally { try { stream.close(); } catch (IOException e) { } } return model; }
private ISchedulingRule getSchedulingRule(IStorage storage) { if (storage instanceof ISchedulingRule) return (ISchedulingRule) storage; else if (storage != null) return (ISchedulingRule) storage.getAdapter(ISchedulingRule.class); return null; }
@Override public boolean isReadOnly() { return storage.isReadOnly(); }
@Override public InputStream getContents() throws CoreException { return storage.getContents(); }
@Override public IPath getFullPath() { return storage.getFullPath(); }
@Override public String getName() { return fJarEntryFile.getName(); }
public Object getAdapter(Class adapter) { return storage.getAdapter(adapter); } public boolean isReadOnly() {
@Override public boolean isReadOnly() { return storage.isReadOnly(); }
public InputStream getContents() throws CoreException { return storage.getContents(); }
@Override public IPath getFullPath() { return storage.getFullPath(); }
public String getName() { return storage.getName(); }