@PreDestroy public void saveWorkingSets() { // Save working set if set if (workingSet != null) { getWindowModel().getPersistedState().put(IWorkbenchConstants.TAG_WORKING_SET, workingSet.getName()); } else { getWindowModel().getPersistedState().remove(IWorkbenchConstants.TAG_WORKING_SET); } List<String> workingSetNames = new ArrayList<>(workingSets.length); for (IWorkingSet workingSet : workingSets) { workingSetNames.add(workingSet.getName()); } saveMemento(IWorkbenchConstants.TAG_WORKING_SETS, IWorkbenchConstants.TAG_WORKING_SET, workingSetNames); getWindowModel().getPersistedState().put(ATT_AGGREGATE_WORKING_SET_ID, aggregateWorkingSetId); }
/** * @param visible * whether the perspective bar should be shown. This is only * applicable if the window configurer also wishes either the * perspective bar to be visible. * @since 3.0 */ public void setStatusLineVisible(boolean visible) { boolean oldValue = statusLineVisible; statusLineVisible = visible; if (oldValue != statusLineVisible) { getModel().getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE, Boolean.toString(visible)); updateLayoutDataForContents(); firePropertyChanged(PROP_STATUS_LINE_VISIBLE, oldValue ? Boolean.TRUE : Boolean.FALSE, statusLineVisible ? Boolean.TRUE : Boolean.FALSE); } }
/** * Cause the perspective bar to be shown or hidden; note that the * perspective bar may still be visible depending on the visibility state of * other elements. This method is a lower-level method that affects the * visibility but does not update any associated preference values. * * @param visible * whether the perspective bar should be shown. This is only * applicable if the window configurer also wishes either the * perspective bar to be visible. * @since 3.0 */ public void setPerspectiveBarVisible(boolean visible) { boolean oldValue = perspectiveBarVisible; perspectiveBarVisible = visible; if (oldValue != perspectiveBarVisible) { getModel().getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE, Boolean.toString(visible)); updateLayoutDataForContents(); firePropertyChanged(PROP_PERSPECTIVEBAR_VISIBLE, oldValue ? Boolean.TRUE : Boolean.FALSE, perspectiveBarVisible ? Boolean.TRUE : Boolean.FALSE); } }
/** * Cause the coolbar to be shown or hidden; note that the coolbar may still * be visible depending on the visibility state of other elements. This * method is a lower-level method that affects the visibility but does not * update any associated preference values. * * @param visible * whether the cool bar should be shown. This is only applicable * if the window configurer also wishes either the cool bar to be * visible. * @since 3.0 */ public void setCoolBarVisible(boolean visible) { boolean oldValue = coolBarVisible; coolBarVisible = visible; if (oldValue != coolBarVisible) { getModel().getPersistedState().put(IPreferenceConstants.COOLBAR_VISIBLE, Boolean.toString(visible)); updateLayoutDataForContents(); firePropertyChanged(PROP_COOLBAR_VISIBLE, oldValue ? Boolean.TRUE : Boolean.FALSE, coolBarVisible ? Boolean.TRUE : Boolean.FALSE); } }
private void saveMemento(String rootType, String childType, Collection<String> ids) { XMLMemento memento = XMLMemento.createWriteRoot(rootType); for (String id : ids) { memento.createChild(childType, id); } StringWriter writer = new StringWriter(); try { memento.save(writer); getWindowModel().getPersistedState().put(rootType, writer.getBuffer().toString()); } catch (IOException e) { // Simply don't store the settings StatusManager.getManager().handle( new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, WorkbenchMessages.SavingProblem, e)); } }
private void restoreShowInMruPartIdsList() { String mruList = getWindowModel().getPersistedState().get(IWorkbenchConstants.TAG_SHOW_IN_TIME); if (mruList != null) { try { IMemento memento = XMLMemento.createReadRoot(new StringReader(mruList)); IMemento[] mementoChildren = memento.getChildren(); for (IMemento child : mementoChildren) { mruShowInPartIds.add(child.getID()); } } catch (WorkbenchException e) { StatusManager.getManager().handle( new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, WorkbenchMessages.WorkbenchPage_problemRestoringTitle, e)); } } }
@Override public void restore() { WMaximizationHost widget = (WMaximizationHost) this.window.getWidget(); WLayoutedWidget<? extends MUIElement> childWidget = null; if (this.maximizedElement instanceof MPlaceholder) { childWidget = (WLayoutedWidget<MUIElement>) ((MPlaceholder) this.maximizedElement).getRef().getWidget(); } else { childWidget = (WLayoutedWidget<MUIElement>) this.maximizedElement.getWidget(); } if (widget != null && childWidget != null) { widget.removeMaximizedContent(); this.window.getPersistedState().remove("MAXIMIZED"); //$NON-NLS-1$ this.maximizedElement = null; } }
public void restoreWorkingSets() { String workingSetName = getWindowModel().getPersistedState().get( IWorkbenchConstants.TAG_WORKING_SET); if (workingSetName != null) { String workingSetMemString = getWindowModel().getPersistedState().get( IWorkbenchConstants.TAG_WORKING_SETS); if (workingSetMemString != null) { aggregateWorkingSetId = getWindowModel().getPersistedState().get( ATT_AGGREGATE_WORKING_SET_ID);
coolbarVisible = Boolean.FALSE.toString(); window.getPersistedState().put(IPreferenceConstants.COOLBAR_VISIBLE, coolbarVisible); window.getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE, coolbarVisible);
@Override public void maximize(@NonNull MUIElement element) { MUIElement maxElement = element; MPlaceholder placeHolder = maxElement.getCurSharedRef(); if (placeHolder != null) { maxElement = placeHolder; } if (this.maximizedElement != null) { if (this.maximizedElement == maxElement) { return; } restore(); } WMaximizationHost widget = (WMaximizationHost) this.window.getWidget(); WLayoutedWidget<MUIElement> childWidget = (WLayoutedWidget<MUIElement>) maxElement.getWidget(); if (widget != null && childWidget != null) { widget.setMaximizedContent(childWidget); this.window.getPersistedState().put("MAXIMIZED", maxElement.getElementId()); //$NON-NLS-1$ this.maximizedElement = maxElement; } }
if (getModel().getPersistedState().containsKey(IPreferenceConstants.COOLBAR_VISIBLE)) { this.coolBarVisible = Boolean.parseBoolean(getModel().getPersistedState().get( IPreferenceConstants.COOLBAR_VISIBLE)); } else { this.coolBarVisible = PrefUtil.getInternalPreferenceStore().getBoolean( IPreferenceConstants.COOLBAR_VISIBLE); getModel().getPersistedState().put(IPreferenceConstants.COOLBAR_VISIBLE, Boolean.toString(this.coolBarVisible)); if (getModel().getPersistedState().containsKey( IPreferenceConstants.PERSPECTIVEBAR_VISIBLE)) { this.perspectiveBarVisible = Boolean.parseBoolean(getModel().getPersistedState() .get(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE)); } else { this.perspectiveBarVisible = PrefUtil.getInternalPreferenceStore().getBoolean( IPreferenceConstants.PERSPECTIVEBAR_VISIBLE); getModel().getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE, Boolean.toString(this.perspectiveBarVisible)); if (Boolean.valueOf(getModel().getPersistedState().get(PERSISTED_STATE_RESTORED))) { SafeRunnable.run(new SafeRunnable() { getModel().getPersistedState().put(PERSISTED_STATE_RESTORED, Boolean.TRUE.toString());
String maxElementId = element.getPersistedState().get("MAXIMIZED"); //$NON-NLS-1$ if(maxElementId != null) { MUIElement maxElement = this.modelService.find(maxElementId, element);