Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorDescriptor


   * @generated
   */
  private static boolean openEditor(IWorkbench workbench, URI fileURI) {
    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = workbenchWindow.getActivePage();
    IEditorDescriptor editorDescriptor = workbench.getEditorRegistry()
        .getDefaultEditor(fileURI.toFileString());
    if (editorDescriptor == null) {
      MessageDialog
          .openError(
              workbenchWindow.getShell(),
              es.upm.dit.gsi.eclipse.jadex.diagram.eclipseJadex.diagram.part.Messages.DiagramEditorActionBarAdvisor_DefaultFileEditorTitle,
              NLS.bind(
                  es.upm.dit.gsi.eclipse.jadex.diagram.eclipseJadex.diagram.part.Messages.DiagramEditorActionBarAdvisor_DefaultFileEditorMessage,
                  fileURI.toFileString()));
      return false;
    } else {
      try {
        page.openEditor(new URIEditorInput(fileURI),
            editorDescriptor.getId());
      } catch (PartInitException exception) {
        MessageDialog
            .openError(
                workbenchWindow.getShell(),
                es.upm.dit.gsi.eclipse.jadex.diagram.eclipseJadex.diagram.part.Messages.DiagramEditorActionBarAdvisor_DefaultEditorOpenErrorTitle,
View Full Code Here


    fTitleImage= null;
    String title= ""; //$NON-NLS-1$

    if (input != null) {
      IEditorRegistry editorRegistry= PlatformUI.getWorkbench().getEditorRegistry();
      IEditorDescriptor editorDesc= editorRegistry.findEditor(getSite().getId());
      ImageDescriptor imageDesc= editorDesc != null ? editorDesc.getImageDescriptor() : null;

      fTitleImage= imageDesc != null ? imageDesc.createImage() : null;
      title= input.getName();
    }
View Full Code Here

      for (IResource res : configuration.getMappedResources()) {
        if (res instanceof IFile) {
          IFile file = (IFile) res;
         
          IWorkbench workbench = PlatformUI.getWorkbench();
          IEditorDescriptor editor = workbench.getEditorRegistry().getDefaultEditor(file.getName());
         
          IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
          IWorkbenchPage page = window.getActivePage();
         
          page.openEditor(new FileEditorInput(file), editor.getId());
          return;
        }
      }
    } catch (CoreException e) {
      // do nothing, open failed
View Full Code Here

                    final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                   
                    if( window != null )
                    {
                        final IWorkbenchPage page = window.getActivePage();
                        IEditorDescriptor editorDescriptor = null;
                       
                        try
                        {
                            editorDescriptor = IDE.getEditorDescriptor( file.getName() );
                        }
                        catch( PartInitException e )
                        {
                            // No editor was found for this file type.
                        }
                       
                        if( editorDescriptor != null )
                        {
                            try
                            {
                                IDE.openEditor( page, file.toURI(), editorDescriptor.getId(), true );
                            }
                            catch( PartInitException e )
                            {
                                Sapphire.service( LoggingService.class ).log( e );
                            }
View Full Code Here

    public static void openEditor(String contents, String name) {
        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        IStorage storage = new StringStorage(contents, name);
        IStorageEditorInput input = new StringInput(storage);
        IWorkbenchPage page = window.getActivePage();
        IEditorDescriptor desc = PlatformUI.getWorkbench().
                                    getEditorRegistry().getDefaultEditor(name);
        // If there is no editor associated with the given file name, we'll just
        // use the eclipse text editor as a default
        String editorId = desc != null?desc.getId():"org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
        try {
        if (page != null) {
            page.openEditor(input, editorId);
        }
        } catch (Exception e) {
View Full Code Here

            try {
                if (PythonPathHelper.isValidSourceFile(n.file.getName())) {
                    new PyOpenAction().run(new ItemPointer(n.file));
                } else {
                    IEditorRegistry editorReg = PlatformUI.getWorkbench().getEditorRegistry();
                    IEditorDescriptor defaultEditor = editorReg.getDefaultEditor(n.file.getName());
                    if (defaultEditor != null) {
                        IDE.openEditor(page, PydevFileEditorInput.create(n.file, false), defaultEditor.getId());
                    } else {
                        IDE.openEditor(page, PydevFileEditorInput.create(n.file, false),
                                EditorsUI.DEFAULT_TEXT_EDITOR_ID);
                    }
                }
View Full Code Here

                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) {
View Full Code Here

            return textEditor;
        return openNewTextEditor(file, activePage);
    }

    private ITextEditor openNewTextEditor(IFile file, IWorkbenchPage activePage) throws PartInitException {
        IEditorDescriptor desc = IDE.getDefaultEditor(file);
        if (desc != null) {
            String editorID = desc.getId();
            IEditorPart editor;
            if (desc.isInternal()) {
                editor = activePage.openEditor(new FileEditorInput(file), editorID);
                if (editor instanceof ITextEditor) {
                    if (editor instanceof IReusableEditor)
                        fEditor = (IReusableEditor) editor;
                    return (ITextEditor) editor;
View Full Code Here

        ITextEditor textEditor = showOpenTextEditor(page, file);
        if (textEditor != null)
            return textEditor;

        String editorId = null;
        IEditorDescriptor desc = IDE.getDefaultEditor(file);
        if (desc != null && desc.isInternal())
            editorId = desc.getId();

        boolean isOpen = isEditorOpen(page, fEditor);

        boolean canBeReused = isOpen && !fEditor.isDirty() && !isPinned(fEditor);
        boolean showsSameInputType = fEditor != null
View Full Code Here

    this.contentProvider = contentProvider;
    this.searchJob = searchJob;
    this.workbenchPage = workbenchPage;
   
    IEditorInput input = contentProvider.getEditorInput(doc);
    IEditorDescriptor editorDesc = IDE.getEditorDescriptor(doc.getFileName());
   
    IEditorPart editorPart = IDE.openEditor(workbenchPage, input, editorDesc.getId());
    this.editor = getTextEditor(input, editorPart);
    this.document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
   
    IStorage storage = contentProvider.getStorage(doc);
    this.file = null;
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IEditorDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.