private String computeTitlePath(FileStoreEditorInput editorInput) { return editorInput.getURI().getPath().toString(); }
@Override public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (adaptableObject instanceof FileStoreEditorInput && adapterType.isAssignableFrom(IFileStore.class)) { FileStoreEditorInput editorInput = (FileStoreEditorInput) adaptableObject; try { return adapterType.cast(EFS.getStore(editorInput.getURI())); } catch (CoreException e) { // Ignore to return null. } } return null; }
/** * Saves the state of the given editor input into the given memento. * * @param memento the storage area for element state * @param input the file editor input */ static void saveState(IMemento memento, FileStoreEditorInput input) { URI uri = input.getURI(); memento.putString(TAG_URI, uri.toString()); }
@Override protected void createSystemFileContexts(InputContextManager manager, FileStoreEditorInput input) { File file = new File(input.getURI()); String name = file.getName(); if (name.endsWith(".product")) { //$NON-NLS-1$ IFileStore store; try { store = EFS.getStore(file.toURI()); IEditorInput in = new FileStoreEditorInput(store); manager.putContext(in, new ProductInputContext(this, in, true)); } catch (CoreException e) { PDEPlugin.logException(e); } } }
@Override protected void createSystemFileContexts(InputContextManager manager, FileStoreEditorInput input) { File file = new File(input.getURI()); File siteFile = null; String name = file.getName().toLowerCase(Locale.ENGLISH); if (name.equals("site.xml")) { //$NON-NLS-1$ siteFile = file; if (siteFile.exists()) { IFileStore store; try { store = EFS.getStore(siteFile.toURI()); IEditorInput in = new FileStoreEditorInput(store); manager.putContext(in, new SiteInputContext(this, in, file == siteFile)); } catch (CoreException e) { PDEPlugin.logException(e); } } } }
@Override protected void createSystemFileContexts(InputContextManager manager, FileStoreEditorInput input) { File file = new File(input.getURI()); File buildFile = null; File featureFile = null; String name = file.getName().toLowerCase(Locale.ENGLISH); if (name.equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) { featureFile = file; File dir = file.getParentFile(); buildFile = new File(dir, ICoreConstants.BUILD_FILENAME_DESCRIPTOR); } else if (name.equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) { buildFile = file; File dir = file.getParentFile(); featureFile = createFeatureFile(dir); } try { if (featureFile.exists()) { IFileStore store = EFS.getStore(featureFile.toURI()); IEditorInput in = new FileStoreEditorInput(store); manager.putContext(in, new FeatureInputContext(this, in, file == featureFile)); } if (buildFile.exists()) { IFileStore store = EFS.getStore(buildFile.toURI()); IEditorInput in = new FileStoreEditorInput(store); manager.putContext(in, new BuildInputContext(this, in, file == buildFile)); } } catch (CoreException e) { PDEPlugin.logException(e); } }
private IBaseModel createExternalModel(FileStoreEditorInput input) { File file = input.getAdapter(File.class); if (file == null) { URI uri = input.getURI(); if (uri != null){ file = new File(uri); } else{ return null; } } SchemaDescriptor sd = new SchemaDescriptor(file); ISchema schema = sd.getSchema(false); if (schema instanceof EditableSchema) { ((EditableSchema) schema).setNotificationEnabled(true); } return schema; }
@Override protected void createSystemFileContexts(InputContextManager manager, FileStoreEditorInput input) { File file = new File(input.getURI()); File manifestFile = null; File buildFile = null;
@Override protected void createSystemFileContexts(InputContextManager manager, FileStoreEditorInput input) { try { IFileStore store = EFS.getStore(input.getURI()); IEditorInput in = new FileStoreEditorInput(store); manager.putContext(in, new CategoryInputContext(this, in, true)); } catch (CoreException e) { PDEPlugin.logException(e); } }
URI fileuri = ((FileStoreEditorInput) adaptable).getURI(); return new Resource(new File(fileuri.getPath()));