Package org.eclipse.ui.internal.registry

Examples of org.eclipse.ui.internal.registry.FileEditorMapping


        i++;
      }
        }

        // Create the new type and insert it
        resourceType = new FileEditorMapping(newName, newExtension);
        TableItem item = newResourceTableItem(resourceType, i, true);
        resourceTypeTable.setFocus();
        resourceTypeTable.showItem(item);
        fillEditorTable();
    }
View Full Code Here


        return WorkbenchPlugin.getDefault().getPreferenceStore();
    }

    protected void fillEditorTable() {
        editorTable.removeAll();
        FileEditorMapping resourceType = getSelectedResourceType();
        if (resourceType != null) {
            IEditorDescriptor[] array = resourceType.getEditors();
            for (int i = 0; i < array.length; i++) {
                IEditorDescriptor editor = array[i];
                TableItem item = new TableItem(editorTable, SWT.NULL);
                item.setData(DATA_EDITOR, editor);
                // Check if it is the default editor
                String defaultString = null;
                if (resourceType != null) {
                    if (resourceType.getDefaultEditor() == editor && resourceType.isDeclaredDefaultEditor(editor)) {
            defaultString = WorkbenchMessages.FileEditorPreference_defaultLabel;
          }
                }

                if (defaultString != null) {
                    item.setText(editor.getLabel() + " " + defaultString); //$NON-NLS-1$
                } else {
                    item.setText(editor.getLabel());
                }
                item.setImage(getImage(editor));
            }
           
            // now add any content type editors
      EditorRegistry registry = (EditorRegistry) WorkbenchPlugin
          .getDefault().getEditorRegistry();
      IContentType[] contentTypes = Platform.getContentTypeManager()
          .findContentTypesFor(resourceType.getLabel());
      for (int i = 0; i < contentTypes.length; i++) {
        array = registry.getEditorsForContentType(contentTypes[i]);
        for (int j = 0; j < array.length; j++) {
          IEditorDescriptor editor = array[j];
          // don't add duplicates
View Full Code Here

    protected void fillResourceTypeTable() {
        // Populate the table with the items
        IFileEditorMapping[] array = WorkbenchPlugin.getDefault()
                .getEditorRegistry().getFileEditorMappings();
        for (int i = 0; i < array.length; i++) {
            FileEditorMapping mapping = (FileEditorMapping) array[i];
            mapping = (FileEditorMapping) mapping.clone(); // want a copy
            newResourceTableItem(mapping, i, false);
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.internal.registry.FileEditorMapping

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.