@Override protected void storeDialog(IDialogSettings settings) { super.storeDialog(settings); settings.put(SHOW_DERIVED, showDerivedResourcesAction.isChecked()); settings.put(FILTER_BY_LOCATION, this.groupResourcesByLocationAction.isChecked()); XMLMemento memento = XMLMemento.createWriteRoot("workingSet"); //$NON-NLS-1$ workingSetFilterActionGroup.saveState(memento); workingSetFilterActionGroup.dispose(); StringWriter writer = new StringWriter(); try { memento.save(writer); settings.put(WORKINGS_SET_SETTINGS, writer.getBuffer().toString()); } catch (IOException e) { StatusManager.getManager().handle( new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "", e)); //$NON-NLS-1$ // don't do anything. Simply don't store the settings } }
@Override protected void restoreDialog(IDialogSettings settings) { super.restoreDialog(settings); boolean showDerived = settings.getBoolean(SHOW_DERIVED); showDerivedResourcesAction.setChecked(showDerived); this.isDerived = showDerived; boolean groupByLoation = settings.getBoolean(FILTER_BY_LOCATION); this.groupResourcesByLocationAction.setChecked(groupByLoation); this.filterResourceByLocation.setEnabled(groupByLoation); addListFilter(this.filterResourceByLocation); String setting = settings.get(WORKINGS_SET_SETTINGS); if (setting != null) { try { IMemento memento = XMLMemento.createReadRoot(new StringReader( setting)); workingSetFilterActionGroup.restoreState(memento); } catch (WorkbenchException e) { StatusManager.getManager().handle( new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "", e)); //$NON-NLS-1$ // don't do anything. Simply don't restore the settings } } addListFilter(workingSetFilter); applyFilter(); }
super.fillViewMenu(menuManager); showDerivedResourcesAction = new ShowDerivedResourcesAction(); menuManager.add(showDerivedResourcesAction); this.groupResourcesByLocationAction = new GroupResourcesByLocationAction();
@Override public void run() { FilteredResourcesSelectionDialog.this.isDerived = isChecked(); applyFilter(); } }