Examples of IContentType


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

     
      // all other textual resources should be validated
      try {
        IContentDescription desc = file.getContentDescription();
        if (desc != null) {       
          IContentType type = desc.getContentType();
          if (type != null && desc.getContentType().isKindOf(Platform.getContentTypeManager().getContentType("org.eclipse.core.runtime.text"))) {
            return true;
          }
        }
      } catch (CoreException e) {
View Full Code Here

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

        _versionCompliance = versionCompliance;
    }

    private void parse() throws BadLocationException {
        // compute environment flags
        IContentType contentType;
        try {
            contentType = Plugin.getDefault().getActiveFile().getContentDescription().getContentType();
            if (contentType.getId().equals(ResourceIDs.CONTENT_TYPE_TML)) {
                _envFlags = _envFlags | ReflectionManager.ENV_BLOCK;
            } else if (contentType.getId().equals(ResourceIDs.CONTENT_TYPE_TMLSCRIPT)) {
                _envFlags = _envFlags | ReflectionManager.ENV_MODULE;
            }
        }
        catch (CoreException e1) {
            Plugin.getDefault().logWarning("Unable to define environment flags for tml script region", e1);
View Full Code Here

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

    if (JAVA_LIKE_EXTENSIONS == null) {
      // TODO (jerome) reenable once JDT UI supports other file extensions (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=71460)
      if (!ENABLE_JAVA_LIKE_EXTENSIONS)
        JAVA_LIKE_EXTENSIONS = new char[][] {SuffixConstants.EXTENSION_java.toCharArray()};
      else {
        IContentType javaContentType = Platform.getContentTypeManager().getContentType(JavaCore.JAVA_SOURCE_CONTENT_TYPE);
        HashSet fileExtensions = new HashSet();
        // content types derived from java content type should be included (https://bugs.eclipse.org/bugs/show_bug.cgi?id=121715)
        IContentType[] contentTypes = Platform.getContentTypeManager().getAllContentTypes();
        for (int i = 0, length = contentTypes.length; i < length; i++) {
          if (contentTypes[i].isKindOf(javaContentType)) { // note that javaContentType.isKindOf(javaContentType) == true
View Full Code Here

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

    }

    private Collection<String> findPackages(ISigilProjectModel project)
    {
        final IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
        final IContentType javaContentType = contentTypeManager.getContentType("org.eclipse.jdt.core.javaSource");
        final HashSet<String> packages = new HashSet<String>();

        try
        {
            project.getProject().accept(new IResourceVisitor()
            {
                public boolean visit(IResource resource) throws CoreException
                {
                    if (resource instanceof IFile)
                    {
                        IFile f = (IFile) resource;
                        IContentType ct = contentTypeManager.findContentTypeFor(f.getName());
                        if (ct != null && ct.isKindOf(javaContentType))
                        {
                            ICompilationUnit cu = (ICompilationUnit) JavaCore.create(f);
                            IPackageFragment pf = (IPackageFragment) cu.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
                            packages.add(pf.getElementName());
                        }
View Full Code Here

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

    private static void findTextImports(ISigilProjectModel project, Set<String> imports,
        IProgressMonitor monitor)
    {
        IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
        IContentType txt = contentTypeManager.getContentType("org.eclipse.core.runtime.text");
        for (Resource p : project.getBundle().getSourcePaths())
        {
            IFile f = project.getProject().getFile(p.getLocalFile());
            if (f.exists())
            {
                try
                {
                    IContentDescription desc = f.getContentDescription();
                    if (desc != null)
                    {
                        IContentType type = desc.getContentType();
                        if (type != null)
                        {
                            if (type.isKindOf(txt))
                            {
                                parseText(f, imports);
                            }
                        }
                    }
View Full Code Here

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

   *
   * @return List
   */
  private List getValidExtensions() {
    if (fValidExtensions == null) {
      IContentType type = getContentType();
      fValidExtensions = new ArrayList(Arrays.asList(type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
    }
    return fValidExtensions;
  }
View Full Code Here

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

  /**
   * Returns the registered Java like extensions.
   */
  public static char[][] getJavaLikeExtensions() {
    if (JAVA_LIKE_EXTENSIONS == null) {
      IContentType javaContentType = Platform.getContentTypeManager().getContentType(JavaCore.JAVA_SOURCE_CONTENT_TYPE);
      HashSet fileExtensions = new HashSet();
      // content types derived from java content type should be included (https://bugs.eclipse.org/bugs/show_bug.cgi?id=121715)
      IContentType[] contentTypes = Platform.getContentTypeManager().getAllContentTypes();
      for (int i = 0, length = contentTypes.length; i < length; i++) {
        if (contentTypes[i].isKindOf(javaContentType)) { // note that javaContentType.isKindOf(javaContentType) == true
View Full Code Here

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

  /*
   * @see org.eclipse.ui.texteditor.IDocumentProviderExtension4#getContentType(java.lang.Object)
   * @since 3.1
   */
  public IContentType getContentType(Object element) throws CoreException {
    IContentType contentType= null;
    if (!canSaveDocument(element) && element instanceof IFileEditorInput)
      contentType= getContentType((IFileEditorInput) element);

    if (contentType == null)
      contentType= super.getContentType(element);
View Full Code Here

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

      return true;
   
    if (target.matchesClass(editor.getClass()))
      return true;

    IContentType contentType= getContentType(editor);
    return contentType != null && target.matchesContentType(contentType);

  }
View Full Code Here

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

   
    if (resource instanceof IFile) {
      IContentDescription contentDescription = ((IFile) resource).getContentDescription();
    
      if (contentDescription != null) {
        IContentType contentType = contentDescription.getContentType();
       
        isConsumerDescritporFile =
                contentType != null && CONSUMER_DESCRIPTOR_ID.equals(contentType.getId());
      }
    }
   
    return isConsumerDescritporFile;
  }
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.