Examples of IContentDescription


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

  private boolean isConsumerDescriptorFile(IResource resource) throws CoreException {
   
    boolean isConsumerDescritporFile = false;
   
    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());
      }
    }
View Full Code Here

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

  private boolean isAnalysisEngineDescriptorFile(IResource resource) throws CoreException {
   
    boolean isAnalysisEngineDescriptorFile = false;
   
    if (resource instanceof IFile) {
      IContentDescription contentDescription = ((IFile) resource).getContentDescription();
     
      if (contentDescription != null) {
        IContentType contentType = contentDescription.getContentType();
       
        isAnalysisEngineDescriptorFile =
                contentType != null && ANALYSIS_ENGINE_DESCRIPTOR_ID.equals(contentType.getId());

      }
View Full Code Here

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

      }
     
      //fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=202613 kindly contributed by Eiji Morito.
      IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
      IContentType contentType = contentTypeManager.getContentType("org.eclipse.wst.html.core.htmlsource"); //$NON-NLS-1$
      IContentDescription contentDescription = contentType.getDescriptionFor(new StringReader(result.toString()), null);
      String charset = contentDescription.getCharset();
     
      if (charset == null || !Charset.isSupported(charset)) {
        charset = ResourcesPlugin.getEncoding();
        if (charset == null)
          charset = "UTF-8"; //$NON-NLS-1$
View Full Code Here

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

   */
  private boolean isFragment(IFile file) {
    boolean isFragment = false;
    InputStream is = null;
    try {
      IContentDescription contentDescription = file.getContentDescription();
      // it can be null
      if (contentDescription == null) {
        is = file.getContents();
        contentDescription = Platform.getContentTypeManager().getDescriptionFor(is, file.getName(), new QualifiedName[]{IContentDescription.CHARSET});
      }
      if (contentDescription != null) {
        String fileCtId = contentDescription.getContentType().getId();
        isFragment = (fileCtId != null && ContentTypeIdForJSP.ContentTypeID_JSPFRAGMENT.equals(fileCtId));
      }
    }
    catch (IOException e) {
      // ignore, assume it's invalid JSP
View Full Code Here

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

  private IContentDescription getContentDescription(Reader reader) {

    if (reader == null)
      return null;

    IContentDescription desc = null;
    try {

      IContentType contentTypeJSP = Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSP);
      desc = contentTypeJSP.getDescriptionFor(reader, IContentDescription.ALL);
    }
View Full Code Here

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

    // note: this will currently only work for models backed by files
    EmbeddedTypeHandler embeddedContentType = null;
    IDOMModel domModel = (IDOMModel) model;

    if (embeddedContentType == null) {
      IContentDescription desc = getContentDescription(structuredDocument);
      if (desc != null) {
        Object prop = null;

        prop = desc.getProperty(IContentDescriptionForJSP.CONTENT_FAMILY_ATTRIBUTE);
        if (prop != null) {
          if (ContentTypeFamilyForHTML.HTML_FAMILY.equals(prop)) {
            embeddedContentType = EmbeddedTypeRegistryImpl.getInstance().getTypeFor("text/html");
          }
        }

        if (embeddedContentType == null) {

          prop = desc.getProperty(IContentDescriptionForJSP.CONTENT_TYPE_ATTRIBUTE);
          if (prop != null) {
            embeddedContentType = EmbeddedTypeRegistryImpl.getInstance().getTypeFor((String) prop);
          }
        }
      }
View Full Code Here

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

   */
  private boolean isFragment(IFile file) {
    boolean isFragment = false;
    InputStream is = null;
    try {
      IContentDescription contentDescription = file.getContentDescription();
      // it can be null
      if (contentDescription == null) {
        is = file.getContents();
        contentDescription = Platform.getContentTypeManager().getDescriptionFor(is, file.getName(), new QualifiedName[]{IContentDescription.CHARSET});
      }
      if (contentDescription != null) {
        String fileCtId = contentDescription.getContentType().getId();
        isFragment = (fileCtId != null && ContentTypeIdForJSP.ContentTypeID_JSPFRAGMENT.equals(fileCtId));
      }
    }
    catch (IOException e) {
      // ignore, assume it's invalid JSP
View Full Code Here

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

   */
  private boolean isFragment(IFile file) {
    boolean isFragment = false;
    InputStream is = null;
    try {
      IContentDescription contentDescription = file.getContentDescription();
      // it can be null
      if (contentDescription == null) {
        is = file.getContents();
        contentDescription = Platform.getContentTypeManager().getDescriptionFor(is, file.getName(), new QualifiedName[]{IContentDescription.CHARSET});
      }
      if (contentDescription != null) {
        String fileCtId = contentDescription.getContentType().getId();
        isFragment = (fileCtId != null && ContentTypeIdForJSP.ContentTypeID_JSPFRAGMENT.equals(fileCtId));
      }
    }
    catch (IOException e) {
      // ignore, assume it's invalid JSP
View Full Code Here

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

          InputStream contents = null;
          try {
            contents = storage.getContents();
            if (contents != null) {
              QualifiedName[] detectionOptions = new QualifiedName[]{IContentDescription.BYTE_ORDER_MARK, IContentDescription.CHARSET};
              IContentDescription description = Platform.getContentTypeManager().getDescriptionFor(contents, storage.getName(), detectionOptions);
              if (description != null) {
                charset = description.getCharset();
              }
            }

          }
          catch (IOException e) {
View Full Code Here

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

    if(monitor == null || monitor.isCanceled())
      return;
   
    try {
      monitor.beginTask("", 100);
      IContentDescription contentDescription = file.getContentDescription();
      monitor.worked(5);
      if (contentDescription != null) {
        IContentType contentType = contentDescription.getContentType();
        IStructuredFormatProcessor formatProcessor = getFormatProcessor(contentType.getId());
        if (formatProcessor != null && (monitor == null || !monitor.isCanceled())) {
          String message = NLS.bind(SSEUIMessages.FormatActionDelegate_3, new String[]{file.getFullPath().toString().substring(1)});          monitor.subTask(message);
          formatProcessor.setProgressMonitor(monitor);
          formatProcessor.formatFile(file);
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.