Example usage for org.eclipse.jface.dialogs MessageDialog WARNING

List of usage examples for org.eclipse.jface.dialogs MessageDialog WARNING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog WARNING.

Prototype

int WARNING

To view the source code for org.eclipse.jface.dialogs MessageDialog WARNING.

Click Source Link

Document

Constant for the warning image, or a simple dialog with the warning image and a single OK button (value 4).

Usage

From source file:org.pentaho.di.ui.trans.steps.openerp.objectinput.OpenERPObjectInputDialog.java

License:Open Source License

private void populateFielsTable(ArrayList<FieldMapping> mappings) {

    int choice = 0;

    if (tableViewFields.table.getItemCount() > 0) {
        // Ask what we should do with the existing data in the step.
        MessageDialog md = new MessageDialog(tableViewFields.getShell(),
                BaseMessages.getString(PKGStepInterface, "BaseStepDialog.GetFieldsChoice.Title"), // "Warning!"
                null,/*w  w w.  ja  va2s .  co  m*/
                BaseMessages
                        .getString(PKGStepInterface, "BaseStepDialog.GetFieldsChoice.Message",
                                "" + tableViewFields.table.getItemCount(), "" + mappings.size()),
                MessageDialog.WARNING,
                new String[] { BaseMessages.getString(PKGStepInterface, "BaseStepDialog.AddNew"),
                        BaseMessages.getString(PKGStepInterface, "BaseStepDialog.ClearAndAdd"),
                        BaseMessages.getString(PKGStepInterface, "BaseStepDialog.Cancel"), },
                0);
        MessageDialog.setDefaultImage(GUIResource.getInstance().getImageSpoon());
        int idx = md.open();
        choice = idx & 0xFF;
    }

    if (choice == 2 || choice == 255 /* 255 = escape pressed */ ) {
        return; // Cancel clicked
    }

    if (choice == 1) {
        tableViewFields.table.removeAll();
    }

    // Make a list of the old elements
    Hashtable<String, Object> currentMaps = new Hashtable<String, Object>();
    for (int i = 0; i < tableViewFields.table.getItemCount(); i++) {
        currentMaps.put(tableViewFields.table.getItem(i).getText(1)
                + tableViewFields.table.getItem(i).getText(2) + tableViewFields.table.getItem(i).getText(3),
                true);
    }
    sourceListMapping = mappings;
    for (FieldMapping map : mappings) {
        // Only add new elements
        if (!currentMaps.containsKey(map.target_field_label + map.target_model + map.target_field)) {
            tableViewFields.add(map.target_field_label, map.target_model, map.target_field, map.source_model,
                    map.source_field, String.valueOf(map.source_index), String.valueOf(map.target_field_type));
        }
    }

    tableViewFields.setRowNums();
    tableViewFields.optWidth(true);
}

From source file:org.pentaho.di.ui.trans.steps.palo.cellinput.PaloCellInputDialog.java

License:Open Source License

public static void showPaloLibWarningDialog(Shell shell) {
    PropsUI props = PropsUI.getInstance();

    if ("Y".equalsIgnoreCase(props.getCustomParameter(STRING_PALO_LIB_WARNING_PARAMETER, "Y"))) {
        MessageDialogWithToggle md = new MessageDialogWithToggle(shell,
                BaseMessages.getString(PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogTitle"), null,
                BaseMessages.getString(PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogMessage", Const.CR)
                        + Const.CR,/*from   ww w  .ja  va2s .  c om*/
                MessageDialog.WARNING,
                new String[] {
                        BaseMessages.getString(PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option1") },
                0, BaseMessages.getString(PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option2"),
                "N".equalsIgnoreCase(props.getCustomParameter(STRING_PALO_LIB_WARNING_PARAMETER, "Y")));
        MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon());
        md.open();
        props.setCustomParameter(STRING_PALO_LIB_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y");
        props.saveProps();
    }
}

From source file:org.pentaho.di.ui.trans.steps.setvariable.SetVariableDialog.java

License:Apache License

private void ok() {
    if (Utils.isEmpty(wStepname.getText())) {
        return;/*  w  w w  .j  a v  a 2s . c  o  m*/
    }

    stepname = wStepname.getText(); // return value

    int count = wFields.nrNonEmpty();
    input.allocate(count);

    //CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < count; i++) {
        TableItem item = wFields.getNonEmpty(i);
        input.getFieldName()[i] = item.getText(1);
        input.getVariableName()[i] = item.getText(2);
        input.getVariableType()[i] = SetVariableMeta.getVariableType(item.getText(3));
        input.getDefaultValue()[i] = item.getText(4);
    }

    input.setUsingFormatting(wFormat.getSelection());

    // Show a warning (optional)
    //
    if ("Y".equalsIgnoreCase(props.getCustomParameter(STRING_USAGE_WARNING_PARAMETER, "Y"))) {
        MessageDialogWithToggle md = new MessageDialogWithToggle(shell,
                BaseMessages.getString(PKG, "SetVariableDialog.UsageWarning.DialogTitle"), null,
                BaseMessages.getString(PKG, "SetVariableDialog.UsageWarning.DialogMessage", Const.CR)
                        + Const.CR,
                MessageDialog.WARNING,
                new String[] { BaseMessages.getString(PKG, "SetVariableDialog.UsageWarning.Option1") }, 0,
                BaseMessages.getString(PKG, "SetVariableDialog.UsageWarning.Option2"),
                "N".equalsIgnoreCase(props.getCustomParameter(STRING_USAGE_WARNING_PARAMETER, "Y")));
        MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon());
        md.open();
        props.setCustomParameter(STRING_USAGE_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y");
        props.saveProps();
    }

    dispose();
}

From source file:org.pentaho.di.ui.trans.steps.setvariablesbulk.SetVariablesBulkDialog.java

License:Open Source License

private void ok() {
    if (Const.isEmpty(wStepname.getText()))
        return;//from   ww w .  ja v a 2 s. c  o m

    stepname = wStepname.getText(); // return value

    input.setVariableType(SetVariablesBulkMeta.getVariableType(wVariableType.getText()));
    input.setVariableNameField(wVariableNameField.getText());
    input.setVariableValueField(wVariableValueField.getText());
    input.setUsingFormatting(wFormat.getSelection());

    // Show a warning (optional)
    //
    if ("Y".equalsIgnoreCase(props.getCustomParameter(STRING_USAGE_WARNING_PARAMETER, "Y"))) //$NON-NLS-1$ //$NON-NLS-2$
    {
        MessageDialogWithToggle md = new MessageDialogWithToggle(shell,
                BaseMessages.getString(PKG, "SetVariablesBulkDialog.UsageWarning.DialogTitle"), //$NON-NLS-1$
                null,
                BaseMessages.getString(PKG, "SetVariablesBulkDialog.UsageWarning.DialogMessage", Const.CR) //$NON-NLS-1$
                        + Const.CR, //$NON-NLS-2$
                MessageDialog.WARNING,
                new String[] { BaseMessages.getString(PKG, "SetVariablesBulkDialog.UsageWarning.Option1") }, //$NON-NLS-1$
                0, BaseMessages.getString(PKG, "SetVariablesBulkDialog.UsageWarning.Option2"), //$NON-NLS-1$
                "N".equalsIgnoreCase(props.getCustomParameter(STRING_USAGE_WARNING_PARAMETER, "Y")) //$NON-NLS-1$ //$NON-NLS-2$
        );
        MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon());
        md.open();
        props.setCustomParameter(STRING_USAGE_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y"); //$NON-NLS-1$ //$NON-NLS-2$
        props.saveProps();
    }
    dispose();
}

From source file:org.pentaho.di.ui.trans.steps.sortedmerge.SortedMergeDialog.java

License:Apache License

private void ok() {
    if (Utils.isEmpty(wStepname.getText())) {
        return;//w w  w . ja  v  a2 s .  c  om
    }

    stepname = wStepname.getText(); // return value

    int nrfields = wFields.nrNonEmpty();

    input.allocate(nrfields);

    //CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrfields; i++) {
        TableItem ti = wFields.getNonEmpty(i);
        input.getFieldName()[i] = ti.getText(1);
        input.getAscending()[i] = BaseMessages.getString(PKG, "System.Combo.Yes")
                .equalsIgnoreCase(ti.getText(2));
    }

    // Show a warning (optional)
    //
    if ("Y".equalsIgnoreCase(props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y"))) {
        MessageDialogWithToggle md = new MessageDialogWithToggle(shell,
                BaseMessages.getString(PKG, "SortedMergeDialog.InputNeedSort.DialogTitle"), null,
                BaseMessages.getString(PKG, "SortedMergeDialog.InputNeedSort.DialogMessage", Const.CR)
                        + Const.CR,
                MessageDialog.WARNING,
                new String[] { BaseMessages.getString(PKG, "SortedMergeDialog.InputNeedSort.Option1") }, 0,
                BaseMessages.getString(PKG, "SortedMergeDialog.InputNeedSort.Option2"),
                "N".equalsIgnoreCase(props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y")));
        MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon());
        md.open();
        props.setCustomParameter(STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y");
        props.saveProps();
    }

    dispose();
}

From source file:org.pentaho.di.ui.trans.steps.tableoutput.TableOutputDialog.java

License:Apache License

protected void showUnsupportedConnectionMessageBox(DatabaseInterface dbi) {
    String title = BaseMessages.getString(PKG, "TableOutput.UnsupportedConnection.DialogTitle");
    String message = dbi.getUnsupportedTableOutputMessage();
    String close = BaseMessages.getString(PKG, "System.Button.Close");

    MessageDialog dialog = new MessageDialog(shell, title, GUIResource.getInstance().getImageSpoon(), message,
            MessageDialog.WARNING, new String[] { close }, 0);
    dialog.open();//  w w w  .j a  va  2 s.c o  m
}

From source file:org.pentaho.di.ui.trans.steps.uniquerows.UniqueRowsDialog.java

License:Apache License

private void ok() {
    if (Utils.isEmpty(wStepname.getText())) {
        return;//from w  ww .  j av  a  2s.  c  o m
    }

    int nrfields = wFields.nrNonEmpty();
    input.allocate(nrfields);

    //CHECKSTYLE:Indentation:OFF
    for (int i = 0; i < nrfields; i++) {
        TableItem item = wFields.getNonEmpty(i);
        input.getCompareFields()[i] = item.getText(1);
        input.getCaseInsensitive()[i] = "Y".equalsIgnoreCase(item.getText(2));
    }

    input.setCountField(wCountField.getText());
    input.setCountRows(wCount.getSelection());
    input.setRejectDuplicateRow(wRejectDuplicateRow.getSelection());
    input.setErrorDescription(wErrorDesc.getText());
    stepname = wStepname.getText(); // return value

    if ("Y".equalsIgnoreCase(props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y"))) {
        MessageDialogWithToggle md = new MessageDialogWithToggle(shell,
                BaseMessages.getString(PKG, "UniqueRowsDialog.InputNeedSort.DialogTitle"), null,
                BaseMessages.getString(PKG, "UniqueRowsDialog.InputNeedSort.DialogMessage", Const.CR)
                        + Const.CR,
                MessageDialog.WARNING,
                new String[] { BaseMessages.getString(PKG, "UniqueRowsDialog.InputNeedSort.Option1") }, 0,
                BaseMessages.getString(PKG, "UniqueRowsDialog.InputNeedSort.Option2"),
                "N".equalsIgnoreCase(props.getCustomParameter(STRING_SORT_WARNING_PARAMETER, "Y")));
        MessageDialogWithToggle.setDefaultImage(GUIResource.getInstance().getImageSpoon());
        md.open();
        props.setCustomParameter(STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y");
        props.saveProps();
    }

    // Remove any error hops coming out of UniqueRows when Reject Duplicate Rows checkbox is unselected.
    if (wRejectDuplicateRow.getSelection() == false) {
        List<TransHopMeta> hops = this.transMeta.getTransHops();
        IntStream.range(0, hops.size()).filter(hopInd -> {
            TransHopMeta hop = hops.get(hopInd);
            return (hop.isErrorHop()
                    && hop.getFromStep().getStepID().equals(this.input.getParentStepMeta().getStepID()));
        }).forEach(hopInd -> this.transMeta.removeTransHop(hopInd));
    }

    dispose();
}

From source file:org.pentaho.hbase.mapping.MappingEditor.java

License:Apache License

private void populateTableWithIncomingFields() {
    if (m_incomingFieldsProducer != null) {
        RowMetaInterface incomingRowMeta = m_incomingFieldsProducer.getIncomingFields();

        Table table = m_fieldsView.table;
        if (incomingRowMeta != null) {
            Set<String> existingRowAliases = new HashSet<String>();
            for (int i = 0; i < table.getItemCount(); i++) {
                TableItem tableItem = table.getItem(i);
                String alias = tableItem.getText(1);
                if (!Const.isEmpty(alias)) {
                    existingRowAliases.add(alias);
                }//from  ww w  .j av a  2 s .c  o m
            }

            int choice = 0;
            if (existingRowAliases.size() > 0) {
                // Ask what we should do with existing mapping data
                MessageDialog md = new MessageDialog(m_shell,
                        Messages.getString("MappingDialog.GetFieldsChoice.Title"), null,
                        Messages.getString("MappingDialog.GetFieldsChoice.Message",
                                "" + existingRowAliases.size(), "" + incomingRowMeta.size()),
                        MessageDialog.WARNING,
                        new String[] { Messages.getString("MappingDialog.AddNew"),
                                Messages.getString("MappingOutputDialog.Add"),
                                Messages.getString("MappingOutputDialog.ClearAndAdd"),
                                Messages.getString("MappingOutputDialog.Cancel"), },
                        0);
                MessageDialog.setDefaultImage(GUIResource.getInstance().getImageSpoon());
                int idx = md.open();
                choice = idx & 0xFF;
            }

            if (choice == 3 || choice == 255 /* 255 = escape pressed */ ) {
                return; // Cancel
            }

            if (choice == 2) {
                m_fieldsView.clearAll();
            }

            for (int i = 0; i < incomingRowMeta.size(); i++) {
                ValueMetaInterface vm = incomingRowMeta.getValueMeta(i);
                boolean addIt = true;

                if (choice == 0) {
                    // only add if its not already in the table
                    if (existingRowAliases.contains(vm.getName())) {
                        addIt = false;
                    }
                }

                if (addIt) {
                    TableItem item = new TableItem(m_fieldsView.table, SWT.NONE);
                    item.setText(1, vm.getName());
                    item.setText(2, "N");

                    if (m_familyCI.getComboValues()[0].length() > 0) {
                        // use existing first column family name as the default
                        item.setText(3, m_familyCI.getComboValues()[0]);
                    } else {
                        // default
                        item.setText(3, DEFAULT_FAMILY);
                    }

                    item.setText(4, vm.getName());
                    item.setText(5, vm.getTypeDesc());
                    if (vm.getType() == ValueMetaInterface.TYPE_INTEGER) {
                        item.setText(5, "Long");
                    }
                    if (vm.getType() == ValueMetaInterface.TYPE_NUMBER) {
                        item.setText(5, "Double");
                    }
                    if (vm.getStorageType() == ValueMetaInterface.STORAGE_TYPE_INDEXED) {
                        Object[] indexValus = vm.getIndex();
                        String indexValsS = HBaseValueMeta.objectIndexValuesToString(indexValus);
                        item.setText(6, indexValsS);
                    }
                }
            }

            m_fieldsView.removeEmptyRows();
            m_fieldsView.setRowNums();
            m_fieldsView.optWidth(true);
        }
    }
}

From source file:org.review_board.ereviewboard.ui.editor.ReviewboardDiffPart.java

License:Open Source License

private void installExtensions(Composite composite, Repository codeRepository, ReviewboardDiffMapper diffMapper,
        Integer diffRevisionId) {

    IConfigurationElement[] configurationElements = Platform.getExtensionRegistry()
            .getConfigurationElementsFor(EXTENSION_POINT_TASK_DIFF_ACTIONS);

    int reviewRequestId = Integer.parseInt(getTaskData().getTaskId());

    Map<String, TaskDiffAction> taskDiffActions = new LinkedHashMap<String, TaskDiffAction>(
            configurationElements.length);

    for (IConfigurationElement element : configurationElements) {
        try {//from w ww.ja v  a  2  s.c  om
            final TaskDiffAction taskDiffAction = (TaskDiffAction) element.createExecutableExtension("class");
            taskDiffAction.init(getTaskRepository(), reviewRequestId, codeRepository, diffMapper,
                    diffRevisionId);
            if (!taskDiffAction.isEnabled())
                continue;

            String label = element.getAttribute("label");

            taskDiffActions.put(label, taskDiffAction);
        } catch (CoreException e) {
            ReviewboardUiPlugin.getDefault().getLog().log(e.getStatus());
        }
    }

    if (taskDiffActions.isEmpty())
        return;

    Composite extensionsComposite = new Composite(composite, SWT.NONE);
    RowLayoutFactory.fillDefaults().type(SWT.HORIZONTAL).applyTo(extensionsComposite);

    for (final Map.Entry<String, TaskDiffAction> taskDiffAction : taskDiffActions.entrySet()) {

        final String labelTest = taskDiffAction.getKey();

        Button button = new Button(extensionsComposite, SWT.PUSH);
        button.setText(labelTest);
        button.addSelectionListener(new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {

                IStatus status;
                try {
                    status = taskDiffAction.getValue().execute(new NullProgressMonitor());
                } catch (Exception e1) {
                    status = new Status(IStatus.ERROR, ReviewboardUiPlugin.PLUGIN_ID,
                            "Internal error while executing action '" + labelTest + "' : " + e1.getMessage(),
                            e1);
                    ReviewboardUiPlugin.getDefault().getLog().log(status);
                }

                if (!status.isOK()) {

                    int kind = MessageDialog.ERROR;
                    if (status.getSeverity() == IStatus.WARNING)
                        kind = MessageDialog.WARNING;

                    MessageDialog.open(kind, null, "Error performing action", status.getMessage(), SWT.SHEET);
                }

                if (status.getCode() == TaskDiffAction.STATUS_CODE_REFRESH_REVIEW_REQUEST)
                    org.review_board.ereviewboard.ui.util.EditorUtil.refreshEditorPage(getTaskEditorPage());
            }

            public void widgetDefaultSelected(SelectionEvent e) {

            }
        });

    }

}

From source file:org.rssowl.ui.internal.Controller.java

License:Open Source License

private boolean openWarningConfirm(Shell parent, String title, String message) {
    MessageDialog dialog = new MessageDialog(parent, title, null, message, MessageDialog.WARNING,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    return dialog.open() == 0;
}