Class NatureUtils
- java.lang.Object
-
- net.ssehub.easy.producer.eclipse.persistency.eclipse.NatureUtils
-
public final class NatureUtils extends java.lang.ObjectSome utility methods for natures.- Author:
- Holger Eichelberger
-
-
Constructor Summary
Constructors Modifier Constructor Description privateNatureUtils()Prevents this class from being instantiated from outside.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddNature(org.eclipse.core.resources.IProject project, java.lang.String nature, org.eclipse.core.runtime.IProgressMonitor monitor)Adds a nature to the given project.static booleanhasNature(org.eclipse.core.resources.IProject project, java.lang.String... natures)Returns whether at least one of the given natures is defined on the given project.static voidremoveNature(org.eclipse.core.resources.IProject project, java.lang.String nature, org.eclipse.core.runtime.IProgressMonitor monitor)Removes a nature from the given project.
-
-
-
Method Detail
-
hasNature
public static boolean hasNature(org.eclipse.core.resources.IProject project, java.lang.String... natures) throws org.eclipse.core.runtime.CoreExceptionReturns whether at least one of the given natures is defined on the given project.- Parameters:
project- the project to check the nature onnatures- the natures to be checked- Returns:
trueif at least one nature innaturesis a nature ofproject,falseelse- Throws:
org.eclipse.core.runtime.CoreException- ifprojectdoes not exist or is not open
-
addNature
public static void addNature(org.eclipse.core.resources.IProject project, java.lang.String nature, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreExceptionAdds a nature to the given project.- Parameters:
project- the project to add the nature tonature- the nature to be addedmonitor- an optional progress monitor (may be null)- Throws:
org.eclipse.core.runtime.CoreException- ifprojectdoes not exist or is not open
-
removeNature
public static void removeNature(org.eclipse.core.resources.IProject project, java.lang.String nature, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreExceptionRemoves a nature from the given project.- Parameters:
project- the project to remove the nature fromnature- the nature to be removemonitor- an optional progress monitor (may be null)- Throws:
org.eclipse.core.runtime.CoreException- ifprojectdoes not exist or is not open
-
-