Package org.eclipse.core.runtime.content

Examples of org.eclipse.core.runtime.content.IContentType


     * (non-Javadoc)
     *
     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
     */
    public Object[] getElements(Object inputElement) {
      IContentType contentType = (IContentType) inputElement;
      String[] userextfileSpecs = contentType
          .getFileSpecs(IContentType.FILE_EXTENSION_SPEC
              | IContentType.IGNORE_PRE_DEFINED);
      String[] usernamefileSpecs = contentType
          .getFileSpecs(IContentType.FILE_NAME_SPEC
              | IContentType.IGNORE_PRE_DEFINED);
      String[] preextfileSpecs = contentType
          .getFileSpecs(IContentType.FILE_EXTENSION_SPEC
              | IContentType.IGNORE_USER_DEFINED);
      String[] prenamefileSpecs = contentType
          .getFileSpecs(IContentType.FILE_NAME_SPEC
              | IContentType.IGNORE_USER_DEFINED);

      return createSpecs(userextfileSpecs, usernamefileSpecs,
          preextfileSpecs, prenamefileSpecs);
View Full Code Here


     * (non-Javadoc)
     *
     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
     */
    public String getText(Object element) {
      IContentType contentType = (IContentType) element;
      return contentType.getName();
    }
View Full Code Here

   
    itr = contentTypeVector.iterator();
    while(itr.hasNext()) {
      String contentTypeId = (String) itr.next();
      if (contentTypeId != null && contentTypeId.length() > 0) {
        IContentType contentType = Platform.getContentTypeManager().getContentType(contentTypeId);
        if (contentType != null) {
          IEditorDescriptor [] editorArray = (IEditorDescriptor[]) contentTypeToEditorMappings.get(contentType);
          if (editorArray == null) {
            editorArray = new IEditorDescriptor[] {editor};
            contentTypeToEditorMappings.put(contentType, editorArray);
View Full Code Here

       
        List allMappings = new ArrayList(Arrays.asList(standardMappings));
        // mock-up content type extensions into IFileEditorMappings
        IContentType [] contentTypes = Platform.getContentTypeManager().getAllContentTypes();
        for (int i = 0; i < contentTypes.length; i++) {
      IContentType type = contentTypes[i];
      String [] extensions = type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
      for (int j = 0; j < extensions.length; j++) {
        String extension = extensions[j];
        boolean found = false;
        for (Iterator k = allMappings.iterator(); k.hasNext();) {
          IFileEditorMapping mapping = (IFileEditorMapping) k.next();
          if ("*".equals(mapping.getName()) && extension.equals(mapping.getExtension())) { //$NON-NLS-1$
            found = true;
            break;
          }
        }
        if (!found) {
          MockMapping mockMapping = new MockMapping(type, "*", extension); //$NON-NLS-1$
          allMappings.add(mockMapping);
        }
      }
   
      String [] filenames = type.getFileSpecs(IContentType.FILE_NAME_SPEC);
      for (int j = 0; j < filenames.length; j++) {
        String wholename = filenames[j];
        int idx = wholename.indexOf('.');       
        String name = idx == -1 ? wholename : wholename.substring(0, idx);
        String extension = idx == -1 ? "" : wholename.substring(idx + 1); //$NON-NLS-1$
View Full Code Here

     *
     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
     */
    public Object[] getChildren(Object parentElement) {
      List elements = new ArrayList();
      IContentType baseType = (IContentType) parentElement;
      IContentType[] contentTypes = manager.getAllContentTypes();
      for (int i = 0; i < contentTypes.length; i++) {
        IContentType type = contentTypes[i];
        if (Util.equals(type.getBaseType(), baseType)) {
          elements.add(type);
        }
      }
      return elements.toArray();
    }
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
     */
    public Object getParent(Object element) {
      IContentType contentType = (IContentType) element;
      return contentType.getBaseType();
    }
View Full Code Here

        setLockedItemText(oldDefaultItem, oldDefaultItem.getText());
      }
            // Now set the new default
            EditorDescriptor editor = (EditorDescriptor) items[0].getData(DATA_EDITOR);
            getSelectedResourceType().setDefaultEditor(editor);
            IContentType fromContentType = (IContentType) items[0].getData(DATA_FROM_CONTENT_TYPE);
            items[0].dispose(); //Table is single selection
            TableItem item = new TableItem(editorTable, SWT.NULL, 0);
            item.setData(DATA_EDITOR, editor);
            if (fromContentType != null) {
        item.setData(DATA_FROM_CONTENT_TYPE, fromContentType);
View Full Code Here

   * @param item the item to test
   * @return whether the selected editor is removable
   * @since 3.1
   */
    private boolean isEditorRemovable(TableItem item) {
    IContentType fromContentType = (IContentType) item.getData(DATA_FROM_CONTENT_TYPE);
    return fromContentType == null;
  }
View Full Code Here

  public SyntaxColoringPage(){
    super();
    store = EditorPlugin.getDefault().getPreferenceStore();
   
    IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
    IContentType type = contentTypeManager.getContentType("at.ssw.cocoE.editor.CocoEContentType");
   
    contentTypes = type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
   
    editorMap = loadPreferenceValues();
   
    tokenMap = new HashMap<Integer, String>();
  }
View Full Code Here

    Composite upperPart = new Composite(content, SWT.NONE);
    upperPart.setLayout(new GridLayout(1, false));
   
   
    IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
    IContentType type = contentTypeManager.getContentType("at.ssw.cocoE.editor.CocoEContentType");
   
    String[] contentTypes = type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
   
    editorChooser = new Combo(upperPart, SWT.NONE);
   
    for(String s : contentTypes){
      editorChooser.add(s);
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.content.IContentType

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.