org.eclipse.jface.fieldassist.SimpleContentProposalProvider Java Examples

The following examples show how to use org.eclipse.jface.fieldassist.SimpleContentProposalProvider. 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 vote down vote up
/**
 * 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: CommandDataDialog.java    From EasyShell with Eclipse Public License 2.0 6 votes vote down vote up
private ContentProposalAdapter addContentAssistSimple(Text textControl) {
    char[] autoActivationCharacters = new char[] { '$', '{' };
    KeyStroke keyStroke = null;
    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;
}
 
Example #3
Source File: DeployOrganizationControlSupplier.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createDefaultUserTextWidget(DataBindingContext ctx, final Composite mainComposite,
        IObservableValue<OrganizationFileStore> fileStoreObservable) {
    SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(usernames());
    proposalProvider.setFiltering(true);

    TextWidget widget = new TextWidget.Builder()
            .withLabel(Messages.defaultUser)
            .grabHorizontalSpace()
            .fill()
            .labelAbove()
            .withProposalProvider(proposalProvider)
            .withTootltip(Messages.defaultUserTooltip)
            .bindTo(usernameObservable)
            .withTargetToModelStrategy(UpdateStrategyFactory.updateValueStrategy()
                    .withValidator(defaultUserValidator()))
            .inContext(ctx)
            .createIn(mainComposite);

    fileStoreObservable.addValueChangeListener(event -> {
        organizationChanged(event.diff.getNewValue().getContent(), proposalProvider);
        widget.getValueBinding().validateTargetToModel();
    });
}
 
Example #4
Source File: SelectArtifactToDeployPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createDefaultUserTextWidget(DataBindingContext ctx, final Composite mainComposite) {
    usernameObservable = PojoProperties.value("defaultUsername").observe(this);
    usernameProposalProvider = new SimpleContentProposalProvider();
    usernameProposalProvider.setFiltering(true);
    defaultUserTextWidget = new TextWidget.Builder()
            .useNativeRender()
            .labelAbove()
            .widthHint(530)
            .withLabel(org.bonitasoft.studio.actors.i18n.Messages.defaultUser)
            .withTootltip(org.bonitasoft.studio.actors.i18n.Messages.defaultUserTooltip)
            .bindTo(usernameObservable)
            .withProposalProvider(usernameProposalProvider)
            .withValidator(defaultUserValidator().create())
            .inContext(ctx)
            .createIn(mainComposite);
}
 
Example #5
Source File: RunConfigurationWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public RunConfigurationWizardPage() {
    super(RunConfigurationWizardPage.class.getName());
    setTitle(Messages.runConfigurationTitle);
    setDescription(Messages.runConfigurationDesc);
    userNameValidator = createUserNameValidator();
    userProposalProvider = new SimpleContentProposalProvider();
    userProposalProvider.setFiltering(true);
}
 
Example #6
Source File: DeployOrganizationControlSupplier.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void organizationChanged(Organization organization, SimpleContentProposalProvider proposalProvider) {
    proposalProvider.setProposals(usernames());
}