本文整理汇总了Java中org.eclipse.ui.editors.text.ILocationProvider类的典型用法代码示例。如果您正苦于以下问题:Java ILocationProvider类的具体用法?Java ILocationProvider怎么用?Java ILocationProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ILocationProvider类属于org.eclipse.ui.editors.text包,在下文中一共展示了ILocationProvider类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPath
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的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
示例2: launch
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的package包/类
@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);
}
}
开发者ID:domeide,项目名称:doclipser,代码行数:19,代码来源:DockerBuildLaunchShortcut.java
示例3: launch
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的package包/类
@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);
}
}
开发者ID:domeide,项目名称:doclipser,代码行数:20,代码来源:DockerRmLaunchShortcut.java
示例4: resolveFileName
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的package包/类
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));
}
开发者ID:henrikor2,项目名称:eclipsensis,代码行数:23,代码来源:IOUtility.java
示例5: getSourceFilePathFromEditorInput
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的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
示例6: getAdapter
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的package包/类
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);
}
开发者ID:subclipse,项目名称:subclipse,代码行数:8,代码来源:ExternalFileEditorInput.java
示例7: getAdapter
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的package包/类
@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);
}
开发者ID:ninneko,项目名称:velocity-edit,代码行数:9,代码来源:ExternalFileEditorInput.java
示例8: getAdapter
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的package包/类
public Object getAdapter(Class adapter)
{
if (adapter == ILocationProvider.class)
{
return this;
}
return null;
}
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:9,代码来源:UntitledFileStorageEditorInput.java
示例9: getAdapter
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Object getAdapter(Class adapter)
{
if(ILocationProvider.class.equals(adapter)) {
return this;
}
else if(IWorkbenchAdapter.class.equals(adapter)) {
return this;
}
return null;
}
开发者ID:henrikor2,项目名称:eclipsensis,代码行数:12,代码来源:NSISExternalFileEditorInput.java
示例10: getURI
import org.eclipse.ui.editors.text.ILocationProvider; //导入依赖的package包/类
/**
* 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;
}
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:63,代码来源:EditorUtil.java
注:本文中的org.eclipse.ui.editors.text.ILocationProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论