本文整理汇总了Java中com.intellij.refactoring.actions.BaseRefactoringAction类的典型用法代码示例。如果您正苦于以下问题:Java BaseRefactoringAction类的具体用法?Java BaseRefactoringAction怎么用?Java BaseRefactoringAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseRefactoringAction类属于com.intellij.refactoring.actions包,在下文中一共展示了BaseRefactoringAction类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getPsiElements
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
@NotNull
protected PsiElement[] getPsiElements(@NotNull TreeNode[] nodes) {
List<PsiElement> psiElements = new ArrayList<PsiElement>(nodes.length);
for (TreeNode node : nodes) {
PsiElement psiElement = getPsiElement(node);
if (psiElement != null) {
psiElements.add(psiElement);
}
}
if (psiElements.size() != 0) {
return PsiUtilCore.toPsiElementArray(psiElements);
}
else {
return BaseRefactoringAction.getPsiElementArray(DataManager.getInstance().getDataContext(myTree));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ProjectViewDropTarget.java
示例2: invoke
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
PsiElement element = getElement(dataContext);
if (element == null) {
element = BaseRefactoringAction.getElementAtCaret(editor, file);
}
if (ApplicationManager.getApplication().isUnitTestMode()) {
final String newName = DEFAULT_NAME.getData(dataContext);
if (newName != null) {
rename(element, project, element, editor, newName);
return;
}
}
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
final PsiElement nameSuggestionContext = InjectedLanguageUtil.findElementAtNoCommit(file, editor.getCaretModel().getOffset());
invoke(element, project, nameSuggestionContext, editor);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PsiElementRenameHandler.java
示例3: invoke
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
@Override
public void invoke(@NotNull final Project project, Editor editor, PsiFile file, DataContext dataContext) {
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
if (element == null) {
element = BaseRefactoringAction.getElementAtCaret(editor, file);
}
if (element != null) {
for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
if (handler.canInlineElementInEditor(element, editor)) {
handler.inlineElement(project, editor, element);
return;
}
}
if (invokeInliner(editor, element)) return;
String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("error.wrong.caret.position.method.or.local.name"));
CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, null);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:InlineRefactoringActionHandler.java
示例4: invoke
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
@Override
public void invoke(@NotNull final Project project, Editor editor, PsiFile file, DataContext dataContext) {
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
PsiElement element = LangDataKeys.PSI_ELEMENT.getData(dataContext);
if (element == null) {
element = BaseRefactoringAction.getElementAtCaret(editor, file);
}
if (element != null) {
for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
if (handler.canInlineElementInEditor(element, editor)) {
handler.inlineElement(project, editor, element);
return;
}
}
if (invokeInliner(editor, element)) return;
String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("error.wrong.caret.position.method.or.local.name"));
CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, null);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:InlineRefactoringActionHandler.java
示例5: update
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
/** Only show if selection is a literal */
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
VirtualFile grammarFile = MyActionUtils.getGrammarFileFromEvent(e);
if ( grammarFile==null ) {
presentation.setEnabled(false);
return;
}
PsiFile file = e.getData(LangDataKeys.PSI_FILE);
Editor editor = e.getData(PlatformDataKeys.EDITOR);
PsiElement selectedElement = BaseRefactoringAction.getElementAtCaret(editor, file);
if ( selectedElement==null ) { // we clicked somewhere outside text
presentation.setEnabled(false);
return;
}
}
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:18,代码来源:GenerateLexerRulesForLiteralsAction.java
示例6: getPsiElements
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
@Nonnull
protected PsiElement[] getPsiElements(@Nonnull TreeNode[] nodes) {
List<PsiElement> psiElements = new ArrayList<>(nodes.length);
for (TreeNode node : nodes) {
PsiElement psiElement = getPsiElement(node);
if (psiElement != null) {
psiElements.add(psiElement);
}
}
if (psiElements.size() != 0) {
return PsiUtilCore.toPsiElementArray(psiElements);
}
else {
return BaseRefactoringAction.getPsiElementArray(DataManager.getInstance().getDataContext(myTree));
}
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ProjectViewDropTarget.java
示例7: invoke
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
@Override
public void invoke(@Nonnull Project project, Editor editor, PsiFile file, DataContext dataContext) {
PsiElement element = getElement(dataContext);
if (element == null) {
element = BaseRefactoringAction.getElementAtCaret(editor, file);
}
if (ApplicationManager.getApplication().isUnitTestMode()) {
final String newName = dataContext.getData(DEFAULT_NAME);
if (newName != null) {
rename(element, project, element, editor, newName);
return;
}
}
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
final PsiElement nameSuggestionContext = InjectedLanguageUtil.findElementAtNoCommit(file, editor.getCaretModel().getOffset());
invoke(element, project, nameSuggestionContext, editor);
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:PsiElementRenameHandler.java
示例8: invoke
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
@Override
public void invoke(@Nonnull final Project project, Editor editor, PsiFile file, DataContext dataContext) {
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
PsiElement element = dataContext.getData(LangDataKeys.PSI_ELEMENT);
if (element == null) {
element = BaseRefactoringAction.getElementAtCaret(editor, file);
}
if (element != null) {
for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
if (handler.canInlineElementInEditor(element, editor)) {
handler.inlineElement(project, editor, element);
return;
}
}
if (invokeInliner(editor, element)) return;
String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("error.wrong.caret.position.method.or.local.name"));
CommonRefactoringUtil.showErrorHint(project, editor, message, REFACTORING_NAME, null);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:InlineRefactoringActionHandler.java
示例9: getElement
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
@Nullable
public static PsiElement getElement(final DataContext dataContext) {
PsiElement[] elementArray = BaseRefactoringAction.getPsiElementArray(dataContext);
if (elementArray.length != 1) {
return null;
}
return elementArray[0];
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiElementRenameHandler.java
示例10: invoke
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
PsiElement element = getElement(dataContext);
if (element == null) {
element = BaseRefactoringAction.getElementAtCaret(editor, file);
}
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
final PsiElement nameSuggestionContext = InjectedLanguageUtil.findElementAtNoCommit(file, editor.getCaretModel().getOffset());
invoke(element, project, nameSuggestionContext, editor);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:PsiElementRenameHandler.java
示例11: isDeclarationOutOfProjectOrAbsent
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
private boolean isDeclarationOutOfProjectOrAbsent(@NotNull Project project, DataContext context) {
PsiElement[] elements = BaseRefactoringAction.getPsiElementArray(context);
return elements.length == 0 || elements.length == 1 && shouldBeRenamedInplace(project, elements);
}
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:5,代码来源:FlowRenameHandler.java
示例12: isDeclarationOutOfProjectOrAbsent
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
private static boolean isDeclarationOutOfProjectOrAbsent(@NotNull final Project project, final DataContext context) {
final PsiElement[] elements = BaseRefactoringAction.getPsiElementArray(context);
return elements.length == 0 || elements.length == 1 && shouldBeRenamedInplace(project, elements);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:XmlTagRenameHandler.java
示例13: isDeclarationOutOfProjectOrAbsent
import com.intellij.refactoring.actions.BaseRefactoringAction; //导入依赖的package包/类
private static boolean isDeclarationOutOfProjectOrAbsent(@NotNull final Project project, final DataContext context)
{
final PsiElement[] elements = BaseRefactoringAction.getPsiElementArray(context);
return elements.length == 0 || elements.length == 1 && shouldBeRenamedInplace(project, elements);
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:6,代码来源:XmlTagRenameHandler.java
注:本文中的com.intellij.refactoring.actions.BaseRefactoringAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论