本文整理汇总了Java中com.intellij.openapi.util.Pass类的典型用法代码示例。如果您正苦于以下问题:Java Pass类的具体用法?Java Pass怎么用?Java Pass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pass类属于com.intellij.openapi.util包,在下文中一共展示了Pass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDestinationRootPanel
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
@Override
protected JPanel createDestinationRootPanel() {
final List<VirtualFile> sourceRoots = JavaProjectRootsUtil.getSuitableDestinationSourceRoots(myProject);
if (sourceRoots.size() <= 1) return super.createDestinationRootPanel();
final JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JBLabel label = new JBLabel(RefactoringBundle.message("target.destination.folder"));
panel.add(label, BorderLayout.NORTH);
label.setLabelFor(myDestinationFolderComboBox);
myDestinationFolderComboBox.setData(myProject, myTargetDirectory, new Pass<String>() {
@Override
public void pass(String s) {
}
}, ((PackageNameReferenceEditorCombo)myPackageNameField).getChildComponent());
panel.add(myDestinationFolderComboBox, BorderLayout.CENTER);
return panel;
}
示例2: substituteElementToRename
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
@Override
public void substituteElementToRename(@NotNull PsiElement element,
@NotNull final Editor editor,
@NotNull final Pass<PsiElement> renameCallback) {
final PsiMethod psiMethod = (PsiMethod)element;
if (psiMethod.isConstructor()) {
final PsiClass containingClass = psiMethod.getContainingClass();
if (containingClass == null) return;
if (!Comparing.strEqual(psiMethod.getName(), containingClass.getName())) {
renameCallback.pass(psiMethod);
return;
}
super.substituteElementToRename(element, editor, renameCallback);
}
else {
SuperMethodWarningUtil.checkSuperMethod(psiMethod, "Rename", new PsiElementProcessor<PsiMethod>() {
@Override
public boolean execute(@NotNull PsiMethod method) {
if (!PsiElementRenameHandler.canRename(method.getProject(), editor, method)) return false;
renameCallback.pass(method);
return false;
}
}, editor);
}
}
示例3: CopyClassDialog
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
public CopyClassDialog(PsiClass aClass, PsiDirectory defaultTargetDirectory, Project project, boolean doClone) {
super(project, true);
myProject = project;
myDefaultTargetDirectory = defaultTargetDirectory;
myDoClone = doClone;
String text = myDoClone ? RefactoringBundle.message("copy.class.clone.0.1", UsageViewUtil.getType(aClass), UsageViewUtil.getLongName(aClass)) :
RefactoringBundle.message("copy.class.copy.0.1", UsageViewUtil.getType(aClass), UsageViewUtil.getLongName(aClass));
myInformationLabel.setText(text);
myInformationLabel.setFont(myInformationLabel.getFont().deriveFont(Font.BOLD));
init();
myDestinationCB.setData(myProject, defaultTargetDirectory,
new Pass<String>() {
@Override
public void pass(String s) {
setErrorText(s);
}
}, myTfPackage.getChildComponent());
myNameField.setText(UsageViewUtil.getShortName(aClass));
myNameField.selectAll();
}
示例4: doTestStopEditing
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
private void doTestStopEditing(Pass<AbstractInplaceIntroducer> pass) {
String name = getTestName(true);
configureByFile(getBasePath() + name + getExtension());
final boolean enabled = getEditor().getSettings().isVariableInplaceRenameEnabled();
try {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
getEditor().getSettings().setVariableInplaceRenameEnabled(true);
final AbstractInplaceIntroducer introducer = invokeRefactoring();
pass.pass(introducer);
checkResultByFile(getBasePath() + name + "_after" + getExtension());
}
finally {
TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
if (state != null) {
state.gotoEnd(true);
}
getEditor().getSettings().setVariableInplaceRenameEnabled(enabled);
}
}
示例5: doTestReplaceChoice
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
private void doTestReplaceChoice(OccurrencesChooser.ReplaceChoice choice, Pass<AbstractInplaceIntroducer> pass) {
String name = getTestName(true);
configureByFile(getBasePath() + name + getExtension());
final boolean enabled = getEditor().getSettings().isVariableInplaceRenameEnabled();
try {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
getEditor().getSettings().setVariableInplaceRenameEnabled(true);
MyIntroduceHandler handler = createIntroduceHandler();
((MyIntroduceVariableHandler)handler).setChoice(choice);
final AbstractInplaceIntroducer introducer = invokeRefactoring(handler);
if (pass != null) {
pass.pass(introducer);
}
TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
assert state != null;
state.gotoEnd(false);
checkResultByFile(getBasePath() + name + "_after" + getExtension());
}
finally {
getEditor().getSettings().setVariableInplaceRenameEnabled(enabled);
}
}
示例6: setTabActions
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
public void setTabActions(ActionGroup group) {
removeOldActionPanel();
if (group == null) return;
myActionPanel = new ActionPanel(myTabs, myInfo, new Pass<MouseEvent>() {
public void pass(final MouseEvent event) {
final MouseEvent me = SwingUtilities.convertMouseEvent(event.getComponent(), event, TabLabel.this);
processMouseEvent(me);
}
});
toggleShowActions(false);
add(myActionPanel, BorderLayout.EAST);
myTabs.revalidateAndRepaint(false);
}
示例7: doTestEscape
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
protected void doTestEscape(Pass<AbstractInplaceIntroducer> pass) {
String name = getTestName(true);
configureByFile(getBasePath() + name + getExtension());
final boolean enabled = getEditor().getSettings().isVariableInplaceRenameEnabled();
try {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
getEditor().getSettings().setVariableInplaceRenameEnabled(true);
final AbstractInplaceIntroducer introducer = invokeRefactoring();
if (pass != null) {
pass.pass(introducer);
}
TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
assert state != null;
state.gotoEnd(true);
checkResultByFile(getBasePath() + name + "_after" + getExtension());
}
finally {
getEditor().getSettings().setVariableInplaceRenameEnabled(enabled);
}
}
示例8: doTest
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
protected void doTest(final Pass<AbstractInplaceIntroducer> pass) {
String name = getTestName(true);
configureByFile(getBasePath() + name + getExtension());
final boolean enabled = getEditor().getSettings().isVariableInplaceRenameEnabled();
try {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
getEditor().getSettings().setVariableInplaceRenameEnabled(true);
final AbstractInplaceIntroducer introducer = invokeRefactoring();
pass.pass(introducer);
TemplateState state = TemplateManagerImpl.getTemplateState(InjectedLanguageUtil.getTopLevelEditor(getEditor()));
assert state != null;
state.gotoEnd(false);
checkResultByFile(getBasePath() + name + "_after" + getExtension());
}
finally {
getEditor().getSettings().setVariableInplaceRenameEnabled(enabled);
}
}
示例9: performActionOnElementOccurrences
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
protected void performActionOnElementOccurrences(final IntroduceOperation operation) {
final Editor editor = operation.getEditor();
if (editor.getSettings().isVariableInplaceRenameEnabled()) {
ensureName(operation);
if (operation.isReplaceAll() != null) {
performInplaceIntroduce(operation);
}
else {
OccurrencesChooser.simpleChooser(editor).showChooser(operation.getElement(), operation.getOccurrences(), new Pass<OccurrencesChooser.ReplaceChoice>() {
@Override
public void pass(OccurrencesChooser.ReplaceChoice replaceChoice) {
operation.setReplaceAll(replaceChoice == OccurrencesChooser.ReplaceChoice.ALL);
performInplaceIntroduce(operation);
}
});
}
}
else {
performIntroduceWithDialog(operation);
}
}
示例10: createTestTreeView
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
protected JComponent createTestTreeView() {
tree = new TestNGTestTreeView();
final TestTreeStructure structure = new TestTreeStructure(project, rootNode);
tree.attachToModel(this);
treeBuilder = new TestTreeBuilder(tree, structure);
Disposer.register(this, treeBuilder);
animator = new TestsProgressAnimator(treeBuilder);
openSourceListener = new OpenSourceSelectionListener();
tree.getSelectionModel().addTreeSelectionListener(openSourceListener);
TrackRunningTestUtil.installStopListeners(tree, this, new Pass<AbstractTestProxy>() {
@Override
public void pass(AbstractTestProxy abstractTestProxy) {
myLastSelected = (TestProxy)abstractTestProxy;
}
});
return tree;
}
示例11: invokeInplaceRename
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
private static void invokeInplaceRename(PsiNameIdentifierOwner nameIdentifierOwner, final String... suggestedNames) {
final PsiNameIdentifierOwner elementToRename = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(nameIdentifierOwner);
final Editor editor = FileEditorManager.getInstance(nameIdentifierOwner.getProject()).getSelectedTextEditor();
if (editor == null) {
return;
}
final PsiElement identifier = elementToRename.getNameIdentifier();
if (identifier == null) {
return;
}
editor.getCaretModel().moveToOffset(identifier.getTextOffset());
final RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(elementToRename);
if (!processor.isInplaceRenameSupported()) {
return;
}
processor.substituteElementToRename(elementToRename, editor, new Pass<PsiElement>() {
@Override
public void pass(PsiElement substitutedElement) {
final MemberInplaceRenamer renamer = new MemberInplaceRenamer(elementToRename, substitutedElement, editor);
final LinkedHashSet<String> nameSuggestions = new LinkedHashSet<String>(Arrays.asList(suggestedNames));
renamer.performInplaceRefactoring(nameSuggestions);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:NonThreadSafeLazyInitializationInspection.java
示例12: invoke
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
@Override
public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file, @Nullable DataContext dataContext) {
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
final SelectionModel model = editor.getSelectionModel();
if (model.hasSelection()) {
invokeImpl(project, editor, file, model.getSelectionStart(), model.getSelectionEnd());
}
else {
final List<GrExpression> expressions = GrIntroduceHandlerBase.collectExpressions(file, editor, editor.getCaretModel().getOffset(), true);
final Pass<GrExpression> callback = new Callback(project, editor, file);
if (expressions.size() == 1) {
callback.pass(expressions.get(0));
}
else if (expressions.isEmpty()) {
model.selectLineAtCaret();
invokeImpl(project, editor, file, model.getSelectionStart(), model.getSelectionEnd());
}
else {
IntroduceTargetChooser.showChooser(editor, expressions, callback, GrIntroduceHandlerBase.GR_EXPRESSION_RENDERER);
}
}
}
示例13: createDestinationRootPanel
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
@Override
protected JPanel createDestinationRootPanel() {
final VirtualFile[] sourceRoots = ProjectRootManager.getInstance(myProject).getContentSourceRoots();
if (sourceRoots.length <= 1) return super.createDestinationRootPanel();
final JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JBLabel label = new JBLabel(RefactoringBundle.message("target.destination.folder"));
panel.add(label, BorderLayout.NORTH);
label.setLabelFor(myDestinationFolderComboBox);
myDestinationFolderComboBox.setData(myProject, myTargetDirectory, new Pass<String>() {
@Override
public void pass(String s) {
}
}, ((PackageNameReferenceEditorCombo)myPackageNameField).getChildComponent());
panel.add(myDestinationFolderComboBox, BorderLayout.CENTER);
return panel;
}
示例14: applyChosenClassAndExtract
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
private boolean applyChosenClassAndExtract(List<PsiVariable> inputVariables, @Nullable Pass<ExtractMethodProcessor> extractPass)
throws PrepareFailedException {
myStatic = shouldBeStatic();
if (!PsiUtil.isLocalOrAnonymousClass(myTargetClass) && (myTargetClass.getContainingClass() == null || myTargetClass.hasModifierProperty(PsiModifier.STATIC))) {
ElementNeedsThis needsThis = new ElementNeedsThis(myTargetClass);
for (int i = 0; i < myElements.length && !needsThis.usesMembers(); i++) {
PsiElement element = myElements[i];
element.accept(needsThis);
}
myCanBeStatic = !needsThis.usesMembers();
}
else {
myCanBeStatic = false;
}
myInputVariables = new InputVariables(inputVariables, myProject, new LocalSearchScope(myElements), true);
if (!checkExitPoints()){
return false;
}
if (extractPass != null) {
extractPass.pass(this);
}
return true;
}
示例15: doTest
import com.intellij.openapi.util.Pass; //导入依赖的package包/类
protected void doTest(final Pass<AbstractInplaceIntroducer> pass) {
String name = getTestName(true);
configureByFile(getBasePath() + name + getExtension());
final boolean enabled = getEditor().getSettings().isVariableInplaceRenameEnabled();
try {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
getEditor().getSettings().setVariableInplaceRenameEnabled(true);
final AbstractInplaceIntroducer introducer = invokeRefactoring();
pass.pass(introducer);
TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
assert state != null;
state.gotoEnd(false);
checkResultByFile(getBasePath() + name + "_after" + getExtension());
}
finally {
getEditor().getSettings().setVariableInplaceRenameEnabled(enabled);
}
}