Java 类org.eclipse.ui.editors.text.ILocationProvider 实例源码
项目:Source
文件:UiIdeMappingUtils.java
/**
* Gets the {@link IPath} from the given {@link IEditorInput}.
*
* @param editorInput
* the {@link IEditorInput}
* @return the {@link IPath} from the given {@link IEditorInput} if any, <code>null</code> otherwise
*/
public static IPath getPath(final IEditorInput editorInput) {
final IPath path;
if (editorInput instanceof ILocationProvider) {
path = ((ILocationProvider)editorInput).getPath(editorInput);
} else if (editorInput instanceof IURIEditorInput) {
final URI uri = ((IURIEditorInput)editorInput).getURI();
if (uri != null) {
final File osFile = URIUtil.toFile(uri);
if (osFile != null) {
path = Path.fromOSString(osFile.getAbsolutePath());
} else {
path = null;
}
} else {
path = null;
}
} else {
path = null;
}
return path;
}
项目:doclipser
文件:DockerBuildLaunchShortcut.java
@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);
}
}
项目:doclipser
文件:DockerRmLaunchShortcut.java
@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);
}
}
项目:doclipser
文件:DockerRunLaunchShortcut.java
@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);
}
}
项目:doclipser
文件:DockerLogsLaunchShortcut.java
@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);
}
}
项目:eclipsensis
文件:IOUtility.java
public static String resolveFileName(String fileName, NSISEditor editor)
{
String fileName2 = fileName;
String newFileName = IOUtility.encodePath(fileName2);
if(editor != null && newFileName.equalsIgnoreCase(fileName2)) {
IEditorInput editorInput = editor.getEditorInput();
if(editorInput instanceof IFileEditorInput) {
IFile file = ((IFileEditorInput)editorInput).getFile();
if(file != null) {
fileName2 = makeRelativeLocation(file, fileName2);
}
}
else if(editorInput instanceof ILocationProvider) {
File f = new File(((ILocationProvider)editorInput).getPath(editorInput).toOSString());
fileName2 = makeRelativeLocation(f, fileName2);
}
}
else {
fileName2 = newFileName;
}
return Common.maybeQuote(Common.escapeQuotes(fileName2));
}
项目:CppStyle
文件:ClangFormatFormatter.java
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;
}
项目:subclipse
文件:ExternalFileEditorInput.java
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);
}
项目:subclipse
文件:ExternalFileEditorInput.java
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);
}
项目:velocity-edit
文件:ExternalFileEditorInput.java
@SuppressWarnings("rawtypes")
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);
}
项目:APICloud-Studio
文件:ExternalFileEditorInput.java
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);
}
项目:APICloud-Studio
文件:UntitledFileStorageEditorInput.java
public Object getAdapter(Class adapter)
{
if (adapter == ILocationProvider.class)
{
return this;
}
return null;
}
项目:eclipsensis
文件:NSISExternalFileEditorInput.java
@SuppressWarnings("unchecked")
public Object getAdapter(Class adapter)
{
if(ILocationProvider.class.equals(adapter)) {
return this;
}
else if(IWorkbenchAdapter.class.equals(adapter)) {
return this;
}
return null;
}
项目:APICloud-Studio
文件:EditorUtil.java
/**
* 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;
}