Examples of IEditorDescriptor


Examples of org.eclipse.ui.IEditorDescriptor

   * Opens a new editor.
   *
   * @return The newly opened editor.
   */
  protected IEditorPart openNewEditor() throws Exception {
    IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(
        "a.txt");
    return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
        new FileEditorInput(getFileForTesting()), desc.getId(), true);
  }
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

            logger.debug("Opening: " + zkn);
          try {
            ZooKeeperClient client = ZooKeeperManager.INSTANCE.getClient(zkn.getServer());
            byte[] open = client.open(zkn);
            IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
            IEditorDescriptor defaultEditor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(zkn.getNodeName());
            activePage.openEditor(new ZooKeeperNodeEditorInput(zkn, open), defaultEditor == null ? "org.eclipse.ui.DefaultTextEditor"
                : defaultEditor.getId(), true);
          } catch (CoreException e) {
            logger.error(e.getMessage(), e);
          } catch (IOException e) {
            logger.error(e.getMessage(), e);
          } catch (InterruptedException e) {
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

        status);
  }

  private String getFileEditorId(IFile file) throws PartInitException {
    String editorId = null;
    IEditorDescriptor desc;
    desc = IDE.getEditorDescriptor(file);
    if (desc == null || !desc.isInternal()) {
      editorId = "org.eclipse.ui.DefaultTextEditor";
    } else {
      editorId = desc.getId();
    }
    return editorId;
  }
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

            int i = 0;
            IEditorDescriptor[] descriptors = editorRegistry
                .getSortedEditorsFromPlugins();
            // Get the internal editors
            for (i = 0; i < descriptors.length; i++) {
              IEditorDescriptor descriptor = descriptors[i];
              editorMap.put(descriptor.getId(), descriptor);
            }
            // Get the external (OS) editors
            descriptors = editorRegistry.getSortedEditorsFromOS();
            for (i = 0; i < descriptors.length; i++) {
              IEditorDescriptor descriptor = descriptors[i];
              editorMap.put(descriptor.getId(), descriptor);
            }
            // Update the file to editor(s) mappings
            editorRegistry.readResources(editorMap, reader);
          }
        } catch (WorkbenchException e) {
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

          throw new CaoException(e1);
        }
        final JackEditorInput editorInput = new JackEditorInput(jack.getNode(),new Path(tmpFile.getAbsolutePath()));
       
//        IEditorReference[] editorRefs = page.findEditors(editorInput,null,IWorkbenchPage.MATCH_INPUT);
        IEditorDescriptor desc = window.getWorkbench().getEditorRegistry().getDefaultEditor(editorInput.getName());
        if (desc == null) {
          System.out.println("User default txt editor");
          desc = window.getWorkbench().getEditorRegistry().getDefaultEditor("text.txt");
        }
        System.out.println(desc);
        if (desc != null) {
          final IEditorDescriptor descFinal = desc;
          window.getShell().getDisplay().asyncExec(new Runnable() {
           
            @Override
            public void run() {
              try {
                final IEditorPart editor = page.openEditor(
                    editorInput, descFinal.getId());
                editor.addPropertyListener(new IPropertyListener() {
                  public void propertyChanged(Object source,
                      int propId) {
                    if (IEditorPart.PROP_DIRTY == propId) {
                      if (editor instanceof AbstractDecoratedTextEditor && (!editor.isDirty())) {
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

        icu2.createPackageDeclaration(pkg.getElementName(), null);

        IFile input = (IFile) icu2.getResource();
        final IEditorInput editorInput = new FileEditorInput(input);
        final IEditorDescriptor desc = PlatformUI.getWorkbench()
            .getEditorRegistry().getDefaultEditor(input.getName());

        PlatformUI.getWorkbench().getDisplay()
            .asyncExec(new Runnable() {
              @Override
              public void run() {
                try {
                  IEditorPart editor = PlatformUI
                      .getWorkbench()
                      .getActiveWorkbenchWindow()
                      .getActivePage()
                      .openEditor(editorInput,
                          desc.getId());

                  // Organize imports if necessary
                  if (Activator
                      .getDefault()
                      .getPreferenceStore()
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

    icu2.createPackageDeclaration(pkg.getElementName(), monitor);

    if (openInEditor) {
      IFile input = (IFile) icu2.getResource();
      final IEditorInput editorInput = new FileEditorInput(input);
      final IEditorDescriptor desc = PlatformUI.getWorkbench()
          .getEditorRegistry().getDefaultEditor(input.getName());

      PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
        @Override
        public void run() {
          try {
            IEditorPart editor = PlatformUI.getWorkbench()
                .getActiveWorkbenchWindow().getActivePage()
                .openEditor(editorInput, desc.getId());

            // Organize imports if necessary
            if (Activator
                .getDefault()
                .getPreferenceStore()
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

        icu2.createPackageDeclaration(pkg.getElementName(), null);

        IFile input = (IFile) icu2.getResource();
        final IEditorInput editorInput = new FileEditorInput(input);
        final IEditorDescriptor desc = PlatformUI.getWorkbench()
            .getEditorRegistry().getDefaultEditor(input.getName());

        PlatformUI.getWorkbench().getDisplay()
            .asyncExec(new Runnable() {
              @Override
              public void run() {
                try {
                  IEditorPart editor = PlatformUI
                      .getWorkbench()
                      .getActiveWorkbenchWindow()
                      .getActivePage()
                      .openEditor(editorInput,
                          desc.getId());

                  // Organize imports if necessary
                  if (Activator
                      .getDefault()
                      .getPreferenceStore()
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

     *            if the source text of the resource could not be read
     */
  public synchronized boolean validate(IResource resource)
        throws CoreException, IOException
    {
    IEditorDescriptor defaultEditorDescriptor =
      PerlEditorPlugin
        .getDefault()
        .getWorkbench()
        .getEditorRegistry()
        .getDefaultEditor(resource.getFullPath().toString());

    if (defaultEditorDescriptor == null) return false;

    if (!defaultEditorDescriptor.getId().equals(Constants.PERL_EDITOR_ID)
      || resource.getFileExtension().equals(Constants.EMB_PERL_FILE_EXTENSION))
        {
      return false;
    }
       
View Full Code Here

Examples of org.eclipse.ui.IEditorDescriptor

    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
TOP
Copyright © 2018 www.massapi.com. 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.