Search in sources :

Example 1 with TreeClassChooser

use of com.intellij.ide.util.TreeClassChooser in project intellij-community by JetBrains.

the class TestClassBrowser method showDialog.

@Override
protected String showDialog() {
    ClassFilter.ClassFilterWithScope filter;
    try {
        filter = getFilter();
    } catch (MessageInfoException e) {
        MessagesEx.MessageInfo message = e.getMessageInfo();
        message.showNow();
        return null;
    }
    TreeClassChooser chooser = TreeClassChooserFactory.getInstance(getProject()).createWithInnerClassesScopeChooser("Choose Test Class", filter.getScope(), filter, null);
    init(chooser);
    chooser.showDialog();
    PsiClass psiclass = chooser.getSelected();
    if (psiclass == null) {
        return null;
    } else {
        onClassChoosen(psiclass);
        return psiclass.getQualifiedName();
    }
}
Also used : TreeClassChooser(com.intellij.ide.util.TreeClassChooser) ClassFilter(com.intellij.ide.util.ClassFilter) TestClassFilter(com.theoryinpractice.testng.model.TestClassFilter) PsiClass(com.intellij.psi.PsiClass) MessageInfoException(com.theoryinpractice.testng.MessageInfoException)

Example 2 with TreeClassChooser

use of com.intellij.ide.util.TreeClassChooser in project intellij-community by JetBrains.

the class JavaExceptionBreakpointType method addBreakpoint.

//public Key<ExceptionBreakpoint> getBreakpointCategory() {
//  return ExceptionBreakpoint.CATEGORY;
//}
@Nullable
@Override
public XBreakpoint<JavaExceptionBreakpointProperties> addBreakpoint(final Project project, JComponent parentComponent) {
    final PsiClass throwableClass = JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_LANG_THROWABLE, GlobalSearchScope.allScope(project));
    TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project).createInheritanceClassChooser(DebuggerBundle.message("add.exception.breakpoint.classchooser.title"), GlobalSearchScope.allScope(project), throwableClass, true, true, null);
    chooser.showDialog();
    final PsiClass selectedClass = chooser.getSelected();
    final String qName = selectedClass == null ? null : JVMNameUtil.getNonAnonymousClassName(selectedClass);
    if (qName != null && qName.length() > 0) {
        return ApplicationManager.getApplication().runWriteAction(new Computable<XBreakpoint<JavaExceptionBreakpointProperties>>() {

            @Override
            public XBreakpoint<JavaExceptionBreakpointProperties> compute() {
                return XDebuggerManager.getInstance(project).getBreakpointManager().addBreakpoint(JavaExceptionBreakpointType.this, new JavaExceptionBreakpointProperties(qName, ((PsiClassOwner) selectedClass.getContainingFile()).getPackageName()));
            }
        });
    }
    return null;
}
Also used : TreeClassChooser(com.intellij.ide.util.TreeClassChooser) JavaExceptionBreakpointProperties(org.jetbrains.java.debugger.breakpoints.properties.JavaExceptionBreakpointProperties) XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint) PsiClass(com.intellij.psi.PsiClass) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with TreeClassChooser

use of com.intellij.ide.util.TreeClassChooser in project intellij-community by JetBrains.

the class DebuggerUtilsImpl method chooseClassDialog.

@Override
public PsiClass chooseClassDialog(String title, Project project) {
    TreeClassChooser dialog = TreeClassChooserFactory.getInstance(project).createAllProjectScopeChooser(title);
    dialog.showDialog();
    return dialog.getSelected();
}
Also used : TreeClassChooser(com.intellij.ide.util.TreeClassChooser)

Example 4 with TreeClassChooser

use of com.intellij.ide.util.TreeClassChooser in project intellij-community by JetBrains.

the class ClassBrowser method showDialog.

@Nullable
protected String showDialog() {
    final ClassFilter.ClassFilterWithScope classFilter;
    try {
        classFilter = getFilter();
    } catch (NoFilterException e) {
        final MessagesEx.MessageInfo info = e.getMessageInfo();
        info.showNow();
        return null;
    }
    final TreeClassChooser dialog = createClassChooser(classFilter);
    configureDialog(dialog);
    dialog.showDialog();
    final PsiClass psiClass = dialog.getSelected();
    if (psiClass == null)
        return null;
    onClassChoosen(psiClass);
    return psiClass.getQualifiedName();
}
Also used : TreeClassChooser(com.intellij.ide.util.TreeClassChooser) ClassFilter(com.intellij.ide.util.ClassFilter) PsiClass(com.intellij.psi.PsiClass) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with TreeClassChooser

use of com.intellij.ide.util.TreeClassChooser in project intellij-community by JetBrains.

the class WrapReturnValueDialog method createUIComponents.

private void createUIComponents() {
    final com.intellij.openapi.editor.event.DocumentAdapter adapter = new com.intellij.openapi.editor.event.DocumentAdapter() {

        public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
            validateButtons();
        }
    };
    packageTextField = new PackageNameReferenceEditorCombo("", myProject, RECENT_KEYS, RefactoringBundle.message("choose.destination.package"));
    packageTextField.getChildComponent().getDocument().addDocumentListener(adapter);
    existingClassField = new ReferenceEditorComboWithBrowseButton(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            final TreeClassChooser chooser = TreeClassChooserFactory.getInstance(getProject()).createWithInnerClassesScopeChooser(RefactorJBundle.message("select.wrapper.class"), GlobalSearchScope.allScope(myProject), null, null);
            final String classText = existingClassField.getText();
            final PsiClass currentClass = JavaPsiFacade.getInstance(myProject).findClass(classText, GlobalSearchScope.allScope(myProject));
            if (currentClass != null) {
                chooser.select(currentClass);
            }
            chooser.showDialog();
            final PsiClass selectedClass = chooser.getSelected();
            if (selectedClass != null) {
                existingClassField.setText(selectedClass.getQualifiedName());
            }
        }
    }, "", myProject, true, RECENT_KEYS);
    existingClassField.getChildComponent().getDocument().addDocumentListener(adapter);
    myDestinationCb = new DestinationFolderComboBox() {

        @Override
        public String getTargetPackage() {
            return getPackageName();
        }
    };
    ((DestinationFolderComboBox) myDestinationCb).setData(myProject, sourceMethod.getContainingFile().getContainingDirectory(), packageTextField.getChildComponent());
}
Also used : TreeClassChooser(com.intellij.ide.util.TreeClassChooser) ActionEvent(java.awt.event.ActionEvent) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) PackageNameReferenceEditorCombo(com.intellij.refactoring.ui.PackageNameReferenceEditorCombo) ReferenceEditorComboWithBrowseButton(com.intellij.ui.ReferenceEditorComboWithBrowseButton) ActionListener(java.awt.event.ActionListener) DestinationFolderComboBox(com.intellij.refactoring.move.moveClassesOrPackages.DestinationFolderComboBox)

Aggregations

TreeClassChooser (com.intellij.ide.util.TreeClassChooser)22 PsiClass (com.intellij.psi.PsiClass)12 ClassFilter (com.intellij.ide.util.ClassFilter)10 ActionEvent (java.awt.event.ActionEvent)7 ActionListener (java.awt.event.ActionListener)7 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)6 Project (com.intellij.openapi.project.Project)4 DocumentEvent (javax.swing.event.DocumentEvent)4 Nullable (org.jetbrains.annotations.Nullable)4 TreeClassChooserFactory (com.intellij.ide.util.TreeClassChooserFactory)3 DocumentAdapter (com.intellij.ui.DocumentAdapter)3 List (java.util.List)3 MemberChooser (com.intellij.ide.util.MemberChooser)2 DataContext (com.intellij.openapi.actionSystem.DataContext)2 Module (com.intellij.openapi.module.Module)2 JavaPsiFacade (com.intellij.psi.JavaPsiFacade)2 PsiModifierList (com.intellij.psi.PsiModifierList)2 DestinationFolderComboBox (com.intellij.refactoring.move.moveClassesOrPackages.DestinationFolderComboBox)2 PackageNameReferenceEditorCombo (com.intellij.refactoring.ui.PackageNameReferenceEditorCombo)2 ReferenceEditorComboWithBrowseButton (com.intellij.ui.ReferenceEditorComboWithBrowseButton)2