Package org.eclipse.core.runtime.content

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


  public static boolean isJSPModel(IDOMModel model) {   
    final IContentTypeManager typeManager = Platform.getContentTypeManager();
    final IStructuredDocumentContext context = IStructuredDocumentContextFactory.INSTANCE.getContext(model.getStructuredDocument(), 0);
    final IWorkspaceContextResolver resolver = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(context);
    final IFile file = (IFile)resolver.getResource();
        final IContentType contentType =
            typeManager.findContentTypeFor(file.getName());
       
    return contentType.isKindOf(JSP_CONTENTTYPE);
  }
View Full Code Here


      return null;

    IContentDescription desc = null;
    try {

      IContentType contentTypeJSP = Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSP);
      desc = contentTypeJSP.getDescriptionFor(in, IContentDescription.ALL);
    }
    catch (IOException e) {
      Logger.logException(e);
    }
    finally {
View Full Code Here

    IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(doc);
    try {
      if (sModel instanceof IDOMModel) {
        String contentType = ((IDOMModel) sModel).getContentTypeIdentifier();
        if (contentType != null) {
          IContentType modelCT = Platform.getContentTypeManager().getContentType(contentType);
          IContentType tagCT = Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSPTAG);
          if (modelCT != null && tagCT != null) {
            isTag = modelCT.isKindOf(tagCT);
          }
        }
      }
View Full Code Here

  public SpellcheckStrategy(ISourceViewer viewer, String contentTypeId) {
    super(viewer);
    fContentTypeId = contentTypeId;

    fSpellingContext = new SpellingContext();
    IContentType contentType = Platform.getContentTypeManager().getContentType(fContentTypeId);
    fSpellingContext.setContentType(contentType);
    fReconcileAnnotationKey = new ReconcileAnnotationKey(fSpellingStep, KEY_CONTENT_TYPE, ReconcileAnnotationKey.PARTIAL);

    /**
     * Inherit spelling region rules
     */
    List contexts = new ArrayList();
    IContentType testType = contentType;
    while (testType != null) {
      String[] textRegionContexts = ExtendedConfigurationBuilder.getInstance().getDefinitions(EXTENDED_BUILDER_TYPE_CONTEXTS, testType.getId());
      for (int j = 0; j < textRegionContexts.length; j++) {
        contexts.addAll(Arrays.asList(StringUtils.unpack(textRegionContexts[j])));
      }
      testType = testType.getBaseType();
    }
    fSupportedTextRegionContexts = (String[]) contexts.toArray(new String[contexts.size()]);

    fSpellCheckPreferenceListener = new SpellCheckPreferenceListener();
  }
View Full Code Here

    fContentTypeManager = Platform.getContentTypeManager();

    String[] supportedContentTypeIDs = FileTaskScannerRegistryReader.getInstance().getSupportedContentTypeIds();
    fSupportedContentTypes = new ArrayList(supportedContentTypeIDs.length);
    for (int i = 0; i < supportedContentTypeIDs.length; i++) {
      IContentType type = fContentTypeManager.getContentType(supportedContentTypeIDs[i]);
      if (type != null) {
        fSupportedContentTypes.add(type);
      }
    }
    String[] ignoreContentTypes = StringUtils.unpack(fPreferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, SSECorePlugin.getDefault().getPluginPreferences().getDefaultString(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED), fPreferencesLookupOrder));
    List contentTypes = new ArrayList();
    for (int i = 0; i < ignoreContentTypes.length; i++) {
      IContentType type = fContentTypeManager.getContentType(ignoreContentTypes[i]);
      if (type != null) {
        contentTypes.add(type);
      }
    }
    fOriginalIgnoreContentTypes = fIgnoreContentTypes = (IContentType[]) contentTypes.toArray(new IContentType[contentTypes.size()]);
View Full Code Here

    }
    String[] defaultIgnoreTypes = StringUtils.unpack(fPreferencesService.get(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, null, defaultPreferences)); //$NON-NLS-1$

    List contentTypes = new ArrayList();
    for (int i = 0; i < defaultIgnoreTypes.length; i++) {
      IContentType type = fContentTypeManager.getContentType(defaultIgnoreTypes[i]);
      if (type != null) {
        contentTypes.add(type);
      }
    }
    fIgnoreContentTypes = (IContentType[]) contentTypes.toArray(new IContentType[contentTypes.size()]);
View Full Code Here

  public SpellcheckStrategy(ISourceViewer viewer, String contentTypeId) {
    super(viewer);
    fContentTypeId = contentTypeId;

    fSpellingContext = new SpellingContext();
    IContentType contentType = Platform.getContentTypeManager().getContentType(fContentTypeId);
    fSpellingContext.setContentType(contentType);
    fReconcileAnnotationKey = new ReconcileAnnotationKey(fSpellingStep, KEY_CONTENT_TYPE, ReconcileAnnotationKey.PARTIAL);

    /**
     * Inherit spelling region rules
     */
    List contexts = new ArrayList();
    IContentType testType = contentType;
    while (testType != null) {
      String[] textRegionContexts = ExtendedConfigurationBuilder.getInstance().getDefinitions(EXTENDED_BUILDER_TYPE_CONTEXTS, testType.getId());
      for (int j = 0; j < textRegionContexts.length; j++) {
        contexts.addAll(Arrays.asList(StringUtils.unpack(textRegionContexts[j])));
      }
      testType = testType.getBaseType();
    }
    fSupportedTextRegionContexts = (String[]) contexts.toArray(new String[contexts.size()]);

    fSpellCheckPreferenceListener = new SpellCheckPreferenceListener();
  }
View Full Code Here

    fContentTypeManager = Platform.getContentTypeManager();

    String[] supportedContentTypeIDs = FileTaskScannerRegistryReader.getInstance().getSupportedContentTypeIds();
    fSupportedContentTypes = new ArrayList(supportedContentTypeIDs.length);
    for (int i = 0; i < supportedContentTypeIDs.length; i++) {
      IContentType type = fContentTypeManager.getContentType(supportedContentTypeIDs[i]);
      if (type != null) {
        fSupportedContentTypes.add(type);
      }
    }
    String[] ignoreContentTypes = StringUtils.unpack(fPreferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, SSECorePlugin.getDefault().getPluginPreferences().getDefaultString(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED), fPreferencesLookupOrder));
    List contentTypes = new ArrayList();
    for (int i = 0; i < ignoreContentTypes.length; i++) {
      IContentType type = fContentTypeManager.getContentType(ignoreContentTypes[i]);
      if (type != null) {
        contentTypes.add(type);
      }
    }
    fOriginalIgnoreContentTypes = fIgnoreContentTypes = (IContentType[]) contentTypes.toArray(new IContentType[contentTypes.size()]);
View Full Code Here

    }
    String[] defaultIgnoreTypes = StringUtils.unpack(fPreferencesService.get(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, null, defaultPreferences)); //$NON-NLS-1$

    List contentTypes = new ArrayList();
    for (int i = 0; i < defaultIgnoreTypes.length; i++) {
      IContentType type = fContentTypeManager.getContentType(defaultIgnoreTypes[i]);
      if (type != null) {
        contentTypes.add(type);
      }
    }
    fIgnoreContentTypes = (IContentType[]) contentTypes.toArray(new IContentType[contentTypes.size()]);
View Full Code Here

      // and IO is expensive
        boolean isJsp = false;

        if (file != null && file.exists()) {
         
            IContentType contentTypeJSP = Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSP);
            // check this before description, it's less expensive
            if (contentTypeJSP.isAssociatedWith(file.getName())) {
              isJsp = true;
            }
        }

        return isJsp;
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.