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

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

Introduction

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

Prototype

int OK_ID

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

Click Source Link

Document

Button id for an "Ok" button (value 0).

Usage

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.RenameCodeDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    GridLayout layout = new GridLayout();
    parent.setLayout(layout);//  www.  jav  a2 s . c o  m

    Composite container = new Composite(parent, SWT.NULL);
    layout = new GridLayout(2, false);
    container.setLayout(layout);
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label label = new Label(container, SWT.NULL);
    label.setText("Code Name"); //$NON-NLS-1$

    fNewName = new Text(container, SWT.BORDER);
    fNewName.setText(""); //$NON-NLS-1$
    fNewName.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));

    fNewName.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            CodeValidator validator = new CodeValidator(fNewName.getText().trim(), fOldName, fProject);
            if (validator.isValid()) {
                setErrorMessage(null);
                getButton(IDialogConstants.OK_ID).setEnabled(true);
            } else {
                setErrorMessage(validator.getErrorMessage());
                getButton(IDialogConstants.OK_ID).setEnabled(false);
            }
        }
    });

    return parent;
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.RenameDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle(Messages.getString("dialogs.RenameDialog.renamingTranscript")); //$NON-NLS-1$
    setMessage(Messages.getString("dialogs.RenameDialog.renameTranscript")); //$NON-NLS-1$
    this.getButton(IDialogConstants.OK_ID).setEnabled(false);
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.RenameDialog.java

License:Open Source License

/**
 * @return//  w w w.ja  v  a2  s  .  co m
 */
private ModifyListener createKeyListener() {
    return new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            TranscriptNameValidator lValidator = new TranscriptNameValidator(fNewName.getText().trim(),
                    fOldName, fProject);

            if (!lValidator.isValid()) {
                setErrorMessage(lValidator.getErrorMessage());
                getButton(IDialogConstants.OK_ID).setEnabled(false);
            } else {
                setErrorMessage(null);
                fName = fNewName.getText();
                getButton(IDialogConstants.OK_ID).setEnabled(true);
            }
        }
    };
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.RenameMemoDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle(Messages.getString("dialog.RenameMemoDialog.renaming")); //$NON-NLS-1$
    setMessage(Messages.getString("dialog.RenameMemoDialog.enterName")); //$NON-NLS-1$
    getButton(IDialogConstants.OK_ID).setEnabled(false);
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.RenameMemoDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    GridLayout layout = new GridLayout();
    parent.setLayout(layout);/*w  w  w  .jav a 2 s .c  om*/

    Composite container = new Composite(parent, SWT.NULL);
    layout = new GridLayout(2, false);
    container.setLayout(layout);
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Label label = new Label(container, SWT.NULL);
    label.setText(Messages.getString("dialog.RenameMemoDialog.memoName")); //$NON-NLS-1$

    fNewName = new Text(container, SWT.BORDER);
    fNewName.setText(""); //$NON-NLS-1$
    fNewName.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));

    fNewName.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            MemoNameValidator validator = new MemoNameValidator(fNewName.getText().trim(), fOldName, fProject);
            if (validator.isValid()) {
                setErrorMessage(null);
                getButton(IDialogConstants.OK_ID).setEnabled(true);
            } else {
                setErrorMessage(validator.getErrorMessage());
                getButton(IDialogConstants.OK_ID).setEnabled(false);
            }
        }
    });

    return parent;
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.RenameProjectDialog.java

License:Open Source License

private void validate() {
    ProjectNameValidator validator = new ProjectNameValidator(fNameText.getText().trim(), fProject.getName(),
            fProject);/*from w  w w  .j av  a2 s .c  o m*/
    if (validator.isValid()) {
        setErrorMessage(null);
        getButton(IDialogConstants.OK_ID).setEnabled(true);
    } else {
        setErrorMessage(validator.getErrorMessage());
        getButton(IDialogConstants.OK_ID).setEnabled(false);
    }

}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.TranscriptPropertiesDialog.java

License:Open Source License

/**
 * Removes a Participant from the transcript.
 * @return//from  ww  w  . j  a va 2 s  .com
 */
private SelectionAdapter createRemoveListener() {
    return new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            while (fTable.getSelectionCount() > 0) {
                fTable.remove(fTable.getSelectionIndex());
            }

            if (fTable.getItemCount() <= 0) {
                setErrorMessage(Messages.getString("dialogs.TranscriptPropertiesDialog.atLeastOne")); //$NON-NLS-1$
                getButton(IDialogConstants.OK_ID).setEnabled(false);
            }
        }
    };
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.TranscriptPropertiesDialog.java

License:Open Source License

/**
 * Adds a participant to the transcript.
 * @return//from   ww  w  .  j  a v  a  2  s. c  om
 */
private SelectionAdapter createAddListener() {
    return new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            List<Participant> list = fTranscript.getProject().getParticipants();
            ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new LabelProvider());
            String[] names = new String[list.size()];
            for (int i = 0; i < list.size(); i++) {
                names[i] = list.get(i).getParticipantId();
            }
            dialog.setElements(names);
            dialog.setTitle(Messages.getString("dialogs.TranscriptPropertiesDialog.addWhich")); //$NON-NLS-1$
            dialog.open();
            Object[] result = dialog.getResult();
            for (Object s : result) {
                if (notInTable(s)) {
                    TableItem item = new TableItem(fTable, SWT.NULL);
                    item.setText((String) s);
                }
            }

            if (fTable.getItemCount() > 0) {
                setErrorMessage(null);
                getButton(IDialogConstants.OK_ID).setEnabled(true);
            }
        }
    };
}

From source file:ca.piggott.p2.site.webview.ui.P2SiteBuilderDialog.java

License:Open Source License

public void modifyText(ModifyEvent e) {
    this.getButton(IDialogConstants.OK_ID).setEnabled(text.getText().length() > 0 /* TODO Repo selection */);
}

From source file:ca.usask.cs.srlab.simclipse.clone.comparison.CompareWithOtherResourceDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);
    okButton = getButton(IDialogConstants.OK_ID);
    updateErrorInfo();//from www .ja v  a2 s  .c o  m
    setMessage(CompareMessages.CompareWithOtherResourceDialog_info);
}