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

org/eclipse/emf/edit/ui/action/ValidateAction$1$1
        //   19: dup
        //   20: aload_0
        //   21: aload_1
        //   22: aload_2
        //   23: invokespecial 59	org/eclipse/emf/edit/ui/action/ValidateAction$1$1:<init>	(Lorg/eclipse/emf/edit/ui/action/ValidateAction$1;Lorg/eclipse/core/runtime/IProgressMonitor;Lorg/eclipse/emf/common/util/Diagnostic;)V
        //   26: invokevirtual 60	org/eclipse/swt/widgets/Display:asyncExec	(Ljava/lang/Runnable;)V
        //   29: goto +12 -> 41
        //   32: astore_3
        //   33: aload_1
        //   34: invokeinterface 62 1 0
        //   39: aload_3
        //   40: athrow
        //   41: aload_1
        //   42: invokeinterface 62 1 0
        //   47: return
        // Line number table:
        //   Java source line #177	-> byte code offset #0
        //   Java source line #178	-> byte code offset #9
        //   Java source line #179	-> byte code offset #16
        //   Java source line #178	-> byte code offset #26
        //   Java source line #195	-> byte code offset #32
        //   Java source line #196	-> byte code offset #33
        //   Java source line #197	-> byte code offset #39
        //   Java source line #196	-> byte code offset #41
        //   Java source line #198	-> byte code offset #47
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	48	0	this	1
        //   0	48	1	progressMonitor	IProgressMonitor
        //   8	15	2	diagnostic	Diagnostic
        //   32	8	3	localObject	Object
        // Exception table:
        //   from	to	target	type
        //   0	32	32	finally
      }
    };
    if (eclipseResourcesUtil != null) {
      runnableWithProgress = eclipseResourcesUtil.getWorkspaceModifyOperation(runnableWithProgress);
    }
    try
    {
      new ProgressMonitorDialog(shell).run(true, true, runnableWithProgress);
    }
    catch (Exception exception)
    {
      EMFEditUIPlugin.INSTANCE.log(exception);
    }
  }
  
  protected Diagnostic validate(IProgressMonitor progressMonitor)
  {
    int selectionSize = selectedObjects.size();
    int count = selectionSize;
    Iterator<?> i;
    for (Iterator localIterator1 = selectedObjects.iterator(); localIterator1.hasNext(); i.hasNext())
    {
      EObject eObject = (EObject)localIterator1.next();
      
      i = eObject.eAllContents(); continue;
      
      count++;i.next();
    }
    progressMonitor.beginTask("", count);
    
    AdapterFactory adapterFactory = 
      (domain instanceof AdapterFactoryEditingDomain) ? ((AdapterFactoryEditingDomain)domain).getAdapterFactory() : null;
    Diagnostician diagnostician = createDiagnostician(adapterFactory, progressMonitor);
    BasicDiagnostic diagnostic;
    BasicDiagnostic diagnostic;
    if (selectionSize == 1) {
      diagnostic = diagnostician.createDefaultDiagnostic((EObject)selectedObjects.get(0));
    } else {
      diagnostic = 
        new BasicDiagnostic(
        "org.eclipse.emf.ecore", 
        0, 
        EMFEditUIPlugin.INSTANCE.getString("_UI_DiagnosisOfNObjects_message", new String[] { Integer.toString(selectionSize) }), 
        selectedObjects.toArray());
    }
    Map<Object, Object> context = diagnostician.createDefaultContext();
    for (EObject eObject : selectedObjects)
    {
      progressMonitor.setTaskName(EMFEditUIPlugin.INSTANCE.getString("_UI_Validating_message", new Object[] { diagnostician.getObjectLabel(eObject) }));
      diagnostician.validate(eObject, diagnostic, context);
    }
    return diagnostic;
  }
  
  protected Diagnostician createDiagnostician(final AdapterFactory adapterFactory, final IProgressMonitor progressMonitor)
  {
    
      new Diagnostician()
      {
        public String getObjectLabel(EObject eObject)
        {
          if ((adapterFactory != null) && (!eObject.eIsProxy()))
          {
            IItemLabelProvider itemLabelProvider = (IItemLabelProvider)adapterFactory.adapt(eObject, IItemLabelProvider.class);
            if (itemLabelProvider != null) {
              return itemLabelProvider.getText(eObject);
            }
          }
          return super.getObjectLabel(eObject);
        }
        
        public boolean validate(EClass eClass, EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context)
        {
          progressMonitor.worked(1);
          return super.validate(eClass, eObject, diagnostics, context);
        }
      };
    }
    
    protected void handleDiagnostic(Diagnostic diagnostic)
    {
      int severity = diagnostic.getSeverity();
      String title = null;
      String message = null;
      if ((severity == 4) || (severity == 2))
      {
        title = EMFEditUIPlugin.INSTANCE.getString("_UI_ValidationProblems_title");
        message = EMFEditUIPlugin.INSTANCE.getString("_UI_ValidationProblems_message");
      }
      else
      {
        title = EMFEditUIPlugin.INSTANCE.getString("_UI_ValidationResults_title");
        message = EMFEditUIPlugin.INSTANCE.getString(severity == 0 ? "_UI_ValidationOK_message" : "_UI_ValidationResults_message");
      }
      int result = 0;
      if (diagnostic.getSeverity() == 0)
      {
        MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, message);
        result = 1;
      }
      else
      {
        result = DiagnosticDialog.open(
          PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, message, diagnostic);
      }
      Resource resource = eclipseResourcesUtil != null ? (Resource)domain.getResourceSet().getResources().get(0) : null;
      if (resource != null) {
        eclipseResourcesUtil.deleteMarkers(resource);
      }
      if (result == 0)
      {
        Object part;
        if (!diagnostic.getChildren().isEmpty())
        {
          List<?> data = ((Diagnostic)diagnostic.getChildren().get(0)).getData();
          if ((!data.isEmpty()) && ((data.get(0) instanceof EObject)))
          {
            part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
            if ((part instanceof ISetSelectionTarget))
            {
              ((ISetSelectionTarget)part).selectReveal(new StructuredSelection(data.get(0)));
            }
            else if ((part instanceof IViewerProvider))
            {
              Viewer viewer = ((IViewerProvider)part).getViewer();
              if (viewer != null) {
                viewer.setSelection(new StructuredSelection(data.get(0)), true);
              }
            }
          }
        }
        if (resource != null) {
          for (part = diagnostic.getChildren().iterator(); ((Iterator)part).hasNext();)
          {
            Diagnostic childDiagnostic = (Diagnostic)((Iterator)part).next();
            
            eclipseResourcesUtil.createMarkers(resource, childDiagnostic);
          }
        }
      }
    }
    
    public void selectionChanged(SelectionChangedEvent event)
    {
      selectionProvider = event.getSelectionProvider();
      if ((event.getSelection() instanceof IStructuredSelection)) {
        setEnabled(updateSelection((IStructuredSelection)event.getSelection()));
      } else {
        setEnabled(false);
      }
    }
    
    public boolean updateSelection(IStructuredSelection selection)
    {
      selectedObjects = new ArrayList();
      for (Iterator<?> objects = selection.iterator(); objects.hasNext();)
      {
        Object object = AdapterFactoryEditingDomain.unwrap(objects.next());
        if ((object instanceof EObject)) {
          selectedObjects.add((EObject)object);
        } else if ((object instanceof Resource)) {
          selectedObjects.addAll(((Resource)object).getContents());
        } else {
          return false;
        }
      }
      selectedObjects = EcoreUtil.filterDescendants(selectedObjects);
      return !selectedObjects.isEmpty();
    }
    
    public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
    {
      if ((workbenchPart instanceof IEditingDomainProvider)) {
        domain = ((IEditingDomainProvider)workbenchPart).getEditingDomain();
      }
    }
  }

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

import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;

class AdapterFactoryTableTreeEditor$1
  extends KeyAdapter
{
  AdapterFactoryTableTreeEditor$1(AdapterFactoryTableTreeEditor paramAdapterFactoryTableTreeEditor) {}
  
  public void keyPressed(KeyEvent event)
  {
    if (character == ' ')
    {
      this$0.setDown(true);
      this$0.canvas.update();
      this$0.setDown(false);
      this$0.activate();
    }
    else if ((character == '\r') || (character == '\n'))
    {
      this$0.setDown(true);
      this$0.canvas.update();
      this$0.setDown(false);
      this$0.activate();
    }
    else if (character == '\033')
    {
      this$0.dismiss();
    }
    else if (keyCode == 16777219)
    {
      this$0.arrowLeft();
    }
    else if (keyCode == 16777220)
    {
      this$0.arrowRight();
    }
    else if (keyCode == 16777217)
    {
      this$0.arrowUp();
    }
    else if (keyCode == 16777218)
    {
      this$0.arrowDown();
    }
  }
}

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

import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;

class AdapterFactoryTableTreeEditor$2
  implements PaintListener
{
  AdapterFactoryTableTreeEditor$2(AdapterFactoryTableTreeEditor paramAdapterFactoryTableTreeEditor) {}
  
  public void paintControl(PaintEvent event)
  {
    this$0.paintControl(event);
  }
}

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

import org.eclipse.swt.custom.TableTree;
import org.eclipse.swt.custom.TableTreeItem;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.TableItem;

class AdapterFactoryTableTreeEditor$3
  extends MouseAdapter
{
  AdapterFactoryTableTreeEditor$3(AdapterFactoryTableTreeEditor paramAdapterFactoryTableTreeEditor) {}
  
  public void mouseDown(MouseEvent event)
  {
    if (button == 1) {
      this$0.setDown(true);
    }
  }
  
  public void mouseUp(MouseEvent event)
  {
    if ((button == 1) && (this$0.isDown())) {
      if ((this$0.currentColumn == 0) && (this$0.currentTableTreeItem.getItemCount() > 0))
      {
        Rectangle imageBounds = AdapterFactoryTableTreeEditor.adjust(
          AdapterFactoryTableTreeEditor.getImageBounds(this$0.currentTableItem, 0), 
          this$0.currentTableItem.getBounds(this$0.currentColumn));
        if (x < x + width + 3)
        {
          this$0.currentTableTreeItem.setExpanded(!this$0.currentTableTreeItem.getExpanded());
          Event expandEvent = new Event();
          item = this$0.currentTableTreeItem;
          this$0.currentTableTreeItem.getParent().notifyListeners(17, expandEvent);
        }
        else
        {
          this$0.activate();
        }
      }
      else
      {
        this$0.activate();
      }
    }
    this$0.setDown(false);
  }
}

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

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class AdapterFactoryTableTreeEditor$4
  implements Listener
{
  AdapterFactoryTableTreeEditor$4(AdapterFactoryTableTreeEditor paramAdapterFactoryTableTreeEditor) {}
  
  public void handleEvent(Event event)
  {
    if (type != 26) {}
  }
}

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

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;

class AdapterFactoryTableTreeEditor$5
  implements Listener
{
  AdapterFactoryTableTreeEditor$5(AdapterFactoryTableTreeEditor paramAdapterFactoryTableTreeEditor, Shell paramShell) {}
  
  public void handleEvent(Event e)
  {
    switch (type)
    {
    case 21: 
      this$0.cancel();
      val$dropDown.dispose();
      break;
    case 27: 
      this$0.apply();
      val$dropDown.dispose();
    }
  }
}

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

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

class AdapterFactoryTableTreeEditor$6
  extends MouseAdapter
{
  AdapterFactoryTableTreeEditor$6(AdapterFactoryTableTreeEditor paramAdapterFactoryTableTreeEditor, Shell paramShell) {}
  
  public void mouseDoubleClick(MouseEvent event)
  {
    if (button == 1)
    {
      this$0.apply();
      val$dropDown.dispose();
    }
  }
}

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

import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Shell;

class AdapterFactoryTableTreeEditor$7
  extends KeyAdapter
{
  AdapterFactoryTableTreeEditor$7(AdapterFactoryTableTreeEditor paramAdapterFactoryTableTreeEditor, Shell paramShell) {}
  
  public void keyPressed(KeyEvent e)
  {
    if ((character == ' ') || (character == '\r') || (character == '\n'))
    {
      this$0.apply();
      val$dropDown.dispose();
    }
    else if (character == '\033')
    {
      this$0.cancel();
      val$dropDown.dispose();
    }
  }
}

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

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.ui.celleditor.ExtendedTableTreeEditor;
import org.eclipse.emf.common.ui.viewer.ExtendedTableTreeViewer;
import org.eclipse.emf.common.ui.viewer.ExtendedTableTreeViewer.ExtendedTableTreeItem;
import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.custom.TableTree;
import org.eclipse.swt.custom.TableTreeItem;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

@Deprecated
public class AdapterFactoryTableTreeEditor
  extends ExtendedTableTreeEditor
{
  protected AdapterFactory adapterFactory;
  protected AdapterFactoryItemDelegator itemDelegator;
  protected TableItem currentTableItem;
  protected TableTreeItem currentTableTreeItem;
  protected Object currentTableTreeItemData;
  protected int currentColumn;
  protected Image leftGradient;
  protected Image rightGradient;
  protected Composite canvas;
  protected KeyListener keyListener;
  protected PaintListener paintListener;
  protected Control activeEditor;
  protected boolean isDown;
  protected boolean hasDropDown;
  protected boolean hasLaunched;
  
  public AdapterFactoryTableTreeEditor(TableTree tableTree, AdapterFactory adapterFactory)
  {
    super(tableTree);
    this.adapterFactory = adapterFactory;
    itemDelegator = new AdapterFactoryItemDelegator(adapterFactory);
    
    keyListener = 
      new KeyAdapter()
      {
        public void keyPressed(KeyEvent event)
        {
          if (character == ' ')
          {
            setDown(true);
            canvas.update();
            setDown(false);
            activate();
          }
          else if ((character == '\r') || (character == '\n'))
          {
            setDown(true);
            canvas.update();
            setDown(false);
            activate();
          }
          else if (character == '\033')
          {
            dismiss();
          }
          else if (keyCode == 16777219)
          {
            arrowLeft();
          }
          else if (keyCode == 16777220)
          {
            arrowRight();
          }
          else if (keyCode == 16777217)
          {
            arrowUp();
          }
          else if (keyCode == 16777218)
          {
            arrowDown();
          }
        }
      };
      paintListener = 
        new PaintListener()
        {
          public void paintControl(PaintEvent event)
          {
            AdapterFactoryTableTreeEditor.this.paintControl(event);
          }
        };
      }
      
      public AdapterFactory getAdapterFactory()
      {
        return adapterFactory;
      }
      
      public void setAdapterFactory(AdapterFactory adapterFactory)
      {
        this.adapterFactory = adapterFactory;
      }
      
      public IItemPropertyDescriptor getColumnPropertyDescriptor(Object object, int column)
      {
        return null;
      }
      
      public boolean hasInPlaceEditor(Object object, int column)
      {
        return column == 0;
      }
      
      public boolean hasDropDownEditor(Object object, int column)
      {
        return column != 0;
      }
      
      public Control createDropDownEditor(Composite parent, Object object, int column)
      {
        return null;
      }
      
      public boolean hasLaunchedEditor(Object object, int column)
      {
        return false;
      }
      
      public void createLaunchedEditor(Composite parent, Object object, int column) {}
      
      protected void setDown(boolean isDown)
      {
        this.isDown = isDown;
        canvas.redraw();
      }
      
      protected boolean isDown()
      {
        return isDown;
      }
      
      protected void editItem(TableItem tableItem, TableTreeItem tableTreeItem, int column)
      {
        if (getEditor() != null) {
          getEditor().dispose();
        }
        currentTableItem = tableItem;
        currentTableTreeItem = tableTreeItem;
        currentTableTreeItemData = tableTreeItem.getData();
        currentColumn = column;
        
        horizontalAlignment = 16384;
        grabHorizontal = true;
        minimumWidth = Math.max(50, currentTableTreeItem.getBounds(column).width);
        
        hasDropDown = hasDropDownEditor(currentTableTreeItemData, currentColumn);
        hasLaunched = ((!hasDropDown) && (hasLaunchedEditor(currentTableTreeItemData, currentColumn)));
        
        canvas = createComposite();
        canvas.addKeyListener(keyListener);
        canvas.addPaintListener(paintListener);
        
        canvas.addMouseListener(
          new MouseAdapter()
          {
            public void mouseDown(MouseEvent event)
            {
              if (button == 1) {
                setDown(true);
              }
            }
            
            public void mouseUp(MouseEvent event)
            {
              if ((button == 1) && (isDown())) {
                if ((currentColumn == 0) && (currentTableTreeItem.getItemCount() > 0))
                {
                  Rectangle imageBounds = AdapterFactoryTableTreeEditor.adjust(
                    AdapterFactoryTableTreeEditor.getImageBounds(currentTableItem, 0), 
                    currentTableItem.getBounds(currentColumn));
                  if (x < x + width + 3)
                  {
                    currentTableTreeItem.setExpanded(!currentTableTreeItem.getExpanded());
                    Event expandEvent = new Event();
                    item = currentTableTreeItem;
                    currentTableTreeItem.getParent().notifyListeners(17, expandEvent);
                  }
                  else
                  {
                    activate();
                  }
                }
                else
                {
                  activate();
                }
              }
              setDown(false);
            }
          });
        Listener listener = 
          new Listener()
          {
            public void handleEvent(Event event)
            {
              if (type != 26) {}
            }
          };
          canvas.addListener(26, listener);
          canvas.addListener(27, listener);
          
          setEditor(canvas, currentTableTreeItem, currentColumn);
          canvas.setFocus();
        }
        
        protected Composite createComposite()
        {
          return new Canvas(currentTableItem.getParent(), 0);
        }
        
        protected void activate()
        {
          Rectangle itemBounds = currentTableItem.getBounds(currentColumn);
          int x = 0;
          if (currentColumn == 0)
          {
            Rectangle imageBounds = adjust(
              getImageBounds(currentTableItem, currentColumn), itemBounds);
            x += x + width;
          }
          Point point = currentTableItem.getParent().toDisplay(
            new Point(x, y));
          
          final Shell dropDown = new Shell(
            currentTableItem.getParent().getShell(), 16392);
          dropDown.setBackground(
            dropDown.getDisplay().getSystemColor(2));
          dropDown.setBounds(x + x, y + height, width - x, height * 5);
          
          Control control = 
            hasDropDownEditor(currentTableTreeItem.getData(), currentColumn) ? 
            createDropDownEditor(dropDown, currentTableTreeItem.getData(), currentColumn) : 
            null;
          if (control != null)
          {
            control.setBounds(1, 1, width - x - 2, height * 5 - 2);
            
            dropDown.setVisible(true);
            dropDown.layout();
            control.setFocus();
            
            Listener dropDownListener = 
              new Listener()
              {
                public void handleEvent(Event e)
                {
                  switch (type)
                  {
                  case 21: 
                    cancel();
                    dropDown.dispose();
                    break;
                  case 27: 
                    apply();
                    dropDown.dispose();
                  }
                }
              };
              dropDown.addListener(21, dropDownListener);
              
              dropDown.addListener(27, dropDownListener);
              
              control.addMouseListener(
                new MouseAdapter()
                {
                  public void mouseDoubleClick(MouseEvent event)
                  {
                    if (button == 1)
                    {
                      apply();
                      dropDown.dispose();
                    }
                  }
                });
              control.addKeyListener(
                new KeyAdapter()
                {
                  public void keyPressed(KeyEvent e)
                  {
                    if ((character == ' ') || (character == '\r') || (character == '\n'))
                    {
                      apply();
                      dropDown.dispose();
                    }
                    else if (character == '\033')
                    {
                      cancel();
                      dropDown.dispose();
                    }
                  }
                });
            }
            else if (hasLaunchedEditor(currentTableTreeItem.getData(), currentColumn))
            {
              createLaunchedEditor(dropDown, currentTableTreeItem.getData(), currentColumn);
            }
            activeEditor = control;
          }
          
          public void cancel()
          {
            activeEditor = null;
          }
          
          public void apply()
          {
            activeEditor = null;
            if ((canvas != null) && (canvas.isDisposed())) {
              canvas.redraw();
            }
          }
          
          public void dismiss()
          {
            if (canvas != null)
            {
              canvas.dispose();
              canvas = null;
              super.dismiss();
            }
          }
          
          protected void arrowLeft()
          {
            if (currentColumn > 0)
            {
              editItem(currentTableItem, currentTableTreeItem, currentColumn - 1);
            }
            else if (currentTableTreeItem.getItemCount() > 0)
            {
              currentTableTreeItem.setExpanded(!currentTableTreeItem.getExpanded());
              Event expandEvent = new Event();
              item = currentTableTreeItem;
              currentTableTreeItem.getParent().notifyListeners(17, expandEvent);
            }
          }
          
          protected void arrowRight()
          {
            if (currentColumn + 1 < currentTableItem.getParent().getColumnCount()) {
              editItem(currentTableItem, currentTableTreeItem, currentColumn + 1);
            }
          }
          
          protected void arrowUp()
          {
            int index = currentTableItem.getParent().indexOf(currentTableItem);
            if (index > 0)
            {
              TableItem newTableItem = currentTableItem.getParent().getItem(index - 1);
              currentTableItem.getParent().showItem(newTableItem);
              currentTableItem.getParent().setSelection(index - 1);
              editItem(newTableItem, (TableTreeItem)newTableItem.getData("TableTreeItemID"), currentColumn);
            }
          }
          
          protected void arrowDown()
          {
            int index = currentTableItem.getParent().indexOf(currentTableItem);
            if (index + 1 < currentTableItem.getParent().getItemCount())
            {
              TableItem newTableItem = currentTableItem.getParent().getItem(index + 1);
              currentTableItem.getParent().showItem(newTableItem);
              currentTableItem.getParent().setSelection(index + 1);
              editItem(newTableItem, (TableTreeItem)newTableItem.getData("TableTreeItemID"), currentColumn);
            }
          }
          
          protected static Rectangle adjust(Rectangle bounds, Rectangle baseBounds)
          {
            x -= x;
            y -= y;
            return bounds;
          }
          
          protected static Rectangle getImageBounds(TableItem item, int column)
          {
            return ExtendedTableTreeViewer.getImageBounds(item, column);
          }
          
          protected static void drawImage(GC gc, Image image, Rectangle bounds)
          {
            Rectangle imageBounds = image.getBounds();
            gc.drawImage(image, 
              x, y, width, height, 
              x, y, width, height);
          }
          
          public void paintControl(PaintEvent event)
          {
            if (currentTableItem.isDisposed())
            {
              apply();
              dismiss();
              TableItem[] tableItems = table.getItems();
              for (int i = 0; i < tableItems.length; i++)
              {
                TableTreeItem tableTreeItem = (TableTreeItem)tableItems[i].getData("TableTreeItemID");
                if (tableTreeItem.getData() == currentTableTreeItemData) {
                  editItem(tableItems[i], tableTreeItem, currentColumn);
                }
              }
              return;
            }
            Display display = currentTableItem.getDisplay();
            Rectangle itemBounds = currentTableItem.getBounds(currentColumn);
            
            String text = currentTableTreeItem.getText(currentColumn);
            Image image = currentTableItem.getImage(currentColumn);
            Rectangle imageBounds = adjust(
              getImageBounds(currentTableItem, currentColumn), itemBounds);
            
            Image extraImage = null;
            Rectangle extraImageBounds = null;
            int paddingWidth = 0;
            if ((currentColumn == 0) && 
              ((currentTableTreeItem instanceof ExtendedTableTreeViewer.ExtendedTableTreeItem)))
            {
              ExtendedTableTreeViewer.ExtendedTableTreeItem item = (ExtendedTableTreeViewer.ExtendedTableTreeItem)currentTableTreeItem;
              extraImage = item.getFirstImage();
              extraImageBounds = adjust(item.getFirstImageBounds(), itemBounds);
              paddingWidth = item.getImagePaddingWidth();
            }
            gc.setBackground(display.getSystemColor(25));
            gc.fillRectangle(x, y, width, height);
            if (image != null) {
              drawImage(gc, image, imageBounds);
            }
            if (extraImage != null) {
              drawImage(gc, extraImage, extraImageBounds);
            }
            if (text != null)
            {
              int x = paddingWidth == 0 ? 3 : paddingWidth;
              x += x + width + 3;
              
              int width = gc.stringExtent(text).x;
              int height = gc.stringExtent(text).y;
              int y = height < height ? 
                (height + 1 - height) / 2 : 0;
              
              gc.setForeground(display.getSystemColor(27));
              gc.setBackground(display.getSystemColor(26));
              
              gc.fillRectangle(x - 3, 0, width + 8, height);
              gc.drawString(text, x, y, true);
            }
            int boxX = width - height;
            int boxY = height - 1;
            if ((hasLaunched) || (hasDropDown))
            {
              gc.setBackground(display.getSystemColor(22));
              gc.fillPolygon(
              
                new int[] {
                boxX, boxY, 
                boxX + height - 1, boxY, 
                boxX + height - 1, 1, 
                boxX, 1 });
            }
            if (hasDropDown)
            {
              gc.setBackground(display.getSystemColor(2));
              int baseX = width - height / 2 - 1;
              int baseY = height - height / 2 + 3;
              if (isDown())
              {
                baseX++;
                baseY++;
              }
              gc.fillPolygon(
              
                new int[] {
                baseX, baseY, 
                baseX + 4, baseY - 4, 
                baseX - 3, baseY - 4 });
            }
            else if (hasLaunched)
            {
              gc.setForeground(display.getSystemColor(2));
              gc.setBackground(display.getSystemColor(22));
              int baseX = width - height / 2 - 1;
              int baseY = 0;
              if (isDown())
              {
                baseX++;
                baseY++;
              }
              gc.drawString("...", width - (height + gc.stringExtent("...").x) / 2, baseY);
            }
            gc.setForeground(display.getSystemColor(16));
            gc.drawRectangle(0, 0, width - 1, height - 1);
            if ((hasLaunched) || (hasDropDown)) {
              if (isDown())
              {
                gc.setForeground(display.getSystemColor(18));
                gc.drawLine(boxX, boxY - 1, boxX, 1);
                gc.drawLine(boxX, 1, boxX + height - 1, 1);
                
                gc.drawLine(boxX + 1, boxY - 1, boxX + height - 1, boxY - 1);
                gc.drawLine(boxX + height - 1, boxY - 1, boxX + height - 1, 2);
              }
              else
              {
                gc.setForeground(display.getSystemColor(20));
                gc.drawLine(boxX + 1, boxY - 1, boxX + 1, 2);
                gc.drawLine(boxX + 1, 2, boxX + height - 2, 2);
                
                gc.setForeground(display.getSystemColor(18));
                gc.drawLine(boxX + 1, boxY - 2, boxX + height - 3, boxY - 2);
                gc.drawLine(boxX + height - 3, boxY - 2, boxX + height - 3, 2);
                
                gc.setForeground(display.getSystemColor(17));
                gc.drawLine(boxX, boxY - 1, boxX + height - 2, boxY - 1);
                gc.drawLine(boxX + height - 2, boxY - 1, boxX + height - 2, 1);
              }
            }
          }
          
          protected Image getLeftGradient()
          {
            if (leftGradient == null) {
              getGradients();
            }
            return leftGradient;
          }
          
          protected Image getRightGradient()
          {
            if (rightGradient == null) {
              getGradients();
            }
            return rightGradient;
          }
          
          protected void getGradients()
          {
            int width = 20;
            int height = 10;
            
            Display display = canvas.getDisplay();
            
            leftGradient = new Image(display, width, height);
            GC leftGC = new GC(leftGradient);
            
            rightGradient = new Image(display, width, height);
            GC rightGC = new GC(rightGradient);
            
            Color startColor = display.getSystemColor(25);
            RGB rgb1 = startColor.getRGB();
            
            Color endColor = display.getSystemColor(25);
            RGB rgb2 = endColor.getRGB();
            for (int k = 0; k < width; k++)
            {
              int r = red + k * (red - red) / width;
              r = red > red ? Math.min(r, red) : Math.max(r, red);
              int g = green + k * (green - green) / width;
              g = green > green ? Math.min(g, green) : Math.max(g, green);
              int b = blue + k * (blue - blue) / width;
              b = blue > blue ? Math.min(b, blue) : Math.max(b, blue);
              
              Color color = new Color(display, r, g, b);
              
              leftGC.setBackground(color);
              leftGC.fillRectangle(width - k - 1, 0, 1, height);
              
              rightGC.setBackground(color);
              rightGC.fillRectangle(k, 0, 1, height);
              
              color.dispose();
            }
            leftGC.dispose();
            rightGC.dispose();
          }
        }

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

import org.eclipse.emf.edit.provider.IUpdateableItemText;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.widgets.Text;

class AdapterFactoryTreeEditor$1
  extends FocusAdapter
{
  AdapterFactoryTreeEditor$1(AdapterFactoryTreeEditor paramAdapterFactoryTreeEditor, IUpdateableItemText paramIUpdateableItemText, Object paramObject, Text paramText) {}
  
  public void focusLost(FocusEvent event)
  {
    val$updateableItemText.setText(val$object, val$text.getText());
    val$text.setVisible(false);
  }
}

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

import org.eclipse.emf.edit.provider.IUpdateableItemText;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Text;

class AdapterFactoryTreeEditor$2
  extends KeyAdapter
{
  AdapterFactoryTreeEditor$2(AdapterFactoryTreeEditor paramAdapterFactoryTreeEditor, IUpdateableItemText paramIUpdateableItemText, Object paramObject, Text paramText) {}
  
  public void keyPressed(KeyEvent event)
  {
    if ((character == '\r') || (character == '\n'))
    {
      val$updateableItemText.setText(val$object, val$text.getText());
      this$0.setEditor(null);
      val$text.dispose();
    }
    else if (character == '\033')
    {
      this$0.setEditor(null);
      val$text.dispose();
    }
  }
}

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

import java.io.PrintStream;
import org.eclipse.emf.edit.provider.IUpdateableItemText;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.widgets.Combo;

class AdapterFactoryTreeEditor$3
  extends FocusAdapter
{
  AdapterFactoryTreeEditor$3(AdapterFactoryTreeEditor paramAdapterFactoryTreeEditor, IUpdateableItemText paramIUpdateableItemText, Object paramObject, Combo paramCombo) {}
  
  public void focusLost(FocusEvent event)
  {
    System.out.println("Combo lost focus");
    val$updateableItemText.setText(val$object, val$combo.getText());
    val$combo.setVisible(false);
  }
}

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

import java.io.PrintStream;
import org.eclipse.emf.edit.provider.IUpdateableItemText;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Combo;

class AdapterFactoryTreeEditor$4
  extends KeyAdapter
{
  AdapterFactoryTreeEditor$4(AdapterFactoryTreeEditor paramAdapterFactoryTreeEditor, IUpdateableItemText paramIUpdateableItemText, Object paramObject, Combo paramCombo) {}
  
  public void keyPressed(KeyEvent event)
  {
    System.out.println("Combo key event");
    if ((character == '\r') || (character == '\n'))
    {
      val$updateableItemText.setText(val$object, val$combo.getText());
      this$0.setEditor(null);
      val$combo.dispose();
    }
    else if (character == '\033')
    {
      this$0.setEditor(null);
      val$combo.dispose();
    }
  }
}

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

import java.io.PrintStream;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class AdapterFactoryTreeEditor$5
  implements ModifyListener
{
  AdapterFactoryTreeEditor$5(AdapterFactoryTreeEditor paramAdapterFactoryTreeEditor) {}
  
  public void modifyText(ModifyEvent event)
  {
    System.out.println("Combo modified");
  }
}

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

import java.io.PrintStream;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.ui.celleditor.ExtendedTreeEditor;
import org.eclipse.emf.edit.provider.IUpdateableItemText;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyAdapter;
import or
1 2 3 4 5 6 7 8

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd