当前位置: 首页>>代码示例>>Java>>正文


Java IURIEditorInput类代码示例

本文整理汇总了Java中org.eclipse.ui.IURIEditorInput的典型用法代码示例。如果您正苦于以下问题:Java IURIEditorInput类的具体用法?Java IURIEditorInput怎么用?Java IURIEditorInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IURIEditorInput类属于org.eclipse.ui包,在下文中一共展示了IURIEditorInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPathFromInput

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
public static String getPathFromInput(IEditorInput in) {
    IResource res = ResourceUtil.getResource(in);
    if (res != null) {
        try {
            if (res.getProject().hasNature(NATURE.ID)) {
                return res.getLocation().toOSString();
            }
        } catch (CoreException ex) {
            Log.log(Log.LOG_WARNING, "Nature error", ex); //$NON-NLS-1$
        }
    }
    if (in instanceof IURIEditorInput) {
        return Paths.get(((IURIEditorInput) in).getURI()).toString();
    } else {
        return null;
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:18,代码来源:PgDbParser.java

示例2: getPath

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:29,代码来源:UiIdeMappingUtils.java

示例3: isModifiable

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
@Override
public boolean isModifiable(Object element) {
	if (isWorkspaceExternalEditorInput(element)) {
		URIInfo info= (URIInfo) getElementInfo(element);
		if (info != null) {
			if (info.updateCache) {
				try {
					updateCache((IURIEditorInput) element);
				} catch (CoreException x) {
					handleCoreException(x, "XtextDocumentProvider.isModifiable");
				}
			}
			return info.isModifiable;
		}
	}
	return super.isModifiable(element);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:XtextDocumentProvider.java

示例4: isReadOnly

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
@Override
public boolean isReadOnly(Object element) {
	if (isWorkspaceExternalEditorInput(element)) {
		URIInfo info= (URIInfo) getElementInfo(element);
		if (info != null) {
			if (info.updateCache) {
				try {
					updateCache((IURIEditorInput) element);
				} catch (CoreException x) {
					handleCoreException(x, "XtextDocumentProvider.isReadOnly");
				}
			}
			return info.isReadOnly;
		}
	}
	return super.isReadOnly(element);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:XtextDocumentProvider.java

示例5: updateCache

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
/**
 * @since 2.3
 */
protected void updateCache(IURIEditorInput input) throws CoreException {
	URIInfo info= (URIInfo) getElementInfo(input);
	if (info != null) {
		java.net.URI uri= input.getURI();
		if (uri != null) {
			boolean readOnly = true;
			String uriAsString = uri.toString();
			URI emfURI = URI.createURI(uriAsString);
			if (emfURI.isFile() && !emfURI.isArchive()) {
				// TODO: Should we use the resource set somehow to obtain the URIConverter for the file protocol?
				// see also todo below, but don't run into a stackoverflow ;-)
				Map<String, ?> attributes = URIConverter.INSTANCE.getAttributes(emfURI, null);
				readOnly = Boolean.TRUE.equals(attributes.get(URIConverter.ATTRIBUTE_READ_ONLY));
			}
			info.isReadOnly=  readOnly;
			info.isModifiable= !readOnly;
		}
		info.updateCache= false;
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:24,代码来源:XtextDocumentProvider.java

示例6: getURI

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
/**
 * Returns the URI for the specific editor input.
 * 
 * @param input
 *            the editor input
 * @return the URI, or null if none could be determined
 */
public static URI getURI(IEditorInput input)
{
	if (input instanceof IFileEditorInput)
	{
		return ((IFileEditorInput) input).getFile().getLocationURI();
	}
	if (input instanceof IURIEditorInput)
	{
		return ((IURIEditorInput) input).getURI();
	}
	if (input instanceof IPathEditorInput)
	{
		return URIUtil.toURI(((IPathEditorInput) input).getPath());
	}
	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:24,代码来源:UIUtils.java

示例7: getPath

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
private IPath getPath(IEditorPart otherEditor)
{
	IEditorInput input = otherEditor.getEditorInput();
	try
	{
		if (input instanceof IPathEditorInput)
		{
			return ((IPathEditorInput) input).getPath();
		}

		URI uri = (URI) input.getAdapter(URI.class);
		if (uri != null)
		{
			return new Path(uri.getHost() + Path.SEPARATOR + uri.getPath());
		}
		if (input instanceof IURIEditorInput)
		{
			return URIUtil.toPath(((IURIEditorInput) input).getURI());
		}
	}
	catch (Exception e)
	{
	}
	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:26,代码来源:FilenameDifferentiator.java

示例8: getSourceFilePathFromEditorInput

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
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;
}
 
开发者ID:wangzw,项目名称:CppStyle,代码行数:25,代码来源:ClangFormatFormatter.java

示例9: partActivated

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
@Override
public void partActivated(IWorkbenchPartReference partRef) {
    IEditorPart part = partRef.getPage().getActiveEditor();
    if (!(part instanceof AbstractTextEditor))
        return;

    // log new active file
    IEditorInput input = part.getEditorInput();
    if (input instanceof IURIEditorInput) {
        URI uri = ((IURIEditorInput)input).getURI();
        if (uri != null && uri.getPath() != null) {
            String currentFile = uri.getPath();
            long currentTime = System.currentTimeMillis() / 1000;
            if (!currentFile.equals(WakaTime.getDefault().lastFile) || WakaTime.getDefault().lastTime + WakaTime.FREQUENCY * 60 < currentTime) {
                WakaTime.sendHeartbeat(currentFile, WakaTime.getActiveProject(), false);
                WakaTime.getDefault().lastFile = currentFile;
                WakaTime.getDefault().lastTime = currentTime;
            }
        }
    }
}
 
开发者ID:wakatime,项目名称:eclipse-wakatime,代码行数:22,代码来源:CustomEditorListener.java

示例10: getInputPath

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
public IPath getInputPath( IEditorInput input )
{
	if ( input instanceof IURIEditorInput )
	{
		//return new Path( ( (IURIEditorInput) input ).getURI( ).getPath( ) );
		URI uri = ( (IURIEditorInput) input ).getURI( );
		if(uri == null && input instanceof IFileEditorInput)
			return ((IFileEditorInput)input).getFile( ).getFullPath( );
		IPath localPath = URIUtil.toPath( uri );
		String host = uri.getHost( );
		if ( host != null && localPath == null )
		{
			return new Path( host + uri.getPath( ) ).makeUNC( true );
		}
		return localPath;
	}
	if ( input instanceof IFileEditorInput )
	{
		return ( (IFileEditorInput) input ).getFile( ).getLocation( );
	}
	return null;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:23,代码来源:IDEFileReportProvider.java

示例11: getElementOfInput

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
/**
 * Returns the element contained in the EditorInput
 */
Object getElementOfInput(IEditorInput input) {
    if (input instanceof IFileEditorInput) {
        return ((IFileEditorInput) input).getFile();
    }
    if (input instanceof IURIEditorInput) {
        IURIEditorInput iuriEditorInput = (IURIEditorInput) input;
        URI uri = iuriEditorInput.getURI();
        return new File(uri);

    }
    if (input instanceof PydevZipFileEditorInput) {
        PydevZipFileEditorInput pydevZipFileEditorInput = (PydevZipFileEditorInput) input;
        try {
            IStorage storage = pydevZipFileEditorInput.getStorage();
            if (storage instanceof PydevZipFileStorage) {
                PydevZipFileStorage pydevZipFileStorage = (PydevZipFileStorage) storage;
                return pydevZipFileStorage;
            }
        } catch (CoreException e) {
            Log.log(e);
        }

    }
    return null;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:29,代码来源:PydevPackageExplorer.java

示例12: getExternalFileEditorInput

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
/**
 * @return the IEditorInput if we're dealing with an external file (or null otherwise)
 */
public static IEditorInput getExternalFileEditorInput(ITextEditor editor) {
    IEditorInput input = editor.getEditorInput();

    //only return not null if it's an external file (IFileEditorInput marks a workspace file, not external file)
    if (input instanceof IFileEditorInput) {
        return null;
    }

    if (input instanceof IPathEditorInput) { //PydevFileEditorInput would enter here
        return input;
    }

    try {
        if (input instanceof IURIEditorInput) {
            return input;
        }
    } catch (Throwable e) {
        //IURIEditorInput not added until eclipse 3.3
    }

    //Note that IStorageEditorInput is not handled for external files (files from zip)

    return input;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:28,代码来源:AbstractBreakpointRulerAction.java

示例13: refreshParser

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
/**
 * Use only for non-project parsers
 * @param {@link IFileEditorInput} {@link IResource} or null
 * @return true if refresh was triggered successfully
 */
private boolean refreshParser(PgDbParser parser, IResource res, IProgressMonitor monitor)
        throws InterruptedException, IOException, CoreException {
    if (res instanceof IFile && res.getProject().hasNature(NATURE.ID)) {
        parser.getObjFromProjFile((IFile) res, monitor);
        return true;
    }

    IEditorInput in = getEditorInput();
    if (in instanceof IURIEditorInput) {
        IURIEditorInput uri = (IURIEditorInput) in;
        IDocument document = getDocumentProvider().getDocument(getEditorInput());
        InputStream stream = new ByteArrayInputStream(document.get().getBytes(StandardCharsets.UTF_8));
        parser.fillRefsFromInputStream(stream, Paths.get(uri.getURI()).toString(), monitor);
        return true;
    }
    return false;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:23,代码来源:SQLEditor.java

示例14: openStream

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
private InputStream openStream(IEditorInput input) throws CoreException,
    IOException {
  if (input instanceof IStorageEditorInput) {
    final IStorage storage = ((IStorageEditorInput) input).getStorage();
    return storage.getContents();
  }
  if (input instanceof IURIEditorInput) {
    final URI uri = ((IURIEditorInput) input).getURI();
    return uri.toURL().openStream();
  }
  throw new IOException("Unsupported input type: " + input.getClass()); //$NON-NLS-1$
}
 
开发者ID:eclipse,项目名称:eclemma,代码行数:13,代码来源:ExecutionDataContent.java

示例15: createDocumentProvider

import org.eclipse.ui.IURIEditorInput; //导入依赖的package包/类
private IDocumentProvider createDocumentProvider(IEditorInput input2) {
	// System.out.println(input2.getClass().toString());
	if (input2 instanceof IFileEditorInput) {
		return new NCLDocumentProvider();
	} else if (input2 instanceof IURIEditorInput) {
		NCLTextDocumentProvider docProvider = new NCLTextDocumentProvider();
		return docProvider;
	} else {
		return new TextFileDocumentProvider();
	}
}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:12,代码来源:NCLEditor.java


注:本文中的org.eclipse.ui.IURIEditorInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。