Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorDescriptor


    IWorkbenchPage page = window.getActivePage();
    return page.openEditor(editorInput, editorID);
  }
 
  public static IEditorPart openEditor(IWorkbench workbench, IFile file) throws PartInitException {
    IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
    if (desc != null) {
      return openEditor(workbench, file, desc.getId());
    } else {
      return openEditor(workbench, file, org.eclipse.ui.editors.text.EditorsUI.DEFAULT_TEXT_EDITOR_ID)
    }
  }
View Full Code Here


    private static final String EMB_PERL_FILE_EXTENSION = "epl";

    private List fileList = new ArrayList();

    public boolean visit(IResource resource) throws CoreException {
      IEditorDescriptor defaultEditorDescriptor = PerlDebugPlugin
          .getDefault().getWorkbench().getEditorRegistry()
          .getDefaultEditor(resource.getName());

      if (defaultEditorDescriptor == null) {
        return true;
      }

      if (defaultEditorDescriptor.getId().equals(PERL_EDITOR_ID) &&
        !EMB_PERL_FILE_EXTENSION.equals(resource.getFileExtension()) &&
        resource.getType() == IResource.FILE) {
        fileList.add(resource.getFullPath().removeFirstSegments(1)
            .toString());
      }
View Full Code Here

    public String getEditorId(IEditorInput input, Object element)
    {
        IEditorRegistry registry =
            PlatformUI.getWorkbench().getEditorRegistry();
        IEditorDescriptor descriptor =
            registry.getDefaultEditor(input.getName());
       
        return descriptor != null ? descriptor.getId() : null;
    }
View Full Code Here

            return count;
        }

        public boolean visit(IResource resource) throws CoreException
        {
            IEditorDescriptor defaultEditorDescriptor =
                registry.getDefaultEditor(resource.getFullPath().toString());

            if (defaultEditorDescriptor != null &&
                defaultEditorDescriptor.getId().equals(PERL_EDITOR_ID) &&
                !resource.getFileExtension().equals(EMB_PERL_FILE_EXTENSION))
            {
                count++;
            }
            return true;
View Full Code Here

    if(!resource.exists()) {
      return;
    }

    // Only decorate Perl sources or projects
    IEditorDescriptor defaultEditorDescriptor = PerlEditorPlugin
        .getDefault().getWorkbench().getEditorRegistry()
        .getDefaultEditor(resource.getFullPath().toString());

    try {
      if (resource.getType() == IResource.PROJECT) {
        if (resource.getProject().isAccessible()) {
          if (resource.getProject().hasNature(PERL_NATURE_ID)) {
            isPerlProject = true;
          }
        }
      }
    } catch (CoreException e) {
      e.printStackTrace();
    }
   
    try {
      if (resource.getType() == IResource.FOLDER) {
        if (resource.getProject().isAccessible()) {
          if (resource.getProject().hasNature(PERL_NATURE_ID)) {
            isPerlFolder = true;
          }
        }
      }
    } catch (CoreException e) {
      e.printStackTrace();
    }

    if (!isPerlProject && defaultEditorDescriptor != null) {
      if (!defaultEditorDescriptor.getId().equals(PERL_EDITOR_ID)
          || EMB_PERL_FILE_EXTENSION.equals(resource.getFileExtension())) {
        return;
      } else {
        isPerlFile = true;
      }
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.eclipse.core.resources.IResourceVisitor#visit(org.eclipse.core.resources.IResource)
     */
    public boolean visit(IResource resource) throws CoreException {
      IEditorDescriptor defaultEditorDescriptor = PerlDebugPlugin
          .getDefault().getWorkbench().getEditorRegistry()
          .getDefaultEditor(resource.getFullPath().toString());

      if (defaultEditorDescriptor == null) {
        return true;
      }

      if (defaultEditorDescriptor.getId().equals(PERL_EDITOR_ID)
          && !resource.getFileExtension().equals(
              EMB_PERL_FILE_EXTENSION)) {
        fileList.add(resource.getFullPath().removeFirstSegments(1)
            .toString());
      }
View Full Code Here

        } catch (final CoreException e) {
        }

        final IWorkbench wbench = PlatformUI.getWorkbench();
        final IWorkbenchPage page = wbench.getActiveWorkbenchWindow().getActivePage();
        final IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry()
                .getDefaultEditor(file.getName());
        try {
            page.openEditor(new FileEditorInput(file), desc.getId());
        } catch (final PartInitException e) {
            ErlLogger.error(e);
        }
    }
View Full Code Here

        }
        return null;
    }

    public static String getEditorID(final IEditorInput input, final Object inputObject) {
        IEditorDescriptor editorDescriptor;
        try {
            if (input instanceof IFileEditorInput) {
                editorDescriptor = IDE.getEditorDescriptor(((IFileEditorInput) input)
                        .getFile());
            } else {
                editorDescriptor = IDE.getEditorDescriptor(input.getName());
            }
        } catch (final PartInitException e) {
            return null;
        }

        if (editorDescriptor != null) {
            return editorDescriptor.getId();
        }

        return null;
    }
View Full Code Here

   */
  public static boolean openEditor(IWorkbench workbench, URI uri) {
    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = workbenchWindow.getActivePage();
   
    IEditorDescriptor editorDescriptor = EditUIUtil.getDefaultEditor(uri, null);
    if (editorDescriptor == null) {
      MessageDialog.openError(
        workbenchWindow.getShell(),
        getString("_UI_Error_title"),
        getString("_WARN_No_Editor", uri.lastSegment()));
      return false;
    }
    else {
      try {
        page.openEditor(new URIEditorInput(uri), editorDescriptor.getId());
      }
      catch (PartInitException exception) {
        MessageDialog.openError(
          workbenchWindow.getShell(),
          getString("_UI_OpenEditorError_label"),
View Full Code Here

   * @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(),
              OntoUML.diagram.part.Messages.DiagramEditorActionBarAdvisor_DefaultFileEditorTitle,
              NLS
                  .bind(
                      OntoUML.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(),
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.