Example usage for org.eclipse.jface.wizard IWizardContainer updateMessage

List of usage examples for org.eclipse.jface.wizard IWizardContainer updateMessage

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard IWizardContainer updateMessage.

Prototype

public void updateMessage();

Source Link

Document

Updates the message (or error message) shown in the message line to reflect the state of the currently active page in this container.

Usage

From source file:org.bbaw.pdr.ae.export.swt.FileSelectionGroup.java

License:Open Source License

/**
 * Mark this widget valid. Also make wizardcontainer update its controls, which
 * means that the responsible wizard is made to reevaluate its 
 * {@link IWizard#canFinish()}, which can be overwritten in order to consider
 * the {@link IPdrWidgetStructure#isValid()} status of further widgets involved. 
 *///  w w  w.ja v a  2 s  .c o  m
private void setValid() {
    isvalid = true;
    this.message = null;
    IWizardContainer wizardContainer = this.wizardPage.getWizard().getContainer();
    try {
        wizardContainer.updateButtons();
        wizardContainer.updateMessage();
    } catch (Exception e) {
        log.log(new Status(IStatus.WARNING, CommonActivator.PLUGIN_ID,
                " Wizard noch nicht bereit? " + wizardPage.getClass().getCanonicalName()));
    }
}

From source file:org.bbaw.pdr.ae.export.swt.FileSelectionGroup.java

License:Open Source License

/**
 * Mark this widget invalid./*w w  w  . ja va 2  s.  c  om*/
 * @param message Complementary error message.
 */
private void setInvalid(String message) {
    //System.out.println("Mark file selector as invalid");
    isvalid = false;
    this.message = message;
    IWizardContainer wizardContainer = this.wizardPage.getWizard().getContainer();
    wizardContainer.updateButtons();
    wizardContainer.updateMessage();
}

From source file:org.bbaw.pdr.ae.export.swt.PdrSelectionPreview.java

License:Open Source License

/**
 * Mark this widget invalid.//from   w  ww .  j av  a2s .  c  o  m
 * @param message Complementary error message.
 */
private void setInvalid(String message) {
    if (isvalid)
        if (message != null && !message.equals(this.message)) {
            System.out.println("Mark previewer as invalid");
            isvalid = false;
            this.message = message;
            IWizardContainer wizardContainer = this.wizardPage.getWizard().getContainer();
            wizardContainer.updateButtons();
            wizardContainer.updateMessage();
        }
}

From source file:org.bbaw.pdr.ae.export.swt.PdrSelectionPreview.java

License:Open Source License

/**
 * Mark this widget valid/*from www  .j ava  2s.c om*/
 */
private void setValid() {
    if (!isvalid) {
        isvalid = true;
        this.message = null;
        IWizardContainer wizardContainer = this.wizardPage.getWizard().getContainer();
        wizardContainer.updateButtons();
        wizardContainer.updateMessage();
    }
}

From source file:org.bbaw.pdr.ae.export.swt.preview.PdrSelectionFilterPreview.java

License:Open Source License

/**
 * Mark this widget invalid./*www . j  a  v  a  2 s .c o  m*/
 * @param message Complementary error message.
 */
private void setInvalid(String message) {
    if (isvalid)
        if (message != null && !message.equals(this.message)) {
            log.log(new Status(IStatus.INFO, CommonActivator.PLUGIN_ID, "Mark previewer as invalid"));
            isvalid = false;
            this.message = message;
            IWizardContainer wizardContainer = this.wizardPage.getWizard().getContainer();
            wizardContainer.updateButtons();
            wizardContainer.updateMessage();
        }
}

From source file:org.bbaw.pdr.ae.export.swt.preview.PdrSelectionFilterPreview.java

License:Open Source License

/**
 * Mark this widget valid//from w  w  w . ja va 2s.c  om
 */
private void setValid() {
    log.log(new Status(IStatus.INFO, CommonActivator.PLUGIN_ID, "Preview selection is valid."));
    if (!isvalid) {
        isvalid = true;
        this.message = null;
        IWizardContainer wizardContainer = this.wizardPage.getWizard().getContainer();
        wizardContainer.updateButtons();
        wizardContainer.updateMessage();
    }
}

From source file:org.eclipse.tcf.te.ui.controls.net.RemoteHostAddressControl.java

License:Open Source License

/**
 * If the user entered a host name, we have to validate that we can really resolve the name
 * to an IP address. Because this may really take a while, give the user the feedback what
 * we are actually doing.//from ww w. j  a v a  2s. co m
 */
private void onCheckAddress() {
    ProgressMonitorDialog dialog = new ProgressMonitorDialog(getParentControl().getShell());
    try {
        dialog.run(false, false, new IRunnableWithProgress() {
            private final String address = getEditFieldControlText();
            private final Control control = getEditFieldControl();
            private final IDialogPage parentPage = getParentPage();

            /* (non-Javadoc)
             * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
             */
            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    monitor.setTaskName(getTaskNameCheckNameAddress());
                    InetAddress[] addresses = InetAddress.getAllByName(address);
                    if (Platform.inDebugMode() && addresses != null) {
                        StringBuilder message = new StringBuilder();
                        message.append("RemoteHostAddressControl: Name '"); //$NON-NLS-1$
                        message.append(address);
                        message.append("' resolves to: "); //$NON-NLS-1$
                        boolean firstAddress = true;
                        for (InetAddress address : addresses) {
                            if (!firstAddress)
                                message.append(", "); //$NON-NLS-1$
                            message.append(address.getHostAddress());
                            firstAddress = false;
                        }

                        IStatus status = new Status(IStatus.WARNING, UIPlugin.getUniqueIdentifier(),
                                message.toString());
                        UIPlugin.getDefault().getLog().log(status);
                    }

                    setCheckResultMessage(IMessageProvider.INFORMATION,
                            getInformationTextCheckNameAddressSuccess());
                } catch (Exception e) {
                    setCheckResultMessage(IMessageProvider.WARNING, getErrorTextCheckNameAddressFailed());
                    control.setFocus();
                } finally {
                    // Trigger the wizard container update
                    IWizardContainer container = null;

                    try {
                        // Try to get the wizard container from the parent page
                        if (parentPage != null) {
                            Class<?>[] paramTypes = new Class[0];
                            Object[] args = new Object[0];
                            final Method method = parentPage.getClass().getMethod("getContainer", paramTypes); //$NON-NLS-1$
                            if (!method.isAccessible()) {
                                AccessController.doPrivileged(new PrivilegedAction<Object>() {
                                    @Override
                                    public Object run() {
                                        method.setAccessible(true);
                                        return null;
                                    }
                                });
                            }
                            Object result = method.invoke(parentPage, args);
                            if (result instanceof IWizardContainer) {
                                container = (IWizardContainer) result;
                            }
                        }
                    } catch (Exception e) {
                        // If the object does not have a "getContainer()" method,
                        // or the invocation fails or the access to the method
                        // is denied, we are done here and break the loop
                        container = null;
                    }

                    if (container != null) {
                        container.updateButtons();
                        container.updateMessage();
                    }
                }
            }
        });
    } catch (Exception e) {
    }
}

From source file:org.eclipse.tm.te.ui.controls.net.RemoteHostAddressControl.java

License:Open Source License

/**
 * If the user entered a host name, we have to validate that we can really resolve the name
 * to an IP address. Because this may really take a while, give the user the feedback what
 * we are actually doing./*  www.  j av a2  s .c o m*/
 */
private void onCheckAddress() {
    ProgressMonitorDialog dialog = new ProgressMonitorDialog(getParentControl().getShell());
    try {
        dialog.run(false, false, new IRunnableWithProgress() {
            private final String address = getEditFieldControlText();
            private final Control control = getEditFieldControl();
            private final IDialogPage parentPage = getParentPage();

            /* (non-Javadoc)
             * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
             */
            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    monitor.setTaskName(getTaskNameCheckNameAddress());
                    InetAddress[] addresses = InetAddress.getAllByName(address);
                    if (Platform.inDebugMode() && addresses != null) {
                        String message = "RemoteHostAddressControl: Name '" + address + "' resolves to: "; //$NON-NLS-1$ //$NON-NLS-2$
                        for (InetAddress address : addresses) {
                            message += address.getHostAddress() + ", "; //$NON-NLS-1$
                        }

                        IStatus status = new Status(IStatus.WARNING, UIPlugin.getUniqueIdentifier(), message);
                        UIPlugin.getDefault().getLog().log(status);
                    }

                    setCheckResultMessage(IMessageProvider.INFORMATION,
                            getInformationTextCheckNameAddressSuccess());
                } catch (Exception e) {
                    setCheckResultMessage(IMessageProvider.WARNING, getErrorTextCheckNameAddressFailed());
                    control.setFocus();
                } finally {
                    // Trigger the wizard container update
                    IWizardContainer container = null;

                    try {
                        // Try to get the wizard container from the parent page
                        Class<?>[] paramTypes = new Class[0];
                        Object[] args = new Object[0];
                        Method method = parentPage.getClass().getMethod("getContainer", paramTypes); //$NON-NLS-1$
                        if (!method.isAccessible()) {
                            method.setAccessible(true);
                        }
                        Object result = method.invoke(parentPage, args);
                        if (result instanceof IWizardContainer) {
                            container = (IWizardContainer) result;
                        }
                    } catch (Exception e) {
                        // If the object does not have a "getContainer()" method,
                        // or the invocation fails or the access to the method
                        // is denied, we are done here and break the loop
                        container = null;
                    }

                    if (container != null) {
                        container.updateButtons();
                        container.updateMessage();
                    }
                }
            }
        });
    } catch (Exception e) {
    }
}