Examples of IContentDescription


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

      try {
        if (resource instanceof IFile) {
          IFile file = (IFile) resource;

          IStructuredFormatProcessor formatProcessor = null;
          IContentDescription contentDescription = file.getContentDescription();
          if (contentDescription != null) {
            IContentType contentType = contentDescription.getContentType();
            formatProcessor = getFormatProcessor(contentType.getId());
          }
          if (formatProcessor != null)
            result = true;
        }
View Full Code Here

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

      Logger.log(Logger.ERROR, "model should never be null in PageDirective Adapter");
      return;
    }

    EmbeddedTypeHandler potentialNewandler = null;
    IContentDescription contentDescription = getContentDescription(model.getStructuredDocument());
    Object prop = contentDescription.getProperty(IContentDescriptionForJSP.CONTENT_FAMILY_ATTRIBUTE);
    if (prop != null) {
      if (ContentTypeFamilyForHTML.HTML_FAMILY.equals(prop)) {
        potentialNewandler = EmbeddedTypeRegistryImpl.getInstance().getTypeFor("text/html");
      }
    }
View Full Code Here

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

  private IContentDescription getContentDescription(Reader in) {

    if (in == null)
      return null;

    IContentDescription desc = null;
    try {

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

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

      return newStamp > modificationStamp;
    }

    private String detectCharset(IFile file) {
      if (file.getType() == IResource.FILE && file.isAccessible()) {
        IContentDescription d = null;
        try {
          // optimized description lookup, might not succeed
          d = file.getContentDescription();
          if (d != null)
            return d.getCharset();
        }
        catch (CoreException e) {
          // should not be possible given the accessible and file
          // type
          // check above
        }
        InputStream contents = null;
        try {
          contents = file.getContents();
          IContentDescription description = Platform.getContentTypeManager().getDescriptionFor(contents, file.getName(), new QualifiedName[]{IContentDescription.CHARSET});
          if (description != null) {
            return description.getCharset();
          }
        }
        catch (IOException e) {
          // will try to cleanup in finally
        }
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(new SubProgressMonitor(monitor, 95));
          formatProcessor.formatFile(file);
View Full Code Here

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

      try {
        if (resource instanceof IFile) {
          IFile file = (IFile) resource;

          IStructuredFormatProcessor formatProcessor = null;
          IContentDescription contentDescription = file.getContentDescription();
          if (contentDescription != null) {
            IContentType contentType = contentDescription.getContentType();
            formatProcessor = getFormatProcessor(contentType.getId());
          }
          if (formatProcessor != null)
            result = true;
        }
View Full Code Here

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

    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) {
View Full Code Here

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

    IContentType type = null;

    IResource resource = FileBuffers.getWorkspaceFileAtLocation(location);
    if (resource != null) {
      if (resource.getType() == IResource.FILE && resource.isAccessible()) {
        IContentDescription d = null;
        try {
          // Optimized description lookup, might not succeed
          d = ((IFile) resource).getContentDescription();
          if (d != null) {
            type = d.getContentType();
          }
        }
        catch (CoreException e) {
          // Should not be possible given the accessible and file
          // type check above
View Full Code Here

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

    }
    else if (input.getAdapter(IFile.class) != null) {
      resource = (IResource) input.getAdapter(IResource.class);
    }
    if (resource.getType() == IResource.FILE && resource.isAccessible()) {
      IContentDescription d = null;
      try {
        // optimized description lookup, might not succeed
        d = ((IFile) resource).getContentDescription();
        if (d != null) {
          types = new IContentType[]{d.getContentType()};
        }
      }
      catch (CoreException e) {
        // should not be possible given the accessible and file type
        // check above
View Full Code Here

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

        // check this before description
        // check name before actually getting the file (less work)
        if(contentTypeJSP.isAssociatedWith(proxy.getName())) {
         
          IFile file = (IFile)proxy.requestResource();
          IContentDescription contentDescription = file.getContentDescription();
          String ctId = null;
          if (contentDescription != null) {
            ctId = contentDescription.getContentType().getId();
          }
          if (ContentTypeIdForJSP.ContentTypeID_JSP.equals(ctId)) {
            if (this.fScope.encloses(proxy.requestFullPath().toString())) {
 
              if (DEBUG)
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.