org.eclipse.mylyn.wikitext.ui_1.6.1.v20120425-0100

   }
    this.defaultFont = defaultFont;
    defaultFontHeight = defaultFont.getFontData()[0].getHeight();
    this.defaultMonospaceFont = defaultMonospaceFont;
    defaultMonospaceFontHeight = (defaultMonospaceFont == null ? 
      defaultFontHeight : 
      defaultMonospaceFont.getFontData()[0].getHeight());
  }
  
  public CssStyleManager()
  {
    register(new ColorRuleHandler(null));
    register(new BackgroundColorRuleHandler(null));
    register(new FontStyleRuleHandler(null));
    register(new FontWeightRuleHandler(null));
    register(new FontSizeRuleHandler(null));
    register(new FontFamilyRuleHandler(null));
    register(new TextDecorationRuleHandler(null));
    register(new VerticalAlignRuleHandler(null));
    
    defaultFont = null;
    defaultMonospaceFont = null;
    defaultFontHeight = 11;
    defaultMonospaceFontHeight = 11;
  }
  
  private void register(RuleHandler handler)
  {
    ruleNameToHandler.put(handler.getRuleName(), handler);
  }
  
  public StyleRange createStyleRange(FontState fontState, int offset, int length)
  {
    StyleRange styleRange = new StyleRange(offset, length, getColorFromRgb(foreground), 
      getColorFromRgb(background));
    if (fontState.isBold()) {
      fontStyle |= 0x1;
    }
    if (fontState.isUnderline()) {
      underline = true;
    }
    if (fontState.isStrikethrough()) {
      strikeout = true;
    }
    if (fontState.isItalic()) {
      fontStyle |= 0x2;
    }
    if (fontState.isSubscript()) {
      rise = -4;
    } else if (fontState.isSuperscript()) {
      rise = 4;
    }
    if (fontState.isFixedWidth())
    {
      String symbolicName = computeSymbolicName(fontState, "monospace", defaultMonospaceFont);
      Font monospaceFont = JFaceResources.getFontRegistry().hasValueFor(symbolicName) ? 
        JFaceResources.getFontRegistry().get(symbolicName) : 
        null;
      if (monospaceFont == null)
      {
        FontData[] fontData = null;
        if (defaultMonospaceFont != null)
        {
          fontData = defaultMonospaceFont.getFontData();
        }
        else
        {
          Font defaultFont = JFaceResources.getFontRegistry().defaultFont();
          
          String[] fontNames = computeMonospaceFontNames();
          String[] arrayOfString1;
          int j = (arrayOfString1 = fontNames).length;
          for (int i = 0; i < j; i++)
          {
            String fontName = arrayOfString1[i];
            fontData = defaultFont.getDevice().getFontList(fontName, false);
            if ((fontData == null) || (fontData.length == 0)) {
              fontData = defaultFont.getDevice().getFontList(fontName, true);
            }
            if ((fontData != null) && (fontData.length > 0)) {
              break;
            }
          }
        }
        if ((fontData != null) && (fontData.length > 0))
        {
          fontData = applyFontState(fontState, fontData);
          JFaceResources.getFontRegistry().put(symbolicName, fontData);
          monospaceFont = JFaceResources.getFontRegistry().get(symbolicName);
        }
      }
      if (monospaceFont != null) {
        font = monospaceFont;
      }
    }
    else
    {
      String symbolicName = computeSymbolicName(fontState, "default", this.defaultFont);
      Font font = JFaceResources.getFontRegistry().hasValueFor(symbolicName) ? JFaceResources.getFontRegistry()
        .get(symbolicName) : null;
      if (font == null)
      {
        FontData[] fontData = createFontData(fontState, this.defaultFont);
        JFaceResources.getFontRegistry().put(symbolicName, fontData);
        font = JFaceResources.getFontRegistry().get(symbolicName);
      }
      if (font != null) {
        font = font;
      }
    }
    return styleRange;
  }
  
  private String[] computeMonospaceFontNames()
  {
    boolean linux = false;
    boolean macosx = false;
    try
    {
      String os = Platform.getOS();
      macosx = "macosx".equals(os);
      linux = "linux".equals(os);
    }
    catch (Exception localException)
    {
      String osName = System.getProperty("os.name");
      if (osName != null) {
        if (osName.startsWith("Mac")) {
          macosx = true;
        } else if (osName.startsWith("Linux")) {
          linux = true;
        }
      }
    }
    if (linux) {
      return new String[] { "monospace", "Courier New", "Courier" };
    }
    if (macosx) {
      return new String[] { "Courier", "Courier New" };
    }
    return new String[] { "Courier New", "Courier" };
  }
  
  private FontData[] applyFontState(FontState fontState, FontData[] fontData)
  {
    boolean bold = fontState.isBold();
    boolean italics = fontState.isItalic();
    int fontHeight = computeFontHeight(fontState);
    FontData[] arrayOfFontData;
    int j = (arrayOfFontData = fontData).length;
    for (int i = 0; i < j; i++)
    {
      FontData data = arrayOfFontData[i];
      data.setHeight(fontHeight);
      int style = data.getStyle();
      if (bold) {
        style |= 0x1;
      }
      if (italics) {
        style |= 0x2;
      }
      data.setStyle(style);
    }
    return fontData;
  }
  
  private int computeFontHeight(FontState fontState)
  {
    int fontHeight = fontState.isFixedWidth() ? defaultMonospaceFontHeight : defaultFontHeight;
    fontHeight = (int)(fontHeight * sizeFactor);
    
    fontHeight = Math.min(50, Math.max(9, fontHeight));
    return fontHeight;
  }
  
  private FontData[] createFontData(FontState fontState, Font baseFont)
  {
    FontData[] fontData = new FontData[baseFont.getFontData().length];
    int index = -1;
    FontData[] arrayOfFontData1;
    int j = (arrayOfFontData1 = baseFont.getFontData()).length;
    for (int i = 0; i < j; i++)
    {
      FontData fd = arrayOfFontData1[i];
      fontData[(++index)] = new FontData(fd.getName(), fd.getHeight(), fd.getStyle());
    }
    return applyFontState(fontState, fontData);
  }
  
  private String computeSymbolicName(FontState fontState, String key, Font defaultFont)
  {
    String symbolicName = getClass().getSimpleName() + '-' + key + '-' + computeFontHeight(fontState);
    if (fontState.isBold()) {
      symbolicName = symbolicName + "-bold";
    }
    if (fontState.isItalic()) {
      symbolicName = symbolicName + "-italic";
    }
    if (defaultFont != null)
    {
      FontData fontData = defaultFont.getFontData()[0];
      symbolicName = symbolicName + '-' + fontData.getName() + '-' + fontData.getStyle();
    }
    return symbolicName;
  }
  
  public Color getColorFromRgb(RGB rgb)
  {
    if (rgb == null) {
      return null;
    }
    String symbolicName = String.format("#%02X%02X%02X", new Object[] { Integer.valueOf(red), Integer.valueOf(green), Integer.valueOf(blue) });
    Color color = JFaceResources.getColorRegistry().get(symbolicName);
    if (color == null)
    {
      JFaceResources.getColorRegistry().put(symbolicName, rgb);
      color = JFaceResources.getColorRegistry().get(symbolicName);
    }
    return color;
  }
  
  public SortedSet<String> getRecognizedRuleNames()
  {
    return new TreeSet(ruleNameToHandler.keySet());
  }
  
  public boolean isKnownRule(CssRule rule)
  {
    return ruleNameToHandler.containsKey(name);
  }
  
  private static class ColorRuleHandler
    implements CssStyleManager.RuleHandler
  {
    public String getRuleName()
    {
      return "color";
    }
    
    public void process(CssRule rule, FontState fontState, FontState parentFontState)
    {
      Integer rgb = CssStyleManager.cssColorRgb(value);
      if (rgb != null) {
        foreground = CssStyleManager.toRGB(rgb.intValue());
      }
    }
  }
  
  private static class BackgroundColorRuleHandler
    implements CssStyleManager.RuleHandler
  {
    public String getRuleName()
    {
      return "background-color";
    }
    
    public void process(CssRule rule, FontState fontState, FontState parentFontState)
    {
      Integer rgb = CssStyleManager.cssColorRgb(value);
      if (rgb != null) {
        background = CssStyleManager.toRGB(rgb.intValue());
      }
    }
  }
  
  private static class FontStyleRuleHandler
    implements CssStyleManager.RuleHandler
  {
    public String getRuleName()
    {
      return "font-style";
    }
    
    public void process(CssRule rule, FontState fontState, FontState parentFontState)
    {
      String[] parts = value.split("((\\s+)|(\\s*,\\s*))");
      String[] arrayOfString1;
      int j = (arrayOfString1 = parts).length;
      for (int i = 0; i < j; i++)
      {
        String part = arrayOfString1[i];
        if ("italic".equals(part)) {
          fontState.setItalic(true);
        } else if ("bold".equals(part)) {
          fontState.setBold(true);
        } else if ("normal".equals(part)) {
          fontState.setItalic(false);
        }
      }
    }
  }
  
  private static class FontWeightRuleHandler
    implements CssStyleManager.RuleHandler
  {
    public String getRuleName()
    {
      return "font-weight";
    }
    
    public void process(CssRule rule, FontState fontState, FontState parentFontState)
    {
      if (("bold".equals(value)) || ("bolder".equals(value))) {
        fontState.setBold(true);
      } else if (("normal".equals(value)) || ("lighter".equals(value))) {
        fontState.setBold(false);
      }
    }
  }
  
  private class FontSizeRuleHandler
    implements CssStyleManager.RuleHandler
  {
    private FontSizeRuleHandler() {}
    
    public String getRuleName()
    {
      return "font-size";
    }
    
    public void process(CssRule rule, FontState fontState, FontState parentFontState)
    {
      String cssFontSizeValue = value;
      if (cssFontSizeValue.endsWith("%")) {
        try
        {
          float percentage = Float.parseFloat(cssFontSizeValue.substring(0, cssFontSizeValue.length() - 1)) / 100.0F;
          if (percentage <= 0.0F) {
            return;
          }
          sizeFactor = percentage;
        }
        catch (NumberFormatException localNumberFormatException1) {}
      } else if ("xx-small".equals(cssFontSizeValue)) {
        sizeFactor = 0.4F;
      } else if ("x-small".equals(cssFontSizeValue)) {
        sizeFactor = 0.6F;
      } else if ("small".equals(cssFontSizeValue)) {
        sizeFactor = 0.8F;
      } else if ("medium".equals(cssFontSizeValue)) {
        sizeFactor = 1.0F;
      } else if ("large".equals(cssFontSizeValue)) {
        sizeFactor = 1.2F;
      } else if ("x-large".equals(cssFontSizeValue)) {
        sizeFactor = 1.4F;
      } else if ("xx-large".equals(cssFontSizeValue)) {
        sizeFactor = 1.6F;
      } else if ("larger".equals(cssFontSizeValue)) {
        sizeFactor *= 1.2F;
      } else if ("smaller".equals(cssFontSizeValue)) {
        sizeFactor -= sizeFactor * 0.2F;
      } else {
        try
        {
          if ((cssFontSizeValue.endsWith("pt")) || (cssFontSizeValue.endsWith("px"))) {
            cssFontSizeValue = cssFontSizeValue.substring(0, cssFontSizeValue.length() - 2);
          }
          float exactSize = Float.parseFloat(cssFontSizeValue);
          if (exactSize > 0.0F)
          {
            float defaultSize = fontState.isFixedWidth() ? defaultMonospaceFontHeight : defaultFontHeight;
            sizeFactor = (exactSize / defaultSize);
          }
        }
        catch (NumberFormatException e)
        {
          e.printStackTrace();
        }
      }
    }
  }
  
  private static class FontFamilyRuleHandler
    implements CssStyleManager.RuleHandler
  {
    public String getRuleName()
    {
      return "font-family";
    }
    
    public void process(CssRule rule, FontState fontState, FontState parentFontState)
    {
      String[] parts = value.split("((\\s+)|(\\s*,\\s*))");
      String[] arrayOfString1;
      int j = (arrayOfString1 = parts).length;
      for (int i = 0; i < j; i++)
      {
        String part = arrayOfString1[i];
        if ((part.length() > 1) && (part.startsWith("'")) && (part.endsWith("'"))) {
          part = part.substring(1, part.length() - 1);
        }
        if (("monospace".equals(part)) || ("courier".equalsIgnoreCase(part)) || 
          ("courier new".equalsIgnoreCase(part))) {
          fontState.setFixedWidth(true);
        } else {
          fontState.setFixedWidth(false);
        }
      }
    }
  }
  
  private static class TextDecorationRuleHandler
    implements CssStyleManager.RuleHandler
  {
    public String getRuleName()
    {
      return "text-decoration";
    }
    
    public void process(CssRule rule, FontState fontState, FontState parentFontState)
    {
      String[] parts = value.split("((\\s+)|(\\s*,\\s*))");
      String[] arrayOfString1;
      int j = (arrayOfString1 = parts).length;
      for (int i = 0; i < j; i++)
      {
        String part = arrayOfString1[i];
        if ("none".equals(part))
        {
          fontState.setStrikethrough(false);
          fontState.setUnderline(false);
        }
        else if ("line-through".equals(part))
        {
          fontState.setStrikethrough(true);
        }
        else if ("underline".equals(part))
        {
          fontState.setUnderline(true);
        }
      }
    }
  }
  
  private static class VerticalAlignRuleHandler
    implements CssStyleManager.RuleHandler
  {
    public String getRuleName()
    {
      return "vertical-align";
    }
    
    public void process(CssRule rule, FontState fontState, FontState parentFontState)
    {
      if ("super".equals(value)) {
        fontState.setSuperscript(true);
      } else if ("sub".equals(value)) {
        fontState.setSubscript(true);
      }
    }
  }
  
  private static RGB toRGB(int rgb)
  {
    return new RGB((rgb & 0xFF0000) >> 16, (rgb & 0xFF00) >> 8, rgb & 0xFF);
  }
  
  public static Integer cssColorRgb(String cssColor)
  {
    Integer rgb = (Integer)colorToRgb.get(cssColor.toLowerCase());
    if (rgb == null) {
      try
      {
        if (cssColor.startsWith("#"))
        {
          String rgbNumeric = cssColor.substring(1);
          if (rgbNumeric.length() == 3)
          {
            String firstDigit = rgbNumeric.substring(0, 1);
            String secondDigit = rgbNumeric.substring(1, 2);
            String thirdDigit = rgbNumeric.substring(2, 3);
            rgbNumeric = firstDigit + firstDigit + secondDigit + secondDigit + thirdDigit + thirdDigit;
          }
          rgb = Integer.valueOf(Integer.parseInt(rgbNumeric, 16));
        }
        else
        {
          Matcher rgbMatcher = rgbPattern.matcher(cssColor);
          if (rgbMatcher.matches())
          {
            String r = rgbMatcher.group(1);
            String g = rgbMatcher.group(2);
            String b = rgbMatcher.group(3);
            String rgbNumeric = String.format("%02X%02X%02X", new Object[] { Integer.valueOf(Integer.parseInt(r)), Integer.valueOf(Integer.parseInt(g)), 
              Integer.valueOf(Integer.parseInt(b)) });
            rgb = Integer.valueOf(Integer.parseInt(rgbNumeric, 16));
          }
        }
      }
      catch (NumberFormatException e)
      {
        e.printStackTrace();
      }
    }
    return rgb;
  }
  
  public FontState createDefaultFontState()
  {
    FontState fontState = new FontState();
    return fontState;
  }
  
  public void processCssStyles(FontState fontState, FontState parentFontState, CssRule rule)
  {
    RuleHandler ruleHandler = (RuleHandler)ruleNameToHandler.get(name);
    if (ruleHandler != null) {
      ruleHandler.process(rule, fontState, parentFontState);
    }
  }
  
  private static abstract interface RuleHandler
  {
    public abstract String getRuleName();
    
    public abstract void process(CssRule paramCssRule, FontState paramFontState1, FontState paramFontState2);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.CssStyleManager
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer;

import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.DefaultInformationControl.IInformationPresenter;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

class TextHover$1$1
  extends DefaultInformationControl
{
  TextHover$1$1(TextHover.1 param1, Shell $anonymous0, int $anonymous1, DefaultInformationControl.IInformationPresenter $anonymous2, String $anonymous3)
  {
    super($anonymous0, $anonymous1, $anonymous2, $anonymous3);
  }
  
  public void setLocation(Point location)
  {
    Point cursorLocation = Display.getCurrent().getCursorLocation();
    if (y + 12 >= y) {
      y += 13;
    }
    super.setLocation(location);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.TextHover.1.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.mylyn.internal.wikitext.core.util.css.ElementInfo;
import org.xml.sax.Attributes;

class HtmlTextPresentationParser$ElementState
  implements ElementInfo
{
  String elementName;
  int childCount = 0;
  int textChildCount = 0;
  final int originalOffset;
  int offset;
  boolean skipWhitespace = true;
  boolean spanElement;
  boolean blockElement;
  boolean noWhitespaceTextContainer;
  boolean collapsesAdjacentWhitespace;
  final FontState fontState;
  int orderedListIndex = 0;
  int indentLevel = 0;
  int bulletLevel = 0;
  List<Annotation> annotations;
  char[] prefix;
  List<Annotation> prefixAnnotations;
  ElementState lastChild;
  final ElementState parent;
  private String id;
  private String[] cssClasses;
  public int textOffset;
  
  public HtmlTextPresentationParser$ElementState(ElementState parent, String elementName, ElementState elementState, int offset, Attributes atts)
  {
    this.parent = parent;
    this.elementName = elementName;
    fontState = new FontState(fontState);
    this.offset = offset;
    originalOffset = offset;
    skipWhitespace = skipWhitespace;
    indentLevel = indentLevel;
    bulletLevel = bulletLevel;
    initState();
    String cssClass = null;
    for (int x = 0; x < atts.getLength(); x++)
    {
      String localName = atts.getLocalName(x);
      if ("id".equals(localName)) {
        id = atts.getValue(x);
      } else if ("class".equals(localName)) {
        cssClass = atts.getValue(x);
      }
      if ((id != null) && (cssClass != null)) {
        break;
      }
    }
    if (cssClass != null)
    {
      cssClasses = cssClass.split("\\s+");
      if (cssClasses.length > 1) {
        Arrays.sort(cssClasses);
      }
    }
  }
  
  public HtmlTextPresentationParser$ElementState(ElementState parent, String elementName, FontState fontState, int offset)
  {
    this.parent = parent;
    this.elementName = elementName;
    this.fontState = new FontState(fontState);
    this.offset = offset;
    originalOffset = offset;
    initState();
  }
  
  private void initState()
  {
    String elementName = this.elementName.toLowerCase();
    spanElement = HtmlTextPresentationParser.access$0().contains(elementName);
    blockElement = HtmlTextPresentationParser.access$1().contains(elementName);
    collapsesAdjacentWhitespace = HtmlTextPresentationParser.access$2().contains(elementName);
    noWhitespaceTextContainer = "body".equals(elementName);
  }
  
  public void addAnnotation(Annotation annotation)
  {
    if (annotations == null) {
      annotations = new ArrayList(2);
    }
    annotations.add(annotation);
  }
  
  public void addPrefixAnnotation(Annotation annotation)
  {
    if (prefixAnnotations == null) {
      prefixAnnotations = new ArrayList(1);
    }
    prefixAnnotations.add(annotation);
  }
  
  public String getLocalName()
  {
    return elementName;
  }
  
  public ElementInfo getParent()
  {
    return parent;
  }
  
  public boolean hasCssClass(String cssClass)
  {
    return (cssClasses != null) && (Arrays.binarySearch(cssClasses, cssClass) >= 0);
  }
  
  public boolean hasId(String id)
  {
    return (id != null) && (id.equals(this.id));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.HtmlTextPresentationParser.ElementState
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer;

import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.DefaultInformationControl.IInformationPresenter;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.mylyn.wikitext.ui.viewer.HtmlTextPresenter;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.editors.text.EditorsUI;

class TextHover$1
  implements IInformationControlCreator
{
  TextHover$1(TextHover paramTextHover) {}
  
  public IInformationControl createInformationControl(Shell parent)
  {
    String tooltipAffordanceString = null;
    try
    {
      tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
    }
    catch (Exception localException) {}
    new DefaultInformationControl(parent, 0, new HtmlTextPresenter(), tooltipAffordanceString)
    {
      public void setLocation(Point location)
      {
        Point cursorLocation = Display.getCurrent().getCursorLocation();
        if (y + 12 >= y) {
          y += 13;
        }
        super.setLocation(location);
      }
    };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.TextHover.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation;

import org.eclipse.jface.text.source.Annotation;

public class BulletAnnotation
  extends Annotation
{
  public static final String TYPE = "org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.bullet";
  private final int indentLevel;
  
  public BulletAnnotation(int indentLevel)
  {
    super("org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.bullet", false, Integer.toString(indentLevel));
    this.indentLevel = indentLevel;
  }
  
  public int getIndentLevel()
  {
    return indentLevel;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.BulletAnnotation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation;

import org.eclipse.jface.text.source.Annotation;
import org.eclipse.mylyn.wikitext.ui.annotation.AnchorHrefAnnotation;
import org.eclipse.swt.graphics.Image;

public class ImageAnnotation
  extends Annotation
{
  public static final String TYPE = "org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.image";
  private Image image;
  private final String url;
  private AnchorHrefAnnotation hyperlnkAnnotation;
  
  public ImageAnnotation(String url, Image image)
  {
    super("org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.image", false, "");
    this.url = url;
    this.image = image;
  }
  
  public String getElementId()
  {
    return getText();
  }
  
  public void setImage(Image image)
  {
    this.image = image;
  }
  
  public Image getImage()
  {
    return image;
  }
  
  public String getUrl()
  {
    return url;
  }
  
  public void setAnchorHrefAnnotation(AnchorHrefAnnotation hyperlnkAnnotation)
  {
    this.hyperlnkAnnotation = hyperlnkAnnotation;
  }
  
  public AnchorHrefAnnotation getHyperlnkAnnotation()
  {
    return hyperlnkAnnotation;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.ImageAnnotation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation;

import org.eclipse.jface.text.source.Annotation;

public class HorizontalRuleAnnotation
  extends Annotation
{
  public static final String TYPE = "org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.hr";
  
  public HorizontalRuleAnnotation()
  {
    super("org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.hr", false, "");
  }
  
  public String getElementId()
  {
    return getText();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.HorizontalRuleAnnotation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation;

import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;

public class ImageDrawingStrategy
  implements AnnotationPainter.IDrawingStrategy
{
  private final SourceViewer viewer;
  
  public ImageDrawingStrategy(SourceViewer viewer)
  {
    this.viewer = viewer;
  }
  
  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color)
  {
    if (gc != null)
    {
      Position position = viewer.getAnnotationModel().getPosition(annotation);
      
      ImageAnnotation imageAnnotation = (ImageAnnotation)annotation;
      Image image = imageAnnotation.getImage();
      if (image != null)
      {
        if (position != null) {
          offset = offset;
        }
        Point left = textWidget.getLocationAtOffset(offset);
        if ((position == null) && (length > 0))
        {
          Point right = textWidget.getLocationAtOffset(offset + length);
          if (x > x)
          {
            x = 0;
            y = y;
          }
        }
        Color foreground = gc.getForeground();
        Color background = gc.getBackground();
        gc.setForeground(textWidget.getBackground());
        gc.setBackground(textWidget.getBackground());
        Rectangle bounds = image.getBounds();
        gc.fillRectangle(new Rectangle(x, y, width, height));
        
        gc.setForeground(foreground);
        gc.setBackground(background);
        gc.drawImage(image, x, y);
      }
    }
    else
    {
      textWidget.redrawRange(offset, length, true);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.ImageDrawingStrategy
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation;

import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;

public class BulletDrawingStrategy
  implements AnnotationPainter.IDrawingStrategy
{
  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color)
  {
    BulletAnnotation bullet = (BulletAnnotation)annotation;
    if (gc != null)
    {
      Color foreground = gc.getForeground();
      Color background = gc.getBackground();
      if (length < 1) {
        return;
      }
      Point left = textWidget.getLocationAtOffset(offset);
      Point right = textWidget.getLocationAtOffset(offset + length);
      if (x > x)
      {
        x = 0;
        y = y;
      }
      int baseline = textWidget.getBaseline(offset);
      
      int lineHeight = textWidget.getLineHeight(offset);
      
      int vcenter = y + baseline / 2 + baseline / 4;
      int hcenter = x + (x - x) / 2;
      
      gc.setLineWidth(0);
      gc.setLineStyle(1);
      
      StyleRange styleRange = textWidget.getStyleRangeAtOffset(offset);
      if ((styleRange != null) && (foreground != null)) {
        color = foreground;
      }
      Point selection = textWidget.getSelection();
      if ((offset >= x) && (offset < y) && (x < y))
      {
        gc.setBackground(textWidget.getSelectionBackground());
        gc.setForeground(color);
      }
      else
      {
        gc.setBackground(textWidget.getBackground());
      }
      gc.fillRectangle(x, y, x - x, lineHeight);
      switch (bullet.getIndentLevel())
      {
      case 1: 
        gc.setBackground(color);
        gc.fillOval(hcenter - 3, vcenter - 2, 5, 5);
        break;
      case 2: 
        gc.setForeground(color);
        gc.drawOval(hcenter - 3, vcenter - 3, 5, 5);
        break;
      default: 
        gc.setBackground(color);
        gc.fillRectangle(hcenter - 3, vcenter - 2, 5, 5);
      }
      gc.setForeground(foreground);
      gc.setBackground(background);
    }
    else
    {
      textWidget.redrawRange(offset, length, true);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.BulletDrawingStrategy
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation;

import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
import org.eclipse.mylyn.internal.wikitext.ui.util.WikiTextUiResources;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;

public class HorizontalRuleDrawingStrategy
  implements AnnotationPainter.IDrawingStrategy
{
  private final Color shadowForeground;
  
  public HorizontalRuleDrawingStrategy()
  {
    shadowForeground = WikiTextUiResources.getColors().get("HR_SHADOW");
  }
  
  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color)
  {
    if (gc != null)
    {
      Color foreground = gc.getForeground();
      
      Point left = textWidget.getLocationAtOffset(offset);
      Point right = textWidget.getLocationAtOffset(offset + length);
      if (x > x)
      {
        x = 0;
        y = y;
      }
      x = getClientAreawidth;
      
      int baseline = textWidget.getBaseline(offset);
      
      int vcenter = y + baseline / 2 + baseline / 4;
      
      gc.setLineWidth(0);
      gc.setLineStyle(1);
      
      x += 3;
      x -= 5;
      vcenter -= 2;
      if (x > x)
      {
        gc.setForeground(shadowForeground);
        gc.drawRectangle(x, vcenter, x - x, 2);
        
        gc.setForeground(color);
        gc.drawLine(x, vcenter, x, vcenter);
        gc.drawLine(x, vcenter, x, vcenter + 2);
      }
      gc.setForeground(foreground);
    }
    else
    {
      textWidget.redrawRange(offset, length, true);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.annotation.HorizontalRuleDrawingStrategy
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
import org.eclipse.jface.text.hyperlink.URLHyperlink;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.mylyn.wikitext.ui.annotation.AnchorHrefAnnotation;
import org.eclipse.mylyn.wikitext.ui.annotation.AnchorNameAnnotation;
import org.eclipse.mylyn.wikitext.ui.annotation.IdAnnotation;
import org.eclipse.swt.custom.StyledText;

public class AnnotationHyperlinkDetector
  implements IHyperlinkDetector
{
  public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks)
  {
    if ((textViewer instanceof ISourceViewer))
    {
      int interestingOffset = region.getOffset() + region.getLength();
      
      ISourceViewer sourceViewer = (ISourceViewer)textViewer;
      IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
      if (annotationModel != null)
      {
        List<AnchorHrefAnnotation> hrefs = null;
        Iterator<?> iterator = annotationModel.getAnnotationIterator();
        while (iterator.hasNext())
        {
          Annotation annotation = (Annotation)iterator.next();
          if ((annotation instanceof AnchorHrefAnnotation))
          {
            AnchorHrefAnnotation href = (AnchorHrefAnnotation)annotation;
            Position position = annotationModel.getPosition(href);
            if ((position.getOffset() <= interestingOffset) && 
              (position.getOffset() + position.getLength() >= interestingOffset))
            {
              if (hrefs == null) {
                hrefs = new ArrayList();
              }
              hrefs.add(href);
            }
          }
        }
        if (hrefs != null)
        {
          if (hrefs.size() > 1) {
            Collections.sort(hrefs, new OffsetComparator(annotationModel));
          }
          return new IHyperlink[] { createHyperlink(sourceViewer, annotationModel, (AnchorHrefAnnotation)hrefs.get(0)) };
        }
      }
    }
    return null;
  }
  
  protected IHyperlink createHyperlink(ISourceViewer viewer, IAnnotationModel annotationModel, AnchorHrefAnnotation anchorHrefAnnotation)
  {
    Position position = annotationModel.getPosition(anchorHrefAnnotation);
    IRegion region = new Region(position.getOffset(), position.getLength());
    String href = anchorHrefAnnotation.getAnchorHref();
    if ((href != null) && (href.startsWith("#"))) {
      return new DocumentHyperlink(viewer, region, href);
    }
    return createUrlHyperlink(region, href);
  }
  
  protected IHyperlink createUrlHyperlink(IRegion region, String href)
  {
    return new URLHyperlink(region, href);
  }
  
  private static class OffsetComparator
    implements Comparator<Annotation>
  {
    private final IAnnotationModel annotationModel;
    
    public OffsetComparator(IAnnotationModel annotationModel)
    {
      this.annotationModel = annotationModel;
    }
    
    public int compare(Annotation o1, Annotation o2)
    {
      if (o1 == o2) {
        return 0;
      }
      Position p1 = annotationModel.getPosition(o1);
      Position p2 = annotationModel.getPosition(o2);
      if (p1.getOffset() > p2.getOffset()) {
        return -1;
      }
      if (p2.getOffset() > p1.getOffset()) {
        return 1;
      }
      if (p1.getLength() > p2.getLength()) {
        return -1;
      }
      if (p2.getLength() > p1.getLength()) {
        return 1;
      }
      return Integer.valueOf(System.identityHashCode(p1)).compareTo(Integer.valueOf(System.identityHashCode(p2)));
    }
  }
  
  protected static class DocumentHyperlink
    implements IHyperlink
  {
    private final ISourceViewer viewer;
    private final IRegion region;
    private final String href;
    
    public DocumentHyperlink(ISourceViewer viewer, IRegion region, String href)
    {
      this.viewer = viewer;
      this.region = region;
      this.href = href;
    }
    
    public IRegion getHyperlinkRegion()
    {
      return region;
    }
    
    public String getHyperlinkText()
    {
      return null;
    }
    
    public String getTypeLabel()
    {
      return null;
    }
    
    public void open()
    {
      String lookingFor = href.substring(1);
      
      IAnnotationModel annotationModel = viewer.getAnnotationModel();
      Iterator<?> iterator = annotationModel.getAnnotationIterator();
      while (iterator.hasNext())
      {
        Annotation annotation = (Annotation)iterator.next();
        if ((annotation instanceof IdAnnotation))
        {
          IdAnnotation idAnnotation = (IdAnnotation)annotation;
          if (!idAnnotation.getElementId().equals(lookingFor)) {
            continue;
          }
        }
        else
        {
          if (!(annotation instanceof AnchorNameAnnotation)) {
            continue;
          }
          AnchorNameAnnotation nameAnnotation = (AnchorNameAnnotation)annotation;
          if (!nameAnnotation.getAnchorName().equals(lookingFor)) {
            continue;
          }
        }
        Position position = annotationModel.getPosition(annotation);
        viewer.getTextWidget().setSelection(position.getOffset());
        break;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.AnnotationHyperlinkDetector
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer;

import java.lang.reflect.Method;
import java.util.Iterator;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;

class Util
{
  static boolean annotationsIncludeOffset(IAnnotationModel annotationModel, int offset)
  {
    if (annotationModel == null) {
      return false;
    }
    try
    {
      Iterator<?> annotationIterator = (Iterator)annotationModel.getClass()
        .getMethod("getAnnotationIterator", new Class[] { Integer.TYPE, Integer.TYPE, Boolean.TYPE, Boolean.TYPE }).invoke(
        annotationModel, new Object[] { Integer.valueOf(offset), Integer.valueOf(1), Boolean.valueOf(true), Boolean.valueOf(true) });
      return annotationIterator.hasNext();
    }
    catch (Exception localException)
    {
      Iterator<Annotation> annotationIterator = annotationModel.getAnnotationIterator();
      while (annotationIterator.hasNext())
      {
        Position position = annotationModel.getPosition((Annotation)annotationIterator.next());
        if ((position != null) && ((offset == offset) || (position.includes(offset)))) {
          return true;
        }
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.Util
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer;

import java.util.Map;
import org.eclipse.swt.graphics.ImageData;

class ImageManager$ImageResolver$1
  implements Runnable
{
  ImageManager$ImageResolver$1(ImageManager.ImageResolver paramImageResolver, String paramString, Map paramMap) {}
  
  public void run()
  {
    ImageManager.access$5(ImageManager.ImageResolver.access$0(this$1), val$imgSrc, (ImageData)val$urlToImageData.get(val$imgSrc));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.wikitext.ui.viewer.ImageManager.ImageResolver.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.ui.viewer;

import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.swt.graphics.ImageData;

class ImageManager$ImageResolver
  extends Thread
{
  public ImageManager$ImageResolver(ImageManager paramImageManager)
  {
    setName(ImageResolver.class.getSimpleName() + '-' + ImageManager.access$0().getAndIncrement());
    setDaemon(true);
  }
  
  /* Error */
  public void run()
  {
    // Byte code:
    //   0: new 82	java/util/HashMap
    //   3: dup
    //   4: invokespecial 186	java/util/HashMap:<init>	()V
    //   7: astore_1
    //   8: aload_0
    //   9: getfield 169	org/eclipse/mylyn/internal/wikitext/ui/viewer/ImageManager$ImageResolver:this$0	Lorg/eclipse/mylyn/internal/wikitext/ui/viewer/ImageManager;
    //   12: invokestatic 192	org/eclipse/mylyn/internal/wikitext/ui/viewer/ImageManager:access$2	(Lorg/eclipse/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd