Example usage for org.eclipse.jface.dialogs IDialogConstants IGNORE_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants IGNORE_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants IGNORE_ID.

Prototype

int IGNORE_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants IGNORE_ID.

Click Source Link

Document

Button id for an "Ignore" button (value 9).

Usage

From source file:org.jkiss.dbeaver.ui.dialogs.data.ValueViewDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, CoreMessages.dialog_value_view_button_save, true)
            .setEnabled(!valueController.isReadOnly());
    boolean required = false;//valueController.getValueType() instanceof DBSAttributeBase && ((DBSAttributeBase) valueController.getValueType()).isRequired();
    createButton(parent, IDialogConstants.IGNORE_ID, CoreMessages.dialog_value_view_button_sat_null, false)
            .setEnabled(!valueController.isReadOnly() && !DBUtils.isNullValue(valueController.getValue())
                    && !required);
    createButton(parent, IDialogConstants.CANCEL_ID, CoreMessages.dialog_value_view_button_cancel, false);
}

From source file:org.jkiss.dbeaver.ui.dialogs.data.ValueViewDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    Point size = getShell().getSize();
    String sizeString = size.x + ":" + size.y;
    dialogSettings.put(getDialogSizePrefId(), sizeString);

    if (buttonId == IDialogConstants.IGNORE_ID) {
        if (!valueController.isReadOnly()) {
            editedValue = BaseValueManager.makeNullValue(valueController);
        }/* ww  w  .  j  a v  a 2  s . c  o  m*/
        super.okPressed();
    } else {
        super.buttonPressed(buttonId);
    }
}

From source file:org.jkiss.dbeaver.ui.dialogs.exec.ExecutionQueueErrorDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Details buttons
    createButton(parent, IDialogConstants.STOP_ID, IDialogConstants.STOP_LABEL, true);
    createButton(parent, IDialogConstants.RETRY_ID, IDialogConstants.RETRY_LABEL, false);
    if (script) {
        createButton(parent, IDialogConstants.SKIP_ID, IDialogConstants.SKIP_LABEL, false);
        createButton(parent, IDialogConstants.IGNORE_ID, IDialogConstants.IGNORE_LABEL, false);
    }/*from  w w  w.  ja v  a  2  s.c o  m*/
    createDetailsButton(parent);
}

From source file:_org.eclipse.debug.internal.ui.IInternalDebugCoreConstants.java

License:Open Source License

protected void createBrowseField(String labelText, String initialValue, boolean allowEmpty) {
    Label label = new Label(panel, SWT.NONE);
    label.setText(labelText);//from   ww w . j  a  v a2  s.  c  om
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));

    Composite comp = new Composite(panel, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 200;
    text.setLayoutData(data);
    text.setData(FIELD_NAME, labelText);

    // make sure rows are the same height on both panels.
    label.setSize(label.getSize().x, text.getSize().y);

    if (initialValue != null) {
        text.setText(initialValue);
    }

    if (!allowEmpty) {
        validators.add(new Validator() {
            @Override
            public boolean validate() {
                return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
            }
        });

        text.addModifyListener(new ModifyListener() {
            @Override
            public void modifyText(ModifyEvent e) {
                validateFields();
            }
        });
    }

    Button button = createButton(comp, IDialogConstants.IGNORE_ID, "&Browse...", false);
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setMessage("Select a file:");
            String currentWorkingDir = text.getText();
            if (!currentWorkingDir.trim().equals(IInternalDebugCoreConstants.EMPTY_STRING)) {
                File path = new File(currentWorkingDir);
                if (path.exists()) {
                    dialog.setFilterPath(currentWorkingDir);
                }
            }

            String selectedDirectory = dialog.open();
            if (selectedDirectory != null) {
                text.setText(selectedDirectory);
            }
        }
    });

    controlList.add(text);

}

From source file:_org.eclipse.debug.internal.ui.IInternalDebugCoreConstants.java

License:Open Source License

public void createVariablesField(String labelText, String initialValue, boolean allowEmpty) {
    Label label = new Label(panel, SWT.NONE);
    label.setText(labelText);//from  w  w w  .j a  v a  2s.  co  m
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));

    Composite comp = new Composite(panel, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    final Text text = new Text(comp, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 200;
    text.setLayoutData(data);
    text.setData(FIELD_NAME, labelText);

    // make sure rows are the same height on both panels.
    label.setSize(label.getSize().x, text.getSize().y);

    if (initialValue != null) {
        text.setText(initialValue);
    }

    if (!allowEmpty) {
        validators.add(new Validator() {
            @Override
            public boolean validate() {
                return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
            }
        });

        text.addModifyListener(new ModifyListener() {
            @Override
            public void modifyText(ModifyEvent e) {
                validateFields();
            }
        });
    }

    Button button = createButton(comp, IDialogConstants.IGNORE_ID, "Eclipse Varia&bles...", false);
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
            int code = dialog.open();
            if (code == IDialogConstants.OK_ID) {
                String variable = dialog.getVariableExpression();
                if (variable != null) {
                    text.insert(variable);
                }
            }
        }
    });

    controlList.add(text);

}

From source file:_org.eclipse.debug.internal.ui.IInternalDebugCoreConstants.java

License:Open Source License

public void createMultilineVariablesField(String labelText, String initialValue, boolean allowEmpty) {
    Label label = new Label(panel, SWT.NONE);
    label.setText(labelText);/*from  w  w w .j a  v  a2s . c  om*/
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    gd.horizontalSpan = 2;
    label.setLayoutData(gd);

    final Text text = new Text(panel, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
    gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 300;
    gd.heightHint = 4 * text.getLineHeight();
    gd.horizontalSpan = 2;
    text.setLayoutData(gd);
    text.setData(FIELD_NAME, labelText);

    text.addTraverseListener(new TraverseListener() {
        @Override
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_RETURN && e.stateMask == SWT.SHIFT) {
                e.doit = true;
            }
        }
    });

    // make sure rows are the same height on both panels.
    label.setSize(label.getSize().x, text.getSize().y);

    if (initialValue != null) {
        text.setText(initialValue);
    }

    if (!allowEmpty) {
        validators.add(new Validator() {
            @Override
            public boolean validate() {
                return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
            }
        });

        text.addModifyListener(new ModifyListener() {
            @Override
            public void modifyText(ModifyEvent e) {
                validateFields();
            }
        });
    }
    Composite comp = SWTFactory.createComposite(panel, panel.getFont(), 1, 2, GridData.HORIZONTAL_ALIGN_END);
    GridLayout ld = (GridLayout) comp.getLayout();
    ld.marginHeight = 1;
    ld.marginWidth = 0;
    ld.horizontalSpacing = 0;
    Button button = createButton(comp, IDialogConstants.IGNORE_ID, "Varia&bles...", false);

    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
            int code = dialog.open();
            if (code == IDialogConstants.OK_ID) {
                String variable = dialog.getVariableExpression();
                if (variable != null) {
                    text.insert(variable);
                }
            }
        }
    });

    controlList.add(text);
}