1 19 20 package org.netbeans.modules.xml.text.completion; 21 22 import java.awt.Color ; 23 import javax.swing.text.JTextComponent ; 24 25 import org.netbeans.modules.xml.api.model.*; 26 27 33 class AttributeResultItem extends XMLResultItem { 34 35 private boolean inline = false; 37 38 public AttributeResultItem(GrammarResult res, boolean inline){ 39 super(res.getNodeName()); 40 selectionForeground = foreground = Color.green.darker().darker(); 41 this.inline = inline; 42 } 43 44 public String getReplacementText(int modifiers) { 45 String extend = inline ? "" : "=\"\""; return super.getReplacementText(modifiers) + extend; 47 } 48 49 public boolean substituteText( JTextComponent c, int offset, int len, int modifiers ){ 50 boolean result = super.replaceText(c, getReplacementText(modifiers), offset, len); 51 c.getCaret().setDot(c.getCaretPosition() - 1); return result; 53 } 54 55 Color getPaintColor() { return Color.blue; } 56 } 57 | Popular Tags |