context, scope, elementKinds, extension); dialog.setMessage(JavaUIMessages.JavaUI_defaultDialogMessage); dialog.setInitialPattern(filter); return dialog;
context, scope, elementKinds, extension); dialog.setMessage(JavaUIMessages.JavaUI_defaultDialogMessage); dialog.setInitialPattern(filter); return dialog;
@Override public int open() { if (getInitialPattern() == null) { IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); if (window != null) { ISelection selection= window.getSelectionService().getSelection(); if (selection instanceof ITextSelection) { String text= ((ITextSelection) selection).getText(); if (text != null) { text= text.trim(); if (text.length() > 0 && JavaConventions.validateJavaTypeName(text, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3).isOK()) { setInitialPattern(text, FULL_SELECTION); } } } } } return super.open(); }
public int open() { if (getInitialPattern() == null) { IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); if (window != null) { ISelection selection= window.getSelectionService().getSelection(); if (selection instanceof ITextSelection) { String text= ((ITextSelection) selection).getText(); if (text != null) { text= text.trim(); if (text.length() > 0 && JavaConventions.validateJavaTypeName(text, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3).isOK()) { setInitialPattern(text, FULL_SELECTION); } } } } } return super.open(); }
@Override public int open() { if (getInitialPattern() == null) { IWorkbenchWindow window= JavaPlugin.getActiveWorkbenchWindow(); if (window != null) { ISelection selection= window.getSelectionService().getSelection(); if (selection instanceof ITextSelection) { String text= ((ITextSelection) selection).getText(); if (text != null) { text= text.trim(); if (text.length() > 0 && JavaConventions.validateJavaTypeName(text, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3).isOK()) { setInitialPattern(text, FULL_SELECTION); } } } } } return super.open(); }
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; }
/** * Opens a selection dialog that allows to select a super class. * * @return returns the selected type or <code>null</code> if the dialog has been canceled. * The caller typically sets the result to the super class input field. * <p> * Clients can override this method if they want to offer a different dialog. * </p> * * @since 3.2 */ protected IType chooseSuperClass() { IJavaProject project= getJavaProject(); if (project == null) { return null; } IJavaElement[] elements= new IJavaElement[] { project }; IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, IJavaSearchConstants.CLASS); dialog.setTitle(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_title); dialog.setMessage(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_message); dialog.setInitialPattern(getSuperClass()); if (dialog.open() == Window.OK) { return (IType) dialog.getFirstResult(); } return null; }
/** * Opens a selection dialog that allows to select a super class. * * @return returns the selected type or <code>null</code> if the dialog has been canceled. * The caller typically sets the result to the super class input field. * <p> * Clients can override this method if they want to offer a different dialog. * </p> * * @since 3.2 */ protected IType chooseSuperClass() { IJavaProject project= getJavaProject(); if (project == null) { return null; } IJavaElement[] elements= new IJavaElement[] { project }; IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, IJavaSearchConstants.CLASS); dialog.setTitle(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_title); dialog.setMessage(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_message); dialog.setInitialPattern(getSuperClass()); if (dialog.open() == Window.OK) { return (IType) dialog.getFirstResult(); } return null; }
/** * Opens a selection dialog that allows to select a super class. * * @return returns the selected type or <code>null</code> if the dialog has been canceled. * The caller typically sets the result to the super class input field. * <p> * Clients can override this method if they want to offer a different dialog. * </p> * * @since 3.2 */ protected IType chooseSuperClass() { IJavaProject project= getJavaProject(); if (project == null) { return null; } IJavaElement[] elements= new IJavaElement[] { project }; IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, IJavaSearchConstants.CLASS); dialog.setTitle(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_title); dialog.setMessage(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_message); dialog.setInitialPattern(getSuperClass()); if (dialog.open() == Window.OK) { return (IType) dialog.getFirstResult(); } return null; }
/** * Opens a selection dialog that allows to select an enclosing type. * * @return returns the selected type or <code>null</code> if the dialog has been canceled. * The caller typically sets the result to the enclosing type input field. * <p> * Clients can override this method if they want to offer a different dialog. * </p> * * @since 3.2 */ protected IType chooseEnclosingType() { IPackageFragmentRoot root= getPackageFragmentRoot(); if (root == null) { return null; } IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { root }); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, IJavaSearchConstants.TYPE); dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChooseEnclosingTypeDialog_title); dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChooseEnclosingTypeDialog_description); dialog.setInitialPattern(Signature.getSimpleName(getEnclosingTypeText())); if (dialog.open() == Window.OK) { return (IType) dialog.getFirstResult(); } return null; }
protected void browseForAccessorClass() { IProgressService service= PlatformUI.getWorkbench().getProgressService(); IPackageFragmentRoot root= fAccessorPackage.getSelectedFragmentRoot(); IJavaSearchScope scope= root != null ? SearchEngine.createJavaSearchScope(new IJavaElement[] { root }) : SearchEngine.createWorkspaceScope(); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog (getShell(), false, service, scope, IJavaSearchConstants.CLASS); dialog.setTitle(NLSUIMessages.NLSAccessorConfigurationDialog_Accessor_Selection); dialog.setMessage(NLSUIMessages.NLSAccessorConfigurationDialog_Choose_the_accessor_file); dialog.setInitialPattern("*Messages"); //$NON-NLS-1$ if (dialog.open() == Window.OK) { IType selectedType= (IType) dialog.getFirstResult(); if (selectedType != null) { fAccessorClassName.setText(selectedType.getElementName()); fAccessorPackage.setSelected(selectedType.getPackageFragment()); } } }
dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChooseEnclosingTypeDialog_title); dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChooseEnclosingTypeDialog_description); dialog.setInitialPattern(Signature.getSimpleName(getEnclosingTypeText()));
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('.')); }
/** * Opens a selection dialog that allows to select an enclosing type. * * @return returns the selected type or <code>null</code> if the dialog has been canceled. * The caller typically sets the result to the enclosing type input field. * <p> * Clients can override this method if they want to offer a different dialog. * </p> * * @since 3.2 */ protected IType chooseEnclosingType() { IPackageFragmentRoot root= getPackageFragmentRoot(); if (root == null) { return null; } IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { root }); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, IJavaSearchConstants.TYPE); dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChooseEnclosingTypeDialog_title); dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChooseEnclosingTypeDialog_description); dialog.setInitialPattern(Signature.getSimpleName(getEnclosingTypeText())); if (dialog.open() == Window.OK) { return (IType) dialog.getFirstResult(); } return null; }
protected void browseForAccessorClass() { IProgressService service= PlatformUI.getWorkbench().getProgressService(); IPackageFragmentRoot root= fAccessorPackage.getSelectedFragmentRoot(); IJavaSearchScope scope= root != null ? SearchEngine.createJavaSearchScope(new IJavaElement[] { root }) : SearchEngine.createWorkspaceScope(); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog (getShell(), false, service, scope, IJavaSearchConstants.CLASS); dialog.setTitle(NLSUIMessages.NLSAccessorConfigurationDialog_Accessor_Selection); dialog.setMessage(NLSUIMessages.NLSAccessorConfigurationDialog_Choose_the_accessor_file); dialog.setInitialPattern("*Messages"); //$NON-NLS-1$ if (dialog.open() == Window.OK) { IType selectedType= (IType) dialog.getFirstResult(); if (selectedType != null) { fAccessorClassName.setText(selectedType.getElementName()); fAccessorPackage.setSelected(selectedType.getPackageFragment()); } } }
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)); }
protected void browseForAccessorClass() { IProgressService service= PlatformUI.getWorkbench().getProgressService(); IPackageFragmentRoot root= fAccessorPackage.getSelectedFragmentRoot(); IJavaSearchScope scope= root != null ? SearchEngine.createJavaSearchScope(new IJavaElement[] { root }) : SearchEngine.createWorkspaceScope(); FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog (getShell(), false, service, scope, IJavaSearchConstants.CLASS); dialog.setTitle(NLSUIMessages.NLSAccessorConfigurationDialog_Accessor_Selection); dialog.setMessage(NLSUIMessages.NLSAccessorConfigurationDialog_Choose_the_accessor_file); dialog.setInitialPattern("*Messages"); //$NON-NLS-1$ if (dialog.open() == Window.OK) { IType selectedType= (IType) dialog.getFirstResult(); if (selectedType != null) { fAccessorClassName.setText(selectedType.getElementName()); fAccessorPackage.setSelected(selectedType.getPackageFragment()); } } }
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('.')); }