当前位置: 首页>>代码示例>>Java>>正文


Java XmlStringUtil.stripHtml方法代码示例

本文整理汇总了Java中com.intellij.xml.util.XmlStringUtil.stripHtml方法的典型用法代码示例。如果您正苦于以下问题:Java XmlStringUtil.stripHtml方法的具体用法?Java XmlStringUtil.stripHtml怎么用?Java XmlStringUtil.stripHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.xml.util.XmlStringUtil的用法示例。


在下文中一共展示了XmlStringUtil.stripHtml方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCompositeTooltip

import com.intellij.xml.util.XmlStringUtil; //导入方法依赖的package包/类
@Nullable
private static String createCompositeTooltip(List<HighlightInfo> infos) {
  StringBuilder result = new StringBuilder();
  for (HighlightInfo info : infos) {
    String toolTip = info.getToolTip();
    if (toolTip != null) {
      if (result.length() != 0) {
        result.append(LINE_BREAK);
      }
      toolTip = XmlStringUtil.stripHtml(toolTip);
      result.append(toolTip);
    }
  }
  if (result.length() == 0) {
    return null;
  }
  return XmlStringUtil.wrapInHtml(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HighlightInfoComposite.java

示例2: toString

import com.intellij.xml.util.XmlStringUtil; //导入方法依赖的package包/类
public String toString() {
  CommonProblemDescriptor descriptor = getDescriptor();
  if (descriptor == null) return "";
  PsiElement element = descriptor instanceof ProblemDescriptor ? ((ProblemDescriptor)descriptor).getPsiElement() : null;

  return XmlStringUtil.stripHtml(ProblemDescriptorUtil.renderDescriptionMessage(descriptor, element,
                                                                                APPEND_LINE_NUMBER | TRIM_AT_TREE_END));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ProblemDescriptionNode.java

示例3: escapeQuickFixText

import com.intellij.xml.util.XmlStringUtil; //导入方法依赖的package包/类
private static String escapeQuickFixText(String text) {
  return XmlStringUtil.isWrappedInHtml(text) ? XmlStringUtil.stripHtml(text) : StringUtil.escapeXml(text);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:DescriptorComposer.java

示例4: composeDescription

import com.intellij.xml.util.XmlStringUtil; //导入方法依赖的package包/类
protected void composeDescription(@NotNull CommonProblemDescriptor description, int i, @NotNull StringBuffer buf, @NotNull RefEntity refElement) {
  PsiElement expression = description instanceof ProblemDescriptor ? ((ProblemDescriptor)description).getPsiElement() : null;
  StringBuilder anchor = new StringBuilder();
  VirtualFile vFile = null;

  if (expression != null) {
    vFile = expression.getContainingFile().getVirtualFile();
    if (vFile instanceof VirtualFileWindow) vFile = ((VirtualFileWindow)vFile).getDelegate();

    //noinspection HardCodedStringLiteral
    anchor.append("<a HREF=\"");
    if (myExporter == null){
      //noinspection HardCodedStringLiteral
      anchor.append(appendURL(vFile, "descr:" + i));
    }
    else {
      anchor.append(myExporter.getURL(refElement));
    }

    anchor.append("\">");
    anchor.append(ProblemDescriptorUtil.extractHighlightedText(description, expression).replaceAll("\\$", "\\\\\\$"));
    //noinspection HardCodedStringLiteral
    anchor.append("</a>");
  }
  else {
    //noinspection HardCodedStringLiteral
    anchor.append("<font style=\"font-weight:bold; color:#FF0000\";>");
    anchor.append(InspectionsBundle.message("inspection.export.results.invalidated.item"));
    //noinspection HardCodedStringLiteral
    anchor.append("</font>");
  }

  String descriptionTemplate = description.getDescriptionTemplate();
  if (XmlStringUtil.isWrappedInHtml(descriptionTemplate)) {
    descriptionTemplate = XmlStringUtil.stripHtml(descriptionTemplate);
  }
  else {
    descriptionTemplate = StringUtil.replace(descriptionTemplate, "<code>", "'");
    descriptionTemplate = StringUtil.replace(descriptionTemplate, "</code>", "'");
    descriptionTemplate = XmlStringUtil.escapeString(descriptionTemplate);
  }
  //noinspection HardCodedStringLiteral
  final String reference = "#ref";
  final boolean containsReference = descriptionTemplate.contains(reference);
  String res = descriptionTemplate.replaceAll(reference, anchor.toString());
  final int lineNumber = description instanceof ProblemDescriptor ? ((ProblemDescriptor)description).getLineNumber() : -1;
  StringBuffer lineAnchor = new StringBuffer();
  if (expression != null && lineNumber > 0) {
    Document doc = FileDocumentManager.getInstance().getDocument(vFile);
    lineAnchor.append(InspectionsBundle.message("inspection.export.results.at.line")).append(" ");
    if (myExporter == null) {
      //noinspection HardCodedStringLiteral
      lineAnchor.append("<a HREF=\"");
      int offset = doc.getLineStartOffset(lineNumber - 1);
      offset = CharArrayUtil.shiftForward(doc.getCharsSequence(), offset, " \t");
      lineAnchor.append(appendURL(vFile, String.valueOf(offset)));
      lineAnchor.append("\">");
    }
    lineAnchor.append(Integer.toString(lineNumber));
    //noinspection HardCodedStringLiteral
    lineAnchor.append("</a>");
    //noinspection HardCodedStringLiteral
    final String location = "#loc";
    if (!res.contains(location)) {
      res += " (" + location + ")";
    }
    res = res.replaceAll(location, lineAnchor.toString());
  }
  buf.append(res.replace("#end", "").replace("#treeend",""));
  buf.append(BR).append(BR);
  composeAdditionalDescription(buf, refElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:73,代码来源:DescriptorComposer.java

示例5: reset

import com.intellij.xml.util.XmlStringUtil; //导入方法依赖的package包/类
@Override
public void reset() {
  final String text = (myTemplate == null) ? "" : myTemplate.getText();
  String name = (myTemplate == null) ? "" : myTemplate.getName();
  String extension = (myTemplate == null) ? "" : myTemplate.getExtension();
  String description = (myTemplate == null) ? "" : myTemplate.getDescription();

  if ((description.length() == 0) && (myDefaultDescriptionUrl != null)) {
    try {
      description = UrlUtil.loadText(myDefaultDescriptionUrl);
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }

  EditorFactory.getInstance().releaseEditor(myTemplateEditor);
  myFile = createFile(text, name);
  myTemplateEditor = createEditor();

  myNameField.setText(name);
  myExtensionField.setText(extension);
  myAdjustBox.setSelected(myTemplate != null && myTemplate.isReformatCode());
  myLiveTemplateBox.setSelected(myTemplate != null && myTemplate.isLiveTemplateEnabled());

  int i = description.indexOf("<html>");
  if (i > 0) {
    description = description.substring(i);
  }
  description = XmlStringUtil.stripHtml(description);
  description = description.replace("\n", "").replace("\r", "");
  description = XmlStringUtil.stripHtml(description);
  description = description + "<hr> <font face=\"verdana\" size=\"-1\"><a href='http://velocity.apache.org/engine/devel/user-guide.html#Velocity_Template_Language_VTL:_An_Introduction'>\n" +
                "Apache Velocity</a> template language is used</font>";

  myDescriptionComponent.setText(description);
  myDescriptionComponent.setCaretPosition(0);

  myNameField.setEditable((myTemplate != null) && (!myTemplate.isDefault()));
  myExtensionField.setEditable((myTemplate != null) && (!myTemplate.isDefault()));
  myModified = false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:FileTemplateConfigurable.java

示例6: addListItemToPlugins

import com.intellij.xml.util.XmlStringUtil; //导入方法依赖的package包/类
public void addListItemToPlugins(final JPanel panel,
                                 String name,
                                 @Nullable String description,
                                 @Nullable final String url,
                                 final boolean enabled,
                                 final boolean incompatible) {
  if (StringUtil.isEmptyOrSpaces(name)) {
    return;
  }
  else {
    name = name.trim();
  }

  final int y = myPluginsIdx += 2;

  JLabel imageLabel = new JLabel(); // There used to be a logo, which is removed and I'm (max) lazy enough fixing gridbag
  GridBagConstraints gBC = new GridBagConstraints(0, y, 1, 1, 0, 0, NORTHWEST, NONE, new Insets(15, 20, 0, 0), 0, 0);
  panel.add(imageLabel, gBC);

  name = name + " " + (incompatible ? UIBundle.message("welcome.screen.incompatible.plugins.description")
                                    : (enabled ? "" : UIBundle.message("welcome.screen.disabled.plugins.description")));
  String shortenedName = adjustStringBreaksByWidth(name, LINK_FONT, false, PLUGIN_NAME_MAX_WIDTH, PLUGIN_NAME_MAX_ROWS);
  JLabel logoName = new JLabel(shortenedName);
  logoName.setFont(LINK_FONT);
  logoName.setForeground(enabled ? CAPTION_COLOR : DISABLED_CAPTION_COLOR);
  if (shortenedName.endsWith(___HTML_SUFFIX)) {
    logoName.setToolTipText(adjustStringBreaksByWidth(name, UIUtil.getToolTipFont(), false, MAX_TOOLTIP_WIDTH, 0));
  }

  JPanel logoPanel = new JPanel(new BorderLayout());
  logoPanel.setBackground(PLUGINS_PANEL_BACKGROUND);
  logoPanel.add(logoName, BorderLayout.WEST);
  gBC = new GridBagConstraints(1, y, 1, 1, 0, 0, NORTHWEST, NONE, new Insets(15, 7, 0, 0), 0, 0);
  panel.add(logoPanel, gBC);

  if (!StringUtil.isEmptyOrSpaces(url)) {
    JLabel learnMore = new JLabel(UIBundle.message("welcome.screen.plugins.panel.learn.more.link"));
    learnMore.setFont(LINK_FONT);
    learnMore.setForeground(enabled ? CAPTION_COLOR : DISABLED_CAPTION_COLOR);
    learnMore.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    learnMore.setToolTipText(UIBundle.message("welcome.screen.plugins.panel.learn.more.tooltip.text"));
    new ClickListener() {
      @Override
      public boolean onClick(MouseEvent e, int clickCount) {
        try {
          BrowserUtil.launchBrowser(url);
        }
        catch (IllegalThreadStateException ignore) {
        }
        return true;
      }
    }.installOn(learnMore);

    logoPanel.add(new JLabel(" "), BorderLayout.CENTER);
    logoPanel.add(learnMore, BorderLayout.EAST);
  }

  if (!StringUtil.isEmpty(description)) {
    //noinspection ConstantConditions
    description = XmlStringUtil.stripHtml(description.trim());
    description = description.replaceAll(ESC_NEW_LINE, "");
    String shortenedDcs = adjustStringBreaksByWidth(description, TEXT_FONT, false, PLUGIN_DSC_MAX_WIDTH, PLUGIN_DSC_MAX_ROWS);
    JLabel pluginDescription = new JLabel(shortenedDcs);
    pluginDescription.setFont(TEXT_FONT);
    if (shortenedDcs.endsWith(___HTML_SUFFIX)) {
      pluginDescription.setToolTipText(adjustStringBreaksByWidth(description, UIUtil.getToolTipFont(), false, MAX_TOOLTIP_WIDTH, 0));
    }

    gBC = new GridBagConstraints(1, y + 1, 1, 1, 0, 0, NORTHWEST, HORIZONTAL, new Insets(5, 7, 0, 0), 5, 0);
    panel.add(pluginDescription, gBC);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:73,代码来源:DefaultWelcomeScreen.java

示例7: reset

import com.intellij.xml.util.XmlStringUtil; //导入方法依赖的package包/类
@RequiredDispatchThread
@Override
public void reset() {
  final String text = (myTemplate == null) ? "" : myTemplate.getText();
  String name = (myTemplate == null) ? "" : myTemplate.getName();
  String extension = (myTemplate == null) ? "" : myTemplate.getExtension();
  String description = (myTemplate == null) ? "" : myTemplate.getDescription();

  if ((description.length() == 0) && (myDefaultDescriptionUrl != null)) {
    try {
      description = UrlUtil.loadText(myDefaultDescriptionUrl);
    }
    catch (IOException e) {
      LOG.error(e);
    }
  }

  EditorFactory.getInstance().releaseEditor(myTemplateEditor);
  myFile = createFile(text, name);
  myTemplateEditor = createEditor();

  myNameField.setText(name);
  myExtensionField.setText(extension);
  myAdjustBox.setSelected(myTemplate != null && myTemplate.isReformatCode());
  myLiveTemplateBox.setSelected(myTemplate != null && myTemplate.isLiveTemplateEnabled());

  int i = description.indexOf("<html>");
  if (i > 0) {
    description = description.substring(i);
  }
  description = XmlStringUtil.stripHtml(description);
  description = description.replace("\n", "").replace("\r", "");
  description = XmlStringUtil.stripHtml(description);
  description = description + "<hr> <font face=\"verdana\" size=\"-1\"><a href='http://velocity.apache.org/engine/devel/user-guide.html#Velocity_Template_Language_VTL:_An_Introduction'>\n" +
                "Apache Velocity</a> template language is used</font>";

  myDescriptionComponent.setText(description);
  myDescriptionComponent.setCaretPosition(0);

  myNameField.setEditable((myTemplate != null) && (!myTemplate.isDefault()));
  myExtensionField.setEditable((myTemplate != null) && (!myTemplate.isDefault()));
  myModified = false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:44,代码来源:FileTemplateConfigurable.java


注:本文中的com.intellij.xml.util.XmlStringUtil.stripHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。