Java Code Examples for org.eclipse.jface.dialogs.IDialogSettings#put()

The following examples show how to use org.eclipse.jface.dialogs.IDialogSettings#put() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImportTraceWizardPage.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void saveWidgetValues() {
    // Persist dialog settings
    IDialogSettings settings = getDialogSettings();
    if (fImportUnrecognizedButton != null) {
        settings.put(getPageStoreKey(IMPORT_WIZARD_IMPORT_UNRECOGNIZED_ID), fImportUnrecognizedButton.getSelection());
    }
    if (fPreserveFolderStructureButton != null) {
        settings.put(getPageStoreKey(IMPORT_WIZARD_PRESERVE_FOLDERS_ID), fPreserveFolderStructureButton.getSelection());
    }

    if (fCreateExperimentCheckbox != null) {
        settings.put(getPageStoreKey(IMPORT_WIZARD_CREATE_EXPERIMENT_ID), fCreateExperimentCheckbox.getSelection());
    }

    settings.put(getPageStoreKey(IMPORT_WIZARD_IMPORT_FROM_DIRECTORY_ID), isImportFromDirectory());

    if (directoryNameField != null) {
        saveComboValues(directoryNameField, settings, getPageStoreKey(IMPORT_WIZARD_ROOT_DIRECTORY_ID));
    }
    if (fArchiveNameField != null) {
        saveComboValues(fArchiveNameField, settings, getPageStoreKey(IMPORT_WIZARD_ARCHIVE_FILE_NAME_ID));
    }
}
 
Example 2
Source File: JarManifestWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Persists resource specification control setting that are to be restored
 * in the next instance of this page. Subclasses wishing to persist
 * settings for their controls should extend the hook method
 * <code>internalSaveWidgetValues</code>.
 */
public final void saveWidgetValues() {
	IDialogSettings settings= getDialogSettings();
	if (settings != null) {
		// Manifest creation
		settings.put(STORE_GENERATE_MANIFEST, fJarPackage.isManifestGenerated());
		settings.put(STORE_SAVE_MANIFEST, fJarPackage.isManifestSaved());
		settings.put(STORE_REUSE_MANIFEST, fJarPackage.isManifestReused());
		settings.put(STORE_MANIFEST_LOCATION, fJarPackage.getManifestLocation().toString());

		// Sealing
		settings.put(STORE_SEAL_JAR, fJarPackage.isJarSealed());
		}

	// Allow subclasses to save values
	internalSaveWidgetValues();
}
 
Example 3
Source File: TmfTableColumnUtils.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static void saveColumnElementBoolean(String traceTypeId, String sectionName, boolean[] data) {
    if (traceTypeId == null) {
        return;
    }
    if (data == null) {
        clearColumnElement(traceTypeId, sectionName);
        return;
    }
    IDialogSettings settings = Activator.getDefault().getDialogSettings();
    IDialogSettings section = settings.getSection(ROOT_SECTION_NAME);
    if (section == null) {
        section = settings.addNewSection(ROOT_SECTION_NAME);
    }
    IDialogSettings columnSection = section.getSection(sectionName);
    if (columnSection == null) {
        columnSection = section.addNewSection(sectionName);
    }
    columnSection.put(traceTypeId, Arrays.toString(data));
}
 
Example 4
Source File: FilteredItemsSelectionDialog.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * 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));
	}
}
 
Example 5
Source File: HybridProjectImportPage.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
private void saveInHistroy(){
	IDialogSettings settings = getDialogSettings();
	if (settings != null) {
		// Directories 
		String[] sourceNames = settings.getArray(SETTINGSKEY_DIRECTORIES);
		if (sourceNames == null) {
			sourceNames = new String[0];
		}
		List<String> l = new ArrayList<String>(Arrays.asList(sourceNames));
		l.remove(directoryPathField.getText());
		l.add(0,directoryPathField.getText());
		sourceNames = l.toArray(new String[l.size()]);
		settings.put(SETTINGSKEY_DIRECTORIES, sourceNames);
		
		//Copy to workspace
		settings.put(SETTINGSKEY_COPY, copyCheckbox.getSelection());
	}
}
 
Example 6
Source File: GoSearchPage.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
public void store(IDialogSettings settings) {
  settings.put("ignoreCase", !isCaseSensitive); //$NON-NLS-1$
  settings.put("isRegExSearch", isRegExSearch); //$NON-NLS-1$
  settings.put("textPattern", textPattern); //$NON-NLS-1$
  settings.put("fileNamePatterns", fileNamePatterns); //$NON-NLS-1$
  settings.put("scope", scope); //$NON-NLS-1$
  if (workingSets != null) {
    String[] wsIds = new String[workingSets.length];
    for (int i = 0; i < workingSets.length; i++) {
      wsIds[i] = workingSets[i].getLabel();
    }
    settings.put("workingSets", wsIds); //$NON-NLS-1$
  } else {
    settings.put("workingSets", new String[0]); //$NON-NLS-1$
  }
}
 
Example 7
Source File: ConcordanceSearchDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Writes the given history into the given dialog store.
 * @param history
 *            the history
 * @param settings
 *            the dialog settings
 * @param sectionName
 *            the section name
 * @since 3.2
 */
private void writeHistory(List<String> history, IDialogSettings settings, String sectionName) {
	int itemCount = history.size();
	Set<String> distinctItems = new HashSet<String>(itemCount);
	for (int i = 0; i < itemCount; i++) {
		String item = (String) history.get(i);
		if (distinctItems.contains(item)) {
			history.remove(i--);
			itemCount--;
		} else {
			distinctItems.add(item);
		}
	}

	while (history.size() > 8) {
		history.remove(8);
	}

	String[] names = new String[history.size()];
	history.toArray(names);
	settings.put(sectionName, names);
}
 
Example 8
Source File: OpenCommandScriptDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void saveWidgetValues() {
    IDialogSettings workbenchSettings = Activator.getDefault().getDialogSettings();
    IDialogSettings settings = workbenchSettings.getSection(DIALOG_SETTINGS_SECTION);
    if (settings != null) {
        // update file names history
        String[] fileNames = settings.getArray(FILE_NAME_ID);
        if (fileNames == null) {
            fileNames = new String[0];
        }

        fileNames = addToHistory(fileNames, fFileNameCombo.getText().trim());
        settings.put(FILE_NAME_ID, fileNames);
    }
}
 
Example 9
Source File: FlameGraphView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void saveSortOption() {
    SortOption sortOption = fTimeGraphContentProvider.getSortOption();
    IDialogSettings settings = Activator.getDefault().getDialogSettings();
    IDialogSettings section = settings.getSection(getClass().getName());
    if (section == null) {
        section = settings.addNewSection(getClass().getName());
    }
    section.put(SORT_OPTION_KEY, sortOption.name());
}
 
Example 10
Source File: SearchUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static void saveState(IDialogSettings settingsStore) {
	IWorkingSet[] workingSets;
	Iterator<IWorkingSet[]> iter= fgLRUWorkingSets.iterator();
	int i= 0;
	while (iter.hasNext()) {
		workingSets= iter.next();
		String[] names= new String[workingSets.length];
		for (int j= 0; j < workingSets.length; j++)
			names[j]= workingSets[j].getName();
		settingsStore.put(STORE_LRU_WORKING_SET_NAMES + i, names);
		i++;
	}
}
 
Example 11
Source File: XmlLatencyViewInfo.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void savePersistentData() {
    IDialogSettings settings = getPersistentPropertyStore();

    settings.put(XML_LATENCY_VIEW_ANALYSIS_ID_PROPERTY, fAnalysisId);
    settings.put(XML_LATENCY_VIEW_LABEL_PROPERTY, fLabel);
}
 
Example 12
Source File: TLAFilteredItemsSelectionDialog.java    From tlaplus with MIT License 5 votes vote down vote up
protected void storeDialog(IDialogSettings settings) {
	settings.put(SHOW_CONSTANTS, toggleShowConstantsAction.isChecked());
	settings.put(SHOW_CLOSED_SPECS, toggleShowSpecAction.isChecked());
	settings.put(SASH_RATIO_TOP, sashForm.getWeights()[0]);
	settings.put(SASH_RATIO_BOTTOM, sashForm.getWeights()[1]);
	super.storeDialog(settings);
}
 
Example 13
Source File: AbstractNewSarlElementWizardPage.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Save the settings of the dialog box.
 */
protected void saveSettings() {
	final IDialogSettings dialogSettings = getDialogSettings();
	if (dialogSettings != null) {
		IDialogSettings section = dialogSettings.getSection(getName());
		if (section == null) {
			section = dialogSettings.addNewSection(getName());
		}
		section.put(SETTINGS_CREATECONSTR, isCreateConstructors());
		section.put(SETTINGS_CREATEUNIMPLEMENTED, isCreateInherited());
		section.put(SETTINGS_GENERATEEVENTHANDLERS, isCreateStandardEventHandlers());
		section.put(SETTINGS_GENERATELIFECYCLEFUNCTIONS, isCreateStandardLifecycleFunctions());
	}
}
 
Example 14
Source File: ReorgMoveWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void dispose() {
	super.dispose();

	IDialogSettings settings= getRefactoringSettings();
	if (settings == null)
		return;

	if (fQualifiedNameCheckbox != null)
		settings.put(ReorgMoveWizard.UPDATE_QUALIFIED_NAMES, fQualifiedNameCheckbox.getSelection());

	if (fQualifiedNameComponent != null)
		fQualifiedNameComponent.savePatterns(settings);
}
 
Example 15
Source File: ImportProjectWizardPage.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
private void saveInHistory(final IDialogSettings settings, final String key, final String value) {
	String[] sourceNames = settings.getArray(key);
	if (sourceNames == null) {
		sourceNames = new String[0];
	}
	sourceNames = addToHistory(sourceNames, value);
	settings.put(key, sourceNames);
}
 
Example 16
Source File: ConversionWizard.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean performFinish() {
	IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
	dialogSettings.put(ConversionWizardPage.REPLACE_TARGET, page.isReplaceTarget());
	dialogSettings.put(ConversionWizardPage.OPEN_PRE_TRANS, page.isOpenPreTrans());
	return true;
}
 
Example 17
Source File: PopupDialog.java    From SWET with MIT License 5 votes vote down vote up
/**
 * Saves the bounds of the shell in the appropriate dialog settings. The
 * bounds are recorded relative to the parent shell, if there is one, or
 * display coordinates if there is no parent shell. Subclasses typically
 * need not override this method, but may extend it (calling
 * <code>super.saveDialogBounds</code> if additional bounds information
 * should be stored. Clients may also call this method to persist the bounds
 * at times other than closing the dialog.
 * 
 * @param shell
 *            The shell whose bounds are to be stored
 */
protected void saveDialogBounds(Shell shell) {
	IDialogSettings settings = getDialogSettings();
	if (settings != null) {
		Point shellLocation = shell.getLocation();
		Point shellSize = shell.getSize();
		Shell parent = getParentShell();
		if (parent != null) {
			Point parentLocation = parent.getLocation();
			shellLocation.x -= parentLocation.x;
			shellLocation.y -= parentLocation.y;
		}
		String prefix = getClass().getName();
		if (persistSize) {
			settings.put(prefix + DIALOG_WIDTH, shellSize.x);
			settings.put(prefix + DIALOG_HEIGHT, shellSize.y);
		}
		if (persistLocation) {
			settings.put(prefix + DIALOG_ORIGIN_X, shellLocation.x);
			settings.put(prefix + DIALOG_ORIGIN_Y, shellLocation.y);
		}
		if (showPersistActions && showDialogMenu) {
			settings.put(getClass().getName() + DIALOG_USE_PERSISTED_SIZE,
					persistSize);
			settings.put(getClass().getName() + DIALOG_USE_PERSISTED_LOCATION,
					persistLocation);

		}
	}
}
 
Example 18
Source File: AccessorDescription.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void serialize(IDialogSettings settings) {
	settings.put(KEY_ACCESSOR_NAME, getAccessorClassName());
	settings.put(KEY_ACCESSOR_PACK, getAccessorClassPackage().getHandleIdentifier());
	settings.put(KEY_RESOURCE_BUNDLE_NAME, getResourceBundleName());
	settings.put(KEY_RESOURCE_BUNDLE_PACK, getResourceBundlePackage().getHandleIdentifier());
}
 
Example 19
Source File: GlobalGroupSet.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
public static void save(final GroupSet columnGroups) {
    try {
        final IDialogSettings settings = new DialogSettings("column_group_list");

        settings.put("database", columnGroups.getDatabase());

        int index = 0;

        for (final ColumnGroup columnGroup : columnGroups) {
            final IDialogSettings columnGroupSection = new DialogSettings("column_group_" + index);
            index++;

            columnGroupSection.put("group_name", columnGroup.getGroupName());

            int columnIndex = 0;

            for (final NormalColumn normalColumn : columnGroup.getColumns()) {
                final IDialogSettings columnSection = new DialogSettings("column_" + columnIndex);
                columnIndex++;

                columnSection.put("physical_name", null2Blank(normalColumn.getPhysicalName()));
                columnSection.put("logical_name", null2Blank(normalColumn.getLogicalName()));
                columnSection.put("type", null2Blank(normalColumn.getType()));
                columnSection.put("length", null2Blank(normalColumn.getTypeData().getLength()));
                columnSection.put("decimal", null2Blank(normalColumn.getTypeData().getDecimal()));
                columnSection.put("array", normalColumn.getTypeData().isArray());
                columnSection.put("array_dimension", null2Blank(normalColumn.getTypeData().getArrayDimension()));
                columnSection.put("unsigned", normalColumn.getTypeData().isUnsigned());
                columnSection.put("zerofill", normalColumn.getTypeData().isZerofill());
                columnSection.put("binary", normalColumn.getTypeData().isBinary());

                columnSection.put("not_null", normalColumn.isNotNull());
                columnSection.put("unique", normalColumn.isUniqueKey());
                columnSection.put("default_value", null2Blank(normalColumn.getDefaultValue()));
                columnSection.put("constraint", null2Blank(normalColumn.getConstraint()));
                columnSection.put("description", null2Blank(normalColumn.getDescription()));
                columnSection.put("char_semantics", normalColumn.getTypeData().isCharSemantics());

                columnGroupSection.addSection(columnSection);
            }

            settings.addSection(columnGroupSection);
        }

        settings.save(getPath());

    } catch (final IOException e) {
        ERDiagramActivator.showExceptionDialog(e);
    }
}
 
Example 20
Source File: GlobalGroupSet.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public static void save(GroupSet columnGroups) {
	try {
		IDialogSettings settings = new DialogSettings("column_group_list");

		settings.put("database", columnGroups.getDatabase());

		int index = 0;

		for (ColumnGroup columnGroup : columnGroups) {
			IDialogSettings columnGroupSection = new DialogSettings(
					"column_group_" + index);
			index++;

			columnGroupSection
					.put("group_name", columnGroup.getGroupName());

			int columnIndex = 0;

			for (NormalColumn normalColumn : columnGroup.getColumns()) {
				IDialogSettings columnSection = new DialogSettings(
						"column_" + columnIndex);
				columnIndex++;

				columnSection.put("physical_name", null2Blank(normalColumn
						.getPhysicalName()));
				columnSection.put("logical_name", null2Blank(normalColumn
						.getLogicalName()));
				columnSection.put("type",
						null2Blank(normalColumn.getType()));
				columnSection.put("length", null2Blank(normalColumn
						.getTypeData().getLength()));
				columnSection.put("decimal", null2Blank(normalColumn
						.getTypeData().getDecimal()));
				columnSection.put("array", normalColumn.getTypeData()
						.isArray());
				columnSection.put("array_dimension",
						null2Blank(normalColumn.getTypeData()
								.getArrayDimension()));
				columnSection.put("unsigned", normalColumn.getTypeData()
						.isUnsigned());

				columnSection.put("not_null", normalColumn.isNotNull());
				columnSection.put("unique", normalColumn.isUniqueKey());
				columnSection.put("default_value", null2Blank(normalColumn
						.getDefaultValue()));
				columnSection.put("constraint", null2Blank(normalColumn
						.getConstraint()));
				columnSection.put("description", null2Blank(normalColumn
						.getDescription()));

				columnGroupSection.addSection(columnSection);
			}

			settings.addSection(columnGroupSection);
		}

		settings.save(getPath());

	} catch (IOException e) {
		Activator.showExceptionDialog(e);
	}
}