Example usage for org.eclipse.jface.fieldassist FieldDecorationRegistry DEC_INFORMATION

List of usage examples for org.eclipse.jface.fieldassist FieldDecorationRegistry DEC_INFORMATION

Introduction

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

Prototype

String DEC_INFORMATION

To view the source code for org.eclipse.jface.fieldassist FieldDecorationRegistry DEC_INFORMATION.

Click Source Link

Document

Decoration id for the decoration that should be used to cue the user that a field has additional information.

Usage

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;//  w  ww .ja  va2  s .c  o 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:bndtools.editor.components.ComponentDetailsPage.java

License:Open Source License

void fillLifecycleSection(FormToolkit toolkit, Section section) {
    FieldDecoration infoDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
    ControlDecoration decor;/*  w  ww.  j a  v  a  2 s .  c  o m*/

    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);

    // Create controls
    toolkit.createLabel(composite, "Activate method:");
    txtActivate = toolkit.createText(composite, "", SWT.BORDER);
    toolkit.createLabel(composite, "Deactivate method:");
    txtDeactivate = toolkit.createText(composite, "", SWT.BORDER);
    toolkit.createLabel(composite, "Modified method:");
    txtModified = toolkit.createText(composite, "", SWT.BORDER);

    toolkit.createLabel(composite, ""); // Spacer
    btnImmediate = toolkit.createButton(composite, "Immediate", SWT.CHECK);
    decor = new ControlDecoration(btnImmediate, SWT.RIGHT, composite);
    decor.setImage(infoDecoration.getImage());
    decor.setDescriptionText("The component will be activated immediately,\n"
            + "even when it provides a service and no consumers\n" + "of the service exist.");
    decor.setShowHover(true);

    toolkit.createLabel(composite, ""); // Spacer
    btnSvcFactory = toolkit.createButton(composite, "Service Factory", SWT.CHECK);
    decor = new ControlDecoration(btnSvcFactory, SWT.RIGHT, composite);
    decor.setImage(infoDecoration.getImage());
    decor.setDescriptionText("An instance of the component will be created\nfor each service consumer.");
    decor.setShowHover(true);

    toolkit.createLabel(composite, "Factory ID:");
    txtFactoryId = toolkit.createText(composite, "", SWT.BORDER);
    decor = new ControlDecoration(txtFactoryId, SWT.LEFT | SWT.BOTTOM, composite);
    decor.setImage(infoDecoration.getImage());
    decor.setDescriptionText(
            "Makes the component a 'factory component', published\nunder the ComponentFactory service, with the specified ID.");

    // Listeners
    txtActivate.addListener(SWT.Modify, new MarkDirtyListener(ServiceComponent.COMPONENT_ACTIVATE));
    txtDeactivate.addListener(SWT.Modify, new MarkDirtyListener(ServiceComponent.COMPONENT_DEACTIVATE));
    txtModified.addListener(SWT.Modify, new MarkDirtyListener(ServiceComponent.COMPONENT_MODIFIED));
    txtFactoryId.addListener(SWT.Modify, new MarkDirtyListener(ServiceComponent.COMPONENT_FACTORY));
    btnImmediate.addListener(SWT.Selection, new MarkDirtyListener(ServiceComponent.COMPONENT_IMMEDIATE));
    btnSvcFactory.addListener(SWT.Selection, new MarkDirtyListener(ServiceComponent.COMPONENT_SERVICEFACTORY));

    // Layout
    composite.setLayout(new GridLayout(2, false));

    GridData gd;
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalIndent = 5;
    txtActivate.setLayoutData(gd);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalIndent = 5;
    txtDeactivate.setLayoutData(gd);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalIndent = 5;
    txtModified.setLayoutData(gd);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalIndent = 5;
    txtFactoryId.setLayoutData(gd);
}

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

License:Open Source License

void fillConfigPolicySection(FormToolkit toolkit, Section section) {
    FieldDecoration infoDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
    ControlDecoration decor;/* w ww . j a  va  2s . c o m*/

    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);
    btnConfigPolicyOptional = toolkit.createButton(composite, "Optional", SWT.RADIO);
    decor = new ControlDecoration(btnConfigPolicyOptional, SWT.RIGHT, composite);
    decor.setImage(infoDecoration.getImage());
    decor.setDescriptionText(
            "The component will be activated whether or not\nmatching configuration data is available.");
    decor.setShowHover(true);
    btnConfigPolicyRequire = toolkit.createButton(composite, "Require", SWT.RADIO);
    decor = new ControlDecoration(btnConfigPolicyRequire, SWT.RIGHT, composite);
    decor.setImage(infoDecoration.getImage());
    decor.setDescriptionText(
            "The component will be activated ONLY if matching\nconfiguration data is available.");
    decor.setShowHover(true);
    btnConfigPolicyIgnore = toolkit.createButton(composite, "Ignore", SWT.RADIO);
    decor = new ControlDecoration(btnConfigPolicyIgnore, SWT.RIGHT, composite);
    decor.setImage(infoDecoration.getImage());
    decor.setDescriptionText("The component will not receive configuration\ndata from Configuration Admin.");
    decor.setShowHover(true);

    // Listeners
    MarkDirtyListener configPolicyDirtyListener = new MarkDirtyListener(
            ServiceComponent.COMPONENT_CONFIGURATION_POLICY);
    btnConfigPolicyOptional.addListener(SWT.Selection, configPolicyDirtyListener);
    btnConfigPolicyRequire.addListener(SWT.Selection, configPolicyDirtyListener);
    btnConfigPolicyIgnore.addListener(SWT.Selection, configPolicyDirtyListener);

    // Layout
    GridLayout layout = new GridLayout(3, false);
    layout.horizontalSpacing = 15;
    composite.setLayout(layout);
}

From source file:bndtools.editor.contents.GeneralInfoPart.java

License:Open Source License

private void createSection(Section section, FormToolkit toolkit) {
    section.setText("Basic Information");

    KeyStroke assistKeyStroke = null;
    try {//from w ww .  j  a  v  a  2s. c om
        assistKeyStroke = KeyStroke.getInstance("Ctrl+Space");
    } catch (ParseException x) {
        // Ignore
    }
    FieldDecoration contentAssistDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);

    Composite composite = toolkit.createComposite(section);
    section.setClient(composite);

    toolkit.createLabel(composite, "Version:");
    txtVersion = toolkit.createText(composite, "", SWT.BORDER);
    ToolTips.setupMessageAndToolTipFromSyntax(txtVersion, Constants.BUNDLE_VERSION);

    Hyperlink linkActivator = toolkit.createHyperlink(composite, "Activator:", SWT.NONE);
    txtActivator = toolkit.createText(composite, "", SWT.BORDER);
    ToolTips.setupMessageAndToolTipFromSyntax(txtActivator, Constants.BUNDLE_ACTIVATOR);

    toolkit.createLabel(composite, "Declarative Services:");
    cmbComponents = new Combo(composite, SWT.READ_ONLY);

    // Content Proposal for the Activator field
    ContentProposalAdapter activatorProposalAdapter = null;

    ActivatorClassProposalProvider proposalProvider = new ActivatorClassProposalProvider();
    activatorProposalAdapter = new ContentProposalAdapter(txtActivator, new TextContentAdapter(),
            proposalProvider, assistKeyStroke, UIConstants.autoActivationCharacters());
    activatorProposalAdapter.addContentProposalListener(proposalProvider);
    activatorProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    activatorProposalAdapter.setLabelProvider(new JavaContentProposalLabelProvider());
    activatorProposalAdapter.setAutoActivationDelay(1000);

    // Decorator for the Activator field
    ControlDecoration decorActivator = new ControlDecoration(txtActivator, SWT.LEFT | SWT.CENTER, composite);
    decorActivator.setImage(contentAssistDecoration.getImage());
    decorActivator.setMarginWidth(3);
    if (assistKeyStroke == null) {
        decorActivator.setDescriptionText("Content Assist is available. Start typing to activate");
    } else {
        decorActivator.setDescriptionText(
                MessageFormat.format("Content Assist is available. Press {0} or start typing to activate",
                        assistKeyStroke.format()));
    }
    decorActivator.setShowOnlyOnFocus(true);
    decorActivator.setShowHover(true);

    // Decorator for the Components combo
    ControlDecoration decorComponents = new ControlDecoration(cmbComponents, SWT.LEFT | SWT.CENTER, composite);
    decorComponents.setImage(FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
    decorComponents.setMarginWidth(3);
    decorComponents.setDescriptionText("Use Java annotations to detect Declarative Service Components.");
    decorComponents.setShowOnlyOnFocus(false);
    decorComponents.setShowHover(true);

    // Listeners
    txtVersion.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            lock.ifNotModifying(new Runnable() {
                @Override
                public void run() {
                    addDirtyProperty(Constants.BUNDLE_VERSION);
                }
            });
        }
    });
    cmbComponents.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            lock.ifNotModifying(new Runnable() {
                @Override
                public void run() {
                    ComponentChoice old = componentChoice;

                    int index = cmbComponents.getSelectionIndex();
                    if (index >= 0 && index < ComponentChoice.values().length) {
                        componentChoice = ComponentChoice.values()[cmbComponents.getSelectionIndex()];
                        if (old != componentChoice) {
                            addDirtyProperty(aQute.bnd.osgi.Constants.SERVICE_COMPONENT);
                            addDirtyProperty(aQute.bnd.osgi.Constants.DSANNOTATIONS);
                            if (old == null) {
                                cmbComponents.remove(ComponentChoice.values().length);
                            }
                        }
                    }
                }
            });
        }
    });
    txtActivator.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent ev) {
            lock.ifNotModifying(new Runnable() {
                @Override
                public void run() {
                    addDirtyProperty(Constants.BUNDLE_ACTIVATOR);
                }
            });
        }
    });
    linkActivator.addHyperlinkListener(new HyperlinkAdapter() {
        @Override
        public void linkActivated(HyperlinkEvent ev) {
            String activatorClassName = txtActivator.getText();
            if (activatorClassName != null && activatorClassName.length() > 0) {
                try {
                    IJavaProject javaProject = getJavaProject();
                    if (javaProject == null)
                        return;

                    IType activatorType = javaProject.findType(activatorClassName);
                    if (activatorType != null) {
                        JavaUI.openInEditor(activatorType, true, true);
                    }
                } catch (PartInitException e) {
                    ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null,
                            new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0,
                                    MessageFormat.format("Error opening an editor for activator class '{0}'.",
                                            activatorClassName),
                                    e));
                } catch (JavaModelException e) {
                    ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null,
                            new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, MessageFormat.format(
                                    "Error searching for activator class '{0}'.", activatorClassName), e));
                }
            }
        }
    });
    activatorProposalAdapter.addContentProposalListener(new IContentProposalListener() {
        @Override
        public void proposalAccepted(IContentProposal proposal) {
            if (proposal instanceof JavaContentProposal) {
                String selectedPackageName = ((JavaContentProposal) proposal).getPackageName();
                if (!model.isIncludedPackage(selectedPackageName)) {
                    model.addPrivatePackage(selectedPackageName);
                }
            }
        }
    });

    // Layout
    GridLayout layout = new GridLayout(2, false);
    layout.horizontalSpacing = 15;

    composite.setLayout(layout);

    GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);

    txtVersion.setLayoutData(gd);
    txtActivator.setLayoutData(gd);
    cmbComponents.setLayoutData(gd);
}

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

License:Open Source License

/**
 * Creates the selected editor combo box.
 * //  ww  w. jav  a2  s.  com
 * @param toolkit
 *            The FormToolKit where the button is created
 * @param composite
 *            The corresponding Composite
 */
private void createSelectedEditorCombo(final FormToolkit toolkit, final Composite composite) {
    toolkit.createLabel(composite, "Associated Editor:");

    this.selectedEditorCombo = new Combo(composite, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
    gridData.horizontalIndent = 6;
    this.selectedEditorCombo.setLayoutData(gridData);
    // The enable state will be updated later. Have to false for now
    // See updateGuiEnableState(..) for more information
    this.selectedEditorCombo.setEnabled(false);

    // Information icon if priority queue is used
    this.selectedEditorDecoration = new ControlDecoration(this.selectedEditorCombo, SWT.LEFT | SWT.TOP);
    Image questionDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage();
    this.selectedEditorDecoration.setImage(questionDecoration);
    this.selectedEditorDecoration.setShowHover(true);

    // Change Listener for the EDITOR_SELECTION_ART property
    final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
        @Override
        public void propertyChange(final PropertyChangeEvent event) {
            if (event.getProperty().equals(Constants.EDITOR_SELECTION_ART)) {
                String editorSelectionArt = event.getNewValue().toString();
                if (editorSelectionArt.equals(Constants.AUTO)) {
                    AdfEditorMasterDetailsBlock.this.selectedEditorPriorityListEnabled = true;
                } else {
                    AdfEditorMasterDetailsBlock.this.selectedEditorPriorityListEnabled = false;
                }
                updateOpenModelButtonEnable();
            }
        }
    };
    CarismaGUI.INSTANCE.getPreferenceStore().addPropertyChangeListener(propertyChangeListener);

    // Selection Listener
    final EditorRegistry editorRegistry = CarismaGUI.INSTANCE.getEditorRegistry();
    this.selectedEditorCombo.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            String actualSelectedEditorName = AdfEditorMasterDetailsBlock.this.selectedEditorCombo
                    .getItem(AdfEditorMasterDetailsBlock.this.selectedEditorCombo.getSelectionIndex());
            if (!actualSelectedEditorName.equals(DEFAULT_EDITOR)) {
                EditorDescriptor actualEditorDescriptor = editorRegistry
                        .getEditorDescriptorByName(actualSelectedEditorName);
                AdfEditorMasterDetailsBlock.this.controller.setSelectedEditorId(actualEditorDescriptor.getId());
            } else {
                AdfEditorMasterDetailsBlock.this.controller.setSelectedEditorId(DEFAULT_EDITOR);
            }
        }

        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            //TODO: Why empty?
        }
    });

    // Add dispose listener to remove PropertyChangeListeners
    composite.getParent().addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            CarismaGUI.INSTANCE.getPreferenceStore().removePropertyChangeListener(propertyChangeListener);
        }
    });
}

From source file:ch.elexis.core.ui.contacts.decorator.ContactTypeDecorator.java

License:Open Source License

@Override
public void decorate(Object element, IDecoration decoration) {
    IContact contact = (IContact) element;
    if (contact.isDeleted()) {
        ImageDescriptor deleted = Images.IMG_DELETE.getImageDescriptor();
        decoration.addOverlay(deleted, IDecoration.TOP_LEFT);
    }// w  ww  . j  av  a 2  s. com

    if (contact.isMandator()) {
        ImageDescriptor vip = Images.IMG_VIP_OVERLAY.getImageDescriptor();
        decoration.addOverlay(vip, IDecoration.BOTTOM_RIGHT);
    }
    if (contact.isUser()) {
        FieldDecoration info = FieldDecorationRegistry.getDefault()
                .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
        ImageDescriptor infoD = ImageDescriptor.createFromImage(info.getImage());
        decoration.addOverlay(infoD, IDecoration.BOTTOM_LEFT);
    }
}

From source file:ch.elexis.views.ComplementaryDetailDisplay.java

License:Open Source License

public Composite createDisplay(Composite parent, IViewSite site) {
    form = toolkit.createScrolledForm(parent);
    TableWrapLayout twl = new TableWrapLayout();
    form.getBody().setLayout(twl);// ww  w.  ja v  a  2s  .co  m
    form.setText("Keine Leistung ausgewhlt.");

    // General Information
    infoSection = toolkit.createSection(form.getBody(),
            Section.COMPACT | Section.EXPANDED | Section.TWISTIE | Section.TITLE_BAR);
    TableWrapData twd = new TableWrapData(TableWrapData.FILL_GRAB);
    twd.grabHorizontal = true;
    infoSection.setLayoutData(twd);
    infoSection.addExpansionListener(new SectionExpansionHandler());
    infoSection.setText("Details");

    Composite info = toolkit.createComposite(infoSection);
    twl = new TableWrapLayout();
    info.setLayout(twl);

    Label lbl = toolkit.createLabel(info, "Kapitel");
    // get a bold version of the standard font
    FontData[] bfd = lbl.getFont().getFontData();
    bfd[0].setStyle(SWT.BOLD);
    Font boldFont = new Font(Display.getCurrent(), bfd[0]);
    lbl.setFont(boldFont);

    codeChapter = toolkit.createText(info, "");
    codeChapter.setEditable(false);
    codeChapter.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));

    lbl = toolkit.createLabel(info, "Code");
    lbl.setFont(boldFont);

    codeCode = toolkit.createText(info, "");
    codeCode.setEditable(false);
    twd = new TableWrapData(TableWrapData.FILL_GRAB);
    codeCode.setLayoutData(twd);

    lbl = toolkit.createLabel(info, "Text");
    lbl.setFont(boldFont);

    codeText = toolkit.createText(info, "");
    codeText.setEditable(false);
    twd = new TableWrapData(TableWrapData.FILL_GRAB);
    codeText.setLayoutData(twd);

    lbl = toolkit.createLabel(info, "Beschreibung");
    lbl.setFont(boldFont);

    codeDescription = toolkit.createText(info, "", SWT.MULTI);
    codeDescription.setEditable(false);
    twd = new TableWrapData(TableWrapData.FILL_GRAB);
    codeDescription.setLayoutData(twd);

    lbl = toolkit.createLabel(info, "Pauschal Preis");
    lbl.setFont(boldFont);

    codeFixedValue = toolkit.createText(info, "", SWT.MULTI);
    twd = new TableWrapData(TableWrapData.FILL_GRAB);
    codeFixedValue.setLayoutData(twd);
    codeFixedValue.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            String text = codeFixedValue.getText();
            if (complementary != null) {
                if (text.isEmpty()) {
                    complementary.setFixedValue(-1);
                    return;
                }
                try {
                    int value = Integer.parseInt(text);
                    complementary.setFixedValue(value);
                } catch (NumberFormatException ex) {
                    // ignore and keep last valid value
                }
            }
        }
    });
    ControlDecoration deco = new ControlDecoration(codeFixedValue, SWT.LEFT | SWT.TOP);
    deco.setImage(FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
    deco.setDescriptionText(
            "Hier kann ein pauschal Preis angegeben werden. Dieser wird dann anstelle des Stundensatz als Preis verwendet.");

    infoSection.setClient(info);

    return form.getBody();
}

From source file:com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectPage.java

License:Open Source License

private ControlDecoration createFieldDecoration(Control control, String description) {
    ControlDecoration dec = new ControlDecoration(control, SWT.LEFT);
    dec.setMarginWidth(2);/*ww  w  .  j  av a  2 s  .  co  m*/
    FieldDecoration errorFieldIndicator = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
    dec.setImage(errorFieldIndicator.getImage());
    dec.setDescriptionText(description);
    control.setToolTipText(description);

    return dec;
}

From source file:com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectPage.java

License:Open Source License

private void setDecoratorType(ControlDecoration decorator, int severity) {
    String id;//  w w  w. j av a  2s .  c o  m
    if (severity == IStatus.ERROR) {
        id = FieldDecorationRegistry.DEC_ERROR;
    } else if (severity == IStatus.WARNING) {
        id = FieldDecorationRegistry.DEC_WARNING;
    } else {
        id = FieldDecorationRegistry.DEC_INFORMATION;
    }
    FieldDecoration errorFieldIndicator = FieldDecorationRegistry.getDefault().getFieldDecoration(id);
    decorator.setImage(errorFieldIndicator.getImage());
}

From source file:com.android.ide.eclipse.adt.internal.wizards.templates.NewTemplatePage.java

License:Open Source License

private ControlDecoration createFieldDecoration(String id, Control control, String description) {
    ControlDecoration decoration = new ControlDecoration(control, SWT.LEFT);
    decoration.setMarginWidth(2);// w  w  w . ja  v  a  2 s. c  om
    FieldDecoration errorFieldIndicator = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
    decoration.setImage(errorFieldIndicator.getImage());
    decoration.setDescriptionText(description);
    control.setToolTipText(description);
    mDecorations.put(id, decoration);

    return decoration;
}