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

16:47:07.170 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.wikitext.tasks.ui_1.6.1.v20120425-0100.jar
package org.eclipse.mylyn.wikitext.tasks.ui.editor;

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

class MarkupTaskEditorExtension$TaskMarkupSourceViewerConfiguration$1
  extends DefaultAnnotationHover
{
  MarkupTaskEditorExtension$TaskMarkupSourceViewerConfiguration$1(MarkupTaskEditorExtension.TaskMarkupSourceViewerConfiguration paramTaskMarkupSourceViewerConfiguration) {}
  
  protected boolean isIncluded(Annotation annotation)
  {
    return (annotation.getType().startsWith("org.eclipse.wikitext")) || (super.isIncluded(annotation));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.tasks.ui.editor.MarkupTaskEditorExtension.TaskMarkupSourceViewerConfiguration.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.tasks.ui.editor;

import java.util.Map;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.mylyn.internal.wikitext.ui.viewer.AnnotationHyperlinkDetector;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TaskHyperlinkPresenter;
import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewer;
import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewerConfiguration;
import org.eclipse.swt.graphics.RGB;

public class MarkupTaskEditorExtension$TaskMarkupViewerConfiguration
  extends MarkupViewerConfiguration
{
  private final IAdaptable context;
  
  public MarkupTaskEditorExtension$TaskMarkupViewerConfiguration(MarkupViewer viewer, TaskRepository taskRepository)
  {
    this(viewer, taskRepository, null);
  }
  
  public MarkupTaskEditorExtension$TaskMarkupViewerConfiguration(MarkupViewer viewer, TaskRepository taskRepository, IAdaptable context)
  {
    super(viewer);
    if (context == null) {
      this.context = MarkupTaskEditorExtension.access$0(taskRepository);
    } else {
      this.context = context;
    }
    markupHyperlinksFirst = false;
  }
  
  protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer)
  {
    Map hyperlinkDetectorTargets = super.getHyperlinkDetectorTargets(sourceViewer);
    MarkupTaskEditorExtension.access$1(context, hyperlinkDetectorTargets);
    return hyperlinkDetectorTargets;
  }
  
  protected AnnotationHyperlinkDetector createAnnotationHyperlinkDetector()
  {
    return new MarkupTaskEditorExtension.PlatformUrlAnnotationHyperlinkDetector(null);
  }
  
  public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer)
  {
    if (fPreferenceStore == null) {
      return new TaskHyperlinkPresenter(new RGB(0, 0, 255));
    }
    return new TaskHyperlinkPresenter(fPreferenceStore);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.tasks.ui.editor.MarkupTaskEditorExtension.TaskMarkupViewerConfiguration
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.tasks.ui.editor;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter;
import org.eclipse.jface.text.reconciler.IReconciler;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.DefaultAnnotationHover;
import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.mylyn.commons.workbench.browser.UrlHyperlink;
import org.eclipse.mylyn.internal.wikitext.tasks.ui.util.Util;
import org.eclipse.mylyn.internal.wikitext.ui.WikiTextUiPlugin;
import org.eclipse.mylyn.internal.wikitext.ui.editor.preferences.Preferences;
import org.eclipse.mylyn.internal.wikitext.ui.util.PreferenceStoreFacade;
import org.eclipse.mylyn.internal.wikitext.ui.viewer.AnnotationHyperlinkDetector;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.ITasksUiFactory;
import org.eclipse.mylyn.tasks.ui.TaskHyperlinkPresenter;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguageConfiguration;
import org.eclipse.mylyn.wikitext.ui.editor.MarkupSourceViewer;
import org.eclipse.mylyn.wikitext.ui.editor.MarkupSourceViewerConfiguration;
import org.eclipse.mylyn.wikitext.ui.editor.ShowInTargetBridge;
import org.eclipse.mylyn.wikitext.ui.viewer.DefaultHyperlinkDetectorDescriptorFilter;
import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewer;
import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewerConfiguration;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.swt.IFocusService;
import org.eclipse.ui.texteditor.AnnotationPreference;
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;

public class MarkupTaskEditorExtension<MarkupLanguageType extends MarkupLanguage>
  extends AbstractTaskEditorExtension
  implements IAdaptable
{
  private static final String MARKUP_SOURCE_CONTEXT_ID = "org.eclipse.mylyn.wikitext.tasks.ui.markupSourceContext";
  private static final String MARKUP_VIEWER = "org.eclipse.mylyn.wikitext.tasks.ui.markupViewer";
  private static final boolean DISABLE_WIKI_WORD = Boolean.getBoolean(MarkupTaskEditorExtension.class.getSimpleName() + 
    ".wikiWordDisabled");
  private static final String ID_CONTEXT_EDITOR_TASK = "org.eclipse.mylyn.tasks.ui.TaskEditor";
  private static final String ID_CONTEXT_EDITOR_TEXT = "org.eclipse.ui.DefaultTextEditor";
  private MarkupLanguageType markupLanguage;
  
  public MarkupLanguageType getMarkupLanguage()
  {
    return markupLanguage;
  }
  
  public void setMarkupLanguage(MarkupLanguageType markupLanguage)
  {
    this.markupLanguage = markupLanguage;
  }
  
  public String getEditorContextId()
  {
    return "org.eclipse.mylyn.wikitext.tasks.ui.markupSourceContext";
  }
  
  @Deprecated
  public SourceViewer createViewer(TaskRepository taskRepository, Composite parent, int style)
  {
    return createViewer(taskRepository, parent, style, null);
  }
  
  public SourceViewer createViewer(TaskRepository taskRepository, Composite parent, int style, IAdaptable context)
  {
    if (markupLanguage == null) {
      throw new IllegalStateException();
    }
    MarkupViewer markupViewer = new MarkupViewer(parent, null, style | 0x800000 | 0x40);
    MarkupLanguageType markupLanguageCopy = createRepositoryMarkupLanguage(taskRepository);
    configureMarkupLanguage(taskRepository, markupLanguageCopy);
    
    markupViewer.setMarkupLanguage(markupLanguageCopy);
    
    MarkupViewerConfiguration configuration = createViewerConfiguration(taskRepository, markupViewer, context);
    configuration.setDisableHyperlinkModifiers(true);
    configuration.setEnableSelfContainedIncrementalFind(true);
    if (markupLanguageCopy.isDetectingRawHyperlinks()) {
      configuration.addHyperlinkDetectorDescriptorFilter(new DefaultHyperlinkDetectorDescriptorFilter(
        "org.eclipse.mylyn.tasks.ui.hyperlinks.detectors.url"));
    }
    markupViewer.configure(configuration);
    
    markupViewer.setEditable(false);
    markupViewer.getTextWidget().setCaret(null);
    if (JFaceResources.getFontRegistry().hasValueFor("org.eclipse.mylyn.tasks.ui.fonts.task.editor.comment")) {
      markupViewer.getTextWidget().setFont(
        JFaceResources.getFontRegistry().get("org.eclipse.mylyn.tasks.ui.fonts.task.editor.comment"));
    }
    if (JFaceResources.getFontRegistry().hasValueFor("org.eclipse.mylyn.wikitext.tasks.ui.monospaceFont")) {
      markupViewer.setDefaultMonospaceFont(JFaceResources.getFontRegistry().get(
        "org.eclipse.mylyn.wikitext.tasks.ui.monospaceFont"));
    }
    markupViewer.setStylesheet(WikiTextUiPlugin.getDefault().getPreferences().getStylesheet());
    
    IFocusService focusService = (IFocusService)PlatformUI.getWorkbench().getService(IFocusService.class);
    if (focusService != null) {
      focusService.addFocusTracker(markupViewer.getTextWidget(), "org.eclipse.mylyn.wikitext.tasks.ui.markupViewer");
    }
    markupViewer.getTextWidget().setData(ISourceViewer.class.getName(), markupViewer);
    
    return markupViewer;
  }
  
  private MarkupLanguageType createRepositoryMarkupLanguage(TaskRepository taskRepository)
  {
    MarkupLanguageType copy = markupLanguage.clone();
    MarkupLanguageConfiguration configuration = createMarkupLanguageConfiguration(taskRepository);
    copy.configure(configuration);
    return copy;
  }
  
  protected MarkupLanguageConfiguration createMarkupLanguageConfiguration(TaskRepository taskRepository)
  {
    MarkupLanguageConfiguration configuration = Util.create(taskRepository.getConnectorKind());
    if (DISABLE_WIKI_WORD) {
      configuration.setWikiWordLinking(Boolean.valueOf(false));
    }
    return configuration;
  }
  
  protected TaskMarkupViewerConfiguration createViewerConfiguration(TaskRepository taskRepository, MarkupViewer markupViewer)
  {
    return createViewerConfiguration(taskRepository, markupViewer, null);
  }
  
  protected TaskMarkupViewerConfiguration createViewerConfiguration(TaskRepository taskRepository, MarkupViewer markupViewer, IAdaptable context)
  {
    return new TaskMarkupViewerConfiguration(markupViewer, taskRepository, context);
  }
  
  protected TaskMarkupSourceViewerConfiguration createSourceViewerConfiguration(TaskRepository taskRepository, SourceViewer viewer)
  {
    return createSourceViewerConfiguration(taskRepository, viewer, null);
  }
  
  protected TaskMarkupSourceViewerConfiguration createSourceViewerConfiguration(TaskRepository taskRepository, SourceViewer viewer, IAdaptable context)
  {
    IPreferenceStore preferenceStore = EditorsUI.getPreferenceStore();
    return new TaskMarkupSourceViewerConfiguration(preferenceStore, taskRepository, context);
  }
  
  @Deprecated
  public SourceViewer createEditor(TaskRepository taskRepository, Composite parent, int style)
  {
    return createEditor(taskRepository, parent, style, null);
  }
  
  public SourceViewer createEditor(TaskRepository taskRepository, Composite parent, int style, IAdaptable context)
  {
    MarkupLanguageType markupLanguageCopy = createRepositoryMarkupLanguage(taskRepository);
    configureMarkupLanguage(taskRepository, markupLanguageCopy);
    
    SourceViewer viewer = new MarkupSourceViewer(parent, null, style | 0x40, markupLanguageCopy);
    
    MarkupSourceViewerConfiguration configuration = createSourceViewerConfiguration(taskRepository, viewer, context);
    
    configuration.setEnableSelfContainedIncrementalFind(true);
    configuration.setMarkupLanguage(markupLanguageCopy);
    configuration.setShowInTarget(new ShowInTargetBridge(viewer));
    viewer.configure(configuration);
    
    viewer.showAnnotations(true);
    
    DefaultMarkerAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
    MarkerAnnotationPreferences annotationPreferences = new MarkerAnnotationPreferences();
    
    final SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(viewer, null, annotationAccess, 
      EditorsUI.getSharedTextColors());
    
    Iterator<AnnotationPreference> e = annotationPreferences.getAnnotationPreferences().iterator();
    while (e.hasNext())
    {
      AnnotationPreference preference = (AnnotationPreference)e.next();
      support.setAnnotationPreference(preference);
    }
    support.setCursorLinePainterPreferenceKeys("currentLine", 
      "currentLineColor");
    support.setMarginPainterPreferenceKeys("printMargin", 
      "printMarginColor", 
      "printMarginColumn");
    
    support.install(new EditorExtensionPreferenceStore(EditorsUI.getPreferenceStore(), viewer.getControl()));
    viewer.getControl().addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        support.dispose();
      }
    });
    IFocusService focusService = (IFocusService)PlatformUI.getWorkbench().getService(IFocusService.class);
    if (focusService != null) {
      focusService.addFocusTracker(viewer.getTextWidget(), "org.eclipse.mylyn.wikitext.ui.editor.sourceViewer");
    }
    viewer.getTextWidget().setData(MarkupLanguage.class.getName(), markupLanguageCopy);
    viewer.getTextWidget().setData(ISourceViewer.class.getName(), viewer);
    
    return viewer;
  }
  
  protected void configureMarkupLanguage(TaskRepository taskRepository, MarkupLanguageType markupLanguage)
  {
    String internalLinkPattern = taskRepository.getProperty("wikiLinkPattern");
    if ((internalLinkPattern != null) && (internalLinkPattern.trim().length() > 0)) {
      markupLanguage.setInternalLinkPattern(internalLinkPattern.trim());
    } else {
      configureDefaultInternalLinkPattern(taskRepository, markupLanguage);
    }
  }
  
  protected void configureDefaultInternalLinkPattern(TaskRepository taskRepository, MarkupLanguageType markupLanguage) {}
  
  protected static class TaskMarkupSourceViewerConfiguration
    extends MarkupSourceViewerConfiguration
  {
    private final TaskRepository taskRepository;
    private final IAdaptable context;
    
    public TaskMarkupSourceViewerConfiguration(IPreferenceStore preferenceStore, TaskRepository taskRepository)
    {
      this(preferenceStore, taskRepository, null);
      setEnableHippieContentAssist(false);
    }
    
    public TaskMarkupSourceViewerConfiguration(IPreferenceStore preferenceStore, TaskRepository taskRepository, IAdaptable context)
    {
      super("org.eclipse.mylyn.tasks.ui.fonts.task.editor.comment", "org.eclipse.mylyn.wikitext.tasks.ui.monospaceFont");
      this.taskRepository = taskRepository;
      if (context == null) {
        this.context = MarkupTaskEditorExtension.createDefaultHyperlinkDetectorContext(taskRepository);
      } else {
        this.context = context;
      }
      addHyperlinkDetectorDescriptorFilter(new DefaultHyperlinkDetectorDescriptorFilter(
        "org.eclipse.ui.internal.editors.text.URLHyperlinkDetector"));
    }
    
    protected IContentAssistProcessor[] createContentAssistProcessors()
    {
      IContentAssistProcessor processor = TasksUi.getUiFactory().createTaskContentAssistProcessor(taskRepository);
      return new IContentAssistProcessor[] { processor == null ? null : processor };
    }
    
    public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer)
    {
      new DefaultAnnotationHover()
      {
        protected boolean isIncluded(Annotation annotation)
        {
          return (annotation.getType().startsWith("org.eclipse.wikitext")) || (super.isIncluded(annotation));
        }
      };
    }
    
    protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer)
    {
      Map hyperlinkDetectorTargets = super.getHyperlinkDetectorTargets(sourceViewer);
      MarkupTaskEditorExtension.addRepositoryHyperlinkDetectorTargets(context, hyperlinkDetectorTargets);
      return hyperlinkDetectorTargets;
    }
    
    public IReconciler getReconciler(ISourceViewer sourceViewer)
    {
      if (sourceViewer.isEditable()) {
        return super.getReconciler(sourceViewer);
      }
      return null;
    }
    
    public int getHyperlinkStateMask(ISourceViewer sourceViewer)
    {
      return 0;
    }
    
    public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer)
    {
      if (fPreferenceStore == null) {
        return new TaskHyperlinkPresenter(new RGB(0, 0, 255));
      }
      return new TaskHyperlinkPresenter(fPreferenceStore);
    }
  }
  
  protected static class TaskMarkupViewerConfiguration
    extends MarkupViewerConfiguration
  {
    private final IAdaptable context;
    
    public TaskMarkupViewerConfiguration(MarkupViewer viewer, TaskRepository taskRepository)
    {
      this(viewer, taskRepository, null);
    }
    
    public TaskMarkupViewerConfiguration(MarkupViewer viewer, TaskRepository taskRepository, IAdaptable context)
    {
      super();
      if (context == null) {
        this.context = MarkupTaskEditorExtension.createDefaultHyperlinkDetectorContext(taskRepository);
      } else {
        this.context = context;
      }
      markupHyperlinksFirst = false;
    }
    
    protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer)
    {
      Map hyperlinkDetectorTargets = super.getHyperlinkDetectorTargets(sourceViewer);
      MarkupTaskEditorExtension.addRepositoryHyperlinkDetectorTargets(context, hyperlinkDetectorTargets);
      return hyperlinkDetectorTargets;
    }
    
    protected AnnotationHyperlinkDetector createAnnotationHyperlinkDetector()
    {
      return new MarkupTaskEditorExtension.PlatformUrlAnnotationHyperlinkDetector(null);
    }
    
    public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer)
    {
      if (fPreferenceStore == null) {
        return new TaskHyperlinkPresenter(new RGB(0, 0, 255));
      }
      return new TaskHyperlinkPresenter(fPreferenceStore);
    }
  }
  
  private static class PlatformUrlAnnotationHyperlinkDetector
    extends AnnotationHyperlinkDetector
  {
    protected IHyperlink createUrlHyperlink(IRegion region, String href)
    {
      return new UrlHyperlink(region, href);
    }
  }
  
  private static IAdaptable createDefaultHyperlinkDetectorContext(TaskRepository repository)
  {
    new IAdaptable()
    {
      public Object getAdapter(Class adapter)
      {
        if (adapter == TaskRepository.class) {
          return MarkupTaskEditorExtension.this;
        }
        return null;
      }
    };
  }
  
  private static void addRepositoryHyperlinkDetectorTargets(IAdaptable context, Map hyperlinkDetectorTargets)
  {
    hyperlinkDetectorTargets.put("org.eclipse.ui.DefaultTextEditor", context);
    hyperlinkDetectorTargets.put("org.eclipse.mylyn.tasks.ui.TaskEditor", context);
  }
  
  private static class EditorExtensionPreferenceStore
    extends PreferenceStoreFacade
  {
    boolean controlFocused;
    
    public EditorExtensionPreferenceStore(IPreferenceStore preferenceStore, Control control)
    {
      super();
      controlFocused = control.isFocusControl();
      control.addFocusListener(new FocusListener()
      {
        public void focusGained(FocusEvent e)
        {
          controlFocused = true;
          focusChanged();
        }
        
        public void focusLost(FocusEvent e)
        {
          controlFocused = false;
          focusChanged();
        }
      });
    }
    
    protected void focusChanged()
    {
      if (!getCurrentLineHighlightPreference()) {
        return;
      }
      boolean newValue = getBoolean("currentLine");
      firePropertyChangeEvent("currentLine", Boolean.valueOf(!newValue), 
        Boolean.valueOf(newValue));
    }
    
    private boolean getCurrentLineHighlightPreference()
    {
      return TasksUiUtil.getHighlightCurrentLine();
    }
    
    public boolean getBoolean(String name)
    {
      if ("currentLine".equals(name))
      {
        if (!controlFocused) {
          return false;
        }
        return getCurrentLineHighlightPreference();
      }
      if ("printMargin".equals(name)) {
        return false;
      }
      return super.getBoolean(name);
    }
  }
  
  public Object getAdapter(Class adapter)
  {
    if (MarkupLanguage.class == adapter) {
      return getMarkupLanguage();
    }
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

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

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;

class MarkupTaskEditorExtension$1
  implements DisposeListener
{
  MarkupTaskEditorExtension$1(MarkupTaskEditorExtension paramMarkupTaskEditorExtension, SourceViewerDecorationSupport paramSourceViewerDecorationSupport) {}
  
  public void widgetDisposed(DisposeEvent e)
  {
    val$support.dispose();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.tasks.ui.editor.MarkupTaskEditorExtension.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.tasks.ui.editor;

abstract interface package-info {}

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

import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.mylyn.commons.workbench.browser.UrlHyperlink;
import org.eclipse.mylyn.internal.wikitext.ui.viewer.AnnotationHyperlinkDetector;

class MarkupTaskEditorExtension$PlatformUrlAnnotationHyperlinkDetector
  extends AnnotationHyperlinkDetector
{
  protected IHyperlink createUrlHyperlink(IRegion region, String href)
  {
    return new UrlHyperlink(region, href);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.tasks.ui.editor.MarkupTaskEditorExtension.PlatformUrlAnnotationHyperlinkDetector
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.tasks.ui.editor;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylyn.tasks.core.TaskRepository;

class MarkupTaskEditorExtension$2
  implements IAdaptable
{
  MarkupTaskEditorExtension$2(TaskRepository paramTaskRepository) {}
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == TaskRepository.class) {
      return val$repository;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.tasks.ui.editor.MarkupTaskEditorExtension.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.tasks.ui.editor;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.mylyn.internal.wikitext.ui.util.PreferenceStoreFacade;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.widgets.Control;

class MarkupTaskEditorExtension$EditorExtensionPreferenceStore
  extends PreferenceStoreFacade
{
  boolean controlFocused;
  
  public MarkupTaskEditorExtension$EditorExtensionPreferenceStore(IPreferenceStore preferenceStore, Control control)
  {
    super(preferenceStore);
    controlFocused = control.isFocusControl();
    control.addFocusListener(new FocusListener()
    {
      public void focusGained(FocusEvent e)
      {
        controlFocused = true;
        focusChanged();
      }
      
      public void focusLost(FocusEvent e)
      {
        controlFocused = false;
        focusChanged();
      }
    });
  }
  
  protected void focusChanged()
  {
    if (!getCurrentLineHighlightPreference()) {
      return;
    }
    boolean newValue = getBoolean("currentLine");
    firePropertyChangeEvent("currentLine", Boolean.valueOf(!newValue), 
      Boolean.valueOf(newValue));
  }
  
  private boolean getCurrentLineHighlightPreference()
  {
    return TasksUiUtil.getHighlightCurrentLine();
  }
  
  public boolean getBoolean(String name)
  {
    if ("currentLine".equals(name))
    {
      if (!controlFocused) {
        return false;
      }
      return getCurrentLineHighlightPreference();
    }
    if ("printMargin".equals(name)) {
      return false;
    }
    return super.getBoolean(name);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.tasks.ui.editor.MarkupTaskEditorExtension.EditorExtensionPreferenceStore
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.tasks.ui.editor;

import java.util.Map;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter;
import org.eclipse.jface.text.reconciler.IReconciler;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.DefaultAnnotationHover;
import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.ITasksUiFactory;
import org.eclipse.mylyn.tasks.ui.TaskHyperlinkPresenter;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.wikitext.ui.editor.MarkupSourceViewerConfiguration;
import org.eclipse.mylyn.wikitext.ui.viewer.DefaultHyperlinkDetectorDescriptorFilter;
import org.eclipse.swt.graphics.RGB;

public class MarkupTaskEditorExtension$TaskMarkupSourceViewerConfiguration
  extends MarkupSourceViewerConfiguration
{
  private final TaskRepository taskRepository;
  private final IAdaptable context;
  
  public MarkupTaskEditorExtension$TaskMarkupSourceViewerConfiguration(IPreferenceStore preferenceStore, TaskRepository taskRepository)
  {
    this(preferenceStore, taskRepository, null);
    setEnableHippieContentAssist(false);
  }
  
  public MarkupTaskEditorExtension$TaskMarkupSourceViewerConfiguration(IPreferenceStore preferenceStore, TaskRepository taskRepository, IAdaptable context)
  {
    super(preferenceStore, "org.eclipse.mylyn.tasks.ui.fonts.task.editor.comment", "org.eclipse.mylyn.wikitext.tasks.ui.monospaceFont");
    this.taskRepository = taskRepository;
    if (context == null) {
      this.context = MarkupTaskEditorExtension.access$0(taskRepository);
    } else {
      this.context = context;
    }
    addHyperlinkDetectorDescriptorFilter(new DefaultHyperlinkDetectorDescriptorFilter(
      "org.eclipse.ui.internal.editors.text.URLHyperlinkDetector"));
  }
  
  protected IContentAssistProcessor[] createContentAssistProcessors()
  {
    IContentAssistProcessor processor = TasksUi.getUiFactory().createTaskContentAssistProcessor(taskRepository);
    return new IContentAssistProcessor[] { processor == null ? null : processor };
  }
  
  public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer)
  {
    new DefaultAnnotationHover()
    {
      protected boolean isIncluded(Annotation annotation)
      {
        return (annotation.getType().startsWith("org.eclipse.wikitext")) || (super.isIncluded(annotation));
      }
    };
  }
  
  protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer)
  {
    Map hyperlinkDetectorTargets = super.getHyperlinkDetectorTargets(sourceViewer);
    MarkupTaskEditorExtension.access$1(context, hyperlinkDetectorTargets);
    return hyperlinkDetectorTargets;
  }
  
  public IReconciler getReconciler(ISourceViewer sourceViewer)
  {
    if (sourceViewer.isEditable()) {
      return super.getReconciler(sourceViewer);
    }
    return null;
  }
  
  public int getHyperlinkStateMask(ISourceViewer sourceViewer)
  {
    return 0;
  }
  
  public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer)
  {
    if (fPreferenceStore == null) {
      return new TaskHyperlinkPresenter(new RGB(0, 0, 255));
    }
    return new TaskHyperlinkPresenter(fPreferenceStore);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.tasks.ui.editor.MarkupTaskEditorExtension.TaskMarkupSourceViewerConfiguration
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.wikitext.tasks.ui.editor;

import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;

class MarkupTaskEditorExtension$EditorExtensionPreferenceStore$1
  implements FocusListener
{
  MarkupTaskEditorExtension$EditorExtensionPreferenceStore$1(MarkupTaskEditorExtension.EditorExtensionPreferenceStore paramEditorExtensionPreferenceStore) {}
  
  public void focusGained(FocusEvent e)
  {
    this$1.controlFocused = true;
    this$1.focusChanged();
  }
  
  public void focusLost(FocusEvent e)
  {
    this$1.controlFocused = false;
    this$1.focusChanged();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.wikitext.tasks.ui.editor.MarkupTaskEditorExtension.EditorExtensionPreferenceStore.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.wikitext.tasks.ui.util.bugzilla;

@Deprecated
public class BugzillaGeneratedCommentBlock
  extends org.eclipse.mylyn.wikitext.core.parser.markup.block.BugzillaGeneratedCommentBlock
{}

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

@Deprecated
public class BugzillaQuoteBlock
  extends org.eclipse.mylyn.wikitext.core.parser.markup.block.BugzillaQuoteBlock
{}

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

import org.eclipse.mylyn.wikitext.core.parser.markup.ConfigurationBuilder;
import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguageConfiguration;
import org.eclipse.mylyn.wikitext.core.parser.markup.block.BugzillaGeneratedCommentBlock;
import org.eclipse.mylyn.wikitext.core.parser.markup.block.BugzillaQuoteBlock;

public class Util
{
  private static final String TASKTOP_TASKZILLA = "taskzilla";
  private static final String TASKTOP_ALM = "com.tasktop.alm.tasks";
  private static final String BUGZILLA = "bugzilla";
  
  public static MarkupLanguageConfiguration create(String repositoryKind)
  {
    ConfigurationBuilder builder = ConfigurationBuilder.create().repositorySettings();
    if (isBugzillaOrDerivative(repositoryKind)) {
      builder.block(new BugzillaQuoteBlock()).block(new BugzillaGeneratedCommentBlock());
    }
    return builder.configuration();
  }
  
  private static boolean isBugzillaOrDerivative(String repositoryKind)
  {
    return ("bugzilla".equals(repositoryKind)) || ("com.tasktop.alm.tasks".equals(repositoryKind)) || ("taskzilla".equals(repositoryKind));
  }
}

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

import java.io.BufferedInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.mylyn.context.core.AbstractContextStructureBridge;
import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.wikitext.core.WikiText;
import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
import org.eclipse.mylyn.wikitext.core.parser.outline.OutlineItem;
import org.eclipse.mylyn.wikitext.core.parser.outline.OutlineParser;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

public class WikiTextContextStructureBridge
  extends AbstractContextStructureBridge
{
  private static final char HANDLE_FILE_SEPARATOR = ';';
  public static final String CONTENT_TYPE = "org.eclipse.mylyn.wikitext";
  
  public boolean acceptsObject(Object object)
  {
    if ((object instanceof OutlineItem)) {
      return true;
    }
    if ((object instanceof IFile))
    {
      IFile file = (IFile)object;
      try
      {
        IContentDescription description = file.getContentDescription();
        if (description != null)
        {
          IContentType contentType = description.getContentType();
          if ((contentType != null) && 
            (isWikiText(contentType))) {
            return true;
          }
        }
      }
      catch (CoreException localCoreException)
      {
        String languageName = WikiText.getMarkupLanguageNameForFilename(file.getName());
        return languageName != null;
      }
    }
    return false;
  }
  
  private boolean isWikiText(IContentType contentType)
  {
    if ("org.eclipse.mylyn.wikitext".equals(contentType.getId())) {
      return true;
    }
    IContentType baseType = contentType.getBaseType();
    if (baseType != null) {
      return isWikiText(baseType);
    }
    return false;
  }
  
  public boolean canBeLandmark(String handle)
  {
    return handle != null;
  }
  
  public boolean canFilter(Object element)
  {
    return true;
  }
  
  public List<String> getChildHandles(String handle)
  {
    Object object = getObjectForHandle(handle);
    if ((object instanceof OutlineItem))
    {
      OutlineItem item = (OutlineItem)object;
      if (!item.getChildren().isEmpty())
      {
        List<String> handles = new ArrayList(item.getChildren().size());
        for (OutlineItem child : item.getChildren()) {
          handles.add(getHandleIdentifier(child));
        }
        return handles;
      }
    }
    return Collections.emptyList();
  }
  
  public String getContentType()
  {
    return "org.eclipse.mylyn.wikitext";
  }
  
  public String getContentType(String elementHandle)
  {
    if (elementHandle.indexOf(';') == -1) {
      return parentContentType;
    }
    return "org.eclipse.mylyn.wikitext";
  }
  
  public String getHandleForOffsetInObject(Object object, int offset)
  {
    IResource resource = null;
    try
    {
      if ((object instanceof IResource)) {
        resource = (IResource)object;
      } else if ((object instanceof IMarker)) {
        resource = ((IMarker)object).getResource();
      } else {
        try
        {
          IMarker marker = (IMarker)object.getClass().getMethod("getMarker", new Class[0]).invoke(object, new Object[0]);
          resource = marker.getResource();
        }
        catch (Exception localException1) {}
      }
      if (!(resource instanceof IFile)) {
        break label136;
      }
    }
    catch (Exception localException2)
    {
      return null;
    }
    IFile file = (IFile)resource;
    if (acceptsObject(file))
    {
      OutlineItem outline = getOutline(file);
      if (outline != null)
      {
        OutlineItem item = outline.findNearestMatchingOffset(offset);
        if (item != null) {
          return getHandleIdentifier(item);
        }
      }
    }
    label136:
    return null;
  }
  
  public String getLabel(Object object)
  {
    if ((object instanceof OutlineItem))
    {
      OutlineItem item = (OutlineItem)object;
      if (item.getParent() == null) {
        return getFile(item).getName();
      }
      return item.getLabel();
    }
    return "";
  }
  
  public Object getObjectForHandle(String handle)
  {
    if (handle == null) {
      return null;
    }
    int idxOfSeparator = handle.indexOf(';');
    String filename = handle;
    if (idxOfSeparator != -1) {
      filename = handle.substring(0, idxOfSeparator);
    }
    try
    {
      file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filename));
    }
    catch (Exception localException)
    {
      IFile file;
      return null;
    }
    IFile file;
    if (file != null) {
      if (idxOfSeparator != -1)
      {
        String headingId = handle.substring(idxOfSeparator + 1);
        OutlineItem outline = getOutline(file);
        if (outline != null)
        {
          OutlineItem item = outline.findItemById(headingId);
          return item;
        }
      }
      else
      {
        return file;
      }
    }
    return null;
  }
  
  public String getParentHandle(String handle)
  {
    Object object = getObjectForHandle(handle);
    if ((object instanceof OutlineItem))
    {
      OutlineItem item = (OutlineItem)object;
      if (item.getParent() != null) {
        return getHandleIdentifier(item.getParent());
      }
      return getHandleIdentifier(getFile(item));
    }
    if ((object instanceof IFile))
    {
      AbstractContextStructureBridge parentBridge = ContextCore.getStructureBridge(parentContentType);
      return parentBridge.getParentHandle(handle);
    }
    return null;
  }
  
  public boolean isDocument(String handle)
  {
    Object object = getObjectForHandle(handle);
    if ((object instanceof OutlineItem))
    {
      OutlineItem item = (OutlineItem)object;
      return item.getParent() == null;
    }
    return false;
  }
  
  public String getHandleIdentifier(Object object)
  {
    if ((object instanceof OutlineItem))
    {
      OutlineItem item = (OutlineItem)object;
      return item.getResourcePath() + ';' + item.getId();
    }
    if (((object instanceof IFile)) && (acceptsObject(object))) {
      return ((IFile)object).getFullPath().toString();
    }
    return null;
  }
  
  private IPath getFullPath(OutlineItem item)
  {
    String resourcePath = item.getResourcePath();
    return resourcePath == null ? null : new Path(resourcePath);
  }
  
  private OutlineItem getOutline(IFile file)
  {
    IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if (editorPart != null)
    {
      OutlineItem outline = (OutlineItem)editorPart.getAdapter(OutlineItem.class);
      if (outline != null) {
        return outline;
      }
    }
    MarkupLanguage markupLanguage = WikiText.getMarkupLanguageForFilename(file.getName());
    if (markupLanguage != null)
    {
      OutlineParser parser = new OutlineParser(markupLanguage);
      try
      {
        String contents = getContents(file);
        OutlineItem outline = parser.parse(contents);
        outline.setResourcePath(file.getFullPath().toString());
        return outline;
      }
      catch (Exception localException)
      {
        return null;
      }
    }
    return null;
  }
  
  private String getContents(IFile file)
    throws Exception
  {
    String charset = file.getCharset();
    StringWriter writer = new StringWriter();
    Reader reader = new InputStreamReader(new BufferedInputStream(file.getContents()), charset);
    int i;
    while ((i = reader.read()) != -1)
    {
      int i;
      writer.write(i);
    }
    return writer.toString();
  
1 2 3

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