/** * Restores control settings that were saved in the previous instance of this page. */ private void restoreWidgetValues() { IDialogSettings settings = getDialogSettings(); if (settings != null) { String[] directoryNames = settings.getArray(getStoreDestinationNamesID()); if (directoryNames == null) { return; // ie.- no settings stored } // destination setDestinationValue(directoryNames[0]); for (int i = 0; i < directoryNames.length; i++) { addDestinationItem(directoryNames[i]); } // options overwriteExistingFilesCheckbox.setSelection(settings.getBoolean(getStoreOverwriteExistingFilesID())); } }
/** * Hook method for saving widget values for restoration by the next instance of this class. */ private void saveWidgetValues() { // update directory names history IDialogSettings settings = getDialogSettings(); if (settings != null) { String[] directoryNames = settings.getArray(getStoreDestinationNamesID()); if (directoryNames == null) { directoryNames = new String[0]; } directoryNames = addToHistory(directoryNames, getTargetDirectory()); settings.put(getStoreDestinationNamesID(), directoryNames); // options settings.put(getStoreOverwriteExistingFilesID(), overwriteExistingFilesCheckbox.getSelection()); } }
@Override protected void internalSaveWidgetValues() { IDialogSettings settings = getDialogSettings(); if (settings != null) { // update directory names history String[] directoryNames = settings .getArray(STORE_EXPORT_DESTINATION_FOLDERS_ID); if (directoryNames == null) { directoryNames = new String[0]; } directoryNames = addToHistory(directoryNames, getDestinationValue()); settings.put(STORE_EXPORT_DESTINATION_FOLDERS_ID, directoryNames); // store checkbox - compress settings.put(STORE_EXPORT_COMPRESS_CONTENTS_ID, compressContentsCheckbox.getSelection()); } }
@Override protected void restoreWidgetValues() { IDialogSettings settings = getDialogSettings(); if (settings != null) { String[] directoryNames = settings .getArray(STORE_EXPORT_DESTINATION_FOLDERS_ID); if (directoryNames == null || directoryNames.length == 0) { // ie.- no settings stored } else { // destination setDestinationValue(directoryNames[0]); for (int i = 0; i < directoryNames.length; i++) { addDestinationItem(directoryNames[i]); } } compressContentsCheckbox.setSelection(settings.getBoolean(STORE_EXPORT_COMPRESS_CONTENTS_ID)); } }
/** save for next usage */ protected void internalSaveWidgetValues() { IDialogSettings settings = getDialogSettings(); if (settings != null) { // update goals history String[] npmGoalLines = settings .getArray(STORE_NPM_GOAL); if (npmGoalLines == null) { npmGoalLines = new String[0]; } npmGoalLines = addToHistory(npmGoalLines, getGoalValue()); settings.put(STORE_NPM_GOAL, npmGoalLines); // store checkbox - compress settings.put(STORE_RUN_NPM_TOOL, runNpmCheckbox.getSelection()); } }
@Override protected void restoreWidgetValues() { IDialogSettings settings = getDialogSettings(); if (settings != null) { String[] npmGoalLines = settings .getArray(STORE_NPM_GOAL); if (npmGoalLines == null || npmGoalLines.length == 0) { // ie.- no settings stored } else { // destination setGoalValue(npmGoalLines[0]); for (int i = 0; i < npmGoalLines.length; i++) { addGoalItem(npmGoalLines[i]); } } runNpmCheckbox.setSelection(settings.getBoolean(STORE_RUN_NPM_TOOL)); } }
/** * Creates a new wizard container for creating and initializing a new N4JS project into the workspace. * * @param projectCreator * the project creation logic to be triggered when finishing this wizard. */ @Inject public SimpleN4MFNewProjectWizard(final IProjectCreator projectCreator) { super(projectCreator); setWindowTitle("New N4JS Project"); setNeedsProgressMonitor(true); setDefaultPageImageDescriptor(NEW_PROJECT_WIZBAN_DESC); projectInfo = new N4MFProjectInfo(); // Setup the dialog settings IDialogSettings workbenchDialogSettings = N4MFActivator.getInstance().getDialogSettings(); IDialogSettings projectWizardSettings = workbenchDialogSettings.getSection(DIALOG_SETTINGS_SECTION_KEY); if (null == projectWizardSettings) { projectWizardSettings = workbenchDialogSettings.addNewSection(DIALOG_SETTINGS_SECTION_KEY); } setDialogSettings(projectWizardSettings); }
@Override protected Point getInitialSize() { IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings == null) { /* no dialog settings available, so fall back to min settings */ return new Point(minWidth, minHeight); } Point point = super.getInitialSize(); if (point.x < minWidth) { point.x = minWidth; } if (point.y < minHeight) { point.y = minHeight; } return point; }
/** * Initialize any state related to the widgetry that should be set up each * time widgets are created. */ private void initializeWidgetState() { menuManager = null; dialogArea = null; titleLabel = null; titleSeparator = null; infoSeparator = null; infoLabel = null; toolBar = null; // If the menu item for persisting bounds is displayed, use the stored // value to determine whether any persisted bounds should be honored at // all. if (showDialogMenu && showPersistActions) { IDialogSettings settings = getDialogSettings(); if (settings != null) { String key = getClass().getName() + DIALOG_USE_PERSISTED_SIZE; if (settings.get(key) != null || !isUsing34API) persistSize = settings.getBoolean(key); key = getClass().getName() + DIALOG_USE_PERSISTED_LOCATION; if (settings.get(key) != null || !isUsing34API) persistLocation = settings.getBoolean(key); } } }
private void migrateBoundsSetting() { IDialogSettings settings = getDialogSettings(); if (settings == null) return; final String className = getClass().getName(); String key = className + DIALOG_USE_PERSISTED_BOUNDS; String value = settings.get(key); if (value == null || DIALOG_VALUE_MIGRATED_TO_34.equals(value)) return; boolean storeBounds = settings.getBoolean(key); settings.put(className + DIALOG_USE_PERSISTED_LOCATION, storeBounds); settings.put(className + DIALOG_USE_PERSISTED_SIZE, storeBounds); settings.put(key, DIALOG_VALUE_MIGRATED_TO_34); }
private void persistLocation() { if (shell==null || shell.isDisposed()){ return; } IDialogSettings settings = getDialogSettings(); if (settings != null) { Point shellLocation = shell.getLocation(); Shell parent = getParent(); if (parent != null) { Point parentLocation = parent.getLocation(); shellLocation.x -= parentLocation.x; shellLocation.y -= parentLocation.y; } String prefix = getClass().getName(); settings.put(prefix + DIALOG_ORIGIN_X, shellLocation.x); settings.put(prefix + DIALOG_ORIGIN_Y, shellLocation.y); } }
private Point getPersistedLocation() { if (shell==null || shell.isDisposed()){ return null; } Point result = null; IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings == null) { return null; } try { int x = dialogSettings.getInt(getClass().getName() + DIALOG_ORIGIN_X); int y = dialogSettings.getInt(getClass().getName() + DIALOG_ORIGIN_Y); result = new Point(x, y); // The coordinates were stored relative to the parent shell. // Convert to display coordinates. Shell parentShell = getParent(); if (parentShell != null) { Point parentLocation = parentShell.getLocation(); result.x += parentLocation.x; result.y += parentLocation.y; } } catch (NumberFormatException e) { } return result; }
public LinkDialog( final Shell parentShell, final WorkItem workItem, final LinkUIRegistry linkUiRegistry, final WIFormLinksControlOptions linksControlOptions) { super(parentShell); this.workItem = workItem; this.linkCollection = workItem.getLinks(); this.linkUiRegistry = linkUiRegistry; this.linksControlOptions = linksControlOptions; final IDialogSettings uiSettings = TFSCommonUIClientPlugin.getDefault().getDialogSettings(); final IDialogSettings dialogSettings = uiSettings.getSection(DIALOG_SETTINGS_SECTION_KEY); if (dialogSettings != null) { initialLinkTypeName = dialogSettings.get(DIALOG_SETTINGS_LINK_TYPE_KEY); } }
public NewLinkedWorkItemDialog( final Shell shell, final WorkItem hostWorkItem, final WIFormLinksControlOptions linksControlOptions) { super(shell); this.hostWorkItem = hostWorkItem; client = hostWorkItem.getClient(); this.linksControlOptions = linksControlOptions; witVersionSupportsWILinks = client.supportsWorkItemLinkTypes(); final IDialogSettings uiSettings = TFSCommonUIClientPlugin.getDefault().getDialogSettings(); final IDialogSettings dialogSettings = uiSettings.getSection(DIALOG_SETTINGS_SECTION_KEY); if (dialogSettings != null) { initialLinkTypeName = dialogSettings.get(DIALOG_SETTINGS_LINK_TYPE_KEY); initialWorkItemTypeName = dialogSettings.get(DIALOG_SETTINGS_WORKITEM_TYPE_KEY); } }
@Override protected void okPressed() { selectedTitle = textWorkItemTitle.getText(); selectedComment = textWorkItemComment.getText(); // Save the selected link-type in user setting so the next launch of the // dialog will // initially select the last used link-type. final IDialogSettings uiSettings = TFSCommonUIClientPlugin.getDefault().getDialogSettings(); IDialogSettings dialogSettings = uiSettings.getSection(DIALOG_SETTINGS_SECTION_KEY); if (dialogSettings == null) { dialogSettings = uiSettings.addNewSection(DIALOG_SETTINGS_SECTION_KEY); } dialogSettings.put(DIALOG_SETTINGS_LINK_TYPE_KEY, linkTypeDisplayNames[selectedLinkTypeIndex]); dialogSettings.put(DIALOG_SETTINGS_WORKITEM_TYPE_KEY, workItemTypeDisplayNames[selectedWorkItemTypeIndex]); super.okPressed(); }
@Override protected void doCreateControl(final Composite parent, final IDialogSettings dialogSettings) { wizard = (ImportWizard) getExtendedWizard(); options = (ImportOptions) wizard.getPageData(ImportOptions.class); workspace = options.getEclipseWorkspace(); final Composite container = new Composite(parent, SWT.NONE); setControl(container); final GridLayout layout = new GridLayout(1, false); layout.marginWidth = getHorizontalMargin(); layout.marginHeight = getVerticalMargin(); layout.horizontalSpacing = getHorizontalSpacing(); layout.verticalSpacing = getVerticalSpacing(); container.setLayout(layout); createWizardSelctionOptions(container); createRepositoriesTreeControl(container); refresh(); }
@Override protected void doCreateControl(final Composite parent, final IDialogSettings dialogSettings) { wizard = (ImportWizard) getExtendedWizard(); options = (ImportOptions) wizard.getPageData(ImportOptions.class); workspace = options.getEclipseWorkspace(); final Composite container = new Composite(parent, SWT.NONE); setControl(container); final GridLayout layout = new GridLayout(1, false); layout.marginWidth = getHorizontalMargin(); layout.marginHeight = getVerticalMargin(); layout.horizontalSpacing = getHorizontalSpacing(); layout.verticalSpacing = getVerticalSpacing(); container.setLayout(layout); createProjectsTreeControl(container); createWorkingSetOption(container); refresh(); }
@Override protected void doCreateControl(final Composite parent, final IDialogSettings dialogSettings) { final Composite container = new Composite(parent, SWT.NONE); setControl(container); final GridLayout layout = new GridLayout(1, false); layout.marginWidth = getHorizontalMargin(); layout.marginHeight = getVerticalMargin(); layout.horizontalSpacing = getHorizontalSpacing(); layout.verticalSpacing = getVerticalSpacing(); container.setLayout(layout); confirmationLabel = new Label(container, SWT.NONE); GridDataBuilder.newInstance().hFill().hGrab().applyTo(confirmationLabel); confirmationTable = new ImportWizardConfirmationTable(container, SWT.FULL_SELECTION); AutomationIDHelper.setWidgetID(confirmationTable.getTable(), CONFIRMATION_TABLE_ID); GridDataBuilder.newInstance().fill().grab().applyTo(confirmationTable); }
/** * Creates a new dialog for ignoring resources. * @param shell the parent shell * @param resources the array of resources to be ignored */ public IgnoreResourcesDialog(Shell shell, IResource[] resources) { super(shell); this.resources = resources; IDialogSettings workbenchSettings = SVNUIPlugin.getPlugin().getDialogSettings(); this.settings = workbenchSettings.getSection("IgnoreResourcesDialog");//$NON-NLS-1$ if (settings == null) { this.settings = workbenchSettings.addNewSection("IgnoreResourcesDialog");//$NON-NLS-1$ } try { selectedAction = settings.getInt(ACTION_KEY); } catch (NumberFormatException e) { selectedAction = ADD_NAME_ENTRY; } }
public boolean performFinish() { if (confirmUserData() == false) { return false; } selectedResources = resourceSelectionTree.getSelectedResources(); int[] hWeights = horizontalSash.getWeights(); int[] vWeights = verticalSash.getWeights(); IDialogSettings section = settings.getSection(COMMIT_WIZARD_DIALOG_SETTINGS); if (section == null) section= settings.addNewSection(COMMIT_WIZARD_DIALOG_SETTINGS); if (showCompare) { section.put(H_WEIGHT_1, hWeights[0]); section.put(H_WEIGHT_2, hWeights[1]); } section.put(V_WEIGHT_1, vWeights[0]); section.put(V_WEIGHT_2, vWeights[1]); section.put(SHOW_COMPARE, showCompare); return true; }
/** * Saves the widget values for the next time */ private void saveWidgetValues() { // Update history IDialogSettings settings = getDialogSettings(); if (settings != null) { if (showCredentials) { String[] userNames = settings.getArray(STORE_USERNAME_ID); if (userNames == null) userNames = new String[0]; userNames = addToHistory(userNames, userCombo.getText()); settings.put(STORE_USERNAME_ID, userNames); } String[] hostNames = settings.getArray(STORE_URL_ID); if (hostNames == null) hostNames = new String[0]; hostNames = addToHistory(hostNames, urlCombo.getText()); settings.put(STORE_URL_ID, hostNames); } }
/** * Saves plugin state for next Eclipse session or when reopening the view. */ private void savePluginState() { if (!tabFolder.isDisposed()) { IDialogSettings section = Notepad4e.getDefault().getDialogSettings().getSection(ID); section.put(STORE_COUNT_KEY, tabFolder.getItemCount()); for (int tabIndex = 0; tabIndex < tabFolder.getItemCount(); ++tabIndex) { CTabItem tab = tabFolder.getItem(tabIndex); if (!tab.isDisposed()) { Note note = getNote(tabIndex); section.put(STORE_TEXT_PREFIX_KEY + tabIndex, note.getText()); section.put(STORE_STYLE_PREFIX_KEY + tabIndex, note.serialiseStyle()); if (tab.getText().startsWith(LOCK_PREFIX)) { // Do not save lock symbol. section.put(STORE_TITLE_PREFIX_KEY + tabIndex, tab.getText().substring(LOCK_PREFIX.length())); } else { section.put(STORE_TITLE_PREFIX_KEY + tabIndex, tab.getText()); } section.put(STORE_EDITABLE_PREFIX_KEY + tabIndex, note.getEditable()); section.put(STORE_BULLETS_PREFIX_KEY + tabIndex, note.serialiseBullets()); } } Notepad4e.save(); } }
private void runPressed() { super.okPressed(); if (getSelected() == null) return; IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); String mainClass = settings.get(getSelected()+"_mainClass"); if (getLauncher() instanceof SootConfigProjectLauncher) { ((SootConfigProjectLauncher)getLauncher()).launch(getSelected(), mainClass); } else if (getLauncher() instanceof SootConfigJavaProjectLauncher){ ((SootConfigJavaProjectLauncher)getLauncher()).launch(getSelected(), mainClass); } else if (getLauncher() instanceof SootConfigFileLauncher) { ((SootConfigFileLauncher)getLauncher()).launch(getSelected(), mainClass); } else if (getLauncher() instanceof SootConfigFromJavaFileLauncher){ ((SootConfigFromJavaFileLauncher)getLauncher()).launch(getSelected(), mainClass); } }
/** * Stores dialog settings. * * @param settings * settings used to store dialog */ protected void storeDialog(IDialogSettings settings) { settings.put(SHOW_STATUS_LINE, toggleStatusLineAction.isChecked()); XMLMemento memento = XMLMemento.createWriteRoot(HISTORY_SETTINGS); this.contentProvider.saveHistory(memento); StringWriter writer = new StringWriter(); try { memento.save(writer); settings.put(HISTORY_SETTINGS, 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.FilteredItemsSelectionDialog_storeError, e)); } }
/** * Resets the values to defaults */ protected void initialize() { isDone = false; isTLCStarted = false; errors = new Vector<TLCError>(); lastDetectedError = null; model.removeMarkers(ModelHelper.TLC_MODEL_ERROR_MARKER_TLC); coverageInfo = new Vector<CoverageInformationItem>(); progressInformation = new Vector<StateSpaceInformationItem>(); startTime = 0; startTimestamp = Long.MIN_VALUE; finishTimestamp = Long.MIN_VALUE; tlcMode = ""; lastCheckpointTimeStamp = Long.MIN_VALUE; coverageTimestamp = ""; setCurrentStatus(NOT_RUNNING); setFingerprintCollisionProbability(""); progressOutput = new Document(NO_OUTPUT_AVAILABLE); userOutput = new Document(NO_OUTPUT_AVAILABLE); constantExprEvalOutput = ""; final IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); stateSortDirection = dialogSettings.getBoolean(STATESORTORDER); }
@Override protected IDialogSettings getDialogSettings() { IDialogSettings settings = N4JSActivator.getInstance().getDialogSettings().getSection(DIALOG_SETTINGS_ID); if (null == settings) { settings = N4JSActivator.getInstance().getDialogSettings().addNewSection(DIALOG_SETTINGS_ID); } return settings; }
@Inject private void injectDialogSettings(IDialogSettings settings) { IDialogSettings section = settings.getSection("NFARExportWizard");//$NON-NLS-1$ if (section == null) { section = settings.addNewSection("NFARExportWizard");//$NON-NLS-1$ } setDialogSettings(section); }
/** */ public NpmExportWizard() { IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings(); IDialogSettings section = workbenchSettings.getSection("NpmExportWizard");//$NON-NLS-1$ if (section == null) { section = workbenchSettings.addNewSection("NpmExportWizard");//$NON-NLS-1$ } setDialogSettings(section); }
@Override public void createPageControls(Composite pageContainer) { super.createPageControls(pageContainer); IDialogSettings dialogSettings = this.getDialogSettings(); if (null != dialogSettings.get(CREATE_GREETER_SETTINGS_KEY)) { projectInfo.setCreateGreeterFile(dialogSettings.getBoolean(CREATE_GREETER_SETTINGS_KEY)); } if (null != dialogSettings.get(VENDOR_ID_SETTINGS_KEY)) { projectInfo.setVendorId(dialogSettings.get(VENDOR_ID_SETTINGS_KEY)); } }
/** * Default constructor */ public ADocSpecExportWizard() { IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings(); IDialogSettings section = workbenchSettings.getSection(WIZARD_NAME);// $NON-NLS-1$ if (section == null) { section = workbenchSettings.addNewSection(WIZARD_NAME);// $NON-NLS-1$ } setDialogSettings(section); }
private static IDialogSettings getOrCreateDialogSection(IDialogSettings dialogSettings) { // in Eclipse 3.6 the method DialogSettings#getOrCreateSection does not exist IDialogSettings section = dialogSettings.getSection(WIZARD_ID); if (section == null) { section = dialogSettings.addNewSection(WIZARD_ID); } return section; }
private void saveBooleanPropertyWhenChanged(final IDialogSettings settings, final String settingsKey, final Property<Boolean> target) { target.addValidationListener(new ValidationListener() { @Override public void validationTriggered(Property<?> source, Optional<String> validationErrorMessage) { settings.put(settingsKey, target.getValue()); } }); }
private void saveStringArrayPropertyWhenChanged(final IDialogSettings settings, final String settingsKey, final Property<List<String>> target) { target.addValidationListener(new ValidationListener() { @Override public void validationTriggered(Property<?> source, Optional<String> validationErrorMessage) { List<String> value = target.getValue(); settings.put(settingsKey, value.toArray(new String[value.size()])); } }); }
private void saveFilePropertyWhenChanged(final IDialogSettings settings, final String settingsKey, final Property<File> target) { target.addValidationListener(new ValidationListener() { @Override public void validationTriggered(Property<?> source, Optional<String> validationErrorMessage) { settings.put(settingsKey, FileUtils.getAbsolutePath(target.getValue()).orNull()); } }); }
private void saveGradleWrapperPropertyWhenChanged(final IDialogSettings settings, final Property<GradleDistributionWrapper> target) { target.addValidationListener(new ValidationListener() { @Override public void validationTriggered(Property<?> source, Optional<String> validationErrorMessage) { settings.put(SETTINGS_KEY_GRADLE_DISTRIBUTION_TYPE, target.getValue().getType().name()); settings.put(SETTINGS_KEY_GRADLE_DISTRIBUTION_CONFIGURATION, target.getValue().getConfiguration()); } }); }
@Override protected final IDialogSettings getDialogSettings() { AbstractUIPlugin activator = getUIPlugin(); if (activator == null) { return null; } return activator.getDialogSettings(); }
@Override protected Point getInitialLocation(Point initialSize) { IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings == null) { /* no dialog settings available, so fall back to min settings */ return new Point(DEFAULT_X, DEFAULT_Y); } return super.getInitialLocation(initialSize); }
public ImportWizard () { setNeedsProgressMonitor ( true ); setWindowTitle ( Messages.ImportWizard_Title ); IDialogSettings settings = Activator.getDefault ().getDialogSettings ().getSection ( "importWizard" ); //$NON-NLS-1$ if ( settings == null ) { settings = Activator.getDefault ().getDialogSettings ().addNewSection ( "importWizard" ); //$NON-NLS-1$ } setDialogSettings ( Activator.getDefault ().getDialogSettings ().getSection ( "importWizard" ) ); //$NON-NLS-1$ this.mergeController = new DiffController (); }