@Override public void tabDeselected( TabItem item ) { if ( !ExpandedContentManager.isVisible() ) { item.setSashWeights( sashform.getWeights() ); } }
if ( sashform.getWeights()[0] != 0 ) { props.setSashWeights( sashform.getWeights() );
/** * maximizeBrowser * * @param browser * the browser object to maximize. We try to take up as much of the Spoon window as possible. */ private static void maximizeExpandedContent( Browser browser ) { SashForm sash = (SashForm) spoonInstance().getDesignParent(); int[] weights = sash.getWeights(); int[] savedSashWeights = new int[weights.length]; System.arraycopy( weights, 0, savedSashWeights, 0, weights.length ); spoonInstance().getTabSet().getSelected().setSashWeights( savedSashWeights ); weights[0] = 0; weights[1] = 1000; sash.setWeights( weights ); FormData formData = new FormData(); formData.top = new FormAttachment( 0, 0 ); formData.left = new FormAttachment( 0, 0 ); formData.bottom = new FormAttachment( 100, 0 ); formData.right = new FormAttachment( 100, 0 ); browser.setLayoutData( formData ); browser.getParent().layout( true ); browser.getParent().redraw(); } }
@Override public void controlResized(ControlEvent e) { int[] weights= fControl.getWeights(); int sashSize= (int) (weights[0] * 100.0 / (weights[0] + weights[1])); fPreferenceStore.setValue(SASH_SIZE_PREF_ID, sashSize); } });
@Override public void controlResized(ControlEvent e) { int[] weights= fControl.getWeights(); int sashSize= (int) (weights[0] * 100.0 / (weights[0] + weights[1])); fPreferenceStore.setValue(SASH_SIZE_PREF_ID, sashSize); } });
/** * Sets the sash form widths. */ void setSashFormWidths() { sashFormWidth = sashForm.getSize().x; int[] ws = sashForm.getWeights(); leftPanelWidth = (int) (((float) ws[0] / (float) (ws[0] + ws[1])) * sashFormWidth); rightPanelWidth = (int) (((float) ws[1] / (float) (ws[0] + ws[1])) * sashFormWidth); }
@Override public void widgetDisposed(final DisposeEvent e) { preferences.storeSashWeights(sash.getWeights()); } });
private void saveSplitterRatio() { if (fHierarchyLocationSplitter != null && ! fHierarchyLocationSplitter.isDisposed()) { int[] weigths = fHierarchyLocationSplitter.getWeights(); int ratio = (weigths[0] * 1000) / (weigths[0] + weigths[1]); String key= DIALOGSTORE_RATIO + fCurrentOrientation; fDialogSettings.put(key, ratio); } }
private void saveSplitterRatio() { if (fHierarchyLocationSplitter != null && ! fHierarchyLocationSplitter.isDisposed()) { int[] weigths = fHierarchyLocationSplitter.getWeights(); int ratio = (weigths[0] * 1000) / (weigths[0] + weigths[1]); String key= DIALOGSTORE_RATIO + fCurrentOrientation; fDialogSettings.put(key, ratio); } }
private void saveSplitterRatio() { if (fHierarchyLocationSplitter != null && ! fHierarchyLocationSplitter.isDisposed()) { int[] weigths = fHierarchyLocationSplitter.getWeights(); int ratio = (weigths[0] * 1000) / (weigths[0] + weigths[1]); String key= DIALOGSTORE_RATIO + fCurrentOrientation; fDialogSettings.put(key, ratio); } }
public static void setSashFormWeights(int[] mainSashWeights, int[] topSashWeights, ActionContext actionContext){ SashForm mainSashForm = (SashForm) actionContext.get("mainSashForm"); if(mainSashForm != null){ mainSashForm.setData("oldWeights", mainSashForm.getWeights()); mainSashForm.setWeights(mainSashWeights); } SashForm topSashForm = (SashForm) actionContext.get("topSashForm"); if(topSashForm != null){ topSashForm.setData("oldWeights", topSashForm.getWeights()); topSashForm.setWeights(topSashWeights); } }
/** * Save the current sash weights */ protected void persistSashWeights() { IDialogSettings settings = getDialogSettings(); if (fSashForm != null) { int[] sashWeights = fSashForm.getWeights(); settings.put(DIALOG_SASH_WEIGHTS_1, (sashWeights[0] < 10 ? DEFAULT_SASH_WEIGHTS[0] : sashWeights[0])); settings.put(DIALOG_SASH_WEIGHTS_2, (sashWeights[1] < 10 ? DEFAULT_SASH_WEIGHTS[1] : sashWeights[1])); } }
public static void setSashFormWeights(int[] mainSashWeights, int[] topSashWeights, ActionContext actionContext){ SashForm mainSashForm = (SashForm) actionContext.get("mainSashForm"); if(mainSashForm != null){ mainSashForm.setData("oldWeights", mainSashForm.getWeights()); mainSashForm.setWeights(mainSashWeights); } SashForm topSashForm = (SashForm) actionContext.get("topSashForm"); if(topSashForm != null){ topSashForm.setData("oldWeights", topSashForm.getWeights()); topSashForm.setWeights(topSashWeights); } }
public void widgetDisposed(DisposeEvent e) { final int[] w = sf.getWeights(); store.putValue(key, UIPreferences.intArrayToString(w)); if (store.needsSaving()) try { store.save(); } catch (IOException e1) { Activator.handleError(e1.getMessage(), e1, false); } } });
/** * Hides the details pane */ private void hideDetailPane() { if (fToggledDetailOnce) { setLastSashWeights(fSashForm.getWeights()); } fSashForm.setMaximizedControl(getViewer().getControl()); }
/** * Saves the current state of the viewer * @param memento the memento to write the viewer state into */ public void saveViewerState(IMemento memento) { if (fSashForm != null && !fSashForm.isDisposed()) { int[] weights = fSashForm.getWeights(); memento.putInteger(SASH_VIEW_PART, weights[0]); memento.putInteger(SASH_DETAILS_PART, weights[1]); } getVariablesViewer().saveState(memento); }
@Override public Control update(SashForm parent, Control control) { int weights[] = parent.getWeights(); ActionContext actionContext = Designer.getActionContext(control); Thing thing = Designer.getThing(control); actionContext.peek().put("parent", parent); Control newControl = thing.doAction("create", actionContext); newControl.moveAbove(control); control.dispose(); parent.setWeights(weights); SwtUtils.layout(parent); return newControl; }
private void writeConfiguration(){ 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$ sashWeights = getSashForm().getWeights(); s.put("sashWidth1", sashWeights[0]); //$NON-NLS-1$ s.put("sashWidth2", sashWeights[1]); //$NON-NLS-1$ } }
private void writeConfiguration() { 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$ sashWeights = getSashForm().getWeights(); s.put("sashWidth1", sashWeights[0]); //$NON-NLS-1$ s.put("sashWidth2", sashWeights[1]); //$NON-NLS-1$ s.put("sashWidth3", sashWeights[2]); //$NON-NLS-1$ }
public void saveBoundsRelatedSettings() { if (!isCreated()) return; IDialogSettings settings = ProvUIActivator.getDefault().getDialogSettings(); IDialogSettings section = settings.getSection(getDialogSettingsName()); if (section == null) { section = settings.addNewSection(getDialogSettingsName()); } section.put(NAME_COLUMN_WIDTH, getNameColumnWidth()); section.put(VERSION_COLUMN_WIDTH, getVersionColumnWidth()); section.put(ID_COLUMN_WIDTH, getIdColumnWidth()); int[] weights = getSashForm().getWeights(); section.put(LIST_WEIGHT, weights[0]); section.put(DETAILS_WEIGHT, weights[1]); }