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

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

Introduction

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

Prototype

boolean getBoolean(String name);

Source Link

Document

Returns the current value of the boolean-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");
    }/*from ww w .  jav a2s .  com*/
    return prefs.getString(AnalysisPreferenceIds.MVN_ANALYSIS_JAVAHOME);
}

From source file:com.google.eclipse.protobuf.preferences.general.GeneralPreferences.java

License:Open Source License

public GeneralPreferences(IPreferenceStoreAccess storeAccess, IProject project) {
    IPreferenceStore preferenceStore = storeAccess.getWritablePreferenceStore(project);
    if (!preferenceStore.getBoolean(ENABLE_PROJECT_SETTINGS_PREFERENCE_NAME)) {
        preferenceStore = storeAccess.getWritablePreferenceStore();
    }//  w  ww. j  a v a2s  .  c om
    this.store = preferenceStore;
}

From source file:com.google.eclipse.protobuf.ui.preferences.compiler.CompilerPreferences.java

License:Open Source License

public static CompilerPreferences compilerPreferences(IPreferenceStoreAccess storeAccess, IProject project) {
    IPreferenceStore store = storeAccess.getWritablePreferenceStore(project);
    boolean enableProjectSettings = store.getBoolean(ENABLE_PROJECT_SETTINGS_PREFERENCE_NAME);
    if (!enableProjectSettings) {
        store = storeAccess.getWritablePreferenceStore();
    }/*w  ww .  j a va 2  s.c  om*/
    return new CompilerPreferences(store, project);
}

From source file:com.google.eclipse.protobuf.ui.preferences.general.GeneralPreferences.java

License:Open Source License

public static GeneralPreferences generalPreferences(IPreferenceStoreAccess storeAccess, IProject project) {
    IPreferenceStore store = storeAccess.getWritablePreferenceStore(project);
    boolean enableProjectSettings = store.getBoolean(ENABLE_PROJECT_SETTINGS_PREFERENCE_NAME);
    if (!enableProjectSettings) {
        store = storeAccess.getWritablePreferenceStore();
    }/*from   w ww  . j  a  v a2 s . c om*/
    return new GeneralPreferences(store);
}

From source file:com.google.gdt.eclipse.designer.builders.participant.MyCompilationParticipant.java

License:Open Source License

@Override
protected void addMarkers(List<MarkerInfo> newMarkers, IFile file, ICompilationUnit modelUnit,
        CompilationUnit astUnit) throws Exception {
    // look if checking is enabled
    {// w  w w.  ja  v a 2 s  .  c  om
        IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
        if (!preferenceStore.getBoolean(Constants.P_BUILDER_CHECK_CLIENT_CLASSPATH)) {
            return;
        }
    }
    // check if unit is in source package
    if (!Utils.isModuleSourcePackage((IPackageFragment) modelUnit.getParent())) {
        return;
    }
    //
    {
        ModuleDescription moduleDescription = Utils.getSingleModule(file);
        if (moduleDescription != null) {
            // prepare document
            IDocument document;
            {
                String contents = IOUtils2.readString(file);
                document = new Document(contents);
            }
            // add error markers for not imported types
            IResourcesProvider resourcesProvider = moduleDescription.getResourcesProvider();
            try {
                addMarkers_notImportedTypes(newMarkers, resourcesProvider, moduleDescription, astUnit, file,
                        document);
            } finally {
                resourcesProvider.dispose();
            }
        }
    }
}

From source file:com.google.gdt.eclipse.designer.gxt.databinding.wizards.autobindings.GxtDatabindingProvider.java

License:Open Source License

public String performSubstitutions(String code, ImportsManager imports) throws Exception {
    // bean class, field, name, field access
    String beanClassName = m_beanClass.getName().replace('$', '.');
    String beanClassShortName = ClassUtils.getShortClassName(beanClassName);
    String fieldPrefix = JavaCore.getOption(JavaCore.CODEASSIST_FIELD_PREFIXES);
    String fieldName = fieldPrefix + StringUtils.uncapitalize(beanClassShortName);
    ///*from  w w  w  . ja  v  a 2  s.c om*/
    Collection<String> importList = Sets.newHashSet();
    //
    final List<PropertyAdapter> properties = Lists.newArrayList();
    Display.getDefault().syncExec(new Runnable() {
        public void run() {
            m_packageName = m_firstPage.getPackageFragment().getElementName();
            CollectionUtils.addAll(properties, m_propertiesViewer.getCheckedElements());
        }
    });
    //
    if (!ClassUtils.getPackageName(beanClassName).equals(m_packageName)) {
        importList.add(beanClassName);
    }
    beanClassName = beanClassShortName;
    //
    code = StringUtils.replace(code, "%BeanClass%", beanClassName);
    //
    if (ReflectionUtils.getConstructorBySignature(m_beanClass, "<init>()") == null) {
        code = StringUtils.replace(code, "%BeanField%", fieldName);
    } else {
        code = StringUtils.replace(code, "%BeanField%", fieldName + " = new " + beanClassName + "()");
    }
    //
    IPreferenceStore preferences = ToolkitProvider.DESCRIPTION.getPreferences();
    String accessPrefix = preferences.getBoolean(FieldUniqueVariableSupport.P_PREFIX_THIS) ? "this." : "";
    String beanFieldAccess = accessPrefix + fieldName;
    //
    code = StringUtils.replace(code, "%BeanFieldAccess%", beanFieldAccess);
    code = StringUtils.replace(code, "%BeanName%", StringUtils.capitalize(beanClassShortName));
    //
    boolean useGenerics = CoreUtils.useGenerics(m_javaProject);
    //
    StringBuffer fieldsCode = new StringBuffer();
    StringBuffer widgetsCode = new StringBuffer();
    StringBuffer bindingsCode = new StringBuffer();
    //
    for (Iterator<PropertyAdapter> I = properties.iterator(); I.hasNext();) {
        PropertyAdapter property = I.next();
        Object[] editorData = m_propertyToEditor.get(property);
        GxtWidgetDescriptor widgetDescriptor = (GxtWidgetDescriptor) editorData[0];
        //
        String propertyName = property.getName();
        String widgetClassName = ClassUtils.getShortClassName(widgetDescriptor.getWidgetClass());
        String widgetFieldName = fieldPrefix + propertyName + widgetClassName;
        String widgetFieldAccess = accessPrefix + widgetFieldName;
        //
        if (useGenerics && widgetDescriptor.isGeneric()) {
            widgetClassName += "<" + convertTypes(property.getType().getName()) + ">";
        }
        //
        fieldsCode.append("\r\nfield\r\n\tprivate " + widgetClassName + " " + widgetFieldName + ";");
        //
        widgetsCode.append("\t\t" + widgetFieldName + " = new " + widgetClassName + "();\r\n");
        widgetsCode.append("\t\t" + widgetFieldAccess + ".setFieldLabel(\""
                + StringUtils.capitalize(propertyName) + "\");\r\n");
        widgetsCode.append("\t\t" + accessPrefix + "m_formPanel.add(" + widgetFieldAccess
                + ", new FormData(\"100%\"));\r\n");
        widgetsCode.append("\t\t//");
        //
        importList.add(widgetDescriptor.getBindingClass());
        bindingsCode.append("\t\tm_formBinding.addFieldBinding(new "
                + ClassUtils.getShortClassName(widgetDescriptor.getBindingClass()) + "(" + widgetFieldAccess
                + ",\"" + propertyName + "\"));\r\n");
        //
        importList.add(widgetDescriptor.getWidgetClass());
        //
        if (I.hasNext()) {
            fieldsCode.append("\r\n");
            widgetsCode.append("\r\n");
        }
    }
    //
    bindingsCode.append("\t\t//\r\n");
    bindingsCode.append("\t\tm_formBinding.bind(" + beanFieldAccess + ");");
    // replace template patterns
    code = StringUtils.replace(code, "%WidgetFields%", fieldsCode.toString());
    code = StringUtils.replace(code, "%Widgets%", widgetsCode.toString());
    code = StringUtils.replace(code, "%Bindings%", bindingsCode.toString());
    // add imports
    for (String qualifiedTypeName : importList) {
        imports.addImport(qualifiedTypeName);
    }
    //
    return code;
}

From source file:com.google.gdt.eclipse.designer.launch.JUnitGwtLaunchConfigurationTabGroup.java

License:Open Source License

@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
    super.setDefaults(config);
    try {/*from   w ww.  j  ava2 s . co m*/
        AbstractUIPlugin junitPlugin = JdtUiUtils.getBundleActivator("org.eclipse.jdt.junit");
        IPreferenceStore preferenceStore = junitPlugin.getPreferenceStore();
        String arg = preferenceStore.getBoolean("org.eclipse.jdt.junit.enable_assertions") ? "-ea" : "";
        config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, arg);
    } catch (Exception e) {
        DesignerPlugin.log(e);
    }
}

From source file:com.google.gdt.eclipse.designer.model.property.css.StylesEditComposite.java

License:Open Source License

@Override
protected StyleEditDialog getStyleEditDialog(CssRuleNode rule) {
    StyleEditDialog dialog = super.getStyleEditDialog(rule);
    StyleEditOptions options = dialog.getOptions();
    IPreferenceStore store = Activator.getStore();
    options.useNamedColors = store.getBoolean(Constants.P_CSS_USE_NAMED_COLORS);
    return dialog;
}

From source file:com.google.gdt.eclipse.designer.uibinder.model.widgets.AbsolutePanelInfo.java

License:Open Source License

private boolean useCreationFlow() {
    IPreferenceStore preferences = getDescription().getToolkit().getPreferences();
    return preferences.getBoolean(IPreferenceConstants.P_CREATION_FLOW);
}

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

License:Apache License

public static boolean attemptFetchOfLatestASAPIs() {
    IPreferenceStore preferences = JsfFlexActivator.getDefault().getPreferenceStore();

    return preferences.getBoolean(PreferenceConstants.ATTEMPT_FETCH_OF_LATEST_AS_APIS);
}