org.eclipse.jface.fieldassist.IContentProposalProvider Java Examples
The following examples show how to use
org.eclipse.jface.fieldassist.IContentProposalProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SourceFolderContentProposalProviderFactory.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * Returns a source folder proposal provider for the given project. * * @param contextProject * The project to look for source folders * @return The provider */ public IContentProposalProvider createProviderForProject(IProject contextProject) { if (null == contextProject) { return null; } IN4JSProject n4Project = StreamSupport.stream(n4jsCore.findAllProjects().spliterator(), false) // Filter for the context project .filter(p -> p.getProjectName().getRawName().equals(contextProject.getName())) .findAny().orElse(null); if (n4Project == null) { return null; } SimpleContentProposalProvider provider = new SimpleContentProposalProvider( n4Project.getSourceContainers().stream() .map(src -> src.getRelativeLocation()) .toArray(String[]::new)); provider.setFiltering(true); return provider; }
Example #2
Source File: AutoCompleteTextCellEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public void setProposalProvider(IContentProposalProvider proposalProvider) { final TextContentAdapter controlContentAdapter = new TextContentAdapter(); proposalAdapter = new ContentProposalAdapter(getControl(), controlContentAdapter, proposalProvider, contentAssistKeyStroke, null); proposalAdapter.setPropagateKeys(true); proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); proposalAdapter.setAutoActivationDelay(0); proposalAdapter.getControl().addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { AutoCompleteTextCellEditor.this.focusLost(); } }); proposalAdapter.addContentProposalListener(new IContentProposalListener() { @Override public void proposalAccepted(IContentProposal proposal) { fireApplyEditorValue(); } }); }
Example #3
Source File: SearchWidget.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected SearchWidget(Composite container, String id, boolean topLabel, int horizontalLabelAlignment, int verticalLabelAlignment, int labelWidth, boolean readOnly, String label, String message, boolean useCompositeMessageDecorator, Optional<String> labelButton, Optional<FormToolkit> toolkit, Optional<IContentProposalProvider> proposalProvider, Optional<ComputedValue<Boolean>> editableStrategy, Optional<DataBindingContext> ctx) { super(container, id, topLabel, horizontalLabelAlignment, verticalLabelAlignment, labelWidth, readOnly, label, message, useCompositeMessageDecorator, labelButton, false, null, toolkit, proposalProvider, editableStrategy, ctx); }
Example #4
Source File: AutoCompleteTextUtil.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
public static <T> void addAutoCompleteSupport(Text text, IContentProposalProvider cpProvider, T defaultObject){ setValue(text, defaultObject); ContentProposalAdapter cpAdapter = new ContentProposalAdapter(text, new TextContentAdapter(), cpProvider, null, null); cpAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); cpAdapter.addContentProposalListener(new IContentProposalListener() { @Override public void proposalAccepted(IContentProposal proposal){ text.setText(proposal.getLabel()); text.setData(PROPOSAL_RET_OBJ, getProposalObject(proposal)); text.setSelection(text.getText().length()); } }); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e){ // resets the contents after manual change text.setData(PROPOSAL_RET_OBJ, null); } }); }
Example #5
Source File: FieldAssistHelper.java From birt with Eclipse Public License 1.0 | 5 votes |
private IContentProposalProvider getContentProposalProvider( final String[] values ) { return new IContentProposalProvider( ) { public IContentProposal[] getProposals( String contents, int position ) { IContentProposal[] proposals = new IContentProposal[values.length]; for ( int i = 0; i < values.length; i++ ) { final String user = values[i]; proposals[i] = new IContentProposal( ) { public String getContent( ) { return user; } public String getLabel( ) { return user; } public String getDescription( ) { return null; } public int getCursorPosition( ) { return user.length( ); } }; } return proposals; } }; }
Example #6
Source File: NativeTextWidget.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected NativeTextWidget(Composite container, String id, boolean topLabel, int horizontalLabelAlignment, int verticalLabelAlignment, int labelWidth, boolean readOnly, String label, String message, boolean useCompositeMessageDecorator, Optional<String> labelButton, boolean transactionalEdit, BiConsumer<String, String> onEdit, Optional<FormToolkit> toolkit, Optional<IContentProposalProvider> proposalProvider, Optional<ComputedValue<Boolean>> editableStrategy, Optional<DataBindingContext> ctx) { super(container, id, topLabel, horizontalLabelAlignment, verticalLabelAlignment, labelWidth, readOnly, label, message, useCompositeMessageDecorator, labelButton, transactionalEdit, onEdit, toolkit, proposalProvider, editableStrategy, ctx); }
Example #7
Source File: TextWidget.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected TextWidget(Composite container, String id, boolean topLabel, int horizontalLabelAlignment, int verticalLabelAlignment, int labelWidth, boolean readOnly, String label, String message, boolean useCompositeMessageDecorator, Optional<String> labelButton, boolean transactionalEdit, BiConsumer<String, String> onEdit, Optional<FormToolkit> toolkit, Optional<IContentProposalProvider> proposalProvider, Optional<ComputedValue<Boolean>> enableStrategy, Optional<DataBindingContext> ctx) { super(container, id, topLabel, horizontalLabelAlignment, verticalLabelAlignment, labelWidth, readOnly, label, message, useCompositeMessageDecorator, labelButton, toolkit); this.transactionalEdit = transactionalEdit; this.onEdit = Optional.ofNullable(onEdit); this.proposalProvider = proposalProvider; this.editingColor = resourceManager.createColor(ColorConstants.EDITING_RGB); this.enableStrategy = enableStrategy; this.ctx = ctx; }
Example #8
Source File: NpmInstallWidget.java From typescript.java with MIT License | 4 votes |
public VersionContentProposalAdapter(Control control, IControlContentAdapter controlContentAdapter, IContentProposalProvider proposalProvider, KeyStroke keyStroke, char[] autoActivationCharacters) { super(control, controlContentAdapter, proposalProvider, keyStroke, autoActivationCharacters); }
Example #9
Source File: CustomContentProposalAdapter.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public CustomContentProposalAdapter(Control control, IControlContentAdapter controlContentAdapter, IContentProposalProvider proposalProvider, KeyStroke keyStroke, char[] autoActivationCharacters) { super(control, controlContentAdapter, proposalProvider, keyStroke, autoActivationCharacters); }
Example #10
Source File: TextWidget.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
public Builder withProposalProvider(IContentProposalProvider proposalProvider) { this.proposalProvider = Optional.of(proposalProvider); return this; }
Example #11
Source File: BonitaContentProposalAdapter.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
/** * Construct a content proposal adapter that can assist the user with * choosing content for the field. * * @param control * the control for which the adapter is providing content assist. * May not be <code>null</code>. * @param controlContentAdapter * the <code>IControlContentAdapter</code> used to obtain and * update the control's contents as proposals are accepted. May * not be <code>null</code>. * @param proposalProvider * the <code>IContentProposalProvider</code> used to obtain * content proposals for this control, or <code>null</code> if no * content proposal is available. * @param keyStroke * the keystroke that will invoke the content proposal popup. If * this value is <code>null</code>, then proposals will be * activated automatically when any of the auto activation * characters are typed. * @param autoActivationCharacters * An array of characters that trigger auto-activation of content * proposal. If specified, these characters will trigger * auto-activation of the proposal popup, regardless of whether * an explicit invocation keyStroke was specified. If this * parameter is <code>null</code>, then only a specified * keyStroke will invoke content proposal. If this parameter is <code>null</code> and the keyStroke parameter is <code>null</code>, then all * alphanumeric characters will * auto-activate content proposal. */ public BonitaContentProposalAdapter(final Control control, final IControlContentAdapter controlContentAdapter, final IContentProposalProvider proposalProvider, final KeyStroke keyStroke, final char[] autoActivationCharacters) { super(); // We always assume the control and content adapter are valid. Assert.isNotNull(control); Assert.isNotNull(controlContentAdapter); this.control = control; this.controlContentAdapter = controlContentAdapter; linkList = new ArrayList<>(); // The rest of these may be null this.proposalProvider = proposalProvider; triggerKeyStroke = keyStroke; if (autoActivationCharacters != null) { autoActivateString = new String(autoActivationCharacters); } addControlListener(control); filteredExpressionType = new ArrayList<>(); }
Example #12
Source File: ModuleSpecifierContentProposalProviderFactory.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * Returns a new module specifier proposal provider, which proposes files and folders in the given working * directory. * * @param root * The working directory path * @return The proposal provider */ public IContentProposalProvider createProviderForPath(IPath root) { return new ModuleSpecifierContentProposalProvider(root); }
Example #13
Source File: BonitaContentProposalAdapter.java From bonita-studio with GNU General Public License v2.0 | 2 votes |
/** * Return the proposal provider that provides content proposals given the * current content of the field. A value of <code>null</code> indicates that * there are no content proposals available for the field. * * @return the {@link IContentProposalProvider} used to show proposals. May * be <code>null</code>. */ public IContentProposalProvider getContentProposalProvider() { return proposalProvider; }
Example #14
Source File: BonitaContentProposalAdapter.java From bonita-studio with GNU General Public License v2.0 | 2 votes |
/** * Set the content proposal provider that is used to show proposals. * * @param proposalProvider * the {@link IContentProposalProvider} used to show proposals */ public void setContentProposalProvider(final IContentProposalProvider proposalProvider) { this.proposalProvider = proposalProvider; }