本文整理汇总了Java中org.eclipse.jdt.core.dom.IExtendedModifier类的典型用法代码示例。如果您正苦于以下问题:Java IExtendedModifier类的具体用法?Java IExtendedModifier怎么用?Java IExtendedModifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IExtendedModifier类属于org.eclipse.jdt.core.dom包,在下文中一共展示了IExtendedModifier类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: installLinkedVisibilityProposals
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
public static void installLinkedVisibilityProposals(LinkedProposalModel linkedProposalModel, ASTRewrite rewrite, List<IExtendedModifier> modifiers, boolean inInterface, String groupId) {
ASTNode modifier = findVisibilityModifier(modifiers);
if (modifier != null) {
int selected = ((Modifier) modifier).getKeyword().toFlagValue();
LinkedProposalPositionGroup positionGroup = linkedProposalModel.getPositionGroup(groupId, true);
positionGroup.addPosition(rewrite.track(modifier), false);
positionGroup.addProposal(new ModifierLinkedModeProposal(selected, 10));
// add all others
int[] flagValues = inInterface ? new int[] { Modifier.PUBLIC, 0 } : new int[] { Modifier.PUBLIC, 0, Modifier.PROTECTED, Modifier.PRIVATE };
for (int i = 0; i < flagValues.length; i++) {
if (flagValues[i] != selected) {
positionGroup.addProposal(new ModifierLinkedModeProposal(flagValues[i], 9 - i));
}
}
}
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:19,代码来源:ModifierCorrectionSubProcessor.java
示例2: getAnnotation
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
private ASTNode getAnnotation(List paramModifiers, String annotation) {
ASTNode found = null;
for (Iterator itParamModifiers = paramModifiers.iterator(); itParamModifiers.hasNext();) {
IExtendedModifier o = (IExtendedModifier) itParamModifiers.next();
if (o instanceof SingleMemberAnnotation) {
SingleMemberAnnotation annot = (SingleMemberAnnotation) o;
String name = annot.getTypeName().toString();
if (name.compareTo(annotation) == 0) {
found = annot;
break;
}
}
}
return found;
}
开发者ID:aroog,项目名称:code,代码行数:17,代码来源:RemoveAnnotations.java
示例3: checkExisting
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
boolean checkExisting(
List<IExtendedModifier> existingModifiers,
ListRewrite listRewrite,
TextEditGroup editGroup) {
for (Object mod : existingModifiers) {
if (mod instanceof MarkerAnnotation) {
MarkerAnnotation annotation = (MarkerAnnotation) mod;
String existingName = annotation.getTypeName().getFullyQualifiedName();
int lastDot = fAnnotationToRemove.lastIndexOf('.');
if (existingName.equals(fAnnotationToRemove)
|| (lastDot != -1
&& fAnnotationToRemove.substring(lastDot + 1).equals(existingName))) {
if (!fAllowRemove) return false; // veto this change
listRewrite.remove(annotation, editGroup);
return true;
}
// paranoia: check if by accident the annotation is already present (shouldn't happen):
lastDot = fAnnotationToAdd.lastIndexOf('.');
if (existingName.equals(fAnnotationToAdd)
|| (lastDot != -1 && fAnnotationToAdd.substring(lastDot + 1).equals(existingName))) {
return false; // already present
}
}
}
return true;
}
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:NullAnnotationsRewriteOperations.java
示例4: hasNullAnnotation
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
private static boolean hasNullAnnotation(MethodDeclaration decl) {
List<IExtendedModifier> modifiers = decl.modifiers();
String nonnull =
NullAnnotationsFix.getNonNullAnnotationName(decl.resolveBinding().getJavaElement(), false);
String nullable =
NullAnnotationsFix.getNullableAnnotationName(decl.resolveBinding().getJavaElement(), false);
for (Object mod : modifiers) {
if (mod instanceof Annotation) {
Name annotationName = ((Annotation) mod).getTypeName();
String fullyQualifiedName = annotationName.getFullyQualifiedName();
if (annotationName.isSimpleName()
? nonnull.endsWith(fullyQualifiedName)
: fullyQualifiedName.equals(nonnull)) return true;
if (annotationName.isSimpleName()
? nullable.endsWith(fullyQualifiedName)
: fullyQualifiedName.equals(nullable)) return true;
}
}
return false;
}
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:NullAnnotationsRewriteOperations.java
示例5: installLinkedVisibilityProposals
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
public static void installLinkedVisibilityProposals(
LinkedProposalModel linkedProposalModel,
ASTRewrite rewrite,
List<IExtendedModifier> modifiers,
boolean inInterface) {
ASTNode modifier = findVisibilityModifier(modifiers);
if (modifier != null) {
int selected = ((Modifier) modifier).getKeyword().toFlagValue();
LinkedProposalPositionGroup positionGroup =
linkedProposalModel.getPositionGroup(KEY_MODIFIER, true);
positionGroup.addPosition(rewrite.track(modifier), false);
positionGroup.addProposal(new ModifierLinkedModeProposal(selected, 10));
// add all others
int[] flagValues =
inInterface
? new int[] {Modifier.PUBLIC, 0}
: new int[] {Modifier.PUBLIC, 0, Modifier.PROTECTED, Modifier.PRIVATE};
for (int i = 0; i < flagValues.length; i++) {
if (flagValues[i] != selected) {
positionGroup.addProposal(new ModifierLinkedModeProposal(flagValues[i], 9 - i));
}
}
}
}
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:ModifierCorrectionSubProcessor.java
示例6: checkExisting
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
boolean checkExisting(List<IExtendedModifier> existingModifiers, ListRewrite listRewrite, TextEditGroup editGroup) {
for (Object mod : existingModifiers) {
if (mod instanceof MarkerAnnotation) {
MarkerAnnotation annotation= (MarkerAnnotation) mod;
String existingName= annotation.getTypeName().getFullyQualifiedName();
int lastDot= fAnnotationToRemove.lastIndexOf('.');
if (existingName.equals(fAnnotationToRemove) || (lastDot != -1 && fAnnotationToRemove.substring(lastDot + 1).equals(existingName))) {
if (!fAllowRemove)
return false; // veto this change
listRewrite.remove(annotation, editGroup);
return true;
}
// paranoia: check if by accident the annotation is already present (shouldn't happen):
lastDot= fAnnotationToAdd.lastIndexOf('.');
if (existingName.equals(fAnnotationToAdd) || (lastDot != -1 && fAnnotationToAdd.substring(lastDot + 1).equals(existingName))) {
return false; // already present
}
}
}
return true;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:NullAnnotationsRewriteOperations.java
示例7: hasNullAnnotation
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
private static boolean hasNullAnnotation(MethodDeclaration decl) {
List<IExtendedModifier> modifiers= decl.modifiers();
String nonnull= NullAnnotationsFix.getNonNullAnnotationName(decl.resolveBinding().getJavaElement(), false);
String nullable= NullAnnotationsFix.getNullableAnnotationName(decl.resolveBinding().getJavaElement(), false);
for (Object mod : modifiers) {
if (mod instanceof Annotation) {
Name annotationName= ((Annotation) mod).getTypeName();
String fullyQualifiedName= annotationName.getFullyQualifiedName();
if (annotationName.isSimpleName() ? nonnull.endsWith(fullyQualifiedName) : fullyQualifiedName.equals(nonnull))
return true;
if (annotationName.isSimpleName() ? nullable.endsWith(fullyQualifiedName) : fullyQualifiedName.equals(nullable))
return true;
}
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:NullAnnotationsRewriteOperations.java
示例8: splitVariableDeclarationStatement
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
/**
* Split the fragments in <code>statement</code> to multiple VariableDeclarationStatements whenever
* <code>splitOperator.needsSplit</code> returns <code>true</code>.
* i.e.:
* int i, j; ---> int i; int j; (if splitOperator.needsSplit(i, j) == true)
*
* @param statement The VariableDeclarationStatement to split
* @param splitOperator The operator to use to split
* @param rewrite The rewriter to use to generate new VariableDeclarationStatements.
*/
private void splitVariableDeclarationStatement(VariableDeclarationStatement statement, ISplitOperation splitOperator, ASTRewrite rewrite) {
List<VariableDeclarationFragment> fragments= statement.fragments();
Iterator<VariableDeclarationFragment> iter= fragments.iterator();
VariableDeclarationFragment lastFragment= iter.next();
VariableDeclarationStatement lastStatement= statement;
splitOperator.initializeStatement(lastStatement, lastFragment);
ListRewrite fragmentsRewrite= null;
while (iter.hasNext()) {
VariableDeclarationFragment currentFragment= iter.next();
if (splitOperator.needsSplit(lastFragment, currentFragment)) {
VariableDeclarationStatement newStatement= getAst().newVariableDeclarationStatement((VariableDeclarationFragment)rewrite.createMoveTarget(currentFragment));
ListRewrite modifierRewrite= rewrite.getListRewrite(newStatement, VariableDeclarationStatement.MODIFIERS2_PROPERTY);
for (Iterator<IExtendedModifier> iterator= statement.modifiers().iterator(); iterator.hasNext();) {
modifierRewrite.insertLast(rewrite.createCopyTarget((ASTNode)iterator.next()), null);
}
newStatement.setType((Type)rewrite.createCopyTarget(statement.getType()));
splitOperator.initializeStatement(newStatement, currentFragment);
fragmentsRewrite= rewrite.getListRewrite(newStatement, VariableDeclarationStatement.FRAGMENTS_PROPERTY);
lastStatement= newStatement;
} else if (fragmentsRewrite != null) {
ASTNode fragment0= rewrite.createMoveTarget(currentFragment);
fragmentsRewrite.insertLast(fragment0, null);
}
lastFragment= currentFragment;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:47,代码来源:SurroundWith.java
示例9: installLinkedVisibilityProposals
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
public static void installLinkedVisibilityProposals(LinkedProposalModel linkedProposalModel, ASTRewrite rewrite, List<IExtendedModifier> modifiers, boolean inInterface) {
ASTNode modifier= findVisibilityModifier(modifiers);
if (modifier != null) {
int selected= ((Modifier) modifier).getKeyword().toFlagValue();
LinkedProposalPositionGroup positionGroup= linkedProposalModel.getPositionGroup(KEY_MODIFIER, true);
positionGroup.addPosition(rewrite.track(modifier), false);
positionGroup.addProposal(new ModifierLinkedModeProposal(selected, 10));
// add all others
int[] flagValues= inInterface ? new int[] { Modifier.PUBLIC, 0 } : new int[] { Modifier.PUBLIC, 0, Modifier.PROTECTED, Modifier.PRIVATE };
for (int i= 0; i < flagValues.length; i++) {
if (flagValues[i] != selected) {
positionGroup.addProposal(new ModifierLinkedModeProposal(flagValues[i], 9 - i));
}
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:ModifierCorrectionSubProcessor.java
示例10: makeConstant
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
/**
* Makes an attribute constant.
*/
@SuppressWarnings("unchecked")
public void makeConstant() {
List<IExtendedModifier> modifierList = fieldDeclaration.modifiers();
logger.debug("Trying to make attribute '" + attributeName + "' constant...");
/*
* Test if modifier already exists. If they don't exist than add them to the modifier list.
*/
if (testIfModifierExists(ModifierKeyword.STATIC_KEYWORD, modifierList)) {
logger.debug("modifier 'static' already exists");
} else {
modifierList.add(fieldDeclaration.getAST().newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD));
logger.debug("Added 'static' modifier to '" + attributeName + "'");
}
if (testIfModifierExists(ModifierKeyword.FINAL_KEYWORD, modifierList)) {
logger.debug("modifier 'final' already exists...");
} else {
modifierList.add(fieldDeclaration.getAST().newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD));
logger.debug("Added 'final' modifier to '" + attributeName + "'");
}
notifyChanged();
}
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:25,代码来源:JavaAttribute.java
示例11: makeVariable
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
/**
* Makes a constant attribute variable.
*/
@SuppressWarnings("unchecked")
public void makeVariable() {
List<IExtendedModifier> modifierList = fieldDeclaration.modifiers();
List<IExtendedModifier> removeList = new ArrayList<IExtendedModifier>();
logger.debug("Trying to make attribute '" + attributeName + "' variable...");
for (Object modifier : modifierList) {
/*
* Mark modifier for deletion if it exists. To avoid NoSuchElementException this modifier will be put in a
* separate list and will be removed later.
*/
if (modifier.toString().equals(Modifier.ModifierKeyword.FINAL_KEYWORD.toString())
|| modifier.toString().equals(Modifier.ModifierKeyword.STATIC_KEYWORD.toString())) {
logger.debug("'" + modifier + "' flagged for deletion...");
removeList.add((IExtendedModifier) modifier);
}
}
logger.debug("Remove modifiers...");
modifierList.removeAll(removeList);
notifyChanged();
}
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:24,代码来源:JavaAttribute.java
示例12: annotations
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
/**
* Returns the annotations for a given <code>modifierList</code>.
*
* @param modifierList the modifier list to be processed
* @return An ArraySet with all annotations
*/
@OperationMeta(returnGenerics = JavaAnnotation.class)
public Set<JavaAnnotation> annotations(List<IExtendedModifier> modifierList) {
List<JavaAnnotation> list = new ArrayList<JavaAnnotation>();
for (Object modifier : modifierList) {
if (modifier instanceof org.eclipse.jdt.core.dom.Annotation) {
org.eclipse.jdt.core.dom.Annotation annot = (org.eclipse.jdt.core.dom.Annotation) modifier;
// Get annotation name and value
Map<String, String> fields = new HashMap<String, String>();
// possibly the unqualified name as not resolved unless not given as qualified name!
String name = annot.getTypeName().getFullyQualifiedName();
if (annot instanceof SingleMemberAnnotation) {
fields.put(JavaAnnotation.DEFAULT_FIELD,
toString(((SingleMemberAnnotation) modifier).getValue()));
} else if (annot instanceof NormalAnnotation) {
@SuppressWarnings("unchecked")
List<MemberValuePair> values = ((NormalAnnotation) annot).values();
for (MemberValuePair pair : values) {
fields.put(pair.getName().getIdentifier(), toString(pair.getValue()));
}
}
list.add(new JavaAnnotation(name, fields, this));
}
}
return new ArraySet<JavaAnnotation>(list.toArray(new JavaAnnotation[list.size()]), JavaAnnotation.class);
}
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:32,代码来源:JavaParentFragmentArtifact.java
示例13: hasNullAnnotation
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
private static boolean hasNullAnnotation(MethodDeclaration decl) {
List<IExtendedModifier> modifiers= decl.modifiers();
String nonnull= NullQuickFixes.getNonNullAnnotationName(decl.resolveBinding().getJavaElement(), false);
String nullable= NullQuickFixes.getNullableAnnotationName(decl.resolveBinding().getJavaElement(), false);
for (Object mod : modifiers) {
if (mod instanceof Annotation) {
Name annotationName= ((Annotation) mod).getTypeName();
String fullyQualifiedName= annotationName.getFullyQualifiedName();
if (annotationName.isSimpleName() ? nonnull.endsWith(fullyQualifiedName) : fullyQualifiedName.equals(nonnull))
return true;
if (annotationName.isSimpleName() ? nullable.endsWith(fullyQualifiedName) : fullyQualifiedName.equals(nullable))
return true;
}
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:NullRewriteOperations.java
示例14: setPublic
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
/**
* Sets the public modifier and deletes the protected one.
*/
private void setPublic(MethodDeclaration md) {
// if already public, do nothing
if (isPublic(md)) {
return;
}
// set public
Modifier modifier = ast.newModifier(ModifierKeyword.fromFlagValue(Modifier.PUBLIC));
md.modifiers().add(0, modifier);
// delete protected
for (int i = 0; i < md.modifiers().size(); i++) {
if (((IExtendedModifier)md.modifiers().get(i)).isModifier()) {
Modifier m = (Modifier)md.modifiers().get(i);
if (m.isProtected()) {
m.delete();
break;
}
}
}
}
开发者ID:conyx,项目名称:jenkins.py,代码行数:23,代码来源:MethodMaker.java
示例15: getAnnotation
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
/**
* Return an Annotation instance used on this body declaration
*/
public static Annotation getAnnotation(String annotationName,
BodyDeclaration bodyDeclaration) {
List<?> modifiers = bodyDeclaration.modifiers();
// Test if this MethodDeclaration contains modifiers
if (modifiers != null) {
Iterator<?> modifiersIterator = modifiers.iterator();
while (modifiersIterator.hasNext()) {
IExtendedModifier modifier = (IExtendedModifier) modifiersIterator
.next();
if (modifier.isAnnotation()) {
Annotation a = (Annotation) modifier;
String annotationType = a.getTypeName().toString();
if (annotationType.endsWith(annotationName)) {
return a;
}
}
}
}
return null;
}
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:29,代码来源:ASTHelper.java
示例16: isStatic
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
private boolean isStatic(FieldDeclaration field) {
List<IExtendedModifier> fieldModifiers = field.modifiers();
return fieldModifiers.stream()
.filter(modifier -> modifier instanceof Modifier)
.filter(modifer -> ((Modifier) modifer).getKeyword().equals(ModifierKeyword.STATIC_KEYWORD))
.findFirst()
.isPresent();
}
开发者ID:helospark,项目名称:SparkBuilderGenerator,代码行数:9,代码来源:ClassFieldCollector.java
示例17: getFieldModifier
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
private JavaVisibilityScopeModifier getFieldModifier(BodyDeclaration fieldDeclaration) {
return ((List<IExtendedModifier>) fieldDeclaration.modifiers())
.stream()
.filter(modifier -> modifier instanceof Modifier)
.map(modifier -> ((Modifier) modifier).getKeyword().toString())
.filter(modifierKeyword -> JavaVisibilityScopeModifier.isValid(modifierKeyword))
.map(modifierKeyword -> JavaVisibilityScopeModifier.convert(modifierKeyword))
.filter(Optional::isPresent)
.map(Optional::get)
.findFirst()
.orElse(JavaVisibilityScopeModifier.DEFAULT_MODIFIER);
}
开发者ID:helospark,项目名称:SparkBuilderGenerator,代码行数:13,代码来源:BodyDeclarationVisibleFromPredicate.java
示例18: isPublic
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
private boolean isPublic(MethodDeclaration method) {
return ((List<IExtendedModifier>) method.modifiers())
.stream()
.filter(modifier -> modifier instanceof Modifier)
.filter(modifier -> ((Modifier) modifier).equals(Modifier.PUBLIC))
.findFirst()
.isPresent();
}
开发者ID:helospark,项目名称:SparkBuilderGenerator,代码行数:9,代码来源:StaticBuilderMethodRemover.java
示例19: test
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
public boolean test(BodyDeclaration method, Predicate<IExtendedModifier> modifiedPredicate) {
return ((List<IExtendedModifier>) method.modifiers())
.stream()
.filter(modifier -> modifier instanceof Modifier)
.filter(modifiedPredicate)
.findFirst()
.isPresent();
}
开发者ID:helospark,项目名称:SparkBuilderGenerator,代码行数:9,代码来源:GenericModifierPredicate.java
示例20: test
import org.eclipse.jdt.core.dom.IExtendedModifier; //导入依赖的package包/类
@Override
public boolean test(BodyDeclaration bodyDeclaration) {
return ((List<IExtendedModifier>) bodyDeclaration.modifiers())
.stream()
.filter(modifier -> modifier instanceof SingleMemberAnnotation)
.map(modifier -> (SingleMemberAnnotation) modifier)
.filter(modifier -> isGeneratedAnnotation(modifier))
.filter(modifier -> modifier.getValue() instanceof StringLiteral)
.filter(annotation -> ((StringLiteral) annotation.getValue()).getLiteralValue().equals(PLUGIN_GENERATED_ANNOTATION_NAME))
.findFirst()
.isPresent();
}
开发者ID:helospark,项目名称:SparkBuilderGenerator,代码行数:13,代码来源:GeneratedAnnotationPredicate.java
注:本文中的org.eclipse.jdt.core.dom.IExtendedModifier类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论