Class JdtUtils


  • public final class JdtUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private JdtUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static org.eclipse.jdt.core.IJavaProject getJavaProject​(org.eclipse.core.resources.IProject project)  
      private static int getJavaProjectTabWidth​(int tabWidth, org.eclipse.core.resources.IProject project)  
      static org.eclipse.core.resources.IProject getProject​(org.eclipse.debug.core.ILaunchConfiguration config)  
      static org.eclipse.core.resources.IProject getProjectForClass​(org.eclipse.ui.IEditorInput currentInput)  
      static int getTabWidth​(org.eclipse.core.resources.IFile file)  
      private static org.eclipse.jdt.core.IType[] getTypeForName​(java.lang.String simpleTypeName, org.eclipse.jdt.core.search.IJavaSearchScope searchScope, org.eclipse.core.runtime.IProgressMonitor monitor)
      Finds a type by the simple name.
      private static boolean hasJavaNature​(org.eclipse.core.resources.IProject project)
      Returns true if the given project is accessible and it has a java nature, otherwise false.
      static int searchAndOpenType​(java.lang.String typeName)  
      • Methods inherited from class java.lang.Object

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

      • JdtUtils

        private JdtUtils()
    • Method Detail

      • searchAndOpenType

        public static int searchAndOpenType​(java.lang.String typeName)
                                     throws org.eclipse.core.runtime.OperationCanceledException
        Parameters:
        typeName -
        Throws:
        org.eclipse.core.runtime.OperationCanceledException - if user doesnt select founded types
      • getTypeForName

        private static org.eclipse.jdt.core.IType[] getTypeForName​(java.lang.String simpleTypeName,
                                                                   org.eclipse.jdt.core.search.IJavaSearchScope searchScope,
                                                                   org.eclipse.core.runtime.IProgressMonitor monitor)
                                                            throws org.eclipse.jdt.core.JavaModelException
        Finds a type by the simple name. see org.eclipse.jdt.internal.corext.codemanipulation.AddImportsOperation
        Returns:
        null, if no types was found, empty array if more then one type was found, or only one element, if single match exists
        Throws:
        org.eclipse.jdt.core.JavaModelException
      • hasJavaNature

        private static boolean hasJavaNature​(org.eclipse.core.resources.IProject project)
        Returns true if the given project is accessible and it has a java nature, otherwise false.
        Parameters:
        project - IProject
        Returns:
        boolean
      • getJavaProject

        private static org.eclipse.jdt.core.IJavaProject getJavaProject​(org.eclipse.core.resources.IProject project)
      • getTabWidth

        public static int getTabWidth​(org.eclipse.core.resources.IFile file)
      • getJavaProjectTabWidth

        private static int getJavaProjectTabWidth​(int tabWidth,
                                                  org.eclipse.core.resources.IProject project)
      • getProjectForClass

        public static org.eclipse.core.resources.IProject getProjectForClass​(org.eclipse.ui.IEditorInput currentInput)
        Parameters:
        currentInput - class file input
        Returns:
        may return null
      • getProject

        public static org.eclipse.core.resources.IProject getProject​(org.eclipse.debug.core.ILaunchConfiguration config)