当前位置: 首页>>代码示例>>Java>>正文


Java CopyReferenceAction类代码示例

本文整理汇总了Java中com.intellij.ide.actions.CopyReferenceAction的典型用法代码示例。如果您正苦于以下问题:Java CopyReferenceAction类的具体用法?Java CopyReferenceAction怎么用?Java CopyReferenceAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CopyReferenceAction类属于com.intellij.ide.actions包,在下文中一共展示了CopyReferenceAction类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doRename

import com.intellij.ide.actions.CopyReferenceAction; //导入依赖的package包/类
public static void doRename(final PsiElement element, String newName, UsageInfo[] usages, final Project project,
                            @Nullable final RefactoringElementListener listener) throws IncorrectOperationException{
  final RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(element);
  final String fqn = element instanceof PsiFile ? ((PsiFile)element).getVirtualFile().getPath() : CopyReferenceAction.elementToFqn(element);
  if (fqn != null) {
    UndoableAction action = new BasicUndoableAction() {
      @Override
      public void undo() throws UnexpectedUndoException {
        if (listener instanceof UndoRefactoringElementListener) {
          ((UndoRefactoringElementListener)listener).undoElementMovedOrRenamed(element, fqn);
        }
      }

      @Override
      public void redo() throws UnexpectedUndoException {
      }
    };
    UndoManager.getInstance(project).undoableActionPerformed(action);
  }
  processor.renameElement(element, newName, usages, listener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:RenameUtil.java

示例2: performCopy

import com.intellij.ide.actions.CopyReferenceAction; //导入依赖的package包/类
@Override
public void performCopy(@NotNull DataContext dataContext) {
  final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
  final String fqn;
  if (element != null) {
    fqn = CopyReferenceAction.elementToFqn(element);
  }
  else {
    AbstractTestProxy selectedTest = getSelectedTest();
    fqn = selectedTest instanceof TestProxyRoot ? ((TestProxyRoot)selectedTest).getRootLocation() 
                                                : selectedTest != null ? selectedTest.getLocationUrl() : null;
  }
  CopyPasteManager.getInstance().setContents(new StringSelection(fqn));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:TestTreeView.java

示例3: testCopyReference

import com.intellij.ide.actions.CopyReferenceAction; //导入依赖的package包/类
public void testCopyReference() {
  myFixture.configureByFile("navigation/" + getTestName(false) + ".json");
  final PsiElement element = myFixture.getElementAtCaret();
  assertInstanceOf(element, JsonProperty.class);
  final String qualifiedName = CopyReferenceAction.elementToFqn(element);
  assertEquals("foo.bar.baz", qualifiedName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JsonNavigationTest.java

示例4: performCopy

import com.intellij.ide.actions.CopyReferenceAction; //导入依赖的package包/类
@Override
public void performCopy(@Nonnull DataContext dataContext) {
  final PsiElement element = dataContext.getData(CommonDataKeys.PSI_ELEMENT);
  final String fqn;
  if (element != null) {
    fqn = CopyReferenceAction.elementToFqn(element);
  }
  else {
    AbstractTestProxy selectedTest = getSelectedTest();
    fqn = selectedTest instanceof TestProxyRoot ? ((TestProxyRoot)selectedTest).getRootLocation() : selectedTest != null ? selectedTest.getLocationUrl() : null;
  }
  CopyPasteManager.getInstance().setContents(new StringSelection(fqn));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:TestTreeView.java

示例5: performCopy

import com.intellij.ide.actions.CopyReferenceAction; //导入依赖的package包/类
@Override
public void performCopy(@NotNull DataContext dataContext) {
  final PsiElement element = LangDataKeys.PSI_ELEMENT.getData(dataContext);
  CopyPasteManager.getInstance().setContents(new StringSelection(CopyReferenceAction.elementToFqn(element)));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:TestTreeView.java


注:本文中的com.intellij.ide.actions.CopyReferenceAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。