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.eclipse.andmore.android.launch.ui.StartedInstancesDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK, Ignore and Abort buttons
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    ignoreButton = createButton(parent, IDialogConstants.IGNORE_ID, IDialogConstants.IGNORE_LABEL, false);
    abortButton = createButton(parent, IDialogConstants.ABORT_ID, IDialogConstants.ABORT_LABEL, false);

    ignoreButton.addMouseListener(new MouseListener() {

        @Override//from   w w w. jav a2  s .  c o m
        public void mouseUp(MouseEvent e) {
            setReturnCode(IDialogConstants.IGNORE_ID);
            close();
        }

        @Override
        public void mouseDown(MouseEvent e) {
            // do nothing
        }

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            // do nothing
        }
    });

    abortButton.addMouseListener(new MouseListener() {

        @Override
        public void mouseUp(MouseEvent e) {
            setReturnCode(IDialogConstants.ABORT_ID);
            close();
        }

        @Override
        public void mouseDown(MouseEvent e) {
            // do nothing
        }

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            // do nothing
        }
    });
}

From source file:org.eclipse.cdt.make.internal.ui.MultipleInputDialog.java

License:Open Source License

protected void createBrowseField(String labelText, String initialValue, boolean allowEmpty) {
    Label label = new Label(panel, SWT.NONE);
    label.setText(labelText);//www  .j  a va 2s. 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(""); //$NON-NLS-1$
            }
        });

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

    Button button = createButton(comp, IDialogConstants.IGNORE_ID,
            MakeUIPlugin.getResourceString("MultipleInputDialog.0"), false); //$NON-NLS-1$
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setMessage(MakeUIPlugin.getResourceString("MultipleInputDialog.1")); //$NON-NLS-1$
            String currentWorkingDir = text.getText();
            if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$
                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.cdt.make.internal.ui.MultipleInputDialog.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 .  ja  va2 s . com
    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(""); //$NON-NLS-1$
            }
        });

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

    Button button = createButton(comp, IDialogConstants.IGNORE_ID,
            MakeUIPlugin.getResourceString("MultipleInputDialog.2"), false); //$NON-NLS-1$
    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.MultipleInputDialog.java

License:Open Source License

protected void createBrowseField(String labelText, String initialValue, boolean allowEmpty) {
    Label label = new Label(panel, SWT.NONE);
    label.setText(labelText);/*ww w .  ja  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() {
            public boolean validate() {
                return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
            }
        });

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

    Button button = createButton(comp, IDialogConstants.IGNORE_ID, DebugUIMessages.MultipleInputDialog_6,
            false);
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setMessage(DebugUIMessages.MultipleInputDialog_7);
            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.MultipleInputDialog.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  av  a2 s  . com
    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() {
            public boolean validate() {
                return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
            }
        });

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

    Button button = createButton(comp, IDialogConstants.IGNORE_ID, DebugUIMessages.MultipleInputDialog_8,
            false);
    button.addSelectionListener(new SelectionAdapter() {
        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.MultipleInputDialog.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.java2  s.c o m
    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() {
        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() {
            public boolean validate() {
                return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
            }
        });

        text.addModifyListener(new ModifyListener() {
            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, DebugUIMessages.MultipleInputDialog_8,
            false);

    button.addSelectionListener(new SelectionAdapter() {
        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.dltk.mod.internal.debug.ui.interpreters.MultipleInputDialog.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 av  a2  s  . 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() {
            public boolean validate() {
                return !text.getText().equals(""); //$NON-NLS-1$
            }
        });

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

    Button button = createButton(comp, IDialogConstants.IGNORE_ID, Messages.MultipleInputDialog_ignore, false);
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setMessage(""); //$NON-NLS-1$  
            String currentWorkingDir = text.getText();
            if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$
                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.dltk.ui.dialogs.MultipleInputDialog.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 www.  ja  v  a 2s .c  o 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() {
            public boolean validate() {
                return !text.getText().equals(""); //$NON-NLS-1$
            }
        });

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

    Button button = createButton(comp, IDialogConstants.IGNORE_ID, DialogMessages.MultipleInputDialog_ignore,
            false);
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setMessage(""); //$NON-NLS-1$  
            String currentWorkingDir = text.getText();
            if (!currentWorkingDir.trim().equals("")) { //$NON-NLS-1$
                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.jdt.internal.debug.ui.launcher.RuntimeClasspathAdvancedDialog.java

License:Open Source License

private void addVariableStringComposite(Composite composite) {
    fAddVariableStringButton = new Button(composite, SWT.RADIO);
    fAddVariableStringButton.setText(LauncherMessages.RuntimeClasspathAdvancedDialog_6);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    fAddVariableStringButton.setLayoutData(gd);

    final Composite inner = new Composite(composite, SWT.NONE);
    inner.setLayout(new GridLayout(2, false));
    inner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fVariableString = new Text(inner, SWT.SINGLE | SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.grabExcessHorizontalSpace = true;
    fVariableString.setLayoutData(gd);//from w w w . j  a  v  a2s  . co  m

    final Button fVariablesButton = createButton(inner, IDialogConstants.IGNORE_ID,
            LauncherMessages.RuntimeClasspathAdvancedDialog_7, false);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    fVariablesButton.setLayoutData(gd);

    fVariablesButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
            dialog.open();
            String variable = dialog.getVariableExpression();
            if (variable != null) {
                fVariableString.insert(variable);
            }
        }
    });

    fAddVariableStringButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean enabled = fAddVariableStringButton.getSelection();
            fVariableString.setEnabled(enabled);
            fVariablesButton.setEnabled(enabled);
        }
    });
    //set initial state
    boolean enabled = fAddVariableStringButton.getSelection();
    fVariableString.setEnabled(enabled);
    fVariablesButton.setEnabled(enabled);
}

From source file:org.eclipse.sirius.common.ui.tools.api.dialog.SiriusMessageDialogWithToggle.java

License:Open Source License

/**
 * Attempt to find a standard JFace button id that matches the specified
 * button label. If no match can be found, use the default id provided.
 * //from   ww  w  .  j  a  v  a  2 s  .  c  o m
 * Overridden to investigate the provided buttons.
 * 
 * @param buttonLabel
 *            the button label whose id is sought
 * @param defaultId
 *            the id to use for the button if there is no standard id
 * @return the id for the specified button label
 */
// CHECKSTYLE:OFF
private int mapButtonLabelToButtonID(String buttonLabel, int defaultId) {
    // CHECKSTYLE:OON
    // Not pretty but does the job...
    if (IDialogConstants.OK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OK_ID;
    }

    if (IDialogConstants.YES_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_ID;
    }

    if (IDialogConstants.NO_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_ID;
    }

    if (IDialogConstants.CANCEL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CANCEL_ID;
    }

    if (IDialogConstants.YES_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_TO_ALL_ID;
    }

    if (IDialogConstants.SKIP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.SKIP_ID;
    }

    if (IDialogConstants.STOP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.STOP_ID;
    }

    if (IDialogConstants.ABORT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.ABORT_ID;
    }

    if (IDialogConstants.RETRY_LABEL.equals(buttonLabel)) {
        return IDialogConstants.RETRY_ID;
    }

    if (IDialogConstants.IGNORE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.IGNORE_ID;
    }

    if (IDialogConstants.PROCEED_LABEL.equals(buttonLabel)) {
        return IDialogConstants.PROCEED_ID;
    }

    if (IDialogConstants.OPEN_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OPEN_ID;
    }

    if (IDialogConstants.CLOSE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CLOSE_ID;
    }

    if (IDialogConstants.BACK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.BACK_ID;
    }

    if (IDialogConstants.NEXT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NEXT_ID;
    }

    if (IDialogConstants.FINISH_LABEL.equals(buttonLabel)) {
        return IDialogConstants.FINISH_ID;
    }

    if (IDialogConstants.HELP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.HELP_ID;
    }

    if (IDialogConstants.NO_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_TO_ALL_ID;
    }

    if (IDialogConstants.SHOW_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    if (IDialogConstants.HIDE_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    for (String providedButton : buttonsMap.keySet()) {
        if (providedButton.equals(buttonLabel)) {
            return buttonsMap.get(providedButton);
        }
    }

    // No XXX_LABEL in IDialogConstants for these. Unlikely
    // they would be used in a message dialog though.
    // public int SELECT_ALL_ID = 18;
    // public int DESELECT_ALL_ID = 19;
    // public int SELECT_TYPES_ID = 20;

    return defaultId;
}