Examples of IEditorRegistry


Examples of org.eclipse.ui.IEditorRegistry

        else return null;
    }

    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

Examples of org.eclipse.ui.IEditorRegistry

    private Image getResourceImage(String uri) {
      Image result = null;
      Image base = null;

      IEditorRegistry er = PlatformUI.getWorkbench().getEditorRegistry();
      ImageDescriptor imageDescriptor = er.getImageDescriptor(uri);
      Image image = (Image) imageTable.get(imageDescriptor);
      if (image == null) {
        image = imageDescriptor.createImage();
        imageTable.put(imageDescriptor, image);
      }
View Full Code Here

Examples of org.eclipse.ui.IEditorRegistry

     * @param id
     * @return
     */
    private EditorDescriptor getDescriptor(String id) {
        EditorDescriptor desc;
        IEditorRegistry reg = WorkbenchPlugin.getDefault()
                .getEditorRegistry();
        desc = (EditorDescriptor) reg.findEditor(id);
        return desc;
    }
View Full Code Here

Examples of org.eclipse.ui.IEditorRegistry

      return;
    }

    // Update the file associations if they have changed due to an import
    if (IPreferenceConstants.RESOURCES.equals(propertyName)) {
      IEditorRegistry registry = WorkbenchPlugin.getDefault()
          .getEditorRegistry();
      if (registry instanceof EditorRegistry) {
        EditorRegistry editorRegistry = (EditorRegistry) registry;
        IPreferenceStore store = WorkbenchPlugin.getDefault()
            .getPreferenceStore();
View Full Code Here

Examples of org.eclipse.ui.IEditorRegistry

    Image oldImage= fTitleImage;
    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

Examples of org.eclipse.ui.IEditorRegistry

    return EFS.getLocalFileSystem().getStore(path);
  }

  private String getEditorId(IFileStore fileStore) {
    IWorkbench workbench= fWindow.getWorkbench();
    IEditorRegistry editorRegistry= workbench.getEditorRegistry();
    IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(fileStore.getName());
    if (descriptor != null)
      return descriptor.getId();
    return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
  }
View Full Code Here

Examples of org.eclipse.ui.IEditorRegistry

                newPolicy = ResourcesPlugin.getWorkspace().getRoot().
                        getFile(newPolicyPath);
            }

            // Open the policy
            IEditorRegistry editorRegistry =
                    PlatformUI.getWorkbench().getEditorRegistry();
            String editorId =
                    editorRegistry.getDefaultEditor(newPolicy.getName()).getId();
            IWorkbenchPage activePage =
                    PlatformUI.getWorkbench().
                    getActiveWorkbenchWindow().
                    getActivePage();
            activePage.openEditor(new FileEditorInput(newPolicy),
View Full Code Here

Examples of org.eclipse.ui.IEditorRegistry

   * @param filename
   * @return editor id of the editor associated with the given file name
   */
  private String getEditorId(String filename) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IEditorRegistry editorRegistry = workbench.getEditorRegistry();
    IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(filename);
    if (descriptor != null)
      return descriptor.getId();
    return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
  }
View Full Code Here

Examples of org.eclipse.ui.IEditorRegistry

  public static AbstractTextEditor getEditorForContentTypeWithFakeFileName(IEditorInput contents, Composite parent)
  {
    String fakeFileName=contents.getName();
    if (PlatformUI.getWorkbench() == null)
      throw new RuntimeException("No workbench found! You must create a workbench for using ContentTypeEditorProvider!");
    IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();   
   
    try
    {
   
      IEditorDescriptor defaultEditor = editorRegistry.getDefaultEditor(contents.getName());
      if (defaultEditor == null){
        defaultEditor = editorRegistry.getDefaultEditor("a.txt");
      }
      IEditorPart newEditor =null;
      try{
        newEditor=((EditorDescriptor)defaultEditor).createEditor();
      }catch (Exception e) {
        e.printStackTrace();
        newEditor=((EditorDescriptor)editorRegistry.getDefaultEditor("a.txt")).createEditor();
      }
      if (defaultEditor instanceof EditorDescriptor)
      {
        newEditor.init(new DummyEditorSite(newEditor, "editor", parent), contents);
        Composite con=new Composite(parent,SWT.BORDER);
View Full Code Here

Examples of org.eclipse.ui.IEditorRegistry

   */
  public static Composite getEditorForContentTypeWithFakeFileName(String fakeFileName, String contents, Composite parent)
  {
    if (PlatformUI.getWorkbench() == null)
      throw new RuntimeException("No workbench found! You must create a workbench for using ContentTypeEditorProvider!");
    IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();   
   
    try
    {
      int lastIdx = fakeFileName.lastIndexOf(".");
      if (lastIdx == -1) return null;
      String substring = fakeFileName.substring(0,lastIdx);
      StringBuilder sb = new StringBuilder();
      for (int i = substring.length() - 1; i >= 0; i--)
      {
        if (Character.isJavaIdentifierPart(substring.charAt(i)))
          sb.append(substring.charAt(i));
        else
          break;
      }
      sb.reverse();
      if (sb.length() < 3) substring = "aaa";
      else
        substring = sb.toString();
      File tmpFile = File.createTempFile(substring, fakeFileName.substring(lastIdx, fakeFileName.length()));
     
      tmpFile.deleteOnExit();
      IEditorDescriptor defaultEditor = editorRegistry.getDefaultEditor(tmpFile.getAbsolutePath());
      if (defaultEditor == null){
        defaultEditor = editorRegistry.getDefaultEditor("a.txt");
      }
      IEditorPart newEditor =null;
      try{
        newEditor=((EditorDescriptor)defaultEditor).createEditor();
      }catch (Exception e) {
        e.printStackTrace();
        newEditor=((EditorDescriptor)editorRegistry.getDefaultEditor("a.txt")).createEditor();
      }
      if (defaultEditor instanceof EditorDescriptor)
      {
        newEditor.init(new DummyEditorSite(newEditor, "editor", parent), new StringEditorInput(contents));
        Composite con=new Composite(parent,SWT.BORDER);
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.