Examples of StringsCompleter


Examples of org.apache.karaf.shell.console.completer.StringsCompleter

public class NamesCompleter implements Completer {

    private JndiService jndiService;

    public int complete(String buffer, int cursor, List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (String name : jndiService.names().keySet()) {
                delegate.getStrings().add(name);
            }
        } catch (Exception e) {
            // nothing to do
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

Examples of org.apache.karaf.shell.console.completer.StringsCompleter

public class ServicesIdCompleter implements Completer {

    private BundleContext bundleContext;

    public int complete(String buffer, int cursor, List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        Bundle[] bundles = bundleContext.getBundles();
        for (Bundle bundle : bundles) {
            ServiceReference[] references = bundle.getRegisteredServices();
            if (references != null) {
                for (ServiceReference reference : references) {
                    if (reference.getProperty(Constants.SERVICE_ID) != null) {
                        delegate.getStrings().add(reference.getProperty(Constants.SERVICE_ID).toString());
                    }
                }
            }
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

Examples of org.apache.karaf.shell.console.completer.StringsCompleter

public class ContextsCompleter implements Completer {

    private JndiService jndiService;

    public int complete(String buffer, int cursor, List candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            List<String> contexts = jndiService.contexts();
            for (String context : contexts) {
                delegate.getStrings().add(context);
            }
        } catch (Exception e) {
            // nothing to do
        }
        return delegate.complete(buffer, cursor, candidates);
    }
View Full Code Here

Examples of org.apache.karaf.shell.support.completers.StringsCompleter

    public void setFeaturesService(FeaturesService featuresService) {
        this.featuresService = featuresService;
    }

    public int complete(Session session, final CommandLine commandLine, final List<String> candidates) {
        StringsCompleter delegate = new StringsCompleter();
        try {
            for (Repository repository : featuresService.listRepositories()) {
                delegate.getStrings().add(repository.getName());
            }
        } catch (Exception e) {
            // Ignore
        }
        return delegate.complete(session, commandLine, candidates);
    }
View Full Code Here

Examples of scala.tools.jline.console.completer.StringsCompleter

public class ArgumentCompleterTest
    extends ConsoleReaderTestSupport
{
    @Test
    public void test1() throws Exception {
        console.addCompleter(new ArgumentCompleter(new StringsCompleter("foo", "bar", "baz")));

        assertBuffer("foo foo ", new Buffer("foo f").tab());
        assertBuffer("foo ba", new Buffer("foo b").tab());
        assertBuffer("foo ba", new Buffer("foo ba").tab());
        assertBuffer("foo baz ", new Buffer("foo baz").tab());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.