Example usage for org.eclipse.jface.dialogs IMessageProvider INFORMATION

List of usage examples for org.eclipse.jface.dialogs IMessageProvider INFORMATION

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider INFORMATION.

Prototype

int INFORMATION

To view the source code for org.eclipse.jface.dialogs IMessageProvider INFORMATION.

Click Source Link

Document

Constant for an info message (value 1).

Usage

From source file:org.jlibrary.client.ui.repository.wizard.UserDataPage.java

License:Open Source License

/**
 * @param outer//from w  w w.ja  va 2 s . c  o m
 */
private void doConnect(final Composite outer) {

    final String profile = serverCombo.getItem(serverCombo.getSelectionIndex());
    final String user = userText.getText();
    final String password = passwordText.getText();

    IRunnableWithProgress runnable = new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {

            monitor.beginTask(Messages.getMessage("repository_dialog_connect"), 2);
            monitor.worked(1);
            connect(profile, user, password);
            monitor.worked(2);

            monitor.done();
        }
    };

    WizardDialog wd = (WizardDialog) getWizard().getContainer();
    try {
        wd.run(true, true, runnable);

        if (connected) {
            setMessage(nextMessage, IMessageProvider.INFORMATION);
            setPageComplete(true);
        } else {
            setPageComplete(false);
        }

    } catch (Exception e) {

        logger.error(e.getMessage(), e);
    }
}

From source file:org.jlibrary.client.ui.repository.wizard.UserDataPage.java

License:Open Source License

private void connect(String profile, String user, String password) {

    connected = false;//from   w  w  w.ja  va 2 s  .  c  o  m
    serverProfile = (ServerProfile) profiles.get(profile);

    try {
        SecurityService securityService = JLibraryServiceFactory.getInstance(serverProfile)
                .getSecurityService();
        credentials = new Credentials();
        credentials.setUser(user);
        if (user.equals(Messages.getMessage(User.ADMIN_NAME)) || user.equals(User.ADMIN_KEYNAME)) {
            credentials.setUser(User.ADMIN_NAME);
        }
        credentials.setPassword(password);
        ticket = securityService.login(credentials, SecurityService.SYSTEM_REPOSITORY);
        if (!isOpenDialog) {
            if (!ticket.getUser().isAdmin()) {
                //setErrorMessage(Messages.getMessage("not_enough_permissions"));
                getShell().getDisplay().asyncExec(showError(Messages.getMessage("not_enough_permissions")));
                return;
            }
        }

        // Move the selected profile to the first place on the combo box
        ClientConfig.moveToFirst(serverProfile);

        connected = true;

        getShell().getDisplay().asyncExec(showError(null));
        getShell().getDisplay().asyncExec(showMessage(nextMessage, IMessageProvider.INFORMATION));

    } catch (ConnectException ce) {
        getShell().getDisplay().asyncExec(showError(Messages.getMessage("connection_refused")));
    } catch (UserNotFoundException e1) {
        getShell().getDisplay()
                .asyncExec(showError(Messages.getAndParseValue("error_not_global_admin", "%1", user)));
    } catch (AuthenticationException e1) {
        getShell().getDisplay()
                .asyncExec(showError(Messages.getMessage("repository_dialog_authentication_error")));
        //           setErrorMessage(Messages.getMessage("repository_dialog_authentication_error"));
    } catch (Exception e) {
        //         setErrorMessage(e1.getMessage());

        logger.error(e.getMessage(), e);
        getShell().getDisplay().asyncExec(showError(e.getMessage()));
    }
}

From source file:org.jlibrary.client.ui.security.wizard.UserWizardDataPage.java

License:Open Source License

public void createControl(Composite outer) {
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 4;//from  w  w w. j  a  v a 2  s.  c  om
    gridLayout.marginHeight = 10;
    gridLayout.marginWidth = 10;
    gridLayout.horizontalSpacing = 10;
    gridLayout.verticalSpacing = 10;
    outer.setLayout(gridLayout);

    Label label0 = new Label(outer, SWT.NONE);
    label0.setText(Messages.getMessage("new_user_alias"));
    GridData data = new GridData();
    data.horizontalAlignment = GridData.BEGINNING;
    label0.setLayoutData(data);

    nickText = new Text(outer, SWT.BORDER);
    data = new GridData();
    data.widthHint = 120;
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = GridData.FILL;
    nickText.setLayoutData(data);

    Label sep2 = new Label(outer, SWT.NONE);
    data = new GridData();
    data.horizontalSpan = 2;
    sep2.setLayoutData(data);

    Label label2 = new Label(outer, SWT.NONE);
    label2.setText(Messages.getMessage("new_user_password"));

    passwordText = new Text(outer, SWT.BORDER);
    passwordText.setEchoChar('*');
    data = new GridData();
    data.widthHint = 120;
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = GridData.FILL;
    passwordText.setLayoutData(data);

    Label label4 = new Label(outer, SWT.NONE);
    label4.setText(Messages.getMessage("new_user_confirm_password"));

    confirmPasswordText = new Text(outer, SWT.BORDER);
    confirmPasswordText.setEchoChar('*');
    data = new GridData();
    data.widthHint = 120;
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = GridData.FILL;
    confirmPasswordText.setLayoutData(data);

    Label sep = new Label(outer, SWT.SEPARATOR | SWT.HORIZONTAL);
    data = new GridData();
    data.horizontalSpan = 4;
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = GridData.FILL;
    sep.setLayoutData(data);

    Label label6 = new Label(outer, SWT.NONE);
    label6.setText(Messages.getMessage("new_user_firstname"));

    firstNameText = new Text(outer, SWT.BORDER);
    data = new GridData();
    data.widthHint = 120;
    data.horizontalSpan = 3;
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = GridData.FILL;
    firstNameText.setLayoutData(data);

    Label label8 = new Label(outer, SWT.NONE);
    label8.setText(Messages.getMessage("new_user_lastname"));

    lastNameText = new Text(outer, SWT.BORDER);
    data = new GridData();
    data.widthHint = 200;
    data.horizontalSpan = 3;
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = GridData.FILL;
    lastNameText.setLayoutData(data);

    Label label12 = new Label(outer, SWT.NONE);
    label12.setText(Messages.getMessage("new_user_email"));

    emailText = new Text(outer, SWT.BORDER);
    data = new GridData();
    data.widthHint = 120;
    data.horizontalSpan = 3;
    data.grabExcessHorizontalSpace = true;
    data.horizontalAlignment = GridData.FILL;
    emailText.setLayoutData(data);

    ModifyListener modifyListener = new ModifyListener() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
         */
        public void modifyText(ModifyEvent e) {

            checkButtonsEnabled();
        }
    };

    nickText.addModifyListener(modifyListener);
    passwordText.addModifyListener(modifyListener);
    confirmPasswordText.addModifyListener(modifyListener);
    firstNameText.addModifyListener(modifyListener);
    lastNameText.addModifyListener(modifyListener);
    emailText.addModifyListener(modifyListener);

    setMessage(Messages.getMessage("new_user_required_fields"), IMessageProvider.INFORMATION);

    setControl(outer);
}

From source file:org.kalypso.contribs.eclipse.jface.dialog.DialogPageUtilitites.java

License:Open Source License

/** Translate the {@link IStatus}-severity codes to {@link org.eclipse.jface.dialogs.DialogPage}-message-codes. */
public static int severityToMessagecode(final IStatus status) {
    switch (status.getSeverity()) {
    case IStatus.INFO:
        return IMessageProvider.INFORMATION;

    case IStatus.WARNING:
        return IMessageProvider.WARNING;

    case IStatus.ERROR:
        return IMessageProvider.ERROR;

    case IStatus.OK:
        // fall through
    case IStatus.CANCEL:
        // fall through
    default://from  w w  w  . ja v a 2  s .c  o m
        return IMessageProvider.NONE;
    }
}

From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java

License:Open Source License

/**
 * Sets the message for this dialog with an indication of what type of message it is.
 * <p>/*from  ww w.  ja  va 2s.c  om*/
 * The valid message types are one of <code>NONE</code>,<code>INFORMATION</code>,<code>WARNING</code>, or
 * <code>ERROR</code>.
 * </p>
 * <p>
 * Note that for backward compatibility, a message of type <code>ERROR</code> is different than an error message (set
 * using <code>setErrorMessage</code>). An error message overrides the current message until the error message is
 * cleared. This method replaces the current message and does not affect the error message.
 * </p>
 *
 * @param newMessage
 *          the message, or <code>null</code> to clear the message
 * @param newType
 *          the message type
 * @since 2.0
 */
public void setMessage(final String newMessage, final int newType) {
    Image newImage = null;
    if (newMessage != null) {
        switch (newType) {
        case IMessageProvider.NONE:
            break;
        case IMessageProvider.INFORMATION:
            newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
            break;
        case IMessageProvider.WARNING:
            newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
            break;
        case IMessageProvider.ERROR:
            newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
            break;
        }
    }
    showMessage(newMessage, newImage);
}

From source file:org.kalypso.contribs.eclipse.ui.forms.MessageUtilitites.java

License:Open Source License

/**
 * Converts the severity of an {@link IStatus} to the mesage type of an {@link IMessage}.
 * /*  www  .  j  a va  2s.  co  m*/
 * @see IStatus#getSeverity()
 * @see IMessage#getMessageType()
 */
public static int convertStatusSeverity(final int severity) {
    switch (severity) {
    case IStatus.OK:
        return IMessageProvider.NONE;
    case IStatus.INFO:
        return IMessageProvider.INFORMATION;
    case IStatus.WARNING:
        return IMessageProvider.WARNING;
    case IStatus.ERROR:
        return IMessageProvider.ERROR;
    case IStatus.CANCEL:
        return IMessageProvider.INFORMATION;

    default:
        throw new IllegalArgumentException("Unknown status severity: " + severity); //$NON-NLS-1$
    }
}

From source file:org.kalypso.contribs.eclipse.ui.forms.MessageUtilitites.java

License:Open Source License

/**
 * Converts the type of an {@link IMessage} to the severity of an {@link IStatus}.
 * //from  w w w .  j a  va 2s  .c  om
 * @see IStatus#getSeverity()
 * @see IMessage#getMessageType()
 */
public static int convertMessageSeverity(final int type) {
    switch (type) {
    case IMessageProvider.NONE:
        return IStatus.OK;

    case IMessageProvider.INFORMATION:
        return IStatus.INFO;
    case IMessageProvider.WARNING:
        return IStatus.WARNING;
    case IMessageProvider.ERROR:
        return IStatus.ERROR;

    default:
        throw new IllegalArgumentException("Unknown message type: " + type); //$NON-NLS-1$
    }
}

From source file:org.kalypso.model.wspm.ui.view.AbstractChartModelViewPart.java

License:Open Source License

protected final void updatePartName(final IChartModel model, final String message, final Form form) {
    if (form == null || form.isDisposed())
        return;//from w ww.j  a  v a 2  s  . co  m

    final String stationName = getStationName(model);
    if (stationName == null) {
        setPartName(m_registeredName);
        form.setMessage(Messages.getString("org.kalypso.model.wspm.ui.view.legend.LegendView.2"), //$NON-NLS-1$
                IMessageProvider.INFORMATION);
    } else {
        form.setMessage(message);
        setPartName(stationName);
    }
}

From source file:org.kalypso.model.wspm.ui.view.chart.ProfilChartViewPart.java

License:Open Source License

private void updateMessages(final IProfile newProfile) {
    if (newProfile == null) {
        setFormMessage(Messages.getString("org.kalypso.model.wspm.ui.view.chart.ChartView.0"), //$NON-NLS-1$
                IMessageProvider.INFORMATION);
        setPartNames(Messages.getString("org.kalypso.model.wspm.ui.view.AbstractProfilViewPart_1"), //$NON-NLS-1$
                Messages.getString("org.kalypso.model.wspm.ui.view.AbstractProfilViewPart_2")); //$NON-NLS-1$
    } else {//  w w w  .  j ava  2s .com
        setFormMessage(null, IMessageProvider.NONE);
        setPartNames(Messages.getString("ProfilChartViewPart.1", newProfile.getStation()), //$NON-NLS-1$
                newProfile.getDescription());
    }
}

From source file:org.kalypso.model.wspm.ui.view.table.ProfileTableForm.java

License:Open Source License

/**
 * To be called if the profile reference changes, in this case, the whole table is re-generated.
 *///from  ww  w  . j  a v a 2s  . co  m
protected void updateControl() {
    if (m_form == null || m_form.isDisposed())
        return;

    if (m_selection.isEmpty()) {
        m_form.setMessage(Messages.getString("org.kalypso.model.wspm.ui.view.table.TableView.2"), //$NON-NLS-1$
                IMessageProvider.INFORMATION);

        /* hie problem section */
        m_sashForm.setMaximizedControl(m_viewer.getControl());

        /* but hide the table -> gray background */
        m_viewer.getTable().setVisible(false);

        return;
    }

    m_viewer.getTable().setVisible(true);

    /* Create handlers for this profile */
    final IProfile profile = m_selection.getProfileFeature().getProfile();

    final IProfilLayerProvider layerProvider = KalypsoModelWspmUIExtensions
            .createProfilLayerProvider(profile.getType());
    final IComponentUiHandlerProvider handlerProvider = layerProvider.getComponentUiHandlerProvider(profile);
    if (m_viewer.getContentProvider() != null) {
        // Reset input in order to avoid double refresh
        m_viewer.setInput(null);
    }

    m_tupleResultContentProvider = new TupleResultContentProvider(handlerProvider);
    m_tupleResultLabelProvider = new TupleResultLabelProvider(m_tupleResultContentProvider);

    m_viewer.setContentProvider(m_tupleResultContentProvider);
    m_viewer.setLabelProvider(m_tupleResultLabelProvider);
    m_viewer.setCellModifier(new TupleResultCellModifier(m_tupleResultContentProvider));

    m_viewer.setInput(profile.getResult());
    m_form.setMessage(null);

    updateProblemView();

    // FIXME: really necessary?
    m_viewer.getControl().getParent().layout();
}