Package org.eclipse.core.runtime.content

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


        return bundle;
    }

    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


    }

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

    private CommonUtils() {
    }

    public static boolean isErlangFileContentFileName(final String fileName) {
        final IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
        final IContentType[] contentTypes = contentTypeManager
                .findContentTypesFor(fileName);
        for (final IContentType contentType : contentTypes) {
            if (contentType.getId().equals("org.erlide.core.content.erlang")) {
                return true;
            }
View Full Code Here

  protected boolean isSwingComponent() {
    IEditorInput input = getEditorInput();
    if (input instanceof IFileEditorInput) {
      IFileEditorInput file = (IFileEditorInput) input;
      IContentTypeManager contentTypeManager = Platform
          .getContentTypeManager();
      InputStream stream = null;
      try {
        stream = file.getFile().getContents();
        IContentType[] contentTypes = contentTypeManager
            .findContentTypesFor(stream, file.getName());
        for (IContentType contentType : contentTypes) {
          if (contentType.getId().equals(
              VisualSwingContentDescriber.CONTENT_TYPE_ID_VS)) {
            return true;
View Full Code Here

  private static TagRegistryIdentifier getTagRegistryIdentifier(
      final IPaletteContext paletteContext) {

    final IFile file = paletteContext.getFile();
    if (file != null) {
          final IContentTypeManager typeManager = Platform.getContentTypeManager();
          final IContentType contentType =
              typeManager.findContentTypeFor(file.getName());
         
          if (contentType != null)
          {
              return new TagRegistryIdentifier(file.getProject(), contentType);
          }
View Full Code Here

  /**
   * @param model
   * @return true if model is a JSP contenttype
   */
  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

      if (!file.exists()) {
        file.createNewFile();
      }
     
      //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();
View Full Code Here

  private void installCharacterPairing() {
    IStructuredModel model = getInternalModel();
    if (model != null) {
      IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(SSEUIPlugin.ID, "characterPairing"); //$NON-NLS-1$
      IContentTypeManager mgr = Platform.getContentTypeManager();
      IContentType type = mgr.getContentType(model.getContentTypeIdentifier());
      if (type != null) {
        for (int i = 0; i < elements.length; i++) {
          // Create the inserter
          IConfigurationElement element = elements[i];
          try {
            IConfigurationElement[] contentTypes = element.getChildren("contentTypeIdentifier");
            for (int j = 0; j < contentTypes.length; j++) {
              String id = contentTypes[j].getAttribute("id");
              if (id != null) {
                IContentType targetType = mgr.getContentType(id);
                int priority = calculatePriority(type, targetType, 0);
                if (priority >= 0) {
                  final CharacterPairing pairing = new CharacterPairing();
                  pairing.priority = priority;
                  String[] partitions = StringUtils.unpack(contentTypes[j].getAttribute("partitions"));
View Full Code Here

        _description = element.getAttribute("description"); //$NON-NLS-1$

        final IConfigurationElement[] contentTypes = element
                .getChildren("content-type"); //$NON-NLS-1$

        final IContentTypeManager typeManager = Platform
                .getContentTypeManager();
        _contentTypes = new HashSet<IContentType>();
        for (IConfigurationElement contentTypeElement : contentTypes)
        {
            final String contentTypeId = contentTypeElement
                    .getAttribute("contentTypeId"); //$NON-NLS-1$

            final IContentType contentType = typeManager
                    .getContentType(contentTypeId);
            _contentTypes.add(contentType);
        }
    }
View Full Code Here

  private void installCharacterPairing() {
    IStructuredModel model = getInternalModel();
    if (model != null) {
      IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(SSEUIPlugin.ID, "characterPairing"); //$NON-NLS-1$
      IContentTypeManager mgr = Platform.getContentTypeManager();
      IContentType type = mgr.getContentType(model.getContentTypeIdentifier());
      if (type != null) {
        for (int i = 0; i < elements.length; i++) {
          // Create the inserter
          IConfigurationElement element = elements[i];
          try {
            IConfigurationElement[] contentTypes = element.getChildren("contentTypeIdentifier");
            for (int j = 0; j < contentTypes.length; j++) {
              String id = contentTypes[j].getAttribute("id");
              if (id != null) {
                IContentType targetType = mgr.getContentType(id);
                int priority = calculatePriority(type, targetType, 0);
                if (priority >= 0) {
                  final CharacterPairing pairing = new CharacterPairing();
                  pairing.priority = priority;
                  String[] partitions = StringUtils.unpack(contentTypes[j].getAttribute("partitions"));
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.content.IContentTypeManager

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.