Code example for Element

Methods: getAttributes

0
        SHTMLEditorPane editorPane = panel.getSHTMLEditorPane();
		final Element linkElement = editorPane.getCurrentLinkElement();
        final boolean foundLink = (linkElement != null);
		final String linkAsString;
        if (foundLink) {
            final AttributeSet elemAttrs = linkElement.getAttributes();
            final Object linkAttr = elemAttrs.getAttribute(HTML.Tag.A);
            final Object href = ((AttributeSet) linkAttr).getAttribute(HTML.Attribute.HREF);
            if (href != null) { 
            	linkAsString = href.toString();
            } 
            else 
            	linkAsString = "http://";
        } 
        else { 
            linkAsString = "http://";
        } 
		final String inputValue = UITools.showInputDialog(
		    Controller.getCurrentController().getSelection().getSelected(), TextUtils.getText("edit_link_manually"), linkAsString);
		if (inputValue != null && ! inputValue.matches("\\w+://")) {
Experience pair programming with AI  Get Codota for Java