org.eclipse.pde.ua.ui_1.0.100.v20110516

16:47:31.363 INFO  jd.cli.Main - Decompiling org.eclipse.pde.ua.ui_1.0.100.v20110516.jar
package org.eclipse.pde.internal.ua.ui;

public abstract interface IConstants
{
  public static final String COMPOSITE_CHEAT_SHEET_EDITOR_ID = "org.eclipse.pde.ua.ui.compositeCheatSheetEditor";
  public static final String SIMPLE_CHEAT_SHEET_EDITOR_ID = "org.eclipse.pde.ua.uisimpleCheatSheetEditor";
  public static final String CONTEXT_HELP_EDITOR_ID = "org.eclipse.pde.ua.ui.ctxHelpEditor";
  public static final String TABLE_OF_CONTENTS_EDITOR_ID = "org.eclipse.pde.ua.ui.tocEditor";
  public static final String SIMPLE_CHEAT_SHEET_CONTENT_ID = "org.eclipse.pde.simpleCheatSheet";
  public static final String TABLE_OF_CONTENTS_CONTENT_ID = "org.eclipse.pde.tocFile";
}

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

import java.util.List;
import org.eclipse.pde.internal.core.util.PDETextHelper;
import org.eclipse.pde.internal.ua.core.cheatsheet.simple.ISimpleCSObject;
import org.eclipse.pde.internal.ua.core.ctxhelp.text.CtxHelpObject;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSObject;
import org.eclipse.pde.internal.ua.core.toc.text.TocObject;
import org.eclipse.pde.internal.ui.util.SharedLabelProvider;
import org.eclipse.swt.graphics.Image;

public class PDEUserAssistanceLabelProvider
  extends SharedLabelProvider
{
  public String getText(Object obj)
  {
    if ((obj instanceof ISimpleCSObject)) {
      return getObjectText((ISimpleCSObject)obj);
    }
    if ((obj instanceof ICompCSObject)) {
      return getObjectText((ICompCSObject)obj);
    }
    if ((obj instanceof TocObject)) {
      return getObjectText((TocObject)obj);
    }
    if ((obj instanceof CtxHelpObject)) {
      return getObjectText((CtxHelpObject)obj);
    }
    return super.getText(obj);
  }
  
  public String getObjectText(ISimpleCSObject obj)
  {
    int limit = 50;
    if (obj.getType() == 0) {
      limit = 40;
    } else if (obj.getType() == 6) {
      limit = 36;
    } else if (obj.getType() == 5) {
      limit = 36;
    } else if (obj.getType() == 10) {
      limit = 32;
    }
    return PDETextHelper.truncateAndTrailOffText(PDETextHelper.translateReadText(obj.getName()), limit);
  }
  
  public String getObjectText(ICompCSObject obj)
  {
    int limit = 40;
    ICompCSObject parent = obj.getParent();
    while (parent != null)
    {
      limit -= 4;
      parent = parent.getParent();
    }
    return PDETextHelper.truncateAndTrailOffText(PDETextHelper.translateReadText(obj.getName()), limit);
  }
  
  public String getObjectText(TocObject obj)
  {
    return PDETextHelper.translateReadText(obj.getName());
  }
  
  public String getObjectText(CtxHelpObject obj)
  {
    return PDETextHelper.translateReadText(obj.getName());
  }
  
  public Image getImage(Object obj)
  {
    if ((obj instanceof ISimpleCSObject)) {
      return getObjectImage((ISimpleCSObject)obj);
    }
    if ((obj instanceof ICompCSObject)) {
      return getObjectImage((ICompCSObject)obj);
    }
    if ((obj instanceof TocObject)) {
      return getObjectImage((TocObject)obj);
    }
    if ((obj instanceof CtxHelpObject)) {
      return getObjectImage((CtxHelpObject)obj);
    }
    return super.getImage(obj);
  }
  
  private Image getObjectImage(ISimpleCSObject object)
  {
    if (object.getType() == 6) {
      return get(PDEUserAssistanceUIPluginImages.DESC_CSITEM_OBJ);
    }
    if (object.getType() == 10) {
      return get(PDEUserAssistanceUIPluginImages.DESC_CSSUBITEM_OBJ);
    }
    if (object.getType() == 9) {
      return get(PDEUserAssistanceUIPluginImages.DESC_CSUNSUPPORTED_OBJ);
    }
    if (object.getType() == 3) {
      return get(PDEUserAssistanceUIPluginImages.DESC_CSUNSUPPORTED_OBJ);
    }
    if (object.getType() == 0) {
      return get(PDEUserAssistanceUIPluginImages.DESC_SIMPLECS_OBJ);
    }
    if (object.getType() == 5) {
      return get(PDEUserAssistanceUIPluginImages.DESC_CSINTRO_OBJ);
    }
    if (object.getType() == 8) {
      return get(PDEUserAssistanceUIPluginImages.DESC_CSUNSUPPORTED_OBJ);
    }
    return get(PDEUserAssistanceUIPluginImages.DESC_SIMPLECS_OBJ, 1);
  }
  
  private Image getObjectImage(ICompCSObject object)
  {
    if (object.getType() == 2) {
      return get(PDEUserAssistanceUIPluginImages.DESC_SIMPLECS_OBJ);
    }
    if (object.getType() == 1) {
      return get(PDEUserAssistanceUIPluginImages.DESC_CSTASKGROUP_OBJ);
    }
    if (object.getType() == 0) {
      return get(PDEUserAssistanceUIPluginImages.DESC_COMPCS_OBJ);
    }
    return get(PDEUserAssistanceUIPluginImages.DESC_SIMPLECS_OBJ, 1);
  }
  
  private Image getObjectImage(TocObject object)
  {
    switch (object.getType())
    {
    case 0: 
      return get(PDEUserAssistanceUIPluginImages.DESC_TOC_OBJ);
    case 1: 
      if (object.getChildren().isEmpty()) {
        return get(PDEUserAssistanceUIPluginImages.DESC_TOC_LEAFTOPIC_OBJ);
      }
      return get(PDEUserAssistanceUIPluginImages.DESC_TOC_TOPIC_OBJ);
    case 3: 
      return get(PDEUserAssistanceUIPluginImages.DESC_TOC_LINK_OBJ);
    case 2: 
      return get(PDEUserAssistanceUIPluginImages.DESC_TOC_ANCHOR_OBJ);
    }
    return get(PDEUserAssistanceUIPluginImages.DESC_SIMPLECS_OBJ, 1);
  }
  
  private Image getObjectImage(CtxHelpObject object)
  {
    switch (object.getType())
    {
    case 0: 
      return get(PDEUserAssistanceUIPluginImages.DESC_TOC_OBJ);
    case 1: 
      return get(PDEUserAssistanceUIPluginImages.DESC_CTXHELP_CONTEXT_OBJ);
    case 2: 
      return get(PDEUserAssistanceUIPluginImages.DESC_CTXHELP_DESC_OBJ);
    case 3: 
      return get(PDEUserAssistanceUIPluginImages.DESC_TOC_LEAFTOPIC_OBJ);
    case 4: 
      return get(PDEUserAssistanceUIPluginImages.DESC_CTXHELP_COMMAND_OBJ);
    }
    return get(PDEUserAssistanceUIPluginImages.DESC_SIMPLECS_OBJ, 1);
  }
}

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

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;

class PDEUserAssistanceUIPlugin$1
  implements Runnable
{
  private final String val$title;
  private final IStatus val$fstatus;
  
  PDEUserAssistanceUIPlugin$1(String paramString, IStatus paramIStatus)
  {
    val$title = paramString;val$fstatus = paramIStatus;
  }
  
  public void run()
  {
    ErrorDialog.openError(null, val$title, null, val$fstatus);
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class PDEUserAssistanceUIPlugin
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.pde.ua.ui";
  private static PDEUserAssistanceUIPlugin plugin;
  private PDEUserAssistanceLabelProvider fLabelProvider;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    super.stop(context);
  }
  
  public static PDEUserAssistanceUIPlugin getDefault()
  {
    return plugin;
  }
  
  public static Shell getActiveWorkbenchShell()
  {
    IWorkbenchWindow window = getActiveWorkbenchWindow();
    if (window != null) {
      return window.getShell();
    }
    return null;
  }
  
  public static IWorkbenchWindow getActiveWorkbenchWindow()
  {
    return getDefault().getWorkbench().getActiveWorkbenchWindow();
  }
  
  public static void logException(Throwable e, String title, String message)
  {
    if ((e instanceof InvocationTargetException)) {
      e = ((InvocationTargetException)e).getTargetException();
    }
    IStatus status = null;
    if ((e instanceof CoreException))
    {
      status = ((CoreException)e).getStatus();
    }
    else
    {
      if (message == null) {
        message = e.getMessage();
      }
      if (message == null) {
        message = e.toString();
      }
      status = new Status(4, "org.eclipse.pde.ua.ui", 0, 
        message, e);
    }
    ResourcesPlugin.getPlugin().getLog().log(status);
    Display display = Display.getCurrent() == null ? Display.getCurrent() : 
      Display.getDefault();
    IStatus fstatus = status;
    display.asyncExec(new Runnable()
    {
      private final IStatus val$fstatus;
      
      public void run()
      {
        ErrorDialog.openError(null, PDEUserAssistanceUIPlugin.this, null, val$fstatus);
      }
    });
  }
  
  public static void logException(Throwable e)
  {
    logException(e, null, null);
  }
  
  public static IWorkbenchPage getActivePage()
  {
    return getActiveWorkbenchWindow().getActivePage();
  }
  
  public PDEUserAssistanceLabelProvider getLabelProvider()
  {
    if (fLabelProvider == null) {
      fLabelProvider = new PDEUserAssistanceLabelProvider();
    }
    return fLabelProvider;
  }
}

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

import java.net.URL;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;

public class PDEUserAssistanceUIPluginImages
{
  private static ImageRegistry PLUGIN_REGISTRY;
  public static final String ICONS_PATH = "icons/";
  private static final String PATH_OBJ = "icons/obj16/";
  private static final String PATH_WIZBAN = "icons/wizban/";
  public static final ImageDescriptor DESC_SIMPLECS_OBJ = create("icons/obj16/", "cheatsheet_simple_obj.gif");
  public static final ImageDescriptor DESC_COMPCS_OBJ = create("icons/obj16/", "cheatsheet_composite_obj.gif");
  public static final ImageDescriptor DESC_CSTASKGROUP_OBJ = create("icons/obj16/", "cheatsheet_taskgroup_obj.gif");
  public static final ImageDescriptor DESC_CSITEM_OBJ = create("icons/obj16/", "cheatsheet_item_obj.gif");
  public static final ImageDescriptor DESC_CSSUBITEM_OBJ = create("icons/obj16/", "cheatsheet_subitem_obj.gif");
  public static final ImageDescriptor DESC_CSINTRO_OBJ = create("icons/obj16/", "cheatsheet_intro_obj.gif");
  public static final ImageDescriptor DESC_CSCONCLUSION_OBJ = create("icons/obj16/", "cheatsheet_conclusion_obj.gif");
  public static final ImageDescriptor DESC_CSUNSUPPORTED_OBJ = create("icons/obj16/", "cheatsheet_unsupported_obj.gif");
  public static final ImageDescriptor DESC_CHEATSHEET_OBJ = create("icons/obj16/", "cheatsheet_obj.gif");
  public static final ImageDescriptor DESC_TOC_OBJ = create("icons/obj16/", "toc_obj.gif");
  public static final ImageDescriptor DESC_TOC_TOPIC_OBJ = create("icons/obj16/", "toc_topic_obj.gif");
  public static final ImageDescriptor DESC_TOC_LEAFTOPIC_OBJ = create("icons/obj16/", "toc_leaftopic_obj.gif");
  public static final ImageDescriptor DESC_TOC_LINK_OBJ = create("icons/obj16/", "toc_link_obj.gif");
  public static final ImageDescriptor DESC_TOC_ANCHOR_OBJ = create("icons/obj16/", "toc_anchor_obj.gif");
  public static final ImageDescriptor DESC_CTXHELP_CONTEXT_OBJ = create("icons/obj16/", "ctxhelp_context_obj.gif");
  public static final ImageDescriptor DESC_CTXHELP_DESC_OBJ = create("icons/obj16/", "ctxhelp_desc_obj.gif");
  public static final ImageDescriptor DESC_CTXHELP_COMMAND_OBJ = create("icons/obj16/", "ctxhelp_command_obj.gif");
  public static final ImageDescriptor DESC_CHEATSHEET_WIZ = create("icons/wizban/", "new_cheatsheet_wiz.png");
  
  private static ImageDescriptor create(String prefix, String name)
  {
    return ImageDescriptor.createFromURL(makeImageURL(prefix, name));
  }
  
  public static Image get(String key)
  {
    if (PLUGIN_REGISTRY == null) {
      initialize();
    }
    return PLUGIN_REGISTRY.get(key);
  }
  
  private static final void initialize()
  {
    PLUGIN_REGISTRY = new ImageRegistry();
  }
  
  private static URL makeImageURL(String prefix, String name)
  {
    String path = "$nl$/" + prefix + name;
    return FileLocator.find(PDEUserAssistanceUIPlugin.getDefault().getBundle(), new Path(path), null);
  }
  
  public static Image manage(String key, ImageDescriptor desc)
  {
    Image image = desc.createImage();
    PLUGIN_REGISTRY.put(key, image);
    return image;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.PDEUserAssistanceUIPluginImages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.pde.core.IModelChangedEvent;
import org.eclipse.pde.internal.ui.editor.FormLayoutFactory;
import org.eclipse.pde.internal.ui.editor.PDEDetails;
import org.eclipse.pde.internal.ui.editor.PDEFormEditor;
import org.eclipse.pde.internal.ui.editor.PDEFormPage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.IFormPart;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormToolkit;

public abstract class CSAbstractDetails
  extends PDEDetails
  implements ICSDetails
{
  private ICSMaster fMasterSection;
  private String fContextID;
  
  public CSAbstractDetails(ICSMaster masterSection, String contextID)
  {
    fMasterSection = masterSection;
    fContextID = contextID;
  }
  
  public void createContents(Composite parent)
  {
    configureParentLayout(parent);
    createDetails(parent);
    hookListeners();
  }
  
  private void configureParentLayout(Composite parent)
  {
    parent.setLayout(FormLayoutFactory.createDetailsGridLayout(false, 1));
  }
  
  public abstract void createDetails(Composite paramComposite);
  
  public abstract void updateFields();
  
  public abstract void hookListeners();
  
  public void selectionChanged(IFormPart part, ISelection selection) {}
  
  public void fireSaveNeeded()
  {
    markDirty();
    getPage().getPDEEditor().fireSaveNeeded(getContextId(), false);
  }
  
  public String getContextId()
  {
    return fContextID;
  }
  
  public PDEFormPage getPage()
  {
    return (PDEFormPage)getManagedForm().getContainer();
  }
  
  public boolean isEditable()
  {
    return fMasterSection.isEditable();
  }
  
  public void modelChanged(IModelChangedEvent event) {}
  
  public boolean isEditableElement()
  {
    return fMasterSection.isEditable();
  }
  
  public FormToolkit getToolkit()
  {
    return getManagedForm().getToolkit();
  }
  
  public ICSMaster getMasterSection()
  {
    return fMasterSection;
  }
  
  protected Object getFirstSelectedObject(ISelection selection)
  {
    IStructuredSelection structuredSel = (IStructuredSelection)selection;
    if (structuredSel == null) {
      return null;
    }
    return structuredSel.getFirstElement();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.CSAbstractDetails
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet;

import org.eclipse.jface.action.ControlContribution;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

class CSAbstractEditor$1
  extends ControlContribution
{
  final CSAbstractEditor this$0;
  
  CSAbstractEditor$1(CSAbstractEditor paramCSAbstractEditor, String $anonymous0)
  {
    super($anonymous0);this$0 = paramCSAbstractEditor;
  }
  
  protected Control createControl(Composite parent)
  {
    CSAbstractEditor.access$0(this$0, parent);
    
    CSAbstractEditor.access$1(this$0);
    return CSAbstractEditor.access$2(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.CSAbstractEditor.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet;

import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;

class CSAbstractEditor$2
  implements IHyperlinkListener
{
  final CSAbstractEditor this$0;
  
  CSAbstractEditor$2(CSAbstractEditor paramCSAbstractEditor)
  {
    this$0 = paramCSAbstractEditor;
  }
  
  public void linkActivated(HyperlinkEvent e)
  {
    CSAbstractEditor.access$3(this$0);
  }
  
  public void linkEntered(HyperlinkEvent e)
  {
    CSAbstractEditor.access$4(this$0, e.getLabel());
  }
  
  public void linkExited(HyperlinkEvent e)
  {
    CSAbstractEditor.access$5(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.CSAbstractEditor.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet;

import org.eclipse.jface.action.ControlContribution;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.pde.core.IBaseModel;
import org.eclipse.pde.core.IModel;
import org.eclipse.pde.internal.core.WorkspaceModelManager;
import org.eclipse.pde.internal.ua.ui.PDEUserAssistanceUIPlugin;
import org.eclipse.pde.internal.ua.ui.wizards.cheatsheet.RegisterCSWizard;
import org.eclipse.pde.internal.ui.editor.MultiSourceEditor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.HyperlinkGroup;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ImageHyperlink;

public abstract class CSAbstractEditor
  extends MultiSourceEditor
{
  private ImageHyperlink fImageHyperlinkRegisterCS;
  
  public void contributeToToolbar(IToolBarManager manager)
  {
    if ((WorkspaceModelManager.isPluginProject(getCommonProject())) && 
      (getAggregateModel().isEditable())) {
      manager.add(createUIControlConRegisterCS());
    }
  }
  
  private ControlContribution createUIControlConRegisterCS()
  {
    new ControlContribution("Register")
    {
      protected Control createControl(Composite parent)
      {
        CSAbstractEditor.this.createUIImageHyperlinkRegisterCS(parent);
        
        CSAbstractEditor.this.createUIListenerImageHyperlinkRegisterCS();
        return fImageHyperlinkRegisterCS;
      }
    };
  }
  
  private void createUIImageHyperlinkRegisterCS(Composite parent)
  {
    fImageHyperlinkRegisterCS = new ImageHyperlink(parent, 0);
    fImageHyperlinkRegisterCS.setText(Messages.CSAbstractEditor_register);
    fImageHyperlinkRegisterCS.setUnderlined(true);
    fImageHyperlinkRegisterCS.setForeground(getToolkit()
      .getHyperlinkGroup().getForeground());
  }
  
  private void createUIListenerImageHyperlinkRegisterCS()
  {
    fImageHyperlinkRegisterCS.addHyperlinkListener(new IHyperlinkListener()
    {
      public void linkActivated(HyperlinkEvent e)
      {
        CSAbstractEditor.this.handleLinkActivatedRegisterCS();
      }
      
      public void linkEntered(HyperlinkEvent e)
      {
        CSAbstractEditor.this.handleLinkEnteredRegisterCS(e.getLabel());
      }
      
      public void linkExited(HyperlinkEvent e)
      {
        CSAbstractEditor.this.handleLinkExitedRegisterCS();
      }
    });
  }
  
  private void handleLinkEnteredRegisterCS(String message)
  {
    fImageHyperlinkRegisterCS.setForeground(getToolkit()
      .getHyperlinkGroup().getActiveForeground());
    
    getEditorSite().getActionBars().getStatusLineManager().setMessage(
      message);
  }
  
  private void handleLinkExitedRegisterCS()
  {
    fImageHyperlinkRegisterCS.setForeground(getToolkit()
      .getHyperlinkGroup().getForeground());
    
    getEditorSite().getActionBars().getStatusLineManager().setMessage(null);
  }
  
  private void handleLinkActivatedRegisterCS()
  {
    RegisterCSWizard wizard = new RegisterCSWizard(
      (IModel)getAggregateModel());
    
    wizard.init(PlatformUI.getWorkbench(), null);
    
    WizardDialog dialog = new WizardDialog(
      PDEUserAssistanceUIPlugin.getActiveWorkbenchShell(), wizard);
    dialog.create();
    
    dialog.getShell().setSize(400, 370);
    
    dialog.open();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.CSAbstractEditor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet;

import org.eclipse.swt.widgets.Composite;

public abstract class CSAbstractSubDetails
  extends CSAbstractDetails
{
  public CSAbstractSubDetails(ICSMaster masterSection, String contextID)
  {
    super(masterSection, contextID);
  }
  
  public void createContents(Composite parent) {}
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.CSAbstractSubDetails
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet;

import org.eclipse.swt.widgets.Composite;

public abstract interface ICSDetails
{
  public abstract void createDetails(Composite paramComposite);
  
  public abstract void updateFields();
  
  public abstract void hookListeners();
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.ICSDetails
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet;

import org.eclipse.ui.forms.widgets.Section;

public abstract interface ICSMaster
{
  public abstract void updateButtons();
  
  public abstract boolean isEditable();
  
  public abstract void fireSelection();
  
  public abstract Section getSection();
  
  public abstract boolean setFormInput(Object paramObject);
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.ICSMaster
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.pde.internal.ua.ui.editor.cheatsheet.messages";
  public static String CSAbstractEditor_register;
  
  static
  {
    NLS.initializeMessages("org.eclipse.pde.internal.ua.ui.editor.cheatsheet.messages", Messages.class);
  }
}

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

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.pde.core.IModelChangedEvent;
import org.eclipse.pde.core.IModelChangedListener;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCS;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSTask;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSTaskGroup;
import org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.details.CompCSDetails;
import org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.details.CompCSTaskDetails;
import org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.details.CompCSTaskGroupDetails;
import org.eclipse.pde.internal.ui.editor.PDEFormPage;
import org.eclipse.pde.internal.ui.editor.PDEMasterDetailsBlock;
import org.eclipse.pde.internal.ui.editor.PDESection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.DetailsPart;
import org.eclipse.ui.forms.IDetailsPage;
import org.eclipse.ui.forms.IDetailsPageProvider;
import org.eclipse.ui.forms.IManagedForm;

public class CompCSBlock
  extends PDEMasterDetailsBlock
  implements IModelChangedListener, IDetailsPageProvider
{
  private CompCSMasterTreeSection fMasterSection;
  private CompCSDetails fDetails;
  private CompCSTaskGroupDetails fTaskGroupDetails;
  private CompCSTaskDetails fTaskDetails;
  
  public CompCSBlock(PDEFormPage page)
  {
    super(page);
  }
  
  protected PDESection createMasterSection(IManagedForm managedForm, Composite parent)
  {
    fMasterSection = new CompCSMasterTreeSection(getPage(), parent);
    return fMasterSection;
  }
  
  protected void registerPages(DetailsPart detailsPart)
  {
    detailsPart.setPageLimit(0);
    
    fDetails = new CompCSDetails(fMasterSection);
    detailsPart.registerPage(CompCSDetails.class, fDetails);
    
    fTaskGroupDetails = new CompCSTaskGroupDetails(fMasterSection);
    detailsPart.registerPage(CompCSTaskGroupDetails.class, fTaskGroupDetails);
    
    fTaskDetails = new CompCSTaskDetails(fMasterSection);
    detailsPart.registerPage(CompCSTaskDetails.class, fTaskDetails);
    
    detailsPart.setPageProvider(this);
  }
  
  public Object getPageKey(Object object)
  {
    if ((object instanceof ICompCS)) {
      return CompCSDetails.class;
    }
    if ((object instanceof ICompCSTaskGroup)) {
      return CompCSTaskGroupDetails.class;
    }
    if ((object instanceof ICompCSTask)) {
      return CompCSTaskDetails.class;
    }
    return object.getClass();
  }
  
  public IDetailsPage getPage(Object key)
  {
    return null;
  }
  
  public void modelChanged(IModelChangedEvent event)
  {
    if (fMasterSection != null) {
      fMasterSection.modelChanged(event);
    }
  }
  
  public CompCSMasterTreeSection getMastersSection()
  {
    return fMasterSection;
  }
  
  public ISelection getSelection()
  {
    if (fMasterSection != null) {
      return fMasterSection.getSelection();
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.CompCSBlock
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp;

import java.util.List;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSModel;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSObject;

public class CompCSContentProvider
  implements ITreeContentProvider
{
  public Object[] getChildren(Object parentElement)
  {
    if ((parentElement instanceof ICompCSModel)) {
      return new Object[] { ((ICompCSModel)parentElement).getCompCS() };
    }
    if ((parentElement instanceof ICompCSObject))
    {
      List list = ((ICompCSObject)parentElement).getChildren();
      if (list.size() > 0) {
        return list.toArray();
      }
    }
    return new Object[0];
  }
  
  public Object getParent(Object element)
  {
    if ((element instanceof ICompCSObject)) {
      return ((ICompCSObject)element).getParent();
    }
    return null;
  }
  
  public boolean hasChildren(Object element)
  {
    return getChildren(element).length > 0;
  }
  
  public Object[] getElements(Object inputElement)
  {
    return getChildren(inputElement);
  }
  
  public void dispose() {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.CompCSContentProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp;

import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.pde.internal.ua.ui.PDEUserAssistanceUIPlugin;
import org.eclipse.pde.internal.ua.ui.editor.cheatsheet.CSAbstractEditor;
import org.eclipse.pde.internal.ui.editor.ISortableContentOutlinePage;
import org.eclipse.pde.internal.ui.editor.context.InputContext;
import org.eclipse.pde.internal.ui.editor.context.InputContextManager;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.editor.IFormPage;
import org.eclipse.ui.ide.FileStoreEditorInput;

public class CompCSEditor
  extends CSAbstractEditor
{
  protected String getEditorID()
  {
    return "org.eclipse.pde.ua.ui.compositeCheatSheetEditor";
  }
  
  public boolean isSaveAsAllowed()
  {
    return true;
  }
  
  public String getContextIDForSaveAs()
  {
    return "compcs-context";
  }
  
  protected void addEditorPages()
  {
    try
    {
      addPage(new CompCSPage(this));
    }
    catch (PartInitException e)
    {
      PDEUserAssistanceUIPlugin.logException(e);
    }
  }
  
  protected ISortableContentOutlinePage createContentOutline()
  {
    return new CompCSFormOutlinePage(this);
  }
  
  protected InputContextManager createInputContextManager()
  {
    return new CompCSInputContextManager(this);
  }
  
  protected void createResourceContexts(InputContextManager contexts, IFileEditorInput input)
  {
    contexts.putContext(input, new CompCSInputContext(this, input, true));
    contexts.monitorFile(input.getFile());
  }
  
  protected void createStorageContexts(InputContextManager contexts, IStorageEditorInput input)
  {
    contexts.putContext(input, new CompCSInputContext(this, input, true));
  }
  
  protected void createSystemFileContexts(InputContextManager contexts, FileStoreEditorInput input)
  {
    try
    {
      IFileStore store = EFS.getStore(input.getURI());
      IEditorInput in = new FileStoreEditorInput(store);
      contexts.putContext(in, new CompCSInputContext(this, in, true));
    }
    catch (CoreException e)
    {
      PDEUserAssistanceUIPlugin.logException(e);
    }
  }
  
  public void editorContextAdded(InputContext context) {}
  
  protected InputContext getInputContext(Object object)
  {
    return fInputContextManager.findContext("compcs-context");
  }
  
  public void contextRemoved(InputContext context)
  {
    close(false);
  }
  
  public void monitoredFileAdded(IFile monitoredFile) {}
  
  public boolean monitoredFileRemoved(IFile monitoredFile)
  {
    return true;
  }
  
  public ISelection getSelection()
  {
    IFormPage formPage = getActivePageInstance();
    if ((formPage != null) && ((formPage instanceof CompCSPage))) {
      return ((CompCSPage)formPage).getSelection();
    }
    return super.getSelection();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.CompCSEditor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp;

import org.eclipse.pde.internal.ui.editor.PDEFormEditorContributor;

public class CompCSEditorContributor
  extends PDEFormEditorContributor
{
  public CompCSEditorContributor()
  {
    super("compCSEditor");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.CompCSEditorContributor
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.pde.internal.ua.ui.PDEUserAssistanceUIPlugin;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;

public class CompCSFileValidator
  implements ISelectionStatusValidator
{
  public IStatus validate(Object[] selection)
  {
    if (selection.length == 0) {
      return errorStatus("");
    }
    if (!(selection[0] instanceof IFile)) {
      return errorStatus("");
    }
    IFile file = (IFile)selection[0];
    if (!isSimpleCSFile(file)) {
      return errorStatus(Messages.CompCSFileValidator_0);
    }
    return okStatus("");
  }
  
  private boolean isSimpleCSFile(IFile file)
  {
    try
    {
      IContentDescription description = file.getContentDescription();
      IContentType type = description.getContentType();
      return type.getId().equalsIgnoreCase(
        "org.eclipse.pde.simpleCheatSheet");
    }
    catch (CoreException e)
    {
      PDEUserAssistanceUIPlugin.logException(e);
    }
    return false;
  }
  
  private IStatus errorStatus(String message)
  {
    return new Status(4, "org.eclipse.pde.ua.ui", 
      4, message, null);
  }
  
  private IStatus okStatus(String message)
  {
    return new Status(0, "org.eclipse.pde.ua.ui", 
      0, message, null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.CompCSFileValidator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp;

import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSObject;
import org.eclipse.pde.internal.ui.editor.FormOutlinePage.BasicLabelProvider;

class CompCSFormOutlinePage$CompCSLabelProvider
  extends FormOutlinePage.BasicLabelProvider
{
  final CompCSFormOutlinePage this$0;
  
  public CompCSFormOutlinePage$CompCSLabelProvider(CompCSFormOutlinePage paramCompCSFormOutlinePage, ILabelProvider ilp)
  {
    super(paramCompCSFormOutlinePage, ilp);
    this$0 = paramCompCSFormOutlinePage;
  }
  
  public String getText(Object obj)
  {
    if ((obj instanceof ICompCSObject)) {
      return this$0.getObjectText((ICompCSObject)obj);
    }
    return super.getText(obj);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.CompCSFormOutlinePage.CompCSLabelProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp;

import java.util.List;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.pde.internal.core.util.PDETextHelper;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSModel;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSObject;
import org.eclipse.pde.internal.ua.ui.PDEUserAssistanceUIPlugin;
import org.eclipse.pde.internal.ui.editor.FormOutlinePage;
import org.eclipse.pde.internal.ui.editor.FormOutlinePage.BasicLabelProvider;
import org.eclipse.pde.internal.ui.editor.PDEFormEditor;

public class CompCSFormOutlinePage
  extends FormOutlinePage
{
  public CompCSFormOutlinePage(PDEFormEditor editor)
  {
    super(editor);
  }
  
  private class CompCSLabelProvider
    extends FormOutlinePage.BasicLabelProvider
  {
    public CompCSLabelProvider(ILabelProvider ilp)
    {
      super(ilp);
    }
    
    public String getText(Object obj)
    {
      if ((obj instanceof ICompCSObject)) {
        return getObjectText((ICompCSObject)obj);
      }
      return super.getText(obj);
    }
  }
  
  protected String getObjectText(ICompCSObject obj)
  {
    int limit = 50;
    if (obj.getType() == 0) {
      limit = 30;
    } else if (obj.getType() == 2) {
      limit = 26;
    } else if (obj.getType() == 1) {
      limit = 22;
    }
    return PDETextHelper.truncateAndTrailOffText(PDETextHelper.translateReadText(obj.getName()), limit);
  }
  
  protected Object[] getChildren(Object parent)
  {
    if ((parent instanceof CompCSPage))
    {
      ICompCSModel cheatsheet = (ICompCSModel)fEditor.getAggregateModel();
      if ((cheatsheet != null) && (cheatsheet.isLoaded()))
      {
        Object[] list = new Object[1];
        list[0] = cheatsheet.getCompCS();
        return list;
      }
    }
    else if ((parent instanceof ICompCSObject))
    {
      List list = ((ICompCSObject)parent).getChildren();
      if (list.size() > 0) {
        return list.toArray();
      }
    }
    return super.getChildren(parent);
  }
  
  public ILabelProvider createLabelProvider()
  {
    return new CompCSLabelProvider(PDEUserAssistanceUIPlugin.getDefault().getLabelProvider());
  }
  
  protected String getParentPageId(Object item)
  {
    return "compCSPage";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.CompCSFormOutlinePage
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp;

import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.pde.internal.core.util.PDETextHelper;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCS;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSTaskGroup;
import org.eclipse.pde.internal.ua.core.icheatsheet.comp.ICompCSTaskObject;
import org.eclipse.ui.forms.widgets.Form;

public class CompCSGroupValidator
{
  private Form fForm;
  private HashSet fGroups;
  private String fErrorCategory;
  
  public CompCSGroupValidator(ICompCS cheatsheet, Form form, String errorCategory)
  {
    fForm = form;
    fErrorCategory = errorCategory;
    
    fGroups = new HashSet();
    populateGroups(cheatsheet);
  }
  
  private void populateGroups(ICompCS cheatsheet)
  {
    if (cheatsheet.getFieldTaskObject().getType() == 1) {
      addGroup((ICompCSTaskGroup)cheatsheet.getFieldTaskObject());
    }
  }
  
  public void addGroup(ICompCSTaskGroup group)
  {
    fGroups.add(group);
    if (!group.hasFieldTaskObjects()) {
      return;
    }
    ICompCSTaskObject[] taskObjects = group.getFieldTaskObjects();
    for (int i = 0; i < taskObjects.length; i++) {
      if (taskObjects[i].getType() == 1) {
        addGroup((ICompCSTaskGroup)taskObjects[i]);
      }
    }
  }
  
  public void removeGroup(ICompCSTaskGroup group)
  {
    fGroups.remove(group);
    if (!group.hasFieldTaskObjects()) {
      return;
    }
    ICompCSTaskObject[] taskObjects = group.getFieldTaskObjects();
    for (int i = 0; i < taskObjects.length; i++) {
      if (taskObjects[i].getType() == 1) {
        removeGroup((ICompCSTaskGroup)taskObjects[i]);
      }
    }
  }
  
  public boolean validate()
  {
    if (fGroups.isEmpty())
    {
      fForm.setMessage(null);
      return true;
    }
    Iterator iterator = fGroups.iterator();
    while (iterator.hasNext())
    {
      ICompCSTaskGroup group = (ICompCSTaskGroup)iterator.next();
      if (!validate(group)) {
        return false;
      }
    }
    fForm.setMessage(null);
    return true;
  }
  
  private boolean validate(ICompCSTaskGroup group)
  {
    if (group.getFieldTaskObjectCount() == 0)
    {
      String message = '[' + fErrorCategory + ']' + ' ' + PDETextHelper.translateReadText(group.getFieldName()) + ':' + ' ' + Messages.CompCSGroupValidator_errorChildlessGroup;
      fForm.setMessage(message, 1);
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp.CompCSGroupValidator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.ua.ui.editor.cheatsheet.comp;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ISto
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

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