Example usage for org.eclipse.jface.dialogs PageChangedEvent getSelectedPage

List of usage examples for org.eclipse.jface.dialogs PageChangedEvent getSelectedPage

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs PageChangedEvent getSelectedPage.

Prototype

public Object getSelectedPage() 

Source Link

Document

Returns the selected page.

Usage

From source file:ar.com.fluxit.jqa.wizard.page.AbstractLayerCheckWizardPage.java

License:Open Source License

@Override
public final void pageChanged(PageChangedEvent event) {
    if (event.getSelectedPage() == this) {
        layersTable.refresh(true);//from w  w  w .  j a v a2 s.co m
    }
}

From source file:ar.com.fluxit.jqa.wizard.page.ApisDefinitionWizardPage.java

License:Open Source License

@Override
public void pageChanged(PageChangedEvent event) {
    if (event.getSelectedPage() == this) {
        layersTable.refresh(true);/* ww w .j  a v a 2 s  .co  m*/
    }
}

From source file:ar.com.fluxit.jqa.wizard.page.CommonsTypesDefinitionWizardPage.java

License:Open Source License

@Override
public void pageChanged(PageChangedEvent event) {
    if (event.getSelectedPage() == this) {
        commonTypesTreeViewer.refresh();
        commonTypesTreeViewer.expandAll();
    }//  w  w w.j a  v  a  2 s .c o m
}

From source file:ar.com.fluxit.jqa.wizard.page.NamingDefinitionWizardPage.java

License:Open Source License

@Override
public void pageChanged(PageChangedEvent event) {
    if (event.getSelectedPage() == this) {
        layersTable.refresh(true);/*from w w w .j  av a 2  s.  c  o  m*/
        implPackageText.setText(getWizard().getImplPackageText());
        classPackageText.setText(getWizard().getClassPackageText());
    }
}

From source file:ar.com.fluxit.jqa.wizard.page.UsageDefinitionWizardPage.java

License:Open Source License

@Override
public void pageChanged(PageChangedEvent event) {
    if (event.getSelectedPage() == this) {
        // FIXME if the input has no changes, then not change it on the
        // viewer. The empty list is for a BUG (NullPointerException) on
        // org.eclipse.zest.core.viewers.internal.AbstractStylingModelFactory:325
        viewer.setInput(Collections.emptyList());
        viewer.setInput(getArchitectureDescriptor().getLayers());
    }//from  w ww  .j  ava 2s  .c  o m
}

From source file:cc.warlock.rcp.wizards.WizardWithNotification.java

License:Open Source License

public void pageChanged(PageChangedEvent event) {
    if (currentPage == null) {
        currentPage = (IWizardPage) event.getSelectedPage();
        if (currentPage instanceof WizardPageWithNotification) {
            ((WizardPageWithNotification) currentPage).pageEntered(UNKNOWN);
        }/*  ww  w  .  ja  v  a2  s .co m*/
        return;
    }

    Object selectedPage = event.getSelectedPage();
    IWizardPage previous = currentPage.getPreviousPage();
    IWizardPage next = currentPage.getNextPage();

    if (previous != null && previous.equals(selectedPage)) {
        if (currentPage instanceof WizardPageWithNotification)
            ((WizardPageWithNotification) currentPage).pageExited(PREVIOUS);
        if (selectedPage instanceof WizardPageWithNotification)
            ((WizardPageWithNotification) selectedPage).pageEntered(PREVIOUS);
    } else if (next != null && next.equals(selectedPage)) {
        if (currentPage instanceof WizardPageWithNotification)
            ((WizardPageWithNotification) currentPage).pageExited(NEXT);
        if (selectedPage instanceof WizardPageWithNotification)
            ((WizardPageWithNotification) selectedPage).pageEntered(NEXT);
    } else {
        if (currentPage instanceof WizardPageWithNotification) {
            ((WizardPageWithNotification) currentPage).pageExited(UNKNOWN);
        }
        if (selectedPage instanceof WizardPageWithNotification) {
            ((WizardPageWithNotification) selectedPage).pageEntered(UNKNOWN);
        }
    }
    currentPage = selectedPage instanceof IWizardPage ? ((IWizardPage) selectedPage) : null;
}

From source file:ch.elexis.core.ui.views.rechnung.InvoiceCorrectionView.java

License:Open Source License

/**
 * Copies the actual fall, merge the copied fall with changes, transfer cons, storno the old
 * invoice//w  w  w  .  j av  a  2s.  c o m
 */
private Result<String> doBillCorrection(Rechnung actualInvoice) {
    log.debug("invoice correction: start");
    if (actualInvoice != null && actualInvoice.isCorrectable()) {
        if (actualInvoice.getFall() != null && invoiceCorrectionDTO != null
                && invoiceCorrectionDTO.getFallDTO() != null) {
            try {
                log.debug("invoice correction: invoice number [{}]", actualInvoice.getNr());
                invoiceCorrectionDTO.updateHistory();

                InvoiceCorrectionWizardDialog wizardDialog = new InvoiceCorrectionWizardDialog(
                        getSite().getShell(), invoiceCorrectionDTO);
                wizardDialog.addPageChangedListener(new IPageChangedListener() {

                    @Override
                    public void pageChanged(PageChangedEvent event) {

                        if (event.getSelectedPage() instanceof Page2) {
                            log.debug("invoice correction: processable changes {}",
                                    invoiceCorrectionDTO.getHistory().stream()
                                            .map(item -> item.getOperationType()).collect(Collectors.toList()));
                            Page2 page = (Page2) event.getSelectedPage();
                            InvoiceCorrectionDTO invoiceCorrectionDTO = page.getInvoiceCorrectionDTO();

                            BillingUtil.doBillCorrection(invoiceCorrectionDTO, new BillCallback() {

                                @Override
                                public List<Konsultation> storno(Rechnung rechnung) {
                                    RnDialogs.StornoDialog stronoDlg = new RnDialogs.StornoDialog(
                                            UiDesk.getDisplay().getActiveShell(), rechnung, true);
                                    if (stronoDlg.openDialog() == Dialog.OK) {
                                        return stronoDlg.getKonsultations();
                                    } else {
                                        page.getTxtOutput().setText(
                                                "Die Rechnungskorrektur wurde durch den Benutzer abgebrochen.");
                                        return null;
                                    }
                                }
                            });

                            page.updateProcess();
                            if (invoiceCorrectionDTO.getOutputText() != null) {
                                page.getTxtOutput().setText(invoiceCorrectionDTO.getOutputText());
                            }
                        }
                    }

                });

                wizardDialog.open();
                if (invoiceCorrectionDTO.getOutputText() != null) {

                    setInvoiceCorrectionInfo(actualInvoice);

                    if (invoiceCorrectionDTO.isCorrectionSuccess()) {
                        // set bemerkung text
                        StringBuilder txtBemerkung = new StringBuilder();
                        if (txtBemerkung != null) {
                            txtBemerkung.append(actualInvoice.getBemerkung());
                        }
                        if (txtBemerkung.length() > 0) {
                            txtBemerkung.append("\n");
                        }
                        txtBemerkung.append(invoiceCorrectionDTO.getOutputText());
                        actualInvoice.setBemerkung(txtBemerkung.toString());

                        log.debug("invoice correction: successfully finished");
                        return new Result<String>("ok");
                    }
                    log.debug("invoice correction: failed with warnings");
                    return new Result<String>(SEVERITY.WARNING, 2, "warn", null, false);
                }
            } catch (Exception e) {
                log.error("invoice correction: failed with errors [{}]", actualInvoice.getId(), e);
                setInvoiceCorrectionInfo(actualInvoice);
                return new Result<String>(SEVERITY.ERROR, 2, "error",
                        "Die Rechnungskorrektur konnte nicht vollstndig durchgefhrt werden.\nFr mehr Details, beachten Sie bitte das Log-File.",
                        false);
            }
        }
    }
    return null;
}

From source file:com.aptana.deploy.heroku.ui.wizard.HerokuLoginWizardPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
    setControl(composite);/* w w w  . j  a v  a  2  s  .  c  o  m*/

    initializeDialogUnits(parent);

    // Actual contents
    Label label = new Label(composite, SWT.NONE);
    label.setText(Messages.HerokuLoginWizardPage_EnterCredentialsLabel);

    Composite credentials = new Composite(composite, SWT.NONE);
    credentials.setLayout(new GridLayout(2, false));

    Label userIdLabel = new Label(credentials, SWT.NONE);
    userIdLabel.setText(Messages.HerokuLoginWizardPage_UserIDLabel);
    userId = new Text(credentials, SWT.SINGLE | SWT.BORDER);
    userId.setMessage(Messages.HerokuLoginWizardPage_UserIDExample);
    GridData gd = new GridData(300, SWT.DEFAULT);
    userId.setLayoutData(gd);
    userId.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            getContainer().updateButtons();
        }
    });

    Label passwordLabel = new Label(credentials, SWT.NONE);
    passwordLabel.setText(Messages.HerokuLoginWizardPage_PasswordLabel);
    password = new Text(credentials, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    password.setMessage(Messages.HerokuLoginWizardPage_PasswordExample);
    password.setLayoutData(gd);
    password.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            getContainer().updateButtons();
        }
    });

    Button checkAuth = new Button(credentials, SWT.PUSH);
    checkAuth.setText(Messages.HerokuLoginWizardPage_SubmitButtonLabel);
    checkAuth.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // api.writeCredentials(); // we write them automatically via a page changed listener below...
            if (validateLogin() && isPageComplete()) {
                getContainer().showPage(getNextPage());
            }
        }
    });

    // Signup link
    Link link = new Link(composite, SWT.NONE);
    link.setText(Messages.HerokuLoginWizardPage_SignupLink);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // Open the next dialog page where user can begin signup process!
            IWizardPage signupPage = new HerokuSignupPage(userId.getText());
            signupPage.setWizard(getWizard());
            getContainer().showPage(signupPage);
        }
    });

    Dialog.applyDialogFont(composite);

    // Save credentials if user hit Next too!!!
    IWizardContainer container = getWizard().getContainer();
    ((IPageChangeProvider) container).addPageChangedListener(new IPageChangedListener() {

        public void pageChanged(PageChangedEvent event) {
            Object selected = event.getSelectedPage();
            if (selected instanceof HerokuDeployWizardPage) {
                // If user has moved on to deploy page, write their credentials to a file
                HerokuAPI api = new HerokuAPI(userId.getText(), password.getText());
                api.writeCredentials();
            }
        }
    });
}

From source file:com.bdaum.zoom.csv.internal.wizards.CsvExportWizard.java

License:Open Source License

@Override
public void pageChanged(PageChangedEvent event) {
    Object selectedPage = event.getSelectedPage();
    if (selectedPage instanceof RelabelPage)
        ((RelabelPage) selectedPage).fillViewer();
}

From source file:com.googlecode.osde.internal.editors.GadgetXmlEditor.java

License:Apache License

@Override
protected void addPages() {
    try {/*from   ww w . ja  v a  2 s  .c  om*/
        modulePrefsPage = new ModulePrefsPage(this, module);
        addPage(modulePrefsPage);
        contentsPage = new ContentsPage(this, module);
        addPage(contentsPage);
        messageBundlePage = new LocalePage(this, module);
        addPage(messageBundlePage);
        userPrefsPage = new UserPrefsPage(this, module);
        addPage(userPrefsPage);
        sourceEditor = new StructuredTextEditor() {
            @Override
            public void doSave(IProgressMonitor progressMonitor) {
                try {
                    reflectModel();
                } catch (ParserException e) {
                    logger.warn("Reflecting to the model failed.", e);
                    // Ignore
                } catch (UnsupportedEncodingException e) {
                    logger.warn("Reflecting to the model failed.", e);
                    // Ignore
                }
                commitPages(true);
                super.doSave(progressMonitor);
                editorDirtyStateChanged();
            }
        };
        addPage(sourceEditor, getEditorInput());
        setPageText(4, "Source");
        addPageChangedListener(new IPageChangedListener() {
            public void pageChanged(PageChangedEvent event) {
                Object page = event.getSelectedPage();
                if (page instanceof PageSelectionListener) {
                    ((PageSelectionListener) page).pageSelected();
                }
                Parser<Module> parser = ParserFactory.gadgetSpecParser();
                try {
                    parser.parse(new ByteArrayInputStream(getSource().getBytes("UTF-8")));
                } catch (UnsupportedEncodingException e) {
                    MessageDialog.openError(getSite().getShell(), "Error",
                            "Encoding error in source editor: " + e.getMessage());
                    setActiveEditor(sourceEditor);
                    return;
                } catch (ParserException e) {
                    MessageDialog.openError(getSite().getShell(), "Error", "Syntax error: " + e.getMessage());
                    setActiveEditor(sourceEditor);
                    return;
                }
                if (sourceEditor.isDirty()) {
                    try {
                        reflectModel();
                    } catch (ParserException e) {
                        MessageDialog.openError(getSite().getShell(), "Error",
                                "Parsing error: " + e.getMessage());
                        setActiveEditor(sourceEditor);
                    } catch (UnsupportedEncodingException e) {
                        MessageDialog.openError(getSite().getShell(), "Error",
                                "Encoding error: " + e.getMessage());
                        setActiveEditor(sourceEditor);
                    }
                }
            }
        });
        sourceEditor.getDocumentProvider().getDocument(getEditorInput())
                .addDocumentListener(new IDocumentListener() {
                    public void documentAboutToBeChanged(DocumentEvent event) {
                    }

                    public void documentChanged(DocumentEvent event) {
                        if (outlinePage != null) {
                            outlinePage.refresh();
                        }
                    }
                });
        if (initializeFailed) {
            setActiveEditor(sourceEditor);
        }
    } catch (PartInitException e) {
        throw new IllegalStateException(e);
    }
}