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


Java IEditorRegistry.getDefaultEditor方法代码示例

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


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

示例1: openFileInEditor

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
protected void openFileInEditor(IFile file, IWorkbenchWindow workbenchWindow, IWorkbenchPage page) throws PartInitException{
		IEditorRegistry editorRegistry = workbench.getEditorRegistry();
		FileEditorInput fileEditorInput = new FileEditorInput(file);
		
		IPath filePath = file.getFullPath();
		String filePathString = filePath.toString();
		
		IEditorDescriptor defaultEditor = editorRegistry.getDefaultEditor(filePathString);
		String defaultEditorId = defaultEditor.getId();
		
		page.openEditor(fileEditorInput, defaultEditorId);					 	 

//		Shell shell = workbenchWindow.getShell();
//		String title = "Error";
//		String message = exception.getMessage();
//		MessageDialog.openError(shell, title, message);
	}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:18,代码来源:DwFeatureModelWizard.java

示例2: getEditorId

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
private String getEditorId(IFileStore file) {
//		IWorkbench workbench= fWindow.getWorkbench();
		IWorkbench workbench = PlatformUI.getWorkbench();
		IEditorRegistry editorRegistry= workbench.getEditorRegistry();
		IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));

		// check the OS for in-place editor (OLE on Win32)
		if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
			descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
		
		// check the OS for external editor
		if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
			descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
		
		if (descriptor != null)
			return descriptor.getId();
		
		return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
	}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:20,代码来源:SVNConflictResolver.java

示例3: getEditorId

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
private String getEditorId(IFileStore file) {
	IWorkbench workbench = PlatformUI.getWorkbench();
	IEditorRegistry editorRegistry= workbench.getEditorRegistry();
	IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));

	// check the OS for in-place editor (OLE on Win32)
	if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
		descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
	
	// check the OS for external editor
	if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
		descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
	
	if (descriptor != null)
		return descriptor.getId();
	
	return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:19,代码来源:SVNConflictResolver.java

示例4: getEditorId

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
private String getEditorId( IFileStore file )
{
	IWorkbench workbench = window.getWorkbench( );
	IEditorRegistry editorRegistry = workbench.getEditorRegistry( );
	IEditorDescriptor descriptor = editorRegistry.getDefaultEditor( file.getName( ),
			getContentType( file ) );

	// check the OS for in-place editor (OLE on Win32)
	if ( descriptor == null
			&& editorRegistry.isSystemInPlaceEditorAvailable( file.getName( ) ) )
	{
		descriptor = editorRegistry.findEditor( IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID );
	}

	// check the OS for external editor
	if ( descriptor == null
			&& editorRegistry.isSystemExternalEditorAvailable( file.getName( ) ) )
	{
		descriptor = editorRegistry.findEditor( IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID );
	}

	return ( descriptor == null ) ? "" : descriptor.getId( ); //$NON-NLS-1$
}
 
开发者ID:eclipse,项目名称:birt,代码行数:24,代码来源:OpenJavaSourceAction.java

示例5: openFiles

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
@Override
protected void openFiles(PythonpathZipChildTreeNode[] pythonPathFilesSelected) {
    for (PythonpathZipChildTreeNode n : pythonPathFilesSelected) {
        try {
            if (PythonPathHelper.isValidSourceFile(n.zipPath)) {
                new PyOpenAction().run(new ItemPointer(n.zipStructure.file, new Location(), new Location(), null,
                        n.zipPath));
            } else {
                IEditorRegistry editorReg = PlatformUI.getWorkbench().getEditorRegistry();
                IEditorDescriptor defaultEditor = editorReg.getDefaultEditor(n.zipPath);
                PydevZipFileStorage storage = new PydevZipFileStorage(n.zipStructure.file, n.zipPath);
                PydevZipFileEditorInput input = new PydevZipFileEditorInput(storage);

                if (defaultEditor != null) {
                    IDE.openEditor(page, input, defaultEditor.getId());
                } else {
                    IDE.openEditor(page, input, EditorsUI.DEFAULT_TEXT_EDITOR_ID);
                }
            }
        } catch (PartInitException e) {
            Log.log(e);
        }
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:25,代码来源:PyOpenResourceAction.java

示例6: getEditorId

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
private String getEditorId(String filePath) {
	IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
	IEditorDescriptor desc = editorRegistry.getDefaultEditor(filePath);
	if (desc == null) {
		desc = editorRegistry.getDefaultEditor(filePath + ".txt");
	}
	return desc.getId();
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:9,代码来源:DefaultScanResultsHandler.java

示例7: getEditorId

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
private static String getEditorId(File file, IWorkbenchWindow window) {
	IWorkbench workbench= window.getWorkbench();
	IEditorRegistry editorRegistry= workbench.getEditorRegistry();
	IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName());
	if (descriptor != null)
		return descriptor.getId();
	return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:9,代码来源:EditorUtil.java

示例8: openEditorForFile

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
/**
 * @param filePath
 *            TODO: we should really make this into a utility function, and have the Ruble::Editor.open method use
 *            it. But I am giving up for now because Eclipse plugin dependencies drive me crazy!
 */
private void openEditorForFile(String filePath)
{
	File file = new File(filePath);
	// Process an existing file.
	if (file.exists() && file.isFile())
	{
		Path path = new Path(filePath);
		IFile fileForLocation = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
		IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
		IEditorDescriptor editorDescriptor = null;
		if (fileForLocation == null)
		{
			IContentType contentType = Platform.getContentTypeManager().findContentTypeFor(filePath);
			editorDescriptor = editorRegistry.getDefaultEditor(filePath, contentType);
		}
		else
		{
			editorDescriptor = editorRegistry.getDefaultEditor(filePath);
		}
		String editorId = (editorDescriptor == null) ? "com.aptana.editor.text" : editorDescriptor.getId(); //$NON-NLS-1$
		try
		{
			IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file.toURI(),
					editorId, true);
		}
		catch (PartInitException e)
		{
			IdeLog.logError(UIPlugin.getDefault(), e);
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:37,代码来源:ViewLogCommandHandler.java

示例9: getEditorDescriptor

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
protected IEditorDescriptor getEditorDescriptor()
{
	IEditorRegistry editorReg = PlatformUI.getWorkbench().getEditorRegistry();
	if (uri.getPath() == null || uri.getPath().equals("/") || uri.getPath().trim().equals("")) //$NON-NLS-1$ //$NON-NLS-2$
	{
		return null;
	}
	IPath path = new Path(uri.getPath());
	return editorReg.getDefaultEditor(path.lastSegment());
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:11,代码来源:URIHyperlink.java

示例10: getEditorId

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
private static String getEditorId(File file) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IEditorRegistry editorRegistry = workbench.getEditorRegistry();
    IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(file.getName(), getContentType(file));
    if (descriptor != null) {
        return descriptor.getId();
    }
    return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:10,代码来源:OpenXMLResultsAction.java

示例11: getEditorDescriptor

import org.eclipse.ui.IEditorRegistry; //导入方法依赖的package包/类
private IEditorDescriptor getEditorDescriptor( IEditorInput input,
		boolean determineContentType )
{
	if ( input == null )
	{
		throw new IllegalArgumentException( );
	}
	IContentType contentType = Platform.getContentTypeManager( )
			.findContentTypeFor( input.getName( ) );
	IEditorRegistry editorReg = PlatformUI.getWorkbench( )
			.getEditorRegistry( );
	return editorReg.getDefaultEditor( input.getName( ), contentType );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:14,代码来源:OpenFileAction.java


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