本文整理汇总了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)));
}