|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--dk.lec.idea.plugin.generate.PsiUtil
Utility methods accessing the IDEA PSI API (Program Structure Information).
| Method Summary | |
static void |
addImportStatement(com.intellij.psi.PsiJavaFile javaFile,
java.lang.String importStatementOnDemand,
com.intellij.psi.PsiElementFactory factory,
com.intellij.psi.codeStyle.CodeStyleManager codeStyleManager)
Add's an importstatement to the javafile and optimizes the imports afterwards. |
static com.intellij.psi.PsiMethod |
findMethodByName(com.intellij.psi.PsiClass clazz,
java.lang.String name)
Find's an existing method with the given name. |
static com.intellij.psi.codeStyle.CodeStyleManager |
getCodeStyleManager(com.intellij.openapi.project.Project project)
Get's the CodeStyleManager for the project. |
static com.intellij.psi.PsiClass |
getCurrentClass(com.intellij.psi.PsiJavaFile javaFile,
com.intellij.openapi.editor.Editor editor)
Gets the current class for the javafile and relative to the editor's caret. |
static com.intellij.psi.PsiField[] |
getFields(com.intellij.psi.PsiClass clazz)
Get's the fields for the class. |
static java.util.Collection |
getFieldsAsCollection(com.intellij.psi.PsiClass clazz)
Get's the fields for the class. |
static com.intellij.openapi.project.Project |
getProject(com.intellij.openapi.actionSystem.DataContext dataContext)
Get's the IDEA project. |
static com.intellij.psi.PsiElementFactory |
getPsiElemetFactory(com.intellij.psi.PsiManager manager)
Get's the PSIElementFactory. |
static com.intellij.psi.PsiManager |
getPsiManager(com.intellij.openapi.project.Project project)
Get's the PSIManager. |
static com.intellij.psi.PsiJavaFile |
getSelectedJavaFile(com.intellij.openapi.actionSystem.DataContext context)
Convenience method to get the selected Java file given a DataContext. |
static com.intellij.psi.PsiJavaFile |
getSelectedJavaFile(com.intellij.openapi.project.Project project,
com.intellij.psi.PsiManager manager)
Get's the javafile that's currently selected in the editor. |
static boolean |
hasFields(com.intellij.psi.PsiClass clazz)
Does the class have any fields? |
static boolean |
hasImportStatement(com.intellij.psi.PsiJavaFile javaFile,
java.lang.String importStatement)
Does the javafile have the importstatement. |
static boolean |
isCollectionType(com.intellij.psi.PsiElementFactory factory,
com.intellij.psi.PsiField field)
Is the given field a Collection type? |
static boolean |
isConstantField(com.intellij.psi.PsiField field)
Returns true if a field is constant. |
static boolean |
isMapTye(com.intellij.psi.PsiElementFactory factory,
com.intellij.psi.PsiField field)
Is the given field a Map type? |
static boolean |
isModifierTransient(com.intellij.psi.PsiField field)
Returns true if a field has a transient modifier. |
static boolean |
isObjectArrayType(com.intellij.psi.PsiField field)
Is the given field an Object array type (etc. |
static boolean |
isPrimitiveArrayType(com.intellij.psi.PsiField field)
Returns true if the given field a primtive array type (e.g., int[], long[], float[]). |
static boolean |
isPrimitiveType(com.intellij.psi.PsiField field)
Is this field a primitive type |
static boolean |
isStringType(com.intellij.psi.PsiElementFactory factory,
com.intellij.psi.PsiField field)
Is the given field a String type? |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static com.intellij.openapi.project.Project getProject(com.intellij.openapi.actionSystem.DataContext dataContext)
dataContext - data context.
public static com.intellij.psi.PsiManager getPsiManager(com.intellij.openapi.project.Project project)
project - IDEA project.
public static com.intellij.psi.PsiJavaFile getSelectedJavaFile(com.intellij.openapi.actionSystem.DataContext context)
DataContext.
This form of the method is provided purely for convenience.
context - Data context
getSelectedJavaFile(Project, PsiManager)
public static com.intellij.psi.PsiJavaFile getSelectedJavaFile(com.intellij.openapi.project.Project project,
com.intellij.psi.PsiManager manager)
project - IDEA project.manager - IDEA manager.
public static com.intellij.psi.PsiField[] getFields(com.intellij.psi.PsiClass clazz)
clazz - class.
public static java.util.Collection getFieldsAsCollection(com.intellij.psi.PsiClass clazz)
clazz - class.
public static com.intellij.psi.PsiElementFactory getPsiElemetFactory(com.intellij.psi.PsiManager manager)
manager - PSIManager.
public static com.intellij.psi.PsiClass getCurrentClass(com.intellij.psi.PsiJavaFile javaFile,
com.intellij.openapi.editor.Editor editor)
javaFile - javafile for the class to find.editor - the editor.
public static boolean isConstantField(com.intellij.psi.PsiField field)
static modifier.
field - field to check if it's a constant
public static com.intellij.psi.PsiMethod findMethodByName(com.intellij.psi.PsiClass clazz,
java.lang.String name)
clazz - the classname - name of method to find
public static boolean isPrimitiveArrayType(com.intellij.psi.PsiField field)
field - field.
public static boolean isObjectArrayType(com.intellij.psi.PsiField field)
field - field.
public static boolean isCollectionType(com.intellij.psi.PsiElementFactory factory,
com.intellij.psi.PsiField field)
throws com.intellij.util.IncorrectOperationException
Collection type?
factory - element factory.field - field.
com.intellij.util.IncorrectOperationException - is thrown if the type test failed.
public static boolean isMapTye(com.intellij.psi.PsiElementFactory factory,
com.intellij.psi.PsiField field)
throws com.intellij.util.IncorrectOperationException
Map type?
factory - element factory.field - field.
com.intellij.util.IncorrectOperationException - is thrown if the type test failed.
public static boolean isStringType(com.intellij.psi.PsiElementFactory factory,
com.intellij.psi.PsiField field)
throws com.intellij.util.IncorrectOperationException
String type?
factory - element factory.field - field.
com.intellij.util.IncorrectOperationException - is thrown if the type test failed.public static boolean isPrimitiveType(com.intellij.psi.PsiField field)
field - field.
public static boolean isModifierTransient(com.intellij.psi.PsiField field)
transient modifier.
field - field.
transient modifierpublic static com.intellij.psi.codeStyle.CodeStyleManager getCodeStyleManager(com.intellij.openapi.project.Project project)
project - project.
public static boolean hasFields(com.intellij.psi.PsiClass clazz)
clazz - the PsiClass.
public static boolean hasImportStatement(com.intellij.psi.PsiJavaFile javaFile,
java.lang.String importStatement)
javaFile - javafile.importStatement - importstatement.
public static void addImportStatement(com.intellij.psi.PsiJavaFile javaFile,
java.lang.String importStatementOnDemand,
com.intellij.psi.PsiElementFactory factory,
com.intellij.psi.codeStyle.CodeStyleManager codeStyleManager)
throws com.intellij.util.IncorrectOperationException
javaFile - javafile.importStatementOnDemand - name of importstatement, must be with a wildcard (etc. java.util.*).factory - PSI element factory.codeStyleManager - PSI codestyle to optimize the imports.
com.intellij.util.IncorrectOperationException - is thrown if there is an error creating the importstatement.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||