use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.
the class FindDialog method addHistory.
/**
* Adds the search text to history.
*
* @param searchText The search text.
*/
private void addHistory(String searchText) {
if (searchText.isEmpty()) {
return;
}
IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(getClass().getName());
String[] items = dialogSettings.getArray(FIND_HISTORY_KEY);
if (items == null) {
items = new String[] { searchText };
} else {
List<String> list = new ArrayList<String>();
Collections.addAll(list, items);
if (list.contains(searchText)) {
list.remove(searchText);
}
Collections.reverse(list);
list.add(searchText);
Collections.reverse(list);
items = list.toArray(new String[0]);
}
dialogSettings.put(FIND_HISTORY_KEY, items);
findText.setItems(items);
findText.select(0);
}
use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.
the class Activator method getDialogSettings.
/**
* Gets the dialog settings.
*
* @param sectionName The sectionName
*
* @return The dialog settings
*/
public IDialogSettings getDialogSettings(String sectionName) {
IDialogSettings settings = getDialogSettings();
IDialogSettings section = settings.getSection(sectionName);
if (section == null) {
section = settings.addNewSection(sectionName);
}
return section;
}
use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.
the class GenerateDocAsHTMLWizardPage method handleEvent.
@Override
public void handleEvent(Event e) {
super.handleEvent(e);
Widget source = e.widget;
if (source instanceof Combo) {
String destination = ((Combo) source).getText();
if (getDialogSettings() != null) {
IDialogSettings section = getDialogSettings().getSection(DESTINATION_FILE);
if (section == null) {
section = getDialogSettings().addNewSection(DESTINATION_FILE);
}
section.put(DESTINATION_FILE, destination);
}
}
}
use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.
the class GenerateDocAsHTMLWizardPage method saveLastDirectoryName.
/**
* Save the last directoryName path .
*
* @param runnable
*/
private void saveLastDirectoryName(ArchiveFileExportOperationFullPath runnable) {
IDialogSettings settings = getDialogSettings();
if (settings != null) {
String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
if (directoryNames != null) {
boolean isExist = false;
for (String directoryName : directoryNames) {
if (directoryName.equals(runnable.getDestinationFilename())) {
isExist = true;
}
}
if (!isExist) {
String[] newDirectoryNames = Arrays.copyOf(directoryNames, directoryNames.length + 1);
newDirectoryNames[newDirectoryNames.length - 1] = runnable.getDestinationFilename();
settings.put(STORE_DESTINATION_NAMES_ID, newDirectoryNames);
}
} else {
settings.put(STORE_DESTINATION_NAMES_ID, new String[] { runnable.getDestinationFilename() });
}
}
}
use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.
the class OverviewSection method getDialogSettings.
/**
* Gets the dialog settings for the tree expansion state.
*
* @return The dialog settings
*/
private IDialogSettings getDialogSettings() {
String id = sectionName;
IActiveJvm jvm = getJvm();
if (jvm != null) {
id += jvm.getPid();
}
IDialogSettings settings = Activator.getDefault().getDialogSettings();
IDialogSettings section = settings.getSection(id);
if (section == null) {
section = settings.addNewSection(id);
}
return section;
}
Aggregations