universal

16:53:49.453 INFO  jd.cli.Main - Decompiling universal.jar
package org.eclipse.ui.internal.intro.universal;

import java.io.PrintWriter;

public abstract class BaseData
{
  private GroupData parent;
  protected String id;
  
  protected void setParent(GroupData gd)
  {
    parent = gd;
  }
  
  public GroupData getParent()
  {
    return parent;
  }
  
  public abstract void write(PrintWriter paramPrintWriter, String paramString);
  
  public String getId()
  {
    return id;
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;

class CustomizationContentsArea$1
  extends SelectionAdapter
{
  final CustomizationContentsArea this$0;
  
  CustomizationContentsArea$1(CustomizationContentsArea paramCustomizationContentsArea)
  {
    this$0 = paramCustomizationContentsArea;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    TabItem[] selection = CustomizationContentsArea.access$11(this$0).getSelection();
    CustomizationContentsArea.access$12(this$0, selection[0]);
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TableViewer;

class CustomizationContentsArea$10
  extends Action
{
  final CustomizationContentsArea this$0;
  private final TableViewer val$viewer;
  
  CustomizationContentsArea$10(CustomizationContentsArea paramCustomizationContentsArea, String $anonymous0, TableViewer paramTableViewer)
  {
    super($anonymous0);this$0 = paramCustomizationContentsArea;val$viewer = paramTableViewer;
  }
  
  public void run()
  {
    CustomizationContentsArea.access$22(this$0, val$viewer, true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.10
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TableViewer;

class CustomizationContentsArea$11
  extends Action
{
  final CustomizationContentsArea this$0;
  private final TableViewer val$viewer;
  
  CustomizationContentsArea$11(CustomizationContentsArea paramCustomizationContentsArea, String $anonymous0, TableViewer paramTableViewer)
  {
    super($anonymous0);this$0 = paramCustomizationContentsArea;val$viewer = paramTableViewer;
  }
  
  public void run()
  {
    CustomizationContentsArea.access$22(this$0, val$viewer, false);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.11
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TableViewer;

class CustomizationContentsArea$12
  extends Action
{
  final CustomizationContentsArea this$0;
  private final TableViewer val$viewer;
  
  CustomizationContentsArea$12(CustomizationContentsArea paramCustomizationContentsArea, String $anonymous0, TableViewer paramTableViewer)
  {
    super($anonymous0);this$0 = paramCustomizationContentsArea;val$viewer = paramTableViewer;
  }
  
  public void run()
  {
    CustomizationContentsArea.access$23(this$0, val$viewer);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.12
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TableViewer;

class CustomizationContentsArea$13
  extends Action
{
  final CustomizationContentsArea this$0;
  private final TableViewer val$source;
  private final TableViewer val$target;
  
  CustomizationContentsArea$13(CustomizationContentsArea paramCustomizationContentsArea, String $anonymous0, TableViewer paramTableViewer1, TableViewer paramTableViewer2)
  {
    super($anonymous0);this$0 = paramCustomizationContentsArea;val$source = paramTableViewer1;val$target = paramTableViewer2;
  }
  
  public void run()
  {
    CustomizationContentsArea.access$24(this$0, val$source, val$target);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.13
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

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

class CustomizationContentsArea$2
  extends SelectionAdapter
{
  final CustomizationContentsArea this$0;
  
  CustomizationContentsArea$2(CustomizationContentsArea paramCustomizationContentsArea)
  {
    this$0 = paramCustomizationContentsArea;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    CustomizationContentsArea.access$13(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

class CustomizationContentsArea$3
  implements Runnable
{
  final CustomizationContentsArea this$0;
  
  CustomizationContentsArea$3(CustomizationContentsArea paramCustomizationContentsArea)
  {
    this$0 = paramCustomizationContentsArea;
  }
  
  public void run()
  {
    CustomizationContentsArea.access$14(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Canvas;

class CustomizationContentsArea$4
  implements ISelectionChangedListener
{
  final CustomizationContentsArea this$0;
  
  CustomizationContentsArea$4(CustomizationContentsArea paramCustomizationContentsArea)
  {
    this$0 = paramCustomizationContentsArea;
  }
  
  public void selectionChanged(SelectionChangedEvent e)
  {
    Object sel = ((StructuredSelection)e.getSelection()).getFirstElement();
    CustomizationContentsArea.access$15(this$0, (CustomizationContentsArea.IntroTheme)sel);
    CustomizationContentsArea.access$16(this$0).redraw();
    CustomizationContentsArea.access$17(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

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 CustomizationContentsArea$5
  implements PaintListener
{
  final CustomizationContentsArea this$0;
  
  CustomizationContentsArea$5(CustomizationContentsArea paramCustomizationContentsArea)
  {
    this$0 = paramCustomizationContentsArea;
  }
  
  public void paintControl(PaintEvent e)
  {
    if (CustomizationContentsArea.access$18(this$0) == null) {
      return;
    }
    Image bgImage = CustomizationContentsArea.access$18(this$0).getPreviewImage();
    if (bgImage == null) {
      return;
    }
    Rectangle ibounds = bgImage.getBounds();
    gc.drawImage(bgImage, 0, 0, width, height, 10, 10, 160, 120);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.5
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;

class CustomizationContentsArea$6
  implements ICheckStateListener
{
  final CustomizationContentsArea this$0;
  
  CustomizationContentsArea$6(CustomizationContentsArea paramCustomizationContentsArea)
  {
    this$0 = paramCustomizationContentsArea;
  }
  
  public void checkStateChanged(CheckStateChangedEvent event)
  {
    CustomizationContentsArea.RootPage page = (CustomizationContentsArea.RootPage)event.getElement();
    boolean checked = event.getChecked();
    CustomizationContentsArea.access$19(this$0, id, checked);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.6
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.TableViewer;

class CustomizationContentsArea$7
  implements IMenuListener
{
  final CustomizationContentsArea this$0;
  private final TableViewer val$viewer;
  
  CustomizationContentsArea$7(CustomizationContentsArea paramCustomizationContentsArea, TableViewer paramTableViewer)
  {
    this$0 = paramCustomizationContentsArea;val$viewer = paramTableViewer;
  }
  
  public void menuAboutToShow(IMenuManager manager)
  {
    CustomizationContentsArea.access$20(this$0, manager, val$viewer);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.7
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.TableItem;

class CustomizationContentsArea$8
  implements ICellModifier
{
  final CustomizationContentsArea this$0;
  private final TableViewer val$viewer;
  
  CustomizationContentsArea$8(CustomizationContentsArea paramCustomizationContentsArea, TableViewer paramTableViewer)
  {
    this$0 = paramCustomizationContentsArea;val$viewer = paramTableViewer;
  }
  
  public boolean canModify(Object element, String property)
  {
    return property.equals("importance");
  }
  
  public Object getValue(Object element, String property)
  {
    if ((element instanceof ExtensionData))
    {
      ExtensionData ed = (ExtensionData)element;
      if (property.equals("importance")) {
        return new Integer(ed.getImportance());
      }
    }
    return null;
  }
  
  public void modify(Object element, String property, Object value)
  {
    Integer ivalue = (Integer)value;
    TableItem item = (TableItem)element;
    ExtensionData ed = (ExtensionData)item.getData();
    ed.setImportance(ivalue.intValue());
    val$viewer.update(ed, new String[] { "importance" });
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.8
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TableViewer;

class CustomizationContentsArea$9
  extends Action
{
  final CustomizationContentsArea this$0;
  private final TableViewer val$viewer;
  
  CustomizationContentsArea$9(CustomizationContentsArea paramCustomizationContentsArea, String $anonymous0, TableViewer paramTableViewer)
  {
    super($anonymous0);this$0 = paramCustomizationContentsArea;val$viewer = paramTableViewer;
  }
  
  public void run()
  {
    CustomizationContentsArea.access$21(this$0, val$viewer);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.9
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.internal.intro.universal.util.ImageUtil;
import org.osgi.framework.Bundle;

class CustomizationContentsArea$IntroTheme
{
  IConfigurationElement element;
  Image previewImage;
  final CustomizationContentsArea this$0;
  
  public String getName()
  {
    return element.getAttribute("name");
  }
  
  public String getId()
  {
    return element.getAttribute("id");
  }
  
  public boolean isScalable()
  {
    return "true".equals(element.getAttribute("scalable"));
  }
  
  public CustomizationContentsArea$IntroTheme(CustomizationContentsArea paramCustomizationContentsArea, IConfigurationElement element)
  {
    this$0 = paramCustomizationContentsArea;
    this.element = element;
  }
  
  public Image getPreviewImage()
  {
    if (previewImage == null)
    {
      String path = element.getAttribute("previewImage");
      if (path != null)
      {
        String bid = element.getDeclaringExtension().getNamespaceIdentifier();
        Bundle bundle = Platform.getBundle(bid);
        if (bundle != null)
        {
          ImageDescriptor desc = ImageUtil.createImageDescriptor(bundle, path);
          previewImage = desc.createImage();
        }
      }
    }
    return previewImage;
  }
  
  public void dispose()
  {
    if (previewImage != null)
    {
      previewImage.dispose();
      previewImage = null;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.IntroTheme
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

class CustomizationContentsArea$RootPage
{
  public String id;
  public String name;
  public String nameNoMnemonic;
  
  public CustomizationContentsArea$RootPage(String id, String name, String nameNoMnemonic)
  {
    this.id = id;
    this.name = name;
    this.nameNoMnemonic = nameNoMnemonic;
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getNameNoMnemonic()
  {
    return nameNoMnemonic;
  }
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if ((obj instanceof RootPage))
    {
      RootPage page = (RootPage)obj;
      return (id.equals(id)) && (name.equals(name));
    }
    return false;
  }
  
  public String toString()
  {
    return name;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.RootPage
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import java.util.ArrayList;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;

class CustomizationContentsArea$TableContentProvider
  implements IStructuredContentProvider
{
  final CustomizationContentsArea this$0;
  
  CustomizationContentsArea$TableContentProvider(CustomizationContentsArea paramCustomizationContentsArea)
  {
    this$0 = paramCustomizationContentsArea;
  }
  
  public Object[] getElements(Object inputElement)
  {
    if (inputElement == CustomizationContentsArea.access$0()) {
      return CustomizationContentsArea.access$0();
    }
    if ((inputElement instanceof GroupData)) {
      return ((GroupData)inputElement).getChildren();
    }
    if (inputElement == CustomizationContentsArea.access$1(this$0)) {
      return CustomizationContentsArea.access$2(this$0).toArray();
    }
    return new Object[0];
  }
  
  public void dispose() {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.TableContentProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import java.util.Iterator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.DragSourceListener;

class CustomizationContentsArea$TableDragSourceListener
  implements DragSourceListener
{
  TableViewer viewer;
  BaseData[] sel;
  final CustomizationContentsArea this$0;
  
  public CustomizationContentsArea$TableDragSourceListener(CustomizationContentsArea paramCustomizationContentsArea, TableViewer viewer)
  {
    this$0 = paramCustomizationContentsArea;
    this.viewer = viewer;
  }
  
  public void dragStart(DragSourceEvent event)
  {
    IStructuredSelection ssel = (IStructuredSelection)viewer.getSelection();
    if (ssel.size() > 0) {
      doit = true;
    } else {
      doit = false;
    }
  }
  
  public void dragSetData(DragSourceEvent event)
  {
    IStructuredSelection ssel = (IStructuredSelection)viewer.getSelection();
    BaseData[] array = new BaseData[ssel.size()];
    int i = 0;
    for (Iterator iter = ssel.iterator(); iter.hasNext();) {
      array[(i++)] = ((BaseData)iter.next());
    }
    data = array;
    sel = array;
  }
  
  public void dragFinished(DragSourceEvent event)
  {
    if (detail == 2)
    {
      GroupData gd = (GroupData)viewer.getInput();
      for (int i = 0; i < sel.length; i++)
      {
        BaseData ed = sel[i];
        gd.remove(ed);
      }
      viewer.refresh();
      CustomizationContentsArea.access$3(this$0, viewer);
    }
    sel = null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.TableDragSourceListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.TransferData;

class CustomizationContentsArea$TableDropTargetListener
  extends ViewerDropAdapter
{
  final CustomizationContentsArea this$0;
  
  public CustomizationContentsArea$TableDropTargetListener(CustomizationContentsArea paramCustomizationContentsArea, TableViewer viewer)
  {
    super(viewer);
    this$0 = paramCustomizationContentsArea;
  }
  
  public boolean performDrop(Object data)
  {
    BaseData target = (BaseData)getCurrentTarget();
    int loc = getCurrentLocation();
    GroupData gd = (GroupData)getViewer().getInput();
    if (gd == null) {
      gd = CustomizationContentsArea.access$4(this$0, getViewer());
    }
    BaseData[] sel = (BaseData[])data;
    
    int index = target != null ? gd.getIndexOf(target) : -1;
    int startingIndex = getStartIndex(gd, sel);
    if (target != null) {
      if ((loc == 2) || (
        (loc == 3) && (startingIndex != -1) && (startingIndex < index))) {
        index++;
      } else if ((index > 0) && (loc == 1)) {
        index--;
      }
    }
    for (int i = 0; i < sel.length; i++)
    {
      BaseData ed = sel[i];
      if (index == -1) {
        gd.add(ed);
      } else {
        gd.add(index++, ed);
      }
    }
    if (getViewer().getInput() != null) {
      getViewer().refresh();
    } else {
      getViewer().setInput(gd);
    }
    CustomizationContentsArea.access$3(this$0, (TableViewer)getViewer());
    return true;
  }
  
  private int getStartIndex(GroupData gd, BaseData[] sel)
  {
    for (int i = 0; i < sel.length; i++)
    {
      BaseData ed = sel[i];
      int index = gd.getIndexOf(ed.getId());
      if (index != -1) {
        return index;
      }
    }
    return -1;
  }
  
  public boolean validateDrop(Object target, int operation, TransferData transferType)
  {
    return ExtensionDataTransfer.getInstance().isSupportedType(transferType);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.TableDropTargetListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

class CustomizationContentsArea$TableLabelProvider
  extends LabelProvider
  implements ITableLabelProvider
{
  final CustomizationContentsArea this$0;
  
  CustomizationContentsArea$TableLabelProvider(CustomizationContentsArea paramCustomizationContentsArea)
  {
    this$0 = paramCustomizationContentsArea;
  }
  
  public String getText(Object obj)
  {
    if ((obj instanceof CustomizationContentsArea.RootPage)) {
      return ((CustomizationContentsArea.RootPage)obj).getNameNoMnemonic();
    }
    if ((obj instanceof ExtensionData))
    {
      ExtensionData ed = (ExtensionData)obj;
      String name = ed.getName();
      if ((name != null) && (name.length() > 0)) {
        return name;
      }
      return ed.getId();
    }
    if ((obj instanceof SeparatorData)) {
      return Messages.WelcomeCustomizationPreferencePage_horizontalSeparator;
    }
    if ((obj instanceof CustomizationContentsArea.IntroTheme))
    {
      CustomizationContentsArea.IntroTheme bg = (CustomizationContentsArea.IntroTheme)obj;
      return bg.getName();
    }
    return super.getText(obj);
  }
  
  public Image getImage(Object obj)
  {
    if ((obj instanceof ExtensionData))
    {
      ExtensionData ed = (ExtensionData)obj;
      switch (ed.getImportance())
      {
      case 3: 
        return CustomizationContentsArea.access$5(this$0);
      case 1: 
        return CustomizationContentsArea.access$6(this$0);
      case 4: 
        return CustomizationContentsArea.access$7(this$0);
      case 0: 
        return CustomizationContentsArea.access$8(this$0);
      }
      return CustomizationContentsArea.access$9(this$0);
    }
    if ((obj instanceof CustomizationContentsArea.IntroTheme)) {
      return CustomizationContentsArea.access$10(this$0);
    }
    return null;
  }
  
  public Image getColumnImage(Object element, int columnIndex)
  {
    if (columnIndex == 0) {
      return getImage(element);
    }
    return null;
  }
  
  public String getColumnText(Object element, int columnIndex)
  {
    if ((columnIndex == 1) || ((element instanceof CustomizationContentsArea.IntroTheme)) || ((element instanceof CustomizationContentsArea.RootPage))) {
      return getText(element);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ui.internal.intro.universal.CustomizationContentsArea.TableLabelProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ui.internal.intro.universal;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IProduct;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.DragSourceListener;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
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.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.internal.intro.impl.FontSelection;
import org.eclipse.ui.internal.intro.impl.IntroPlugin;
import org.eclipse.ui.internal.intro.impl.model.IntroModelRoot;
import org.eclipse.ui.internal.intro.universal.util.BundleUtil;
import org.eclipse.ui.internal.intro.universal.util.ImageUtil;
import org.eclipse.ui.internal.intro.universal.util.Log;
import org.eclipse.ui.intro.IIntroManager;
import org.eclipse.ui.intro.IIntroPart;
import org.eclipse.ui.intro.IIntroSite;
import org.eclipse.ui.intro.config.CustomizableIntroPart;
import org.eclipse.ui.intro.config.IIntroURL;
import org.eclipse.ui.intro.config.IntroURLFactory;
import org.osgi.framework.Bundle;
import org.osgi.service.prefs.BackingStoreException;

public class CustomizationContentsArea
{
  private static final String INTRO_ROOT_PAGES = "INTRO_ROOT_PAGES";
  private static final String INTRO_DATA = "INTRO_DATA";
  private static final String INTRO_THEME = "INTRO_THEME";
  private static final String NO_ROOT_PAGES = "no_root_pages";
  private TabFolder tabFolder;
  private String firstPageId;
  private Composite pageContainer;
  private TableViewer themes;
  private TableViewer available;
  private TableViewer topLeft;
  private TableViewer topRight;
  private TableViewer bottomLeft;
  private TableViewer bottomRight;
  private CheckboxTableViewer rootPages;
  private ArrayList introRootPages = new ArrayList();
  private ArrayList themeList = new ArrayList();
  private IntroTheme introTheme;
  private String introThemeId;
  private IntroData introData;
  private Canvas themePreview;
  private TableContentProvider contentProvider;
  private TableLabelProvider labelProvider;
  private Button applyToAll;
  private Button useRelativeFonts;
  private Image extensionImage;
  private Image themeImage;
  private Image ihighImage;
  private Image ilowImage;
  private Image inewImage;
  private Image icalloutImage;
  private Shell shell;
  private static final Transfer[] TRANSFER_TYPES = { ExtensionDataTransfer.getInstance() };
  private static final RootPage[] ROOT_PAGE_TABLE = {
    new RootPage("overview", 
    Messages.WelcomeCustomizationPreferencePage_overview, 
    Messages.WelcomeCustomizationPreferencePage_NoMnemonic_overview), 
    new RootPage("firststeps", 
    Messages.WelcomeCustomizationPreferencePage_firststeps, 
    Messages.WelcomeCustomizationPreferencePage_NoMnemonic_firststeps), 
    new RootPage("tutorials", 
    Messages.WelcomeCustomizationPreferencePage_tutorials, 
    Messages.WelcomeCustomizationPreferencePage_NoMnemonic_tutorials), 
    new RootPage("samples", 
    Messages.WelcomeCustomizationPreferencePage_samples, 
    Messages.WelcomeCustomizationPreferencePage_NoMnemonic_samples), 
    new RootPage("whatsnew", 
    Messages.WelcomeCustomizationPreferencePage_whatsnew, 
    Messages.WelcomeCustomizationPreferencePage_NoMnemonic_whatsnew), 
    new RootPage("webresources", 
    Messages.WelcomeCustomizationPreferencePage_webresources, 
    Messages.WelcomeCustomizationPreferencePage_NoMnemonic_webresources), 
    new RootPage("migrate", 
    Messages.WelcomeCustomizationPreferencePage_migrate, 
    Messages.WelcomeCustomizationPreferencePage_NoMnemonic_migrate) };
  
  static class RootPage
  {
    public String id;
    public String name;
    public String nameNoMnemonic;
    
    public RootPage(String id, String name, String nameNoMnemonic)
    {
      this.id = id;
      this.name = name;
      this.nameNoMnemonic = nameNoMnemonic;
    }
    
    public String getName()
    {
      return name;
    }
    
    public String getNameNoMnemonic()
    {
      return nameNoMnemonic;
    }
    
    public boolean equals(Object obj)
    {
      if (obj == this) {
        return true;
      }
      if (obj == null) {
        return false;
      }
      if ((obj instanceof RootPage))
      {
        RootPage page = (RootPage)obj;
        return (id.equals(id)) && (name.equals(name));
      }
      return false;
    }
    
    public String toString()
    {
      return name;
    }
  }
  
  class TableContentProvider
    implements IStructuredContentProvider
  {
    TableContentProvider() {}
    
    public Object[] getElements(Object inputElement)
    {
      if (inputElement == CustomizationContentsArea.ROOT_PAGE_TABLE) {
        return CustomizationContentsArea.ROOT_PAGE_TABLE;
      }
      if ((inputElement instanceof GroupData)) {
        return ((GroupData)inputElement).getChildren();
      }
      if (inputElement == themes) {
        return themeList.toArray();
      }
      return new Object[0];
    }
    
    public void dispose() {}
    
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
  }
  
  class TableDragSourceListener
    implements DragSourceListener
  {
    TableViewer viewer;
    BaseData[] sel;
    
    public TableDragSourceListener(TableViewer viewer)
    {
      this.viewer = viewer;
    }
    
    public void dragStart(DragSourceEvent event)
    {
      IStructuredSelection ssel = (IStructuredSelection)viewer.getSelection();
      if (ssel.size() > 0) {
        doit = true;
      } else {
        doit = false;
      }
    }
    
    public void dragSetData(DragSourceEvent event)
    {
      IStructuredSelection ssel = (IStructuredSelection)viewer.getSelection();
      BaseData[] array = new BaseData[ssel.size()];
      int i = 0;
      for (Iterator iter = ssel.iterator(); iter.hasNext();) {
        array[(i++)] = ((BaseData)iter.next());
      }
      data = array;
      sel = array;
    }
    
    public void dragFinished(DragSourceEvent event)
    {
      if (detail == 2)
      {
        GroupData gd = (GroupData)viewer.getInput();
        for (int i = 0; i < sel.length; i++)
        {
          BaseData ed = sel[i];
          gd.remove(ed);
        }
        viewer.refresh();
        CustomizationContentsArea.this.updateColumnSizes(viewer);
      }
      sel = null;
    }
  }
  
  class TableDropTargetListener
    extends ViewerDropAdapter
  {
    public TableDropTargetListener(TableViewer viewer)
    {
      super();
    }
    
    public boolean performDrop(Object data)
    {
      BaseData target = (BaseData)getCurrentTarget();
      int loc = getCurrentLocation();
      GroupData gd = (GroupData)getViewer().getInput();
      if (gd == null) {
        gd = CustomizationContentsArea.this.createTargetGd(getViewer());
      }
      BaseData[] sel = (BaseData[])data;
      
      int index = target != null ? gd.getIndexOf(target) : -1;
      int startingIndex = getStartIndex(gd, sel);
      if (target != null) {
        if ((loc == 2) || (
          (loc == 3) && (startingIndex != -1) && (startingIndex < index))) {
          index++;
        } else if ((index > 0) && (loc == 1)) {
          index--;
        }
      }
      for (int i = 0; i < sel.length; i++)
      {
        BaseData ed = sel[i];
        if (index == -1) {
          gd.add(ed);
        } else {
          gd.add(index++, ed);
        }
      }
      if (getViewer().getInput() != null) {
        getViewer().refresh();
      } else {
        getViewer().setInput(gd);
      }
      CustomizationContentsArea.this.updateColumnSizes((TableViewer)getViewer());
      return true;
    }
    
    private int getStartIndex(GroupData gd, BaseData[] sel)
    {
      for (int i = 0; i < sel.length; i++)
      {
        BaseData ed = sel[i];
        int index = gd.getIndexOf(ed.getId());
        if (index != -1) {
          return index;
        }
      }
      return -1;
    }
    
    public boolean validateDrop(Object target, int operation, TransferData transferType)
    {
      return ExtensionDataTransfer.getInstance().isSupportedType(transferType);
    }
  }
  
  class TableLabelProvider
    extends LabelProvider
    implements ITableLabelProvider
  {
    TableLabelProvider() {}
    
    public String getText(Object obj)
    {
      if ((obj instanceof CustomizationContentsArea.RootPage)) {
        return ((CustomizationContentsArea.RootPage)obj).getNameNoMnemonic();
      }
      if ((obj instanceof ExtensionData))
      {
        ExtensionData ed = (ExtensionData)obj;
        String name = ed.getName();
        if ((name != null) && (name.length() > 0)) {
          return name;
        }
        return ed.getId();
      }
      if ((obj instanceof SeparatorData)) {
        return Messages.WelcomeCustomizationPreferencePage_horizontalSeparator;
      }
      if ((obj instanceof CustomizationContentsArea.IntroTheme))
      {
        CustomizationContentsArea.IntroTheme bg = (CustomizationContentsArea.IntroTheme)obj;
        return bg.getName();
      }
      return super.getText(obj);
    }
    
    public Image getImage(Object obj)
    {
      if ((obj instanceof ExtensionData))
      {
        ExtensionData ed = (ExtensionData)obj;
        switch (ed.getImportance())
        {
        case 3: 
          return ihighImage;
        case 1: 
          return ilowImage;
        case 4: 
          return inewImage;
        case 0: 
          return icalloutImage;
        }
        return extensionImage;
      }
      if ((obj instanceof CustomizationContentsArea.IntroTheme)) {
        return themeImage;
      }
      return null;
    }
    
    public Image getColumnImage(Object element, int columnIndex)
    {
      if (columnIndex == 0) {
        return getImage(element);
      }
      return null;
    }
    
    public String getColumnText(Object element, int columnIndex)
    {
      if ((columnIndex == 1) || ((element instanceof CustomizationContentsArea.IntroTheme)) || ((element instanceof CustomizationContentsArea.RootPage))) {
        return getText(element);
      }
      return null;
    }
  }
  
  class IntroTheme
  {
    IConfigurationElement element;
    Image previewImage;
    
    public String getName()
    {
      return element.getAttribute("name");
    }
    
    public String getId()
    {
      return element.getAttribute("id");
    }
    
    public boolean isScalable()
    {
      return "true".equals(element.getAttribute("scalable"));
    }
    
    public IntroTheme(IConfigurationElement element)
    {
      this.element = element;
    }
    
    public Image getPreviewImage()
    {
      if (previewImage == null)
      {
        String path = element.getAttribute("previewImage");
        if (path != null)
        {
          String bid = element.getDeclaringExtension().getNamespaceIdentifier();
          Bundle bundle = Platform.getBundle(bid);
          if (bundle != null)
          {
            ImageDescriptor desc = ImageUtil.createImageDescriptor(bundle, path);
            previewImage = desc.createImage();
          }
        }
      }
      return previewImage;
    }
    
    public void dispose()
    {
      if (previewImage != null)
      {
        previewImage.dispose();
        previewImage = null;
      }
    }
  }
  
  protected Control createContents(Composite parent)
  {
    Composite container = new Composite(parent, 0);
    GridData data = new GridData();
    verticalAlignment = 4;
    horizontalAlignment = 4;
    container.setLayoutData(data);
    GridLayout layout = new GridLayout();
    marginHeight = 0;
    marginWidth = 0;
    container.setLayout(layout);
    tabFolder = new TabFolder(container, 128);
    tabFolder.setLayoutData(new GridData(1808));
    tabFolder.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        TabItem[] selection = tabFolder.getSelection();
        CustomizationContentsArea.this.onTabChange(selection[0]);
      }
    });
    useRelativeFonts = new Button(container, 32);
    useRelativeFonts.setText(Messages.WelcomeCustomizationPreferencePage_useRelative);
    applyToAll = new Button(container, 32);
    applyToAll.setText(Messages.WelcomeCustomizationPreferencePage_applyToAll);
    contentProvider = new TableContentProvider();
    labelProvider = new TableLabelProvider();
    if (isCustomizationMode())
    {
      Button serialize = new Button(container, 8);
      serialize.setText(Messages.WelcomeCustomizationPreferencePage_serialize);
      serialize.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          CustomizationContentsArea.this.doSerializeState();
        }
      });
    }
    extensionImage = ImageUtil.createImage("full/obj16/extension_obj.gif");
    ihighImage = ImageUtil.createImage("full/obj16/ihigh_obj.gif");
    ilowImage = ImageUtil.createImage("full/obj16/ilow_obj.gif");
    inewImage = ImageUtil.createImage("full/obj16/inew_obj.gif");
    icalloutImage = ImageUtil.createImage("full/obj16/icallout_obj.gif");
    themeImage = ImageUtil.createImage("full/obj16/image_obj.gif");
    addPages();
    Dialog.applyDialogFont(container);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.eclipse.ui.intro.universal.universalWelcomePreference");
    return container;
  }
  
  private void doSerializeState()
  {
    FileDialog fd = new FileDialog(shell, 8192);
    fd.setText(Messages.WelcomeCustomizationPreferencePage_serializeTitle);
    String fileName = fd.open();
    if (fileName != null) {
      try
      {
        FileWriter writer = new FileWriter(fileName);
        PrintWriter pwriter = new PrintWriter(writer);
        introData.write(pwriter);
        pwriter.close();
      }
      catch (IOException e)
      {
        Log.error("Error while saving the intro data file", e);
      }
    }
  }
  
  private boolean isCustomizationMode()
  {
    return true;
  }
  
  public void init(IWorkbench workbench) {}
  
  private void addPages()
  {
    loadData(false);
    addHomePage();
    createPageContainer();
    addRootPages();
    updateWidgetsFromData();
    selectFirstPage();
  }
  
  private void addRootPages()
  {
    addPage("overview");
    addPage("firststeps");
    addPage("tutorials");
    addPage("samples");
    addPage("whatsnew");
    addPage("webresources");
    addPage("migrate");
  }
  
  private void createPageContainer()
  {
    pageContainer = new Composite(tabFolder, 0);
    GridLayout layo
1 2 3 4 5

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