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

;
  }
}

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

import java.lang.reflect.Constructor;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.text.AbstractInformationControlManager;
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.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.information.IInformationProvider;
import org.eclipse.jface.text.information.IInformationProviderExtension;
import org.eclipse.jface.text.information.IInformationProviderExtension2;
import org.eclipse.jface.text.information.InformationPresenter;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.mylyn.internal.wikitext.ui.editor.syntax.FastMarkupPartitioner;
import org.eclipse.mylyn.wikitext.ui.viewer.HtmlTextPresenter;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public class InformationPresenterUtil
{
  public static class SizeConstraint
  {
    int horizontalWidthInChars;
    int verticalWidthInChars;
    boolean enforceAsMinimumSize;
    boolean enforceAsMaximumSize;
    
    public SizeConstraint(int horizontalWidthInChars, int verticalWidthInChars, boolean enforceAsMinimumSize, boolean enforceAsMaximumSize)
    {
      this.horizontalWidthInChars = horizontalWidthInChars;
      this.verticalWidthInChars = verticalWidthInChars;
      this.enforceAsMinimumSize = enforceAsMinimumSize;
      this.enforceAsMaximumSize = enforceAsMaximumSize;
    }
  }
  
  private static final class InformationProvider
    implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2
  {
    private final IRegion hoverRegion;
    private final Object hoverInfo;
    private final IInformationControlCreator controlCreator;
    
    InformationProvider(IRegion hoverRegion, Object info, IInformationControlCreator controlCreator)
    {
      this.hoverRegion = hoverRegion;
      hoverInfo = info;
      this.controlCreator = controlCreator;
    }
    
    public IRegion getSubject(ITextViewer textViewer, int invocationOffset)
    {
      return hoverRegion;
    }
    
    public String getInformation(ITextViewer textViewer, IRegion subject)
    {
      return hoverInfo.toString();
    }
    
    public Object getInformation2(ITextViewer textViewer, IRegion subject)
    {
      return hoverInfo;
    }
    
    public IInformationControlCreator getInformationPresenterControlCreator()
    {
      return controlCreator;
    }
  }
  
  private static final String DATA_INFORMATION_PRESENTER = InformationPresenterUtil.class.getName() + 
    "#informationPresenter";
  private static final String DATA_INFORMATION_CONTROL_CREATOR = InformationPresenterUtil.class.getName() + 
    "#informationControlCreator";
  
  public static InformationPresenter getHtmlInformationPresenter(ISourceViewer viewer, SizeConstraint constraint, ToolBarManager toolBarManager, String htmlContent)
  {
    Control control = viewer.getTextWidget();
    InformationPresenter presenter = (InformationPresenter)control.getData(DATA_INFORMATION_PRESENTER);
    
    int offset = getSelectedRangex;
    IInformationControlCreator informationControlCreator;
    if (presenter == null)
    {
      IInformationControlCreator informationControlCreator = new IInformationControlCreator()
      {
        public IInformationControl createInformationControl(Shell shell)
        {
          try
          {
            return 
            
              (IInformationControl)DefaultInformationControl.class.getConstructor(new Class[] { Shell.class, ToolBarManager.class, DefaultInformationControl.IInformationPresenter.class }).newInstance(new Object[] { shell, InformationPresenterUtil.this, new HtmlTextPresenter() });
          }
          catch (NoSuchMethodException localNoSuchMethodException)
          {
            return new DefaultInformationControl(shell, 16, 768, 
              new HtmlTextPresenter());
          }
          catch (Exception e)
          {
            throw new IllegalStateException(e);
          }
        }
      };
      presenter = new InformationPresenter(informationControlCreator)
      {
        public IInformationProvider getInformationProvider(String contentType)
        {
          IInformationProvider informationProvider = super.getInformationProvider(contentType);
          if (informationProvider == null) {
            informationProvider = super.getInformationProvider("__dftl_partition_content_type");
          }
          return informationProvider;
        }
      };
      presenter.install(viewer);
      presenter.setAnchor(AbstractInformationControlManager.ANCHOR_BOTTOM);
      presenter.setMargins(6, 6);
      
      presenter.setOffset(offset);
      
      presenter.install(viewer);
      InformationPresenter informationPresenter = presenter;
      viewer.getTextWidget().addDisposeListener(new DisposeListener()
      {
        public void widgetDisposed(DisposeEvent e)
        {
          try
          {
            uninstall();
          }
          catch (Exception localException) {}
          dispose();
        }
      });
      control.setData(DATA_INFORMATION_PRESENTER, presenter);
      control.setData(DATA_INFORMATION_CONTROL_CREATOR, informationControlCreator);
    }
    else
    {
      informationControlCreator = (IInformationControlCreator)control.getData(DATA_INFORMATION_CONTROL_CREATOR);
      presenter.disposeInformationControl();
    }
    presenter.setSizeConstraints(horizontalWidthInChars, verticalWidthInChars, 
      enforceAsMinimumSize, enforceAsMaximumSize);
    
    InformationProvider informationProvider = new InformationProvider(new Region(offset, 0), 
      htmlContent, informationControlCreator);
    String[] arrayOfString;
    int j = (arrayOfString = FastMarkupPartitioner.ALL_CONTENT_TYPES).length;
    for (int i = 0; i < j; i++)
    {
      String contentType = arrayOfString[i];
      presenter.setInformationProvider(informationProvider, contentType);
    }
    presenter.setInformationProvider(informationProvider, "__dftl_partition_content_type");
    
    return presenter;
  }
}

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

import org.eclipse.jface.text.information.InformationPresenter;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;

class InformationPresenterUtil$3
  implements DisposeListener
{
  InformationPresenterUtil$3(InformationPresenter paramInformationPresenter) {}
  
  public void widgetDisposed(DisposeEvent e)
  {
    try
    {
      val$informationPresenter.uninstall();
    }
    catch (Exception localException) {}
    val$informationPresenter.dispose();
  }
}

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

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.ResourceBundle;
import java.util.Set;
import org.eclipse.osgi.util.NLS;

public class NlsResourceBundle
  extends ResourceBundle
{
  private final Class<? extends NLS> nlsClass;
  
  public NlsResourceBundle(Class<? extends NLS> nlsClass)
  {
    this.nlsClass = nlsClass;
  }
  
  public Enumeration<String> getKeys()
  {
    Set<String> keys = new HashSet();
    Field[] arrayOfField;
    int j = (arrayOfField = nlsClass.getFields()).length;
    for (int i = 0; i < j; i++)
    {
      Field field = arrayOfField[i];
      if ((field.getType() == String.class) && 
        (Modifier.isStatic(field.getModifiers()))) {
        keys.add(field.getName());
      }
    }
    return Collections.enumeration(keys);
  }
  
  protected Object handleGetObject(String key)
  {
    try
    {
      Field field = nlsClass.getField(key);
      field.setAccessible(true);
      return field.get(null);
    }
    catch (Exception localException) {}
    return null;
  }
}

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

import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;

class PreferenceStoreFacade$1
  implements IPropertyChangeListener
{
  PreferenceStoreFacade$1(PreferenceStoreFacade paramPreferenceStoreFacade) {}
  
  public void propertyChange(PropertyChangeEvent event)
  {
    this$0.firePropertyChangeEvent(event.getProperty(), event.getOldValue(), event.getNewValue());
  }
}

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

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;

public class ImageCache
{
  private final Map<String, Image> imageByUrl = new HashMap();
  private URL base;
  private Image missingImage;
  private boolean disposed = false;
  
  public Image getImage(String url)
  {
    if (disposed) {
      throw new IllegalStateException();
    }
    Image image = (Image)imageByUrl.get(url);
    if (image == null) {
      try
      {
        URL location = base == null ? new URL(url) : new URL(base, url);
        ImageDescriptor descriptor = ImageDescriptor.createFromURL(location);
        image = descriptor.createImage(false);
        if (image == null) {
          image = getMissingImage();
        }
        imageByUrl.put(url, image);
      }
      catch (MalformedURLException localMalformedURLException)
      {
        image = getMissingImage();
        imageByUrl.put(url, image);
      }
    }
    return image;
  }
  
  public void putImage(String url, Image image)
  {
    if (disposed) {
      throw new IllegalStateException();
    }
    Image previous = (Image)imageByUrl.put(url, image);
    if ((previous != null) && (previous != missingImage)) {
      previous.dispose();
    }
  }
  
  public Image getMissingImage()
  {
    if (missingImage == null) {
      missingImage = ImageDescriptor.createFromURL(ImageCache.class.getResource("resources/missing-image.png"))
        .createImage();
    }
    return missingImage;
  }
  
  public void dispose()
  {
    disposed = true;
    for (Image image : imageByUrl.values()) {
      if (image != missingImage) {
        image.dispose();
      }
    }
    imageByUrl.clear();
    if (missingImage != null)
    {
      missingImage.dispose();
      missingImage = null;
    }
  }
  
  public URL getBase()
  {
    return base;
  }
  
  public void setBase(URL base)
  {
    this.base = base;
  }
}

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

public class InformationPresenterUtil$SizeConstraint
{
  int horizontalWidthInChars;
  int verticalWidthInChars;
  boolean enforceAsMinimumSize;
  boolean enforceAsMaximumSize;
  
  public InformationPresenterUtil$SizeConstraint(int horizontalWidthInChars, int verticalWidthInChars, boolean enforceAsMinimumSize, boolean enforceAsMaximumSize)
  {
    this.horizontalWidthInChars = horizontalWidthInChars;
    this.verticalWidthInChars = verticalWidthInChars;
    this.enforceAsMinimumSize = enforceAsMinimumSize;
    this.enforceAsMaximumSize = enforceAsMaximumSize;
  }
}

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

import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;

class WikiTextUiPlugin$1
  implements IPropertyChangeListener
{
  WikiTextUiPlugin$1(WikiTextUiPlugin paramWikiTextUiPlugin) {}
  
  public void propertyChange(PropertyChangeEvent event)
  {
    WikiTextUiPlugin.access$0(this$0, null);
  }
}

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

import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;

class ValidationProjectBuilder$1
  implements IResourceDeltaVisitor
{
  ValidationProjectBuilder$1(ValidationProjectBuilder paramValidationProjectBuilder, IProgressMonitor paramIProgressMonitor, List paramList) {}
  
  public boolean visit(IResourceDelta delta)
    throws CoreException
  {
    if (val$monitor.isCanceled()) {
      throw new OperationCanceledException();
    }
    if (this$0.isInterrupted()) {
      return false;
    }
    IResource resource = delta.getResource();
    if ((resource instanceof IFile))
    {
      if ((delta.getKind() & 0x5) != 0)
      {
        IFile file = (IFile)resource;
        ValidationProjectBuilder.access$0(this$0, val$files, file);
      }
    }
    else if (((resource instanceof IContainer)) && 
      (ValidationProjectBuilder.access$1(this$0, (IContainer)resource))) {
      return false;
    }
    return true;
  }
}

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

import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;

class ValidationProjectBuilder$2
  implements IResourceVisitor
{
  ValidationProjectBuilder$2(ValidationProjectBuilder paramValidationProjectBuilder, IProgressMonitor paramIProgressMonitor, List paramList) {}
  
  public boolean visit(IResource resource)
    throws CoreException
  {
    if (val$monitor.isCanceled()) {
      throw new OperationCanceledException();
    }
    if (this$0.isInterrupted()) {
      return false;
    }
    if ((resource instanceof IFile))
    {
      IFile file = (IFile)resource;
      ValidationProjectBuilder.access$0(this$0, val$files, file);
    }
    else if (((resource instanceof IContainer)) && 
      (ValidationProjectBuilder.access$1(this$0, (IContainer)resource)))
    {
      return false;
    }
    return true;
  }
}

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

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.mylyn.internal.wikitext.ui.editor.MarkupEditor;
import org.eclipse.mylyn.wikitext.core.WikiText;

public class ValidationProjectBuilder
  extends IncrementalProjectBuilder
{
  public static final String ID = "org.eclipse.mylyn.wikitext.ui.wikiTextValidationBuilder";
  private static final IProject[] NO_PROJECTS = new IProject[0];
  private static int CHECK_ANCESTORS;
  private static Method RESOURCE_DERIVED_WITH_FLAGS_METHOD;
  
  static
  {
    try
    {
      CHECK_ANCESTORS = ((Integer)IResource.class.getDeclaredField("CHECK_ANCESTORS").get(null)).intValue();
    }
    catch (Exception localException1)
    {
      CHECK_ANCESTORS = 0;
    }
    try
    {
      RESOURCE_DERIVED_WITH_FLAGS_METHOD = IResource.class.getDeclaredMethod("isDerived", 
        new Class[] { Integer.TYPE });
    }
    catch (Exception localException2)
    {
      RESOURCE_DERIVED_WITH_FLAGS_METHOD = null;
    }
  }
  
  protected void clean(IProgressMonitor monitor)
    throws CoreException
  {
    getProject().deleteMarkers("org.eclipse.mylyn.wikitext.core.validation.problem", true, 2);
  }
  
  protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
    throws CoreException
  {
    IProject project = getProject();
    IResourceDelta resourceDelta = getDelta(project);
    
    List<ValidationInfo> files = null;
    if (((kind != 10) && (kind != 9)) || 
      (resourceDelta == null)) {
      files = collect(project, monitor);
    } else {
      files = collect(resourceDelta, monitor);
    }
    if ((files != null) && (!files.isEmpty()) && (!isInterrupted()) && (!monitor.isCanceled())) {
      validate(files, monitor);
    }
    if (monitor.isCanceled()) {
      throw new OperationCanceledException();
    }
    return NO_PROJECTS;
  }
  
  private static class ValidationInfo
  {
    private final IFile file;
    private final String languageName;
    
    public ValidationInfo(IFile file, String languageName)
    {
      this.file = file;
      this.languageName = languageName;
    }
  }
  
  private List<ValidationInfo> collect(IResourceDelta resourceDelta, final IProgressMonitor monitor)
    throws CoreException
  {
    final List<ValidationInfo> files = new ArrayList();
    
    resourceDelta.accept(new IResourceDeltaVisitor()
    {
      public boolean visit(IResourceDelta delta)
        throws CoreException
      {
        if (monitor.isCanceled()) {
          throw new OperationCanceledException();
        }
        if (isInterrupted()) {
          return false;
        }
        IResource resource = delta.getResource();
        if ((resource instanceof IFile))
        {
          if ((delta.getKind() & 0x5) != 0)
          {
            IFile file = (IFile)resource;
            ValidationProjectBuilder.this.visit(files, file);
          }
        }
        else if (((resource instanceof IContainer)) && 
          (ValidationProjectBuilder.this.filtered((IContainer)resource))) {
          return false;
        }
        return true;
      }
    });
    return files;
  }
  
  private List<ValidationInfo> collect(IProject project, final IProgressMonitor monitor)
    throws CoreException
  {
    final List<ValidationInfo> files = new ArrayList();
    project.accept(new IResourceVisitor()
    {
      public boolean visit(IResource resource)
        throws CoreException
      {
        if (monitor.isCanceled()) {
          throw new OperationCanceledException();
        }
        if (isInterrupted()) {
          return false;
        }
        if ((resource instanceof IFile))
        {
          IFile file = (IFile)resource;
          ValidationProjectBuilder.this.visit(files, file);
        }
        else if (((resource instanceof IContainer)) && 
          (ValidationProjectBuilder.this.filtered((IContainer)resource)))
        {
          return false;
        }
        return true;
      }
    });
    return files;
  }
  
  private boolean filtered(IContainer container)
  {
    return false;
  }
  
  private void visit(List<ValidationInfo> files, IFile file)
  {
    boolean derived = false;
    if (RESOURCE_DERIVED_WITH_FLAGS_METHOD != null) {
      try
      {
        derived = ((Boolean)RESOURCE_DERIVED_WITH_FLAGS_METHOD.invoke(file, new Object[] { Integer.valueOf(CHECK_ANCESTORS) })).booleanValue();
      }
      catch (Exception localException)
      {
        derived = file.isDerived();
      }
    } else {
      derived = file.isDerived();
    }
    if (derived) {
      return;
    }
    String language = getMarkupLanguageForFile(file);
    if (language != null) {
      files.add(new ValidationInfo(file, language));
    }
  }
  
  private void validate(List<ValidationInfo> files, IProgressMonitor monitor)
    throws CoreException
  {
    if (files.isEmpty()) {
      return;
    }
    monitor.beginTask(Messages.ValidationProjectBuilder_validationTask, files.size() * 1000);
    for (ValidationInfo file : files)
    {
      if (monitor.isCanceled()) {
        throw new OperationCanceledException();
      }
      if (isInterrupted()) {
        break;
      }
      validate(file, new SubProgressMonitor(monitor, 1000));
    }
    monitor.done();
  }
  
  /* Error */
  private void validate(ValidationInfo file, IProgressMonitor monitor)
    throws CoreException
  {
    // Byte code:
    //   0: sipush 1000
    //   3: istore_3
    //   4: aload_2
    //   5: getstatic 300	org/eclipse/mylyn/internal/wikitext/ui/validation/Messages:ValidationProjectBuilder_validatingFileTask	Ljava/lang/String;
    //   8: iconst_1
    //   9: anewarray 137	java/lang/Object
    //   12: dup
    //   13: iconst_0
    //   14: aload_1
    //   15: invokestatic 349	org/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo:access$0	(Lorg/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo;)Lorg/eclipse/core/resources/IFile;
    //   18: invokeinterface 362 1 0
    //   23: aastore
    //   24: invokestatic 352	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    //   27: iload_3
    //   28: invokeinterface 369 3 0
    //   33: new 156	org/eclipse/mylyn/internal/wikitext/ui/editor/validation/ResourceMarkerMarkupValidator
    //   36: dup
    //   37: invokespecial 330	org/eclipse/mylyn/internal/wikitext/ui/editor/validation/ResourceMarkerMarkupValidator:<init>	()V
    //   40: astore 4
    //   42: aload 4
    //   44: aload_1
    //   45: invokestatic 348	org/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo:access$1	(Lorg/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo;)Ljava/lang/String;
    //   48: invokestatic 351	org/eclipse/mylyn/wikitext/core/WikiText:getMarkupLanguage	(Ljava/lang/String;)Lorg/eclipse/mylyn/wikitext/core/parser/markup/MarkupLanguage;
    //   51: invokevirtual 333	org/eclipse/mylyn/internal/wikitext/ui/editor/validation/ResourceMarkerMarkupValidator:setMarkupLanguage	(Lorg/eclipse/mylyn/wikitext/core/parser/markup/MarkupLanguage;)V
    //   54: aload 4
    //   56: aload_1
    //   57: invokestatic 349	org/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo:access$0	(Lorg/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo;)Lorg/eclipse/core/resources/IFile;
    //   60: invokevirtual 331	org/eclipse/mylyn/internal/wikitext/ui/editor/validation/ResourceMarkerMarkupValidator:setResource	(Lorg/eclipse/core/resources/IResource;)V
    //   63: aload 4
    //   65: invokevirtual 332	org/eclipse/mylyn/internal/wikitext/ui/editor/validation/ResourceMarkerMarkupValidator:getMarkupLanguage	()Lorg/eclipse/mylyn/wikitext/core/parser/markup/MarkupLanguage;
    //   68: ifnull +201 -> 269
    //   71: new 132	java/io/StringWriter
    //   74: dup
    //   75: invokespecial 310	java/io/StringWriter:<init>	()V
    //   78: astore 5
    //   80: aload_1
    //   81: invokestatic 349	org/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo:access$0	(Lorg/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo;)Lorg/eclipse/core/resources/IFile;
    //   84: invokeinterface 361 1 0
    //   89: astore 6
    //   91: aload 6
    //   93: ifnonnull +29 -> 122
    //   96: new 130	java/io/InputStreamReader
    //   99: dup
    //   100: new 128	java/io/BufferedInputStream
    //   103: dup
    //   104: aload_1
    //   105: invokestatic 349	org/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo:access$0	(Lorg/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo;)Lorg/eclipse/core/resources/IFile;
    //   108: invokeinterface 360 1 0
    //   113: invokespecial 305	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   116: invokespecial 306	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;)V
    //   119: goto +28 -> 147
    //   122: new 130	java/io/InputStreamReader
    //   125: dup
    //   126: new 128	java/io/BufferedInputStream
    //   129: dup
    //   130: aload_1
    //   131: invokestatic 349	org/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo:access$0	(Lorg/eclipse/mylyn/internal/wikitext/ui/validation/ValidationProjectBuilder$ValidationInfo;)Lorg/eclipse/core/resources/IFile;
    //   134: invokeinterface 360 1 0
    //   139: invokespecial 305	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   142: aload 6
    //   144: invokespecial 307	java/io/InputStreamReader:<init>	(Ljava/io/InputStream;Ljava/lang/String;)V
    //   147: astore 7
    //   149: goto +12 -> 161
    //   152: aload 5
    //   154: iload 8
    //   156: i2c
    //   157: invokevirtual 311	java/io/StringWriter:append	(C)Ljava/io/StringWriter;
    //   160: pop
    //   161: aload 7
    //   163: invokevirtual 308	java/io/Reader:read	()I
    //   166: dup
    //   167: istore 8
    //   169: iconst_m1
    //   170: if_icmpne -18 -> 152
    //   173: goto +13 -> 186
    //   176: astore 9
    //   178: aload 7
    //   180: invokevirtual 309	java/io/Reader:close	()V
    //   183: aload 9
    //   185: athrow
    //   186: aload 7
    //   188: invokevirtual 309	java/io/Reader:close	()V
    //   191: goto +22 -> 213
    //   194: astore 7
    //   196: new 147	org/eclipse/core/runtime/CoreException
    //   199: dup
    //   200: invokestatic 327	org/eclipse/mylyn/internal/wikitext/ui/WikiTextUiPlugin:getDefault	()Lorg/eclipse/mylyn/internal/wikitext/ui/WikiTextUiPlugin;
    //   203: iconst_4
    //   204: aload 7
    //   206: invokevirtual 328	org/eclipse/mylyn/internal/wikitext/ui/WikiTextUiPlugin:createStatus	(ILjava/lang/Throwable;)Lorg/eclipse/core/runtime/IStatus;
    //   209: invokespecial 322	org/eclipse/core/runtime/CoreException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   212: athrow
    //   213: aload_2
    //   214: iload_3
    //   215: iconst_2
    //   216: idiv
    //   217: invokeinterface 368 2 0
    //   222: new 151	org/eclipse/jface/text/Document
    //   225: dup
    //   226: aload 5
    //   228: invokevirtual 312	java/io/StringWriter:toString	()Ljava/lang/String;
    //   231: invokespecial 325	org/eclipse/jface/text/Document:<init>	(Ljava/lang/String;)V
    //   234: astore 7
    //   236: aload 4
    //   238: new 150	org/eclipse/core/runtime/SubProgressMonitor
    //   241: dup
    //   242: aload_2
    //   243: iload_3
    //   244: iconst_2
    //   245: idiv
    //   246: invokespecial 324	org/eclipse/core/runtime/SubProgressMonitor:<init>	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   249: aload 7
    //   251: new 153	org/eclipse/jface/text/Region
    //   254: dup
    //   255: iconst_0
    //   256: aload 7
    //   258: invokeinterface 370 1 0
    //   263: invokespecial 326	org/eclipse/jface/text/Region:<init>	(II)V
    //   266: invokevirtual 334	org/eclipse/mylyn/internal/wikitext/ui/editor/validation/ResourceMarkerMarkupValidator:validate	(Lorg/eclipse/core/runtime/IProgressMonitor;Lorg/eclipse/jface/text/IDocument;Lorg/eclipse/jface/text/IRegion;)V
    //   269: aload_2
    //   270: invokeinterface 366 1 0
    //   275: return
    // Line number table:
    //   Java source line #228	-> byte code offset #0
    //   Java source line #229	-> byte code offset #4
    //   Java source line #230	-> byte code offset #5
    //   Java source line #231	-> byte code offset #27
    //   Java source line #229	-> byte code offset #28
    //   Java source line #232	-> byte code offset #33
    //   Java source line #233	-> byte code offset #42
    //   Java source line #234	-> byte code offset #54
    //   Java source line #236	-> byte code offset #63
    //   Java source line #237	-> byte code offset #71
    //   Java source line #238	-> byte code offset #80
    //   Java source line #240	-> byte code offset #91
    //   Java source line #241	-> byte code offset #100
    //   Java source line #242	-> byte code offset #126
    //   Java source line #240	-> byte code offset #147
    //   Java source line #245	-> byte code offset #149
    //   Java source line #246	-> byte code offset #152
    //   Java source line #245	-> byte code offset #161
    //   Java source line #248	-> byte code offset #176
    //   Java source line #249	-> byte code offset #178
    //   Java source line #250	-> byte code offset #183
    //   Java source line #249	-> byte code offset #186
    //   Java source line #251	-> byte code offset #194
    //   Java source line #252	-> byte code offset #196
    //   Java source line #254	-> byte code offset #213
    //   Java source line #255	-> byte code offset #222
    //   Java source line #256	-> byte code offset #236
    //   Java source line #257	-> byte code offset #251
    //   Java source line #256	-> byte code offset #266
    //   Java source line #259	-> byte code offset #269
    //   Java source line #260	-> byte code offset #275
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	276	0	this	ValidationProjectBuilder
    //   0	276	1	file	ValidationInfo
    //   0	276	2	monitor	IProgressMonitor
    //   3	241	3	totalWork	int
    //   40	197	4	validator	org.eclipse.mylyn.internal.wikitext.ui.editor.validation.ResourceMarkerMarkupValidator
    //   78	149	5	writer	java.io.StringWriter
    //   89	54	6	charset	String
    //   147	40	7	reader	java.io.Reader
    //   194	11	7	ioe	java.io.IOException
    //   234	23	7	document	org.eclipse.jface.text.IDocument
    //   152	3	8	c	int
    //   167	3	8	c	int
    //   176	8	9	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   149	176	176	finally
    //   91	191	194	java/io/IOException
  }
  
  private String getMarkupLanguageForFile(IFile file)
  {
    String language = MarkupEditor.getMarkupLanguagePreference(file);
    if (language == null) {
      language = WikiText.getMarkupLanguageNameForFilename(file.getName());
    }
    return language;
  }
}

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

import org.eclipse.core.resources.IFile;

class ValidationProjectBuilder$ValidationInfo
{
  private final IFile file;
  private final String languageName;
  
  public ValidationProjectBuilder$ValidationInfo(IFile file, String languageName)
  {
    this.file = file;
    this.languageName = languageName;
  }
}

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

import org.eclipse.osgi.util.NLS;

class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.wikitext.ui.validation.messages";
  public static String ValidationProjectBuilder_validatingFileTask;
  public static String ValidationProjectBuilder_validationTask;
  
  static
  {
    NLS.initializeMessages("org.eclipse.mylyn.internal.wikitext.ui.validation.messages", Messages.class);
  }
}

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

import java.util.List;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.util.TransferDropTargetListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.internal.wikitext.ui.WikiTextUiPlugin;
import org.eclipse.mylyn.internal.wikitext.ui.editor.operations.AbstractDocumentCommand;
import org.eclipse.mylyn.internal.wikitext.ui.editor.operations.CommandManager;
import org.eclipse.mylyn.internal.wikitext.ui.editor.operations.InsertLocation;
import org.eclipse.mylyn.internal.wikitext.ui.editor.operations.MoveSectionsCommand;
import org.eclipse.mylyn.wikitext.core.parser.outline.OutlineItem;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

public class OutlineDropTargetListener
  implements TransferDropTargetListener
{
  private static final double THRESHOLD_BEFORE = 0.25D;
  private static final double THRESHOLD_AFTER = 0.75D;
  private final CommandManager commandManager;
  
  public OutlineDropTargetListener(CommandManager commandManager)
  {
    this.commandManager = commandManager;
  }
  
  public void dragEnter(DropTargetEvent event) {}
  
  public void dragLeave(DropTargetEvent event) {}
  
  public void dragOperationChanged(DropTargetEvent event) {}
  
  public void dropAccept(DropTargetEvent event) {}
  
  public void dragOver(DropTargetEvent event)
  {
    feedback = 1;
    float relativeLocation = computeRelativeLocation(event);
    if (relativeLocation > 0.75D) {
      feedback = 4;
    } else if (relativeLocation < 0.25D) {
      feedback = 2;
    }
    feedback |= 0x18;
  }
  
  public void drop(DropTargetEvent event)
  {
    List<OutlineItem> dropItems = getDropItems(event);
    if (dropItems != null)
    {
      InsertLocation location = computeInsertLocation(event);
      Object targetData = item.getData();
      
      final AbstractDocumentCommand command = computeCommand(targetData, dropItems, location);
      if (command != null) {
        if (command.isEnabled()) {
          SafeRunnable.run(new ISafeRunnable()
          {
            public void handleException(Throwable exception)
            {
              WikiTextUiPlugin.getDefault().log(exception);
              MessageDialog.openError(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 
                Messages.OutlineDropTargetListener_0, 
                NLS.bind(Messages.OutlineDropTargetListener_1, 
                new Object[] { exception.getMessage() }));
            }
            
            public void run()
              throws Exception
            {
              commandManager.perform(command);
            }
          });
        } else {
          MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 
            Messages.OutlineDropTargetListener_2, 
            NLS.bind(Messages.OutlineDropTargetListener_3, new Object[] { command.getProblemText() }));
        }
      }
    }
  }
  
  private AbstractDocumentCommand computeCommand(Object targetData, List<OutlineItem> dropItems, InsertLocation location)
  {
    return new MoveSectionsCommand((OutlineItem)targetData, dropItems, location);
  }
  
  private List<OutlineItem> getDropItems(DropTargetEvent event)
  {
    if ((operations == 0) || (item == null)) {
      return null;
    }
    Object targetData = item.getData();
    if (!(targetData instanceof OutlineItem)) {
      return null;
    }
    ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
    if (((selection instanceof IStructuredSelection)) && (!selection.isEmpty()))
    {
      IStructuredSelection structuredSelection = (IStructuredSelection)selection;
      List<?> list = structuredSelection.toList();
      if (!list.isEmpty())
      {
        for (Object i : list) {
          if (!(i instanceof OutlineItem)) {
            return null;
          }
        }
        return list;
      }
    }
    return null;
  }
  
  private InsertLocation computeInsertLocation(DropTargetEvent event)
  {
    float relativeLocation = computeRelativeLocation(event);
    if (relativeLocation < 0.25D) {
      return InsertLocation.BEFORE;
    }
    if (relativeLocation > 0.75D) {
      return InsertLocation.AFTER;
    }
    return InsertLocation.WITHIN;
  }
  
  private float computeRelativeLocation(DropTargetEvent event)
  {
    if (item == null) {
      return 0.5F;
    }
    if ((item instanceof TreeItem))
    {
      TreeItem treeItem = (TreeItem)item;
      Control control = treeItem.getParent();
      Point controlRelativeEventLocation = control.toControl(new Point(x, y));
      Rectangle bounds = treeItem.getBounds();
      return (y - y) / height;
    }
    return 0.0F;
  }
  
  public Transfer getTransfer()
  {
    return LocalSelectionTransfer.getTransfer();
  }
  
  public boolean isEnabled(DropTargetEvent event)
  {
    return (getTransfer().isSupportedType(currentDataType)) && (getDropItems(event) != null);
  }
}

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

import org.eclipse.jface.util.DelegatingDragAdapter;
import org.eclipse.jface.util.DelegatingDropAdapter;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.mylyn.internal.wikitext.ui.editor.operations.CommandManager;
import org.eclipse.swt.dnd.DragSource;
import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.widgets.Control;

public class DndConfigurationStrategy
{
  private DelegatingDragAdapter dragAdapter;
  private DragSource dragSource;
  private DelegatingDropAdapter dropAdapter;
  private DropTarget dropTarget;
  
  public void configure(CommandManager commandManager, Control control, ISelectionProvider provider)
  {
    dragAdapter = new DelegatingDragAdapter();
    dragSource = new DragSource(control, 3);
    dragAdapter.addDragSourceListener(new OutlineDragSourceListener(provider))
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-2019. Infinite Loop Ltd