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

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

Introduction

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

Prototype

boolean contains(String name);

Source Link

Document

Returns whether the named preference is known to this preference store.

Usage

From source file:com.google.dart.tools.ui.theme.ColorThemeManager.java

License:Open Source License

public void clearImportedThemes() {
    IPreferenceStore store = getPreferenceStore();
    for (int i = 1; store.contains("importedColorTheme" + i); i++) { // $NON-NLS-1$
        store.setToDefault("importedColorTheme" + i); // $NON-NLS-1$
    }//from w  w  w  . jav a  2 s  .c  o m
    themes.clear();
    readStockThemes(themes);
}

From source file:com.google.dart.tools.ui.theme.ColorThemeManager.java

License:Open Source License

/**
 * Adds the color theme to the list and saves it to the preferences. Existing themes will be
 * overwritten with the new content.//from  w w  w .ja  v  a 2 s  . c  o m
 * 
 * @param content The content of the color theme file.
 * @return The saved color theme, or <code>null</code> if the theme was not valid.
 */
public ColorTheme saveTheme(String content) {
    ColorTheme theme;
    try {
        theme = ColorThemeManager.parseTheme(new ByteArrayInputStream(content.getBytes()));
        String name = theme.getName();
        themes.put(name, theme);
        IPreferenceStore store = getPreferenceStore();
        for (int i = 1;; i++) {
            if (!store.contains("importedColorTheme" + i)) { // $NON-NLS-1$
                store.putValue("importedColorTheme" + i, content); // $NON-NLS-1$
                break;
            }
        }
        return theme;
    } catch (Exception e) {
        return null;
    }
}

From source file:com.imperial.fiksen.codesimilarity.compare.ParseTreeMergeViewer.java

License:Open Source License

/**
 * Creates a color from the information stored in the given preference
 * store. Returns <code>null</code> if there is no such information
 * available./*w  ww .j  a  va 2s . c o m*/
 * 
 * @param store
 *            preference store
 * @param key
 *            preference key
 * @return the color or <code>null</code>
 */
private static RGB createColor(IPreferenceStore store, String key) {
    if (!store.contains(key))
        return null;
    if (store.isDefault(key))
        return PreferenceConverter.getDefaultColor(store, key);
    return PreferenceConverter.getColor(store, key);
}

From source file:com.iw.plugins.spindle.editors.SummarySourceViewer.java

License:Mozilla Public License

private void initializeWidgetFont(StyledText styledText) {
    IPreferenceStore store = getPreferenceStore();
    if (store != null) {

        FontData data = null;/*from  w  ww .  jav  a  2 s .  c  o m*/

        if (store.contains(JFaceResources.TEXT_FONT) && !store.isDefault(JFaceResources.TEXT_FONT)) {
            data = PreferenceConverter.getFontData(store, JFaceResources.TEXT_FONT);
        } else {
            data = PreferenceConverter.getDefaultFontData(store, JFaceResources.TEXT_FONT);
        }

        if (data != null) {
            Font font = new Font(styledText.getDisplay(), data);
            styledText.setFont(font);

            if (currentFont != null)
                currentFont.dispose();

            currentFont = font;
            return;
        }
    }

    // if all the preferences failed
    styledText.setFont(JFaceResources.getTextFont());
}

From source file:com.microsoft.tfs.client.common.ui.teambuild.buildstatus.BuildStatusAlerter.java

License:Open Source License

private boolean getPreference(final String preferenceKey) {
    final IPreferenceStore prefs = TFSCommonUIClientPlugin.getDefault().getPreferenceStore();

    if (prefs.contains(preferenceKey)) {
        return prefs.getBoolean(preferenceKey);
    } else {//from w  w  w. j  a  v a 2s  .  com
        return prefs.getDefaultBoolean(preferenceKey);
    }
}

From source file:com.microsoft.tfs.client.common.ui.teambuild.prefs.BuildNotificationPreferencePage.java

License:Open Source License

private void initializeValues() {
    /*/* w  ww .ja  va  2s. c o m*/
     * Note: The interval preference is from the non-UI common client
     * plug-in because BuildStatusManager is in that plug-in and uses the
     * pref directly.
     *
     * TODO Use a non-deprecated method to access the preferences in the
     * non-UI common client plug-in or refactor TFSServer and
     * BuildStatusManager not to use a pref (pass in the value).
     */
    final Preferences nonUIPrefs = TFSCommonClientPlugin.getDefault().getPluginPreferences();

    int refreshIntervalMillis = nonUIPrefs.getInt(PreferenceConstants.BUILD_STATUS_REFRESH_INTERVAL);

    if (refreshIntervalMillis <= 0) {
        refreshIntervalMillis = nonUIPrefs.getDefaultInt(PreferenceConstants.BUILD_STATUS_REFRESH_INTERVAL);
    }

    int refreshIntervalMins = 0;
    if (refreshIntervalMillis > 0) {
        refreshIntervalMins = refreshIntervalMillis / (60 * 1000);
    }
    if (refreshIntervalMins <= 0) {
        refreshIntervalMins = 5;
    }

    refreshTimeText.setText(Integer.toString(refreshIntervalMins));

    /*
     * These prefs are in the UI client with most other prefs.
     */

    final IPreferenceStore uiPrefs = TFSCommonUIClientPlugin.getDefault().getPreferenceStore();

    final boolean notifySuccess = uiPrefs.contains(UIPreferenceConstants.BUILD_NOTIFICATION_SUCCESS)
            ? uiPrefs.getBoolean(UIPreferenceConstants.BUILD_NOTIFICATION_SUCCESS)
            : uiPrefs.getDefaultBoolean(UIPreferenceConstants.BUILD_NOTIFICATION_SUCCESS);

    final boolean notifyPartiallySucceeded = uiPrefs
            .contains(UIPreferenceConstants.BUILD_NOTIFICATION_PARTIALLY_SUCCEEDED)
                    ? uiPrefs.getBoolean(UIPreferenceConstants.BUILD_NOTIFICATION_PARTIALLY_SUCCEEDED)
                    : uiPrefs.getDefaultBoolean(UIPreferenceConstants.BUILD_NOTIFICATION_PARTIALLY_SUCCEEDED);

    final boolean notifyFailure = uiPrefs.contains(UIPreferenceConstants.BUILD_NOTIFICATION_FAILURE)
            ? uiPrefs.getBoolean(UIPreferenceConstants.BUILD_NOTIFICATION_FAILURE)
            : uiPrefs.getDefaultBoolean(UIPreferenceConstants.BUILD_NOTIFICATION_FAILURE);

    notifyBuildSuccessButton.setSelection(notifySuccess);
    notifyBuildPartiallySucceededButton.setSelection(notifyPartiallySucceeded);
    notifyBuildFailureButton.setSelection(notifyFailure);
}

From source file:com.motorolamobility.preflighting.ui.CommandLinePreferencePage.java

License:Apache License

@Override
protected Control createContents(Composite parent) {
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, PREFERENCE_PAGE_HELP);

    pagesComposite = new ArrayList<AbstractAppValidatorTabComposite>();

    IPreferenceStore prefStore = PreflightingUIPlugin.getDefault().getPreferenceStore();
    if ((!prefStore.contains(PreflightingUIPlugin.OUTPUT_LIMIT_VALUE))
            && prefStore.contains(PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_KEY)
            && (!(prefStore.getString(PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_KEY))
                    .equals(PreflightingUIPlugin.DEFAULT_BACKWARD_COMMANDLINE))) {

        Label backLabel = new Label(parent, SWT.WRAP);
        GridData layoutData = new GridData(SWT.FILL, SWT.TOP, true, false);
        layoutData.widthHint = 450;/*from  w  w  w  . ja  va  2 s  .  c om*/
        backLabel.setLayoutData(layoutData);
        backLabel.setText("You have previously set the following App Validator parameters:\n"
                + prefStore.getString(PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_KEY));

    }

    Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(new GridLayout(1, false));
    GridData mainData = new GridData(SWT.FILL, SWT.TOP, true, false);
    mainComposite.setLayoutData(mainData);

    TabFolder tabFolder = new TabFolder(mainComposite, SWT.TOP);

    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));

    TabItem generalSettingsTab = new TabItem(tabFolder, SWT.NONE);
    generalSettingsTab.setText(PreflightingUiNLS.CommandLinePreferencePage_GeneralSettingTabName);
    AbstractAppValidatorTabComposite genSettingsComposite = new GeneralSettingsComposite(tabFolder, SWT.NONE);
    generalSettingsTab.setControl(genSettingsComposite);
    genSettingsComposite.addUIChangedListener(new UIChangedListener() {

        public void uiChanged(AbstractAppValidatorTabComposite composite) {
            validateUI(composite);
        }
    });
    pagesComposite.add(genSettingsComposite);

    TabItem checkersSettingsTab = new TabItem(tabFolder, SWT.NONE);
    checkersSettingsTab.setText(PreflightingUiNLS.CommandLinePreferencePage_Checkers_Tab);
    AbstractAppValidatorTabComposite checkersTabComposite = new CheckersTabComposite(tabFolder, SWT.NONE,
            getPreferenceStore());
    checkersSettingsTab.setControl(checkersTabComposite);
    checkersTabComposite.addUIChangedListener(new UIChangedListener() {

        public void uiChanged(AbstractAppValidatorTabComposite composite) {
            validateUI(composite);
        }
    });
    pagesComposite.add(checkersTabComposite);

    TabItem devicesSettingTab = new TabItem(tabFolder, SWT.NONE);
    devicesSettingTab.setText(PreflightingUiNLS.CommandLinePreferencePage_Devices_Tab);
    AbstractAppValidatorTabComposite devicesTabComposite = new DevicesTabComposite(tabFolder, SWT.NONE,
            getPreferenceStore());
    devicesSettingTab.setControl(devicesTabComposite);
    pagesComposite.add(devicesTabComposite);

    setValid(((GeneralSettingsComposite) genSettingsComposite).canFinish());

    return mainComposite;
}

From source file:com.motorolamobility.preflighting.ui.handlers.AnalyzeApkHandler.java

License:Apache License

public Object execute(ExecutionEvent event) throws ExecutionException {

    IWorkbench workbench = PlatformUI.getWorkbench();
    if ((workbench != null) && !workbench.isClosing()) {
        IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
        if (window != null) {
            ISelection selection = null;
            if (initialSelection != null) {
                selection = initialSelection;
            } else {
                selection = window.getSelectionService().getSelection();
            }//from  w w w.j a v  a  2 s .co m

            if (selection instanceof IStructuredSelection) {
                IStructuredSelection sselection = (IStructuredSelection) selection;
                Iterator<?> it = sselection.iterator();
                String sdkPath = AndroidUtils.getSDKPathByPreference();
                if (monitor != null) {
                    monitor.setTaskName(PreflightingUiNLS.ApplicationValidation_monitorTaskName);
                    monitor.beginTask(PreflightingUiNLS.ApplicationValidation_monitorTaskName,
                            sselection.size() + 1);
                    monitor.worked(1);
                }

                ArrayList<PreFlightJob> jobList = new ArrayList<PreFlightJob>();
                boolean isHelpExecution = false;

                IPreferenceStore preferenceStore = PreflightingUIPlugin.getDefault().getPreferenceStore();

                boolean showMessageDialog = true;
                if (preferenceStore.contains(
                        PreflightingUIPlugin.SHOW_BACKWARD_DIALOG + PreflightingUIPlugin.TOGGLE_DIALOG)) {
                    showMessageDialog = MessageDialogWithToggle.ALWAYS.equals(preferenceStore.getString(
                            PreflightingUIPlugin.SHOW_BACKWARD_DIALOG + PreflightingUIPlugin.TOGGLE_DIALOG));
                }

                if (showMessageDialog && (!preferenceStore.contains(PreflightingUIPlugin.OUTPUT_LIMIT_VALUE))
                        && preferenceStore.contains(PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_KEY)
                        && (!(preferenceStore.getString(PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_KEY))
                                .equals(PreflightingUIPlugin.DEFAULT_BACKWARD_COMMANDLINE))) {
                    String commandLine = PreflightingUIPlugin.getDefault().getPreferenceStore()
                            .getString(PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_KEY);
                    MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(
                            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                            PreflightingUiNLS.AnalyzeApkHandler_BackwardMsg_Title,
                            NLS.bind(PreflightingUiNLS.AnalyzeApkHandler_BackwardMsg_Message, commandLine),
                            PreflightingUiNLS.AnalyzeApkHandler_Do_Not_Show_Again, false, preferenceStore,
                            PreflightingUIPlugin.SHOW_BACKWARD_DIALOG + PreflightingUIPlugin.TOGGLE_DIALOG);

                    int returnCode = dialog.getReturnCode();
                    if (returnCode == IDialogConstants.YES_ID) {
                        EclipseUtils.openPreference(
                                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                                PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_PAGE);
                    }
                }

                String userParamsStr = preferenceStore
                        .getString(PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_KEY);

                downgradeErrors = preferenceStore
                        .contains(PreflightingUIPlugin.ECLIPSE_PROBLEM_TO_WARNING_VALUE)
                                ? preferenceStore
                                        .getBoolean(PreflightingUIPlugin.ECLIPSE_PROBLEM_TO_WARNING_VALUE)
                                : true;

                //we look for a help parameter: -help or -list-checkers
                //in such case we execute app validator only once, 
                //since all executions will have the same output
                if (userParamsStr.length() > 0) {
                    String regex = "((?!(\\s+" + "-" + ")).)*"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                    Pattern pat = Pattern.compile(regex);
                    Matcher matcher = pat.matcher(userParamsStr);
                    while (matcher.find()) {
                        String parameterValues = userParamsStr.substring(matcher.start(), matcher.end());
                        if (parameterValues.equals("-" //$NON-NLS-1$
                                + ApplicationParameterInterpreter.PARAM_HELP) || parameterValues.equals(
                                        "-" //$NON-NLS-1$
                                                + ApplicationParameterInterpreter.PARAM_LIST_CHECKERS)) {
                            isHelpExecution = true;
                        }
                    }
                }
                while (it.hasNext()) {
                    IResource analyzedResource = null;
                    Object resource = it.next();
                    String path = null;
                    if (resource instanceof IFile) {
                        IFile apkfile = (IFile) resource;
                        analyzedResource = apkfile;
                        if (apkfile.getFileExtension().equals("apk") && apkfile.exists() //$NON-NLS-1$
                                && apkfile.getLocation().toFile().canRead()) {
                            /*
                             * For each apk, execute all verifications passaing the two needed parameters
                             */
                            path = apkfile.getLocation().toOSString();
                        } else {
                            MessageDialog.openError(window.getShell(),
                                    PreflightingUiNLS.AnalyzeApkHandler_ErrorTitle,
                                    PreflightingUiNLS.AnalyzeApkHandler_ApkFileErrorMessage);
                        }
                    } else if (resource instanceof File) {
                        File apkfile = (File) resource;

                        if (apkfile.getName().endsWith(".apk") && apkfile.exists() //$NON-NLS-1$
                                && apkfile.canRead()) {
                            /*
                             * For each apk, execute all verifications passaing the two needed parameters
                             */
                            path = apkfile.getAbsolutePath();
                        } else {
                            MessageDialog.openError(window.getShell(),
                                    PreflightingUiNLS.AnalyzeApkHandler_ErrorTitle,
                                    PreflightingUiNLS.AnalyzeApkHandler_ApkFileErrorMessage);
                        }
                        enableMarkers = false;
                    } else if (resource instanceof IProject) {
                        IProject project = (IProject) resource;
                        analyzedResource = project;
                        path = project.getLocation().toOSString();
                    } else if (resource instanceof IAdaptable) {
                        IAdaptable adaptable = (IAdaptable) resource;
                        IProject project = (IProject) adaptable.getAdapter(IProject.class);
                        analyzedResource = project;

                        if (project != null) {
                            path = project.getLocation().toOSString();
                        }
                    }

                    if (path != null) {
                        PreFlightJob job = new PreFlightJob(path, sdkPath, analyzedResource);
                        jobList.add(job);
                        if (isHelpExecution) {
                            //app validator is executed only once for help commands
                            break;
                        }
                    }
                }

                if (enableMarkers) {
                    // Show and activate problems view
                    Runnable showProblemsView = new Runnable() {
                        public void run() {
                            try {
                                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
                                        .showView(PROBLEMS_VIEW_ID);
                            } catch (PartInitException e) {
                                PreflightingLogger.error("Error showing problems view."); //$NON-NLS-1$
                            }

                        }
                    };

                    Display.getDefault().asyncExec(showProblemsView);
                }
                //show console for external apks
                else {
                    showApkConsole();
                }

                ParentJob parentJob = new ParentJob(
                        PreflightingUiNLS.AnalyzeApkHandler_PreflightingToolNameMessage, jobList);
                parentJob.setUser(true);
                parentJob.schedule();

                try {
                    if (monitor != null) {
                        monitor.done();
                    }
                } catch (Exception e) {
                    //Do nothing
                }
            }
        }
    }

    return null;
}

From source file:com.motorolamobility.preflighting.ui.handlers.AnalyzeApkHandler.java

License:Apache License

private int executePreFlightingTool(String path, String sdkPath, IResource analyzedResource,
        StringBuilder strbValidationOutput) {
    int returnValue = EXIT_CODE_OK;
    List<Parameter> parameters = null;

    //Remove app validator markers every time.
    if (enableMarkers) {
        cleanMarkers(analyzedResource);/*from w ww .j ava 2  s . co  m*/
    }

    // set default warning and verbosity levels
    ByteArrayOutputStream verboseOutputStream = new ByteArrayOutputStream();
    PrintStream prtStream = new PrintStream(verboseOutputStream);
    DebugVerboseOutputter.setStream(prtStream);

    DebugVerboseOutputter.setCurrentVerboseLevel(DebugVerboseOutputter.DEFAULT_VERBOSE_LEVEL);
    WarningLevelFilter.setCurrentWarningLevel(WarningLevelFilter.DEFAULT_WARNING_LEVEL);

    DebugVerboseOutputter.printVerboseMessage("", VerboseLevel.v0); //$NON-NLS-1$
    DebugVerboseOutputter.printVerboseMessage("", VerboseLevel.v0); //$NON-NLS-1$
    DebugVerboseOutputter.printVerboseMessage(PreflightingUiNLS.AnalyzeApkHandler_Header, VerboseLevel.v0);
    DebugVerboseOutputter.printVerboseMessage("", VerboseLevel.v0); //$NON-NLS-1$

    IPreferenceStore preferenceStore = PreflightingUIPlugin.getDefault().getPreferenceStore();
    String userParamsStr = null;
    if (preferenceStore.contains(PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_KEY)) {
        userParamsStr = preferenceStore.getString(PreflightingUIPlugin.COMMAND_LINE_PREFERENCE_KEY);
    } else {
        userParamsStr = PreflightingUIPlugin.DEFAULT_COMMANDLINE;
    }

    try {
        if (userParamsStr.length() > 0) {
            CommandLineInputProcessor commandLineInputProcessor = new CommandLineInputProcessor();
            parameters = commandLineInputProcessor.processCommandLine(userParamsStr);
        } else {
            parameters = new ArrayList<Parameter>(5);
        }

        parameters.add(new Parameter(ValidationManager.InputParameter.APPLICATION_PATH.getAlias(), path));

        //If user selected a different SDK, let's use their definition, otherwise we'll pick the SDK currently set
        Parameter sdkParam = new Parameter(ValidationManager.InputParameter.SDK_PATH.getAlias(), null);
        if (!parameters.contains(sdkParam)) {
            parameters.add(new Parameter(ValidationManager.InputParameter.SDK_PATH.getAlias(), sdkPath));
        }

        //If user selected the help, list-checker, list-devices or describe-device parameter, let's clear and use only those parameters
        Parameter helpParam = new Parameter(ApplicationParameterInterpreter.PARAM_HELP, null);
        boolean hasHelpParam = parameters.contains(helpParam);
        Parameter listCheckersParam = new Parameter(ApplicationParameterInterpreter.PARAM_LIST_CHECKERS, null);
        boolean hasListCheckersParam = parameters.contains(listCheckersParam);
        Parameter describeDeviceParam = new Parameter(ApplicationParameterInterpreter.PARAM_DESC_DEVICE, null);
        boolean hasDescribeDeviceParam = parameters.contains(describeDeviceParam);
        Parameter listDevicesParam = new Parameter(ApplicationParameterInterpreter.PARAM_LIST_DEVICES, null);
        boolean hasListDevicesParam = parameters.contains(listDevicesParam);

        if (hasHelpParam || hasListCheckersParam || hasDescribeDeviceParam || hasListDevicesParam) {
            int neededParamIdx = hasHelpParam ? parameters.indexOf(helpParam)
                    : hasListCheckersParam ? parameters.indexOf(listCheckersParam)
                            : hasDescribeDeviceParam ? parameters.indexOf(describeDeviceParam)
                                    : parameters.indexOf(listDevicesParam);
            Parameter parameter = parameters.get(neededParamIdx);
            parameters.clear();
            parameters.add(parameter);
            // Show console
            showApkConsole();
        }

        List<Parameter> parametersCopy = new ArrayList<Parameter>(parameters);

        AbstractOutputter outputter = null;
        for (Parameter param : parametersCopy) {
            if (InputParameter.OUTPUT.getAlias().equals(param.getParameterType())) {
                ApplicationParameterInterpreter.validateOutputParam(param.getValue());
                outputter = OutputterFactory.getInstance().createOutputter(parameters);
                parameters.remove(param);
                break;
            }
        }

        if (outputter == null) {
            outputter = OutputterFactory.getInstance().createOutputter(null);
        }

        ValidationManager validationManager = new ValidationManager();

        if (userParamsStr.length() > 0) {
            ApplicationParameterInterpreter.checkApplicationParameters(parameters, validationManager,
                    prtStream);
        }

        if (!hasHelpParam && !hasListCheckersParam && !hasDescribeDeviceParam && !hasListDevicesParam) {
            List<ApplicationValidationResult> results = validationManager.run(parameters);
            ApplicationValidationResult result = null;

            //inside studio, there won't be any support zip files, thus the map will have only one result 
            for (ApplicationValidationResult aResult : results) {
                result = aResult;
            }

            strbValidationOutput.append(verboseOutputStream.toString());
            if (enableMarkers && (analyzedResource != null) && (result != null)) {
                // Create problem markers
                createProblemMarkers(result.getResults(), analyzedResource);
            }

            if (result != null) {
                ByteArrayOutputStream baos = null;
                try {
                    baos = new ByteArrayOutputStream();
                    outputter.print(result, baos, parameters);
                    strbValidationOutput.append(baos.toString());
                } finally {
                    try {
                        baos.close();
                    } catch (IOException e) {
                        StudioLogger.error("Could not close stream: ", e.getMessage());
                    }
                }

                if ((result.getResults().size() > 0)) {
                    //result already used
                    //clean it to help Garbage Collector to work freeing memory
                    result.getResults().clear();
                    result = null;
                    Runtime.getRuntime().gc();
                }

            }

        } else {
            strbValidationOutput.append(verboseOutputStream.toString());
        }

        try {
            verboseOutputStream.flush();
        } catch (IOException e) {
            StudioLogger.error("Could not flush stream: ", e.getMessage());
        }
    } catch (PreflightingParameterException pe) {
        // only log, do not print message (ValidationManager.run() method already prints
        // each problem individually)
        PreflightingLogger.error(AnalyzeApkHandler.class,
                "Parameter problems executing MOTODEV Studio Application Validator", pe); //$NON-NLS-1$
        strbValidationOutput.append(verboseOutputStream.toString());
        // Show console
        showApkConsole();
        returnValue = EXIT_CODE_TOOL_CONTEXT_ERROR;
    } catch (PreflightingToolException e) {
        PreflightingLogger.error(AnalyzeApkHandler.class,
                "An error ocurred trying to execute MOTODEV Studio Application Validator", e); //$NON-NLS-1$

        strbValidationOutput.append(verboseOutputStream.toString());
        strbValidationOutput
                .append(PreflightingUiNLS.AnalyzeApkHandler_PreflightingApplicationExecutionErrorMessage);
        strbValidationOutput.append(e.getMessage());
        strbValidationOutput.append(NEWLINE);
        returnValue = EXIT_APPLICATION_CONTEXT_ERROR;
        // Show console
        showApkConsole();

    } catch (ParameterParseException e) {
        PreflightingLogger.error(AnalyzeApkHandler.class,
                "An error ocurred trying to execute MOTODEV Studio Application Validator", e); //$NON-NLS-1$

        strbValidationOutput.append(verboseOutputStream.toString());
        strbValidationOutput
                .append(PreflightingUiNLS.AnalyzeApkHandler_PreflightingApplicationExecutionErrorMessage);
        strbValidationOutput.append(e.getMessage());
        strbValidationOutput.append(NEWLINE);

        // Show console
        showApkConsole();
        returnValue = EXIT_CODE_TOOL_CONTEXT_ERROR;
    } finally {
        try {
            verboseOutputStream.close();
            prtStream.close();
        } catch (IOException e) {
            StudioLogger.error("Could not close stream: ", e.getMessage());
        }
    }

    return returnValue;
}

From source file:com.nextep.designer.p2.preferences.LicensePreferencePage.java

License:Open Source License

public LicensePreferencePage() {
    setPreferenceStore(P2Plugin.getDefault().getPreferenceStore());

    // Initialize the default value of auto-update preference
    IPreferenceStore prefs = getPreferenceStore();
    prefs.setDefault(PreferenceConstants.P_AUTO_UPDATE_NEXTEP, true);
    if (prefs.contains(PreferenceConstants.P_AUTO_UPDATE_NEXTEP)) {
        autoUpdate = prefs.getBoolean(PreferenceConstants.P_AUTO_UPDATE_NEXTEP);
    } else {/*from www.j a v a 2s .  co  m*/
        autoUpdate = prefs.getDefaultBoolean(PreferenceConstants.P_AUTO_UPDATE_NEXTEP);
    }
}