final void doBrowsePackages() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= PackageSelectionDialog.F_REMOVE_DUPLICATES | PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE; PackageSelectionDialog dialog= new PackageSelectionDialog(getShell(), context, style, scope); dialog.setFilter(fNameDialogField.getText()); dialog.setIgnoreCase(false); dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_title); dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_description); dialog.setEmptyListMessage(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_empty); if (dialog.open() == Window.OK) { IPackageFragment res= (IPackageFragment) dialog.getFirstResult(); fNameDialogField.setText(res.getElementName()); } }
/** * Creates a selection dialog that lists all packages of the given Java search scope. * The caller is responsible for opening the dialog with <code>Window.open</code>, * and subsequently extracting the selected package (of type * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>. * * @param parent the parent shell of the dialog to be created * @param context the runnable context to run the search in * @param scope the scope defining the available packages. * @param multipleSelection true if multiple selection is allowed * @param removeDuplicates true if only one package is shown per package name * @param filter the initial pattern to filter the set of packages. For example "com" shows * all packages starting with "com". The meta character '?' representing any character and * '*' representing any string are supported. Clients can pass an empty string if no filtering * is required. * @return a new selection dialog * * @since 3.2 */ public static SelectionDialog createPackageDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, boolean multipleSelection, boolean removeDuplicates, String filter) { int flag= removeDuplicates ? PackageSelectionDialog.F_REMOVE_DUPLICATES : 0; PackageSelectionDialog dialog= new PackageSelectionDialog(parent, context, flag, scope); dialog.setFilter(filter); dialog.setIgnoreCase(false); dialog.setMultipleSelection(multipleSelection); return dialog; }
/** * Creates a package selection dialog. * @param parent the parent shell * @param context the runnable context to run the search in * @param flags a combination of <code>F_REMOVE_DUPLICATES</code>, <code>F_SHOW_PARENTS</code>, * <code>F_HIDE_DEFAULT_PACKAGE</code> and <code>F_HIDE_EMPTY_INNER</code> * @param scope the scope defining the available packages. */ public PackageSelectionDialog(Shell parent, IRunnableContext context, int flags, IJavaSearchScope scope) { super(parent, createLabelProvider(flags)); fFlags= flags; fScope= scope; fContext= context; }
private void doButtonPressed() { IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext(); int flags= PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE | PackageSelectionDialog.F_REMOVE_DUPLICATES; PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, flags , scope); dialog.setTitle(PreferencesMessages.TypeFilterInputDialog_choosepackage_label); dialog.setMessage(PreferencesMessages.TypeFilterInputDialog_choosepackage_description); dialog.setMultipleSelection(false); dialog.setFilter(fNameDialogField.getText()); if (dialog.open() == IDialogConstants.OK_ID) { IPackageFragment res= (IPackageFragment) dialog.getFirstResult(); fNameDialogField.setText(res.getElementName() + "*"); //$NON-NLS-1$ } }
private String[] choosePackage() { IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext(); int flags= PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE | PackageSelectionDialog.F_REMOVE_DUPLICATES; PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, flags , scope); dialog.setTitle(PreferencesMessages.TypeFilterPreferencePage_choosepackage_label); dialog.setMessage(PreferencesMessages.TypeFilterPreferencePage_choosepackage_description); dialog.setMultipleSelection(true); if (dialog.open() == IDialogConstants.OK_ID) { Object[] fragments= dialog.getResult(); String[] res= new String[fragments.length]; for (int i= 0; i < res.length; i++) { res[i]= ((IPackageFragment) fragments[i]).getElementName() + ".*"; //$NON-NLS-1$ } return res; } return null; }
/** * Stores it current configuration in the dialog store. */ private void writeSettings() { IDialogSettings s= getDialogSettings(); Point location= getShell().getLocation(); s.put("x", location.x); //$NON-NLS-1$ s.put("y", location.y); //$NON-NLS-1$ Point size= getShell().getSize(); s.put("width", size.x); //$NON-NLS-1$ s.put("height", size.y); //$NON-NLS-1$ }
/** * Initializes itself from the dialog settings with the same state * as at the previous invocation. */ private void readSettings() { IDialogSettings s= getDialogSettings(); try { int x= s.getInt("x"); //$NON-NLS-1$ int y= s.getInt("y"); //$NON-NLS-1$ fLocation= new Point(x, y); int width= s.getInt("width"); //$NON-NLS-1$ int height= s.getInt("height"); //$NON-NLS-1$ fSize= new Point(width, height); } catch (NumberFormatException e) { fLocation= null; fSize= null; } }
private void doButtonPressed() { IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext(); int flags= PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE | PackageSelectionDialog.F_REMOVE_DUPLICATES; PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, flags , scope); dialog.setTitle(PreferencesMessages.TypeFilterInputDialog_choosepackage_label); dialog.setMessage(PreferencesMessages.TypeFilterInputDialog_choosepackage_description); dialog.setMultipleSelection(false); dialog.setFilter(fNameDialogField.getText()); if (dialog.open() == IDialogConstants.OK_ID) { IPackageFragment res= (IPackageFragment) dialog.getFirstResult(); fNameDialogField.setText(res.getElementName() + "*"); //$NON-NLS-1$ } }
private String[] choosePackage() { IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext(); int flags= PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE | PackageSelectionDialog.F_REMOVE_DUPLICATES; PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, flags , scope); dialog.setTitle(PreferencesMessages.TypeFilterPreferencePage_choosepackage_label); dialog.setMessage(PreferencesMessages.TypeFilterPreferencePage_choosepackage_description); dialog.setMultipleSelection(true); if (dialog.open() == IDialogConstants.OK_ID) { Object[] fragments= dialog.getResult(); String[] res= new String[fragments.length]; for (int i= 0; i < res.length; i++) { res[i]= ((IPackageFragment) fragments[i]).getElementName() + ".*"; //$NON-NLS-1$ } return res; } return null; }
/** * Stores it current configuration in the dialog store. */ private void writeSettings() { IDialogSettings s= getDialogSettings(); Point location= getShell().getLocation(); s.put("x", location.x); //$NON-NLS-1$ s.put("y", location.y); //$NON-NLS-1$ Point size= getShell().getSize(); s.put("width", size.x); //$NON-NLS-1$ s.put("height", size.y); //$NON-NLS-1$ }
/** * Initializes itself from the dialog settings with the same state * as at the previous invocation. */ private void readSettings() { IDialogSettings s= getDialogSettings(); try { int x= s.getInt("x"); //$NON-NLS-1$ int y= s.getInt("y"); //$NON-NLS-1$ fLocation= new Point(x, y); int width= s.getInt("width"); //$NON-NLS-1$ int height= s.getInt("height"); //$NON-NLS-1$ fSize= new Point(width, height); } catch (NumberFormatException e) { fLocation= null; fSize= null; } }
private void doButtonPressed() { IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext(); int flags= PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE | PackageSelectionDialog.F_REMOVE_DUPLICATES; PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, flags , scope); dialog.setTitle(PreferencesMessages.TypeFilterInputDialog_choosepackage_label); dialog.setMessage(PreferencesMessages.TypeFilterInputDialog_choosepackage_description); dialog.setMultipleSelection(false); dialog.setFilter(fNameDialogField.getText()); if (dialog.open() == IDialogConstants.OK_ID) { IPackageFragment res= (IPackageFragment) dialog.getFirstResult(); fNameDialogField.setText(res.getElementName() + "*"); //$NON-NLS-1$ } }
final void doBrowsePackages() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= PackageSelectionDialog.F_REMOVE_DUPLICATES | PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE; PackageSelectionDialog dialog= new PackageSelectionDialog(getShell(), context, style, scope); dialog.setFilter(fNameDialogField.getText()); dialog.setIgnoreCase(false); dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_title); dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_description); dialog.setEmptyListMessage(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_empty); if (dialog.open() == Window.OK) { IPackageFragment res= (IPackageFragment) dialog.getFirstResult(); fNameDialogField.setText(res.getElementName()); } }
private String[] choosePackage() { IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext(); int flags= PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE | PackageSelectionDialog.F_REMOVE_DUPLICATES; PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, flags , scope); dialog.setTitle(PreferencesMessages.TypeFilterPreferencePage_choosepackage_label); dialog.setMessage(PreferencesMessages.TypeFilterPreferencePage_choosepackage_description); dialog.setMultipleSelection(true); if (dialog.open() == IDialogConstants.OK_ID) { Object[] fragments= dialog.getResult(); String[] res= new String[fragments.length]; for (int i= 0; i < res.length; i++) { res[i]= ((IPackageFragment) fragments[i]).getElementName() + ".*"; //$NON-NLS-1$ } return res; } return null; }
/** * Creates a selection dialog that lists all packages of the given Java search scope. * The caller is responsible for opening the dialog with <code>Window.open</code>, * and subsequently extracting the selected package (of type * <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>. * * @param parent the parent shell of the dialog to be created * @param context the runnable context to run the search in * @param scope the scope defining the available packages. * @param multipleSelection true if multiple selection is allowed * @param removeDuplicates true if only one package is shown per package name * @param filter the initial pattern to filter the set of packages. For example "com" shows * all packages starting with "com". The meta character '?' representing any character and * '*' representing any string are supported. Clients can pass an empty string if no filtering * is required. * @return a new selection dialog * * @since 3.2 */ public static SelectionDialog createPackageDialog(Shell parent, IRunnableContext context, IJavaSearchScope scope, boolean multipleSelection, boolean removeDuplicates, String filter) { int flag= removeDuplicates ? PackageSelectionDialog.F_REMOVE_DUPLICATES : 0; PackageSelectionDialog dialog= new PackageSelectionDialog(parent, context, flag, scope); dialog.setFilter(filter); dialog.setIgnoreCase(false); dialog.setMultipleSelection(multipleSelection); return dialog; }
/** * Stores it current configuration in the dialog store. */ private void writeSettings() { IDialogSettings s= getDialogSettings(); Point location= getShell().getLocation(); s.put("x", location.x); //$NON-NLS-1$ s.put("y", location.y); //$NON-NLS-1$ Point size= getShell().getSize(); s.put("width", size.x); //$NON-NLS-1$ s.put("height", size.y); //$NON-NLS-1$ }
/** * Creates a package selection dialog. * @param parent the parent shell * @param context the runnable context to run the search in * @param flags a combination of <code>F_REMOVE_DUPLICATES</code>, <code>F_SHOW_PARENTS</code>, * <code>F_HIDE_DEFAULT_PACKAGE</code> and <code>F_HIDE_EMPTY_INNER</code> * @param scope the scope defining the available packages. */ public PackageSelectionDialog(Shell parent, IRunnableContext context, int flags, IJavaSearchScope scope) { super(parent, createLabelProvider(flags)); fFlags= flags; fScope= scope; fContext= context; }
/** * Initializes itself from the dialog settings with the same state * as at the previous invocation. */ private void readSettings() { IDialogSettings s= getDialogSettings(); try { int x= s.getInt("x"); //$NON-NLS-1$ int y= s.getInt("y"); //$NON-NLS-1$ fLocation= new Point(x, y); int width= s.getInt("width"); //$NON-NLS-1$ int height= s.getInt("height"); //$NON-NLS-1$ fSize= new Point(width, height); } catch (NumberFormatException e) { fLocation= null; fSize= null; } }
private void doButtonPressed() { IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext(); int flags= PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE | PackageSelectionDialog.F_REMOVE_DUPLICATES; PackageSelectionDialog dialog = new PackageSelectionDialog(getShell(), context, flags , scope); dialog.setTitle(PreferencesMessages.TypeFilterInputDialog_choosepackage_label); dialog.setMessage(PreferencesMessages.TypeFilterInputDialog_choosepackage_description); dialog.setMultipleSelection(false); dialog.setFilter(fNameDialogField.getText()); if (dialog.open() == IDialogConstants.OK_ID) { IPackageFragment res= (IPackageFragment) dialog.getFirstResult(); fNameDialogField.setText(res.getElementName() + "*"); //$NON-NLS-1$ } }
final void doBrowsePackages() { IRunnableContext context= new BusyIndicatorRunnableContext(); IJavaSearchScope scope= SearchEngine.createWorkspaceScope(); int style= PackageSelectionDialog.F_REMOVE_DUPLICATES | PackageSelectionDialog.F_SHOW_PARENTS | PackageSelectionDialog.F_HIDE_DEFAULT_PACKAGE; PackageSelectionDialog dialog= new PackageSelectionDialog(getShell(), context, style, scope); dialog.setFilter(fNameDialogField.getText()); dialog.setIgnoreCase(false); dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_title); dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_description); dialog.setEmptyListMessage(PreferencesMessages.ImportOrganizeInputDialog_ChoosePackageDialog_empty); if (dialog.open() == Window.OK) { IPackageFragment res= (IPackageFragment) dialog.getFirstResult(); fNameDialogField.setText(res.getElementName()); } }