Class ProjectNature

  • All Implemented Interfaces:
    org.eclipse.core.resources.IProjectNature
    Direct Known Subclasses:
    ValidationNature, ViewModelNature

    public abstract class ProjectNature
    extends java.lang.Object
    implements org.eclipse.core.resources.IProjectNature
    Common project nature implementation.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ProjectNature​(java.lang.String id, java.lang.String builder)
      Initializes me with my unique identifier and builder ID.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void configure()  
      void deconfigure()  
      org.eclipse.core.resources.IProject getProject()  
      boolean hasNature​(org.eclipse.core.resources.IProject project)
      Query whether a project has my nature.
      void setProject​(org.eclipse.core.resources.IProject project)  
      static void toggleNature​(org.eclipse.core.resources.IProject project, java.lang.String natureID)
      Toggles a nature on a project.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProjectNature

        protected ProjectNature​(java.lang.String id,
                                java.lang.String builder)
        Initializes me with my unique identifier and builder ID.
        Parameters:
        id - my unique identifier
        builder - my builder
    • Method Detail

      • configure

        public void configure()
                       throws org.eclipse.core.runtime.CoreException
        Specified by:
        configure in interface org.eclipse.core.resources.IProjectNature
        Throws:
        org.eclipse.core.runtime.CoreException
      • deconfigure

        public void deconfigure()
                         throws org.eclipse.core.runtime.CoreException
        Specified by:
        deconfigure in interface org.eclipse.core.resources.IProjectNature
        Throws:
        org.eclipse.core.runtime.CoreException
      • getProject

        public org.eclipse.core.resources.IProject getProject()
        Specified by:
        getProject in interface org.eclipse.core.resources.IProjectNature
      • setProject

        public void setProject​(org.eclipse.core.resources.IProject project)
        Specified by:
        setProject in interface org.eclipse.core.resources.IProjectNature
      • hasNature

        public boolean hasNature​(org.eclipse.core.resources.IProject project)
        Query whether a project has my nature.
        Parameters:
        project - a project
        Returns:
        whether it has my nature
      • toggleNature

        public static void toggleNature​(org.eclipse.core.resources.IProject project,
                                        java.lang.String natureID)
                                 throws org.eclipse.core.runtime.CoreException
        Toggles a nature on a project.
        Parameters:
        project - to have sample nature added or removed
        natureID - the nature ID to toggle
        Throws:
        org.eclipse.core.runtime.CoreException - issue while toggling nature