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

spose(display);
  }
  
  public ExtendedColorRegistry(Display display)
  {
    this.display = display;
    hookDisplayDispose(display);
  }
  
  public Color getColor(Color foregroundColor, Color backgroundColor, Object object)
  {
    if ((object instanceof Color)) {
      return (Color)object;
    }
    Collection<Object> key = new ArrayList(2);
    key.add(foregroundColor);
    key.add(backgroundColor);
    key.add(object);
    
    Color result = (Color)table.get(key);
    if (result == null)
    {
      if ((object instanceof ColorDescriptor))
      {
        ColorDescriptor colorDescriptor = (ColorDescriptor)object;
        try
        {
          result = colorDescriptor.createColor(display);
        }
        catch (DeviceResourceException exception)
        {
          EMFEditUIPlugin.INSTANCE.log(exception);
        }
      }
      else if ((object instanceof URI))
      {
        URI colorURI = (URI)object;
        if (!"color".equals(colorURI.scheme())) {
          throw new IllegalArgumentException("Only 'color' scheme is recognized" + colorURI);
        }
        RGB colorData;
        if ("rgb".equals(colorURI.authority()))
        {
          int red = Integer.parseInt(colorURI.segment(0));
          int green = Integer.parseInt(colorURI.segment(1));
          int blue = Integer.parseInt(colorURI.segment(2));
          colorData = new RGB(red, green, blue);
        }
        else
        {
          RGB colorData;
          if ("hsb".equals(colorURI.authority()))
          {
            float[] hsb = new float[3];
            for (int i = 0; i < 3; i++)
            {
              String segment = colorURI.segment(i);
              hsb[i] = 
              
                ("background".equals(segment) ? 
                backgroundColor.getRGB().getHSB()[i] : ("".equals(segment)) || ("foreground".equals(segment)) ? foregroundColor.getRGB().getHSB()[i] : 
                Float.parseFloat(segment));
            }
            colorData = new RGB(hsb[0], hsb[1], hsb[2]);
          }
          else
          {
            throw new IllegalArgumentException("Only 'rgb' and 'hsb' authority are recognized" + colorURI);
          }
        }
        try
        {
          RGB colorData;
          result = ColorDescriptor.createFrom(colorData).createColor(display);
        }
        catch (DeviceResourceException exception)
        {
          EMFEditUIPlugin.INSTANCE.log(exception);
        }
      }
      if (result != null) {
        table.put(key, result);
      }
    }
    return result;
  }
  
  protected void handleDisplayDispose()
  {
    for (Color color : table.values()) {
      color.dispose();
    }
    table = null;
  }
  
  protected void hookDisplayDispose(Display display)
  {
    display.disposeExec(
      new Runnable()
      {
        public void run()
        {
          handleDisplayDispose();
        }
      });
  }
}

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

class ExtendedFontRegistry$1
  implements Runnable
{
  ExtendedFontRegistry$1(ExtendedFontRegistry paramExtendedFontRegistry) {}
  
  public void run()
  {
    this$0.handleDisplayDispose();
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.jface.resource.DeviceResourceException;
import org.eclipse.jface.resource.FontDescriptor;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Display;

public class ExtendedFontRegistry
{
  public static final ExtendedFontRegistry INSTANCE = new ExtendedFontRegistry();
  protected Display display;
  protected HashMap<Collection<?>, Font> table = new HashMap(10);
  
  public ExtendedFontRegistry()
  {
    display = Display.getCurrent();
    hookDisplayDispose(display);
  }
  
  public ExtendedFontRegistry(Display display)
  {
    this.display = display;
    hookDisplayDispose(display);
  }
  
  public Font getFont(Font baseFont, Object object)
  {
    if ((object instanceof Font)) {
      return (Font)object;
    }
    Collection<Object> key = new ArrayList(2);
    key.add(baseFont);
    key.add(object);
    
    Font result = (Font)table.get(key);
    if (result == null)
    {
      if ((object instanceof FontDescriptor))
      {
        FontDescriptor fontDescriptor = (FontDescriptor)object;
        try
        {
          result = fontDescriptor.createFont(display);
        }
        catch (DeviceResourceException exception)
        {
          EMFEditUIPlugin.INSTANCE.log(exception);
        }
      }
      else if ((object instanceof URI))
      {
        URI fontURI = (URI)object;
        if (!"font".equals(fontURI.scheme())) {
          throw new IllegalArgumentException("Only 'font' scheme is recognized" + fontURI);
        }
        String fontNameSpecification = fontURI.authority();
        if ("".equals(fontNameSpecification)) {
          fontNameSpecification = null;
        }
        String heightSpecification = fontURI.segment(0);
        int height;
        int height;
        boolean delta;
        if (heightSpecification.startsWith("+"))
        {
          boolean delta = true;
          height = Integer.parseInt(heightSpecification.substring(1));
        }
        else
        {
          int height;
          if ("".equals(heightSpecification))
          {
            boolean delta = true;
            height = 0;
          }
          else
          {
            height = Integer.parseInt(heightSpecification);
            delta = height < 0;
          }
        }
        String styleSpecification = fontURI.segment(1);
        int style = 
        
          "normal".equals(styleSpecification) ? 
          0 : ("italic+bold".equals(styleSpecification)) || ("bold+italic".equals(styleSpecification)) ? 3 : "italic".equals(styleSpecification) ? 2 : "bold".equals(styleSpecification) ? 1 : 
          -1;
        
        FontData[] baseFontData = baseFont.getFontData();
        FontData[] fontData = new FontData[baseFontData.length];
        for (int i = 0; i < baseFontData.length; i++) {
          fontData[i] = 
            new FontData(
            fontNameSpecification == null ? baseFontData[i].getName() : fontNameSpecification, 
            delta ? baseFontData[i].getHeight() + height : height, 
            style == -1 ? baseFontData[i].getStyle() : style);
        }
        try
        {
          result = FontDescriptor.createFrom(fontData).createFont(display);
        }
        catch (DeviceResourceException exception)
        {
          EMFEditUIPlugin.INSTANCE.log(exception);
        }
      }
      if (result != null) {
        table.put(key, result);
      }
    }
    return result;
  }
  
  protected void handleDisplayDispose()
  {
    for (Font image : table.values()) {
      image.dispose();
    }
    table = null;
  }
  
  protected void hookDisplayDispose(Display display)
  {
    display.disposeExec(
      new Runnable()
      {
        public void run()
        {
          handleDisplayDispose();
        }
      });
  }
}

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

class ExtendedImageRegistry$1
  implements Runnable
{
  ExtendedImageRegistry$1(ExtendedImageRegistry paramExtendedImageRegistry) {}
  
  public void run()
  {
    this$0.handleDisplayDispose();
  }
}

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

import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.edit.EMFEditPlugin;
import org.eclipse.emf.edit.provider.ComposedImage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class ExtendedImageRegistry
{
  public static final ExtendedImageRegistry INSTANCE = new ExtendedImageRegistry();
  
  public static ExtendedImageRegistry getInstance()
  {
    return INSTANCE;
  }
  
  protected HashMap<Object, Image> table = new HashMap(10);
  
  public ExtendedImageRegistry()
  {
    Display display = Display.getCurrent();
    hookDisplayDispose(display);
  }
  
  public ExtendedImageRegistry(Display display)
  {
    hookDisplayDispose(display);
  }
  
  protected static Object resourceURL = EMFEditPlugin.INSTANCE.getImage("full/obj16/Resource");
  protected static String resourceURLPrefix = resourceURL.toString() + "#";
  protected static String itemURLPrefix = EMFEditPlugin.INSTANCE.getImage("full/obj16/Item").toString() + "#";
  protected static String createChildURLPrefix = EMFEditPlugin.INSTANCE.getImage("full/ctool16/CreateChild").toString() + "#";
  
  public Image getImage(Object object)
  {
    if ((object instanceof Image)) {
      return (Image)object;
    }
    Image result = (Image)table.get(object);
    if (result == null)
    {
      if ((object instanceof ImageDescriptor))
      {
        ImageDescriptor imageDescriptor = (ImageDescriptor)object;
        result = imageDescriptor.createImage();
      }
      else if (((object instanceof URL)) || ((object instanceof URI)))
      {
        String urlString = object.toString();
        ImageDescriptor imageDescriptor = null;
        if (urlString.startsWith(resourceURLPrefix))
        {
          if (EMFPlugin.IS_RESOURCES_BUNDLE_AVAILABLE) {
            imageDescriptor = 
              PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(
              "dummy." + urlString.substring(resourceURLPrefix.length()));
          } else {
            result = getImage(resourceURL);
          }
        }
        else if (urlString.startsWith(itemURLPrefix)) {
          try
          {
            URL url = new URL(urlString.substring(0, itemURLPrefix.length()));
            String key1 = urlString.substring(itemURLPrefix.length());
            imageDescriptor = new URLImageDescriptor(url, key1, null);
          }
          catch (IOException localIOException) {}
        } else if (urlString.startsWith(createChildURLPrefix)) {
          try
          {
            URL url = new URL(urlString.substring(0, createChildURLPrefix.length()));
            String key1 = urlString.substring(createChildURLPrefix.length() + 1);
            String key2 = null;
            int index = key1.indexOf("/");
            if (index != -1)
            {
              key2 = key1.substring(index + 1);
              key1 = key1.substring(0, index);
            }
            imageDescriptor = new URLImageDescriptor(url, key1, key2);
          }
          catch (IOException localIOException1) {}
        } else {
          try
          {
            imageDescriptor = ImageDescriptor.createFromURL(new URL(urlString));
          }
          catch (IOException localIOException2) {}
        }
        if (imageDescriptor != null) {
          result = imageDescriptor.createImage();
        }
      }
      else if ((object instanceof ComposedImage))
      {
        ImageDescriptor composedImageDescriptor = new ComposedImageDescriptor((ComposedImage)object);
        result = composedImageDescriptor.createImage();
      }
      if (result != null) {
        table.put(object, result);
      }
    }
    return result;
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    if ((object instanceof ImageDescriptor)) {
      return (ImageDescriptor)object;
    }
    Image image = getImage(object);
    if (image != null) {
      return new ImageWrapperImageDescriptor(image);
    }
    return null;
  }
  
  protected void handleDisplayDispose()
  {
    for (Image image : table.values()) {
      image.dispose();
    }
    table = null;
  }
  
  protected void hookDisplayDispose(Display display)
  {
    display.disposeExec(
      new Runnable()
      {
        public void run()
        {
          handleDisplayDispose();
        }
      });
  }
}

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

import java.util.ArrayList;
import java.util.List;

public class ImageDataSynthesizer$ColorInformation
{
  public static ColorInformation getColor(int index)
  {
    index = Math.abs(index) % 61;
    while (entries.size() <= index)
    {
      instance.generateColor();
      
      ColorInformation entry = new ColorInformation();
      red = instancered;
      green = instancegreen;
      blue = instanceblue;
      which = instancewhich;
      factor = new double[] { instancefactor[0], instancefactor[1], instancefactor[2], instancefactor[3] };
      rainbow = instancerainbow;
      entries.add(entry);
      instance.fixFactor();
    }
    return (ColorInformation)entries.get(index);
  }
  
  protected static ColorInformation instance = new ColorInformation();
  protected static List<ColorInformation> entries = new ArrayList(1000);
  public int red = 192;
  public int green = 64;
  public int blue = 64;
  public int which = 2;
  public int change = 64;
  public double[] factor = { 0.35D, 0.1D, -0.1D, -0.3D };
  public boolean rainbow;
  
  public byte scale(int value, double factor)
  {
    if (factor > 0.0D) {
      return (byte)(int)(value + (255 - value) * factor);
    }
    return (byte)(int)(value + value * factor);
  }
  
  protected void generateColor()
  {
    switch (which)
    {
    case 0: 
      red += change;
      if (red <= 64)
      {
        which = 1;
        change = (-change);
      }
      else if (red >= 192)
      {
        which = 1;
        change = (-change);
      }
      break;
    case 1: 
      green += change;
      if (green >= 192)
      {
        which = 2;
        change = (-change);
      }
      else if (green <= 64)
      {
        which = 2;
        change = (-change);
      }
      break;
    case 2: 
      blue += change;
      if (blue >= 192)
      {
        which = 0;
        change = (-change);
      }
      else if (blue <= 64)
      {
        which = 0;
        change = (-change);
      }
      break;
    }
  }
  
  protected void fixFactor()
  {
    if ((red == 192) && (green == 64) && (blue == 64))
    {
      for (int j = 0; j < factor.length; j++) {
        factor[j] += 0.3D;
      }
      if (factor[0] >= 1.0D)
      {
        rainbow = true;
        for (int j = 0; j < factor.length; j++) {
          factor[j] -= 0.8D;
        }
      }
    }
  }
}

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

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

class ImageDataSynthesizer
{
  protected URL url;
  protected static final int tableOffset1 = 49;
  protected static final int tableOffset2 = 25;
  
  public ImageDataSynthesizer(URL url)
  {
    this.url = url;
  }
  
  protected int code(String code)
  {
    int result = 0;
    for (int i = 0; i < code.length(); i++) {
      result += code.charAt(i) - ' ';
    }
    return result;
  }
  
  public InputStream generateGIF(String key1, String key2)
  {
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    try
    {
      byte[] content = new byte['?'];
      int result = getContents(content, url);
      
      ColorInformation info1 = ColorInformation.getColor(code(key1));
      ColorInformation info2 = key2 == null ? null : ColorInformation.getColor(code(key2));
      for (int j = 0; j < result; j++)
      {
        if ((j == 49) || (j == 52) || (j == 55) || (j == 58))
        {
          int index = (j - 49) / 3;
          if ((!rainbow) || (which == index - 1)) {
            content[j] = info1.scale(red, factor[index]);
          }
        }
        else if ((j == 50) || (j == 53) || (j == 56) || (j == 59))
        {
          int index = (j - 49 - 1) / 3;
          if ((!rainbow) || (which == index - 1)) {
            content[j] = info1.scale(green, factor[index]);
          }
        }
        else if ((j == 51) || (j == 54) || (j == 57) || (j == 60))
        {
          int index = (j - 49 - 2) / 3;
          if ((!rainbow) || (which == index - 1)) {
            content[j] = info1.scale(blue, factor[index]);
          }
        }
        if (info2 != null) {
          if ((j == 25) || (j == 28) || (j == 31) || (j == 34))
          {
            int index = (j - 25) / 3;
            if ((!rainbow) || (which == index - 1)) {
              content[j] = info2.scale(red, factor[index]);
            }
          }
          else if ((j == 26) || (j == 29) || (j == 32) || (j == 35))
          {
            int index = (j - 25 - 1) / 3;
            if ((!rainbow) || (which == index - 1)) {
              content[j] = info2.scale(green, factor[index]);
            }
          }
          else if ((j == 27) || (j == 30) || (j == 33) || (j == 36))
          {
            int index = (j - 25 - 2) / 3;
            if ((!rainbow) || (which == index - 1)) {
              content[j] = info2.scale(blue, factor[index]);
            }
          }
        }
      }
      DataOutputStream writer = new DataOutputStream(outputStream);
      writer.write(content, 0, result);
      writer.close();
    }
    catch (Exception exception)
    {
      exception.printStackTrace();
    }
    return new ByteArrayInputStream(outputStream.toByteArray());
  }
  
  protected int getContents(byte[] content, URL gifURL)
    throws IOException
  {
    BufferedInputStream bufferedInputStream = new BufferedInputStream(gifURL.openStream());
    DataInputStream reader = new DataInputStream(bufferedInputStream);
    int result = reader.read(content, 0, content.length);
    reader.close();
    return result;
  }
  
  protected static class ColorInformation
  {
    public static ColorInformation getColor(int index)
    {
      index = Math.abs(index) % 61;
      while (entries.size() <= index)
      {
        instance.generateColor();
        
        ColorInformation entry = new ColorInformation();
        red = instancered;
        green = instancegreen;
        blue = instanceblue;
        which = instancewhich;
        factor = new double[] { instancefactor[0], instancefactor[1], instancefactor[2], instancefactor[3] };
        rainbow = instancerainbow;
        entries.add(entry);
        instance.fixFactor();
      }
      return (ColorInformation)entries.get(index);
    }
    
    protected static ColorInformation instance = new ColorInformation();
    protected static List<ColorInformation> entries = new ArrayList(1000);
    public int red = 192;
    public int green = 64;
    public int blue = 64;
    public int which = 2;
    public int change = 64;
    public double[] factor = { 0.35D, 0.1D, -0.1D, -0.3D };
    public boolean rainbow;
    
    public byte scale(int value, double factor)
    {
      if (factor > 0.0D) {
        return (byte)(int)(value + (255 - value) * factor);
      }
      return (byte)(int)(value + value * factor);
    }
    
    protected void generateColor()
    {
      switch (which)
      {
      case 0: 
        red += change;
        if (red <= 64)
        {
          which = 1;
          change = (-change);
        }
        else if (red >= 192)
        {
          which = 1;
          change = (-change);
        }
        break;
      case 1: 
        green += change;
        if (green >= 192)
        {
          which = 2;
          change = (-change);
        }
        else if (green <= 64)
        {
          which = 2;
          change = (-change);
        }
        break;
      case 2: 
        blue += change;
        if (blue >= 192)
        {
          which = 0;
          change = (-change);
        }
        else if (blue <= 64)
        {
          which = 0;
          change = (-change);
        }
        break;
      }
    }
    
    protected void fixFactor()
    {
      if ((red == 192) && (green == 64) && (blue == 64))
      {
        for (int j = 0; j < factor.length; j++) {
          factor[j] += 0.3D;
        }
        if (factor[0] >= 1.0D)
        {
          rainbow = true;
          for (int j = 0; j < factor.length; j++) {
            factor[j] -= 0.8D;
          }
        }
      }
    }
  }
}

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

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

class ImageWrapperImageDescriptor
  extends ImageDescriptor
{
  protected Image image;
  
  public ImageWrapperImageDescriptor(Image image)
  {
    this.image = image;
  }
  
  public boolean equals(Object that)
  {
    return ((that instanceof ImageWrapperImageDescriptor)) && (image.equals(image));
  }
  
  public int hashCode()
  {
    return image.hashCode();
  }
  
  public ImageData getImageData()
  {
    return image.getImageData();
  }
}

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

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class InputDialog$1
  implements ModifyListener
{
  InputDialog$1(InputDialog paramInputDialog) {}
  
  public void modifyText(ModifyEvent e)
  {
    this$0.validateInput();
  }
}

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

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

class InputDialog
  extends Dialog
{
  private String title;
  private String message;
  private String value = "";
  private IInputValidator validator;
  private Button okButton;
  private Text text;
  private Text errorMessageText;
  private String errorMessage;
  
  public InputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, IInputValidator validator)
  {
    super(parentShell);
    title = dialogTitle;
    message = dialogMessage;
    if (initialValue == null) {
      value = "";
    } else {
      value = initialValue;
    }
    this.validator = validator;
  }
  
  protected void buttonPressed(int buttonId)
  {
    if (buttonId == 0) {
      value = text.getText();
    } else {
      value = null;
    }
    super.buttonPressed(buttonId);
  }
  
  protected void configureShell(Shell shell)
  {
    super.configureShell(shell);
    if (title != null) {
      shell.setText(title);
    }
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    okButton = createButton(parent, 0, 
      IDialogConstants.OK_LABEL, true);
    createButton(parent, 1, 
      IDialogConstants.CANCEL_LABEL, false);
    
    text.setFocus();
    if (value != null)
    {
      text.setText(value);
      text.selectAll();
    }
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = (Composite)super.createDialogArea(parent);
    if (message != null)
    {
      Label label = new Label(composite, 64);
      label.setText(message);
      GridData data = new GridData(772);
      
      widthHint = convertHorizontalDLUsToPixels(300);
      label.setLayoutData(data);
      label.setFont(parent.getFont());
    }
    text = createText(composite);
    text.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        validateInput();
      }
    });
    errorMessageText = new Text(composite, 8);
    errorMessageText.setLayoutData(new GridData(768));
    
    errorMessageText.setBackground(errorMessageText.getDisplay()
      .getSystemColor(22));
    
    setErrorMessage(errorMessage);
    
    applyDialogFont(composite);
    return composite;
  }
  
  protected Text createText(Composite composite)
  {
    Text text = new Text(composite, 2052);
    text.setLayoutData(new GridData(768));
    
    return text;
  }
  
  @Deprecated
  protected Label getErrorMessageLabel()
  {
    return null;
  }
  
  protected Button getOkButton()
  {
    return okButton;
  }
  
  protected Text getText()
  {
    return text;
  }
  
  protected IInputValidator getValidator()
  {
    return validator;
  }
  
  public String getValue()
  {
    return value;
  }
  
  protected void validateInput()
  {
    String errorMessage = null;
    if (validator != null) {
      errorMessage = validator.isValid(text.getText());
    }
    setErrorMessage(errorMessage);
  }
  
  public void setErrorMessage(String errorMessage)
  {
    this.errorMessage = errorMessage;
    if ((errorMessageText != null) && (!errorMessageText.isDisposed()))
    {
      errorMessageText.setText(errorMessage == null ? "" : errorMessage);
      errorMessageText.getParent().update();
      
      Control button = getButton(0);
      if (button != null) {
        button.setEnabled(errorMessage == null);
      }
    }
  }
}

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

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control;

class NotifyChangedToViewerRefresh$1
  implements Runnable
{
  NotifyChangedToViewerRefresh$1(Viewer paramViewer, Object paramObject1, int paramInt1, Object paramObject2, Object paramObject3, Object paramObject4, int paramInt2) {}
  
  public void run()
  {
    if ((val$viewer.getControl() != null) && (!val$viewer.getControl().isDisposed())) {
      new NotifyChangedToViewerRefresh().refresh(val$viewer, val$object, val$eventType, val$feature, val$oldValue, val$newValue, val$index);
    }
  }
}

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

import java.util.Collection;
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableTreeViewer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;

public class NotifyChangedToViewerRefresh
{
  public static void handleNotifyChanged(Viewer viewer, final Object object, final int eventType, final Object feature, final Object oldValue, final Object newValue, final int index)
  {
    if ((viewer.getControl() == null) || (viewer.getControl().isDisposed())) {
      return;
    }
    Display d = viewer.getControl().getDisplay();
    if (d != Display.getCurrent()) {
      d.asyncExec(
        new Runnable()
        {
          public void run()
          {
            if ((getControl() != null) && (!getControl().isDisposed())) {
              new NotifyChangedToViewerRefresh().refresh(NotifyChangedToViewerRefresh.this, object, eventType, feature, oldValue, newValue, index);
            }
          }
        });
    } else {
      new NotifyChangedToViewerRefresh().refresh(viewer, object, eventType, feature, oldValue, newValue, index);
    }
  }
  
  public void refresh(Viewer viewer, Object object, int eventType, Object feature, Object oldValue, Object newValue, int index)
  {
    if ((viewer instanceof TreeViewer)) {
      refreshTreeViewer((TreeViewer)viewer, object, eventType, feature, oldValue, newValue, index);
    } else if ((viewer instanceof TableTreeViewer)) {
      refreshTableTreeViewer((TableTreeViewer)viewer, object, eventType, feature, oldValue, newValue, index);
    } else if ((viewer instanceof TableViewer)) {
      refreshTableViewer((TableViewer)viewer, object, eventType, feature, oldValue, newValue, index);
    } else if ((viewer instanceof ListViewer)) {
      refreshListViewer((ListViewer)viewer, object, eventType, feature, oldValue, newValue, index);
    } else {
      refreshViewer(viewer, object, eventType, feature, oldValue, newValue, index);
    }
  }
  
  public void refreshTreeViewer(TreeViewer viewer, Object object, int eventType, Object feature, Object oldValue, Object newValue, int index)
  {
    switch (eventType)
    {
    }
    refreshAbstractTreeViewer(viewer, object, eventType, feature, oldValue, newValue, index);
  }
  
  @Deprecated
  public void refreshTableTreeViewer(TableTreeViewer viewer, Object object, int eventType, Object feature, Object oldValue, Object newValue, int index)
  {
    switch (eventType)
    {
    }
    refreshAbstractTreeViewer(viewer, object, eventType, feature, oldValue, newValue, index);
  }
  
  public void refreshListViewer(ListViewer viewer, Object object, int eventType, Object feature, Object oldValue, Object newValue, int index)
  {
    switch (eventType)
    {
    case 3: 
      viewer.add(newValue);
      break;
    case 5: 
      viewer.add(((Collection)newValue).toArray());
      break;
    case 4: 
      viewer.remove(oldValue);
      break;
    case 6: 
      viewer.remove(((Collection)oldValue).toArray());
      break;
    case 7: 
      viewer.refresh();
    case 1: 
    case 2: 
    default: 
      refreshStructuredViewer(viewer, object, eventType, feature, oldValue, newValue, index);
    }
  }
  
  public void refreshTableViewer(TableViewer viewer, Object object, int eventType, Object feature, Object oldValue, Object newValue, int index)
  {
    switch (eventType)
    {
    case 3: 
      viewer.insert(newValue, index);
      break;
    case 5: 
      if (index == -1) {
        viewer.add(((Collection)newValue).toArray());
      } else {
        for (Object value : (Collection)newValue) {
          viewer.insert(value, index++);
        }
      }
      break;
    case 4: 
      viewer.remove(oldValue);
      break;
    case 6: 
      viewer.remove(((Collection)oldValue).toArray());
      break;
    case 1: 
    case 2: 
    case 7: 
    default: 
      refreshStructuredViewer(viewer, object, eventType, feature, oldValue, newValue, index);
    }
  }
  
  public void refreshAbstractTreeViewer(AbstractTreeViewer viewer, Object object, int eventType, Object feature, Object oldValue, Object newValue, int index)
  {
    switch (eventType)
    {
    case 3: 
      if (newValue == null) {
        viewer.refresh(object);
      } else {
        viewer.add(object, newValue);
      }
      break;
    case 5: 
      viewer.add(object, ((Collection)newValue).toArray());
      break;
    case 4: 
      if (oldValue == null) {
        viewer.refresh(object);
      } else {
        viewer.remove(oldValue);
      }
      break;
    case 6: 
      viewer.remove(((Collection)oldValue).toArray());
      break;
    case 1: 
    case 2: 
    case 7: 
    default: 
      refreshStructuredViewer(viewer, object, eventType, feature, oldValue, newValue, index);
    }
  }
  
  public void refreshStructuredViewer(StructuredViewer viewer, Object object, int eventType, Object feature, Object oldValue, Object newValue, int index)
  {
    switch (eventType)
    {
    case 3: 
    case 4: 
    case 5: 
    case 6: 
    case 7: 
      viewer.refresh(object);
      break;
    case 1: 
    case 2: 
      if ((feature instanceof EReference)) {
        viewer.refresh(object);
      } else {
        viewer.update(object, (feature instanceof ENamedElement) ? new String[] { ((ENamedElement)feature).getName() } : null);
      }
      break;
    default: 
      refreshViewer(viewer, object, eventType, feature, oldValue, newValue, index);
    }
  }
  
  public void refreshViewer(Viewer viewer, Object object, int eventType, Object feature, Object oldValue, Object newValue, int index)
  {
    switch (eventType)
    {
    case 9: 
      break;
    case 1: 
    case 2: 
    case 3: 
    case 4: 
    case 5: 
    case 6: 
    case 7: 
    case 8: 
    default: 
      viewer.refresh();
    }
  }
}

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

import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

class PropertyDescriptor$1
  extends LabelProvider
{
  PropertyDescriptor$1(PropertyDescriptor paramPropertyDescriptor, IItemLabelProvider paramIItemLabelProvider) {}
  
  public String getText(Object object)
  {
    return val$itemLabelProvider.getText(object);
  }
  
  public Image getImage(Object object)
  {
    return ExtendedImageRegistry.getInstance().getImage(val$itemLabelProvider.getImage(object));
  }
}

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

import org.eclipse.emf.common.ui.celleditor.ExtendedDialogCellEditor;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

class PropertyDescriptor$2
  extends ExtendedDialogCellEditor
{
  protected PropertyDescriptor.EDataTypeValueHandler valueHandler;
  
  PropertyDescriptor$2(PropertyDescriptor paramPropertyDescriptor, Composite $anonymous0, ILabelProvider $anonymous1, EDataType paramEDataType)
  {
    super($anonymous0, $anonymous1);
    
    valueHandler = new PropertyDescriptor.EDataTypeValueHandler(paramEDataType);
  }
  
  protected Object openDialogBox(Control cellEditorWindow)
  {
    InputDialog dialog = new PropertyDescriptor.MultiLineInputDialog(
      cellEditorWindow.getShell(), 
      EMFEditUIPlugin.INSTANCE.getString(
      "_UI_FeatureEditorDialog_title", new Object[] { this$0.getDisplayName(), this$0.getEditLabelProvider().getText(this$0.object) }), 
      EMFEditUIPlugin.INSTANCE.getString("_UI_MultiLineInputDialog_message"), 
      valueHandler.toString(getValue()), 
      valueHandler);
    return dialog.open() == 0 ? valueHandler.toValue(dialog.getValue()) : null;
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.ui.celleditor.ExtendedDialogCellEditor;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.ui.celleditor.FeatureEditorDialog;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

class PropertyDescriptor$3
  extends ExtendedDialogCellEditor
{
  PropertyDescriptor$3(PropertyDescriptor paramPropertyDescriptor, Composite $anonymous0, ILabelProvider $anonymous1, ILabelProvider paramILabelProvider1, EStructuralFeature paramEStructuralFeature, Collection paramCollection)
  {
    super($anonymous0, $anonymous1);
  }
  
  protected Object openDialogBox(Control cellEditorWindow)
  {
    FeatureEditorDialog dialog = new FeatureEditorDialog(
      cellEditorWindow.getShell(), 
      val$editLabelProvider, 
      this$0.object, 
      val$feature.getEType(), 
      (List)doGetValue(), 
      this$0.getDisplayName(), 
      new ArrayList(val$choiceOfValues), 
      false, 
      this$0.itemPropertyDescriptor.isSortChoices(this$0.object), 
      val$feature.isUnique());
    dialog.open();
    return dialog.getResult();
  }
}

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

import java.util.List;
import org.eclipse.emf.common.ui.celleditor.ExtendedDialogCellEditor;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.ui.celleditor.FeatureEditorDialog;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

class PropertyDescriptor$4
  extends ExtendedDialogCellEditor
{
  PropertyDescriptor$4(PropertyDescriptor paramPropertyDescriptor, Composite $anonymous0, ILabelProvider $anonymous1, ILabelProvider paramILabelProvider1, EStructuralFeature paramEStructuralFeature)
  {
    super($anonymous0, $anonymous1);
  }
  
  protected Object openDialogBox(Control cellEditorWindow)
  {
    FeatureEditorDialog dialog = new FeatureEditorDialog(
      cellEditorWindow.getShell(), 
      val$editLabelProvider, 
      this$0.object, 
      val$feature.getEType(), 
      (List)doGetValue(), 
      this$0.getDisplayName(), 
      null, 
      this$0.itemPropertyDescriptor.isMultiLine(this$0.object), 
      false, 
      val$feature.isUnique());
    dialog.open();
    return dialog.getResult();
  }
}

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

import org.eclipse.emf.ecore.EDataType;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.widgets.Composite;

public class PropertyDescriptor$EDataTypeCellEditor
  extends TextCellEditor
{
  protected EDataType eDataType;
  protected PropertyDescriptor.EDataTypeValueHandler valueHandler;
  
  public PropertyDescriptor$EDataTypeCellEditor(EDataType eDataType, Composite parent)
  {
    super(parent);
    this.eDataType = eDataType;
    valueHandler = new PropertyDescriptor.EDataTypeValueHandler(eDataType);
    setValidator(valueHandler);
  }
  
  public Object doGetValue()
  {
    return valueHandler.toValue((String)super.doGetValue());
  }
  
  public void doSetValue(Object value)
  {
    value = valueHandler.toString(value);
    super.doSetValue(value);
  }
  
  protected boolean validateAsValue = true;
  
  protected void editOccured(ModifyEvent e)
  {
    validateAsValue = false;
    super.editOccured(e);
    validateAsValue = t
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