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:ch.parisi.e4.advancedlaunch.dialog.MultiLaunchConfigurationSelectionDialog.java

License:Open Source License

protected void validate() {
    Button btnOk = getButton(IDialogConstants.OK_ID);
    isValid = true;/*from  w  w  w  .  j a  v a 2s. co  m*/

    if (isValid) {
        setErrorMessage(null);
        if (action == PostLaunchAction.DELAY) {
            try {
                isValid = ((Integer.parseInt(actionParam.toString()) > 0));
            } catch (Exception e) {
                isValid = false;
                setErrorMessage(isValid ? null : LaunchMessages.LaunchGroupConfigurationSelectionDialog_10);
            }
        } else if (action == PostLaunchAction.WAIT_FOR_CONSOLESTRING) {
            isValid = (!String.valueOf(actionParam).trim().isEmpty());
            setErrorMessage(isValid ? null : LaunchMessages.LaunchGroupConfigurationSelectionDialog_10_2);
        }
        if (currentSelection == null) {
            isValid = false;
        } else {
            IStructuredSelection selection = (IStructuredSelection) currentSelection;
            if (selection.getFirstElement() instanceof ILaunchConfigurationType) {
                isValid = false;
                setErrorMessage(
                        isValid ? null : LaunchMessages.LaunchGroupConfiguration_NotALaunchConfiguration);
            }
        }
    }

    if (btnOk != null) {
        btnOk.setEnabled(isValid);
    }
}

From source file:cn.com.sky.hyperbola.LoginDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    Button removeCurrentUser = createButton(parent, IDialogConstants.CLIENT_ID, "&Delete User", false);
    removeCurrentUser.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            savedDetails.remove(userIdText.getText());
            initializeUsers("");
        }//from   w  w w. ja  va  2  s .  c  o m
    });
    createButton(parent, IDialogConstants.OK_ID, "&Login", true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

}

From source file:cn.com.sky.hyperbola.LoginDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID || buttonId == IDialogConstants.CANCEL_ID)
        saveDescriptors();//from   w  ww.ja va  2s . c om
    super.buttonPressed(buttonId);
}

From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.CloudUiUtil.java

License:Open Source License

/**
 * Prompts user to define a value for the wildcard in the cloud URL, then
 * return the new URL//from ww w  .ja  v a2 s .  c o  m
 * 
 * @param cloudUrl
 * @param allCloudUrls
 * @param shell
 * @return new URL, null if no wildcard appears in cloudUrl or if user
 * cancels out of defining a new value
 */
public static CloudServerURL getWildcardUrl(CloudServerURL cloudUrl, List<CloudServerURL> allCloudUrls,
        Shell shell) {
    String url = cloudUrl.getUrl();
    if (url.contains("{")) { //$NON-NLS-1$
        int startIndex = url.indexOf("{"); //$NON-NLS-1$
        int endIndex = url.indexOf("}"); //$NON-NLS-1$
        String wildcard = url.substring(startIndex + 1, endIndex);

        TargetURLDialog dialog = new TargetURLDialog(shell, cloudUrl, wildcard, allCloudUrls);
        if (dialog.open() == IDialogConstants.OK_ID) {
            url = dialog.getUrl();
            String name = dialog.getName();
            // CloudUiUtil.addUserDefinedUrl(serverTypeId, name, url);
            return new CloudServerURL(name, url, true);
        } else {
            return null;
        }
    }

    return null;
}

From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.editor.CloudUrlDialog.java

License:Open Source License

private void update() {
    boolean canFinish = false;

    if (name == null || name.length() == 0) {
        messageLabel.setText(Messages.CloudUrlDialog_TEXT_ENTER_URL_LABEL);
    } else if (url == null || url.length() == 0) {
        messageLabel.setText(Messages.CloudUrlDialog_TEXT_ENTER_URL);
    } else {//from  www .j  a  va 2  s .  c o m
        canFinish = true;

        //         List<CloudURL> cloudUrls = CloudUiUtil.getAllUrls(serverTypeId);
        for (CloudServerURL cloudUrl : allCloudUrls) {
            if (!cloudUrl.getUrl().contains("{")) { //$NON-NLS-1$
                if (cloudUrl.getName().equals(name)) {
                    canFinish = false;
                    messageLabel.setText(NLS.bind(Messages.CloudUrlDialog_TEXT_URL_EXISTS, name));
                }
            }
        }

        if (canFinish) {
            try {
                URL urlObject = new URL(url);
                String host = urlObject.getHost();
                if (host == null || host.length() == 0) {
                    canFinish = false;
                    messageLabel.setText(Messages.COMMONTXT_ENTER_VALID_URL);
                }
            } catch (MalformedURLException e) {
                messageLabel.setText(Messages.COMMONTXT_ENTER_VALID_URL);
                canFinish = false;
            }

            if (canFinish) {
                messageLabel.setText(Messages.CloudUrlDialog_TEXT_CREATE_NEW_URL);
            }
        }
    }
    getButton(IDialogConstants.OK_ID).setEnabled(canFinish);
}

From source file:cn.edu.pku.ogeditor.dialogs.ConceptFilterDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // TODO Auto-generated method stub
    // super.createButtonsForButtonBar(parent);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

}

From source file:cn.edu.pku.ogeditor.dialogs.ConceptFilterDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
        List<Shape> shapes = diagram.getAllShapesNames();
        for (int i = 0; i < shapes.size(); i++) {
            Shape curShape = shapes.get(i);
            if (tv.getChecked(curShape)) {
                curShape.setVisible(true);
            } else {
                curShape.setVisible(false);
            }//from  w w  w.  j a v a2s .com
        }
    }
    super.buttonPressed(buttonId);
}

From source file:cn.edu.pku.ogeditor.dialogs.RelationFilterDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // TODO Auto-generated method stub
    // super.createButtonsForButtonBar(parent);
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:cn.edu.pku.ogeditor.dialogs.RelationFilterDialog.java

License:Open Source License

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
        List<Connection> connections = diagram.getAllConnectionsNames();
        for (int i = 0; i < connections.size(); i++) {
            Connection curConnection = connections.get(i);
            if (tv.getChecked(curConnection)) {
                diagram.setConnectionsVisible(curConnection, true);
            }//from   w  w w.  j a v a2  s .  co  m
        }
        for (int i = 0; i < connections.size(); i++) {
            Connection curConnection = connections.get(i);
            if (!tv.getChecked(curConnection)) {
                diagram.setConnectionsVisible(curConnection, false);
            }
        }
    }
    super.buttonPressed(buttonId);
}

From source file:cn.edu.xmu.tidems.control.ui.views.components.MzCalibrationDialog.java

License:Open Source License

@Override
protected void buttonPressed(final int buttonId) {

    if (buttonId == IDialogConstants.OK_ID) {
        if (checkInput()) {
            final int size = 3;
            final double[] tof = new double[size];
            final double[] mz = new double[size];
            for (int i = 0; i < size; i++) {
                tof[i] = Double.parseDouble(txtTof[i].getText().trim());
                mz[i] = Double.parseDouble(txtMz[i].getText().trim());
            }// w  ww. j  a v  a  2  s .c  o m
            final double[] factors = TideMSUtil.polynomialFit(tof, mz, 2);
            updateMZCalibrationFactor(factors);
            close();
        }
    } else {
        close();
    }
}