private void doOpenSelectionDialog(int scopeType, FormEntry entry) { try { String filter = entry.getValue(); filter = filter.substring(filter.lastIndexOf(".") + 1); //$NON-NLS-1$ SelectionDialog dialog = JavaUI.createTypeDialog(PDEPlugin.getActiveWorkbenchShell(), PlatformUI.getWorkbench().getProgressService(), SearchEngine.createWorkspaceScope(), scopeType, false, filter); dialog.setTitle(PDEUIMessages.GeneralInfoSection_selectionTitle); if (dialog.open() == Window.OK) { IType type = (IType) dialog.getResult()[0]; entry.setValue(type.getFullyQualifiedName('$')); entry.commit(); } } catch (CoreException e) { } }
private void browseForBuilderClass() { try { IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { getType().getJavaProject() }); SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), PlatformUI.getWorkbench().getProgressService(), scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*ToString", fExtension); //$NON-NLS-1$ dialog.setTitle(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_windowTitle); dialog.setMessage(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_message); dialog.open(); if (dialog.getReturnCode() == OK) { IType type= (IType)dialog.getResult()[0]; fBuilderClassName.setText(type.getFullyQualifiedParameterizedName()); List<String> suggestions= fValidator.getAppendMethodSuggestions(type); if (!suggestions.contains(fAppendMethodName.getText())) fAppendMethodName.setText(suggestions.get(0)); suggestions= fValidator.getResultMethodSuggestions(type); if (!suggestions.contains(fResultMethodName.getText())) fResultMethodName.setText(suggestions.get(0)); } } catch (JavaModelException e) { JavaPlugin.log(e); } } }
private void browseForBuilderClass() { try { IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { getType().getJavaProject() }); SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), PlatformUI.getWorkbench().getProgressService(), scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*ToString", fExtension); //$NON-NLS-1$ dialog.setTitle(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_windowTitle); dialog.setMessage(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_message); dialog.open(); if (dialog.getReturnCode() == OK) { IType type= (IType)dialog.getResult()[0]; fBuilderClassName.setText(type.getFullyQualifiedParameterizedName()); List<String> suggestions= fValidator.getAppendMethodSuggestions(type); if (!suggestions.contains(fAppendMethodName.getText())) fAppendMethodName.setText(suggestions.get(0)); suggestions= fValidator.getResultMethodSuggestions(type); if (!suggestions.contains(fResultMethodName.getText())) fResultMethodName.setText(suggestions.get(0)); } } catch (JavaModelException e) { JavaPlugin.log(e); } } }
public void run(IAction action) { Shell shell = JDIDebugUIPlugin.getActiveWorkbenchShell(); SelectionDialog dialog = null; try { dialog = JavaUI.createTypeDialog(shell, workbenchWindow, SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_CLASSES, true, "", null); //$NON-NLS-1$ dialog.setTitle(BreakpointMessages.AddClassPrepareBreakpointAction_0); dialog.setMessage(BreakpointMessages.AddClassPrepareBreakpointAction_1); if (dialog.open() == IDialogConstants.OK_ID) { createBreakpoints(dialog.getResult()); } } catch (CoreException e) {JDIDebugUIPlugin.log(e);} }
public static String selectType(IResource resource, int scope) { if (resource == null) return null; IProject project = resource.getProject(); try { SelectionDialog dialog = JavaUI.createTypeDialog(PDEPlugin.getActiveWorkbenchShell(), PlatformUI.getWorkbench().getProgressService(), PDEJavaHelper.getSearchScope(project), scope, false, ""); //$NON-NLS-1$ dialog.setTitle(PDEUIMessages.ClassAttributeRow_dialogTitle); if (dialog.open() == Window.OK) { IType type = (IType) dialog.getResult()[0]; return type.getFullyQualifiedName('$'); } } catch (JavaModelException e) { } return null; }
public static String selectType(IResource resource, int scope, String filter, String superTypeName) { if (resource == null) return null; IProject project = resource.getProject(); try { IJavaSearchScope searchScope = null; if (superTypeName != null && !superTypeName.equals("java.lang.Object")) { //$NON-NLS-1$ IJavaProject javaProject = JavaCore.create(project); IType superType = javaProject.findType(superTypeName); if (superType != null) searchScope = SearchEngine.createStrictHierarchyScope(javaProject, superType, true, false, null); } if (searchScope == null) searchScope = PDEJavaHelper.getSearchScope(project); SelectionDialog dialog = JavaUI.createTypeDialog(PDEPlugin.getActiveWorkbenchShell(), PlatformUI.getWorkbench().getProgressService(), searchScope, scope, false, filter); dialog.setTitle(PDEUIMessages.ClassAttributeRow_dialogTitle); if (dialog.open() == Window.OK) { IType type = (IType) dialog.getResult()[0]; return type.getFullyQualifiedName('$'); } } catch (JavaModelException e) { } return null; }
private void doBrowseTypes() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES; try { SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText()); dialog.setTitle(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title); dialog.setMessage(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_description); if (dialog.open() == Window.OK) { IType res= (IType) dialog.getResult()[0]; fNameDialogField.setText(res.getFullyQualifiedName('.')); } } catch (JavaModelException e) { ExceptionHandler.handle(e, getShell(), PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title, PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_error_message); } }
private void doBrowseTypes() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES; try { SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText()); dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title); dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_description); if (dialog.open() == Window.OK) { IType res= (IType) dialog.getResult()[0]; fNameDialogField.setText(res.getFullyQualifiedName('.')); } } catch (JavaModelException e) { ExceptionHandler.handle(e, getShell(), PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title, PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_error_message); } }
private void doBrowseTypes() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES; try { SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText()); dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title); dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_description); if (dialog.open() == Window.OK) { IType res= (IType) dialog.getResult()[0]; fNameDialogField.setText(res.getFullyQualifiedName('.')); } } catch (JavaModelException e) { ExceptionHandler.handle(e, getShell(), PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title, PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_error_message); } }
private void doBrowseTypes() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES; try { SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText()); dialog.setTitle(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title); dialog.setMessage(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_description); if (dialog.open() == Window.OK) { IType res= (IType) dialog.getResult()[0]; fNameDialogField.setText(res.getFullyQualifiedName('.')); } } catch (JavaModelException e) { ExceptionHandler.handle(e, getShell(), PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title, PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_error_message); } }
private void doBrowseTypes() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES; try { SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText()); dialog.setTitle(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title); dialog.setMessage(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_description); if (dialog.open() == Window.OK) { IType res= (IType) dialog.getResult()[0]; fNameDialogField.setText(res.getFullyQualifiedName('.')); } } catch (JavaModelException e) { ExceptionHandler.handle(e, getShell(), PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title, PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_error_message); } }
private void doBrowseTypes() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES; try { SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText()); dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title); dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_description); if (dialog.open() == Window.OK) { IType res= (IType) dialog.getResult()[0]; fNameDialogField.setText(res.getFullyQualifiedName('.')); } } catch (JavaModelException e) { ExceptionHandler.handle(e, getShell(), PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title, PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_error_message); } }
public void run() { Shell shell= JavaPlugin.getActiveWorkbenchShell(); SelectionDialog dialog= null; try { dialog= JavaUI.createTypeDialog(shell, new ProgressMonitorDialog(shell), SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false); } catch (JavaModelException e) { String title= getDialogTitle(); String message= PackagesMessages.GotoType_error_message; ExceptionHandler.handle(e, title, message); return; } dialog.setTitle(getDialogTitle()); dialog.setMessage(PackagesMessages.GotoType_dialog_message); if (dialog.open() == IDialogConstants.CANCEL_ID) { return; } Object[] types= dialog.getResult(); if (types != null && types.length > 0) { gotoType((IType) types[0]); } }
@Override public void run() { Shell shell= JavaPlugin.getActiveWorkbenchShell(); SelectionDialog dialog= null; try { dialog= JavaUI.createTypeDialog(shell, new ProgressMonitorDialog(shell), SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false); } catch (JavaModelException e) { String title= getDialogTitle(); String message= PackagesMessages.GotoType_error_message; ExceptionHandler.handle(e, title, message); return; } dialog.setTitle(getDialogTitle()); dialog.setMessage(PackagesMessages.GotoType_dialog_message); if (dialog.open() == IDialogConstants.CANCEL_ID) { return; } Object[] types= dialog.getResult(); if (types != null && types.length > 0) { gotoType((IType) types[0]); } }
@Override public void run() { Shell shell= JavaPlugin.getActiveWorkbenchShell(); SelectionDialog dialog= null; try { dialog= JavaUI.createTypeDialog(shell, new ProgressMonitorDialog(shell), SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false); } catch (JavaModelException e) { String title= getDialogTitle(); String message= PackagesMessages.GotoType_error_message; ExceptionHandler.handle(e, title, message); return; } dialog.setTitle(getDialogTitle()); dialog.setMessage(PackagesMessages.GotoType_dialog_message); if (dialog.open() == IDialogConstants.CANCEL_ID) { return; } Object[] types= dialog.getResult(); if (types != null && types.length > 0) { gotoType((IType) types[0]); } }
/** * Creates the type hierarchy for type selection. */ private void doBrowseTypes() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES; try { SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText()); dialog.setTitle(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title); dialog.setMessage(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_description); if (dialog.open() == Window.OK) { IType res= (IType)dialog.getResult()[0]; fNameDialogField.setText(res.getFullyQualifiedName('.')); } } catch (JavaModelException e) { ExceptionHandler.handle(e, getShell(), CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title, CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_error_message); } }
/** * Creates the type hierarchy for type selection. */ private void doBrowseTypes() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES; try { SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText()); dialog.setTitle(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title); dialog.setMessage(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_description); if (dialog.open() == Window.OK) { IType res= (IType)dialog.getResult()[0]; fNameDialogField.setText(res.getFullyQualifiedName('.')); } } catch (JavaModelException e) { ExceptionHandler.handle(e, getShell(), CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title, CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_error_message); } }
/** * add a new type to the listing of available filters */ private void addType() { try { SelectionDialog dialog = JavaUI.createTypeDialog(getShell(), PlatformUI.getWorkbench().getProgressService(), SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_CLASSES, false); dialog.setTitle(DebugUIMessages.JavaStepFilterPreferencePage_Add_type_to_step_filters_20); dialog.setMessage(DebugUIMessages.JavaStepFilterPreferencePage_Select_a_type_to_filter_when_stepping_23); if (dialog.open() == IDialogConstants.OK_ID) { Object[] types = dialog.getResult(); if (types != null && types.length > 0) { IType type = (IType)types[0]; addFilter(type.getFullyQualifiedName(), true); } } } catch (JavaModelException jme) { ExceptionHandler.handle(jme, DebugUIMessages.JavaStepFilterPreferencePage_Add_type_to_step_filters_20, DebugUIMessages.JavaStepFilterPreferencePage_Could_not_open_type_selection_dialog_for_step_filters_21); } }
private void addType() { Shell shell = fAddTypeButton.getDisplay().getActiveShell(); SelectionDialog dialog = null; try { dialog = JavaUI.createTypeDialog(shell, PlatformUI.getWorkbench().getProgressService(), SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_CLASSES, false); } catch (JavaModelException jme) { String title = PropertyPageMessages.ExceptionFilterEditor_19; String message = PropertyPageMessages.ExceptionFilterEditor_20; ExceptionHandler.handle(jme, title, message); return; } dialog.setTitle(PropertyPageMessages.ExceptionFilterEditor_19); dialog.setMessage(PropertyPageMessages.ExceptionFilterEditor_22); if (dialog.open() == IDialogConstants.CANCEL_ID) { return; } Object[] types = dialog.getResult(); IType type; if (types != null) { for (int i = 0; i < types.length; i++) { type = (IType) types[i]; Filter f = fFilterContentProvider.addFilter(type.getFullyQualifiedName()); fFilterContentProvider.checkFilter(f, true); } } }
private void addType() { Shell shell= fAddTypeButton.getDisplay().getActiveShell(); SelectionDialog dialog= null; try { dialog= JavaUI.createTypeDialog(shell, PlatformUI.getWorkbench().getProgressService(), SearchEngine.createJavaSearchScope(new IJavaElement[]{fEditor.getJavaProject()}, true), IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false); } catch (JavaModelException jme) { String title= SnippetMessages.getString("SelectImportsDialog.Add_Type_as_Import_12"); //$NON-NLS-1$ String message= SnippetMessages.getString("SelectImportsDialog.Could_not_open_class_selection_dialog_13"); //$NON-NLS-1$ ExceptionHandler.handle(jme, title, message); return; } dialog.setTitle(SnippetMessages.getString("SelectImportsDialog.Add_Type_as_Import_12")); //$NON-NLS-1$ dialog.setMessage(SnippetMessages.getString("SelectImportsDialog.&Select_a_type_to_add_to_add_as_an_import_15")); //$NON-NLS-1$ if (dialog.open() == IDialogConstants.CANCEL_ID) { return; } Object[] types= dialog.getResult(); if (types != null && types.length > 0) { IType type = (IType)types[0]; fImportContentProvider.addImport(type.getFullyQualifiedName()); } }