org.eclipse.emf.common.ui_2.7.0.v20120130-0943

16:43:25.423 INFO  jd.cli.Main - Decompiling org.eclipse.emf.common.ui_2.7.0.v20120130-0943.jar
package org.eclipse.emf.common.ui;

public class CommonUIPlugin$Implementation
  extends EclipseUIPlugin
{
  public CommonUIPlugin$Implementation()
  {
    CommonUIPlugin.access$0(this);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.CommonUIPlugin.Implementation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;

public final class CommonUIPlugin
  extends EMFPlugin
{
  public static final CommonUIPlugin INSTANCE = new CommonUIPlugin();
  private static Implementation plugin;
  
  private CommonUIPlugin()
  {
    super(new ResourceLocator[0]);
  }
  
  public ResourceLocator getPluginResourceLocator()
  {
    return plugin;
  }
  
  public static Implementation getPlugin()
  {
    return plugin;
  }
  
  public static class Implementation
    extends EclipseUIPlugin
  {
    public Implementation()
    {
      CommonUIPlugin.plugin = this;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.CommonUIPlugin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.widgets.Text;

class DiagnosticComposite$1
  implements ISelectionChangedListener
{
  DiagnosticComposite$1(DiagnosticComposite paramDiagnosticComposite) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    if (!event.getSelection().isEmpty())
    {
      Diagnostic diagnostic = (Diagnostic)((IStructuredSelection)event.getSelection()).getFirstElement();
      this$0.diagnosticSelected(diagnostic);
    }
    else
    {
      this$0.detailText.setText("");
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.DiagnosticComposite.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

class DiagnosticComposite$2
  implements ITreeContentProvider
{
  private boolean isRootElement;
  private Map<Diagnostic, Diagnostic[]> parentToChildrenMap;
  
  DiagnosticComposite$2(DiagnosticComposite paramDiagnosticComposite)
  {
    isRootElement = paramDiagnosticComposite.isShowRootDiagnostic();
    parentToChildrenMap = new HashMap();
  }
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
  {
    parentToChildrenMap.clear();
  }
  
  public void dispose()
  {
    parentToChildrenMap.clear();
  }
  
  public Object getParent(Object element)
  {
    return null;
  }
  
  public Object[] getElements(Object inputElement)
  {
    if (isRootElement)
    {
      isRootElement = false;
      Diagnostic diagnostic = (Diagnostic)inputElement;
      if (DiagnosticComposite.severityMatches(diagnostic, this$0.severityMask))
      {
        if ((diagnostic.getMessage() != null) || (diagnostic.getException() != null)) {
          return new Object[] { diagnostic };
        }
      }
      else {
        return new Object[0];
      }
    }
    return getChildren(inputElement);
  }
  
  public boolean hasChildren(Object element)
  {
    return getChildren(element).length > 0;
  }
  
  public Object[] getChildren(Object parentElement)
  {
    Diagnostic[] children = (Diagnostic[])parentToChildrenMap.get(parentElement);
    if (children == null)
    {
      Diagnostic diagnostic = (Diagnostic)parentElement;
      List<Diagnostic> childList = new ArrayList(diagnostic.getChildren().size());
      for (Diagnostic child : diagnostic.getChildren()) {
        if (DiagnosticComposite.severityMatches(child, this$0.severityMask)) {
          childList.add(child);
        }
      }
      children = (Diagnostic[])childList.toArray(new Diagnostic[childList.size()]);
      parentToChildrenMap.put(diagnostic, children);
    }
    return children;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.DiagnosticComposite.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

class DiagnosticComposite$3
  extends LabelProvider
{
  DiagnosticComposite$3(DiagnosticComposite paramDiagnosticComposite) {}
  
  public String getText(Object element)
  {
    Diagnostic diagnostic = (Diagnostic)element;
    String message = diagnostic.getMessage();
    if (message == null) {
      switch (diagnostic.getSeverity())
      {
      case 4: 
        message = CommonUIPlugin.getPlugin().getString("_UI_DiagnosticError_label");
        break;
      case 2: 
        message = CommonUIPlugin.getPlugin().getString("_UI_DiagnosticWarning_label");
        break;
      case 3: 
      default: 
        message = CommonUIPlugin.getPlugin().getString("_UI_Diagnostic_label");
      }
    }
    return message;
  }
  
  public Image getImage(Object element)
  {
    Diagnostic diagnostic = (Diagnostic)element;
    ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
    switch (diagnostic.getSeverity())
    {
    case 4: 
      return sharedImages.getImage("IMG_OBJS_ERROR_TSK");
    case 2: 
    case 8: 
      return sharedImages.getImage("IMG_OBJS_WARN_TSK");
    case 0: 
    case 1: 
      return sharedImages.getImage("IMG_OBJS_INFO_TSK");
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.DiagnosticComposite.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import java.io.PrintWriter;
import java.io.StringWriter;
import org.eclipse.emf.common.util.Diagnostic;

public class DiagnosticComposite$TextProvider
{
  public String getDetail(Diagnostic diagnostic)
  {
    Throwable throwable = diagnostic.getException();
    PrintWriter ps;
    if (throwable != null)
    {
      StringWriter in = new StringWriter();
      ps = new PrintWriter(in);
      throwable.printStackTrace(ps);
      return in.getBuffer().toString();
    }
    for (Object datum : diagnostic.getData()) {
      if ((datum instanceof StringBuilder)) {
        return datum.toString();
      }
    }
    return "";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.DiagnosticComposite.TextProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class DiagnosticComposite
  extends Composite
{
  public static class TextProvider
  {
    public String getDetail(Diagnostic diagnostic)
    {
      Throwable throwable = diagnostic.getException();
      PrintWriter ps;
      if (throwable != null)
      {
        StringWriter in = new StringWriter();
        ps = new PrintWriter(in);
        throwable.printStackTrace(ps);
        return in.getBuffer().toString();
      }
      for (Object datum : diagnostic.getData()) {
        if ((datum instanceof StringBuilder)) {
          return datum.toString();
        }
      }
      return "";
    }
  }
  
  public static int ERROR_WARNING_MASK = 6;
  protected Diagnostic diagnostic;
  protected TextProvider textProvider;
  
  public static boolean severityMatches(Diagnostic diagnostic, int mask)
  {
    return (diagnostic.getSeverity() & mask) != 0;
  }
  
  protected boolean showRootDiagnostic = false;
  protected TreeViewer diagnosticTreeViewer;
  protected Text detailText;
  protected int severityMask = 0;
  
  public DiagnosticComposite(Composite parent, int style)
  {
    super(parent, style);
    GridLayout layout = new GridLayout();
    int spacing = 3;
    marginTop = -5;
    marginBottom = -5;
    marginLeft = -5;
    marginRight = -5;
    horizontalSpacing = spacing;
    verticalSpacing = spacing;
    setLayout(layout);
  }
  
  public void dispose()
  {
    diagnostic = null;
    diagnosticTreeViewer = null;
    detailText = null;
    
    super.dispose();
  }
  
  public void initialize(Diagnostic diagnostic)
  {
    if (!isInitialized())
    {
      setDiagnostic(diagnostic);
      createControls(this);
    }
  }
  
  public boolean isInitialized()
  {
    return (diagnosticTreeViewer != null) && (detailText != null);
  }
  
  public void setDiagnostic(Diagnostic diagnostic)
  {
    this.diagnostic = diagnostic;
    if (isInitialized())
    {
      detailText.setText("");
      if (getDiagnostic() != null) {
        diagnosticTreeViewer.setInput(getDiagnostic());
      } else {
        diagnosticTreeViewer.getTree().removeAll();
      }
    }
  }
  
  public Diagnostic getDiagnostic()
  {
    return diagnostic;
  }
  
  public void setTextProvider(TextProvider textProvider)
  {
    this.textProvider = textProvider;
    if (detailText != null)
    {
      String detail = getTextProvider().getDetail(getSelection());
      setDetailText(detail);
    }
  }
  
  public TextProvider getTextProvider()
  {
    if (textProvider == null) {
      textProvider = new TextProvider();
    }
    return textProvider;
  }
  
  public void setShowRootDiagnostic(boolean showRootDiagnostic)
  {
    this.showRootDiagnostic = showRootDiagnostic;
  }
  
  public boolean isShowRootDiagnostic()
  {
    return showRootDiagnostic;
  }
  
  public void setSeverityMask(int severityMask)
  {
    this.severityMask = severityMask;
  }
  
  public int getSeverityMask()
  {
    return severityMask;
  }
  
  protected void createControls(Composite parent)
  {
    SashForm sashForm = new SashForm(parent, 512);
    sashForm.setLayoutData(new GridData(1808));
    
    diagnosticTreeViewer = new TreeViewer(sashForm, 2048);
    diagnosticTreeViewer.getTree().setLayoutData(new GridData(1810));
    
    detailText = new Text(sashForm, 2826);
    GridData gridData = new GridData(1808);
    heightHint = 20;
    grabExcessVerticalSpace = true;
    detailText.setLayoutData(gridData);
    detailText.setBackground(detailText.getDisplay().getSystemColor(25));
    
    sashForm.setWeights(new int[] { 70, 30 });
    sashForm.setMaximizedControl(diagnosticTreeViewer.getTree());
    
    diagnosticTreeViewer.setContentProvider(createContentProvider());
    diagnosticTreeViewer.setLabelProvider(createLabelProvider());
    
    diagnosticTreeViewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        if (!event.getSelection().isEmpty())
        {
          Diagnostic diagnostic = (Diagnostic)((IStructuredSelection)event.getSelection()).getFirstElement();
          diagnosticSelected(diagnostic);
        }
        else
        {
          detailText.setText("");
        }
      }
    });
    if (getDiagnostic() != null) {
      diagnosticTreeViewer.setInput(getDiagnostic());
    }
    diagnosticTreeViewer.expandToLevel(2);
  }
  
  public void setDetailText(String text)
  {
    if (text == null) {
      text = "";
    }
    if ((detailText != null) && (!text.equals(detailText.getText()))) {
      detailText.setText(text);
    }
  }
  
  public String getDetailText()
  {
    return detailText == null ? "" : 
      detailText.getText();
  }
  
  public Diagnostic getSelection()
  {
    return diagnosticTreeViewer == null ? null : 
      (Diagnostic)((IStructuredSelection)diagnosticTreeViewer.getSelection()).getFirstElement();
  }
  
  protected void diagnosticSelected(Diagnostic selection)
  {
    String detail = getTextProvider().getDetail(selection).trim();
    
    SashForm sashForm = (SashForm)detailText.getParent();
    setDetailText(detail);
    if (detail.length() == 0)
    {
      sashForm.setMaximizedControl(diagnosticTreeViewer.getTree());
    }
    else
    {
      sashForm.setMaximizedControl(null);
      if (diagnosticTreeViewer != null) {
        diagnosticTreeViewer.getTree().showSelection();
      }
    }
  }
  
  protected ITreeContentProvider createContentProvider()
  {
    new ITreeContentProvider()
    {
      private boolean isRootElement = isShowRootDiagnostic();
      private Map<Diagnostic, Diagnostic[]> parentToChildrenMap = new HashMap();
      
      public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
      {
        parentToChildrenMap.clear();
      }
      
      public void dispose()
      {
        parentToChildrenMap.clear();
      }
      
      public Object getParent(Object element)
      {
        return null;
      }
      
      public Object[] getElements(Object inputElement)
      {
        if (isRootElement)
        {
          isRootElement = false;
          Diagnostic diagnostic = (Diagnostic)inputElement;
          if (DiagnosticComposite.severityMatches(diagnostic, severityMask))
          {
            if ((diagnostic.getMessage() != null) || (diagnostic.getException() != null)) {
              return new Object[] { diagnostic };
            }
          }
          else {
            return new Object[0];
          }
        }
        return getChildren(inputElement);
      }
      
      public boolean hasChildren(Object element)
      {
        return getChildren(element).length > 0;
      }
      
      public Object[] getChildren(Object parentElement)
      {
        Diagnostic[] children = (Diagnostic[])parentToChildrenMap.get(parentElement);
        if (children == null)
        {
          Diagnostic diagnostic = (Diagnostic)parentElement;
          List<Diagnostic> childList = new ArrayList(diagnostic.getChildren().size());
          for (Diagnostic child : diagnostic.getChildren()) {
            if (DiagnosticComposite.severityMatches(child, severityMask)) {
              childList.add(child);
            }
          }
          children = (Diagnostic[])childList.toArray(new Diagnostic[childList.size()]);
          parentToChildrenMap.put(diagnostic, children);
        }
        return children;
      }
    };
  }
  
  protected ILabelProvider createLabelProvider()
  {
    new LabelProvider()
    {
      public String getText(Object element)
      {
        Diagnostic diagnostic = (Diagnostic)element;
        String message = diagnostic.getMessage();
        if (message == null) {
          switch (diagnostic.getSeverity())
          {
          case 4: 
            message = CommonUIPlugin.getPlugin().getString("_UI_DiagnosticError_label");
            break;
          case 2: 
            message = CommonUIPlugin.getPlugin().getString("_UI_DiagnosticWarning_label");
            break;
          case 3: 
          default: 
            message = CommonUIPlugin.getPlugin().getString("_UI_Diagnostic_label");
          }
        }
        return message;
      }
      
      public Image getImage(Object element)
      {
        Diagnostic diagnostic = (Diagnostic)element;
        ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
        switch (diagnostic.getSeverity())
        {
        case 4: 
          return sharedImages.getImage("IMG_OBJS_ERROR_TSK");
        case 2: 
        case 8: 
          return sharedImages.getImage("IMG_OBJS_WARN_TSK");
        case 0: 
        case 1: 
          return sharedImages.getImage("IMG_OBJS_INFO_TSK");
        }
        return null;
      }
    };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.DiagnosticComposite
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.MissingResourceException;
import org.eclipse.emf.common.CommonPlugin;
import org.eclipse.emf.common.EMFPlugin.InternalEclipsePlugin;
import org.eclipse.emf.common.EMFPlugin.InternalHelper;
import org.eclipse.emf.common.util.Logger;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.ui.plugin.AbstractUIPlugin;

public abstract class EclipseUIPlugin
  extends AbstractUIPlugin
  implements ResourceLocator, Logger, EMFPlugin.InternalEclipsePlugin
{
  protected EMFPlugin.InternalHelper helper;
  
  public EclipseUIPlugin()
  {
    helper = new EMFPlugin.InternalHelper(this);
  }
  
  public String getSymbolicName()
  {
    return helper.getSymbolicName();
  }
  
  public URL getBaseURL()
  {
    return helper.getBaseURL();
  }
  
  public Object getImage(String key)
  {
    try
    {
      return doGetImage(key);
    }
    catch (MalformedURLException exception)
    {
      throw new WrappedException(exception);
    }
    catch (IOException exception)
    {
      throw 
        new MissingResourceException(
        CommonPlugin.INSTANCE.getString("_UI_StringResourceNotFound_exception", new Object[] { key }), 
        getClass().getName(), 
        key);
    }
  }
  
  protected Object doGetImage(String key)
    throws IOException
  {
    return helper.getImage(key);
  }
  
  public String getString(String key)
  {
    return helper.getString(key, true);
  }
  
  public String getString(String key, boolean translate)
  {
    return helper.getString(key, translate);
  }
  
  public String getString(String key, Object[] substitutions)
  {
    return helper.getString(key, substitutions, true);
  }
  
  public String getString(String key, Object[] substitutions, boolean translate)
  {
    return helper.getString(key, substitutions, translate);
  }
  
  public void log(Object logEntry)
  {
    helper.log(logEntry);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.EclipseUIPlugin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

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.Path;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.URI;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.part.FileEditorInput;

public class MarkerHelper
{
  protected String getMarkerID()
  {
    return "org.eclipse.core.resources.problemmarker";
  }
  
  protected IFile getFile(Object datum)
  {
    if ((datum instanceof IFileEditorInput)) {
      return ((IFileEditorInput)datum).getFile();
    }
    if ((datum instanceof IFile)) {
      return (IFile)datum;
    }
    if ((datum instanceof Diagnostic)) {
      return getFile((Diagnostic)datum);
    }
    return null;
  }
  
  protected IFile getFile(Diagnostic diagnostic)
  {
    List<?> data = diagnostic.getData();
    if (data != null) {
      for (Object datum : data)
      {
        IFile result = getFile(datum);
        if (result != null) {
          return result;
        }
      }
    }
    return null;
  }
  
  protected IFile getFile(URI uri)
  {
    String platformResourceString = uri.toPlatformString(true);
    return platformResourceString != null ? 
      ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformResourceString)) : 
      null;
  }
  
  public void createMarkers(Diagnostic diagnostic)
    throws CoreException
  {
    if (diagnostic.getChildren().isEmpty()) {
      createMarkers(getFile(diagnostic), diagnostic, null);
    } else if (diagnostic.getMessage() == null) {
      for (Diagnostic childDiagnostic : diagnostic.getChildren()) {
        createMarkers(childDiagnostic);
      }
    } else {
      for (Diagnostic childDiagnostic : diagnostic.getChildren()) {
        createMarkers(getFile(childDiagnostic), childDiagnostic, diagnostic);
      }
    }
  }
  
  protected void createMarkers(IResource resource, Diagnostic diagnostic, Diagnostic parentDiagnostic)
    throws CoreException
  {
    if ((resource != null) && (resource.exists()))
    {
      IMarker marker = resource.createMarker(getMarkerID());
      int severity = diagnostic.getSeverity();
      if (severity < 2) {
        marker.setAttribute("severity", 0);
      } else if (severity < 4) {
        marker.setAttribute("severity", 1);
      } else {
        marker.setAttribute("severity", 2);
      }
      String message = composeMessage(diagnostic, parentDiagnostic);
      if (message != null) {
        marker.setAttribute("message", message);
      }
      adjustMarker(marker, diagnostic, parentDiagnostic);
    }
  }
  
  protected void adjustMarker(IMarker marker, Diagnostic diagnostic, Diagnostic parentDiagnostic)
    throws CoreException
  {}
  
  protected String composeMessage(Diagnostic diagnostic, Diagnostic parentDiagnostic)
  {
    return diagnostic.getMessage();
  }
  
  public boolean hasMarkers(Object object)
  {
    return hasMarkers(object, false, 0);
  }
  
  public boolean hasMarkers(Object object, boolean includeSubtypes, int depth)
  {
    return hasMarkers(getFile(object), includeSubtypes, depth);
  }
  
  protected boolean hasMarkers(IResource resource, boolean includeSubtypes, int depth)
  {
    if ((resource != null) && (resource.exists())) {
      try
      {
        IMarker[] markers = resource.findMarkers(getMarkerID(), includeSubtypes, depth);
        return markers.length > 0;
      }
      catch (CoreException localCoreException) {}
    }
    return false;
  }
  
  public void deleteMarkers(Object object)
  {
    deleteMarkers(object, false, 0);
  }
  
  public void deleteMarkers(Object object, boolean includeSubtypes, int depth)
  {
    deleteMarkers(getFile(object), includeSubtypes, depth);
  }
  
  protected void deleteMarkers(IResource resource, boolean includeSubtypes, int depth)
  {
    if ((resource != null) && (resource.exists())) {
      try
      {
        resource.deleteMarkers(getMarkerID(), includeSubtypes, depth);
      }
      catch (CoreException e)
      {
        CommonUIPlugin.INSTANCE.log(e);
      }
    }
  }
  
  public IEditorInput getEditorInput(Object object)
  {
    IFile file = getFile(object);
    if (file != null) {
      return new FileEditorInput(file);
    }
    return null;
  }
  
  public List<?> getTargetObjects(Object object, IMarker marker)
  {
    return Collections.EMPTY_LIST;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.MarkerHelper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.core.resources.IFile;
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.Path;
import org.eclipse.emf.common.util.URI;

public class URIEditorInput$EclipseUtil
{
  public static Object getAdatper(Class<?> adapter, URI uri)
  {
    if (((adapter == IFile.class) || (adapter == IResource.class)) && (uri.isPlatformResource())) {
      return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
    }
    return null;
  }
  
  public static boolean exists(URI uri)
  {
    if (uri.isPlatformResource()) {
      return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true))).exists();
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.URIEditorInput.EclipseUtil
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import java.io.File;
import java.lang.reflect.Constructor;
import org.eclipse.core.resources.IFile;
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.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistableElement;
import org.osgi.framework.Bundle;

public class URIEditorInput
  implements IEditorInput, IPersistableElement
{
  private URI uri;
  private String name;
  protected static final String BUNDLE_TAG = "bundle";
  protected static final String CLASS_TAG = "class";
  protected static final String URI_TAG = "uri";
  protected static final String NAME_TAG = "name";
  
  public URIEditorInput(URI uri)
  {
    this.uri = uri;
  }
  
  public URIEditorInput(URI uri, String name)
  {
    this.uri = uri;
    this.name = name;
  }
  
  public URIEditorInput(IMemento memento)
  {
    loadState(memento);
  }
  
  public int hashCode()
  {
    return uri.hashCode();
  }
  
  public boolean equals(Object o)
  {
    return (this == o) || (((o instanceof URIEditorInput)) && (uri.equals(((URIEditorInput)o).getURI())));
  }
  
  public URI getURI()
  {
    return uri;
  }
  
  public boolean exists()
  {
    if (getURI().isFile()) {
      return new File(getURI().toFileString()).exists();
    }
    if (EMFPlugin.IS_RESOURCES_BUNDLE_AVAILABLE) {
      return EclipseUtil.exists(uri);
    }
    return false;
  }
  
  public String getName()
  {
    if (name == null)
    {
      URI uri = getURI();
      return URI.decode((uri.isHierarchical()) && (uri.lastSegment() != null) ? uri.lastSegment() : uri.toString());
    }
    return name;
  }
  
  public String getToolTipText()
  {
    return getURI().toString();
  }
  
  public ImageDescriptor getImageDescriptor()
  {
    return null;
  }
  
  public IPersistableElement getPersistable()
  {
    return this;
  }
  
  public Object getAdapter(Class adapter)
  {
    if (EMFPlugin.IS_RESOURCES_BUNDLE_AVAILABLE)
    {
      Object result = EclipseUtil.getAdatper(adapter, uri);
      if (result != null) {
        return result;
      }
    }
    return null;
  }
  
  public String getFactoryId()
  {
    return URIEditorInputFactory.ID;
  }
  
  protected String getBundleSymbolicName()
  {
    return CommonUIPlugin.getPlugin().getSymbolicName();
  }
  
  static URIEditorInput create(IMemento memento)
  {
    String bundleSymbolicName = memento.getString("bundle");
    String className = memento.getString("class");
    try
    {
      Bundle bundle = Platform.getBundle(bundleSymbolicName);
      Class<?> theClass = bundle.loadClass(className);
      Constructor<?> constructor = theClass.getConstructor(new Class[] { IMemento.class });
      return (URIEditorInput)constructor.newInstance(new Object[] { memento });
    }
    catch (Exception exception)
    {
      CommonUIPlugin.INSTANCE.log(exception);
    }
    return new URIEditorInput(memento);
  }
  
  public void saveState(IMemento memento)
  {
    memento.putString("bundle", getBundleSymbolicName());
    memento.putString("class", getClass().getName());
    memento.putString("uri", uri.toString());
    memento.putString("name", name);
  }
  
  protected void loadState(IMemento memento)
  {
    uri = URI.createURI(memento.getString("uri"));
    name = memento.getString("name");
  }
  
  protected static class EclipseUtil
  {
    public static Object getAdatper(Class<?> adapter, URI uri)
    {
      if (((adapter == IFile.class) || (adapter == IResource.class)) && (uri.isPlatformResource())) {
        return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
      }
      return null;
    }
    
    public static boolean exists(URI uri)
    {
      if (uri.isPlatformResource()) {
        return ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true))).exists();
      }
      return false;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.URIEditorInput
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.IElementFactory;
import org.eclipse.ui.IMemento;

public class URIEditorInputFactory
  implements IElementFactory
{
  public static final String ID = URIEditorInputFactory.class.getName();
  
  public IAdaptable createElement(IMemento memento)
  {
    return URIEditorInput.create(memento);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.URIEditorInputFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;

class ViewerPane$1
  extends MouseAdapter
{
  ViewerPane$1(ViewerPane paramViewerPane) {}
  
  public void mouseDown(MouseEvent e)
  {
    this$0.requestActivation();
  }
  
  public void mouseDoubleClick(MouseEvent e)
  {
    if (e.getSource() == this$0.titleLabel) {
      this$0.doMaximize();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.ViewerPane.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;

class ViewerPane$2
  implements IPartListener
{
  ViewerPane$2(ViewerPane paramViewerPane) {}
  
  public void partActivated(IWorkbenchPart p) {}
  
  public void partBroughtToTop(IWorkbenchPart p) {}
  
  public void partClosed(IWorkbenchPart p) {}
  
  public void partDeactivated(IWorkbenchPart p)
  {
    if (p == this$0.part) {
      this$0.showFocus(false);
    }
  }
  
  public void partOpened(IWorkbenchPart p) {}
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.ViewerPane.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;

class ViewerPane$3
  implements DisposeListener
{
  ViewerPane$3(ViewerPane paramViewerPane) {}
  
  public void widgetDisposed(DisposeEvent event)
  {
    this$0.dispose();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.ViewerPane.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ViewerPane$4
  extends SelectionAdapter
{
  ViewerPane$4(ViewerPane paramViewerPane) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    ViewerPane.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.ViewerPane.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;

class ViewerPane$5
  extends MouseAdapter
{
  ViewerPane$5(ViewerPane paramViewerPane) {}
  
  public void mouseDown(MouseEvent e)
  {
    if (button == 3) {
      ViewerPane.access$1(this$0, e);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.ViewerPane.5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;

class ViewerPane$6
  implements PaintListener
{
  ViewerPane$6(ViewerPane paramViewerPane) {}
  
  public void paintControl(PaintEvent event)
  {
    if (this$0.isActive)
    {
      Rectangle clientRectangle = this$0.titleLabel.getClientArea();
      gc.drawImage(
        WorkbenchColors.getGradient((gc.getStyle() & 0x2000000) != 0), 
        10, 0, 10, 10, 
        0, 0, 24, height);
      
      Image image = this$0.titleLabel.getImage();
      if (image != null)
      {
        Rectangle imageRectangle = image.getBounds();
        gc.drawImage(
          image, 
          0, 0, width, height, 
          3, (height - height) / 2, width, height);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.ViewerPane.6
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ViewerPane$7
  extends SelectionAdapter
{
  ViewerPane$7(ViewerPane paramViewerPane) {}
  
  public void widgetSelected(SelectionEvent selectionEvent)
  {
    this$0.doMaximize();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.ViewerPane.7
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ViewerPane$8
  extends SelectionAdapter
{
  ViewerPane$8(ViewerPane paramViewerPane) {}
  
  public void widgetSelected(SelectionEvent selectionEvent)
  {
    this$0.doMaximize();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.ViewerPane.8
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.custom.ViewForm;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.ToolBar;

class ViewerPane$PaneToolBarManager
  extends ToolBarManager
{
  public ViewerPane$PaneToolBarManager(ViewerPane paramViewerPane, ToolBar paneToolBar)
  {
    super(paneToolBar);
  }
  
  protected void relayout(ToolBar toolBar, int oldCount, int newCount)
  {
    if (newCount < 1)
    {
      if (this$0.control.getTopCenter() != null) {
        this$0.control.setTopCenter(null);
      }
    }
    else
    {
      toolBar.layout();
      if (this$0.control.getTopCenter() == null) {
        this$0.control.setTopCenter(toolBar);
      }
    }
    Composite parent = toolBar.getParent();
    parent.layout();
    if (parent.getParent() != null) {
      parent.getParent().layout();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.common.ui.ViewerPane.PaneToolBarManager
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.common.ui;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ContentViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ViewForm;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;

public abstract class ViewerPane
  implements IPropertyListener, Listener
{
  protected IWorkbenchPage page;
  protected IWorkbenchPart part;
  protected Collection<Object> buddies = new ArrayList();
  protected Viewer viewer;
  protected Composite container;
  boolean isActive;
  protected CLabel titleLabel;
  protected ToolBar actionBar;
  protected ToolBarManager toolBarManager;
  protected MenuManager menuManager;
  protected Image pullDownImage;
  protected ToolBar systemBar;
  protected ViewForm control;
  protected MouseListener mouseListener = new MouseAdapter()
  {
    public void mouseDown(MouseEvent e)
    {
      requestActivation();
    }
    
    public void mouseDoubleClick(MouseEvent e)
    {
      if (e.getSource() == titleLabel) {
        doMaximize();
      }
    }
  };
  protected IPartListener partListener = new IPartListener()
  {
    public void partActivated(IWorkbenchPart p) {}
    
    public void partBroughtToTop(IWorkbenchPart p) {}
    
    public void partClosed(IWorkbenchPart p) {}
    
    public void partDeactivated(IWorkbenchPart p)
    {
      if (p == part) {
        showFocus(false);
      }
    }
    
    public void partOpened(IWorkbenchPart p) {}
  };
  
  public ViewerPane(IWorkbenchPage page, IWorkbenchPart part)
  {
    WorkbenchColors.startup();
    this.page = page;
    this.part = part;
    
    page.addPartListener(partListener);
  }
  
  public abstract Viewer createViewer(Composite paramComposite);
  
  public Collection<Object> getBudies()
  {
    return buddies;
  }
  
  public void createControl(Composite parent)
  {
    if (getControl() == null)
    {
      container = parent;
      
      control = new ViewForm(parent, 0);
      control.addDisposeListener(
        new DisposeListener()
        {
          public void widgetDisposed(DisposeEvent event)
          {
            dispose();
          }
        });
      control.marginWidth = 0;
      control.marginHeight = 0;
      
      createTitleBar();
      
      viewer = createViewer(control);
      control.setContent(viewer.getControl());
      
      control.setTabList(new Control[] { viewer.getControl() });
      
      control.addListener(26, this);
      hookFocus(control);
      hookFocus(viewer.getControl());
    }
  }
  
  public Viewer getViewer()
  {
    return viewer;
  }
  
  public Control getControl()
  {
    return control;
  }
  
  protected ViewForm getViewForm()
  {
    return control;
  }
  
  public void handleEvent(Event event)
  {
    if (type == 26) {
      requestActiv
1 2 3 4 5 6

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