List of usage examples for org.eclipse.jface.fieldassist ContentProposalAdapter setFilterStyle
public void setFilterStyle(int filterStyle)
From source file:de.anbos.eclipse.easyshell.plugin.preferences.CommandDataDialog.java
License:Open Source License
private ContentProposalAdapter addContentAssistSimple(Text textControl) { char[] autoActivationCharacters = new char[] { '$', '{' }; KeyStroke keyStroke = null;/*from w w w. j a va2 s. c o m*/ try { keyStroke = KeyStroke.getInstance("Ctrl+Space"); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } // assume that myTextControl has already been created in some way List<Variable> variables = Variable.getVisibleVariables(); String[] proposals = new String[variables.size()]; for (int i = 0; i < variables.size(); i++) { proposals[i] = variables.get(i).getFullVariableName(); } ContentProposalAdapter adapter = new ContentProposalAdapter(textControl, new TextContentAdapter(), new SimpleContentProposalProvider(proposals), keyStroke, autoActivationCharacters); adapter.setPropagateKeys(false); adapter.setFilterStyle(ContentProposalAdapter.FILTER_NONE); //adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); return adapter; }
From source file:org.eclipse.birt.chart.ui.swt.fieldassist.FieldAssistHelper.java
License:Open Source License
/** * @param control/*ww w . j a va 2s . c om*/ * @param contentAdapter * @param values */ public void installContentProposalAdapter(Control control, IControlContentAdapter contentAdapter, String[] values) { IPreferenceStore store = getPreferenceStore(); boolean propagate = store.getBoolean(PreferenceConstants.PREF_CONTENTASSISTKEY_PROPAGATE); KeyStroke keyStroke = null; char[] autoActivationCharacters = null; int autoActivationDelay = store.getInt(PreferenceConstants.PREF_CONTENTASSISTDELAY); String triggerKey = getTriggerKey(); if (triggerKey == null) { keyStroke = null; } else { keyStroke = getKeyStroke(triggerKey); } ContentProposalAdapter adapter = new ContentProposalAdapter(control, contentAdapter, getContentProposalProvider(values), keyStroke, autoActivationCharacters); adapter.setAutoActivationDelay(autoActivationDelay); adapter.setPropagateKeys(propagate); adapter.setFilterStyle(getContentAssistFilterStyle()); adapter.setProposalAcceptanceStyle(getContentAssistAcceptance()); }
From source file:org.eclipse.conesc.plugin.utils.HelperAssistant.java
License:Open Source License
public static void applyAssistentTo(Control control, Node diagram) { try {/*from ww w . j a v a 2 s. c o m*/ ContentProposalAdapter adapter = new ContentProposalAdapter(control, new TextContentAdapter(), new SimpleContentProposalProvider(getAllProposals(diagram)), KeyStroke.getInstance("Ctrl+Space"), new char[] { '(', '|', '&', '>' }); adapter.setFilterStyle(ContentProposalAdapter.FILTER_CHARACTER); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_INSERT); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.eclipse.jubula.client.ui.rcp.controllers.ContentAssistCellEditor.java
License:Open Source License
/** * Activates content assist (if it is supported). * /*from ww w .j a v a 2 s. c o m*/ * @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.jubula.client.ui.rcp.widgets.CheckedParamTextContentAssisted.java
License:Open Source License
/** * //ww w . j av a 2s. com * @param parent parent * @param style style * @param node current node, associated with parameter for this value * @param desc parameter description associated with current edited value * @param dataValidator validator for data validation * @param proposalProvider The content proposal provider for this text * field, or <code>null</code> if no content * assist is available. */ @SuppressWarnings("synthetic-access") public CheckedParamTextContentAssisted(Composite parent, int style, IParameterInterfacePO node, IParamDescriptionPO desc, IParamValueValidator dataValidator, IContentProposalProvider proposalProvider) { super(parent, style, node, desc, dataValidator); m_popupListener = new IContentProposalListener2Implementation(); ContentProposalAdapter cpa = new ContentProposalAdapter(this, new TextContentAdapter(), proposalProvider, ContentAssistUtil.getTriggerKeyStroke(), ContentAssistUtil.getTriggerChars()); cpa.setFilterStyle(ContentProposalAdapter.FILTER_NONE); cpa.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_INSERT); cpa.addContentProposalListener(m_popupListener); }
From source file:org.eclipse.mylyn.internal.web.tasks.WebContentProposalProvider.java
License:Open Source License
@SuppressWarnings("deprecation") public static ControlDecoration createDecoration(final Text text, // ParametersEditor parametersEditor, boolean includeTemplates) { FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); FieldDecoration fieldDecoration = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); ControlDecoration decoration = new ControlDecoration(text, SWT.LEFT | SWT.TOP); decoration.setImage(fieldDecoration.getImage()); decoration.setDescriptionText(fieldDecoration.getDescription()); decoration.setShowOnlyOnFocus(true); KeyStroke keystroke = null;/*from w w w.ja v a 2 s . c o m*/ try { keystroke = KeyStroke.getInstance("Ctrl" + KeyStroke.KEY_DELIMITER + "Space"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (ParseException e) { } ContentProposalAdapter adapter = new ContentProposalAdapter(text, new TextContentAdapter(), // new WebContentProposalProvider(parametersEditor, includeTemplates), keystroke, null); adapter.setPopupSize(new Point(200, 150)); adapter.setPropagateKeys(true); adapter.setFilterStyle(ContentProposalAdapter.FILTER_CUMULATIVE); // workaround for bug 196565 WebContentProposalListener listener = new WebContentProposalListener(adapter); adapter.addContentProposalListener((IContentProposalListener) listener); adapter.addContentProposalListener((IContentProposalListener2) listener); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_IGNORE); return decoration; }
From source file:org.eclipse.papyrus.profile.ui.dialogs.ChooseSetAssistedDialog.java
License:Open Source License
/** * Install content assistant provider./* ww w . ja v a 2 s. c o m*/ */ protected void installContentAssistantProvider() { KeyStroke keyStroke = null; char[] autoActivationCharacters = null; int autoActivationDelay = 500; ContentProposalAdapter adapter = new ContentProposalAdapter(possibleElementsText, new TextContentAdapter(), getContentProposalProvider(), keyStroke, autoActivationCharacters); adapter.setAutoActivationDelay(autoActivationDelay); // filter proposals as keys are pressed and proposals popup is present adapter.setFilterStyle(ContentProposalAdapter.FILTER_CUMULATIVE); // replace all text adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); //this listener is activated when a stereotype item in popup menu is selected and //the popup menu is closed. It is used to add the selected stereotype in to the right hand side part //of the dialog, so that uers can economize one key hit. //cf. proposalAccepted() operation in KeyTextListener adapter.addContentProposalListener(keyTextListener); }
From source file:org.eclipse.ui.examples.fieldassist.FieldAssistTestDialog.java
License:Open Source License
void installContentProposalAdapter(Control control, IControlContentAdapter contentAdapter) { IPreferenceStore store = FieldAssistPlugin.getDefault().getPreferenceStore(); boolean propagate = store.getBoolean(PreferenceConstants.PREF_CONTENTASSISTKEY_PROPAGATE); KeyStroke keyStroke;/* ww w . j av a 2s.co m*/ char[] autoActivationCharacters = null; int autoActivationDelay = store.getInt(PreferenceConstants.PREF_CONTENTASSISTDELAY); if (triggerKey.equals(PreferenceConstants.PREF_CONTENTASSISTKEYAUTO)) { // null means automatically assist when character typed keyStroke = null; } else if (triggerKey.equals(PreferenceConstants.PREF_CONTENTASSISTKEYAUTOSUBSET)) { keyStroke = null; autoActivationCharacters = new char[] { 't', 'd' }; } else { try { keyStroke = KeyStroke.getInstance(triggerKey); } catch (ParseException e) { keyStroke = KeyStroke.getInstance(SWT.F10); } } ContentProposalAdapter adapter = new ContentProposalAdapter(control, contentAdapter, getContentProposalProvider(), keyStroke, autoActivationCharacters); adapter.setAutoActivationDelay(autoActivationDelay); adapter.setPropagateKeys(propagate); adapter.setFilterStyle(getContentAssistFilterStyle()); adapter.setProposalAcceptanceStyle(getContentAssistAcceptance()); }
From source file:org.sonarlint.eclipse.ui.internal.bind.TextCellEditorWithContentProposal.java
License:Open Source License
private void enableContentProposal(IContentProposalProvider contentProposalProvider, ProjectBindModel sonarProject) { ContentProposalAdapter contentProposalAdapter = new ContentAssistCommandAdapter(text, new RemoteProjectTextContentAdapter(sonarProject), contentProposalProvider, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, null, true); contentProposalAdapter.setAutoActivationCharacters(null); contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); contentProposalAdapter.setFilterStyle(ContentProposalAdapter.FILTER_NONE); contentProposalAdapter.setAutoActivationDelay(100); }
From source file:org.sonarlint.eclipse.ui.internal.server.wizard.OrganizationWizardPage.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/* ww w . j a va 2s. c om*/ protected void doCreateControl(Composite container) { Label labelOrganization = new Label(container, SWT.NULL); labelOrganization.setText("Organization:"); Text organizationText = new Text(container, SWT.BORDER | SWT.SINGLE); organizationText.setMessage("Start typing to search for your organization"); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalIndent = 10; organizationText.setLayoutData(gd); DataBindingContext dbc = new DataBindingContext(); orgaTextBinding = dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(organizationText), BeanProperties.value(ServerConnectionModel.class, ServerConnectionModel.PROPERTY_ORGANIZATION) .observe(model), new UpdateValueStrategy() .setBeforeSetValidator(new MandatoryValidator("You must select an organization")), null); WizardPageSupport.create(this, dbc); ContentProposalAdapter contentProposalAdapter = new ContentAssistCommandAdapter(organizationText, new TextContentAdapter(), new OrganizationProvider(model, this), ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, null, true); contentProposalAdapter.setAutoActivationCharacters(null); contentProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); contentProposalAdapter.setFilterStyle(ContentProposalAdapter.FILTER_NONE); contentProposalAdapter.setAutoActivationDelay(100); }