本文整理汇总了Java中com.intellij.psi.PsiModifier.PACKAGE_LOCAL属性的典型用法代码示例。如果您正苦于以下问题:Java PsiModifier.PACKAGE_LOCAL属性的具体用法?Java PsiModifier.PACKAGE_LOCAL怎么用?Java PsiModifier.PACKAGE_LOCAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.psi.PsiModifier
的用法示例。
在下文中一共展示了PsiModifier.PACKAGE_LOCAL属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVisibility
@Nullable
public String getVisibility() {
if (myRbPublic.isSelected()) {
return PsiModifier.PUBLIC;
}
if (myRbPackageLocal.isSelected()) {
return PsiModifier.PACKAGE_LOCAL;
}
if (myRbProtected.isSelected()) {
return PsiModifier.PROTECTED;
}
if (myRbPrivate.isSelected()) {
return PsiModifier.PRIVATE;
}
if (myRbEscalate != null && myRbEscalate.isSelected()) {
return VisibilityUtil.ESCALATE_VISIBILITY;
}
return null;
}
示例2: perform
/**
* to be performed in write action
*/
public void perform(final PsiVariable variable) {
ApplicationManager.getApplication().assertWriteAccessAllowed();
final Document document = myEditor.getDocument();
LOG.assertTrue(variable != null);
final PsiModifierList modifierList = variable.getModifierList();
LOG.assertTrue(modifierList != null);
int textOffset = modifierList.getTextOffset();
final String modifierListText = modifierList.getText();
int length = PsiModifier.PUBLIC.length();
int idx = modifierListText.indexOf(PsiModifier.PUBLIC);
if (idx == -1) {
idx = modifierListText.indexOf(PsiModifier.PROTECTED);
length = PsiModifier.PROTECTED.length();
}
if (idx == -1) {
idx = modifierListText.indexOf(PsiModifier.PRIVATE);
length = PsiModifier.PRIVATE.length();
}
String visibility = getVisibility();
if (visibility == PsiModifier.PACKAGE_LOCAL) {
visibility = "";
}
final boolean wasPackageLocal = idx == -1;
final boolean isPackageLocal = visibility.isEmpty();
final int startOffset = textOffset + (wasPackageLocal ? 0 : idx);
final int endOffset;
if (wasPackageLocal) {
endOffset = startOffset;
}
else {
endOffset = textOffset + length + (isPackageLocal ? 1 : 0);
}
final String finalVisibility = visibility + (wasPackageLocal ? " " : "");
Runnable runnable = new Runnable() {
@Override
public void run() {
document.replaceString(startOffset, endOffset, finalVisibility);
}
};
final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(myEditor);
if (lookup != null) {
lookup.performGuardedChange(runnable);
} else {
runnable.run();
}
}
示例3: getDialog
@NotNull
@Override
protected GrIntroduceDialog<GrIntroduceFieldSettings> getDialog(@NotNull GrIntroduceContext context) {
return new GrIntroduceDialog<GrIntroduceFieldSettings>() {
@Override
public GrIntroduceFieldSettings getSettings() {
return new GrIntroduceFieldSettings() {
@Override
public boolean declareFinal() {
return myDeclareFinal;
}
@Override
public Init initializeIn() {
return myInitializeIn;
}
@Override
public String getVisibilityModifier() {
return PsiModifier.PACKAGE_LOCAL;
}
@Override
public boolean isStatic() {
return myIsStatic;
}
@Override
public boolean removeLocalVar() {
return myRemoveLocal;
}
@Override
public String getName() {
return "f";
}
@Override
public boolean replaceAllOccurrences() {
return replaceAll;
}
@Override
public PsiType getSelectedType() {
return mySelectedType;
}
};
}
@Override
public void show() {
}
@Override
public boolean isOK() {
return true;
}
@NotNull
@Override
public LinkedHashSet<String> suggestNames() {
LinkedHashSet<String> strings = new LinkedHashSet<String>();
strings.add("f");
return strings;
}
};
}
示例4: getModifier
@Override
protected String getModifier() {
return PsiModifier.PACKAGE_LOCAL;
}