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();
}
}
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;
}
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();
}
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();
}
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());
}
Aggregations