本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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$
}
示例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);
}
}
}
示例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();
}
示例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;
}
示例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);
}
}
}
示例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());
}
示例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;
}
示例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 );
}