private IType chooseException() { IJavaElement[] elements= new IJavaElement[] { fProject.getJavaProject() }; final IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, PlatformUI.getWorkbench().getProgressService(), scope, IJavaSearchConstants.CLASS); dialog.setTitle(RefactoringMessages.ChangeExceptionsControl_choose_title); dialog.setMessage(RefactoringMessages.ChangeExceptionsControl_choose_message); dialog.setInitialPattern("*Exception*"); //$NON-NLS-1$ dialog.setValidator(new ISelectionStatusValidator() { @Override public IStatus validate(Object[] selection) { if (selection.length == 0) return new StatusInfo(IStatus.ERROR, ""); //$NON-NLS-1$ try { return checkException((IType)selection[0]); } catch (JavaModelException e) { JavaPlugin.log(e); return StatusInfo.OK_STATUS; } } }); if (dialog.open() == Window.OK) { return (IType) dialog.getFirstResult(); } return null; }
private IType chooseException() { IJavaElement[] elements= new IJavaElement[] { fProject.getJavaProject() }; final IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, PlatformUI.getWorkbench().getProgressService(), scope, IJavaSearchConstants.CLASS); dialog.setTitle(RefactoringMessages.ChangeExceptionsControl_choose_title); dialog.setMessage(RefactoringMessages.ChangeExceptionsControl_choose_message); dialog.setInitialPattern("*Exception*"); //$NON-NLS-1$ dialog.setValidator(new ISelectionStatusValidator() { public IStatus validate(Object[] selection) { if (selection.length == 0) return new StatusInfo(IStatus.ERROR, ""); //$NON-NLS-1$ try { return checkException((IType)selection[0]); } catch (JavaModelException e) { JavaPlugin.log(e); return StatusInfo.OK_STATUS; } } }); if (dialog.open() == Window.OK) { return (IType) dialog.getFirstResult(); } return null; }
private IType chooseException() { IJavaElement[] elements= new IJavaElement[] { fProject.getJavaProject() }; final IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, PlatformUI.getWorkbench().getProgressService(), scope, IJavaSearchConstants.CLASS); dialog.setTitle(RefactoringMessages.ChangeExceptionsControl_choose_title); dialog.setMessage(RefactoringMessages.ChangeExceptionsControl_choose_message); dialog.setInitialPattern("*Exception*"); //$NON-NLS-1$ dialog.setValidator(new ISelectionStatusValidator() { @Override public IStatus validate(Object[] selection) { if (selection.length == 0) return new StatusInfo(IStatus.ERROR, ""); //$NON-NLS-1$ try { return checkException((IType)selection[0]); } catch (JavaModelException e) { JavaPlugin.log(e); return StatusInfo.OK_STATUS; } } }); if (dialog.open() == Window.OK) { return (IType) dialog.getFirstResult(); } return null; }
private void openTypeSelectionDialog(){ int elementKinds= IJavaSearchConstants.TYPE; final IJavaSearchScope scope= createWorkspaceSourceScope(); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, elementKinds); dialog.setTitle(RefactoringMessages.MoveMembersInputPage_choose_Type); dialog.setMessage(RefactoringMessages.MoveMembersInputPage_dialogMessage); dialog.setValidator(new ISelectionStatusValidator(){ @Override public IStatus validate(Object[] selection) { Assert.isTrue(selection.length <= 1); if (selection.length == 0) return new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, RefactoringMessages.MoveMembersInputPage_Invalid_selection, null); Object element= selection[0]; if (! (element instanceof IType)) return new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, RefactoringMessages.MoveMembersInputPage_Invalid_selection, null); IType type= (IType)element; return validateDestinationType(type, type.getElementName()); } }); dialog.setInitialPattern(createInitialFilter()); if (dialog.open() == Window.CANCEL) return; IType firstResult= (IType)dialog.getFirstResult(); fDestinationField.setText(firstResult.getFullyQualifiedName('.')); }
private void openTypeSelectionDialog(){ int elementKinds= IJavaSearchConstants.TYPE; final IJavaSearchScope scope= createWorkspaceSourceScope(); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, elementKinds); dialog.setTitle(RefactoringMessages.MoveMembersInputPage_choose_Type); dialog.setMessage(RefactoringMessages.MoveMembersInputPage_dialogMessage); dialog.setValidator(new ISelectionStatusValidator(){ public IStatus validate(Object[] selection) { Assert.isTrue(selection.length <= 1); if (selection.length == 0) return new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, RefactoringMessages.MoveMembersInputPage_Invalid_selection, null); Object element= selection[0]; if (! (element instanceof IType)) return new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, RefactoringMessages.MoveMembersInputPage_Invalid_selection, null); IType type= (IType)element; return validateDestinationType(type, type.getElementName()); } }); dialog.setInitialPattern(createInitialFilter()); if (dialog.open() == Window.CANCEL) return; IType firstResult= (IType)dialog.getFirstResult(); fDestinationField.setText(JavaModelUtil.getFullyQualifiedName(firstResult)); }
private void openTypeSelectionDialog(){ int elementKinds= IJavaSearchConstants.TYPE; final IJavaSearchScope scope= createWorkspaceSourceScope(); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, elementKinds); dialog.setTitle(RefactoringMessages.MoveMembersInputPage_choose_Type); dialog.setMessage(RefactoringMessages.MoveMembersInputPage_dialogMessage); dialog.setValidator(new ISelectionStatusValidator(){ @Override public IStatus validate(Object[] selection) { Assert.isTrue(selection.length <= 1); if (selection.length == 0) return new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, RefactoringMessages.MoveMembersInputPage_Invalid_selection, null); Object element= selection[0]; if (! (element instanceof IType)) return new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.OK, RefactoringMessages.MoveMembersInputPage_Invalid_selection, null); IType type= (IType)element; return validateDestinationType(type, type.getElementName()); } }); dialog.setInitialPattern(createInitialFilter()); if (dialog.open() == Window.CANCEL) return; IType firstResult= (IType)dialog.getFirstResult(); fDestinationField.setText(firstResult.getFullyQualifiedName('.')); }