org.eclipse.ui.editors.text.ILocationProvider Java Examples
The following examples show how to use
org.eclipse.ui.editors.text.ILocationProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DockerBuildLaunchShortcut.java From doclipser with Eclipse Public License 1.0 | 6 votes |
@Override public void launch(IEditorPart editor, String mode) { IEditorInput input = editor.getEditorInput(); IFile dockerfile = (IFile) input.getAdapter(IFile.class); IPath dockerfilePath = null; if (dockerfile != null) { dockerfilePath = dockerfile.getLocation().removeLastSegments(1); } if (dockerfilePath == null) { ILocationProvider locationProvider = (ILocationProvider) input.getAdapter(ILocationProvider.class); if (locationProvider != null) { dockerfilePath = locationProvider.getPath(input); } } if (dockerfilePath != null) { launch(dockerfile, dockerfilePath); } }
Example #2
Source File: DockerRmLaunchShortcut.java From doclipser with Eclipse Public License 1.0 | 6 votes |
@Override public void launch(IEditorPart editor, String mode) { IEditorInput input = editor.getEditorInput(); IFile dockerfile = (IFile) input.getAdapter(IFile.class); IPath dockerfilePath = null; if (dockerfile != null) { dockerfilePath = dockerfile.getLocation().removeLastSegments(1); } if (dockerfilePath == null) { ILocationProvider locationProvider = (ILocationProvider) input .getAdapter(ILocationProvider.class); if (locationProvider != null) { dockerfilePath = locationProvider.getPath(input); } } if (dockerfilePath != null) { launch(dockerfile, dockerfilePath); } }
Example #3
Source File: DockerRunLaunchShortcut.java From doclipser with Eclipse Public License 1.0 | 6 votes |
@Override public void launch(IEditorPart editor, String mode) { IEditorInput input = editor.getEditorInput(); IFile dockerfile = (IFile) input.getAdapter(IFile.class); IPath dockerfilePath = null; if (dockerfile != null) { dockerfilePath = dockerfile.getLocation().removeLastSegments(1); } if (dockerfilePath == null) { ILocationProvider locationProvider = (ILocationProvider) input .getAdapter(ILocationProvider.class); if (locationProvider != null) { dockerfilePath = locationProvider.getPath(input); } } if (dockerfilePath != null) { launch(dockerfile, dockerfilePath); } }
Example #4
Source File: DockerLogsLaunchShortcut.java From doclipser with Eclipse Public License 1.0 | 6 votes |
@Override public void launch(IEditorPart editor, String mode) { IEditorInput input = editor.getEditorInput(); IFile dockerfile = (IFile) input.getAdapter(IFile.class); IPath dockerfilePath = null; if (dockerfile != null) { dockerfilePath = dockerfile.getLocation().removeLastSegments(1); } if (dockerfilePath == null) { ILocationProvider locationProvider = (ILocationProvider) input .getAdapter(ILocationProvider.class); if (locationProvider != null) { dockerfilePath = locationProvider.getPath(input); } } if (dockerfilePath != null) { launch(dockerfile, dockerfilePath); } }
Example #5
Source File: ClangFormatFormatter.java From CppStyle with MIT License | 6 votes |
private static IPath getSourceFilePathFromEditorInput(IEditorInput editorInput) { if (editorInput instanceof IURIEditorInput) { URI uri = ((IURIEditorInput) editorInput).getURI(); if (uri != null) { IPath path = URIUtil.toPath(uri); if (path != null) { return path; } } } if (editorInput instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) editorInput).getFile(); if (file != null) { return file.getLocation(); } } if (editorInput instanceof ILocationProvider) { return ((ILocationProvider) editorInput).getPath(editorInput); } return null; }
Example #6
Source File: ExternalFileEditorInput.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public Object getAdapter(Class adapter) { if (ILocationProvider.class.equals(adapter)) return this; if (IWorkbenchAdapter.class.equals(adapter)) return fWorkbenchAdapter; return Platform.getAdapterManager().getAdapter(this, adapter); }
Example #7
Source File: UntitledFileStorageEditorInput.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public Object getAdapter(Class adapter) { if (adapter == ILocationProvider.class) { return this; } return null; }
Example #8
Source File: EditorUtil.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * Gets the URI associated with the editor. * * @param editor * @return */ public static URI getURI(IEditorPart editor) { // NOTE: Moved from CommonContentAssistProcessor if (editor != null) { IEditorInput editorInput = editor.getEditorInput(); if (editorInput instanceof IURIEditorInput) { IURIEditorInput uriEditorInput = (IURIEditorInput) editorInput; return uriEditorInput.getURI(); } if (editorInput instanceof IPathEditorInput) { IPathEditorInput pathEditorInput = (IPathEditorInput) editorInput; return URIUtil.toURI(pathEditorInput.getPath()); } if (editorInput instanceof IFileEditorInput) { IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput; return fileEditorInput.getFile().getLocationURI(); } try { if (editorInput instanceof IStorageEditorInput) { IStorageEditorInput storageEditorInput = (IStorageEditorInput) editorInput; IStorage storage = storageEditorInput.getStorage(); if (storage != null) { IPath path = storage.getFullPath(); if (path != null) { return URIUtil.toURI(path); } } } } catch (CoreException e) { IdeLog.logError(CommonEditorPlugin.getDefault(), e); } if (editorInput instanceof ILocationProviderExtension) { ILocationProviderExtension lpe = (ILocationProviderExtension) editorInput; return lpe.getURI(null); } if (editorInput instanceof ILocationProvider) { ILocationProvider lp = (ILocationProvider) editorInput; return URIUtil.toURI(lp.getPath(null)); } } return null; }