Package org.eclipse.core.runtime.content

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


      // 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


        editorClass = editorClass.getSuperclass();
      }
    }

    if (fContentType != null) {
      IContentType contentType = Platform.getContentTypeManager().getContentType(fContentType);
      while (contentType != null && !contentType.getId().equals(IContentTypeManager.CT_TEXT)) {
        if (!points.contains(contentType.getId()))
          points.add(contentType.getId());
        contentType = contentType.getBaseType();
      }
    }

    if (fRootClass != null && !points.contains(fRootClass.getName()))
      points.add(fRootClass.getName());
View Full Code Here

    if (name == null) {
      return null;
    }

    IContentType contentType= null;
    try {
      InputStream is = null;
      try {
        is = store.openInputStream(EFS.NONE, null);
        contentType= Platform.getContentTypeManager().findContentTypeFor(is, name);
View Full Code Here

    if (doc == null)
      return null;

    String contentTypeId = null;

    IContentType ct = null;
    try {
      IContentDescription desc = Platform.getContentTypeManager().getDescriptionFor(new StringReader(doc.get()), null, IContentDescription.ALL);
      if (desc != null) {
        ct = desc.getContentType();
        if (ct != null)
          contentTypeId = ct.getId();
      }
    }
    catch (IOException e) {
      // just bail
    }
View Full Code Here

     
      ITextViewer viewer = getTextViewer();
      if(viewer instanceof ProjectionViewer) {
        ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
       
        IContentType type = Platform.getContentTypeManager().getContentType(contentTypeId);
        while(fFoldingStrategy == null && type != null) {
          fFoldingStrategy =(AbstractStructuredFoldingStrategy) builder.getConfiguration(
              AbstractStructuredFoldingStrategy.ID, type.getId());
       
          type = type.getBaseType();
        }
       
        if(fFoldingStrategy != null) {
          fFoldingStrategy.setViewer((ProjectionViewer)viewer);
          fFoldingStrategy.setDocument(getDocument());
View Full Code Here

   
    ISemanticHighlighting highlighting = null;
    String styleKey = null;
    IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(SSEUIPlugin.ID, SEMANTIC_HIGHLIGHTING_EXTENSION_POINT);
   
    IContentType contentType = Platform.getContentTypeManager().getContentType(fContentTypeId);
   
    for (int i = 0; i < elements.length; i++) {
      String[] targets = StringUtils.unpack(elements[i].getAttribute(TARGET_ATTR));
      for (int j = 0; j < targets.length; j++) {
        IContentType targetContentType = Platform.getContentTypeManager().getContentType(targets[j]);
        /* Apply semantic highlighting to kinds of targetContentType */
        if (contentType.isKindOf(targetContentType)) {
          try {
            highlighting = (ISemanticHighlighting) elements[i].createExecutableExtension(CLASS_ATTR);
            styleKey = elements[i].getAttribute(STYLE_KEY_ATTR);
View Full Code Here

    IContentDescription contentDescription = null;
    try {
      contentDescription = ((IFile) file).getContentDescription();
      if (contentDescription != null) {
        IContentType contentType = contentDescription.getContentType();
        return contentDescription != null && contentType.isKindOf(getXMLContentType());
      }
    }
    catch (CoreException e) {
      Logger.logException(e);
    }
View Full Code Here

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

     * @return true if extension is valid for this content type
     */
    boolean extensionValidForContentType(String fileName) {
      boolean valid = false;

      IContentType type = Platform.getContentTypeManager().getContentType(ContentTypeIdForXML.ContentTypeID_XML);
      // there is currently an extension
      if (fileName.lastIndexOf('.') != -1) {
        // check what content types are associated with current
        // extension
        IContentType[] types = Platform.getContentTypeManager().findContentTypesFor(fileName);
View Full Code Here

    final String path = fURL.getPath();
    String name = null;
    if (path != null)
      name = new Path(fURL.getPath()).lastSegment();

    IContentType contentType= null;
    try {
      InputStream is = null;
      try {
        is = storage.getContents();
        contentType= Platform.getContentTypeManager().findContentTypeFor(is, name);
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.