private ISchedulingRule getSchedulingRule(IStorage storage) { if (storage instanceof ISchedulingRule) return (ISchedulingRule) storage; else if (storage != null) return storage.getAdapter(ISchedulingRule.class); return null; }
private ISchedulingRule getSchedulingRule(IStorage storage) { if (storage instanceof ISchedulingRule) return (ISchedulingRule) storage; else if (storage != null) return (ISchedulingRule) storage.getAdapter(ISchedulingRule.class); return null; }
public Object getAdapter(Class adapter) { return storage.getAdapter(adapter); } public boolean isReadOnly() {
@Override public <T> T getAdapter(Class<T> adapter) { return storage.getAdapter(adapter); }
@Override public <T> T getAdapter(Class<T> adapter) { return storage.getAdapter(adapter); }
public Object getAdapter(Class adapter) { return storage.getAdapter(adapter); }
public Object getAdapter(Class adapter) { return storage.getAdapter(adapter); }
@Override @SuppressWarnings("unchecked") public <T> T getAdapter(Class<T> adapter) { if (adapter.equals(File.class)) return (T) fJarEntryFile.getAdapter(File.class); return null; }
@Override public String getToolTipText() { File file = fJarEntryFile.getAdapter(File.class); if (file != null) return file.getAbsolutePath(); return fJarEntryFile.getFullPath().toString(); }
public ImageDescriptor getImageDescriptor(Object object) { IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter)storage.getAdapter(IWorkbenchAdapter.class); if (wbAdapter != null) return wbAdapter.getImageDescriptor(storage); return null; } /*
private static IFile createCachedBundleFile(final IProject project, final String resourcePathStr) throws IOException, CoreException { IStorage storage = LoadBundleUtil.getLoadBundleResource(project, resourcePathStr); IFile bundleRes = null; if (storage != null && storage.getAdapter(IFile.class) != null) { bundleRes = (IFile) storage.getAdapter(IFile.class); getBundleFileCache(project).put(resourcePathStr, bundleRes); return bundleRes; } throw new IOException("Bundle "+resourcePathStr+" not found in classpath for project: "+project.getName()); //$NON-NLS-1$ //$NON-NLS-2$ }
public Object getAdapter(Object element, Class key) { updateLazyLoadedAdapters(); if (fSearchPageScoreComputer != null && ISearchPageScoreComputer.class.equals(key)) return fSearchPageScoreComputer; if (IJavaElement.class.equals(key) && element instanceof IEditorInput) { IJavaElement je= JavaUI.getWorkingCopyManager().getWorkingCopy((IEditorInput)element); if (je != null) return je; if (element instanceof IStorageEditorInput) { try { return ((IStorageEditorInput)element).getStorage().getAdapter(key); } catch (CoreException ex) { // Fall through } } } return null; }
@Override @SuppressWarnings("unchecked") public <T> T getAdapter(Object element, Class<T> key) { updateLazyLoadedAdapters(); if (fSearchPageScoreComputer != null && ISearchPageScoreComputer.class.equals(key) && element instanceof IEditorInput && JavaUI.getEditorInputJavaElement((IEditorInput)element) != null) return (T) fSearchPageScoreComputer; if (IJavaElement.class.equals(key) && element instanceof IEditorInput) { IJavaElement je= JavaUI.getWorkingCopyManager().getWorkingCopy((IEditorInput)element); if (je != null) return (T) je; if (element instanceof IStorageEditorInput) { try { return ((IStorageEditorInput)element).getStorage().getAdapter(key); } catch (CoreException ex) { // Fall through } } } return null; }
@Override @SuppressWarnings("unchecked") public <T> T getAdapter(Object element, Class<T> key) { updateLazyLoadedAdapters(); if (fSearchPageScoreComputer != null && ISearchPageScoreComputer.class.equals(key) && element instanceof IEditorInput && JavaUI.getEditorInputJavaElement((IEditorInput)element) != null) return (T) fSearchPageScoreComputer; if (IJavaElement.class.equals(key) && element instanceof IEditorInput) { IJavaElement je= JavaUI.getWorkingCopyManager().getWorkingCopy((IEditorInput)element); if (je != null) return (T) je; if (element instanceof IStorageEditorInput) { try { return ((IStorageEditorInput)element).getStorage().getAdapter(key); } catch (CoreException ex) { // Fall through } } } 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) { } } }