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

The following examples show how to use org.eclipse.jface.dialogs.IDialogSettings#get() . 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: PopupDialog.java    From SWET with MIT License 6 votes vote down vote up
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);
}
 
Example 2
Source File: FieldDialogImpl.java    From jenerate with Eclipse Public License 1.0 6 votes vote down vote up
private IDialogSettings initFieldDialogSettings() {
    IDialogSettings settings = generalDialogSettings.getSection(ABSTRACT_SETTINGS_SECTION);
    if (settings == null) {
        settings = generalDialogSettings.addNewSection(ABSTRACT_SETTINGS_SECTION);
    }

    currentPosition = settings.get(SETTINGS_INSERT_POSITION);
    if (currentPosition == null || currentPosition.isEmpty()) {
        currentPosition = DialogFactoryHelperImpl.FIRST_METHOD_POSITION;
    }

    if (disableAppendSuper) {
        appendSuper = false;
    } else {
        appendSuper = settings.getBoolean(SETTINGS_APPEND_SUPER);
    }
    generateComment = settings.getBoolean(SETTINGS_GENERATE_COMMENT);
    useGettersInsteadOfFields = settings.getBoolean(SETTINGS_USE_GETTERS);
    return settings;
}
 
Example 3
Source File: ImportTracePackageWizardPage.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void restoreWidgetValues() {
    super.restoreWidgetValues();
    IDialogSettings settings = getDialogSettings();
    if (settings != null && fProjectText != null) {

        // Restore last selected project
        String projectName = settings.get(STORE_PROJECT_NAME_ID);
        if (projectName != null && !projectName.isEmpty()) {
            for (IProject project : fOpenedTmfProjects) {
                if (project.getName().equals(projectName)) {
                    selectProject(project);
                    break;
                }
            }
        }
    }
}
 
Example 4
Source File: SootConfigManagerDialog.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
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);
	}
	
	
}
 
Example 5
Source File: EclipseFindSettings.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Initializes itself from the dialog settings with the same state as at the previous invocation.
 */
/* default */void readConfiguration()
{
	IDialogSettings s = getDialogSettings();

	fWrap = s.get("wrap") == null || s.getBoolean("wrap"); //$NON-NLS-1$ //$NON-NLS-2$
	fCase = s.getBoolean("casesensitive"); //$NON-NLS-1$
	fWholeWord = s.getBoolean("wholeword"); //$NON-NLS-1$
	fRegExSearch = s.getBoolean("isRegEx"); //$NON-NLS-1$
	fSelection = s.get("selection"); //$NON-NLS-1$

	String[] findHistory = s.getArray("findhistory"); //$NON-NLS-1$
	if (findHistory != null)
	{
		fFindHistory.clear();
		for (int i = 0; i < findHistory.length; i++)
		{
			fFindHistory.add(findHistory[i]);
		}
	}
}
 
Example 6
Source File: TimeGraphFindDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Initializes itself from the dialog settings with the same state as at the
 * previous invocation.
 */
private void readConfiguration() {
    IDialogSettings s = getDialogSettings();

    fWrapInit = s.get(WRAP) == null || s.getBoolean(WRAP);
    fCaseInit = s.getBoolean(CASE_SENSITIVE);
    fWholeWordInit = s.getBoolean(WHOLE_WORD);
    fIsRegExInit = s.getBoolean(IS_REGEX_EXPRESSION);

    String[] findHistory = s.getArray(FIND_HISTORY);
    if (findHistory != null) {
        fFindHistory.clear();
        for (int i = 0; i < findHistory.length; i++) {
            fFindHistory.add(findHistory[i]);
        }
    }
}
 
Example 7
Source File: SearchIndexData.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public static SearchIndexData create(IDialogSettings settings) {
    String textPattern = settings.get(STORE_TEXT_PATTERN);

    try {
        boolean hasStoredIsWholeWord = settings.get(STORE_IS_WHOLE_WORD) != null;
        boolean isWholeWord = true; // default is true
        if (hasStoredIsWholeWord) {
            isWholeWord = settings.getBoolean(STORE_IS_WHOLE_WORD);
        }

        boolean isCaseSensitive = settings.getBoolean(STORE_IS_CASE_SENSITIVE);
        int scope = settings.getInt(STORE_SCOPE);
        String scopeData = settings.get(STORE_SCOPE_DATA);
        String filenamePattern = settings.get(STORE_FILENAME_PATTERN);

        return new SearchIndexData(textPattern, isCaseSensitive, isWholeWord, scope, scopeData, filenamePattern);
    } catch (NumberFormatException e) {
        return null;
    }
}
 
Example 8
Source File: SREsPreferencePage.java    From sarl with Apache License 2.0 6 votes vote down vote up
/**
 * Restore table settings from the given dialog store using the
 * given key.
 *
 * @param settings dialog settings store
 */
private void restoreColumnSettings(IDialogSettings settings) {
	this.sresList.getTable().layout(true);
	restoreColumnWidths(settings);
	this.sortColumn = Column.NAME;
	try {
		final String columnName = settings.get(ID + ".sortColumn"); //$NON-NLS-1$
		if (!Strings.isNullOrEmpty(columnName)) {
			this.sortColumn = Column.valueOf(columnName);
			if (this.sortColumn == null) {
				this.sortColumn = Column.NAME;
			}
		}
	} catch (Throwable exception) {
		//
	}
	switch (this.sortColumn) {
	case NAME:
		sortByName();
		break;
	case LOCATION:
		sortByLocation();
		break;
	default:
	}
}
 
Example 9
Source File: AccessorDescription.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static AccessorDescription deserialize(IDialogSettings settings) {
	String accessorName= settings.get(KEY_ACCESSOR_NAME);
	if (accessorName == null) {
		return null;
	}

	String accessorPackHandle= settings.get(KEY_ACCESSOR_PACK);
	if (accessorPackHandle == null) {
		return null;
	}
	IJavaElement accessorPack= JavaCore.create(accessorPackHandle);
	if (!(accessorPack instanceof IPackageFragment) || !accessorPack.exists()) {
		return null;
	}

	String bundleName= settings.get(KEY_RESOURCE_BUNDLE_NAME);
	if (bundleName == null) {
		return null;
	}

	String bundlePackHandle= settings.get(KEY_RESOURCE_BUNDLE_PACK);
	if (bundlePackHandle == null) {
		return null;
	}
	IJavaElement bundlePack= JavaCore.create(bundlePackHandle);
	if (!(bundlePack instanceof IPackageFragment) || !bundlePack.exists()) {
		return null;
	}

	return new AccessorDescription(accessorName, (IPackageFragment) accessorPack, bundleName, (IPackageFragment) bundlePack);
}
 
Example 10
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private int getLastSelectedJREKind() {
	IDialogSettings settings= JavaPlugin.getDefault().getDialogSettings();
	if (settings.get(LAST_SELECTED_JRE_KIND2) == null)
		return EE_JRE;

	return settings.getInt(LAST_SELECTED_JRE_KIND2);
}
 
Example 11
Source File: TLAFilteredItemsSelectionDialog.java    From tlaplus with MIT License 5 votes vote down vote up
protected IDialogSettings getDialogSettings() {
	final IDialogSettings settings = Activator.getDefault().getDialogSettings();
	if (settings.get(SHOW_CONSTANTS) == null) {
		// Show constants by default
		settings.put(SHOW_CONSTANTS, true);
	}
	return settings;
}
 
Example 12
Source File: FilteredItemsSelectionDialog.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * Restores dialog using persisted settings. The default implementation
 * restores the status of the details line and the selection history.
 *
 * @param settings
 *            settings used to restore dialog
 */
protected void restoreDialog(IDialogSettings settings) {
	boolean toggleStatusLine = true;

	if (settings.get(SHOW_STATUS_LINE) != null) {
		toggleStatusLine = settings.getBoolean(SHOW_STATUS_LINE);
	}

	toggleStatusLineAction.setChecked(toggleStatusLine);

	details.setVisible(toggleStatusLine);

	String setting = settings.get(HISTORY_SETTINGS);
	if (setting != null) {
		try {
			IMemento memento = XMLMemento.createReadRoot(new StringReader(
					setting));
			this.contentProvider.loadHistory(memento);
		} catch (WorkbenchException e) {
			// Simply don't restore the settings
			StatusManager
					.getManager()
					.handle(
							new Status(
									IStatus.ERROR,
									PlatformUI.PLUGIN_ID,
									IStatus.ERROR,
									WorkbenchMessages.FilteredItemsSelectionDialog_restoreError,
									e));
		}
	}
}
 
Example 13
Source File: ExportRTFDilaog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
private void initRtfPath() {
	IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
	String strRtfPath = dialogSettings.get(STORE_RTF_PATH);
	if (strRtfPath != null && !strRtfPath.trim().equals("")) {
		txtRTFPath.setText(strRtfPath);
	}
}
 
Example 14
Source File: FatJarPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void restoreWidgetValues() {

	// restore JARPACKAGEDATA from SETTINGS and set widgets
	IDialogSettings settings= getDialogSettings();
	if (settings != null) {
		// SAVE ANT SCRIPT
		fAntScriptSaveCheckbox.setSelection(settings.getBoolean(STORE_ANTSCRIPT_SAVE));

		// ANT SCRIPT LOCATION
		String antScriptLocation= settings.get(STORE_ANTSCRIPT_LOCATION);
		if (antScriptLocation != null) {
			fAntScriptLocation= Path.fromOSString(antScriptLocation);
			if (fAntScriptLocation.isEmpty()) {
				fAntScriptNamesCombo.setText(""); //$NON-NLS-1$
			} else {
				fAntScriptNamesCombo.setText(fAntScriptLocation.toOSString());
			}
		}

		// ANT SCRIPT LOCATION HISTORY
		String[] directoryNames= settings.getArray(STORE_ANTSCRIPT_LOCATION_HISTORY);
		if (directoryNames != null) {
			if (!fAntScriptNamesCombo.getText().equals(directoryNames[0]))
				fAntScriptNamesCombo.add(fAntScriptNamesCombo.getText());
			for (int i= 0; i < directoryNames.length; i++)
				fAntScriptNamesCombo.add(directoryNames[i]);
		}

		// LIBRARY HANDLING
		int libraryHandling= ExtractLibraryHandler.ID; // default value for migrated (Eclipse 3.4) settings
		try {
			libraryHandling= settings.getInt(STORE_LIBRARY_HANDLING);
		} catch (NumberFormatException ignore) { // also thrown if no value was stored (null)
		}
		setLibraryHandler(createLibraryHandlerById(libraryHandling));

		// LAUNCH CONFIG
		String name= settings.get(STORE_LAUNCH_CONFIGURATION_SELECTION_NAME);
		if (name != null) {
			String[] items= fLaunchConfigurationCombo.getItems();
			for (int i= 0; i < items.length; i++) {
				if (name.equals(items[i])) {
					fLaunchConfigurationCombo.select(i);
				}
			}
		}

		// DESTINATION
		String destinationPath= settings.get(STORE_DESTINATION_ELEMENT);
		if (destinationPath != null && destinationPath.length() > 0) {
			fJarPackage.setJarLocation(Path.fromOSString(destinationPath));
		}
	}

	super.restoreWidgetValues();

}
 
Example 15
Source File: KeysPreferencePage.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.KEYS_PREFERENCE_PAGE);
	final Composite page = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(1, false);
	layout.marginWidth = 0;
	page.setLayout(layout);

	Group groupParent = new Group(page, SWT.None);
	groupParent.setLayout(new GridLayout());
	groupParent.setLayoutData(new GridData(GridData.FILL_BOTH));
	groupParent.setText(Messages.getString("preferencepage.KeysPreferencePage.groupParent"));

	HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preferencepage.KeysPreferencePage.imageLabel"),
			Activator.getImageDescriptor(ImageConstants.PREFERENCE_SYS_KEY));
	Composite cmp = imageLabel.createControl(groupParent);
	cmp.setLayout(new GridLayout());
	Composite cmpTemp = (Composite) imageLabel.getControl();
	cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH));
	Composite cmpContent = new Composite(cmpTemp, SWT.None);
	cmpContent.setLayout(new GridLayout());
	GridData data = new GridData(GridData.FILL_BOTH);
	data.horizontalSpan = 2;
	cmpContent.setLayoutData(data);

	// 不显示过滤文本框
	PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false);

	IDialogSettings settings = getDialogSettings();

	fPatternFilter = new CategoryPatternFilter(true, commandService.getCategory(null));
	if (settings.get(TAG_FILTER_UNCAT) != null) {
		fPatternFilter.filterCategories(settings.getBoolean(TAG_FILTER_UNCAT));
	}

	createTree(cmpContent);

	fill();

	applyDialogFont(cmpContent);
	imageLabel.computeSize();
	return page;
}
 
Example 16
Source File: MainProjectWizardPage.java    From sarl with Apache License 2.0 4 votes vote down vote up
private String getLastSelectedEE() {
	final IDialogSettings settings = JavaPlugin.getDefault().getDialogSettings();
	return settings.get(LAST_SELECTED_EE_SETTINGS_KEY);
}
 
Example 17
Source File: KeysPreferencePage.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.KEYS_PREFERENCE_PAGE);
	final Composite page = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(1, false);
	layout.marginWidth = 0;
	page.setLayout(layout);

	Group groupParent = new Group(page, SWT.None);
	groupParent.setLayout(new GridLayout());
	groupParent.setLayoutData(new GridData(GridData.FILL_BOTH));
	groupParent.setText(Messages.getString("preferencepage.KeysPreferencePage.groupParent"));

	HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preferencepage.KeysPreferencePage.imageLabel"),
			Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_KEY));
	Composite cmp = imageLabel.createControl(groupParent);
	cmp.setLayout(new GridLayout());
	Composite cmpTemp = (Composite) imageLabel.getControl();
	cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH));
	Composite cmpContent = new Composite(cmpTemp, SWT.None);
	cmpContent.setLayout(new GridLayout());
	GridData data = new GridData(GridData.FILL_BOTH);
	data.horizontalSpan = 2;
	cmpContent.setLayoutData(data);

	// 不显示过滤文本框
	PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false);

	IDialogSettings settings = getDialogSettings();

	fPatternFilter = new CategoryPatternFilter(true, commandService.getCategory(null));
	if (settings.get(TAG_FILTER_UNCAT) != null) {
		fPatternFilter.filterCategories(settings.getBoolean(TAG_FILTER_UNCAT));
	}

	createTree(cmpContent);

	fill();

	applyDialogFont(cmpContent);
	imageLabel.computeSize();
	return page;
}
 
Example 18
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private String getLastSelectedJRE() {
	IDialogSettings settings= JavaPlugin.getDefault().getDialogSettings();
	return settings.get(LAST_SELECTED_JRE_SETTINGS_KEY);
}
 
Example 19
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private String getLastSelectedEE() {
	IDialogSettings settings= JavaPlugin.getDefault().getDialogSettings();
	return settings.get(LAST_SELECTED_EE_SETTINGS_KEY);
}
 
Example 20
Source File: ExportDocxDialog.java    From translationstudio8 with GNU General Public License v2.0 votes vote down vote up
private void initRtfPath() {
		IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
		String strRtfPath = dialogSettings.get(STORE_DOCX_PATH);
		if (strRtfPath != null && !strRtfPath.trim().equals("")) {
			docxPathTxt.setText(strRtfPath);
		}
	}