Package aQute.bnd.help

Examples of aQute.bnd.help.Syntax


     *            the control
     * @param constant
     *            the constant, as mentioned in aQute.bnd.osgi.Constants
     */
    static public void setupMessageAndToolTipFromSyntax(Control control, String constant) {
        Syntax syntax = Syntax.HELP.get(constant);
        if (syntax == null) {
            logger.logError("No bnd syntax found for " + constant, null);
            syntax = new Syntax(constant, "Description of " + constant, constant + ": Example for " + constant, null, null);
        }

        String values = syntax.getValues();
        if (values != null) {
            /* filter out macros */
            values = values.replaceAll("\\$\\{[^\\}]*\\}", "");
            values = values.replaceAll(",\\s*,", ",");
            values = values.replaceAll("(^,|,$)", "");
        }
        if ((values == null) || (values.trim().length() == 0)) {
            values = "";
        } else {
            values = "\n\nProposed Values:\n" + values.trim().replaceAll("\\s*,\\s*", ", ");
        }

        String examples = getStrippedExample(syntax, constant);
        if (examples == null) {
            examples = "";
        } else {
            examples = "\n\nExample:\n" + examples;
        }

        String tt = syntax.getLead() + values + examples;
        control.setToolTipText(tt);
    }
View Full Code Here


        if (hoverRegion != null) {
            IDocument doc = textViewer.getDocument();
            try {
                String key = doc.get(hoverRegion.getOffset(), hoverRegion.getLength());

                Syntax syntax = Syntax.HELP.get(key);
                if (syntax == null)
                    return null;

                StringBuilder sb = new StringBuilder();
                sb.append(syntax.getLead());
                sb.append("\nE.g. ");
                sb.append(syntax.getExample());

                String text = sb.toString();

                if (text.length() > 30) {
                    text = wrap(text, 30);
View Full Code Here

TOP

Related Classes of aQute.bnd.help.Syntax

Copyright © 2018 www.massapicom. 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.