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

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

Introduction

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

Prototype

IContentProposalListener2

Source Link

Usage

From source file:com.vectrace.MercurialEclipse.history.MercurialHistoryPage.java

License:Open Source License

/**
 * Adds field assistance to the revision text field.
 *//*  www .jav  a  2  s .c o m*/
private void setupRevisionFieldAssistance() {
    proposalProvider = new HistoryContentProposalProvider(this);
    ContentAssistCommandAdapter contentAssist = new ContentAssistCommandAdapter(gotoText,
            new TextContentAdapter(), proposalProvider, null, null, true);

    // uncomment to open popup immediately on typing first character into the text field
    // contentAssist.setAutoActivationCharacters(null);
    contentAssist.setAutoActivationDelay(300);
    contentAssist.setPropagateKeys(true);
    contentAssist.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    contentAssist.addContentProposalListener(new IContentProposalListener2() {
        public void proposalPopupOpened(ContentProposalAdapter adapter) {
            fetchEntireHistory(true);
        }

        public void proposalPopupClosed(ContentProposalAdapter adapter) {
            fetchEntireHistory(false);
        }
    });
    contentAssist.addContentProposalListener(new IContentProposalListener() {
        public void proposalAccepted(IContentProposal proposal) {
            if (proposal instanceof RevisionContentProposal) {
                selectProposal(proposal);
            } else {
                // try to find something
                guessAndSelectVersion(proposal.getContent());
            }
        }
    });
}

From source file:de.unistuttgart.ipvs.pmp.editor.ui.editors.internals.localetable.AutocompleteTextCellEditor.java

License:Apache License

public AutocompleteTextCellEditor(Composite parent, SimpleContentProposalProvider proposalProvider,
        KeyStroke keyStroke, char[] autoActivationCharacters) {
    super(parent);

    proposalProvider.setFiltering(true);
    this.adapter = new ContentProposalAdapter(this.text, new TextContentAdapter(), proposalProvider, keyStroke,
            autoActivationCharacters);//from  www. j a  v a 2 s.  c  o m
    // adapter.setPropagateKeys(true);
    this.adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);

    // Listen for popup open/close events to be able to handle focus events
    // correctly
    this.adapter.addContentProposalListener(new IContentProposalListener2() {

        @Override
        public void proposalPopupClosed(ContentProposalAdapter adapter) {
            if (!AutocompleteTextCellEditor.this.text.isFocusControl()) {
                focusLost();// fireApplyEditorValue();
            }
        }

        @Override
        public void proposalPopupOpened(ContentProposalAdapter adapter) {
        }
    });
}

From source file:de.unistuttgart.ipvs.pmp.editor.ui.editors.internals.localetable.ContentProposalTextCellEditor.java

License:Apache License

private void enableContentProposal(IContentProposalProvider contentProposalProvider, KeyStroke keyStroke,
        char[] autoActivationCharacters) {
    this.contentProposalAdapter = new ContentProposalAdapter(getControl(), new TextContentAdapter(),
            contentProposalProvider, keyStroke, autoActivationCharacters);

    // Listen for popup open/close events to be able to handle focus events
    // correctly/*from   w w w  .ja  va2  s.c  om*/
    this.contentProposalAdapter.addContentProposalListener(new IContentProposalListener2() {

        @Override
        public void proposalPopupClosed(ContentProposalAdapter adapter) {
            ContentProposalTextCellEditor.this.popupOpen = false;
        }

        @Override
        public void proposalPopupOpened(ContentProposalAdapter adapter) {
            ContentProposalTextCellEditor.this.popupOpen = true;
        }
    });
}

From source file:fr.esrf.icat.manager.core.part.EntityEditDialog.java

License:Apache License

@Override
protected Control createDialogArea(final Composite parent) {
    final Composite container = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout(3, false);
    layout.marginRight = 5;//from  www . j av a 2s.  c om
    layout.marginLeft = 10;
    container.setLayout(layout);
    comboMapping = new HashMap<>();
    fieldValues = new HashMap<>();
    // we are sure we have at least one entity, use the 1st one for anything general (field types, etc.)
    final WrappedEntityBean firstEntity = entities.get(0);
    for (final String field : firstEntity.getMutableFields()) {
        Label lblAuthn = new Label(container, SWT.NONE);
        lblAuthn.setText(StringUtils.capitalize(field) + ":");
        final Button checkEdit = new Button(container, SWT.CHECK);
        checkEdit.setEnabled(false);
        checkEdit.setVisible(false);
        final Class<?> clazz = firstEntity.getReturnType(field);
        Object initialValue = null;
        boolean notSet = true;
        for (WrappedEntityBean entity : entities) {
            try {
                Object value = entity.get(field);
                if (notSet) {
                    initialValue = value;
                    notSet = false;
                } else if ((null == value && null != initialValue)
                        || (null != value && !value.equals(initialValue))) {
                    initialValue = null;
                    checkEdit.setImage(MULTI_IMAGE);
                    checkEdit.setSelection(false);
                    checkEdit.setEnabled(true);
                    checkEdit.setVisible(true);
                    break;
                }
            } catch (Exception e) {
                LOG.error("Error getting initial value for " + field, e);
            }
        }
        final boolean hasInitialValue = initialValue != null;
        if (firstEntity.isEntity(field)) {
            final Combo combo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER);
            new Label(container, SWT.NONE); //empty left label
            final Label label = new Label(container, SWT.RIGHT);
            label.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false));
            label.setImage(WARNING_IMAGE);
            final Label warningLabel = new Label(container, SWT.LEFT);
            warningLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
            combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
            final EntityListProposalContentProvider proposalProvider = new EntityListProposalContentProvider(
                    client, firstEntity.getReturnType(field).getSimpleName(), initialValue, label, warningLabel,
                    container);
            warningLabel.setText(proposalProvider.getCurrentFilter());
            final ContentProposalAdapter contentProposalAdapter = new ContentProposalAdapter(combo,
                    new ComboContentAdapter(), proposalProvider, DEFAULT_KEYSTROKE, DEFAULT_ACTIVATION_CHARS);
            contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
            contentProposalAdapter.setPropagateKeys(true);
            contentProposalAdapter.setAutoActivationDelay(1000);
            contentProposalAdapter.addContentProposalListener(new IContentProposalListener2() {
                @Override
                public void proposalPopupOpened(ContentProposalAdapter adapter) {
                }

                @Override
                public void proposalPopupClosed(ContentProposalAdapter adapter) {
                    // when the proposal popup closes we set the content of the combo to the proposals
                    final String[] currentItems = proposalProvider.getCurrentItems();
                    if (currentItems != null && currentItems.length > 0) {
                        combo.setItems(currentItems);
                    }
                    final String currentText = proposalProvider.getCurrentText();
                    final int caretPosition = proposalProvider.getCaretPosition();
                    combo.setText(currentText);
                    combo.setSelection(new Point(caretPosition, caretPosition));
                }
            });
            combo.setItems(proposalProvider.getInitialItems());
            if (hasInitialValue) {
                combo.select(0);
            }
            comboMapping.put(field,
                    new ImmutablePair<Object[], Combo>(new Object[] { proposalProvider }, combo));
            if (checkEdit.isEnabled()) {
                combo.setEnabled(false);
                checkEdit.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        combo.setEnabled(checkEdit.getSelection());
                    }
                });
            }

        } else if (Enum.class.isAssignableFrom(clazz)) {
            final Combo combo = new Combo(container, SWT.DROP_DOWN | SWT.BORDER);
            final Object[] c = clazz.getEnumConstants();
            final String[] s = new String[c.length];
            int selected = -1;
            for (int i = 0; i < c.length; i++) {
                s[i] = c[i].toString();
                if (initialValue != null && c[i].equals(initialValue)) {
                    selected = i;
                }
            }
            // replacement for AutocompleteComboSelector to avoid selecting the 1st value in the combo when
            // no proposal is accepted (or field is emptied)
            new AutocompleteCombo(combo) {
                @Override
                protected AutocompleteContentProposalProvider getContentProposalProvider(String[] proposals) {
                    return new AutocompleteSelectorContentProposalProvider(proposals, this.combo);
                }

            };
            combo.setItems(s);
            if (selected >= 0) {
                combo.select(selected);
            }
            combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
            comboMapping.put(field, new ImmutablePair<Object[], Combo>(c, combo));
            if (checkEdit.isEnabled()) {
                combo.setEnabled(false);
                checkEdit.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        combo.setEnabled(checkEdit.getSelection());
                    }
                });
            }

        } else if (clazz.equals(Boolean.class) || clazz.equals(boolean.class)) {
            final Button btn = new Button(container, SWT.CHECK);
            btn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
            if (null == initialValue) {
                if (isSingle) {
                    try {
                        firstEntity.set(field, Boolean.FALSE);
                    } catch (Exception e) {
                        LOG.error("Error setting " + field + " to " + Boolean.FALSE);
                    }
                }
            } else {
                btn.setSelection((Boolean) initialValue);
            }
            btn.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    boolean value = btn.getSelection();
                    fieldValues.put(field, value);
                }
            });
            if (checkEdit.isEnabled()) {
                btn.setEnabled(false);
                checkEdit.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        final boolean selected = checkEdit.getSelection();
                        btn.setEnabled(selected);
                        if (selected) {
                            fieldValues.put(field, btn.getSelection());
                        } else {
                            fieldValues.remove(field);
                        }
                    }
                });
            }

        } else if (Calendar.class.isAssignableFrom(clazz) || Date.class.isAssignableFrom(clazz)
                || XMLGregorianCalendar.class.isAssignableFrom(clazz)) {

            final CDateTime cdt = new CDateTime(container,
                    CDT.BORDER | CDT.SPINNER | CDT.TAB_FIELDS | CDT.DATE_MEDIUM | CDT.TIME_MEDIUM);
            cdt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
            if (null != initialValue) {
                Date initialDate = null;
                if (initialValue instanceof Calendar) {
                    initialDate = ((Calendar) initialValue).getTime();
                } else if (initialValue instanceof XMLGregorianCalendar) {
                    initialDate = ((XMLGregorianCalendar) initialValue).toGregorianCalendar().getTime();
                } else if (initialValue instanceof Date) {
                    initialDate = (Date) initialValue;
                }
                cdt.setSelection(initialDate);
            }

            cdt.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    fieldValues.put(field, makeCorrectDateValue(clazz, cdt.getSelection()));
                }
            });
            if (checkEdit.isEnabled()) {
                cdt.setEnabled(false);
                checkEdit.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        final boolean selected = checkEdit.getSelection();
                        cdt.setEnabled(selected);
                        if (selected) {
                            fieldValues.put(field, makeCorrectDateValue(clazz, cdt.getSelection()));
                        } else {
                            fieldValues.remove(field);
                        }
                    }
                });
            }

        } else if (Number.class.isAssignableFrom(clazz)) {
            final Text text = new Text(container, SWT.BORDER);
            text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
            if (null != initialValue) {
                text.setText(initialValue.toString());
            }
            final Color original = text.getForeground();
            text.addModifyListener(new ModifyListener() {
                @Override
                public void modifyText(ModifyEvent e) {
                    text.setForeground(original);
                    String value = text.getText();
                    if (null == value) {
                        value = ICATEntity.EMPTY_STRING;
                    }
                    final Object numVal = makeCorrectNumericValue(clazz, value);
                    if (null == numVal) {
                        text.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
                    } else {
                        fieldValues.put(field, numVal);
                    }
                }
            });
            if (checkEdit.isEnabled()) {
                text.setEnabled(false);
                checkEdit.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        final boolean selected = checkEdit.getSelection();
                        text.setEnabled(selected);
                        if (selected) {
                            fieldValues.put(field, makeCorrectNumericValue(clazz, text.getText()));
                        } else {
                            fieldValues.remove(field);
                        }
                    }
                });
            }

        } else { // Assumes String
            final Text text = new Text(container, SWT.BORDER);
            text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
            if (null == initialValue) {
                if (isSingle) {
                    try {
                        firstEntity.set(field, ICATEntity.EMPTY_STRING);
                    } catch (Exception e) {
                        LOG.error("Error setting " + field + " to EMPTY_STRING");
                    }
                }
            } else {
                text.setText(initialValue.toString());
            }
            text.addModifyListener(new ModifyListener() {
                @Override
                public void modifyText(ModifyEvent e) {
                    String value = text.getText();
                    if (null == value) {
                        value = ICATEntity.EMPTY_STRING;
                    }
                    fieldValues.put(field, value);
                }
            });
            if (checkEdit.isEnabled()) {
                text.setEnabled(false);
                checkEdit.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        final boolean selected = checkEdit.getSelection();
                        text.setEnabled(selected);
                        if (selected) {
                            fieldValues.put(field, text.getText());
                        } else {
                            fieldValues.remove(field);
                        }
                    }
                });
            }
        }
    }
    return container;
}

From source file:hydrograph.ui.graph.canvas.search.ComponentSearchUtility.java

License:Apache License

/**
 * Added listeners/*from w  w  w .  j a v a2  s  .  co  m*/
 */
private void initializeListneres() {

    assistText.addKeyListener(new KeyListener() {

        @Override
        public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.ESC) {
                disposeAssistText();
            }
        }

        @Override
        public void keyPressed(KeyEvent e) {

        }
    });

    assistText.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
            if (!contentProposalAdapter.isProposalPopupOpen()) {
                disposeAssistText();
            }
        }

        @Override
        public void focusGained(FocusEvent e) {

        }
    });

    contentProposalAdapter.addContentProposalListener(new IContentProposalListener2() {

        @Override
        public void proposalPopupOpened(ContentProposalAdapter adapter) {

        }

        @Override
        public void proposalPopupClosed(ContentProposalAdapter adapter) {
            if (assistText != null && !assistText.isFocusControl()) {
                disposeAssistText();
            }
        }
    });

    contentProposalAdapter.addContentProposalListener(new IContentProposalListener() {

        @Override
        public void proposalAccepted(IContentProposal proposal) {
            acceptProposal();
        }
    });
}

From source file:org.dawnsci.common.widgets.celleditor.ExpresionCellEditor.java

License:Open Source License

private void enableContentProposal(IContentProposalProvider contentProposalProvider, KeyStroke keyStroke,
        char[] autoActivationCharacters) {
    contentProposalAdapter = new ContentProposalAdapter(text, new TextContentAdapter(), contentProposalProvider,
            keyStroke, autoActivationCharacters);

    contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_IGNORE);

    // Listen for popup open/close events to be able to handle focus events correctly
    contentProposalAdapter.addContentProposalListener(new IContentProposalListener2() {

        public void proposalPopupClosed(ContentProposalAdapter adapter) {
            popupOpen = false;//from ww w. jav a 2 s .co  m
        }

        public void proposalPopupOpened(ContentProposalAdapter adapter) {
            popupOpen = true;
        }
    });

    contentProposalAdapter.addContentProposalListener(new IContentProposalListener() {

        @Override
        public void proposalAccepted(IContentProposal proposal) {
            IContentProposalProvider provider = contentProposalAdapter.getContentProposalProvider();

            Control control = ExpresionCellEditor.this.getControl();

            if (provider != null && provider instanceof ExpressionFunctionProposalProvider) {

                int[] lastMatchBounds = ((ExpressionFunctionProposalProvider) provider).getLastMatchBounds();
                int lastPosition = ((ExpressionFunctionProposalProvider) provider).getLastPosition();
                IControlContentAdapter contentAdapter = contentProposalAdapter.getControlContentAdapter();
                String text = contentAdapter.getControlContents(control);

                if (text.isEmpty()) {
                    contentAdapter.setControlContents(control, proposal.getContent(),
                            proposal.getContent().length());
                    return;
                }

                if (lastPosition > lastMatchBounds[1]) {
                    StringBuilder builder = new StringBuilder();
                    builder.append(text.substring(0, lastPosition));
                    builder.append(proposal.getContent());
                    contentAdapter.setControlContents(control, builder.toString(),
                            lastPosition + proposal.getContent().length());
                    return;
                }

                String match = text.substring(lastMatchBounds[0], lastMatchBounds[1]);

                if (match.contains(":")) {
                    int index = match.lastIndexOf(":");
                    StringBuilder builder = new StringBuilder();
                    builder.append(text.substring(0, lastMatchBounds[0] + index + 1));
                    builder.append(proposal.getContent());
                    builder.append(text.substring(lastMatchBounds[1]));
                    contentAdapter.setControlContents(control, builder.toString(),
                            lastMatchBounds[0] + index + proposal.getContent().length() + 1);
                } else {
                    StringBuilder builder = new StringBuilder();
                    builder.append(text.substring(0, lastMatchBounds[0]));
                    builder.append(proposal.getContent());
                    builder.append(text.substring(lastMatchBounds[1]));
                    contentAdapter.setControlContents(control, builder.toString(),
                            lastMatchBounds[0] + proposal.getContent().length());
                }
            }
        }
    });
}

From source file:org.dawnsci.common.widgets.celleditor.TextCellEditorWithContentProposal.java

License:Open Source License

private void enableContentProposal(IContentProposalProvider contentProposalProvider, KeyStroke keyStroke,
        char[] autoActivationCharacters) {

    contentProposalAdapter = new OpenableContentAssistCommandAdapter(text, new TextContentAdapter(),
            contentProposalProvider, null, null, true);
    contentProposalAdapter.setAutoActivationDelay(0);

    contentProposalAdapter.setLabelProvider(labelProvider);
    contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_IGNORE);
    // Listen for popup open/close events to be able to handle focus
    // events correctly
    contentProposalAdapter.addContentProposalListener(new IContentProposalListener2() {

        @Override//ww  w  .j  a  v a 2 s.c o  m
        public void proposalPopupClosed(ContentProposalAdapter adapter) {
            popupOpen = false;
        }

        @Override
        public void proposalPopupOpened(ContentProposalAdapter adapter) {
            popupOpen = true;
        }
    });

    if (contentProposalListener != null) {
        registerListener(contentProposalListener);
    }

}

From source file:org.eclipse.jubula.client.ui.rcp.controllers.ContentAssistCellEditor.java

License:Open Source License

/**
 * Activates content assist (if it is supported).
 * /* w ww.j a  va 2  s .c  om*/
 * @param contentProposalProvider
 *          The proposal provider to use for content assist.
 * @param proposalAcceptanceStyle
 *         The integer style that indicates how an accepted proposal 
 *         affects the control's content. See 
 *         {@link ContentProposalAdapter#setProposalAcceptanceStyle(int)}.
 *          
 */
private void enableContentProposal(IContentProposalProvider contentProposalProvider,
        int proposalAcceptanceStyle) {
    if (contentProposalProvider != null) {

        ContentProposalAdapter contentProposalAdapter = new ContentProposalAdapter(text,
                new TextContentAdapter(), contentProposalProvider, ContentAssistUtil.getTriggerKeyStroke(),
                ContentAssistUtil.getTriggerChars());

        contentProposalAdapter.setFilterStyle(ContentProposalAdapter.FILTER_NONE);
        contentProposalAdapter.setProposalAcceptanceStyle(proposalAcceptanceStyle);

        // Listen for popup open/close events to be able to handle focus events
        // correctly
        contentProposalAdapter.addContentProposalListener(new IContentProposalListener2() {

            @SuppressWarnings("synthetic-access")
            public void proposalPopupClosed(ContentProposalAdapter adapter) {
                m_popupOpen = false;
            }

            @SuppressWarnings("synthetic-access")
            public void proposalPopupOpened(ContentProposalAdapter adapter) {
                m_popupOpen = true;
            }
        });
    }
}

From source file:org.eclipse.sirius.editor.tools.api.assist.TypeContentProposalProvider.java

License:Open Source License

/**
 * Bind a completion processor to a given text element.
 * /*from w ww  .  ja  v  a  2  s  . com*/
 * @param section
 *            section to give, if it implements {@link ModelViewBinding}
 *            then the section update will be disabled during proposal
 *            settings.
 * @param text
 *            text to bind a completion processor to.
 */
public static void bindCompletionProcessor(final AbstractPropertySection section, final Text text) {

    final IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench()
            .getService(IBindingService.class);

    TriggerSequence[] contentAssistBindings = bindingService
            .getActiveBindingsFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    if (contentAssistBindings != null && contentAssistBindings.length > 0) {

        KeyStroke keyStroke = TypeContentProposalProvider.getKeyStroke(contentAssistBindings[0]);
        TypeAssistant typeAssistant = new TypeAssistant(
                SiriusEditorPlugin.getPlugin().getWorkspaceEPackageRegistry(), section);
        final ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(),
                new TypeContentProposalProvider(typeAssistant), keyStroke, null);

        adapter.addContentProposalListener(new IContentProposalListener2() {

            public void proposalPopupClosed(final ContentProposalAdapter arg0) {
                if (section instanceof ModelViewBinding) {
                    ((ModelViewBinding) section).enableModelUpdating();
                }
            }

            public void proposalPopupOpened(final ContentProposalAdapter arg0) {
                if (section instanceof ModelViewBinding) {
                    ((ModelViewBinding) section).disableModelUpdating();
                }
            }

        }); // close popup
    }
}

From source file:org.eclipse.sirius.editor.tools.internal.assist.EAttributeCustomizationAttributeNameContentProposalProvider.java

License:Open Source License

/**
 * Bind a completion processor to a given text element.
 * /* w  w  w .j  ava 2  s .  co  m*/
 * @param section
 *            section to give, if it implements {@link ModelViewBinding}
 *            then the section update will be disabled during proposal
 *            settings.
 * @param text
 *            text to bind a completion processor to.
 */
public static void bindCompletionProcessor(final EAttributeCustomizationAttributeNamePropertySection section,
        final Text text) {

    final IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench()
            .getService(IBindingService.class);

    TriggerSequence[] contentAssistBindings = bindingService
            .getActiveBindingsFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    if (contentAssistBindings != null && contentAssistBindings.length > 0) {

        KeyStroke keyStroke = EAttributeCustomizationAttributeNameContentProposalProvider
                .getKeyStroke(contentAssistBindings[0]);
        final ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(),
                new EAttributeCustomizationAttributeNameContentProposalProvider(
                        section.getEAttributeCustomization()),
                keyStroke, null);

        adapter.addContentProposalListener(new IContentProposalListener2() {

            public void proposalPopupClosed(final ContentProposalAdapter arg0) {
                if (section != null) {
                    ((ModelViewBinding) section).enableModelUpdating();
                }
            }

            public void proposalPopupOpened(final ContentProposalAdapter arg0) {
                if (section != null) {
                    ((ModelViewBinding) section).disableModelUpdating();
                }
            }

        }); // close popup
    }
}