/** * Save new bounds for the corresponding dialog. * * @param bounds The bounds to save */ public void saveBounds(Rectangle bounds) { if (settings != null) { IDialogSettings dialogBounds = settings.getSection(dialogIdentifier + "." + DIALOG_BOUNDS_KEY); // $NON-NLS-1$ if (dialogBounds == null) { dialogBounds = new DialogSettings(dialogIdentifier + "." + DIALOG_BOUNDS_KEY); // $NON-NLS-1$ settings.addSection(dialogBounds); } dialogBounds.put(X, bounds.x); dialogBounds.put(Y, bounds.y); dialogBounds.put(WIDTH, bounds.width); dialogBounds.put(HEIGHT, bounds.height); } }
private void initSize(IDialogSettings settings) { fSettings = settings.getSection(DIALOG_SETTINGS); if (fSettings == null) { fSettings = new DialogSettings(DIALOG_SETTINGS); settings.addSection(fSettings); fSettings.put(WIDTH, 600); fSettings.put(HEIGHT, 400); } fPreviewWidth = 600; fPreviewHeight = 400; try { fPreviewWidth = fSettings.getInt(WIDTH); fPreviewHeight = fSettings.getInt(HEIGHT); } catch (NumberFormatException e) { } }
/** Loads the dialog settings using the page name as a section name. */ private void initDialogSettings() { IDialogSettings pluginSettings; // This is strictly to get SWT Designer working locally without blowing up. if (MavenDependencyConversionActivator.getDefault() == null) { pluginSettings = new DialogSettings("Workbench"); } else { pluginSettings = MavenDependencyConversionActivator.getDefault().getDialogSettings(); } dialogSettings = pluginSettings.getSection(getName()); if (dialogSettings == null) { dialogSettings = pluginSettings.addNewSection(getName()); pluginSettings.addSection(dialogSettings); } }