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

License:Open Source License

/**
 * Get and set the previous values to the preferences page. 
 *
 *///w ww.  java  2  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.CompatibilityAnalyserPreferences.java

License:Open Source License

public void widgetSelected(SelectionEvent e) {
    if (e.widget == browse1) {
        DirectoryDialog dirDlg = new DirectoryDialog(Display.getCurrent().getActiveShell());
        String dirName = null;//from w  w w  .  j  av a2 s.  com
        if ((dirName = dirDlg.open()) != null) {
            localCmb.setText(dirName);
            displayVersion(localCmb.getText(), Messages.getString("CompatibilityAnalyserPreferences.50")); //$NON-NLS-1$
        } else
            return;
    } else if (e.widget == defaultcoreBtn && defaultcoreBtn.getSelection()) {
        localCmb.setEnabled(false);
        browse1.setEnabled(false);
        webLink.setEnabled(false);
        sdkCmb.setEnabled(false);
        String corePath = FileMethods
                .appendPathSeparator(CompatibilityAnalyserPlugin.getInstallPathOfToolsPlugin())
                + Messages.getString("CompatibilityAnalyserPreferences.51"); //$NON-NLS-1$
        displayVersion(corePath, Messages.getString("CompatibilityAnalyserPreferences.52")); //$NON-NLS-1$

    } else if (e.widget == localcoreBtn && localcoreBtn.getSelection()) {
        localCmb.setEnabled(true);

        SavingUserData userData = new SavingUserData();
        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);
        displayVersion(localCmb.getText(), Messages.getString("CompatibilityAnalyserPreferences.53")); //$NON-NLS-1$

    } else if (e.widget == sdkcoreBtn && sdkcoreBtn.getSelection()) {
        localCmb.setEnabled(false);
        browse1.setEnabled(false);
        webLink.setEnabled(false);
        sdkCmb.setEnabled(true);
        ISymbianSDK[] sdks = rndSdkList.toArray(new ISymbianSDK[0]);
        String toolsPath = null;
        if (sdks.length != 0) {
            sdkCmb.select(0);
            String epocRoot = sdks[sdkCmb.getSelectionIndex()].getEPOCROOT();

            toolsPath = FileMethods.appendPathSeparator(epocRoot)
                    + Messages.getString("CompatibilityAnalyserPreferences.epoc32") + File.separator //$NON-NLS-1$
                    + Messages.getString("CompatibilityAnalyserPreferences.tools") + File.separator + //$NON-NLS-1$
                    Messages.getString("CompatibilityAnalyserPreferences.s60rndtools") + File.separator //$NON-NLS-1$
                    + Messages.getString("CompatibilityAnalyserPreferences.bctools"); //$NON-NLS-1$
        }
        displayVersion(toolsPath, Messages.getString("CompatibilityAnalyserPreferences.58")); //$NON-NLS-1$

    } else if (e.widget == webcoreBtn && webcoreBtn.getSelection()) {
        localCmb.setEnabled(false);
        browse1.setEnabled(false);
        webLink.setEnabled(true);
        sdkCmb.setEnabled(false);

        IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
        String toolsPath = store
                .getString(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_PATH);
        displayVersion(toolsPath, Messages.getString("CompatibilityAnalyserPreferences.60")); //$NON-NLS-1$

    } else if (e.widget == sdkCmb) {
        ISymbianSDK[] sdks = rndSdkList.toArray(new ISymbianSDK[0]);
        String epocRoot = sdks[sdkCmb.getSelectionIndex()].getEPOCROOT();

        String toolsPath = FileMethods.appendPathSeparator(epocRoot)
                + Messages.getString("CompatibilityAnalyserPreferences.epoc32") + File.separator //$NON-NLS-1$
                + Messages.getString("CompatibilityAnalyserPreferences.tools") + File.separator + //$NON-NLS-1$
                Messages.getString("CompatibilityAnalyserPreferences.s60rndtools") + File.separator //$NON-NLS-1$
                + Messages.getString("CompatibilityAnalyserPreferences.bctools"); //$NON-NLS-1$
        displayVersion(toolsPath, Messages.getString("CompatibilityAnalyserPreferences.65")); //$NON-NLS-1$

    } else if (e.widget == refreshBtn) {
        showWebToolsProgressBar();
    }

}

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

License:Open Source License

/**
 * Starts downloading coretools from the URL given.
 * Displays the version of coretools after downloading the tools 
 *
 *///from  w  ww  .j  av a2  s  .c om
public void showWebToolsProgressBar() {
    if (webcoreBtn.getSelection()) {
        currentWebserverPath = webLink.getText();
        if (CompatibilityAnalyserEngine.isDownloadAndExtractionNeeded(currentWebserverPath)) {
            // if true download latest
            IRunnableWithProgress op = new IRunnableWithProgress() {
                public void run(IProgressMonitor monitor) {
                    targetPath = CompatibilityAnalyserEngine.getWorkspacePath() + File.separator
                            + Messages.getString("CompatibilityAnalyserPreferences.WebServerLatest"); //$NON-NLS-1$
                    extractionStatus = CompatibilityAnalyserEngine
                            .readAndDownloadSupportedCoretools(currentWebserverPath, targetPath, monitor);
                }
            };
            IWorkbench wb = PlatformUI.getWorkbench();
            IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
            Shell shell = win != null ? win.getShell() : null;
            try {
                new ProgressMonitorDialog(shell).run(true, true, op);
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            ////After download check the version and display
            if (extractionStatus == null) {
                isRefreshInvoked = true;
                displayVersion(CompatibilityAnalyserEngine.getWebServerToolsPath(),
                        Messages.getString("CompatibilityAnalyserPreferences.67")); //$NON-NLS-1$
            } else {

                if (targetPath != null) {
                    File latest = new File(targetPath);
                    if (latest.exists()) {
                        FileMethods.deleteFolder(latest.getAbsolutePath());
                    }
                }
                MessageDialog.openError(Display.getCurrent().getActiveShell(),
                        Messages.getString("CompatibilityAnalyserPreferences.44"),
                        "Error in Extracting CoreTools: " + extractionStatus);
            }
        } else {
            MessageDialog.openInformation(Display.getCurrent().getActiveShell(),
                    Messages.getString("CompatibilityAnalyserPreferences.69"), //$NON-NLS-1$
                    Messages.getString("CompatibilityAnalyserPreferences.70")); //$NON-NLS-1$
            IPreferenceStore store = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
            String toolsPath = store
                    .getString(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_PATH);
            displayVersion(toolsPath, Messages.getString("CompatibilityAnalyserPreferences.71")); //$NON-NLS-1$
        }
    } else if (localcoreBtn.getSelection()) {
        displayVersion(localCmb.getText(), Messages.getString("CompatibilityAnalyserPreferences.72")); //$NON-NLS-1$
    } else if (sdkcoreBtn.getSelection()) {
        ISymbianSDK[] sdks = rndSdkList.toArray(new ISymbianSDK[0]);
        String toolsPath = null;
        if (sdks.length != 0 && sdkCmb.getSelectionIndex() != -1) {
            String epocRoot = sdks[sdkCmb.getSelectionIndex()].getEPOCROOT();

            toolsPath = FileMethods.appendPathSeparator(epocRoot)
                    + Messages.getString("CompatibilityAnalyserPreferences.epoc32") + File.separator //$NON-NLS-1$
                    + Messages.getString("CompatibilityAnalyserPreferences.tools") + File.separator + //$NON-NLS-1$
                    Messages.getString("CompatibilityAnalyserPreferences.s60rndtools") + File.separator //$NON-NLS-1$
                    + Messages.getString("CompatibilityAnalyserPreferences.bctools"); //$NON-NLS-1$
        }
        displayVersion(toolsPath, Messages.getString("CompatibilityAnalyserPreferences.77")); //$NON-NLS-1$
    } else if (defaultcoreBtn.getSelection()) {
        String corePath = FileMethods
                .appendPathSeparator(CompatibilityAnalyserPlugin.getInstallPathOfToolsPlugin())
                + Messages.getString("CompatibilityAnalyserPreferences.78"); //$NON-NLS-1$
        displayVersion(corePath, Messages.getString("CompatibilityAnalyserPreferences.79")); //$NON-NLS-1$
    }

}

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;// www .  j a  va 2s  .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

public void widgetSelected(SelectionEvent e) {
    if (e.widget == configure) {
        Runnable showDialogRunnable = new Runnable() {
            public void run() {
                IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
                String serverUrl = prefStore
                        .getString(CompatibilityAnalyserPreferencesConstants.KNOWNISSUES_URL);
                KnownissuesDilaog dlg = new KnownissuesDilaog(Display.getCurrent().getActiveShell(), serverUrl);
                dlg.open();/*  ww  w .ja  v a  2  s .  c  o  m*/
            }
        };
        Display.getDefault().syncExec(showDialogRunnable);

        showTextKnownissuesLabel();
        getWizard().getContainer().updateButtons();
    } else if (e.widget == browse) {
        DirectoryDialog dirDialog = new DirectoryDialog(this.getShell());
        String newDir = dirDialog.open();
        if (newDir != null)
            pathCombo.setText(newDir);

        getWizard().getContainer().updateButtons();
    } else if (e.widget == yes) {
        configure.setEnabled(true);
        getWizard().getContainer().updateButtons();
    } else if (e.widget == no) {
        configure.setEnabled(false);
        getWizard().getContainer().updateButtons();
    }
}

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);//  w  w  w . j ava  2  s . com
    }
    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 ww.  j  a va 2s.c o m
    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.BaselineProfileUtils.java

License:Open Source License

/**
 * It is used to get the list of profiles. That includes, last created user profiles and predefined
 * web server profiles./*from   w w  w.j a v  a  2 s  .  com*/
 * @return profile names array
 */
public static String[] getAllBaselinesProfiles() {
    SavingUserData prevData = new SavingUserData();
    String[] lastUsedProfiles = prevData.getPreviousValues(SavingUserData.ValueTypes.PROFILENAME);
    ArrayList<String> final_list = new ArrayList<String>();
    if (lastUsedProfiles != null)
        for (String name : lastUsedProfiles) {
            Object obj = BaselineProfileUtils.getBaselineProfileData(name);
            if (obj instanceof BaselineProfile) {
                BaselineProfile profile = (BaselineProfile) obj;
                if (profile.isPredefined()) {
                    if (BaselineProfileUtils.isBaselineDataExist(profile))
                        final_list.add(name);
                    else
                        deleteProfile(name);
                } else
                    final_list.add(name);
            }
        }
    IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
    String serverUrl = prefStore.getString(CompatibilityAnalyserPreferencesConstants.BASELINES_URL);
    if (!serverUrl.endsWith("/"))
        serverUrl = serverUrl + "/";
    ArrayList<String> webServerProfiles = new ArrayList<String>();

    String status = BaselineProfileUtils.readPredefinedBaselineProfilesFromWebserver(serverUrl, METADATAFILE,
            webServerProfiles);
    if (status == null) {
        //Now combine two lists
        for (String profile : webServerProfiles)
            if (final_list.indexOf(profile) == -1)
                final_list.add(profile);
    }

    return final_list.toArray(new String[0]);
}

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  .  jav  a2 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;
}

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

License:Open Source License

/**
 * Starts the downloading core tools from web server with progress monitor.
 *///from ww w.  ja v  a2 s .  c  o m
public static String initiateDownloadingCoreTools() {
    IRunnableWithProgress op = new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) {
            IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
            String urlInPref = prefStore.getString(CompatibilityAnalyserPreferencesConstants.CORETOOLS_URL);
            //If core tools were already downloaded from web server earlier, they will be deleted. 
            String previousContents = prefStore
                    .getString(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_ROOTDIR);
            if (previousContents != null && !previousContents.equals("")) //$NON-NLS-1$
            {
                File oldContents = new File(previousContents);
                if (oldContents.exists())
                    FileMethods.deleteFolder(previousContents);
            }
            String targetPath = FileMethods.appendPathSeparator(CompatibilityAnalyserEngine.getWorkspacePath())
                    + Messages.getString("HeaderAnalyserEngine.WebServerContentsNew"); //$NON-NLS-1$
            String coreToolsExtraction = CompatibilityAnalyserEngine
                    .readAndDownloadSupportedCoretools(urlInPref, targetPath, monitor);
            if (coreToolsExtraction == null) {
                temp = null;
                prefStore.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_URL,
                        urlInPref);
                prefStore.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_PATH,
                        CompatibilityAnalyserEngine.getWebServerToolsPath());
                prefStore.setValue(CompatibilityAnalyserPreferencesConstants.PREVIOUS_WEB_CORE_TOOLS_ROOTDIR,
                        targetPath);
            } else
                temp = coreToolsExtraction;
        }
    };
    IWorkbench wb = PlatformUI.getWorkbench();
    IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
    Shell shell = win != null ? win.getShell() : null;
    try {
        new ProgressMonitorDialog(shell).run(true, true, op);
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        return "Error!";
    } catch (InterruptedException e) {
        e.printStackTrace();
        return "Error!";
    }

    //If download not successful 
    if (temp != null)
        return temp;

    return null;
}