Java Code Examples for com.intellij.psi.PsiModifier#ModifierConstant

The following examples show how to use com.intellij.psi.PsiModifier#ModifierConstant . 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: LombokProcessorUtil.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Nullable
@PsiModifier.ModifierConstant
private static String convertAccessLevelToJavaModifier(String value) {
  if (null == value || value.isEmpty()) {
    return PsiModifier.PUBLIC;
  }

  if ("PUBLIC".equals(value)) {
    return PsiModifier.PUBLIC;
  }
  if ("MODULE".equals(value)) {
    return PsiModifier.PACKAGE_LOCAL;
  }
  if ("PROTECTED".equals(value)) {
    return PsiModifier.PROTECTED;
  }
  if ("PACKAGE".equals(value)) {
    return PsiModifier.PACKAGE_LOCAL;
  }
  if ("PRIVATE".equals(value)) {
    return PsiModifier.PRIVATE;
  }
  if ("NONE".equals(value)) {
    return null;
  }
  return null;
}
 
Example 2
Source File: RedundantModifiersInfo.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public RedundantModifiersInfo(@NotNull RedundantModifiersInfoType redundantModifiersInfoType,
                              @PsiModifier.ModifierConstant @Nullable String dontRunOnModifier,
                              @NotNull String description,
                              @PsiModifier.ModifierConstant @NotNull String... modifiers) {
  this.redundantModifiersInfoType = redundantModifiersInfoType;
  this.description = description;
  this.dontRunOnModifier = dontRunOnModifier;
  this.modifiers = modifiers;
}
 
Example 3
Source File: LombokLightModifierList.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setModifierProperty(@PsiModifier.ModifierConstant @NotNull @NonNls String name, boolean value) throws IncorrectOperationException {
  if (value) {
    addModifier(name);
  } else {
    if (hasModifierProperty(name)) {
      removeModifier(name);
    }
  }
}
 
Example 4
Source File: LombokLightModifierList.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void removeModifier(@PsiModifier.ModifierConstant @NotNull @NonNls String name) {
  final Collection<String> myModifiers = collectAllModifiers();
  myModifiers.remove(name);

  clearModifiers();

  for (String modifier : myModifiers) {
    addModifier(modifier);
  }
}
 
Example 5
Source File: LombokLightModifierList.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Collection<String> collectAllModifiers() {
  Collection<String> result = new HashSet<>();
  for (@PsiModifier.ModifierConstant String modifier : ALL_MODIFIERS) {
    if (hasExplicitModifier(modifier)) {
      result.add(modifier);
    }
  }
  return result;
}
 
Example 6
Source File: RedundantModifiersInfo.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@PsiModifier.ModifierConstant
public String getDontRunOnModifier() {
  return dontRunOnModifier;
}
 
Example 7
Source File: HaxeModifierListOwner.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Override
boolean hasModifierProperty(@PsiModifier.ModifierConstant @NonNls @NotNull String name);
 
Example 8
Source File: LombokProcessorUtil.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nullable
@PsiModifier.ModifierConstant
public static String getMethodModifier(@NotNull PsiAnnotation psiAnnotation) {
  return getLevelVisibility(psiAnnotation, "value");
}
 
Example 9
Source File: LombokLightClassBuilder.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public LombokLightClassBuilder withModifier(@PsiModifier.ModifierConstant @NotNull @NonNls String modifier) {
  myModifierList.addModifier(modifier);
  return this;
}
 
Example 10
Source File: LombokLightClassBuilder.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public LombokLightClassBuilder withImplicitModifier(@PsiModifier.ModifierConstant @NotNull @NonNls String modifier) {
  myModifierList.addImplicitModifierProperty(modifier);
  return this;
}
 
Example 11
Source File: LombokLightFieldBuilder.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public LombokLightFieldBuilder withModifier(@PsiModifier.ModifierConstant @NotNull @NonNls String modifier) {
  myModifierList.addModifier(modifier);
  return this;
}
 
Example 12
Source File: LombokLightFieldBuilder.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public LombokLightFieldBuilder withImplicitModifier(@PsiModifier.ModifierConstant @NotNull @NonNls String modifier) {
  myModifierList.addImplicitModifierProperty(modifier);
  return this;
}
 
Example 13
Source File: LombokLightModifierList.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void checkSetModifierProperty(@PsiModifier.ModifierConstant @NotNull @NonNls String name, boolean value) throws IncorrectOperationException {
  throw new IncorrectOperationException();
}
 
Example 14
Source File: LombokLightModifierList.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void addImplicitModifierProperty(@PsiModifier.ModifierConstant @NotNull @NonNls String implicitModifier) {
  myImplicitModifiers.add(implicitModifier);
}
 
Example 15
Source File: AllArgsConstructorProcessor.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NotNull
public Collection<PsiMethod> createAllArgsConstructor(@NotNull PsiClass psiClass, @PsiModifier.ModifierConstant @NotNull String methodModifier, @NotNull PsiAnnotation psiAnnotation, String staticName, Collection<PsiField> allNotInitializedNotStaticFields) {
  return createConstructorMethod(psiClass, methodModifier, psiAnnotation, false, allNotInitializedNotStaticFields, staticName);
}
 
Example 16
Source File: LombokProcessorUtil.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nullable
@PsiModifier.ModifierConstant
public static String getAccessVisibility(@NotNull PsiAnnotation psiAnnotation) {
  return getLevelVisibility(psiAnnotation, "access");
}
 
Example 17
Source File: HaxePsiCompositeElementImpl.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Override
public boolean hasModifierProperty(@PsiModifier.ModifierConstant @NonNls @NotNull String name) {
  HaxeModifierList list = getModifierList();
  return null == list ? false : list.hasModifierProperty(name);
}
 
Example 18
Source File: HaxeModifierListPsiMixinImpl.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Override
public void checkSetModifierProperty(@PsiModifier.ModifierConstant @NotNull @NonNls String name, boolean value)
  throws IncorrectOperationException {
  // XXX: implement when needed
}
 
Example 19
Source File: HaxeModifierListPsiMixinImpl.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Override
public boolean hasExplicitModifier(@PsiModifier.ModifierConstant @NotNull @NonNls String name) {
  return mModifierStatusMap.containsKey(name);
}
 
Example 20
Source File: LombokProcessorUtil.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nullable
@PsiModifier.ModifierConstant
private static String getLevelVisibility(@NotNull PsiAnnotation psiAnnotation, @NotNull String parameter) {
  return convertAccessLevelToJavaModifier(PsiAnnotationUtil.getStringAnnotationValue(psiAnnotation, parameter));
}