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:ac.soton.eventb.classdiagrams.diagram.part.ClassdiagramsElementChooserDialog.java

License:Open Source License

/**
 * @generated
 */
private void setOkButtonEnabled(boolean enabled) {
    getButton(IDialogConstants.OK_ID).setEnabled(enabled);
}

From source file:ac.soton.eventb.classdiagrams.diagram.sheet.custom.NewConstraintDialog.java

License:Open Source License

private void update() {
    Control button = getButton(IDialogConstants.OK_ID);
    if (button != null) {
        button.setEnabled(predicateValid && nameValid);
    }
}

From source file:ac.soton.eventb.classdiagrams.diagram.sheet.custom.NewEventDialog.java

License:Open Source License

private void update() {
    Control button = getButton(IDialogConstants.OK_ID);
    if (button != null) {
        button.setEnabled(nameValid);
    }
}

From source file:ac.soton.fmusim.components.ui.dialogs.EventBPortDialog.java

License:Open Source License

/**
 * Updates the buttons based on validation.
 *///from  w ww  .  ja  v a 2  s  . c o m
private void update() {
    boolean valid = true;
    Control button = getButton(IDialogConstants.OK_ID);
    if (button != null) {
        valid &= variableValid;
        valid &= parameterValid;
        button.setEnabled(valid);
    }
}

From source file:ac.soton.fmusim.components.ui.dialogs.SimulationInputDialog.java

License:Open Source License

/**
 * Updates the buttons based on validation results.
 *///  www .jav a 2s  . c o m
private void update() {
    Control button = getButton(IDialogConstants.OK_ID);
    if (button != null) {
        button.setEnabled(startTimeValid && stopTimeValid && stepSizeValid && totalTimeValid && stepTimeValid);
    }
}

From source file:ac.soton.multisim.diagram.sheet.custom.common.EventBPortDialog.java

License:Open Source License

/**
 * Updates the buttons based on validation.
 *///from ww w . j a v  a 2 s.  c  o m
private void update() {
    Control button = getButton(IDialogConstants.OK_ID);
    if (button != null) {
        button.setEnabled(elementValid);
    }
}

From source file:ac.soton.multisim.ui.dialogs.SimulationSettingsDialog.java

License:Open Source License

/**
 * Updates the buttons based on validation results.
 *///from   ww w .ja va  2 s . c  om
private void update() {
    Control button = getButton(IDialogConstants.OK_ID);
    if (button != null) {
        button.setEnabled(startTimeValid && stopTimeValid && totalTimeValid && stepTotalValid);
    }
}

From source file:at.bestsolution.efxclipse.tooling.pde.e4.project.NewApplicationWizardPage.java

License:Open Source License

/**
 * create Rect Set dialog/*w w  w.j av  a2 s .  c om*/
 * 
 * @param parent
 * @param valueText
 * @return
 */
public Dialog createRectDialog(final Composite parent, final Text valueText) {
    return new Dialog(parent.getShell()) {
        Text xPointText, yPointText, widthText, heightText;

        @Override
        protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
            return super.createButton(parent, id, label, defaultButton);
        }

        @Override
        protected Control createDialogArea(final Composite parent) {
            Composite composite = (Composite) super.createDialogArea(parent);
            composite.getShell().setText("Set Rect");
            Group group = new Group(composite, SWT.NONE);
            group.setText("Rect");
            GridLayout gridLayout = new GridLayout();
            gridLayout.numColumns = 4;
            group.setLayout(gridLayout);

            Label xPointLabel = new Label(group, SWT.NONE);
            xPointLabel.setText("X:");
            xPointText = new Text(group, SWT.BORDER);
            VerifyListener verifyListener = createVerifyListener(parent.getShell());
            xPointText.addVerifyListener(verifyListener);
            Label yPointLabel = new Label(group, SWT.NONE);
            yPointLabel.setText("Y:");
            yPointText = new Text(group, SWT.BORDER);
            yPointText.addVerifyListener(verifyListener);
            Label widthLabel = new Label(group, SWT.NONE);
            widthLabel.setText("Width:");
            widthText = new Text(group, SWT.BORDER);
            widthText.addVerifyListener(verifyListener);
            Label heighttLabel = new Label(group, SWT.NONE);
            heighttLabel.setText("Height:");
            heightText = new Text(group, SWT.BORDER);
            heightText.addVerifyListener(verifyListener);

            return composite;
        }

        @Override
        protected void buttonPressed(int buttonId) {
            if (IDialogConstants.OK_ID == buttonId) {
                String xPoint = xPointText.getText();
                String yPoint = yPointText.getText();
                String width = widthText.getText();
                String height = heightText.getText();
                if (xPoint.length() == 0 || yPoint.length() == 0 || width.length() == 0
                        || height.length() == 0) {
                    MessageDialog.openWarning(parent.getShell(), "Input value empty",
                            "Value shoud not be empty!");
                } else {
                    valueText.setText(xPoint + "," + yPoint + "," + width + "," + height);
                    okPressed();
                }
            } else if (IDialogConstants.CANCEL_ID == buttonId) {
                cancelPressed();
            }
        }
    };
}

From source file:at.bestsolution.persistence.emap.ecoregenerator.GenModelGenerateDoctrineActionDelegate.java

License:Open Source License

@Override
public final void runWithEvent(final IAction action, final Event event) {
    if (action instanceof EditorPluginAction) {

        ISelection s = ((EditorPluginAction) action).getSelection();
        if (s instanceof IStructuredSelection && !s.isEmpty()
                && ((IStructuredSelection) s).getFirstElement() instanceof GenModel) {
            try {
                GenModel genModel = (GenModel) ((IStructuredSelection) s).getFirstElement();

                IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
                List<IProject> emapProjects = new ArrayList<IProject>();
                for (IProject p : allProjects) {
                    if (p.isOpen() && p.getNature(Messages.GenModelGenerateDoctrineActionDelegate_5) != null
                            && p.getNature("org.eclipse.xtext.ui.shared.xtextNature") != null) {
                        emapProjects.add(p);
                    }/* w w  w . ja v a2  s.c  o  m*/
                }
                if (emapProjects.isEmpty()) {
                    MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                            Messages.GenModelGenerateDoctrineActionDelegate_6,
                            Messages.GenModelGenerateDoctrineActionDelegate_7);
                } else {
                    GeneratorOptionsDialog dlg = new GeneratorOptionsDialog(
                            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), emapProjects);
                    if (dlg.open() == IDialogConstants.OK_ID) {
                        final IProject project = dlg.getSelectedProject();
                        if (!project.exists()) {
                            project.create(new NullProgressMonitor());
                        }
                        if (!project.isOpen()) {
                            project.open(new NullProgressMonitor());
                        }

                        final HashMap<EClass, EClassMetaInfo> metaInfo = new HashMap<EClass, EClassMetaInfo>();
                        try {
                            IFolder srcFolder = dlg.getSelectedFolder();
                            for (GenPackage pack : genModel.getGenPackages()) {
                                collectMetaPackageCode(metaInfo, project, srcFolder, srcFolder, pack);
                            }
                            for (GenPackage pack : genModel.getGenPackages()) {
                                generatePackageCode(metaInfo, project, srcFolder, pack);
                            }
                        } finally {
                            metaInfo.clear();
                        }
                    }
                }
            } catch (CoreException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } else {
            MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    Messages.GenModelGenerateDoctrineActionDelegate_8,
                    Messages.GenModelGenerateDoctrineActionDelegate_9);
        }
    } else {
        MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                Messages.GenModelGenerateDoctrineActionDelegate_10,
                Messages.GenModelGenerateDoctrineActionDelegate_11);
    }
}

From source file:at.medevit.ch.artikelstamm.elexis.common.ui.ArtikelstammDetailDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*w w  w  . j  a v a2 s.  c o m*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}