org.eclipse.pde.api.tools.ui_1.0.301.v20110803_r371

16:47:21.065 INFO  jd.cli.Main - Decompiling org.eclipse.pde.api.tools.ui_1.0.301.v20110803_r371.jar
package org.eclipse.pde.api.tools.ui.internal;

import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.ui.IActionFilter;

class ActionFilterAdapterFactory
  implements IAdapterFactory
{
  public Object getAdapter(Object obj, Class adapterType)
  {
    if ((adapterType == IActionFilter.class) && 
      ((obj instanceof IJavaElement))) {
      return new JavaElementActionFilter();
    }
    return null;
  }
  
  public Class[] getAdapterList()
  {
    return new Class[] {
      IActionFilter.class };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.ActionFilterAdapterFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;

public class ApiImageDescriptor
  extends CompositeImageDescriptor
{
  public static final int ERROR = 1;
  public static final int SUCCESS = 2;
  private ImageDescriptor fBaseImage;
  private int fFlags;
  private Point fSize;
  
  public ApiImageDescriptor(ImageDescriptor baseImage, int flags)
  {
    setBaseImage(baseImage);
    setFlags(flags);
  }
  
  protected Point getSize()
  {
    if (fSize == null)
    {
      ImageData data = getBaseImage().getImageData();
      setSize(new Point(width, height));
    }
    return fSize;
  }
  
  public boolean equals(Object object)
  {
    if (!(object instanceof ApiImageDescriptor)) {
      return false;
    }
    ApiImageDescriptor other = (ApiImageDescriptor)object;
    return (getBaseImage().equals(other.getBaseImage())) && (getFlags() == other.getFlags());
  }
  
  public int hashCode()
  {
    return getBaseImage().hashCode() | getFlags();
  }
  
  protected void drawCompositeImage(int width, int height)
  {
    ImageData bg = getBaseImage().getImageData();
    if (bg == null) {
      bg = DEFAULT_IMAGE_DATA;
    }
    drawImage(bg, 0, 0);
    drawOverlays();
  }
  
  private ImageData getImageData(String imageDescriptorKey)
  {
    return ApiUIPlugin.getImageDescriptor(imageDescriptorKey).getImageData();
  }
  
  protected void drawOverlays()
  {
    int flags = getFlags();
    int x = 0;
    int y = 0;
    ImageData data = null;
    if ((flags & 0x1) != 0)
    {
      x = 0;
      y = getSizey;
      data = getImageData("IMG_OVR_ERROR");
      y -= height;
      drawImage(data, x, y);
    }
    else if ((flags & 0x2) != 0)
    {
      x = 0;
      y = getSizey;
      data = getImageData("IMG_OVR_SUCCESS");
      y -= height;
      drawImage(data, x, y);
    }
  }
  
  protected ImageDescriptor getBaseImage()
  {
    return fBaseImage;
  }
  
  protected void setBaseImage(ImageDescriptor baseImage)
  {
    fBaseImage = baseImage;
  }
  
  protected int getFlags()
  {
    return fFlags;
  }
  
  protected void setFlags(int flags)
  {
    fFlags = flags;
  }
  
  protected void setSize(Point size)
  {
    fSize = size;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.ApiImageDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

import com.ibm.icu.text.MessageFormat;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import org.eclipse.core.resources.IProject;
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.jdt.ui.JavaUI;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.provisional.IApiBaselineManager;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblem;
import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblemFilter;
import org.eclipse.pde.api.tools.ui.internal.wizards.ApiBaselineWizardPage.EEEntry;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class ApiToolsLabelProvider
  extends BaseLabelProvider
  implements ILabelProvider, IFontProvider
{
  private Font font = null;
  
  public void dispose()
  {
    if (font != null) {
      font.dispose();
    }
    super.dispose();
  }
  
  public Image getImage(Object element)
  {
    if ((element instanceof IApiComponent))
    {
      IApiComponent comp = (IApiComponent)element;
      return getApiComponentImage(comp);
    }
    if ((element instanceof IResource))
    {
      IResource resource = (IResource)element;
      switch (resource.getType())
      {
      case 1: 
        return PlatformUI.getWorkbench().getSharedImages().getImage("IMG_OBJ_FILE");
      case 2: 
        return PlatformUI.getWorkbench().getSharedImages().getImage("IMG_OBJ_FOLDER");
      case 4: 
        return PlatformUI.getWorkbench().getSharedImages().getImage("IMG_OBJ_PROJECT");
      }
    }
    if ((element instanceof File)) {
      return PlatformUI.getWorkbench().getSharedImages().getImage("IMG_OBJ_FOLDER");
    }
    if ((element instanceof IApiBaseline)) {
      return getBaselineImage();
    }
    if ((element instanceof ApiBaselineWizardPage.EEEntry)) {
      return ApiUIPlugin.getSharedImage("IMG_OBJ_API_SYSTEM_LIBRARY");
    }
    if ((element instanceof IApiProblemFilter))
    {
      IApiProblemFilter filter = (IApiProblemFilter)element;
      IApiProblem problem = filter.getUnderlyingProblem();
      
      return getApiProblemElementImage(problem);
    }
    return null;
  }
  
  private Image getApiProblemElementImage(IApiProblem problem)
  {
    if (problem.getCategory() != 536870912)
    {
      switch (problem.getElementKind())
      {
      case 1: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.annotation_obj.gif");
      case 6: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.enum_obj.gif");
      case 4: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.class_obj.gif");
      case 8: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.int_obj.gif");
      case 7: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.field_public_obj.gif");
      case 9: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.methpub_obj.gif");
      case 10: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.jcu_obj.gif");
      case 3: 
        return getBaselineImage();
      case 2: 
        IPath path = new Path(problem.getResourcePath());
        
        IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
        if (res != null)
        {
          IApiComponent comp = ApiPlugin.getDefault()
            .getApiBaselineManager()
            .getWorkspaceBaseline()
            .getApiComponent(res.getProject().getName());
          if (comp != null) {
            return getApiComponentImage(comp);
          }
        }
        return ApiUIPlugin.getSharedImage("IMG_OBJ_BUNDLE");
      }
    }
    else
    {
      switch (problem.getElementKind())
      {
      case 2: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.class_obj.gif");
      case 6: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.methpub_obj.gif");
      case 5: 
        return JavaUI.getSharedImages().getImage("org.eclipse.jdt.ui.field_public_obj.gif");
      }
      System.out.println();
    }
    return null;
  }
  
  private Image getBaselineImage()
  {
    return ApiUIPlugin.getSharedImage("IMG_OBJ_ECLIPSE_PROFILE");
  }
  
  private Image getApiComponentImage(IApiComponent component)
  {
    if (component.isSystemComponent()) {
      return ApiUIPlugin.getSharedImage("IMG_OBJ_API_SYSTEM_LIBRARY");
    }
    try
    {
      if (component.isFragment()) {
        return ApiUIPlugin.getSharedImage("IMG_OBJ_FRAGMENT");
      }
    }
    catch (CoreException e)
    {
      ApiPlugin.log(e);
    }
    return ApiUIPlugin.getSharedImage("IMG_OBJ_BUNDLE");
  }
  
  public String getText(Object element)
  {
    if ((element instanceof IApiComponent))
    {
      IApiComponent comp = (IApiComponent)element;
      return MessageFormat.format(Messages.ApiToolsLabelProvider_0, new String[] { comp.getSymbolicName(), comp.getVersion() });
    }
    if ((element instanceof File)) {
      try
      {
        return ((File)element).getCanonicalPath();
      }
      catch (IOException localIOException)
      {
        return ((File)element).getName();
      }
    }
    if ((element instanceof IApiBaseline))
    {
      IApiBaseline baseline = (IApiBaseline)element;
      StringBuffer buffer = new StringBuffer();
      buffer.append(baseline.getName());
      if (isDefaultBaseline(baseline)) {
        buffer.append(NLS.bind(Messages.ApiToolsLabelProvider_default_baseline_place_holder, Messages.ApiToolsLabelProvider_default_baseline));
      }
      return buffer.toString();
    }
    if ((element instanceof ApiBaselineWizardPage.EEEntry)) {
      return ((ApiBaselineWizardPage.EEEntry)element).toString();
    }
    if ((element instanceof IApiProblemFilter))
    {
      IApiProblemFilter filter = (IApiProblemFilter)element;
      return filter.getUnderlyingProblem().getMessage();
    }
    if ((element instanceof IResource))
    {
      IResource resource = (IResource)element;
      IPath path = resource.getProjectRelativePath();
      StringBuffer buffer = new StringBuffer();
      buffer.append(path.removeFileExtension().lastSegment());
      buffer.append(" (");
      buffer.append(path.removeLastSegments(1));
      buffer.append(")");
      return buffer.toString();
    }
    if ((element instanceof String)) {
      return (String)element;
    }
    return "<unknown>";
  }
  
  protected boolean isDefaultBaseline(Object element)
  {
    if ((element instanceof IApiBaseline))
    {
      IApiBaseline profile = (IApiBaseline)element;
      IApiBaseline def = ApiPlugin.getDefault().getApiBaselineManager().getDefaultApiBaseline();
      if (def != null) {
        return profile.getName().equals(def.getName());
      }
    }
    return false;
  }
  
  public Font getFont(Object element)
  {
    if (isDefaultBaseline(element))
    {
      if (font == null)
      {
        Font dialogFont = JFaceResources.getDialogFont();
        FontData[] fontData = dialogFont.getFontData();
        for (int i = 0; i < fontData.length; i++)
        {
          FontData data = fontData[i];
          data.setStyle(1);
        }
        Display display = ApiUIPlugin.getShell().getDisplay();
        font = new Font(display, fontData);
      }
      return font;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.ApiToolsLabelProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

import org.eclipse.pde.api.tools.internal.provisional.ISession;
import org.eclipse.pde.api.tools.internal.provisional.ISessionListener;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;

class ApiUIPlugin$1
  implements ISessionListener
{
  final ApiUIPlugin this$0;
  
  ApiUIPlugin$1(ApiUIPlugin paramApiUIPlugin)
  {
    this$0 = paramApiUIPlugin;
  }
  
  public void sessionAdded(ISession addedSession)
  {
    this$0.getWorkbench().getDisplay().asyncExec(new ApiUIPlugin.2(this));
  }
  
  public void sessionRemoved(ISession removedSession) {}
  
  public void sessionActivated(ISession session) {}
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.ApiUIPlugin.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

class ApiUIPlugin$2
  implements Runnable
{
  final ApiUIPlugin.1 this$1;
  
  ApiUIPlugin$2(ApiUIPlugin.1 param1)
  {
    this$1 = param1;
  }
  
  public void run()
  {
    ApiUIPlugin.1.access$0(this$1).showAPIToolingView();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.ApiUIPlugin.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

import java.net.URL;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.provisional.ISession;
import org.eclipse.pde.api.tools.internal.provisional.ISessionListener;
import org.eclipse.pde.api.tools.internal.provisional.ISessionManager;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;

public class ApiUIPlugin
  extends AbstractUIPlugin
{
  private static Map fCompositeImages = new HashMap();
  private static ApiUIPlugin fgDefault = null;
  private static final String ICONS_PATH = "$nl$/icons/full/";
  private static final String DLCL = "$nl$/icons/full/dlcl16/";
  private static final String ELCL = "$nl$/icons/full/elcl16/";
  public static final int INTERNAL_ERROR = 120;
  private static final String OBJECT = "$nl$/icons/full/obj16/";
  private static final String OVR = "$nl$/icons/full/ovr16/";
  public static final String PLUGIN_ID = "org.eclipse.pde.api.tools.ui";
  private static final String WIZBAN = "$nl$/icons/full/wizban/";
  private ActionFilterAdapterFactory fActionFilterAdapterFactory;
  
  private static final void declareRegistryImage(ImageRegistry reg, String key, String path)
  {
    ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
    Bundle bundle = Platform.getBundle("org.eclipse.pde.api.tools.ui");
    URL url = null;
    if (bundle != null)
    {
      url = FileLocator.find(bundle, new Path(path), null);
      desc = ImageDescriptor.createFromURL(url);
    }
    reg.put(key, desc);
  }
  
  public static ApiUIPlugin getDefault()
  {
    if (fgDefault == null) {
      fgDefault = new ApiUIPlugin();
    }
    return fgDefault;
  }
  
  public static Image getImage(ImageDescriptor descriptor)
  {
    ImageDescriptor ldesc = descriptor;
    if (ldesc == null) {
      ldesc = ImageDescriptor.getMissingImageDescriptor();
    }
    Image result = (Image)fCompositeImages.get(ldesc);
    if (result != null) {
      return result;
    }
    result = ldesc.createImage();
    if (result != null) {
      fCompositeImages.put(ldesc, result);
    }
    return result;
  }
  
  public static ImageDescriptor getImageDescriptor(String key)
  {
    return getDefault().getImageRegistry().getDescriptor(key);
  }
  
  public static String getPluginIdentifier()
  {
    return "org.eclipse.pde.api.tools.ui";
  }
  
  public static Image getSharedImage(String key)
  {
    return getDefault().getImageRegistry().get(key);
  }
  
  public static Shell getShell()
  {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null)
    {
      IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
      if (windows.length > 0) {
        return windows[0].getShell();
      }
    }
    else
    {
      return window.getShell();
    }
    return null;
  }
  
  public static void log(IStatus status)
  {
    if (getDefault() == null)
    {
      Throwable exception = status.getException();
      if (exception != null) {
        exception.printStackTrace();
      }
    }
    else
    {
      getDefault().getLog().log(status);
    }
  }
  
  public static void log(Throwable t)
  {
    log(newErrorStatus("Error logged from API Tools UI: ", t));
  }
  
  public static void logErrorMessage(String message)
  {
    log(newErrorStatus("Internal message logged from API Tools UI: " + message, null));
  }
  
  public static IStatus newErrorStatus(String message, Throwable exception)
  {
    return new Status(4, getPluginIdentifier(), 120, message, exception);
  }
  
  private ISessionListener sessionListener = new ISessionListener()
  {
    public void sessionAdded(ISession addedSession)
    {
      getWorkbench().getDisplay().asyncExec(new ApiUIPlugin.2(this));
    }
    
    public void sessionRemoved(ISession removedSession) {}
    
    public void sessionActivated(ISession session) {}
  };
  
  public ApiUIPlugin()
  {
    fgDefault = this;
  }
  
  public IDialogSettings getDialogSettingsSection(String name)
  {
    IDialogSettings dialogSettings = getDialogSettings();
    IDialogSettings section = dialogSettings.getSection(name);
    if (section == null) {
      section = dialogSettings.addNewSection(name);
    }
    return section;
  }
  
  protected void initializeImageRegistry(ImageRegistry reg)
  {
    declareRegistryImage(reg, "IMG_OBJ_API_COMPONENT", "$nl$/icons/full/obj16/api_tools.gif");
    declareRegistryImage(reg, "IMG_OBJ_API_SYSTEM_LIBRARY", "$nl$/icons/full/obj16/library_obj.gif");
    declareRegistryImage(reg, "IMG_OBJ_API_SEARCH", "$nl$/icons/full/obj16/extract_references.gif");
    declareRegistryImage(reg, "IMG_OBJ_BUNDLE", "$nl$/icons/full/obj16/plugin_obj.gif");
    declareRegistryImage(reg, "IMG_OBJ_FRAGMENT", "$nl$/icons/full/obj16/frgmt_obj.gif");
    declareRegistryImage(reg, "IMG_OBJ_ECLIPSE_PROFILE", "$nl$/icons/full/obj16/eclipse_profile.gif");
    declareRegistryImage(reg, "IMG_OBJ_BUNDLE_VERSION", "$nl$/icons/full/obj16/bundleversion.gif");
    declareRegistryImage(reg, "IMG_ELCL_SETUP_APITOOLS", "$nl$/icons/full/obj16/category_menu.gif");
    
    declareRegistryImage(reg, "IMG_OVR_ERROR", "$nl$/icons/full/ovr16/error_ovr.gif");
    declareRegistryImage(reg, "IMG_OVR_WARNING", "$nl$/icons/full/ovr16/warning_ovr.gif");
    declareRegistryImage(reg, "IMG_OVR_SUCCESS", "$nl$/icons/full/ovr16/success_ovr.gif");
    
    declareRegistryImage(reg, "IMG_WIZBAN_PROFILE", "$nl$/icons/full/wizban/profile_wiz.png");
    declareRegistryImage(reg, "IMG_WIZBAN_COMPARE_TO_BASELINE", "$nl$/icons/full/wizban/compare_wiz.png");
    
    declareRegistryImage(reg, "IMG_ELCL_FILTER", "$nl$/icons/full/elcl16/filter_ps.gif");
    declareRegistryImage(reg, "IMG_ELCL_REMOVE", "$nl$/icons/full/elcl16/remove_exc.gif");
    declareRegistryImage(reg, "IMG_ELCL_OPEN_PAGE", "$nl$/icons/full/elcl16/open_page.gif");
    declareRegistryImage(reg, "IMG_ELCL_COMPARE_APIS", "$nl$/icons/full/elcl16/compare_apis.gif");
    declareRegistryImage(reg, "IMG_ELCL_COMPARE_APIS_DISABLED", "$nl$/icons/full/dlcl16/compare_apis.gif");
    declareRegistryImage(reg, "IMG_ELCL_EXPORT", "$nl$/icons/full/elcl16/export.gif");
    declareRegistryImage(reg, "IMG_ELCL_NEXT_NAV", "$nl$/icons/full/elcl16/next_nav.gif");
    declareRegistryImage(reg, "IMG_ELCL_PREV_NAV", "$nl$/icons/full/elcl16/prev_nav.gif");
    declareRegistryImage(reg, "IMG_ELCL_EXPANDALL", "$nl$/icons/full/elcl16/expandall.gif");
    declareRegistryImage(reg, "IMG_ELCL_TEXT_EDIT", "$nl$/icons/full/elcl16/text_edit.gif");
    
    declareRegistryImage(reg, "IMG_DLCL_EXPORT", "$nl$/icons/full/dlcl16/export.gif");
    declareRegistryImage(reg, "IMG_DLCL_NEXT_NAV", "$nl$/icons/full/dlcl16/next_nav.gif");
    declareRegistryImage(reg, "IMG_DLCL_PREV_NAV", "$nl$/icons/full/dlcl16/prev_nav.gif");
    declareRegistryImage(reg, "IMG_DLCL_EXPANDALL", "$nl$/icons/full/dlcl16/expandall.gif");
  }
  
  void showAPIToolingView()
  {
    showView("org.eclipse.pde.api.tools.ui.views.apitooling.views.apitoolingview");
  }
  
  public void showPropertiesView()
  {
    showView("org.eclipse.ui.views.PropertySheet");
  }
  
  private void showView(String id)
  {
    IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
      return;
    }
    IWorkbenchPage page = window.getActivePage();
    if (page != null) {
      try
      {
        IViewPart view = page.showView(id);
        page.bringToTop(view);
      }
      catch (PartInitException e)
      {
        log(e);
      }
    }
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    ApiPlugin.getDefault().getSessionManager().addSessionListener(sessionListener);
    fActionFilterAdapterFactory = new ActionFilterAdapterFactory();
    Platform.getAdapterManager().registerAdapters(fActionFilterAdapterFactory, IJavaElement.class);
    super.start(context);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    for (Iterator iter = fCompositeImages.values().iterator(); iter.hasNext();)
    {
      Image image = (Image)iter.next();
      image.dispose();
    }
    fCompositeImages.clear();
    ApiPlugin.getDefault().getSessionManager().removeSessionListener(sessionListener);
    Platform.getAdapterManager().unregisterAdapters(fActionFilterAdapterFactory, IJavaElement.class);
    super.stop(context);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.ApiUIPlugin
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;

public class CompositeApiImageDescriptor
  extends CompositeImageDescriptor
{
  public static final int ERROR = 1;
  public static final int WARNING = 2;
  private Image fOriginalImage = null;
  private int fFlags;
  private Point fSize;
  
  public CompositeApiImageDescriptor(Image original, int flags)
  {
    fOriginalImage = original;
    fFlags = flags;
  }
  
  protected void drawCompositeImage(int width, int height)
  {
    ImageData bg = fOriginalImage.getImageData();
    if (bg == null) {
      bg = DEFAULT_IMAGE_DATA;
    }
    drawImage(bg, 0, 0);
    drawOverlays();
  }
  
  protected void drawOverlays()
  {
    drawTopRight();
  }
  
  private void drawTopRight()
  {
    Point pos = new Point(getSizex, 0);
    if ((fFlags & 0x1) != 0) {
      addTopRightImage(ApiUIPlugin.getImageDescriptor("IMG_OVR_ERROR"), pos);
    } else if ((fFlags & 0x2) != 0) {
      addTopRightImage(ApiUIPlugin.getImageDescriptor("IMG_OVR_WARNING"), pos);
    }
  }
  
  private void addTopRightImage(ImageDescriptor desc, Point pos)
  {
    ImageData data = getImageData(desc);
    int x = x - width;
    if (x >= 0)
    {
      drawImage(data, x, y);
      x = x;
    }
  }
  
  private ImageData getImageData(ImageDescriptor descriptor)
  {
    ImageData data = descriptor.getImageData();
    if (data == null) {
      data = DEFAULT_IMAGE_DATA;
    }
    return data;
  }
  
  protected Point getSize()
  {
    if (fSize == null)
    {
      ImageData data = fOriginalImage.getImageData();
      fSize = new Point(width, height);
    }
    return fSize;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof CompositeApiImageDescriptor))
    {
      CompositeApiImageDescriptor other = (CompositeApiImageDescriptor)obj;
      return (fOriginalImage.equals(fOriginalImage)) && (fFlags == fFlags);
    }
    return false;
  }
  
  public int hashCode()
  {
    return fOriginalImage.hashCode() | fFlags;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.CompositeApiImageDescriptor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

public abstract interface IApiToolsConstants
{
  public static final String EMPTY_STRING = "";
  public static final String ID_API_TOOLS_UI_PLUGIN = "org.eclipse.pde.api.tools.ui";
  public static final String ID_BASELINES_PREF_PAGE = "org.eclipse.pde.api.tools.ui.apiprofiles.prefpage";
  public static final String ID_ERRORS_WARNINGS_PREF_PAGE = "org.eclipse.pde.api.tools.ui.apitools.errorwarnings.prefpage";
  public static final String ID_ERRORS_WARNINGS_PROP_PAGE = "org.eclipse.pde.api.tools.ui.apitools.warningspage";
  public static final String ID_FILTERS_PROP_PAGE = "org.eclipse.pde.api.tools.ui.apitools.filterspage";
  public static final String IMG_ELCL_COMPARE_APIS = "IMG_ELCL_COMPARE_APIS";
  public static final String IMG_ELCL_COMPARE_APIS_DISABLED = "IMG_ELCL_COMPARE_APIS_DISABLED";
  public static final String IMG_ELCL_FILTER = "IMG_ELCL_FILTER";
  public static final String IMG_ELCL_SETUP_APITOOLS = "IMG_ELCL_SETUP_APITOOLS";
  public static final String IMG_ELCL_OPEN_PAGE = "IMG_ELCL_OPEN_PAGE";
  public static final String IMG_ELCL_REMOVE = "IMG_ELCL_REMOVE";
  public static final String IMG_ELCL_TEXT_EDIT = "IMG_ELCL_TEXT_EDIT";
  public static final String IMG_OBJ_API_COMPONENT = "IMG_OBJ_API_COMPONENT";
  public static final String IMG_OBJ_API_SEARCH = "IMG_OBJ_API_SEARCH";
  public static final String IMG_OBJ_API_SYSTEM_LIBRARY = "IMG_OBJ_API_SYSTEM_LIBRARY";
  public static final String IMG_OBJ_BUNDLE = "IMG_OBJ_BUNDLE";
  public static final String IMG_OBJ_BUNDLE_VERSION = "IMG_OBJ_BUNDLE_VERSION";
  public static final String IMG_OBJ_ECLIPSE_PROFILE = "IMG_OBJ_ECLIPSE_PROFILE";
  public static final String IMG_OBJ_FRAGMENT = "IMG_OBJ_FRAGMENT";
  public static final String IMG_OVR_ERROR = "IMG_OVR_ERROR";
  public static final String IMG_OVR_SUCCESS = "IMG_OVR_SUCCESS";
  public static final String IMG_OVR_WARNING = "IMG_OVR_WARNING";
  public static final String IMG_WIZBAN_PROFILE = "IMG_WIZBAN_PROFILE";
  public static final String IMG_WIZBAN_COMPARE_TO_BASELINE = "IMG_WIZBAN_COMPARE_TO_BASELINE";
  public static final String IMG_ELCL_EXPORT = "IMG_ELCL_EXPORT";
  public static final String IMG_DLCL_EXPORT = "IMG_DLCL_EXPORT";
  public static final String IMG_ELCL_NEXT_NAV = "IMG_ELCL_NEXT_NAV";
  public static final String IMG_ELCL_PREV_NAV = "IMG_ELCL_PREV_NAV";
  public static final String IMG_DLCL_NEXT_NAV = "IMG_DLCL_NEXT_NAV";
  public static final String IMG_DLCL_PREV_NAV = "IMG_DLCL_PREV_NAV";
  public static final String IMG_ELCL_EXPANDALL = "IMG_ELCL_EXPANDALL";
  public static final String IMG_DLCL_EXPANDALL = "IMG_DLCL_EXPANDALL";
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.IApiToolsConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

public abstract interface IApiToolsHelpContextIds
{
  public static final String PREFIX = ApiUIPlugin.getPluginIdentifier() + ".";
  public static final String APIBASELINE_PREF_PAGE = PREFIX + "apiprofiles_preference_page";
  public static final String APIPROFILES_WIZARD_PAGE = PREFIX + "apiprofiles_wizard_page";
  public static final String API_TOOLING_SETUP_WIZARD_PAGE = PREFIX + "api_tooling_setup_wizard_page";
  public static final String APITOOLS_ERROR_WARNING_PREF_PAGE = PREFIX + "apitools_error_warning_preference_page";
  public static final String APITOOLS_ERROR_WARNING_PROP_PAGE = PREFIX + "apitools_error_warning_prop_page";
  public static final String APITOOLS_PROJECT_SPECIFIC_SETTINGS_SELECTION_DIALOG = PREFIX + "project_specific_settings_selection_dialog";
  public static final String APITOOLS_FILTERS_PROPERTY_PAGE = PREFIX + "apitools_filters_property_page";
  public static final String API_COMPARE_WIZARD_PAGE = PREFIX + "api_compare_wizard_page";
  public static final String API_TOOLING_VIEW = PREFIX + "api_tooling_view";
  public static final String API_COMPARE_EXPORT_DIALOG = PREFIX + "api_compare_export_dialog";
  public static final String APITOOLS_ARCHIVE_PATTERN_WIZARD_PAGE = PREFIX + "apitools_archive_pattern_wizard_page";
  public static final String APITOOLS_REPORT_PATTERN_WIZARD_PAGE = PREFIX + "apitools_report_pattern_wizard_page";
  public static final String APITOOLS_DESCRIPTION_PATTERN_WIZARD_PAGE = PREFIX + "apitools_description_pattern_wizard_page";
  public static final String APITOOLS_PATTERN_SELECTION_WIZARD_PAGE = PREFIX + "apitools_pattern_selection_wizard_page";
  public static final String APIUSESCANS_PREF_PAGE = PREFIX + "apiusescans_preference_page";
  public static final String API_USE_PATTERN_TAB = PREFIX + "api_use_pattern_tab";
  public static final String API_USE_SCAN_TAB = PREFIX + "api_use_main_tab";
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.IApiToolsHelpContextIds
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.ui.IActionFilter;

public class JavaElementActionFilter
  implements IActionFilter
{
  public boolean testAttribute(Object target, String name, String value)
  {
    if ((name.equals("JavaElementActionFilter")) && 
      ((target instanceof IJavaElement)))
    {
      IJavaElement javaElement = (IJavaElement)target;
      if (value.equals("isEnabled"))
      {
        while (javaElement != null) {
          switch (javaElement.getElementType())
          {
          case 3: 
            IPackageFragmentRoot root = (IPackageFragmentRoot)javaElement;
            return !root.isArchive();
          case 4: 
          case 5: 
          case 6: 
          case 7: 
            javaElement = javaElement.getParent();
            break;
          case 1: 
          case 8: 
          case 9: 
          case 10: 
          case 11: 
          case 12: 
          case 13: 
          case 14: 
          case 15: 
          case 16: 
            return false;
          case 2: 
            return true;
          }
        }
        return true;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.JavaElementActionFilter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.pde.api.tools.ui.internal.messages";
  public static String ApiToolsLabelProvider_0;
  public static String ApiToolsLabelProvider_default_baseline;
  public static String ApiToolsLabelProvider_default_baseline_place_holder;
  
  static
  {
    NLS.initializeMessages("org.eclipse.pde.api.tools.ui.internal.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.Messages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.SharedScrolledComposite;

class SWTFactory$1
  extends SharedScrolledComposite
{
  SWTFactory$1(Composite $anonymous0, int $anonymous1)
  {
    super($anonymous0, $anonymous1);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.SWTFactory.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal;

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.layout.PixelConverter;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.SharedScrolledComposite;

public class SWTFactory
{
  public static int getButtonWidthHint(Button button)
  {
    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    int widthHint = converter.convertHorizontalDLUsToPixels(61);
    return Math.max(widthHint, computeSize-1-1x);
  }
  
  public static void setButtonDimensionHint(Button button)
  {
    Assert.isNotNull(button);
    Object gd = button.getLayoutData();
    if ((gd instanceof GridData))
    {
      widthHint = getButtonWidthHint(button);
      horizontalAlignment = 4;
    }
  }
  
  public static Button createCheckButton(Composite parent, String label, Image image, boolean checked, int hspan)
  {
    Button button = new Button(parent, 32);
    button.setFont(parent.getFont());
    button.setSelection(checked);
    if (image != null) {
      button.setImage(image);
    }
    if (label != null) {
      button.setText(label);
    }
    GridData gd = new GridData();
    horizontalSpan = hspan;
    button.setLayoutData(gd);
    return button;
  }
  
  public static Button createPushButton(Composite parent, String label, Image image)
  {
    Button button = new Button(parent, 8);
    button.setFont(parent.getFont());
    if (image != null) {
      button.setImage(image);
    }
    if (label != null) {
      button.setText(label);
    }
    GridData gd = new GridData();
    button.setLayoutData(gd);
    setButtonDimensionHint(button);
    return button;
  }
  
  public static Button createPushButton(Composite parent, String label, Image image, int fill)
  {
    Button button = new Button(parent, 8);
    button.setFont(parent.getFont());
    if (image != null) {
      button.setImage(image);
    }
    if (label != null) {
      button.setText(label);
    }
    GridData gd = new GridData(fill);
    button.setLayoutData(gd);
    setButtonDimensionHint(button);
    return button;
  }
  
  public static Button createRadioButton(Composite parent, String label)
  {
    Button button = new Button(parent, 16);
    button.setFont(parent.getFont());
    if (label != null) {
      button.setText(label);
    }
    GridData gd = new GridData();
    button.setLayoutData(gd);
    setButtonDimensionHint(button);
    return button;
  }
  
  public static Label createLabel(Composite parent, String text, int hspan)
  {
    Label l = new Label(parent, 0);
    l.setFont(parent.getFont());
    if (text != null) {
      l.setText(text);
    }
    GridData gd = new GridData(768);
    horizontalSpan = hspan;
    grabExcessHorizontalSpace = false;
    l.setLayoutData(gd);
    return l;
  }
  
  public static Label createLabel(Composite parent, String text, Font font, int hspan)
  {
    Label l = new Label(parent, 0);
    l.setFont(font);
    if (text != null) {
      l.setText(text);
    }
    GridData gd = new GridData(768);
    horizontalSpan = hspan;
    l.setLayoutData(gd);
    return l;
  }
  
  public static Link createLink(Composite parent, String text, Font font, int hspan)
  {
    Link l = new Link(parent, 4);
    l.setFont(font);
    l.setText(text);
    GridData gd = new GridData(1, 4, true, false, hspan, 1);
    l.setLayoutData(gd);
    return l;
  }
  
  public static Link createLink(Composite parent, String text, Font font, int hspan, int fill)
  {
    Link l = new Link(parent, 4);
    l.setFont(font);
    l.setText(text);
    GridData gd = new GridData(fill);
    horizontalSpan = hspan;
    l.setLayoutData(gd);
    return l;
  }
  
  public static Label createWrapLabel(Composite parent, String text, int hspan, int wrapwidth)
  {
    Label l = new Label(parent, 64);
    l.setFont(parent.getFont());
    if (text != null) {
      l.setText(text);
    }
    GridData gd = new GridData(768);
    horizontalSpan = hspan;
    widthHint = wrapwidth;
    l.setLayoutData(gd);
    return l;
  }
  
  public static Label createWrapLabel(Composite parent, String text, int hspan)
  {
    Label l = new Label(parent, 64);
    l.setFont(parent.getFont());
    if (text != null) {
      l.setText(text);
    }
    GridData gd = new GridData(1);
    horizontalSpan = hspan;
    l.setLayoutData(gd);
    return l;
  }
  
  public static SharedScrolledComposite createScrolledComposite(Composite parent, int columns, int hspan, int marginwidth, int marginheight)
  {
    SharedScrolledComposite comp = new SharedScrolledComposite(parent, 768) {};
    GridLayout layout = new GridLayout(columns, false);
    marginHeight = marginheight;
    marginWidth = marginwidth;
    comp.setLayout(layout);
    GridData gd = new GridData(1808);
    horizontalSpan = hspan;
    comp.setLayoutData(gd);
    comp.setExpandHorizontal(true);
    comp.setExpandVertical(true);
    return comp;
  }
  
  public static ExpandableComposite createExpandibleComposite(Composite parent, String label, int hspan, int fill)
  {
    ExpandableComposite ex = new ExpandableComposite(parent, 0, 18);
    ex.setText(label);
    ex.setFont(JFaceResources.getFontRegistry().getBold("org.eclipse.jface.dialogfont"));
    GridData gd = new GridData(fill);
    horizontalSpan = hspan;
    grabExcessHorizontalSpace = true;
    ex.setLayoutData(gd);
    return ex;
  }
  
  public static Text createSingleText(Composite parent, int hspan)
  {
    Text t = new Text(parent, 2052);
    t.setFont(parent.getFont());
    GridData gd = new GridData(768);
    horizontalSpan = hspan;
    t.setLayoutData(gd);
    return t;
  }
  
  public static Text createText(Composite parent, int style, int hspan, int fill)
  {
    Text t = new Text(parent, style);
    t.setFont(parent.getFont());
    GridData gd = new GridData(fill);
    horizontalSpan = hspan;
    t.setLayoutData(gd);
    return t;
  }
  
  public static Text createText(Composite parent, int style, int hspan)
  {
    Text t = new Text(parent, style);
    t.setFont(parent.getFont());
    GridData gd = new GridData(768);
    horizontalSpan = hspan;
    t.setLayoutData(gd);
    return t;
  }
  
  public static Text createText(Composite parent, int style, int hspan, int width, int height, int fill)
  {
    Text t = new Text(parent, style);
    t.setFont(parent.getFont());
    GridData gd = new GridData(fill);
    horizontalSpan = hspan;
    widthHint = width;
    heightHint = height;
    t.setLayoutData(gd);
    return t;
  }
  
  public static Group createGroup(Composite parent, String text, int columns, int hspan, int fill)
  {
    Group g = new Group(parent, 0);
    g.setLayout(new GridLayout(columns, false));
    g.setText(text);
    g.setFont(parent.getFont());
    GridData gd = new GridData(fill
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

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