Search in sources :

Example 86 with FileEditorInput

use of org.eclipse.ui.part.FileEditorInput in project yamcs-studio by yamcs.

the class ResourceUtil method editorInputFromPath.

public static IEditorInput editorInputFromPath(IPath path) {
    IEditorInput editorInput = null;
    IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
    // by Eclipse.
    if (!ResourceUtil.isExistingWorkspaceFile(path) && ResourceUtil.isExistingLocalFile(path)) {
        IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.getFullPath());
        editorInput = new FileStoreEditorInput(fileStore);
    } else {
        editorInput = new FileEditorInput(file);
    }
    return editorInput;
}
Also used : IFile(org.eclipse.core.resources.IFile) FileEditorInput(org.eclipse.ui.part.FileEditorInput) IFileStore(org.eclipse.core.filesystem.IFileStore) IEditorInput(org.eclipse.ui.IEditorInput) FileStoreEditorInput(org.eclipse.ui.ide.FileStoreEditorInput)

Example 87 with FileEditorInput

use of org.eclipse.ui.part.FileEditorInput in project yamcs-studio by yamcs.

the class OpenFileAction method openFileInBuilderMode.

private void openFileInBuilderMode(IFile file) {
    if (file.getFileExtension().equalsIgnoreCase("opi")) {
        try {
            boolean activate = OpenStrategy.activateOnOpen();
            page.openEditor(new FileEditorInput(file), "org.csstudio.opibuilder.OPIEditor", activate, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID);
        } catch (PartInitException e) {
            DialogUtil.openError(page.getWorkbenchWindow().getShell(), "Problems Opening Editor", e.getMessage(), e);
        }
    } else {
        openFile(file);
    }
}
Also used : FileEditorInput(org.eclipse.ui.part.FileEditorInput) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

FileEditorInput (org.eclipse.ui.part.FileEditorInput)87 IFile (org.eclipse.core.resources.IFile)55 CoreException (org.eclipse.core.runtime.CoreException)31 IEditorPart (org.eclipse.ui.IEditorPart)29 PartInitException (org.eclipse.ui.PartInitException)24 ArrayList (java.util.ArrayList)20 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)19 IXliffEditor (net.heartsome.cat.ts.ui.editors.IXliffEditor)18 IEditorReference (org.eclipse.ui.IEditorReference)17 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)16 IEditorInput (org.eclipse.ui.IEditorInput)16 FileStoreEditorInput (org.eclipse.ui.ide.FileStoreEditorInput)15 IProject (org.eclipse.core.resources.IProject)13 File (java.io.File)11 XLIFFEditorImplWithNatTable (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable)11 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)11 ByteArrayInputStream (java.io.ByteArrayInputStream)9 InvocationTargetException (java.lang.reflect.InvocationTargetException)9 ExecutionException (org.eclipse.core.commands.ExecutionException)9 List (java.util.List)7