本文整理匯總了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);
}
示例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));
}
示例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);
}
示例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));
}
示例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)));
}