Example usage for org.eclipse.jface.preference IPreferenceStore getString

List of usage examples for org.eclipse.jface.preference IPreferenceStore getString

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore getString.

Prototype

String getString(String name);

Source Link

Document

Returns the current value of the string-valued preference with the given name.

Usage

From source file:com.google.devtools.depan.maven.eclipse.NewMavenPomWizard.java

License:Apache License

private String getJavaHome(IPreferenceStore prefs) {
    boolean useSystemJava = prefs.getBoolean(AnalysisPreferenceIds.MVN_ANALYSIS_SYSTEMJAVA);
    if (useSystemJava) {
        return System.getProperty("java.home");
    }//w w w. j a v  a  2s  .  c o m
    return prefs.getString(AnalysisPreferenceIds.MVN_ANALYSIS_JAVAHOME);
}

From source file:com.google.gdt.eclipse.designer.gxt.actions.ConfigureExtGwtAction.java

License:Open Source License

/**
 * @return the folder with "gwt.jar" file, or <code>null</code> if user cancelled selection.
 *//*from   w ww  .  j av  a 2 s  . com*/
private static String getLibraryLocation() {
    IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
    String libraryLocation = preferenceStore.getString(LOCATION_KEY);
    while (true) {
        DirectoryDialog directoryDialog = new DirectoryDialog(DesignerPlugin.getShell());
        directoryDialog.setText("Ext GWT Location");
        directoryDialog.setMessage("Choose folder with extracted Ext GWT, it should have gxt.jar file.\n"
                + "You can download it from http://www.extjs.com/products/gxt/");
        directoryDialog.setFilterPath(libraryLocation);
        libraryLocation = directoryDialog.open();
        // cancel
        if (libraryLocation == null) {
            return null;
        }
        // check for "gxt.jar" file
        {
            String jarPath = ConfigureExtGwtOperation.getJarPath(libraryLocation);
            File file = new File(jarPath);
            if (!file.exists() || !file.isFile()) {
                MessageDialog.openError(null, "Invalid folder", "No gxt.jar file in choosen folder.");
                continue;
            }
        }
        // check for "resources" directory
        {
            File file = new File(libraryLocation + "/resources");
            if (!file.exists() || !file.isDirectory()) {
                MessageDialog.openError(null, "Invalid folder", "No 'resources' directory in choosen folder.\n"
                        + "Just gxt.jar file is not enough, we need also images and CSS files.");
                continue;
            }
        }
        // OK
        preferenceStore.setValue(LOCATION_KEY, libraryLocation);
        return libraryLocation;
    }
}

From source file:com.google.gdt.eclipse.designer.model.LayoutDataNameSupport.java

License:Open Source License

@Override
protected String getTemplate() {
    IPreferenceStore preferences = m_childInfo.getDescription().getToolkit().getPreferences();
    String template = preferences.getString(IPreferenceConstants.P_LAYOUT_DATA_NAME_TEMPLATE);
    if (!isValidTemplate(TEMPLATES, template)) {
        template = getTemplateForDefault();
    }/*  w w w .  jav  a2  s  . c  om*/
    return template;
}

From source file:com.google.gdt.eclipse.designer.model.LayoutNameSupport.java

License:Open Source License

@Override
protected String getTemplate() {
    IPreferenceStore preferences = m_childInfo.getDescription().getToolkit().getPreferences();
    String template = preferences.getString(IPreferenceConstants.P_LAYOUT_NAME_TEMPLATE);
    if (!isValidTemplate(TEMPLATES, template)) {
        template = getTemplateForDefault();
    }//from  ww  w  .j a v a  2  s.  c  o  m
    return template;
}

From source file:com.google.gdt.eclipse.designer.smart.actions.ConfigureSmartGwtAction.java

License:Open Source License

/**
 * @return the folder with "gwt.jar" file, or <code>null</code> if user cancelled selection.
 *//*from w  ww .j  av a  2s.com*/
private static String getLibraryLocation() {
    IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
    String libraryLocation = preferenceStore.getString(LOCATION_KEY);
    while (true) {
        DirectoryDialog directoryDialog = new DirectoryDialog(DesignerPlugin.getShell());
        directoryDialog.setText("Smart GWT Location");
        directoryDialog.setMessage("Choose folder with extracted SmartGWT, it should have smartgwt.jar file.\n"
                + "You can download it from http://code.google.com/p/smartgwt/");
        directoryDialog.setFilterPath(libraryLocation);
        libraryLocation = directoryDialog.open();
        // cancel
        if (libraryLocation == null) {
            return null;
        }
        // check for "gxt.jar" file
        {
            File file = new File(libraryLocation + "/smartgwt.jar");
            if (!file.exists() || !file.isFile()) {
                MessageDialog.openError(null, "Invalid folder", "No smartgwt.jar file in choosen folder.");
                continue;
            }
        }
        // OK
        preferenceStore.setValue(LOCATION_KEY, libraryLocation);
        return libraryLocation;
    }
}

From source file:com.google.inject.tools.ideplugin.eclipse.EclipseJavaProject.java

License:Apache License

@Override
public IDEPluginSettings loadSettings() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    IDEPluginSettings settings = new IDEPluginSettings(store.getString(PluginDefinitionValues.PREFERENCES_ID));
    return settings;
}

From source file:com.googlecode.jsfflexeclipseplugin.model.JsfFlexCacheManager.java

License:Apache License

public static String getLatestASAPIsURL() {
    IPreferenceStore preferences = JsfFlexActivator.getDefault().getPreferenceStore();

    return preferences.getString(PreferenceConstants.LATEST_AS_APIS_URL);
}

From source file:com.googlecode.osde.internal.runtime.RunExternalApplicationDialog.java

License:Apache License

private void setDefaultValues() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    boolean measurePerformance = store.getBoolean(PREF_MEASURE_PERFORMANCE);
    measurePerformanceCheck.setSelection(measurePerformance);
    measurePerformanceCheck.notifyListeners(SWT.Selection, null);

    String joinedUrls = store.getString(PREF_URL);
    if (StringUtils.isNotEmpty(joinedUrls)) {
        String[] urls = StringUtils.split(joinedUrls, "|");
        Arrays.sort(urls);//  ww w.  ja va  2 s.  c o  m
        for (String url : urls) {
            urlCombo.add(url);
            this.urls.add(url);
        }
    } else {
        urlCombo.add(DEV_APP);
        this.urls.add(DEV_APP);
    }
    String prevCountry = store.getString(PREF_COUNTRY);
    if (StringUtils.isNotEmpty(prevCountry) && StringUtils.isNumeric(prevCountry)) {
        countries.select(Integer.parseInt(prevCountry));
    }
    String prevLang = store.getString(PREF_LANG);
    if (StringUtils.isNotEmpty(prevLang) && StringUtils.isNumeric(prevLang)) {
        languages.select(Integer.parseInt(prevLang));
    }
    String prevOwner = store.getString(PREF_OWNER);
    if (StringUtils.isNotEmpty(prevOwner) && StringUtils.isNumeric(prevOwner)) {
        owners.select(Integer.parseInt(prevOwner));
    }
    String prevViewer = store.getString(PREF_VIEWER);
    if (StringUtils.isNotEmpty(prevViewer) && StringUtils.isNumeric(prevViewer)) {
        viewers.select(Integer.parseInt(prevViewer));
    }
    String prevView = store.getString(PREF_VIEW);
    if (StringUtils.isNotEmpty(prevView) && StringUtils.isNumeric(prevView)) {
        viewKind.select(Integer.parseInt(prevView));
    }
    String prevWidth = store.getString(PREF_WIDTH);
    if (StringUtils.isNotEmpty(prevWidth) && StringUtils.isNumeric(prevWidth)) {
        widths.setSelection(Integer.parseInt(prevWidth));
    }
    String prevNotUseSecurityToken = store.getString(PREF_NOT_USE_SECURITY_TOKEN);
    if (StringUtils.isNotEmpty(prevNotUseSecurityToken)) {
        notUseSecurityTokenCheck.setSelection(Boolean.parseBoolean(prevNotUseSecurityToken));
    }
}

From source file:com.gorillalogic.monkeyconsole.editors.utils.MonkeyTalkUtils.java

License:Open Source License

public static void setDefaultUPFromClassPath() throws IOException {
    IPreferenceStore preferenceStore = FoneMonkeyPlugin.getDefault().getPreferenceStore();
    String pass = preferenceStore.getString(PreferenceConstants.P_CLOUDPASS);
    String username = preferenceStore.getString(PreferenceConstants.P_CLOUDUSR);
    if ((username + pass).trim().equalsIgnoreCase("")) {
        Properties rb = getPropertiesFromClasspath("com/gorillalogic/cloud/ideversion/credentials.properties");
        preferenceStore.setValue(PreferenceConstants.P_CLOUDPASS, rb.getProperty("password"));
        preferenceStore.setValue(PreferenceConstants.P_CLOUDUSR, rb.getProperty("username"));
    }//from  w  w w . ja  v a 2s . co m
}

From source file:com.halware.nakedide.eclipse.core.logging.LogController.java

License:Open Source License

/**
 * Constructor starts listening on preference store and sets up initial
 * logging state/*from   www  . ja v  a  2  s  .  c  o m*/
 */
public LogController() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    store.setDefault(LogController.SOCKET_APPENDER_HOST_NAME_KEY,
            LogController.SOCKET_APPENDER_DEFAULT_HOST_NAME);
    store.setDefault(LogController.SOCKET_APPENDER_PORT_KEY, LogController.SOCKET_APPENDER_DEFAULT_PORT);

    store.addPropertyChangeListener(this);
    boolean appenderAdded = false;

    if (store.getBoolean(LogController.CONSOLE_APPENDER_KEY)) {
        addConsoleAppender();
        appenderAdded = true;
    }
    if (store.getBoolean(LogController.SOCKET_APPENDER_KEY)) {
        addSocketAppender();
        appenderAdded = true;
    }
    if (!appenderAdded) {
        // prevent 'no appender' error messages by log4j
        Logger.getRootLogger().addAppender(new NullAppender());
    }
    setLevel(store.getString(LogController.LEVEL_KEY));
}