Example usage for org.eclipse.jface.dialogs DialogSettings put

List of usage examples for org.eclipse.jface.dialogs DialogSettings put

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs DialogSettings put.

Prototype

@Override
    public void put(String key, boolean value) 

Source Link

Usage

From source file:com.sonatype.buildserver.monitor.MonitorPersistence.java

License:Open Source License

/**
 * Persist a {@code HudsonMonitor}, it can be reloaded later using the monitor's ID.
 * //from   www  .  j  a  v  a2s.  co  m
 * @param monitor the monitor to persist
 */
static void store(HudsonMonitor monitor) {
    synchronized (monitor) {
        DialogSettings settings = new DialogSettings(monitor.getId().toString());
        settings.put(ADDRESS, monitor.getServerURI().toString());

        Collection<String> jobIds = monitor.getMonitoredJobIds();
        if (jobIds != null && jobIds.size() > 0)
            settings.put(JOBS, jobIds.toArray(new String[jobIds.size()]));

        try {
            settings.save(getLocation(monitor.getId().toString()));
        } catch (IOException e) {
            log.error("Error while saving Hudson preferences: " + e.getMessage());
        }
    }
}

From source file:com.sonatype.buildserver.monitor.MonitorPersistence.java

License:Open Source License

/**
 * Persist a {@code CompositeMonitor}, it can be reloaded later using the monitor's ID.
 * //from   ww  w  .  j a  v  a 2 s. co m
 * @param compositeMonitor the monitor to persist
 */
static void store(CompositeMonitor compositeMonitor) {
    synchronized (compositeMonitor) {
        DialogSettings settings = new DialogSettings(compositeMonitor.getId().toString());
        Collection<HudsonMonitor> monitors = compositeMonitor.getAllMonitors();

        Collection<String> monitorIDs = new ArrayList<String>();
        for (HudsonMonitor m : monitors) {
            store(m);
            monitorIDs.add(m.getId().toString());
        }
        settings.put(MONITORS, monitorIDs.toArray(new String[monitorIDs.size()]));

        try {
            settings.save(getLocation(compositeMonitor.getId().toString()));
        } catch (IOException e) {
            log.error("Error while saving Hudson preferences: " + e.getMessage());
        }
    }
}

From source file:de.maybebuggy.finder.commands.FinderDialog.java

License:Open Source License

private void saveSearchHistory(SearchHistory history) {
    try {/*from   ww  w .  j  ava2 s  . c o  m*/
        String fileName = getSearchHistoryFileName();
        createFileIfMissing(fileName);

        DialogSettings searchDirectories = new DialogSettings("SearchHistory");
        searchDirectories.put("searchPaths", history.getSearchPaths().toArray(new String[] {}));
        searchDirectories.put("searchTerms", history.getSearchTerms().toArray(new String[] {}));

        searchDirectories.save(fileName);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:de.maybebuggy.finder.commands.FinderDialog.java

License:Open Source License

private void saveLastUsed() {
    try {// w  w  w  .  ja v  a  2s  .com
        String fileName = getSettingsFileName();
        createFileIfMissing(fileName);

        DialogSettings settings = new DialogSettings("FinderDialog");
        SearchHistory history = getSearchHistory();
        history.addSearchTerm(searchTermField.getText());
        history.addSearchPath(searchPathField.getText());
        saveSearchHistory(history);
        settings.put("matchWhole", matchWhole.getSelection());
        settings.put("caseSensitive", caseSensitive.getSelection());
        settings.put("searchForClasses", searchForClasses.getSelection());
        settings.put("searchForFiles", searchForFiles.getSelection());
        settings.put("searchJars", searchJars.getSelection());
        settings.put("searchZips", searchZips.getSelection());
        settings.put("searchDefaultArchives", searchDefaultArchives.getSelection());
        settings.put("searchArchivesRecursive", searchArchivesRecursive.getSelection());
        settings.put("additionalExtensions", additionalExtensions.getText());
        settings.save(fileName);
    } catch (IOException e) {
        e.printStackTrace();
        //ignore
    }
}

From source file:fr.inria.linuxtools.tmf.ui.views.uml2sd.dialogs.Criteria.java

License:Open Source License

/**
 * Saves current criteria attributes in the dialog settings.
 *
 * @param settings The dialog settings// w  w  w  .  j  a  va2  s.com
 */
public void save(DialogSettings settings) {
    settings.put("expression", getExpression()); //$NON-NLS-1$
    settings.put("isCaseSenstiveSelected", isCaseSenstiveSelected()); //$NON-NLS-1$
    settings.put("isAsyncMessageReturnSelected", isAsyncMessageReturnSelected()); //$NON-NLS-1$
    settings.put("isAsyncMessageSelected", isAsyncMessageSelected()); //$NON-NLS-1$
    settings.put("isLifeLineSelected", isLifeLineSelected()); //$NON-NLS-1$
    settings.put("isStopSelected", isStopSelected()); //$NON-NLS-1$
    settings.put("isSyncMessageReturnSelected", isSyncMessageReturnSelected()); //$NON-NLS-1$
    settings.put("isSyncMessageSelected", isSyncMessageSelected()); //$NON-NLS-1$
}

From source file:fr.inria.linuxtools.tmf.ui.views.uml2sd.dialogs.FilterCriteria.java

License:Open Source License

/**
 * Saves current criteria attributes in the dialog settings.
 *
 * @param settings The dialog settings/*  w w w .jav a2  s  .  c om*/
 */
public void save(DialogSettings settings) {
    settings.put(ACTIVE, isActive());
    settings.put(POSITIVE, isPositive());
    if (getLoaderClassName() != null) {
        settings.put(LOADERCLASSNAME, getLoaderClassName());
    } else {
        settings.put(LOADERCLASSNAME, ""); //$NON-NLS-1$
    }
    if (fCriteria != null) {
        fCriteria.save(settings);
    }
}

From source file:fr.inria.linuxtools.tmf.ui.views.uml2sd.dialogs.FilterListDialog.java

License:Open Source License

/**
 * Saves the filter criteria in the dialog settings.
 *
 * @param globalFilters A list of filters to save.
 *///w w w. j ava  2  s  .  com
public static void saveFiltersCriteria(List<FilterCriteria> globalFilters) {
    DialogSettings settings = (DialogSettings) Activator.getDefault().getDialogSettings();
    DialogSettings section = (DialogSettings) settings.getSection(FILTERS_LIST_CRITERIA);
    if (section == null) {
        section = (DialogSettings) settings.addNewSection(FILTERS_LIST_CRITERIA);
    }

    if (globalFilters == null) {
        section.put(FILTERS_LIST_SIZE, 0);
        return;
    }

    section.put(FILTERS_LIST_SIZE, globalFilters.size());

    FilterCriteria criteria;

    for (int j = 0; j < globalFilters.size(); j++) {
        if (globalFilters.get(j) == null) {
            return;
        }

        criteria = globalFilters.get(j);
        DialogSettings subSection = (DialogSettings) section.getSection(FILTERS_LIST_CRITERIA + j);

        if (subSection == null) {
            subSection = (DialogSettings) section.addNewSection(FILTERS_LIST_CRITERIA + j);
        }
        criteria.save(subSection);
    }
}

From source file:fr.inria.linuxtools.tmf.ui.views.uml2sd.dialogs.SearchFilterDialog.java

License:Open Source License

/**
 * Saves the criteria to the dialog settings within the workspace.
 *//*from w  w w. j  a  va  2  s  .  c  o  m*/
public void saveCriteria() {
    String CRITERIA = FIND_CRITERIA;
    String EXPRESSION_LIST = FIND_EXPRESSION_LIST;
    if (!fIsFind) {
        CRITERIA = FILTER_CRITERIA;
        EXPRESSION_LIST = FILTER_EXPRESSION_LIST;
    }
    DialogSettings settings = (DialogSettings) Activator.getDefault().getDialogSettings();
    DialogSettings section = (DialogSettings) settings.getSection(CRITERIA);
    if (section == null) {
        section = (DialogSettings) settings.addNewSection(CRITERIA);
    }
    fCriteria.save(section);

    if (fCriteria.getExpression().length() > 0) {
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < fExpressionList.length; i++) {
            list.add(fExpressionList[i]);
        }
        // Remove the used expression if one from the dropdown list
        list.remove(fCriteria.getExpression());
        // Put the new expression at the beginning
        list.add(0, fCriteria.getExpression());
        // Fill in the expressionList, truncating to MAX_EXPRESSION_LIST
        int size = Math.min(list.size(), MAX_EXPRESSION_LIST);
        String[] temp = new String[size];
        for (int i = 0; i < size; i++) {
            temp[i] = list.get(i);
        }
        fExpressionList = temp;
        settings.put(EXPRESSION_LIST, fExpressionList);
    }
}

From source file:org.eclipse.jst.jsf.ui.internal.project.facet.JSFFacetInstallPage.java

License:Open Source License

private void saveSettings() {
    DialogSettings root = new DialogSettings(SETTINGS_ROOT);
    dialogSettings.addSection(root);//w  w w .  j a  v  a  2s .  c o m

    root.put(SETTINGS_CONFIGURE_SERVLET, getConfigureServlet());
    root.put(SETTINGS_CONFIG, getJSFConfig());
    root.put(SETTINGS_SERVLET, getJSFServletName());
    root.put(SETTINGS_SERVLET_CLASSNAME, getJSFServletClassname());
    DialogSettings mappings = new DialogSettings(SETTINGS_URL_MAPPINGS);
    root.addSection(mappings);
    mappings.put(SETTINGS_URL_PATTERN, getJSFPatterns());
}

From source file:org.eclipse.jst.ws.jaxrs.ui.internal.project.facet.JAXRSFacetInstallPage.java

License:Open Source License

private void saveSettings() {
    DialogSettings root = new DialogSettings(IJAXRSUIConstants.SETTINGS_ROOT);
    dialogSettings.addSection(root);/*from  w  w  w . jav  a2  s  . c  o m*/
    root.put(SETTINGS_SERVLET, getJAXRSServletName());
    LibraryInstallDelegate librariesInstallDelegate = (LibraryInstallDelegate) getDataModel()
            .getProperty(LIBRARY_PROVIDER_DELEGATE);
    root.put(new String(librariesInstallDelegate.getLibraryProvider().getId() + SETTINGS_SERVLET_CLASSNAME),
            getJAXRSServletClassname());
    DialogSettings mappings = new DialogSettings(SETTINGS_URL_MAPPINGS);
    root.addSection(mappings);
    mappings.put(SETTINGS_URL_PATTERN, getJAXRSPatterns());

}