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

The following examples show how to use org.eclipse.jface.dialogs.IDialogSettings#getArray() . 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: Convert2TmxDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private void loadDialogSettings() {
	IDialogSettings dialogSettings = getDialogSettings();
	isOpenBtn.setSelection(dialogSettings.getBoolean("isOpen"));
	boolean isCustomSlect = dialogSettings.getBoolean("isCustom");
	if (!isCustomSlect) {
		return;
	}
	addCustomAttributeBtn.setSelection(isCustomSlect);
	String[] array = dialogSettings.getArray("CustomValues");
	if (null == array || array.length == 0) {
		if (isCustomSlect) {
			createArributeArea(attributeArea, null, null);
		}
		return;
	}
	for (String key_value : array) {
		String[] split = key_value.split(ID_MARK);
		createArributeArea(attributeArea, split[0], split[1]);
	}
}
 
Example 2
Source File: SearchUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static void restoreState() {
	fgLRUWorkingSets= new LRUWorkingSetsList(LRU_WORKINGSET_LIST_SIZE);
	IDialogSettings settingsStore= getDialogStoreSection();

	boolean foundLRU= false;
	for (int i= LRU_WORKINGSET_LIST_SIZE - 1; i >= 0; i--) {
		String[] lruWorkingSetNames= settingsStore.getArray(STORE_LRU_WORKING_SET_NAMES + i);
		if (lruWorkingSetNames != null) {
			Set<IWorkingSet> workingSets= new HashSet<IWorkingSet>(2);
			for (int j= 0; j < lruWorkingSetNames.length; j++) {
				IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[j]);
				if (workingSet != null) {
					workingSets.add(workingSet);
				}
			}
			foundLRU= true;
			if (!workingSets.isEmpty())
				fgLRUWorkingSets.add(workingSets.toArray(new IWorkingSet[workingSets.size()]));
		}
	}
	if (!foundLRU)
		// try old preference format
		restoreFromOldFormat();
}
 
Example 3
Source File: WizardFileSystemResourceExportPage2.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Hook method for saving widget values for restoration by the next instance of this class.
 */
protected void internalSaveWidgetValues() {
	// update directory names history
	IDialogSettings settings = getDialogSettings();
	if (settings != null) {
		String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
		if (directoryNames == null) {
			directoryNames = new String[0];
		}

		directoryNames = addToHistory(directoryNames, getDestinationValue());
		settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);

		// options
		settings.put(STORE_OVERWRITE_EXISTING_FILES_ID, overwriteExistingFilesCheckbox.getSelection());

		settings.put(STORE_CREATE_STRUCTURE_ID, true);

	}
}
 
Example 4
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 5
Source File: SearchUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private static void restoreFromOldFormat() {
	fgLRUWorkingSets= new LRUWorkingSetsList(LRU_WORKINGSET_LIST_SIZE);
	IDialogSettings settingsStore= getDialogStoreSection();

	boolean foundLRU= false;
	String[] lruWorkingSetNames= settingsStore.getArray(STORE_LRU_WORKING_SET_NAMES);
	if (lruWorkingSetNames != null) {
		for (int i= lruWorkingSetNames.length - 1; i >= 0; i--) {
			IWorkingSet workingSet= PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(lruWorkingSetNames[i]);
			if (workingSet != null) {
				foundLRU= true;
				fgLRUWorkingSets.add(new IWorkingSet[]{workingSet});
			}
		}
	}
	if (foundLRU)
		// save in new format
		saveState(settingsStore);
}
 
Example 6
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 7
Source File: ExportRepositoryWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Hook method for saving widget values for restoration by the next instance
 * of this class.
 */
protected void saveWidgetValues() {
    // update directory names history
    final IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        String[] directoryNames = settings
                .getArray(STORE_DESTINATION_NAMES_ID);
        if (directoryNames == null) {
            directoryNames = new String[0];
        }

        String dest = getDetinationPath();
        if (dest.endsWith(".bos")) {
            dest = new File(dest).getParentFile().getAbsolutePath();
        }
        directoryNames = addToHistory(directoryNames, dest);
        settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
    }
}
 
Example 8
Source File: ExportProjectWizardPage.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Hook method for saving widget values for restoration by the next instance of this class.
 */
protected void internalSaveWidgetValues() {
	super.internalSaveWidgetValues();
	// update directory names history
	IDialogSettings settings = getDialogSettings();
	if (settings != null) {
		String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
		if (directoryNames == null) {
			directoryNames = new String[0];
		}

		directoryNames = addToHistory(directoryNames, getDestinationValue());
		settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);

		settings.put(STORE_CREATE_STRUCTURE_ID, true);

		settings.put(STORE_COMPRESS_CONTENTS_ID, true);
	}
}
 
Example 9
Source File: WizardFileSystemResourceExportPage2.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
	 * Hook method for restoring widget values to the values that they held last time this wizard was used to
	 * completion.
	 */
	protected void restoreWidgetValues() {
		IDialogSettings settings = getDialogSettings();
		if (settings != null) {
			String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
			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(STORE_OVERWRITE_EXISTING_FILES_ID));
		}
	}
 
Example 10
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 11
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 12
Source File: ImportProjectWizardPage.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
private void restoreFromHistory(final IDialogSettings settings, final String key, final Combo combo) {
	final String[] sourceNames = settings.getArray(key);
	if (sourceNames == null) {
		return; // ie.- no values stored, so stop
	}

	for (final String sourceName : sourceNames) {
		combo.add(sourceName);
	}
}
 
Example 13
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 14
Source File: AbstractJarDestinationWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void saveWidgetValues() {
	IDialogSettings settings= getDialogSettings();
	if (settings != null) {
		String[] directoryNames= settings.getArray(fStoreDestinationNamesId);
		if (directoryNames == null)
			directoryNames= new String[0];
		directoryNames= addToHistory(directoryNames, getDestinationValue());
		settings.put(fStoreDestinationNamesId, directoryNames);
	}
}
 
Example 15
Source File: AbstractTracePackageWizardPage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Save widget values to Dialog settings
 */
protected void saveWidgetValues() {
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        // update directory names history
        String[] directoryNames = settings.getArray(fStoreFilePathId);
        if (directoryNames == null) {
            directoryNames = new String[0];
        }

        directoryNames = addToHistory(directoryNames, getFilePathValue());
        settings.put(fStoreFilePathId, directoryNames);
    }
}
 
Example 16
Source File: AbstractTracePackageWizardPage.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Restore widget values to the values that they held last time this wizard
 * was used to completion.
 */
protected void restoreWidgetValues() {
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        String[] directoryNames = settings.getArray(fStoreFilePathId);
        if (directoryNames == null || directoryNames.length == 0) {
            return;
        }

        for (int i = 0; i < directoryNames.length; i++) {
            fFilePathCombo.add(directoryNames[i]);
        }
    }
}
 
Example 17
Source File: HybridProjectImportPage.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
private void restoreFromHistory(){
	//Directories
	IDialogSettings settings = getDialogSettings();
	if (settings == null) return;
	String[] sourceNames = settings.getArray(SETTINGSKEY_DIRECTORIES);
	if (sourceNames == null) {
		return; 
	}
	for (String dirname : sourceNames) {
		directoryPathField.add(dirname);
	}
	//copy to workspace
	copyFiles = settings.getBoolean(SETTINGSKEY_COPY);
	copyCheckbox.setSelection(copyFiles);
}
 
Example 18
Source File: GenerateToStringDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public static String[] getTemplates(IDialogSettings dialogSettings) {
	String[] result= dialogSettings.getArray(ToStringGenerationSettings.SETTINGS_TEMPLATES);
	if (result != null && result.length > 0)
		return result;
	return new String[] { ToStringTemplateParser.DEFAULT_TEMPLATE };
}
 
Example 19
Source File: FixedFatJarExportPage.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
protected void saveWidgetValues() {
	super.saveWidgetValues();

	IDialogSettings settings= getDialogSettings();
	if (settings != null) {
		// ANT SCRIPT SAVE
		settings.put(STORE_ANTSCRIPT_SAVE, fAntScriptSaveCheckbox.getSelection());

		// ANT SCRIPT LOCATION
		IPath antScriptLocation= fAntScriptLocation;
		if (antScriptLocation == null) {
			settings.put(STORE_ANTSCRIPT_LOCATION, ""); //$NON-NLS-1$
		} else {
			settings.put(STORE_ANTSCRIPT_LOCATION, antScriptLocation.toOSString());
		}

		// ANT SCRIPT LOCATION HISTORY
		String[] directoryNames= settings.getArray(STORE_ANTSCRIPT_LOCATION_HISTORY);
		if (directoryNames == null)
			directoryNames= new String[0];
		directoryNames= addToHistory(directoryNames, getAntScriptValue());
		settings.put(STORE_ANTSCRIPT_LOCATION_HISTORY, directoryNames);

		// LIBRARY HANDLING
		settings.put(STORE_LIBRARY_HANDLING, getLibraryHandler().getID());

		// LAUNCH CONFIG
		int index= fLaunchConfigurationCombo.getSelectionIndex();
		if (index == -1) {
			settings.put(STORE_LAUNCH_CONFIGURATION_SELECTION_NAME, ""); //$NON-NLS-1$
		} else {
			String selectedItem= fLaunchConfigurationCombo.getItem(index);
			settings.put(STORE_LAUNCH_CONFIGURATION_SELECTION_NAME, selectedItem);
		}

		// DESTINATION
		IPath location= fJarPackage.getJarLocation();
		if (location == null) {
			settings.put(STORE_DESTINATION_ELEMENT, ""); //$NON-NLS-1$
		} else {
			settings.put(STORE_DESTINATION_ELEMENT, location.toOSString());
		}
	}
}
 
Example 20
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();

}