Java 类org.eclipse.core.resources.IProjectNatureDescriptor 实例源码

项目:APICloud-Studio    文件:ResourceUtil.java   
/**
 * Return a map of Aptana nature name to nature id
 * 
 * @return
 */
public static Map<String, String> getAptanaNaturesMap()
{
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IProjectNatureDescriptor[] natureDescriptors = workspace.getNatureDescriptors();
    Map<String, String> result = new HashMap<String, String>();

    // collect Studio-only natures
    for (IProjectNatureDescriptor natureDescriptor : natureDescriptors)
    {
        if (isAptanaNature(natureDescriptor.getNatureId()))
        {
            result.put(natureDescriptor.getLabel(), natureDescriptor.getNatureId());
        }
    }

    return result;
}
项目:APICloud-Studio    文件:WizardFolderImportPage.java   
/**
 * Returns a content provider for the list dialog. The content provider will include all available natures as
 * strings.
 * 
 * @return the content provider that shows the natures (as string children)
 */
private IStructuredContentProvider getContentProvider()
{
    return new BaseWorkbenchContentProvider()
    {
        @Override
        public Object[] getChildren(Object o)
        {
            if (!(o instanceof IWorkspace))
            {
                return new Object[0];
            }
            Set<String> elements = new HashSet<String>();
            // collect all available natures in the workspace
            IProjectNatureDescriptor[] natureDescriptors = ((IWorkspace) o).getNatureDescriptors();
            String natureId;
            for (IProjectNatureDescriptor descriptor : natureDescriptors)
            {
                natureId = descriptor.getNatureId();
                if (natureId != null)
                {
                    if (ResourceUtil.isAptanaNature(natureId))
                    {
                        elements.add(natureId);
                        fNatureDescriptions.put(natureId, descriptor.getLabel());
                    }
                }
            }
            return elements.toArray();
        }
    };
}
项目:che    文件:Workspace.java   
@Override
public IProjectNatureDescriptor[] getNatureDescriptors() {
  throw new UnsupportedOperationException();
}
项目:che    文件:Workspace.java   
@Override
public IProjectNatureDescriptor getNatureDescriptor(String s) {
  throw new UnsupportedOperationException();
}
项目:APICloud-Studio    文件:ProjectNaturesPage.java   
/**
 * Returns a content provider for the list dialog. The content provider will include all available natures as
 * strings.
 * 
 * @return the content provider that shows the natures (as string children)
 */
private IStructuredContentProvider getContentProvider()
{
    return new BaseWorkbenchContentProvider()
    {

        @Override
        public Object[] getChildren(Object o)
        {
            if (!(o instanceof IWorkspace))
            {
                return new Object[0];
            }
            Set<String> elements = new HashSet<String>();
            // collect all available natures in the workspace
            IProjectNatureDescriptor[] natureDescriptors = ((IWorkspace) o).getNatureDescriptors();
            String natureId;
            for (IProjectNatureDescriptor descriptor : natureDescriptors)
            {
                natureId = descriptor.getNatureId();
                if (natureId != null)
                {
                    if (ResourceUtil.isAptanaNature(natureId))
                    {
                        elements.add(natureId);
                        fNatureDescriptions.put(natureId, descriptor.getLabel());
                    }
                }
            }
            // add any natures that exist in the project but not in the
            // workbench
            // (this could happen when importing a project from a different
            // workspace or when the nature provider
            // got uninstalled)
            for (String nature : fCurrentProjectNatures)
            {
                if (elements.add(nature))
                {
                    // since we don't have the nature descriptor here, just
                    // use the nature id for the value instead
                    fNatureDescriptions.put(nature, nature);
                }
            }
            return elements.toArray();
        }
    };
}
项目:eclipse-plugin    文件:CodenvyNature.java   
/**
 * Checks if the given nature exists in the workspace.
 *
 * @param natureId the id of the nature.
 * @return {@code true} if the given nature exists, {@code false} otherwise.
 */
private boolean isNatureWithId(String natureId) {
    final IProjectNatureDescriptor natureDescriptor = ResourcesPlugin.getWorkspace().getNatureDescriptor(natureId);
    return natureDescriptor != null;
}
项目:translationstudio8    文件:NewFolderDialogOfHs.java   
/**
         * Returns whether the container specified in the constructor is
         * a valid parent for creating linked resources.
         * 
         * @return boolean <code>true</code> if the container specified in 
         *  the constructor is a valid parent for creating linked resources.
         *  <code>false</code> if no linked resources may be created with the
         *  specified container as a parent. 
         */
        private boolean isValidContainer() {
            if (container.getType() != IResource.PROJECT
                    && container.getType() != IResource.FOLDER) {
                return false;
            }

            try {
                IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();
                IProject project = container.getProject();
                String[] natureIds = project.getDescription().getNatureIds();

                for (int i = 0; i < natureIds.length; i++) {
                    IProjectNatureDescriptor descriptor = workspace
                            .getNatureDescriptor(natureIds[i]);
                    if (descriptor != null
                            && descriptor.isLinkingAllowed() == false) {
                        return false;
                    }
                }
            } catch (CoreException exception) {
                // project does not exist or is closed
                return false;
            }
            return true;
        }