本文整理汇总了Java中org.openide.xml.XMLUtil.toElementContent方法的典型用法代码示例。如果您正苦于以下问题:Java XMLUtil.toElementContent方法的具体用法?Java XMLUtil.toElementContent怎么用?Java XMLUtil.toElementContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.xml.XMLUtil
的用法示例。
在下文中一共展示了XMLUtil.toElementContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDetails
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private JComponent createDetails(String text, ActionListener action) {
try {
text = (action == null ? "<html>" : "<html><a href=\"_blank\">") + XMLUtil.toElementContent(text); //NOI18N
} catch (CharConversionException ex) {
throw new IllegalArgumentException(ex);
}
if (null == action) {
return new JLabel(text);
}
JButton btn = new JButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(action);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
if (c != null) {
btn.setForeground(c);
}
return btn;
}
示例2: createDetails
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private JComponent createDetails( String text, ActionListener action ) {
if( null == action ) {
return new JLabel(text);
}
try {
text = "<html><u>" + XMLUtil.toElementContent(text); //NOI18N
} catch( CharConversionException ex ) {
throw new IllegalArgumentException(ex);
}
JButton btn = new JButton(text);
btn.setFocusable(false);
btn.setBorder(BorderFactory.createEmptyBorder());
btn.setBorderPainted(false);
btn.setFocusPainted(false);
btn.setOpaque(false);
btn.setContentAreaFilled(false);
btn.addActionListener(action);
btn.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
Color c = UIManager.getColor("nb.html.link.foreground"); //NOI18N
if (c != null) {
btn.setForeground(c);
}
return btn;
}
示例3: getHtmlDisplayName
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
public @Override String getHtmlDisplayName() {
String htmlName = getOriginal().getHtmlDisplayName();
if (htmlName == null) {
try {
htmlName = XMLUtil.toElementContent(getOriginal().getDisplayName());
} catch (CharConversionException ex) {
// ignore
}
}
if (htmlName == null) {
return null;
}
if (files != null && files.iterator().hasNext()) {
try {
String annotatedMagic = files.iterator().next().getFileSystem().
getDecorator().annotateNameHtml(MAGIC, files);
if (annotatedMagic != null) {
htmlName = annotatedMagic.replace(MAGIC, htmlName);
}
} catch (FileStateInvalidException e) {
LOG.log(Level.INFO, null, e);
}
}
return isMainAsync()? "<b>" + htmlName + "</b>" : htmlName;
}
示例4: getHtmlDisplayName
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
@Override
public String getHtmlDisplayName () {
final Pair<String,JavaPlatform> platHolder = pp.getPlatform();
if (platHolder == null) {
return null;
}
final JavaPlatform jp = platHolder.second();
if (jp == null || !jp.isValid()) {
String displayName = this.getDisplayName();
try {
displayName = XMLUtil.toElementContent(displayName);
} catch (CharConversionException ex) {
// OK, no annotation in this case
return null;
}
return "<font color=\"#A40000\">" + displayName + "</font>"; //NOI18N
} else {
return null;
}
}
示例5: messageHtmlName
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
@Override
protected String messageHtmlName() {
if (! obj.isValid()) {
return null;
}
String name = obj.getNodeDelegate().getHtmlDisplayName();
if (name == null) {
try {
name = XMLUtil.toElementContent(obj.getNodeDelegate().getDisplayName());
} catch (CharConversionException ex) {
return null;
}
}
return annotateName(name, true, isModified(), !obj.getPrimaryFile().canWrite());
}
示例6: target2String
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
public static String target2String(TypeElement target) {
final Name qualifiedName = target.getQualifiedName(); //#130759
if (qualifiedName == null) {
Logger.getLogger(Utilities.class.getName()).warning("Target qualified name could not be resolved."); //NOI18N
return ""; //NOI18N
} else {
String qnString = qualifiedName.toString();
if (qnString.length() == 0) {
//probably an anonymous class
qnString = target.asType().toString();
}
try {
qnString = XMLUtil.toElementContent(qnString);
} catch (CharConversionException ex) {
Logger.getLogger(Utilities.class.getName()).log(Level.FINE, null, ex);
}
return qnString;
}
}
示例7: createNotification
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private NotificationImpl createNotification(String title, Icon icon, Priority priority, Category category) {
Parameters.notNull("title", title); //NOI18N
Parameters.notNull("icon", icon); //NOI18N
Parameters.notNull("priority", priority); //NOI18N
Parameters.notNull("category", category); //NOI18N
try {
title = XMLUtil.toElementContent(title);
} catch (CharConversionException ex) {
throw new IllegalArgumentException(ex);
}
return new NotificationImpl(title, icon, priority, category, Calendar.getInstance());
}
示例8: createNotification
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private NotificationImpl createNotification(String title, Icon icon, Priority priority) {
Parameters.notNull("title", title); //NOI18N
Parameters.notNull("icon", icon); //NOI18N
Parameters.notNull("priority", priority); //NOI18N
try {
title = XMLUtil.toElementContent(title);
} catch( CharConversionException ex ) {
throw new IllegalArgumentException(ex);
}
return new NotificationImpl(title, icon, priority);
}
示例9: getHtmlDisplayName
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
public @Override String getHtmlDisplayName() {
if (isDeprecated()) {
try {
return "<html><s>" + XMLUtil.toElementContent(getDisplayName()) + "</s>"; // NOI18N
} catch (CharConversionException ex) {}
}
return null;
}
示例10: getHtmlDisplayName
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
@Override
public String getHtmlDisplayName() {
if (pp.getPlatform() == null) {
String displayName = this.getDisplayName();
try {
displayName = XMLUtil.toElementContent(displayName);
} catch (CharConversionException ex) {
// OK, no annotation in this case
return null;
}
return "<font color=\"#A40000\">" + displayName + "</font>"; //NOI18N
} else {
return null;
}
}
示例11: getHtmlDisplayName
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
public @Override String getHtmlDisplayName() {
if (dep.getModuleEntry().isDeprecated()) {
try {
return "<s>" + XMLUtil.toElementContent(getDisplayName()) + "</s>"; // NOI18N
} catch (CharConversionException x) {
// ignore
}
}
return null;
}
示例12: safeEncode
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private static String safeEncode(String text) { // #208432
if (text.length() > 30) {
text = text.substring(0, 30) + '…';
}
try {
return XMLUtil.toElementContent(text.replaceAll("\\s+", " "));
} catch (CharConversionException ex) {
return text;
}
}
示例13: getTopLvlDisplayText
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private static String getTopLvlDisplayText(boolean containsActiveTask, String name, boolean isOpened) {
String displayName;
try {
name = XMLUtil.toElementContent(name);
} catch (CharConversionException ex) {
}
String activeText = containsActiveTask ? "<b>" + name + "</b>" : name; //NOI18N
if (!isOpened) {
displayName = "<html><strike>" + activeText + "</strike><html>"; //NOI18N
} else {
displayName = "<html>" + activeText + "<html>";
}
return displayName;
}
示例14: escapedSubstring
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
private static String escapedSubstring(String str, int start, int end) {
String substring = str.substring(start, end);
try {
return XMLUtil.toElementContent(substring);
} catch (CharConversionException ex) {
Exceptions.printStackTrace(ex);
return substring;
}
}
示例15: getHtmlDisplayName
import org.openide.xml.XMLUtil; //导入方法依赖的package包/类
public @Override String getHtmlDisplayName() {
if (!project.isMavenProjectLoaded()) {
return null;
}
String packaging = project.getOriginalMavenProject().getPackaging();
if (project.getLookup().lookup(SpecialIcon.class) != null) {
return null;
}
try {
return XMLUtil.toElementContent(getDisplayName()) + " <font color='!controlShadow'>" + packaging + "</font>";
} catch (CharConversionException x) {
return null;
}
}