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.nokia.s60tools.compatibilityanalyser.ui.wizards.AddReportFilesPage.java

License:Open Source License

/**
 * Constructs the page//from   w  w  w. jav a 2  s  .c om
 */
public void createControl(Composite parent) {

    Composite composite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(6, false);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label lbl1 = new Label(composite, SWT.NONE);
    lbl1.setText(Messages.getString("AddReportFilesPage.ListofReportFiles")); //$NON-NLS-1$

    GridData data1 = new GridData(GridData.FILL_HORIZONTAL);
    data1.horizontalSpan = 6;
    lbl1.setLayoutData(data1);

    list = new List(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    list.setToolTipText(Messages.getString("AddReportFilesPage.AddReportFiles")); //$NON-NLS-1$
    GridData data2 = new GridData(GridData.FILL_HORIZONTAL);
    data2.horizontalSpan = 6;
    data2.heightHint = 200;
    list.setLayoutData(data2);

    if (this.files != null) {
        list.setItems(files);
    }
    GridData data3 = new GridData(GridData.FILL_HORIZONTAL);
    data3.verticalIndent = 10;
    data3.horizontalSpan = 2;
    addBtn = new Button(composite, SWT.PUSH);
    addBtn.setText(Messages.getString("AddReportFilesPage.AddFiles")); //$NON-NLS-1$
    addBtn.setLayoutData(data3);
    addBtn.addSelectionListener(this);

    removeBtn = new Button(composite, SWT.PUSH);
    removeBtn.setText(Messages.getString("AddReportFilesPage.Remove")); //$NON-NLS-1$
    removeBtn.setLayoutData(data3);
    removeBtn.addSelectionListener(this);

    selectAllBtn = new Button(composite, SWT.PUSH);
    selectAllBtn.setText(Messages.getString("AddReportFilesPage.RemoveAll")); //$NON-NLS-1$
    selectAllBtn.setLayoutData(data3);
    selectAllBtn.addSelectionListener(this);

    Label lbl2 = new Label(composite, SWT.NONE);
    GridData data4 = new GridData(GridData.FILL);
    data4.verticalIndent = 10;
    data4.horizontalSpan = 6;
    lbl2.setText(Messages.getString("AddReportFilesPage.OutputFilesDirectory")); //$NON-NLS-1$
    lbl2.setLayoutData(data4);

    dirCmb = new Combo(composite, SWT.BORDER | SWT.DROP_DOWN);
    GridData data5 = new GridData(GridData.FILL_HORIZONTAL);
    data5.horizontalSpan = 5;
    dirCmb.setLayoutData(data5);

    SavingUserData data = new SavingUserData();
    String[] lastUsedDirs = data.getPreviousValues(SavingUserData.ValueTypes.REPORT_PATH);

    if (lastUsedDirs != null) {
        dirCmb.setItems(lastUsedDirs);
        dirCmb.select(0);
    } else {
        IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
        if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_TOOLS)) {
            dirCmb.setText("C:\\temp"); //$NON-NLS-1$
        } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS)) {
            dirCmb.setText(prefStore.getString(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH)
                    + File.separator + Messages.getString("AddReportFilesPage.reports")); //$NON-NLS-1$
        } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS)) {
            dirCmb.setText(prefStore.getString(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS_PATH)
                    + File.separator + Messages.getString("AddReportFilesPage.reports")); //$NON-NLS-1$
        } else
            dirCmb.setText("C:\\temp"); //$NON-NLS-1$
    }
    dirCmb.addModifyListener(this);

    browseBtn = new Button(composite, SWT.PUSH);
    GridData data8 = new GridData(GridData.FILL_HORIZONTAL);
    browseBtn.setText(Messages.getString("AddReportFilesPage.Browse")); //$NON-NLS-1$
    browseBtn.setLayoutData(data8);
    browseBtn.addSelectionListener(this);

    Group grp = new Group(composite, SWT.NONE);
    grp.setLayout(new GridLayout(2, false));
    grp.setText(Messages.getString("AddReportFilesPage.Knownissues")); //$NON-NLS-1$
    GridData data9 = new GridData(GridData.FILL_HORIZONTAL);
    data9.horizontalSpan = 6;

    grp.setLayoutData(data9);

    label3 = new Label(grp, SWT.WRAP | SWT.VERTICAL);
    GridData data6 = new GridData(GridData.FILL_HORIZONTAL);
    data6.horizontalSpan = 2;
    showTextKnownissuesLabel();
    label3.setLayoutData(data6);

    Label lbl5 = new Label(grp, SWT.WRAP | SWT.SHADOW_OUT);
    lbl5.setText(""); //$NON-NLS-1$

    issuesBtn = new Button(grp, SWT.PUSH);
    issuesBtn.setText(Messages.getString("AddReportFilesPage.ConfigureKnownissuesFile")); //$NON-NLS-1$
    issuesBtn.setToolTipText(Messages.getString("AddReportFilesPage.Tooltip_OPensKnownissuesDialog")); //$NON-NLS-1$
    issuesBtn.addSelectionListener(this);

    setHelp();
    setControl(composite);

}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.AddReportFilesPage.java

License:Open Source License

/**
 * Shows the selected knowissues filename in the wizard.
 *
 *//*from  w  ww .  j  ava  2  s.  c  o  m*/
private void showTextKnownissuesLabel() {
    IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
    if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_ISSUES)) {
        label3.setText(Messages.getString("AddReportFilesPage.DefaultIssuesWillbeused")); //$NON-NLS-1$
    }

    else if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.LATEST_ISSUES)) {
        label3.setText(Messages.getString("AddReportFilesPage.LatestWillbeUsed")); //$NON-NLS-1$
    }

    else if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_ISSUES)) {
        label3.setText(Messages.getString("AddReportFilesPage.SelectedIssuesWillBeUsed")); //$NON-NLS-1$
    }

    else if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_ISSUES)) {
        label3.setText(Messages.getString("AddReportFilesPage.SelectedFromLocal")); //$NON-NLS-1$
    }

}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.AddReportFilesPage.java

License:Open Source License

/**
 * Checkes the status of the page, whether can be finished or not.
 * @return boolean //from   w ww  .  j  av  a  2s. c  om
 */
public boolean canFinish() {
    boolean value = true;
    setErrorMessage(null);
    removeBtn.setEnabled(list.getItemCount() > 0);
    selectAllBtn.setEnabled(list.getItemCount() > 0);
    if (list.getItemCount() == 0) {
        value = false;
        setErrorMessage(Messages.getString("AddReportFilesPage.Error_AddMinOneReport")); //$NON-NLS-1$
    }
    if (dirCmb.getText().length() == 0) {
        value = false;
        setErrorMessage(Messages.getString("AddReportFilesPage.SelectOutPutDir")); //$NON-NLS-1$
    }

    File dir = new File(dirCmb.getText());
    if (!dir.isDirectory()) {
        value = false;
        setErrorMessage(Messages.getString("AddReportFilesPage.InvalidDirectory")); //$NON-NLS-1$
    }

    IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
    String urlInPref = store.getString(CompatibilityAnalyserPreferencesConstants.KNOWNISSUES_URL);

    LastUsedKnownissues data = new LastUsedKnownissues();
    String[] urlInDialog = data.getPreviousValues(LastUsedKnownissues.ValueTypes.WEBSERVER_MAIN_URL);
    if (urlInPref != null && urlInDialog != null
            && store.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_ISSUES)) {
        if (!urlInPref.endsWith("/")) //$NON-NLS-1$
            urlInPref = urlInPref + "/"; //$NON-NLS-1$
        if (!urlInDialog[0].endsWith("/")) //$NON-NLS-1$
            urlInDialog[0] = urlInPref + "/"; //$NON-NLS-1$

        if (!urlInPref.equalsIgnoreCase(urlInDialog[0])) {
            setMessage(Messages.getString("AddReportFilesPage.URLmismatch"), DialogPage.WARNING); //$NON-NLS-1$
        } else
            setMessage(null);
    }

    return value;
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.AnalysisWizard.java

License:Open Source License

public boolean performFinish() {
    engine = new CompatibilityAnalyserEngine();
    currentSdk = new ProductSdkData();

    currentSdk.productSdkName = sdkPage.sdkNameCombo.getText();
    currentSdk.productSdkVersion = sdkPage.versionCombo.getText();
    currentSdk.epocRoot = sdkPage.epocDirectory.getText();

    if (!currentSdk.epocRoot.endsWith("\\"))
        currentSdk.epocRoot = currentSdk.epocRoot + "\\";

    SavingUserData userData = new SavingUserData();

    IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();

    if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_TOOLS)) {
        currentSdk.useDefaultCoreTools = true;
        currentSdk.useLocalCoreTools = false;
        currentSdk.useSdkCoreTools = false;
        currentSdk.useWebServerCoreTools = false;
    } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS)) {
        currentSdk.useDefaultCoreTools = false;
        currentSdk.useLocalCoreTools = true;
        currentSdk.useSdkCoreTools = false;
        currentSdk.useWebServerCoreTools = false;
        currentSdk.coreToolsPath = prefStore
                .getString(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH);
    } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS)) {
        currentSdk.useDefaultCoreTools = false;
        currentSdk.useLocalCoreTools = false;
        currentSdk.useSdkCoreTools = true;
        currentSdk.useWebServerCoreTools = false;
        currentSdk.coreToolsPath = prefStore
                .getString(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS_PATH);
    } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_TOOLS)) {
        currentSdk.useDefaultCoreTools = false;
        currentSdk.useLocalCoreTools = false;
        currentSdk.useSdkCoreTools = false;
        currentSdk.useWebServerCoreTools = true;
        currentSdk.urlPathofCoreTools = prefStore
                .getString(CompatibilityAnalyserPreferencesConstants.CORETOOLS_URL);
    }/*from w  ww  .j a va  2  s . c om*/

    ISymbianSDK selectedSdk = sdkPage.selectedSDK;

    if (selectedSdk.getSDKVersion().toString().equalsIgnoreCase(Messages.getString("AnalysisWizard.13"))) { //$NON-NLS-1$
        userData.saveSDKNameAndVersion(selectedSdk.getUniqueId(), sdkPage.versionCombo.getText());
    }
    if (sdkPage.headersButton.getSelection()) {
        engine.setHeaderAnalysis(true);

        if (headersPage.defaultRootDir.getSelection()) {
            String s = FileMethods.appendPathSeparator(sdkPage.epocDirectory.getText());
            String[] defIncPath = { s + Messages.getString("AnalysisWizard.epoc32Include") };
            currentSdk.currentHeaderDir = defIncPath;
        } else {

            currentSdk.currentHeaderDir = headersPage.getSelectedHdrPaths();
            currentSdk.defaultHeaderDir = false;
            LastUsedKnownissues saveData = new LastUsedKnownissues();
            saveData.saveValues(LastUsedKnownissues.ValueTypes.CURRENT_HEADERS, currentSdk.currentHeaderDir);
        }
        if (!headersPage.allFiles.getSelection()) {
            currentSdk.analyseAll = false;
            int size = headersPage.filesList.getItemCount();
            ArrayList<String> validFiles = new ArrayList<String>();
            ArrayList<String> currentFiles = new ArrayList<String>();

            for (int i = 0; i < size; i++) {
                TableItem item = headersPage.filesList.getItem(i);
                if (!item.getForeground().equals(headersPage.invalidColor)) {
                    currentFiles.add(item.getText(0));
                    if (item.getText(1).equalsIgnoreCase("")) //$NON-NLS-1$
                        validFiles.add(item.getText(0));
                    else
                        validFiles.add(item.getText(1));
                }
            }
            currentSdk.currentFiles = currentFiles.toArray(new String[0]);
            currentSdk.HeaderFilesList = validFiles.toArray(new String[0]);
        }
        if (!headersPage.allTypes.getSelection()) {
            currentSdk.allTypes = false;
            if (headersPage.hType.getSelection())
                currentSdk.hTypes = true;
            if (headersPage.hrhType.getSelection())
                currentSdk.hrhTypes = true;
            if (headersPage.rsgType.getSelection())
                currentSdk.rsgTypes = true;
            if (headersPage.mbgType.getSelection())
                currentSdk.mbgTypes = true;
            if (headersPage.hppType.getSelection())
                currentSdk.hppTypes = true;
            if (headersPage.panType.getSelection())
                currentSdk.panTypes = true;
        }
        if (headersPage.allFiles.getSelection() && !headersPage.useRecursive.getSelection()) {
            currentSdk.useRecursive = false;
        }
        prefStore.setValue(CompatibilityAnalyserPreferencesConstants.USERECURSION_LAST_SELECTION,
                headersPage.useRecursive.getSelection());

        if (headersPage.currentSdkData.usePlatformData) {
            currentSdk.usePlatformData = true;
        }

        if (!isOpenedFromProject)
            prefStore.setValue(CompatibilityAnalyserPreferencesConstants.USEPLATFORMDATA_LAST_SELECTION,
                    headersPage.currentSdkData.usePlatformData);

        if (headersPage.currentSdkData.currentIncludes != null
                && headersPage.currentSdkData.currentIncludes.length > 0) {
            currentSdk.currentIncludes = headersPage.currentSdkData.currentIncludes;
        }

        currentSdk.forcedHeaders = headersPage.currentSdkData.forcedHeaders;

        currentSdk.replaceSet = headersPage.replaceSet;
    }
    if (sdkPage.libsButton.getSelection()) {
        engine.setLibraryAnalysis(true);

        if (libsPage.buildtarget_radioBtn.getSelection()) {
            currentSdk.platfromSelection = true;
            currentSdk.default_platfrom_selection = false;
            currentSdk.selected_library_dirs = false;
            currentSdk.libsTargetPlat = libsPage.selectedPlatform;
            currentSdk.currentLibsDir = new String[currentSdk.libsTargetPlat.length];
            currentSdk.currentDllDir = new String[currentSdk.libsTargetPlat.length];

            for (int i = 0; i < currentSdk.libsTargetPlat.length; i++) {
                currentSdk.currentLibsDir[i] = CompatibilityAnalyserEngine
                        .getLibsPathFromPlatform(sdkPage.selectedSDK, libsPage.selectedPlatform[i]);
                currentSdk.currentDllDir[i] = CompatibilityAnalyserEngine
                        .getDllPathFromPlatform(sdkPage.selectedSDK, libsPage.selectedPlatform[i]);
            }
        } else if (libsPage.userDirs_radioBtn.getSelection()) {
            currentSdk.platfromSelection = false;
            currentSdk.selected_library_dirs = true;
            currentSdk.default_platfrom_selection = false;

            currentSdk.currentLibsDir = libsPage.getSelectedDSOPaths();
            currentSdk.currentDllDir = libsPage.getSelectedDLLPaths();
            LastUsedKnownissues saveData = new LastUsedKnownissues();
            saveData.saveValues(LastUsedKnownissues.ValueTypes.LIBRARY_DIRECTORIES, currentSdk.currentLibsDir);
            saveData.saveValues(LastUsedKnownissues.ValueTypes.DLL_DIRECTORIES, currentSdk.currentDllDir);
        }

        if (!libsPage.analyseAllFiles_radioBtn.getSelection()) {
            currentSdk.analyzeAllLibs = false;
            int size = libsPage.dsoFiles_list.getItemCount();

            currentSdk.libraryFilesList = new String[size];
            for (int i = 0; i < size; i++)
                currentSdk.libraryFilesList[i] = libsPage.dsoFiles_list.getItem(i).getText();
        }
        currentSdk.toolChain = libsPage.selectedToolChain.getName();
        currentSdk.toolChainPath = libsPage.selectedToolChain.getToolChainPath();

    }
    currentSdk.reportName = reportPage.fileName.getText();
    currentSdk.reportPath = reportPage.pathCombo.getText();
    userData.saveValue(SavingUserData.ValueTypes.REPORT_PATH, currentSdk.reportPath);

    currentSdk.filterNeeded = reportPage.yes.getSelection();
    prefStore.setValue(CompatibilityAnalyserPreferencesConstants.FILTER_REPORTS_LAST_SELECTION,
            reportPage.yes.getSelection());
    engine.setCurrentSdkData(currentSdk);
    engine.setBaselineProfile(sdkPage.profileCombo.getText());
    userData.saveValue(SavingUserData.ValueTypes.PROFILENAME, sdkPage.profileCombo.getText());
    prefStore.setValue(CompatibilityAnalyserPreferencesConstants.LAST_USED_BASELINE_PROFILE,
            sdkPage.profileCombo.getText());

    if (isOpenedFromConfigFile) {
        try {
            ParserEngine.saveSettingsToFile(engine, configFilePath);
        } catch (ParserConfigurationException e) {
            MessageDialog.openError(Display.getCurrent().getActiveShell(), "Compatibility Analyser",
                    "Error in saving the configuration " + e.getMessage());
        }
        return true;
    }
    if (!isOpenedFromConfigFile && savePage.isSavingNeeded()) {
        currentSdk.container = savePage.getContainerName();
        currentSdk.configName = savePage.getFileName();

        if (currentSdk.configName != null && !currentSdk.configName.endsWith(".comptanalyser"))
            currentSdk.configName += ".comptanalyser";

        try {
            if (currentSdk.container.length() > 0 && currentSdk.configName.length() > 0) {
                IPath path = new Path(
                        FileMethods.appendPathSeparator(currentSdk.container) + currentSdk.configName);
                IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);

                ParserEngine.saveSettingsToFile(engine, file.getLocation().toString());
            }
        } catch (ParserConfigurationException e) {
            MessageDialog.openError(Display.getCurrent().getActiveShell(), "Compatibility Analyser",
                    "Error in saving the configuration " + e.getMessage());
        }
    }

    String currentDateTime = FileMethods.getDateTime();
    FileMethods.createFolder(
            FileMethods.convertForwardToBackwardSlashes(CompatibilityAnalyserPlugin.stateLocation.toString())
                    + File.separator + currentDateTime);
    currentSdk.setconfigfolder(
            FileMethods.convertForwardToBackwardSlashes(CompatibilityAnalyserPlugin.stateLocation.toString())
                    + File.separator + currentDateTime);

    MainView mainView = MainView.showAndReturnYourself();
    if (mainView != null)
        mainView.startAnalysis(engine);

    return true;
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.CompatibilityAnalyserPreferences.java

License:Open Source License

/**
 * Get and set the previous values to the preferences page. 
 *
 *///from w w w  .j  a va2 s  . c  o m
private void getPrefsStoreValues() {

    IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();

    defaultcoreBtn.setSelection(store.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_TOOLS));
    localcoreBtn.setSelection(store.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS));
    webcoreBtn.setSelection(store.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_TOOLS));
    sdkcoreBtn.setSelection(store.getBoolean(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS));
    if (defaultcoreBtn.getSelection() == true) {
        localCmb.setEnabled(false);
        browse1.setEnabled(false);
        webLink.setEnabled(false);
        sdkCmb.setEnabled(false);

    } else if (localcoreBtn.getSelection() == true) {
        localCmb.setEnabled(true);
        String[] lastUsedDirs = userData.getPreviousValues(SavingUserData.ValueTypes.CORE_PATH);

        if (lastUsedDirs != null) {
            localCmb.setItems(lastUsedDirs);
            localCmb.select(0);
        }

        browse1.setEnabled(true);
        webLink.setEnabled(false);
        sdkCmb.setEnabled(false);

        if (CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH != null
                && !CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH.equals(""))
            localCmb.setText(store.getString(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH));

    }

    else if (webcoreBtn.getSelection() == true) {
        localCmb.setEnabled(false);
        browse1.setEnabled(false);
        webLink.setEnabled(true);
        sdkCmb.setEnabled(false);
        webLink.setText(store.getString(CompatibilityAnalyserPreferencesConstants.CORETOOLS_URL));

        String toolsPath = store
                .getString(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_PATH);
        displayVersion(toolsPath, Messages.getString("CompatibilityAnalyserPreferences.49")); //$NON-NLS-1$
    }

    else if (sdkcoreBtn.getSelection() == true) {
        localCmb.setEnabled(false);
        browse1.setEnabled(false);
        webLink.setEnabled(false);
        sdkCmb.setEnabled(true);
        String prevSDK = store.getString(CompatibilityAnalyserPreferencesConstants.SDK_NAME);

        if (sdkCmb.indexOf(prevSDK) != -1) {
            sdkCmb.select(sdkCmb.indexOf(prevSDK));
        }
    }

    String url2 = store.getString(CompatibilityAnalyserPreferencesConstants.KNOWNISSUES_URL);
    knowniss_webLink.setText(url2);

    baselineTxt.setText(store.getString(CompatibilityAnalyserPreferencesConstants.BASELINES_URL));
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.ReportFileInfoPage.java

License:Open Source License

public void createControl(Composite parent) {

    composite = new Composite(parent, SWT.NULL);
    GridLayout gl = new GridLayout();
    gl.numColumns = 3;//  ww  w.j a  v a  2 s .c  o m
    composite.setLayout(gl);

    GridData gd = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(gd);

    Label nameLabel = new Label(composite, SWT.LEFT);
    nameLabel.setText(Messages.getString("ReportFileInfoPage.ReportFileName")); //$NON-NLS-1$

    fileName = new Text(composite, SWT.BORDER);
    fileName.setToolTipText(Messages.getString("ReportFileInfoPage.CreateReportFileWithGivenName")); //$NON-NLS-1$
    GridData textGD = new GridData(GridData.FILL_HORIZONTAL);
    textGD.horizontalSpan = 2;
    fileName.setLayoutData(textGD);
    fileName.setEnabled(true);

    if (currentSdk.reportName != null)
        fileName.setText(currentSdk.reportName);
    else {
        if (currentSdk.isOpenedFromProject)
            fileName.setText(currentSdk.projectName + "_" + DEFAULT_REPORT_NAME); //$NON-NLS-1$
        else
            fileName.setText(DEFAULT_REPORT_NAME); //$NON-NLS-1$
    }

    fileName.addModifyListener(this);
    Label pathLabel = new Label(composite, SWT.LEFT);

    pathLabel.setText(Messages.getString("ReportFileInfoPage.ReportFilePath")); //$NON-NLS-1$
    pathLabel.setToolTipText(Messages.getString("ReportFileInfoPage.ToolTip_whereYouWantToSaveTheReportFile")); //$NON-NLS-1$
    pathCombo = new Combo(composite, SWT.BORDER);
    GridData pathGD = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    pathCombo.setLayoutData(pathGD);
    pathCombo.setEnabled(true);

    browse = new Button(composite, SWT.PUSH);
    pathGD = new GridData(GridData.HORIZONTAL_ALIGN_END);
    browse.setLayoutData(pathGD);
    browse.setText(Messages.getString("ReportFileInfoPage.Browse")); //$NON-NLS-1$
    browse.addSelectionListener(this);

    IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();

    SavingUserData data = new SavingUserData();
    String[] lastUsedDirs = data.getPreviousValues(SavingUserData.ValueTypes.REPORT_PATH);

    if (lastUsedDirs != null) {
        pathCombo.setItems(lastUsedDirs);
        pathCombo.select(0);
    } else {
        if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_TOOLS)) {
            pathCombo.setText(Messages.getString("ReportFileInfoPage.tempPath")); //$NON-NLS-1$
        } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS)) {
            pathCombo.setText(prefStore.getString(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH)
                    + File.separator + Messages.getString("ReportFileInfoPage.reports")); //$NON-NLS-1$
        } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS)) {
            pathCombo.setText(prefStore.getString(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS_PATH)
                    + File.separator + Messages.getString("ReportFileInfoPage.reports")); //$NON-NLS-1$
        } else
            pathCombo.setText(Messages.getString("ReportFileInfoPage.tempPath")); //$NON-NLS-1$
    }

    if (currentSdk.reportPath != null) {
        if (pathCombo.getItemCount() > 0) {
            for (String s : pathCombo.getItems()) {
                if (currentSdk.reportPath.equals(s)) {
                    pathCombo.select(pathCombo.indexOf(s));
                }
            }
        } else
            pathCombo.setText(currentSdk.reportPath);
    }

    pathCombo.addModifyListener(this);
    createFilterGroup();

    setHelp();
    setControl(composite);

}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.ReportFileInfoPage.java

License:Open Source License

private void showTextKnownissuesLabel() {
    IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
    if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_ISSUES)) {
        label.setText(Messages.getString("ReportFileInfoPage.Knownissues_Default")); //$NON-NLS-1$
    }/*from www. jav  a  2 s.c  o m*/

    else if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.LATEST_ISSUES)) {
        label.setText(Messages.getString("ReportFileInfoPage.Knownissues_Latest")); //$NON-NLS-1$
    }

    else if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_ISSUES)) {
        label.setText(Messages.getString("ReportFileInfoPage.Knownissues_Webserver")); //$NON-NLS-1$
    }

    else if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_ISSUES)) {
        label.setText(Messages.getString("ReportFileInfoPage.Knownissues_Local")); //$NON-NLS-1$
    }
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.ReportFileInfoPage.java

License:Open Source License

public boolean canFlipToNextPage() {
    this.setErrorMessage(null);
    this.setMessage(null);

    if (fileName.getText().length() == 0) {
        this.setMessage(Messages.getString("ReportFileInfoPage.ReportFileNameCanNotBeNull"), //$NON-NLS-1$
                DialogPage.WARNING);//from  ww w. j  a  v a2 s . c o  m
    }
    if (pathCombo.getText().length() == 0) {
        this.setErrorMessage(Messages.getString("ReportFileInfoPage.ReportFilePathCanNotBeNull")); //$NON-NLS-1$
        return false;
    }
    if (pathCombo.getText().length() > 0) {
        File file = new File(pathCombo.getText());

        if (!(file.exists() && file.isDirectory())) {
            this.setErrorMessage(Messages.getString("ReportFileInfoPage.InvalidPath")); //$NON-NLS-1$
            return false;
        } else {
            String fullPath = null;
            ProductSDKSelectionPage productPage = (ProductSDKSelectionPage) this.getWizard().getStartingPage();
            isHeaderSelected = productPage.isHeaderAnalysisSelected();
            isLibrarySelected = productPage.isLibraryAnalysisSelected();

            if (isHeaderSelected) {
                fullPath = pathCombo.getText() + File.separator
                        + Messages.getString("HeaderAnalyserEngine.Headers_") + fileName.getText() + ".xml";
            } else if (isLibrarySelected) {
                fullPath = pathCombo.getText() + File.separator
                        + Messages.getString("LibraryAnalyserEngine.Libraries_") + fileName.getText() + ".xml";
            }
            if (fullPath != null && new File(fullPath).exists())
                this.setMessage(Messages.getString("ReportFilterLineReader.ReortFile_AlreadyExist_Warning"), //$NON-NLS-1$
                        DialogPage.WARNING); //)
        }
    }

    if (yes.getSelection()) {
        IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
        String urlInPref = store.getString(CompatibilityAnalyserPreferencesConstants.KNOWNISSUES_URL);

        LastUsedKnownissues data = new LastUsedKnownissues();
        String[] urlInDialog = data.getPreviousValues(LastUsedKnownissues.ValueTypes.WEBSERVER_MAIN_URL);
        if (urlInPref != null && urlInDialog != null
                && store.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_ISSUES)) {
            if (!urlInPref.endsWith("/")) //$NON-NLS-1$
                urlInPref = urlInPref + "/"; //$NON-NLS-1$
            if (!urlInDialog[0].endsWith("/")) //$NON-NLS-1$
                urlInDialog[0] = urlInPref + "/"; //$NON-NLS-1$

            if (!urlInPref.equalsIgnoreCase(urlInDialog[0])) {
                setMessage(Messages.getString("ReportFileInfoPage.URLmismatch"), DialogPage.WARNING); //$NON-NLS-1$
            } else
                setMessage(null);
        }
    }

    if (currentSdk.isOpenedFromConfigFile)
        return false;

    return true;
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.wizards.ReportFilterWizard.java

License:Open Source License

@Override
public boolean performFinish() {

    String[] fileNames = reportPage.list.getItems();
    data.reportFiles.clear();//from w  w  w. ja  v  a2  s  . com
    for (int i = 0; i < fileNames.length; i++) {
        data.reportFiles.add(fileNames[i]);
    }

    data.outputDir = reportPage.dirCmb.getText();
    SavingUserData saveData = new SavingUserData();
    saveData.saveValue(SavingUserData.ValueTypes.REPORT_PATH, data.outputDir);
    //getting the tools path
    IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
    if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_TOOLS)) {
        data.useDefaultCoreTools = true;
        data.useLocalCoreTools = false;
        data.useSdkCoreTools = false;
        data.useWebServerCoreTools = false;
    } else if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS)) {
        data.useDefaultCoreTools = false;
        data.useLocalCoreTools = true;
        data.useSdkCoreTools = false;
        data.useWebServerCoreTools = false;
        data.bcFilterPath = store.getString(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH);
    } else if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS)) {
        data.useDefaultCoreTools = false;
        data.useLocalCoreTools = false;
        data.useSdkCoreTools = true;
        data.useWebServerCoreTools = false;
        data.bcFilterPath = store.getString(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS_PATH);
    } else if (store.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_TOOLS)) {
        data.useDefaultCoreTools = false;
        data.useLocalCoreTools = false;
        data.useSdkCoreTools = false;
        data.useWebServerCoreTools = true;
    }

    String currentDateTime = FileMethods.getDateTime();
    FileMethods.createFolder(
            FileMethods.convertForwardToBackwardSlashes(CompatibilityAnalyserPlugin.stateLocation.toString())
                    + File.separator + currentDateTime);
    data.setconfigfolder(
            FileMethods.convertForwardToBackwardSlashes(CompatibilityAnalyserPlugin.stateLocation.toString())
                    + File.separator + currentDateTime);

    MainView mainView = MainView.showAndReturnYourself();
    if (mainView != null) {
        mainView.startFilteration(data);
    }
    return true;
}

From source file:com.nokia.s60tools.compatibilityanalyser.utils.CompatibilityAnalyserUtils.java

License:Open Source License

/**
 * Gets the path of core tools selected in preferences.
 * @return path of core tools/*from   w  w  w . j av a  2 s.co  m*/
 */
private static String getSelectedCoretoolsPath() {
    String path = null;
    IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
    if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.DEFAULT_TOOLS)) {
        path = FileMethods.appendPathSeparator(CompatibilityAnalyserPlugin.getInstallPathOfToolsPlugin())
                + Messages.getString("HeaderAnalyserEngine.BCTools");
    } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS)) {
        path = prefStore.getString(CompatibilityAnalyserPreferencesConstants.LOCAL_TOOLS_PATH);
    } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS)) {
        path = prefStore.getString(CompatibilityAnalyserPreferencesConstants.SDK_TOOLS_PATH);
    } else if (prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_TOOLS)) {
        path = prefStore.getString(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_PATH);
    }

    if ((new File(path).exists()))
        return path;

    return null;
}