Example usage for org.eclipse.jface.wizard WizardDialog addPageChangedListener

List of usage examples for org.eclipse.jface.wizard WizardDialog addPageChangedListener

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard WizardDialog addPageChangedListener.

Prototype

@Override
    public void addPageChangedListener(IPageChangedListener listener) 

Source Link

Usage

From source file:com.codenvy.eclipse.ui.wizard.exporter.ExportProjectToCodenvyWizard.java

License:Open Source License

@Override
public void setContainer(IWizardContainer wizardContainer) {
    super.setContainer(wizardContainer);

    if (wizardContainer != null) {
        final WizardDialog wizardDialog = (WizardDialog) wizardContainer;
        wizardDialog.addPageChangingListener(authenticationWizardPage);
        wizardDialog.addPageChangedListener(workspaceWizardPage);
    }//from w  ww  . j a  va2s . c om
}

From source file:com.codenvy.eclipse.ui.wizard.importer.ImportProjectFromCodenvyWizard.java

License:Open Source License

@Override
public void setContainer(IWizardContainer wizardContainer) {
    super.setContainer(wizardContainer);

    if (wizardContainer != null) {
        final WizardDialog wizardDialog = (WizardDialog) wizardContainer;
        wizardDialog.addPageChangingListener(authenticationWizardPage);
        wizardDialog.addPageChangedListener(projectWizardPage);
    }//w ww.  j  a va2  s  .c o m
}

From source file:com.ibm.xsp.extlib.designer.tooling.palette.calendarview.CalendarViewDropAction.java

License:Open Source License

private Element openConfigurationWizard(Document doc, String prefix) {
    // We must create an element for the panelData
    // We might overwrite this depending on chosen wizard options
    Element element = super.createElement(doc, prefix);

    // Setup the Panel Data
    PanelExtraData panelData = new PanelExtraData();
    panelData.setDesignerProject(getDesignerProject());
    panelData.setNode(element);/*from   ww  w. j  a va  2s  .  c o  m*/
    panelData.setDocument(doc);

    // Launch the Wizard
    Shell shell = getControl().getShell();
    CalendarViewDropWizard wiz = new CalendarViewDropWizard(shell, panelData);
    WizardDialog dialog = new WizardDialog(shell, wiz);
    dialog.addPageChangingListener(wiz);
    dialog.addPageChangedListener(wiz);
    if (WizardDialog.OK != dialog.open()) {
        return null;
    }

    // Return the calendarView or panel
    return (Element) panelData.getNode();
}

From source file:com.ibm.xsp.extlib.designer.tooling.palette.singlepageapp.SinglePageAppDropAction.java

License:Open Source License

private Element openConfigurationWizard(Document doc, String prefix) {

    Shell shell = getControl().getShell();

    // Setup the Panel Data
    Element element = super.createElement(doc, prefix);
    PanelExtraData panelData = new PanelExtraData();
    panelData.setDesignerProject(getDesignerProject());
    panelData.setNode(element);/*from  w w  w  . j a  v a  2  s .  c  om*/

    // Check that the mobile prefix has been configured
    // and that the XPage has the correct prefix
    if (checkXPagePrefix(panelData) == false) {
        return null;
    }

    // Launch the Wizard
    SinglePageAppDropWizard wiz = new SinglePageAppDropWizard(shell, panelData);
    WizardDialog dialog = new WizardDialog(shell, wiz);
    dialog.addPageChangingListener(wiz);
    dialog.addPageChangedListener(wiz);
    if (WizardDialog.OK != dialog.open()) {
        return null;
    }

    return element;
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.actions.AnalyseDirOnlyAction.java

License:Open Source License

/**
 * This method gets invoked when user selects the option,
 * 'Run static analysis for this directory in project...' from
 * the submenu of a folder.//from  w  ww .  j  ava2 s. c  o m
 */
public void run(IAction action) {

    IWorkbenchWindow window = CompatibilityAnalyserPlugin.getDefault().getWorkbench()
            .getActiveWorkbenchWindow();
    ISelection selection = (ISelection) window.getSelectionService().getSelection();

    engine = new CompatibilityAnalyserEngine();
    currentSdk = new ProductSdkData();

    currentSdk.isOpenedFromProject = true;

    try {
        isCancelled = false;
        engine.setHeaderAnalysis(true);
        if (selection instanceof TreeSelection) {
            IStructuredSelection treeSelection = (IStructuredSelection) selection;

            //In Carbide, some folders are instances of ICContainer class. 
            if (treeSelection.getFirstElement() instanceof IFolder
                    || treeSelection.getFirstElement() instanceof ICContainer) {
                IFolder selectedFolder = null;
                ICContainer container = null;
                IProject parentProj = null;

                if (treeSelection.getFirstElement() instanceof IFolder) {
                    selectedFolder = (IFolder) treeSelection.getFirstElement();
                    parentProj = selectedFolder.getProject();
                    folderPath = FileMethods
                            .convertForwardToBackwardSlashes(selectedFolder.getLocation().toString());
                } else if (treeSelection.getFirstElement() instanceof ICContainer) {
                    container = (ICContainer) treeSelection.getFirstElement();
                    parentProj = container.getCProject().getProject();
                    folderPath = FileMethods
                            .convertForwardToBackwardSlashes(container.getResource().getLocation().toString());
                }

                ICarbideBuildManager mngr = CarbideBuilderPlugin.getBuildManager();

                //Selected folder path is added to the list of
                //directories, in Headers page of the wizard.

                if (folderPath != null) {
                    currentSdk.defaultHeaderDir = false;
                    currentSdk.currentHeaderDir = new String[] { folderPath };
                    currentSdk.analyseAll = false;
                } else {
                    MessageDialog.openInformation(Display.getCurrent().getActiveShell(),
                            Messages.getString("ProjectViewPopupAction.CompatibilityAnalyserError"),
                            "Unable to read selected Resource");
                    currentSdk.isOpenedFromProject = false;
                    return;
                }
                if (parentProj != null && mngr.isCarbideProject(parentProj)) {
                    prjInfo = mngr.getProjectInfo(parentProj);
                } else {
                    MessageDialog.openInformation(Display.getCurrent().getActiveShell(),
                            Messages.getString("ProjectViewPopupAction.CompatibilityAnalyserError"),
                            Messages.getString("ProjectViewPopupAction.CouldNotReadInfoFromProject"));
                    currentSdk.isOpenedFromProject = false;
                    return;
                }

                currentSdk.projectName = parentProj.getName();
                currentSdk.productSdkName = prjInfo.getDefaultConfiguration().getSDK().getUniqueId();

                IRunnableWithProgress projProgInfo = new IRunnableWithProgress() {

                    public void run(IProgressMonitor monitor) {

                        try {
                            monitor.beginTask("Reading folder data...", 10);
                            filesList = getHeaderFilesFromFolder(folderPath, monitor);

                            ArrayList<String> sysIncList = new ArrayList<String>();

                            getSystemIncludesFromThisProject(prjInfo, sysIncList, monitor);

                            currentSdk.HeaderFilesList = filesList.toArray(new String[0]);
                            monitor.worked(6);
                            currentSdk.currentIncludes = sysIncList.toArray(new String[0]);

                            if (!isCancelled) {
                                libsList = getCorrespondingDsos(filesList, monitor);
                                monitor.worked(9);
                            }
                            if (libsList.size() != 0) {
                                engine.setLibraryAnalysis(true);
                                currentSdk.analyzeAllLibs = false;
                                currentSdk.libraryFilesList = libsList.toArray(new String[0]);
                            }

                        } catch (Exception e) {
                            e.printStackTrace();
                        }

                        monitor.done();
                    }
                };

                new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true, true, projProgInfo);
            }
        }

        engine.setCurrentSdkData(currentSdk);

    } catch (Exception e) {
        e.printStackTrace();
    }

    if (isCancelled)
        return;

    Runnable showWizardRunnable = new Runnable() {
        public void run() {
            WizardDialog wizDialog;
            AnalysisWizard wiz = new AnalysisWizard(engine);
            wizDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
            wizDialog.create();
            //wizDialog.getShell().setSize(550, 620);
            wizDialog.addPageChangedListener(wiz);
            try {
                wizDialog.open();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };

    Display.getDefault().syncExec(showWizardRunnable);

}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.actions.ProjectViewPopupAction.java

License:Open Source License

public void run(IAction action) {

    engine = new CompatibilityAnalyserEngine();
    ProductSdkData currentSdk = new ProductSdkData();
    engine.setCurrentSdkData(currentSdk);
    isCancelled = false;//from w  ww .j  a v  a 2s . c  om

    IRunnableWithProgress projProgInfo = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) {

            try {
                getSettingsForGivenSelection(selection, engine, monitor);

            } catch (Exception e) {
                e.printStackTrace();
                return;
            }

        }

    };

    try {
        new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true, true, projProgInfo);
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    if (isCancelled)
        return;

    if (engine.isLibraryAnalysisChecked()) {
        currentSdk.analyzeAllLibs = false;
    }
    engine.setCurrentSdkData(currentSdk);

    Runnable showWizardRunnable = new Runnable() {
        public void run() {
            WizardDialog wizDialog;
            //CompatibilityAnalyserEngine engine = new CompatibilityAnalyserEngine();

            AnalysisWizard wiz = new AnalysisWizard(engine);
            wizDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
            wizDialog.create();
            wizDialog.getShell().setSize(wizDialog.getShell().getSize().x,
                    wizDialog.getShell().getSize().y + 70);
            wizDialog.addPageChangedListener(wiz);
            try {
                wizDialog.open();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    };

    Display.getDefault().syncExec(showWizardRunnable);

}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.editors.ComptAnalyserEditLauncher.java

License:Open Source License

public void open(IPath file) {

    try {/*  w  w  w .ja  v a2 s. co  m*/
        document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(file.toString()));
    } catch (SAXException e) {
        Status status = new Status(IStatus.ERROR, "Compatibiliy Analyser", 0, e.getMessage(), null);
        ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Compatibiliy Analyser",
                "Unable to read the configuration", status);
    } catch (IOException e) {
        MessageDialog.openError(Display.getCurrent().getActiveShell(), "Compatibility Analyser",
                "Unable to read the configuration from " + file.toString());
    } catch (ParserConfigurationException e) {
        Status status = new Status(IStatus.ERROR, "Compatibiliy Analyser", 0, e.getMessage(), null);
        ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Compatibiliy Analyser",
                "Unable to read the configuration", status);
    }

    //Parse the given Configuration file
    result = ParserEngine.parseTheConfiguration(document);
    result.getCurrentSdkData().configFileSysPath = file.toString();

    if (result == null) {
        MessageDialog.openError(Display.getCurrent().getActiveShell(), "Compatibility Analyser",
                "Selected file is not a valid configuration file ");
        return;
    } else {
        //Invoke Wizard with data in configuration file
        Runnable showWizardRunnable = new Runnable() {
            public void run() {
                WizardDialog wizDialog;
                AnalysisWizard wiz = new AnalysisWizard(result);
                wiz.setNeedsProgressMonitor(true);
                wizDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
                wizDialog.create();
                //wizDialog.getShell().setSize(550, 680);
                wizDialog.addPageChangedListener(wiz);
                wizDialog.open();
            }
        };

        Display.getDefault().asyncExec(showWizardRunnable);
    }
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.editors.ComptAnalyserLauncher.java

License:Open Source License

public void open(IPath file) {

    try {/*from www.ja v a  2s. co m*/
        Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder()
                .parse(new File(file.toString()));
        engine = ParserEngine.parseTheConfiguration(document);

        String status = validateGivenData(engine);

        if (status != null) {
            boolean query = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(),
                    "Compatibility Analyser",
                    "Invalid Configuration: " + status + "\n Do you want to edit the Configuration file?");

            if (query) {
                engine.getCurrentSdkData().isOpenedFromConfigFile = true;
                engine.getCurrentSdkData().configFileSysPath = file.toString();

                Runnable showWizardRunnable = new Runnable() {
                    public void run() {
                        WizardDialog wizDialog;
                        AnalysisWizard wiz = new AnalysisWizard(engine);
                        wiz.setNeedsProgressMonitor(true);
                        wizDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
                        wizDialog.create();
                        //wizDialog.getShell().setSize(550, 680);
                        wizDialog.addPageChangedListener(wiz);
                        wizDialog.open();
                    }
                };

                Display.getDefault().asyncExec(showWizardRunnable);
            }
            //MessageDialog.openError(Display.getCurrent().getActiveShell(), "Compatibility Analyser", "Invalid Configuration: " + status);
            return;
        }
        runStaticAnalysis(engine);
    } catch (SAXException e) {
        Status status = new Status(IStatus.ERROR, "Compatibiliy Analyser", 0, e.getMessage(), null);
        ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Compatibiliy Analyser",
                "Unable to read the configuration", status);
    } catch (IOException e) {
        MessageDialog.openError(Display.getCurrent().getActiveShell(), "Compatibility Analyser",
                "Unable to read the configuration from " + file.toString());
    } catch (ParserConfigurationException e) {
        Status status = new Status(IStatus.ERROR, "Compatibiliy Analyser", 0, e.getMessage(), null);
        ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Compatibiliy Analyser",
                "Unable to read the configuration", status);
    }
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.views.MainView.java

License:Open Source License

/**
 * Opens the analysis wizard./*www.jav  a  2 s .  co m*/
 *
 */
public void showWizard() {
    //First Check if web server core tools are selected in preferences
    //If yes, check whether core tools are updated or not.
    IPreferenceStore prefStore = CompatibilityAnalyserPlugin.getCompatabilityAnalyserPrefStore();
    String urlInPref = prefStore.getString(CompatibilityAnalyserPreferencesConstants.CORETOOLS_URL);
    boolean webToolsSelected = prefStore.getBoolean(CompatibilityAnalyserPreferencesConstants.WEB_TOOLS);
    if (webToolsSelected && CompatibilityAnalyserEngine.isDownloadAndExtractionNeeded(urlInPref)) {
        //If not, ask for the confirmation
        boolean okPressed = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(),
                "Compatibility Analyser",
                "Core components from Web server are in use.\nPress Ok to download them, or Cancel and change the settings in preferences page.");
        if (okPressed) {
            String status = CompatibilityAnalyserUtils.initiateDownloadingCoreTools();
            if (status != null) {
                status = status + "\n\nNote: Using the different core tools may solve your problem.";
                MessageDialog.openError(tableviewer.getControl().getShell(), "Compatibility Analyser", status);
                return;
            }
        } else {
            return;
        }
    }

    //If the opened from the view, set false 
    Runnable showWizardRunnable = new Runnable() {
        public void run() {
            WizardDialog wizDialog;
            CompatibilityAnalyserEngine engine = new CompatibilityAnalyserEngine();
            AnalysisWizard wiz = new AnalysisWizard(engine);
            wiz.setNeedsProgressMonitor(true);
            wiz.setNeedsProgressMonitor(true);
            wizDialog = new WizardDialog(getViewSite().getShell(), wiz);
            wizDialog.create();
            wizDialog.addPageChangedListener(wiz);
            wizDialog.getShell().setSize(wizDialog.getShell().getSize().x,
                    wizDialog.getShell().getSize().y + 70);
            wizDialog.open();
        }
    };

    Display.getDefault().asyncExec(showWizardRunnable);
}

From source file:com.nokia.s60tools.compatibilityanalyser.ui.views.MainView.java

License:Open Source License

/**
 * Opens the report filter wizard.//  www.  j  ava 2s  .  c o  m
 *
 */
public void showReportFilterWizard(String[] files) {
    selectedReportfilesInViews = files;
    Runnable showWizardRunnable = new Runnable() {
        public void run() {
            WizardDialog wizDialog;
            ReportFilterWizard wiz = new ReportFilterWizard(selectedReportfilesInViews);
            wizDialog = new WizardDialog(getViewSite().getShell(), wiz);
            wizDialog.create();
            wizDialog.getShell().setSize(550, 620);
            wizDialog.addPageChangedListener(wiz);
            wizDialog.open();
        }
    };

    Display.getDefault().asyncExec(showWizardRunnable);
}