Java Code Examples for org.eclipse.jdt.core.NamingConventions#VK_STATIC_FIELD
The following examples show how to use
org.eclipse.jdt.core.NamingConventions#VK_STATIC_FIELD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaStatementPostfixContext.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public String[] suggestFieldName(String type, String[] excludes, boolean staticField, boolean finalField) throws IllegalArgumentException { int dim = 0; while (type.endsWith("[]")) { dim++; type = type.substring(0, type.length() - 2); } IJavaProject project = getJavaProject(); int namingConventions = 0; if (staticField && finalField) { namingConventions = NamingConventions.VK_STATIC_FINAL_FIELD; } else if (staticField && !finalField) { namingConventions = NamingConventions.VK_STATIC_FIELD; } else { namingConventions = NamingConventions.VK_INSTANCE_FIELD; } if (project != null) return StubUtility.getVariableNameSuggestions(namingConventions, project, type, dim, Arrays.asList(excludes), true); return new String[] {Signature.getSimpleName(type).toLowerCase()}; }
Example 2
Source File: ExtractFieldRefactoring.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
/** * @return proposed field names (may be empty, but not null). The first proposal * should be used as "best guess" (if it exists). */ public String[] guessFieldNames() { if (fGuessedFieldNames == null) { try { Expression expression = getSelectedExpression().getAssociatedExpression(); if (expression != null) { ITypeBinding binding = guessBindingForReference(expression); int modifiers = getModifiers(); int variableKind; if (Flags.isFinal(modifiers) && Flags.isStatic(modifiers)) { variableKind = NamingConventions.VK_STATIC_FINAL_FIELD; } else if (Flags.isStatic(modifiers)) { variableKind = NamingConventions.VK_STATIC_FIELD; } else { variableKind = NamingConventions.VK_INSTANCE_FIELD; } fGuessedFieldNames = StubUtility.getVariableNameSuggestions(variableKind, fCu.getJavaProject(), binding, expression, Arrays.asList(getExcludedFieldNames())); } } catch (JavaModelException e) { } if (fGuessedFieldNames == null) { fGuessedFieldNames = new String[0]; } } return fGuessedFieldNames; }
Example 3
Source File: StubUtility.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static int getFieldKind(int modifiers) { if (!Modifier.isStatic(modifiers)) return NamingConventions.VK_INSTANCE_FIELD; if (!Modifier.isFinal(modifiers)) return NamingConventions.VK_STATIC_FIELD; return NamingConventions.VK_STATIC_FINAL_FIELD; }
Example 4
Source File: AssignToVariableAssistProposal.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private String[] suggestFieldNames(ITypeBinding binding, Expression expression, int modifiers, ASTNode nodeToAssign) { IJavaProject project= getCompilationUnit().getJavaProject(); int varKind= Modifier.isStatic(modifiers) ? NamingConventions.VK_STATIC_FIELD : NamingConventions.VK_INSTANCE_FIELD; return StubUtility.getVariableNameSuggestions(varKind, project, binding, expression, getUsedVariableNames(nodeToAssign)); }
Example 5
Source File: AssignToVariableAssistProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private String[] suggestFieldNames(ITypeBinding binding, Expression expression, int modifiers) { IJavaProject project= getCompilationUnit().getJavaProject(); int varKind= Modifier.isStatic(modifiers) ? NamingConventions.VK_STATIC_FIELD : NamingConventions.VK_INSTANCE_FIELD; return StubUtility.getVariableNameSuggestions(varKind, project, binding, expression, getUsedVariableNames()); }