Example usage for org.eclipse.jface.fieldassist ControlDecoration ControlDecoration

List of usage examples for org.eclipse.jface.fieldassist ControlDecoration ControlDecoration

Introduction

In this page you can find the example usage for org.eclipse.jface.fieldassist ControlDecoration ControlDecoration.

Prototype

public ControlDecoration(Control control, int position) 

Source Link

Document

Construct a ControlDecoration for decorating the specified control at the specified position relative to the control.

Usage

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

License:Open Source License

/**
 * Returns new control decorator initialised with message.
 * //from ww  w . j ava  2  s.  c o  m
 * @param control control widget
 * @param message initial message or null if none
 * @param type decorator type constant from FieldDecorationRegistry
 * @param visible is it visible when created
 * @return control decorator
 */
public static ControlDecoration createDecorator(Control control, String message, String type, boolean visible) {
    ControlDecoration controlDecoration = new ControlDecoration(control, SWT.LEFT | SWT.TOP);
    controlDecoration.setDescriptionText(message);
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(type);
    controlDecoration.setImage(fieldDecoration.getImage());
    if (!visible)
        controlDecoration.hide();
    return controlDecoration;
}

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

License:Open Source License

/**
 * Returns new control decorator initialised with message.
 * // ww w . j  ava2 s. c  o m
 * @param control control widget
 * @param type decorator type constant from FieldDecorationRegistry
 * @param visible is it visible when created
 * @return control decorator
 */
public static ControlDecoration createDecorator(Control control, String type, boolean visible) {
    ControlDecoration controlDecoration = new ControlDecoration(control, SWT.LEFT | SWT.TOP);
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(type);
    controlDecoration.setImage(fieldDecoration.getImage());
    if (!visible)
        controlDecoration.hide();
    return controlDecoration;
}

From source file:at.medevit.ch.artikelstamm.ui.DetailComposite.java

License:Open Source License

public DetailComposite(Composite parent, int style, String atcCodeLanguage) {
    super(parent, style);
    setLayout(new GridLayout(1, false));
    setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));

    mainComposite = new Composite(this, SWT.NONE);
    mainComposite.setLayout(new GridLayout(1, false));

    DetailComposite.prefAtcLanguage = atcCodeLanguage;

    Composite headerComposite = new Composite(mainComposite, SWT.NONE);
    headerComposite.setLayout(new GridLayout(4, false));
    headerComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    lblDSCR = new Label(headerComposite, SWT.NONE);
    lblDSCR.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblDSCR.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_DARK_SHADOW));
    lblDSCR.setFont(SWTResourceManager.getFont("Lucida Grande", 16, SWT.BOLD));
    GridData gd_lblDSCR = new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1);
    gd_lblDSCR.widthHint = 435;//from  ww  w.j  a  va 2  s . co  m
    lblDSCR.setLayoutData(gd_lblDSCR);

    Composite topComposite = new Composite(headerComposite, SWT.NONE);
    topComposite.setLayout(new GridLayout(6, false));
    topComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1));

    GridData gdd = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gdd.widthHint = 70;
    GridData gdd2 = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    Label lblGtin = new Label(topComposite, SWT.NONE);
    lblGtin.setLayoutData(gdd);
    lblGtin.setToolTipText("European Article Number / Global Trade Index Number");
    lblGtin.setText("EAN/GTIN");

    txtGTIN = new Text(topComposite, SWT.READ_ONLY);
    txtGTIN.setLayoutData(gdd2);
    txtGTIN.setBackground(topComposite.getBackground());

    Label lblPhznr = new Label(topComposite, SWT.NONE);
    lblPhznr.setToolTipText("Pharmacode");
    lblPhznr.setLayoutData(gdd);
    lblPhznr.setText("Pharmacode");

    txtPHZNR = new Text(topComposite, SWT.READ_ONLY);
    txtPHZNR.setLayoutData(gdd2);
    txtPHZNR.setBackground(topComposite.getBackground());

    final Label lblProductNr = new Label(topComposite, SWT.NONE);
    lblProductNr.setToolTipText("Produktnummer");
    lblProductNr.setLayoutData(gdd);
    lblProductNr.setText("Produkt Nr");

    txtProductNr = new Text(topComposite, SWT.READ_ONLY);
    txtProductNr.setLayoutData(gdd2);
    txtProductNr.setBackground(topComposite.getBackground());
    txtProductNr.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            lblProductNr.setVisible(!txtProductNr.getText().isEmpty());
        }
    });

    lblAbgabekategorie = new Label(headerComposite, SWT.NONE);
    lblAbgabekategorie.setText("Abgabekategorie");

    txtABGABEKATEGORIE = new Text(headerComposite, SWT.READ_ONLY);
    txtABGABEKATEGORIE.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    txtABGABEKATEGORIE.setBackground(topComposite.getBackground());
    new Label(headerComposite, SWT.NONE);
    new Label(headerComposite, SWT.NONE);

    Group grpPackungsgroessenPreise = new Group(mainComposite, SWT.NONE);
    grpPackungsgroessenPreise.setText("Preis");
    grpPackungsgroessenPreise.setLayout(new GridLayout(7, false));
    grpPackungsgroessenPreise.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    Label lblExFactoryPreis = new Label(grpPackungsgroessenPreise, SWT.NONE);
    lblExFactoryPreis.setText("Ex-Factory");

    lblEXFACTORYPRICE = new Label(grpPackungsgroessenPreise, SWT.BORDER);
    lblEXFACTORYPRICE.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblPublicPrice = new Label(grpPackungsgroessenPreise, SWT.NONE);
    lblPublicPrice.setText("Publikumspreis");

    txtPUBLICPRICE = new Text(grpPackungsgroessenPreise, SWT.BORDER);
    txtPUBLICPRICE.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    controlDecoIsCalculatedPPUB = new ControlDecoration(txtPUBLICPRICE, SWT.LEFT | SWT.TOP);
    controlDecoIsCalculatedPPUB.setDescriptionText("Preis wurde mittels Marge kalkuliert!");
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
    controlDecoIsCalculatedPPUB.setImage(fieldDecoration.getImage());
    controlDecoIsCalculatedPPUB.hide();

    lblSelbstbehalt = new Label(grpPackungsgroessenPreise, SWT.NONE);
    lblSelbstbehalt.setText("Selbstbehalt (%)");

    lblSELBSTBEHALT = new Text(grpPackungsgroessenPreise, SWT.READ_ONLY);
    lblSELBSTBEHALT.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    btnUserDefinedPrice = new Button(grpPackungsgroessenPreise, SWT.FLAT | SWT.CHECK);
    btnUserDefinedPrice.setToolTipText("Benutzerdefinierter Preis");
    btnUserDefinedPrice.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    btnUserDefinedPrice.setImage(
            ResourceManager.getPluginImage("at.medevit.ch.artikelstamm.ui", "rsc/icons/money--pencil.png"));
    btnUserDefinedPrice.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            item.getValue().setUserDefinedPrice(btnUserDefinedPrice.getSelection());
            m_bindingContext.updateTargets();
            txtPUBLICPRICE.setFocus();
        }
    });

    Group grepATCCode = new Group(mainComposite, SWT.NONE);
    grepATCCode.setLayout(new GridLayout(1, false));
    grepATCCode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    grepATCCode.setText("ATC-Code");

    treeATC = new Tree(grepATCCode, SWT.BORDER);
    GridData gd_treeATC = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_treeATC.heightHint = 80;
    treeATC.setLayoutData(gd_treeATC);
    treeATC.setBackground(parent.getBackground());

    Group grpMarker = new Group(mainComposite, SWT.None);
    grpMarker.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    grpMarker.setText("Marker");
    grpMarker.setLayout(new GridLayout(2, false));

    btnCheckIsNarcotic = new Button(grpMarker, SWT.CHECK);
    btnCheckIsNarcotic.setText("Betubungsmittel");

    btnLPPVEntry = new Button(grpMarker, SWT.CHECK);
    btnLPPVEntry.setToolTipText(
            "Artikel wird in Liste pharmazeutischer Prparate mit spezieller Verwendung (LPPV) gefhrt");
    btnLPPVEntry.setText("LPPV Eintrag");

    Group grpLimitations = new Group(mainComposite, SWT.None);
    grpLimitations.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    grpLimitations.setText("Einschrnkungen");
    grpLimitations.setLayout(new GridLayout(2, false));

    btnlLimitation = new Button(grpLimitations, SWT.CHECK);
    btnlLimitation.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    btnlLimitation.setText("Limitation");

    lblLimitationspunkte = new Label(grpLimitations, SWT.NONE);
    lblLimitationspunkte.setText("Limitationspunkte");

    txtLIMITATIONPOINTS = new Text(grpLimitations, SWT.READ_ONLY);
    txtLIMITATIONPOINTS.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    txtLIMITATIONPOINTS.setBackground(grpLimitations.getBackground());

    lblLimitationstext = new Label(grpLimitations, SWT.NONE);
    lblLimitationstext.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    lblLimitationstext.setText("Limitationstext");

    GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
    gd.widthHint = 450;
    gd.minimumWidth = 450;
    txtLIMITATIONTEXT = new Text(grpLimitations, SWT.WRAP | SWT.MULTI);
    txtLIMITATIONTEXT.setLayoutData(gd);
    txtLIMITATIONTEXT.setBackground(grpLimitations.getBackground());

    Group grpHersteller = new Group(mainComposite, SWT.NONE);
    grpHersteller.setLayout(new GridLayout(1, false));
    grpHersteller.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    grpHersteller.setText("Hersteller");

    lblHERSTELLER = new Label(grpHersteller, SWT.NONE);
    lblHERSTELLER.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    grpDefaultSignature = new Group(mainComposite, SWT.NONE);
    grpDefaultSignature.setLayout(new GridLayout(1, false));
    grpDefaultSignature.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    grpDefaultSignature.setText("Standard Signatur");

    adsc = new ArticleDefaultSignatureComposite(grpDefaultSignature, SWT.NONE);
    adsc.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    adsc.setOnLocationEnabled(false);

    m_bindingContext = initDataBindings();
    adsc.initDataBindings(m_bindingContext);
    adsc.setAutoSave(true);

    this.setContent(mainComposite);
    this.setExpandHorizontal(true);
    this.setExpandVertical(true);

    this.setMinSize(mainComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    this.layout(true, true);
}

From source file:au.gov.ansto.bragg.echidna.exp.task.AbstractEchidnaScanTask.java

License:Open Source License

public static void addValidator(final Text textBox, final Validator validator) {
    final ControlDecoration startangDec = new ControlDecoration(textBox, SWT.LEFT | SWT.BOTTOM);
    textBox.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (validator.isValid(textBox.getText())) {
                startangDec.hide();//from w  ww  . j  a v  a2 s  . c  o  m
            } else {
                startangDec.setImage(errorDec.getImage());
                startangDec.setDescriptionText(validator.getErrorMessage());
                startangDec.show();
            }
        }
    });
}

From source file:au.gov.ansto.bragg.kowari.exp.command.AbstractScanParameter.java

License:Open Source License

protected void addValidator(final Text textBox, final ParameterValidator validator) {
    final ControlDecoration startangDec = new ControlDecoration(textBox, SWT.LEFT | SWT.BOTTOM);
    textBox.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (validator.isValid(textBox.getText())) {
                startangDec.hide();//w  ww  .j a va 2s. c  om
            } else {
                startangDec.setImage(errorDec.getImage());
                startangDec.setDescriptionText(validator.getErrorMessage());
                startangDec.show();
            }
        }
    });
}

From source file:au.gov.ansto.bragg.kowari.exp.command.AbstractScanParameter.java

License:Open Source License

protected void addSelectionValidator(final Combo combo, final ParameterValidator validator) {
    final ControlDecoration startangDec = new ControlDecoration(combo, SWT.LEFT | SWT.BOTTOM);
    combo.addModifyListener(new ModifyListener() {

        @Override/*  ww  w.  j a  v a  2 s .c o m*/
        public void modifyText(ModifyEvent arg0) {
            if (validator.isValid(combo.getText()))
                startangDec.hide();
            else {
                startangDec.setImage(errorDec.getImage());
                startangDec.setDescriptionText(validator.getErrorMessage());
                startangDec.show();
            }
        }
    });
}

From source file:bndtools.editor.components.SvcInterfaceSelectionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Control dialogArea = super.createDialogArea(parent);

    FieldDecoration proposalDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

    KeyStroke assistKeyStroke = null;
    try {/*from w  w w  . ja  va  2 s  . co  m*/
        assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException x) {
        // Ignore
    }

    Text textField = getText();
    ControlDecoration decor = new ControlDecoration(textField, SWT.LEFT | SWT.TOP);
    decor.setImage(proposalDecoration.getImage());
    decor.setDescriptionText(MessageFormat.format(
            "Content Assist is available. Press {0} or start typing to activate", assistKeyStroke.format()));
    decor.setShowHover(true);
    decor.setShowOnlyOnFocus(true);

    SvcInterfaceProposalProvider proposalProvider = new SvcInterfaceProposalProvider(searchContext);
    ContentProposalAdapter proposalAdapter = new ContentProposalAdapter(textField, new TextContentAdapter(),
            proposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
    proposalAdapter.addContentProposalListener(proposalProvider);
    proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    proposalAdapter.setLabelProvider(new JavaContentProposalLabelProvider());
    proposalAdapter.setAutoActivationDelay(1500);

    return dialogArea;
}

From source file:ca.uvic.chisel.javasketch.persistence.ui.internal.FiltersComposite.java

License:Open Source License

/**
 * @param group/*from   w w w  .j ava  2s  .c om*/
 * @return
 */
private TableViewer createTableArea(Group group) {
    group.setLayout(new GridLayout(3, false));
    final Text addText = new Text(group, SWT.SINGLE | SWT.BORDER);
    addText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
    final Button addButton = new Button(group, SWT.PUSH);
    addButton.setText("Add");
    addButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
    Button removeButton = new Button(group, SWT.PUSH);
    removeButton.setText("Remove");
    addButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
    TableViewer tableViewer = new TableViewer(group);
    tableViewer.getTable().setLinesVisible(true);
    GridData tableData = new GridData(GridData.FILL, GridData.FILL, true, true);
    tableData.horizontalSpan = 3;
    tableViewer.getTable().setLayoutData(tableData);
    //      TableLayout tl = new TableLayout();
    //      tableViewer.getTable().setLayout(tl);
    final TableViewerColumn labelColumn = new TableViewerColumn(tableViewer, SWT.NONE);
    labelColumn.setLabelProvider(new SimpleCellLabelProvider());
    tableViewer.setLabelProvider(new SimpleCellLabelProvider());
    tableViewer.setContentProvider(new ArrayContentProvider());
    tableViewer.setInput(new String[0]);
    addText.addModifyListener(
            new AddFilterAssistListener(addButton, new ControlDecoration(addText, SWT.TOP | SWT.LEFT)));
    AddFilterListener addInclusionListener = new AddFilterListener(addText, tableViewer);
    addButton.addSelectionListener(addInclusionListener);
    addButton.addKeyListener(addInclusionListener);
    addText.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            getShell().setDefaultButton(addButton);
        }
    });
    removeButton.addSelectionListener(new RemoveItemListener(tableViewer));
    try {
        new ContentProposalAdapter(addText, new TextContentAdapter(), new SimpleJavaContentProposalProvider(),
                KeyStroke.getInstance("Ctrl+Space"), new char[] { '.' });
    } catch (ParseException e1) {
    }
    tableViewer.getTable().addControlListener(new ControlAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent)
         */
        @Override
        public void controlResized(ControlEvent e) {
            labelColumn.getColumn().setWidth(((Table) e.widget).getClientArea().width);
        }
    });
    return tableViewer;
}

From source file:carisma.ui.eclipse.editors.AdfEditorCheckDetailsPage.java

License:Open Source License

/**
 * Handles Integer parameter./*from w  w  w . ja  va 2s.c  o  m*/
 * 
 * @param comp
 *            the composite for the parameter input elements
 * @param checkParameter
 *            the checkParameter to handle
 */
private void handleIntParameter(final Composite comp, final CheckParameter checkParameter) {
    final String errorText = "Please insert an integer value!";

    final Text text = this.toolkit.createText(comp, "", SWT.SINGLE);
    GridData layoutData = new GridData(SWT.FILL, SWT.TOP, true, false);
    layoutData.horizontalSpan = 2;
    text.setLayoutData(layoutData);

    int value = ((IntegerParameter) checkParameter).getValue();
    text.setText(String.valueOf(value));
    text.setToolTipText(checkParameter.getDescriptor().getDescription());

    final ControlDecoration decoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
    Image contpro = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR)
            .getImage();
    decoration.setImage(contpro);
    decoration.hide();

    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(final ModifyEvent e) {
            try {
                AdfEditorCheckDetailsPage.this.controller.setParameter(checkParameter,
                        Integer.valueOf(text.getText()));
                decoration.hide();
            } catch (Exception exc) {
                AdfEditorCheckDetailsPage.this.controller.setParameter(checkParameter, new Integer(0));
                decoration.show();
                decoration.showHoverText(errorText);
            }
            if (text.getText().isEmpty()) {
                if (!checkParameter.getDescriptor().isOptional()) {
                    AdfEditorCheckDetailsPage.this.controller.setParameterQod(checkParameter, true);
                }
            } else {
                AdfEditorCheckDetailsPage.this.controller.setParameterQod(checkParameter, false);
            }
            AdfEditorCheckDetailsPage.this.qodButtonMap.get(checkParameter)
                    .setSelection(checkParameter.isQueryOnDemand());
        }
    });

    text.addListener(SWT.Verify, new Listener() {
        @Override
        public void handleEvent(final Event e) {
            String newCharacter = e.text;
            String newText = applyEventToText(text, e);
            try {
                if (!newCharacter.equals("") && !newCharacter.equals("-")) {
                    Integer.parseInt(newCharacter);
                }
                if (!newText.equals("")) {
                    Integer.parseInt(newText);
                }
                decoration.hide();
            } catch (Exception exc) {
                e.doit = false;
                decoration.show();
                decoration.showHoverText(errorText);
            }
        }
    });

    text.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(final FocusEvent e) {
        }

        @Override
        public void focusLost(final FocusEvent e) {
            decoration.hide();
        }
    });

    text.addListener(SWT.Modify, this.masterListener);
}

From source file:carisma.ui.eclipse.editors.AdfEditorCheckDetailsPage.java

License:Open Source License

/**
 * Handles Float parameter./*from w w  w.jav  a2s  . c  o m*/
 * 
 * @param comp
 *            the composite for the parameter input elements
 * @param checkParameter
 *            the checkParamter to handle
 */
private void handleFloatParameter(final Composite comp, final CheckParameter checkParameter) {
    final String errorText = "Please insert a float value!";

    final Text text = this.toolkit.createText(comp, "", SWT.SINGLE);
    GridData layoutData = new GridData(SWT.FILL, SWT.TOP, true, false);
    layoutData.horizontalSpan = 2;
    text.setLayoutData(layoutData);

    float value = ((FloatParameter) checkParameter).getValue();
    text.setText(String.valueOf(value));

    text.setToolTipText(checkParameter.getDescriptor().getDescription());
    final ControlDecoration decoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP);
    Image contpro = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR)
            .getImage();
    decoration.setImage(contpro);
    decoration.hide();

    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(final ModifyEvent e) {
            try {
                AdfEditorCheckDetailsPage.this.controller.setParameter(checkParameter,
                        Float.valueOf(text.getText()));
                AdfEditorCheckDetailsPage.this.controller.setParameterQod(checkParameter, false);
                decoration.hide();
            } catch (Exception exc) { // e.g. field is empty
                AdfEditorCheckDetailsPage.this.controller.setParameter(checkParameter, new Float(0.0f));
                if (!checkParameter.getDescriptor().isOptional()) {
                    AdfEditorCheckDetailsPage.this.controller.setParameterQod(checkParameter, true);
                }
                decoration.show();
                decoration.showHoverText(errorText);
            }
            AdfEditorCheckDetailsPage.this.qodButtonMap.get(checkParameter)
                    .setSelection(checkParameter.isQueryOnDemand());
        }
    });

    text.addListener(SWT.Verify, new Listener() {
        @Override
        public void handleEvent(final Event e) {
            e.text = e.text.replace(",", ".");
            String newCharacter = e.text;
            String newText = applyEventToText(text, e);
            try {
                if (!newCharacter.equals("") && !newCharacter.equals("-") && !newCharacter.equals(".")) {
                    Float.parseFloat(newCharacter);
                }
                if (!newText.equals("")) {
                    float newFloat = Float.parseFloat(newText);
                    if (newFloat != 0) {
                        if ((newFloat > Float.MAX_VALUE || newFloat < Float.MIN_VALUE)
                                && ((newFloat * -1) > Float.MAX_VALUE || (newFloat * -1) < Float.MIN_VALUE)) {
                            throw new NumberFormatException("Float out of range");
                        }
                    }
                }
                decoration.hide();
            } catch (Exception exc) {
                e.doit = false;
                decoration.show();
                decoration.showHoverText(errorText);
            }
        }
    });

    text.addFocusListener(new FocusListener() {
        @Override
        public void focusGained(final FocusEvent e) {
        }

        @Override
        public void focusLost(final FocusEvent e) {
            decoration.hide();
        }
    });

    text.addListener(SWT.Modify, this.masterListener);
}