當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。