org.eclipse.wst.common.frameworks.ui_1.2.100.v201105122000

16:48:50.298 INFO  jd.cli.Main - Decompiling org.eclipse.wst.common.frameworks.ui_1.2.100.v201105122000.jar
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

import org.eclipse.jface.wizard.IWizardPage;

public abstract interface AddablePageGroup
  extends IDMPageGroup
{
  public abstract void addPage(IWizardPage paramIWizardPage);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.datamodel.ui.AddablePageGroup
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

class DataModelSynchHelper$1
  implements Runnable
{
  DataModelSynchHelper$1(DataModelSynchHelper paramDataModelSynchHelper, String paramString, int paramInt) {}
  
  public void run()
  {
    DataModelSynchHelper.access$0(this$0, val$propertyName, val$flag);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

import java.util.Map;
import org.eclipse.swt.widgets.Control;

class DataModelSynchHelper$2
  implements Runnable
{
  DataModelSynchHelper$2(DataModelSynchHelper paramDataModelSynchHelper, String paramString, boolean paramBoolean) {}
  
  public void run()
  {
    Control control = (Control)this$0.propertyToWidgetHash.get(val$propertyName);
    if (control != null) {
      this$0.setEnablement(control, val$enabled);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Map;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;

class DataModelSynchHelper$3
  implements ActionListener
{
  DataModelSynchHelper$3(DataModelSynchHelper paramDataModelSynchHelper) {}
  
  public void actionPerformed(ActionEvent e)
  {
    Widget w = (Widget)e.getSource();
    if ((this$0.currentWidget == w) || (w.isDisposed())) {
      return;
    }
    String propertyName = (String)this$0.widgetToPropertyHash.get(w);
    this$0.setTextProperty(propertyName, (Text)w);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

import java.awt.event.ActionListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.wst.common.frameworks.internal.ui.TimedModifyListener;

class DataModelSynchHelper$4
  extends TimedModifyListener
{
  DataModelSynchHelper$4(DataModelSynchHelper paramDataModelSynchHelper, ActionListener $anonymous0)
  {
    super($anonymous0);
  }
  
  public void modifyText(ModifyEvent e)
  {
    if (this$0.ignoreModifyEvent) {
      return;
    }
    super.modifyText(e);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

import java.util.Map;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.StructuredViewer;

class DataModelSynchHelper$CheckBoxViewerListener
  implements ICheckStateListener
{
  private DataModelSynchHelper$CheckBoxViewerListener(DataModelSynchHelper paramDataModelSynchHelper) {}
  
  public void checkStateChanged(CheckStateChangedEvent event)
  {
    StructuredViewer viewer = (StructuredViewer)event.getSource();
    
    Object[] items = (Object[])null;
    if ((viewer instanceof CheckboxTableViewer))
    {
      CheckboxTableViewer checkBoxTableViewer = (CheckboxTableViewer)viewer;
      items = checkBoxTableViewer.getCheckedElements();
    }
    else if ((viewer instanceof CheckboxTreeViewer))
    {
      CheckboxTreeViewer checkBoxTreeViewer = (CheckboxTreeViewer)viewer;
      items = checkBoxTreeViewer.getCheckedElements();
    }
    String propertyName = (String)this$0.widgetToPropertyHash.get(viewer.getControl());
    this$0.setPropertyItems(propertyName, items);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper.CheckBoxViewerListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

import java.util.Map;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;

class DataModelSynchHelper$CheckboxSelectionListener
  implements SelectionListener
{
  private DataModelSynchHelper$CheckboxSelectionListener(DataModelSynchHelper paramDataModelSynchHelper) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    Button button = (Button)e.getSource();
    if (this$0.currentWidget == button) {
      return;
    }
    String propertyName = (String)this$0.widgetToPropertyHash.get(button);
    this$0.setProperty(propertyName, new Boolean(button.getSelection()));
  }
  
  public void widgetDefaultSelected(SelectionEvent e) {}
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper.CheckboxSelectionListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

import java.util.Map;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;

class DataModelSynchHelper$ComboListener
  implements SelectionListener, ModifyListener
{
  private DataModelSynchHelper$ComboListener(DataModelSynchHelper paramDataModelSynchHelper) {}
  
  public void modifyText(ModifyEvent e)
  {
    if (this$0.ignoreModifyEvent) {
      return;
    }
    Combo combo = (Combo)e.getSource();
    if (this$0.currentWidget == combo) {
      return;
    }
    try
    {
      this$0.currentWidgetFromEvent = combo;
      String propertyName = (String)this$0.widgetToPropertyHash.get(combo);
      DataModelPropertyDescriptor[] descriptors = this$0.dataModel.getValidPropertyDescriptors(propertyName);
      String description = combo.getText();
      if ((DataModelSynchHelper.isLinux) && (description.length() == 0) && (descriptors.length != 0) && (!(descriptors[0].getPropertyValue() instanceof String))) {
        return;
      }
      for (int i = 0; i < descriptors.length; i++) {
        if (description.equals(descriptors[i].getPropertyDescription()))
        {
          this$0.setProperty(propertyName, descriptors[i].getPropertyValue());
          return;
        }
      }
      this$0.setProperty(propertyName, combo.getText());
    }
    finally
    {
      this$0.currentWidgetFromEvent = null;
    }
    this$0.currentWidgetFromEvent = null;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    Combo combo = (Combo)e.getSource();
    if (this$0.currentWidget == combo) {
      return;
    }
    String propertyName = (String)this$0.widgetToPropertyHash.get(combo);
    if (combo.getSelectionIndex() >= 0)
    {
      DataModelPropertyDescriptor[] descriptors = this$0.dataModel.getValidPropertyDescriptors(propertyName);
      String description = combo.getItem(combo.getSelectionIndex());
      for (int i = 0; i < descriptors.length; i++) {
        if (description.equals(descriptors[i].getPropertyDescription()))
        {
          this$0.setProperty(propertyName, descriptors[i].getPropertyValue());
          return;
        }
      }
      this$0.setProperty(propertyName, combo.getItem(combo.getSelectionIndex()));
    }
  }
  
  public void widgetDefaultSelected(SelectionEvent e) {}
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper.ComboListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

import java.util.Map;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;

class DataModelSynchHelper$ModifyTextListener
  implements ModifyListener
{
  private DataModelSynchHelper$ModifyTextListener(DataModelSynchHelper paramDataModelSynchHelper) {}
  
  public void modifyText(ModifyEvent e)
  {
    if (this$0.ignoreModifyEvent) {
      return;
    }
    Text text = (Text)e.getSource();
    if (this$0.currentWidget == text) {
      return;
    }
    String propertyName = (String)this$0.widgetToPropertyHash.get(text);
    this$0.setProperty(propertyName, text.getText());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelSynchHelper.ModifyTextListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.common.frameworks.internal.datamodel.ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
import org.eclipse.wst.common.frameworks.internal.ui.TimedModifyListener;

public class DataModelSynchHelper
  implements IDataModelListener
{
  protected static final boolean isLinux = System.getProperty("os.name").equals("Linux");
  protected IDataModel dataModel;
  protected Map widgetToPropertyHash;
  protected Map propertyToWidgetHash;
  protected Map widgetToDepControls;
  protected String currentProperty;
  protected Widget currentWidget;
  protected Widget currentWidgetFromEvent;
  protected boolean ignoreModifyEvent = false;
  private ModifyTextListener modifyTextListener;
  private TimedModifyListener timedModifyListener;
  private ComboListener comboListener;
  private CheckboxSelectionListener checkboxSelectionListener;
  private CheckBoxViewerListener checkBoxViewerStateListener;
  
  private class ModifyTextListener
    implements ModifyListener
  {
    private ModifyTextListener() {}
    
    public void modifyText(ModifyEvent e)
    {
      if (ignoreModifyEvent) {
        return;
      }
      Text text = (Text)e.getSource();
      if (currentWidget == text) {
        return;
      }
      String propertyName = (String)widgetToPropertyHash.get(text);
      setProperty(propertyName, text.getText());
    }
  }
  
  private class ComboListener
    implements SelectionListener, ModifyListener
  {
    private ComboListener() {}
    
    public void modifyText(ModifyEvent e)
    {
      if (ignoreModifyEvent) {
        return;
      }
      Combo combo = (Combo)e.getSource();
      if (currentWidget == combo) {
        return;
      }
      try
      {
        currentWidgetFromEvent = combo;
        String propertyName = (String)widgetToPropertyHash.get(combo);
        DataModelPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName);
        String description = combo.getText();
        if ((DataModelSynchHelper.isLinux) && (description.length() == 0) && (descriptors.length != 0) && (!(descriptors[0].getPropertyValue() instanceof String))) {
          return;
        }
        for (int i = 0; i < descriptors.length; i++) {
          if (description.equals(descriptors[i].getPropertyDescription()))
          {
            setProperty(propertyName, descriptors[i].getPropertyValue());
            return;
          }
        }
        setProperty(propertyName, combo.getText());
      }
      finally
      {
        currentWidgetFromEvent = null;
      }
      currentWidgetFromEvent = null;
    }
    
    public void widgetSelected(SelectionEvent e)
    {
      Combo combo = (Combo)e.getSource();
      if (currentWidget == combo) {
        return;
      }
      String propertyName = (String)widgetToPropertyHash.get(combo);
      if (combo.getSelectionIndex() >= 0)
      {
        DataModelPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName);
        String description = combo.getItem(combo.getSelectionIndex());
        for (int i = 0; i < descriptors.length; i++) {
          if (description.equals(descriptors[i].getPropertyDescription()))
          {
            setProperty(propertyName, descriptors[i].getPropertyValue());
            return;
          }
        }
        setProperty(propertyName, combo.getItem(combo.getSelectionIndex()));
      }
    }
    
    public void widgetDefaultSelected(SelectionEvent e) {}
  }
  
  private class CheckboxSelectionListener
    implements SelectionListener
  {
    private CheckboxSelectionListener() {}
    
    public void widgetSelected(SelectionEvent e)
    {
      Button button = (Button)e.getSource();
      if (currentWidget == button) {
        return;
      }
      String propertyName = (String)widgetToPropertyHash.get(button);
      setProperty(propertyName, new Boolean(button.getSelection()));
    }
    
    public void widgetDefaultSelected(SelectionEvent e) {}
  }
  
  public DataModelSynchHelper(IDataModel model)
  {
    dataModel = model;
    dataModel.addListener(this);
  }
  
  private class CheckBoxViewerListener
    implements ICheckStateListener
  {
    private CheckBoxViewerListener() {}
    
    public void checkStateChanged(CheckStateChangedEvent event)
    {
      StructuredViewer viewer = (StructuredViewer)event.getSource();
      
      Object[] items = (Object[])null;
      if ((viewer instanceof CheckboxTableViewer))
      {
        CheckboxTableViewer checkBoxTableViewer = (CheckboxTableViewer)viewer;
        items = checkBoxTableViewer.getCheckedElements();
      }
      else if ((viewer instanceof CheckboxTreeViewer))
      {
        CheckboxTreeViewer checkBoxTreeViewer = (CheckboxTreeViewer)viewer;
        items = checkBoxTreeViewer.getCheckedElements();
      }
      String propertyName = (String)widgetToPropertyHash.get(viewer.getControl());
      setPropertyItems(propertyName, items);
    }
  }
  
  public void propertyChanged(DataModelEvent event)
  {
    String propertyName = event.getPropertyName();
    int flag = event.getFlag();
    if (flag == 3) {
      setEnablement(propertyName, event.isPropertyEnabled());
    } else {
      synchUIWithModel(propertyName, flag);
    }
  }
  
  /* Error */
  protected void setProperty(String propertyName, Object value)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: putfield 426	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentProperty	Ljava/lang/String;
    //   5: aload_0
    //   6: getfield 432	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:dataModel	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   9: aload_1
    //   10: aload_2
    //   11: invokeinterface 533 3 0
    //   16: goto +11 -> 27
    //   19: astore_3
    //   20: aload_0
    //   21: aconst_null
    //   22: putfield 426	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentProperty	Ljava/lang/String;
    //   25: aload_3
    //   26: athrow
    //   27: aload_0
    //   28: aconst_null
    //   29: putfield 426	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentProperty	Ljava/lang/String;
    //   32: return
    // Line number table:
    //   Java source line #187	-> byte code offset #0
    //   Java source line #189	-> byte code offset #5
    //   Java source line #190	-> byte code offset #19
    //   Java source line #191	-> byte code offset #20
    //   Java source line #192	-> byte code offset #25
    //   Java source line #191	-> byte code offset #27
    //   Java source line #193	-> byte code offset #32
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	33	0	this	DataModelSynchHelper
    //   0	33	1	propertyName	String
    //   0	33	2	value	Object
    //   19	7	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   5	19	19	finally
  }
  
  /* Error */
  protected void setPropertyItems(String propertyName, Object[] items)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: putfield 426	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentProperty	Ljava/lang/String;
    //   5: aload_0
    //   6: getfield 432	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:dataModel	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   9: aload_1
    //   10: aload_2
    //   11: invokeinterface 533 3 0
    //   16: goto +11 -> 27
    //   19: astore_3
    //   20: aload_0
    //   21: aconst_null
    //   22: putfield 426	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentProperty	Ljava/lang/String;
    //   25: aload_3
    //   26: athrow
    //   27: aload_0
    //   28: aconst_null
    //   29: putfield 426	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentProperty	Ljava/lang/String;
    //   32: return
    // Line number table:
    //   Java source line #196	-> byte code offset #0
    //   Java source line #198	-> byte code offset #5
    //   Java source line #199	-> byte code offset #19
    //   Java source line #200	-> byte code offset #20
    //   Java source line #201	-> byte code offset #25
    //   Java source line #200	-> byte code offset #27
    //   Java source line #202	-> byte code offset #32
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	33	0	this	DataModelSynchHelper
    //   0	33	1	propertyName	String
    //   0	33	2	items	Object[]
    //   19	7	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   5	19	19	finally
  }
  
  public void synchUIWithModel(final String propertyName, final int flag)
  {
    if ((propertyToWidgetHash != null) && (propertyToWidgetHash.containsKey(propertyName))) {
      if (Thread.currentThread() == Display.getDefault().getThread()) {
        doSynchUIWithModel(propertyName, flag);
      } else {
        Display.getDefault().asyncExec(new Runnable()
        {
          public void run()
          {
            DataModelSynchHelper.this.doSynchUIWithModel(propertyName, flag);
          }
        });
      }
    }
  }
  
  /* Error */
  private void doSynchUIWithModel(String propertyName, int flag)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_0
    //   2: getfield 427	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:propertyToWidgetHash	Ljava/util/Map;
    //   5: aload_1
    //   6: invokeinterface 526 2 0
    //   11: checkcast 214	org/eclipse/swt/widgets/Widget
    //   14: putfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   17: aload_0
    //   18: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   21: ifnull +252 -> 273
    //   24: aload_0
    //   25: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   28: aload_0
    //   29: getfield 431	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidgetFromEvent	Lorg/eclipse/swt/widgets/Widget;
    //   32: if_acmpeq +241 -> 273
    //   35: aload_0
    //   36: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   39: astore_3
    //   40: aload_0
    //   41: iconst_1
    //   42: putfield 424	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:ignoreModifyEvent	Z
    //   45: aload_0
    //   46: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   49: instanceof 211
    //   52: ifeq +19 -> 71
    //   55: aload_0
    //   56: aload_1
    //   57: iload_2
    //   58: aload_0
    //   59: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   62: checkcast 211	org/eclipse/swt/widgets/Text
    //   65: invokevirtual 504	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:setWidgetValue	(Ljava/lang/String;ILorg/eclipse/swt/widgets/Text;)V
    //   68: goto +169 -> 237
    //   71: aload_0
    //   72: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   75: instanceof 204
    //   78: ifeq +19 -> 97
    //   81: aload_0
    //   82: aload_1
    //   83: iload_2
    //   84: aload_0
    //   85: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   88: checkcast 204	org/eclipse/swt/widgets/Combo
    //   91: invokevirtual 500	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:setWidgetValue	(Ljava/lang/String;ILorg/eclipse/swt/widgets/Combo;)V
    //   94: goto +143 -> 237
    //   97: aload_0
    //   98: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   101: instanceof 203
    //   104: ifeq +19 -> 123
    //   107: aload_0
    //   108: aload_1
    //   109: iload_2
    //   110: aload_0
    //   111: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   114: checkcast 203	org/eclipse/swt/widgets/Button
    //   117: invokevirtual 499	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:setWidgetValue	(Ljava/lang/String;ILorg/eclipse/swt/widgets/Button;)V
    //   120: goto +117 -> 237
    //   123: aload_0
    //   124: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   127: instanceof 207
    //   130: ifeq +19 -> 149
    //   133: aload_0
    //   134: aload_1
    //   135: iload_2
    //   136: aload_0
    //   137: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   140: checkcast 207	org/eclipse/swt/widgets/Label
    //   143: invokevirtual 501	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:setWidgetValue	(Ljava/lang/String;ILorg/eclipse/swt/widgets/Label;)V
    //   146: goto +91 -> 237
    //   149: aload_0
    //   150: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   153: instanceof 208
    //   156: ifeq +19 -> 175
    //   159: aload_0
    //   160: aload_1
    //   161: iload_2
    //   162: aload_0
    //   163: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   166: checkcast 208	org/eclipse/swt/widgets/List
    //   169: invokevirtual 502	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:setWidgetValue	(Ljava/lang/String;ILorg/eclipse/swt/widgets/List;)V
    //   172: goto +65 -> 237
    //   175: aload_0
    //   176: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   179: instanceof 209
    //   182: ifeq +19 -> 201
    //   185: aload_0
    //   186: aload_1
    //   187: iload_2
    //   188: aload_0
    //   189: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   192: checkcast 209	org/eclipse/swt/widgets/Table
    //   195: invokevirtual 503	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:setWidgetValue	(Ljava/lang/String;ILorg/eclipse/swt/widgets/Table;)V
    //   198: goto +39 -> 237
    //   201: aload_0
    //   202: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   205: instanceof 212
    //   208: ifeq +29 -> 237
    //   211: aload_0
    //   212: aload_1
    //   213: iload_2
    //   214: aload_0
    //   215: getfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   218: checkcast 212	org/eclipse/swt/widgets/Tree
    //   221: invokevirtual 505	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:setWidgetValue	(Ljava/lang/String;ILorg/eclipse/swt/widgets/Tree;)V
    //   224: goto +13 -> 237
    //   227: astore 4
    //   229: aload_0
    //   230: iconst_0
    //   231: putfield 424	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:ignoreModifyEvent	Z
    //   234: aload 4
    //   236: athrow
    //   237: aload_0
    //   238: iconst_0
    //   239: putfield 424	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:ignoreModifyEvent	Z
    //   242: aload_0
    //   243: aload_3
    //   244: checkcast 205	org/eclipse/swt/widgets/Control
    //   247: aload_0
    //   248: getfield 432	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:dataModel	Lorg/eclipse/wst/common/frameworks/datamodel/IDataModel;
    //   251: aload_1
    //   252: invokeinterface 529 2 0
    //   257: invokevirtual 492	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:setEnablement	(Lorg/eclipse/swt/widgets/Control;Z)V
    //   260: goto +13 -> 273
    //   263: astore 5
    //   265: aload_0
    //   266: aconst_null
    //   267: putfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   270: aload 5
    //   272: athrow
    //   273: aload_0
    //   274: aconst_null
    //   275: putfield 430	org/eclipse/wst/common/frameworks/internal/datamodel/ui/DataModelSynchHelper:currentWidget	Lorg/eclipse/swt/widgets/Widget;
    //   278: return
    // Line number table:
    //   Java source line #230	-> byte code offset #0
    //   Java source line #231	-> byte code offset #17
    //   Java source line #234	-> byte code offset #35
    //   Java source line #236	-> byte code offset #40
    //   Java source line #237	-> byte code offset #45
    //   Java source line #238	-> byte code offset #55
    //   Java source line #239	-> byte code offset #71
    //   Java source line #240	-> byte code offset #81
    //   Java source line #241	-> byte code offset #97
    //   Java source line #242	-> byte code offset #107
    //   Java source line #243	-> byte code offset #123
    //   Java source line #244	-> byte code offset #133
    //   Java source line #245	-> byte code offset #149
    //   Java source line #246	-> byte code offset #159
    //   Java source line #247	-> byte code offset #175
    //   Java source line #248	-> byte code offset #185
    //   Java source line #249	-> byte code offset #201
    //   Java source line #250	-> byte code offset #211
    //   Java source line #251	-> byte code offset #227
    //   Java source line #252	-> byte code offset #229
    //   Java source line #253	-> byte code offset #234
    //   Java source line #252	-> byte code offset #237
    //   Java source line #255	-> byte code offset #242
    //   Java source line #257	-> byte code offset #263
    //   Java source line #258	-> byte code offset #265
    //   Java source line #259	-> byte code offset #270
    //   Java source line #258	-> byte code offset #273
    //   Java source line #260	-> byte code offset #278
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	279	0	this	DataModelSynchHelper
    //   0	279	1	propertyName	String
    //   0	279	2	flag	int
    //   39	205	3	widget	Widget
    //   227	8	4	localObject1	Object
    //   263	8	5	localObject2	Object
    // Exception table:
    //   from	to	target	type
    //   40	227	227	finally
    //   0	263	263	finally
  }
  
  protected void setEnablement(Control control, boolean enabled)
  {
    if (control.isEnabled() != enabled) {
      control.setEnabled(enabled);
    }
    setDependentControlEnablement(control, enabled);
  }
  
  private void setEnablement(final String propertyName, final boolean enabled)
  {
    if (propertyToWidgetHash != null) {
      Display.getDefault().syncExec(new Runnable()
      {
        public void run()
        {
          Control control = (Control)propertyToWidgetHash.get(propertyName);
          if (control != null) {
            setEnablement(control, enabled);
          }
        }
      });
    }
  }
  
  private void setDependentControlEnablement(Control control, boolean enabled)
  {
    if (widgetToDepControls != null)
    {
      Control[] dependents = (Control[])widgetToDepControls.get(control);
      if (dependents != null)
      {
        Control dep = null;
        for (int i = 0; i < dependents.length; i++)
        {
          dep = dependents[i];
          if (dep.isEnabled() != enabled) {
            dep.setEnabled(enabled);
          }
        }
      }
    }
  }
  
  protected void setWidgetValue(String propertyName, int flag, Button button)
  {
    if (((button.getStyle() & 0x20) == 32) || ((button.getStyle() & 0x10) == 16))
    {
      boolean checked = dataModel.getBooleanProperty(propertyName);
      if (button.getSelection() != checked) {
        button.setSelection(checked);
      }
    }
  }
  
  protected void setWidgetValue(String propertyName, int flag, Combo combo)
  {
    if ((flag == 4) || (combo.getItemCount() == 0))
    {
      DataModelPropertyDescriptor[] descriptors = dataModel.getValidPropertyDescriptors(propertyName);
      String[] items = new String[descriptors.length];
      for (int i = 0; i < descriptors.length; i++) {
        items[i] = descriptors[i].getPropertyDescription();
      }
      combo.setItems(items);
    }
    String newText = dataModel.getPropertyDescriptor(propertyName).getPropertyDescription();
    int selIndex = combo.getSelectionIndex();
    if ((selIndex < 0) || (!newText.equals(combo.getItem(selIndex))))
    {
      String[] items = combo.getItems();
      for (int i = 0; i < items.length; i++) {
        if (items[i].equals(newText))
        {
          combo.select(i);
          return;
        }
      }
    }
    combo.setText(newText);
  }
  
  protected void setWidgetValue(String propertyName, int flag, Text text)
  {
    String newText = dataModel.getStringProperty(propertyName);
    if (!newText.equals(text.getText())) {
      text.setText(newText);
    }
  }
  
  protected void setWidgetValue(String propertyName, int flag, Table table)
  {
    Object[] elements = (Object[])dataModel.getProperty(propertyName);
    if ((elements == null) || (elements.length == 0))
    {
      setTableItemsChecked(table.getItems(), false);
      return;
    }
    java.util.List elementList = Arrays.asList(elements);
    TableItem[] tableItems = table.getItems();
    for (int i = 0; i < tableItems.length; i++)
    {
      TableItem item = tableItems[i];
      if (elementList.contains(item.getData())) {
        item.setChecked(true);
      } else {
        item.setChecked(false);
      }
    }
  }
  
  protected void setTableItemsChecked(TableItem[] tableItems, boolean b)
  {
    for (int i = 0; i < tableItems.length; i++) {
      tableItems[i].setChecked(b);
    }
  }
  
  protected void setWidgetValue(String propertyName, int flag, Tree tree)
  {
    Object[] elements = (Object[])dataModel.getProperty(propertyName);
    if (elements == null) {
      return;
    }
    java.util.List elementList = Arrays.asList(elements);
    TreeItem[] treeItems = tree.getItems();
    if (elementList.size() == 0)
    {
      setTreeItemsGrey(treeItems, false);
      return;
    }
    if (treeItems.length > 0) {
      setTreeItemChecked(treeItems, elementList);
    }
  }
  
  public void setTreeItemsGrey(TreeItem[] treeItems, boolean b)
  {
    for (int i = 0; i < treeItems.length; i++)
    {
      TreeItem item = treeItems[i];
      item.setGrayed(b);
      setTreeItemsGrey(treeItems[i].getItems(), b);
    }
  }
  
  protected void setTreeItemChecked(TreeItem[] treeItems, java.util.List items)
  {
    for (int i = 0; i < treeItems.length; i++)
    {
      if (items.contains(treeItems[i].getData()))
      {
        treeItems[i].setChecked(true);
        treeItems[i].setGrayed(false);
      }
      else
      {
        treeItems[i].setGrayed(true);
      }
      TreeItem[] childernItems = treeItems[i].getItems();
      if (childernItems.length > 0)
      {
        treeItems[i].setExpanded(true);
        setTreeItemChecked(childernItems, items);
      }
    }
  }
  
  protected void setWidgetValue(String propertyName, int flag, Label label)
  {
    String newText = dataModel.getStringProperty(propertyName);
    if (!newText.equals(label.getText())) {
      label.setText(newText);
    }
  }
  
  protected void setWidgetValue(String propertyName, int flag, org.eclipse.swt.widgets.List list)
  {
    Object newContents = dataModel.getProperty(propertyName);
    if (newContents == null)
    {
      list.setItems(new String[0]);
      return;
    }
    if ((newContents instanceof java.util.List))
    {
      java.util.List modelContents = (java.util.List)newContents;
      String[] items = new String[modelContents.size()];
      for (int i = 0; i < modelContents.size(); i++) {
        items[i] = modelContents.get(i).toString();
      }
      list.setItems(items);
    }
    else if ((newContents instanceof String[]))
    {
      list.setItems((String[])newContents);
    }
  }
  
  public void synchAllUIWithModel()
  {
    if (propertyToWidgetHash != null)
    {
      Collection keys = propertyToWidgetHash.keySet();
      if (!keys.isEmpty())
      {
        Iterator propertyNames = keys.iterator();
        String propertyName = null;
        while (propertyNames.hasNext())
        {
          propertyName = (String)propertyNames.next();
          synchUIWithModel(propertyName, 1);
        }
      }
    }
  }
  
  protected void synchComposite(Widget widget, String propertyName, Control[] depControls)
  {
    if (widgetToPropertyHash == null) {
      widgetToPropertyHash = new HashMap();
    }
    if (propertyToWidgetHash == null) {
      propertyToWidgetHash = new HashMap();
    }
    widgetToPropertyHash.put(widget, propertyName);
    propertyToWidgetHash.put(propertyName, widget);
    if (depControls != null)
    {
      if (widgetToDepControls == null) {
        widgetToDepControls = new HashMap();
      }
      widgetToDepControls.put(widget, depControls);
    }
    synchUIWithModel(propertyName, 1);
  }
  
  public void synchText(Text text, String propertyName, Control[] dependentControls)
  {
    synchText(text, propertyName, false, dependentControls);
  }
  
  public void synchText(Text text, String propertyName, boolean isTimeModified, Control[] dependentControls)
  {
    synchComposite(text, propertyName, dependentControls);
    if (isTimeModified) {
      text.addModifyListener(getTimedListener());
    } else {
      text.addModifyListener(getModifyTextListener());
    }
  }
  
  public void synchLabel(Label label, String propertyName, Control[] dependentControls)
  {
    synchComposite(label, propertyName, dependentControls);
  }
  
  public void synchList(org.eclipse.swt.widgets.List list, String propertyName, Control[] dependentControls)
  {
    synchComposite(list, propertyName, dependentControls);
  }
  
  public void synchCombo(Combo combo, String propertyName, Control[] dependentControls)
  {
    synchComposite(combo, propertyName, dependentControls);
    if (comboListener == null) {
      comboListener = new ComboListener(null);
    }
    combo.addSelectionListener(comboListener);
    combo.addModifyListener(comboListener);
  }
  
  public void synchCheckbox(Button checkbox, String propertyName, Control[] dependentControls)
  {
    synchComposite(checkbox, propertyName, dependentControls);
    if (checkboxSelectionListener == null) {
      checkboxSelectionListener = new CheckboxSelectionListener(null);
    }
    checkbox.addSelectionListener(checkboxSelectionListener);
  }
  
  public void synchCheckBoxTableViewer(CheckboxTableViewer tableViewer, String propertyName, Control[] dependentControls)
  {
    synchComposite(tableViewer.getControl(), propertyName, dependentControls);
    if (checkBoxViewerStateListener == null) {
      checkBoxViewerStateListener = new CheckBoxViewerListener(null);
    }
    tableViewer.addCheckStateListener(checkBoxViewerStateListener);
  }
  
  public void synchCheckBoxTreeViewer(CheckboxTreeViewer treeViewer, String propertyName, Control[] dependentControls)
  {
    treeViewer.expandAll();
    synchComposite(treeViewer.getControl(), propertyName, dependentControls);
    if (checkBoxViewerStateListener == null) {
      checkBoxViewerStateListener = new CheckBoxViewerListener(null);
    }
    treeViewer.addCheckStateListener(checkBoxViewerStateListener);
  }
  
  public void synchRadio(Button radio, String propertyName, Control[] dependentControls)
  {
    synchCheckbox(radio, propertyName, dependentControls);
  }
  
  private TimedModifyListener getTimedListener()
  {
    if (timedModifyListener == null) {
      timedModifyListener = new TimedModifyListener(new ActionListener()
      {
        public void actionPerformed(ActionEvent e)
        {
          Widget w = (Widget)e.getSource();
          if ((currentWidget == w) || (w.isDisposed())) {
            return;
          }
          String propertyName = (String)widgetToPropertyHash.get(w);
          setTextProperty(propertyName, (Text)w);
        }
      })
      {
        public void modifyText(ModifyEvent e)
        {
          if (ignoreModifyEvent) {
            return;
          }
          super.modifyText(e);
        }
      };
    }
    return timedModifyListener;
  }
  
  prote
1 2 3 4 5 6 7

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