本文整理汇总了Java中com.intellij.ide.util.TreeClassChooserFactory类的典型用法代码示例。如果您正苦于以下问题:Java TreeClassChooserFactory类的具体用法?Java TreeClassChooserFactory怎么用?Java TreeClassChooserFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeClassChooserFactory类属于com.intellij.ide.util包,在下文中一共展示了TreeClassChooserFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
final TreeClassChooserFactory factory = TreeClassChooserFactory.getInstance(myProject);
PsiFile formFile = null;
if (myTextField.getText().length() > 0) {
VirtualFile formVFile = ResourceFileUtil.findResourceFileInScope(myTextField.getText(), myProject, ProjectScope.getAllScope(myProject));
if (formVFile != null) {
formFile = PsiManager.getInstance(myProject).findFile(formVFile);
}
}
TreeFileChooser fileChooser = factory.createFileChooser(myTitle, formFile, null, myFilter, true, true);
fileChooser.showDialog();
PsiFile file = fileChooser.getSelectedFile();
if (file != null) {
myTextField.setText(FormEditingUtil.buildResourceName(file));
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ComponentItemDialog.java
示例2: chooseMainClassForProject
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
/** Ui for the user to pick the Main class. */
@NotNull
public TreeClassChooser chooseMainClassForProject() {
logger.info("Choosing main class for project.");
TreeClassChooser chooser;
Project project = new ObjectFinder().findCurrentProject();
while (true) {
TreeClassChooserFactory factory = TreeClassChooserFactory.getInstance(project);
GlobalSearchScope scope;
scope = GlobalSearchScope.moduleScope(module);
PsiClass ecClass = JavaPsiFacade.getInstance(project).findClass("", scope);
ClassFilter filter = createClassFilter();
chooser =
factory.createInheritanceClassChooser(
"Choose main class", scope, ecClass, null, filter);
chooser.showDialog();
if (chooser.getSelected() == null
|| chooser.getSelected().findMethodsByName("main", true).length > 0) {
logger.info("Choosing main class aborted.");
break;
}
}
logger.info("Main class chosen successfully.");
return chooser;
}
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:26,代码来源:RunConfigurationFactory.java
示例3: addBreakpoint
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:JavaExceptionBreakpointType.java
示例4: chooseAnnotation
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
private void chooseAnnotation(String title, JBList list) {
final TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject)
.createNoInnerClassesScopeChooser("Choose " + title + " annotation", GlobalSearchScope.allScope(myProject), new ClassFilter() {
@Override
public boolean isAccepted(PsiClass aClass) {
return aClass.isAnnotationType();
}
}, null);
chooser.showDialog();
final PsiClass selected = chooser.getSelected();
if (selected == null) {
return;
}
final String qualifiedName = selected.getQualifiedName();
final DefaultListModel model = (DefaultListModel)list.getModel();
final int index = model.indexOf(qualifiedName);
if (index < 0) {
model.addElement(qualifiedName);
} else {
myList.setSelectedIndex(index);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:NullableNotNullDialog.java
示例5: createElement
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@Override
protected DomElement createElement(final T context, final Editor editor, PsiFile file, final Project project) {
PsiClass selectedClass;
if (!ApplicationManager.getApplication().isUnitTestMode()) {
PsiClass baseClass = getBaseClass(context, project, myBaseClass);
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project)
.createInheritanceClassChooser(getChooserTitle(), GlobalSearchScope.allScope(project), baseClass, null, new ClassFilter() {
@Override
public boolean isAccepted(PsiClass aClass) {
return !aClass.isInterface() && !aClass.hasModifierProperty(PsiModifier.ABSTRACT);
}
});
chooser.showDialog();
selectedClass = chooser.getSelected();
}
else {
selectedClass = getBaseClass(context, project, myBaseClass == null ? CommonClassNames.JAVA_LANG_OBJECT : myBaseClass);
}
if (selectedClass == null) return null;
return createElement(context, editor, file, project, selectedClass);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CreateClassMappingAction.java
示例6: createAppletClassBrowser
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
public static ClassBrowser createAppletClassBrowser(final Project project,
final ConfigurationModuleSelector moduleSelector) {
final String title = ExecutionBundle.message("choose.applet.class.dialog.title");
return new MainClassBrowser(project, moduleSelector, title) {
@Override
protected TreeClassChooser createClassChooser(ClassFilter.ClassFilterWithScope classFilter) {
final Module module = moduleSelector.getModule();
final GlobalSearchScope scope =
module == null ? GlobalSearchScope.allScope(myProject) : GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module);
final PsiClass appletClass = JavaPsiFacade.getInstance(project).findClass("java.applet.Applet", scope);
return TreeClassChooserFactory.getInstance(getProject())
.createInheritanceClassChooser(title, classFilter.getScope(), appletClass, false, false,
ConfigurationUtil.PUBLIC_INSTANTIATABLE_CLASS);
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ClassBrowser.java
示例7: actionPerformed
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject).createWithInnerClassesScopeChooser(myChooserTitle,
GlobalSearchScope.projectScope(myProject),
new ClassFilter() {
public boolean isAccepted(PsiClass aClass) {
return aClass.getParent() instanceof PsiJavaFile || aClass.hasModifierProperty(PsiModifier.STATIC);
}
}, null);
if (mySelectedClass != null) {
chooser.selectDirectory(mySelectedClass.getContainingFile().getContainingDirectory());
}
chooser.showDialog();
mySelectedClass = chooser.getSelected();
if (mySelectedClass != null) {
setText(mySelectedClass.getQualifiedName());
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ClassNameReferenceEditor.java
示例8: createTreeClassChooser
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@Override
protected TreeClassChooser createTreeClassChooser(@NotNull Project project,
@NotNull GlobalSearchScope scope,
@Nullable PsiClass initialSelection,
@NotNull final ClassFilter classFilter) {
final PsiClass baseClass = JavaPsiFacade.getInstance(project).findClass(myBaseClassName, ProjectScope.getAllScope(project));
if (baseClass == null) {
Messages.showErrorDialog(project, AndroidBundle.message("cant.find.class.error", myBaseClassName), CommonBundle.getErrorTitle());
return null;
}
return TreeClassChooserFactory.getInstance(project).createInheritanceClassChooser(
myDialogTitle, scope, baseClass, initialSelection, new ClassFilter() {
@Override
public boolean isAccepted(PsiClass aClass) {
if (aClass.getManager().areElementsEquivalent(aClass, baseClass)) {
return false;
}
return classFilter.isAccepted(aClass);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AndroidInheritingClassBrowser.java
示例9: selectListenerClass
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@Nullable
protected String selectListenerClass() {
GlobalSearchScope searchScope = getSearchScope(config.getModules());
if (searchScope == null) {
searchScope = GlobalSearchScope.allScope(project);
}
final TestListenerFilter filter = new TestListenerFilter(searchScope, project);
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project)
.createWithInnerClassesScopeChooser("Choose Listener Class", filter.getScope(), filter, null);
chooser.showDialog();
PsiClass psiclass = chooser.getSelected();
if (psiclass == null) {
return null;
}
else {
return JavaExecutionUtil.getRuntimeQualifiedName(psiclass);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:TestNGConfigurationEditor.java
示例10: showDialog
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@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();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TestClassBrowser.java
示例11: actionPerformed
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
final TreeClassChooserFactory factory = TreeClassChooserFactory.getInstance(myProject);
PsiFile formFile = null;
if (myTextField.getText().length() > 0) {
VirtualFile formVFile = ResourceFileUtil.findResourceFileInScope(myTextField.getText(), myProject, ProjectScope.getAllScope(myProject));
if (formVFile != null) {
formFile = PsiManager.getInstance(myProject).findFile(formVFile);
}
}
TreeFileChooser fileChooser = factory.createFileChooser(myTitle, formFile, null, myFilter, true, true);
fileChooser.showDialog();
PsiFile file = fileChooser.getSelectedFile();
if (file != null) {
myTextField.setText(FormEditingUtil.buildResourceName(file));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ComponentItemDialog.java
示例12: addBreakpoint
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@Override
public Breakpoint addBreakpoint(Project project) {
ExceptionBreakpoint breakpoint = null;
final PsiClass throwableClass =
JavaPsiFacade.getInstance(project).findClass("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();
PsiClass selectedClass = chooser.getSelected();
String qName = selectedClass == null ? null : JVMNameUtil.getNonAnonymousClassName(selectedClass);
if (qName != null && qName.length() > 0) {
breakpoint = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager()
.addExceptionBreakpoint(qName, ((PsiClassOwner)selectedClass.getContainingFile()).getPackageName());
}
return breakpoint;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:ExceptionBreakpointFactory.java
示例13: getScope
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@Nullable
public SearchScope getScope() {
if (myCachedScope == null) {
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject).createAllProjectScopeChooser(IdeBundle.message("prompt.choose.base.class.of.the.hierarchy"));
chooser.showDialog();
PsiClass aClass = chooser.getSelected();
if (aClass == null) return null;
List<PsiElement> classesToSearch = new LinkedList<PsiElement>();
classesToSearch.add(aClass);
classesToSearch.addAll(ClassInheritorsSearch.search(aClass, true).findAll());
myCachedScope = new LocalSearchScope(PsiUtilCore.toPsiElementArray(classesToSearch),
IdeBundle.message("scope.hierarchy", ClassPresentationUtil.getNameForClass(aClass, true)));
}
return myCachedScope;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:ClassHierarchyScopeDescriptor.java
示例14: showDialog
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@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 JavaExecutionUtil.getRuntimeQualifiedName(psiclass);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:TestClassBrowser.java
示例15: getScope
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@Nullable
public SearchScope getScope() {
if (myCachedScope == null) {
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject).createAllProjectScopeChooser(IdeBundle.message("prompt.choose.base.class.of.the.hierarchy"));
chooser.showDialog();
PsiClass aClass = chooser.getSelected();
if (aClass == null) return null;
List<PsiElement> classesToSearch = new LinkedList<PsiElement>();
classesToSearch.add(aClass);
classesToSearch.addAll(ClassInheritorsSearch.search(aClass, true).findAll());
myCachedScope = new LocalSearchScope(PsiUtilBase.toPsiElementArray(classesToSearch),
IdeBundle.message("scope.hierarchy", ClassPresentationUtil.getNameForClass(aClass, true)));
}
return myCachedScope;
}
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:ClassHierarchyScopeDescriptor.java
示例16: addBreakpoint
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
@Nullable
@Override
public XBreakpoint<JavaExceptionBreakpointProperties> addBreakpoint(final Project project, JComponent parentComponent)
{
final PsiClass throwableClass = JavaPsiFacade.getInstance(project).findClass("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;
}
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:JavaExceptionBreakpointType.java
示例17: chooseClass
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
public static PsiClass chooseClass(Project project, PsiClass defaultClass) {
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project)
.createProjectScopeChooser("Select a class", defaultClass);
chooser.showDialog();
return chooser.getSelected();
}
开发者ID:zeng198821,项目名称:CodeGenerate,代码行数:9,代码来源:CodeMakerUtil.java
示例18: chooseClass
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
/**
* 类选择器
* @param project
* @param defaultClass
* @return
*/
public static PsiClass chooseClass(Project project, PsiClass defaultClass) {
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(project)
.createProjectScopeChooser("Select a class", defaultClass);
chooser.showDialog();
return chooser.getSelected();
}
开发者ID:hykes,项目名称:CodeGen,代码行数:13,代码来源:PsiUtil.java
示例19: createCenterPanel
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
protected JComponent createCenterPanel() {
final JPanel panel = new JPanel(new GridBagLayout());
final JLabel header = new JLabel(UIBundle.message("label.class.filter.editor.add.dialog.filter.pattern"));
myClassName = new TextFieldWithBrowseButton(new JTextField(35));
final JLabel iconLabel = new JLabel(Messages.getQuestionIcon());
panel.add(header, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 0), 0, 0));
panel.add(myClassName, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 0), 0, 0));
panel.add(iconLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(15, 0, 0, 0), 0, 0));
myClassName.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
PsiClass currentClass = getSelectedClass();
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject).createNoInnerClassesScopeChooser(
UIBundle.message("class.filter.editor.choose.class.title"), GlobalSearchScope.allScope(myProject), null, null);
if (currentClass != null) {
PsiFile containingFile = currentClass.getContainingFile();
if (containingFile != null) {
PsiDirectory containingDirectory = containingFile.getContainingDirectory();
if (containingDirectory != null) {
chooser.selectDirectory(containingDirectory);
}
}
}
chooser.showDialog();
PsiClass selectedClass = chooser.getSelected();
if (selectedClass != null) {
myClassName.setText(selectedClass.getQualifiedName());
}
}
});
myClassName.setEnabled(myProject != null);
return panel;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:ClassFilterEditorAddDialog.java
示例20: addClassFilter
import com.intellij.ide.util.TreeClassChooserFactory; //导入依赖的package包/类
protected void addClassFilter() {
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject).createNoInnerClassesScopeChooser(
UIBundle.message("class.filter.editor.choose.class.title"), GlobalSearchScope.allScope(myProject), myChooserFilter, null);
chooser.showDialog();
PsiClass selectedClass = chooser.getSelected();
if (selectedClass != null) {
com.intellij.ui.classFilter.ClassFilter filter = createFilter(getJvmClassName(selectedClass));
myTableModel.addRow(filter);
int row = myTableModel.getRowCount() - 1;
myTable.getSelectionModel().setSelectionInterval(row, row);
myTable.scrollRectToVisible(myTable.getCellRect(row, 0, true));
myTable.requestFocus();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ClassFilterEditor.java
注:本文中的com.intellij.ide.util.TreeClassChooserFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论