org.eclipse.jst.jsf.common.ui_1.2.100.v201104061711

ion:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

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

class ImageContainer$1
  implements PaintListener
{
  ImageContainer$1(ImageContainer paramImageContainer) {}
  
  public void paintControl(PaintEvent e)
  {
    if (ImageContainer.access$0(this$0) != null) {
      gc.drawImage(ImageContainer.access$0(this$0), 0, 0);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.ImageContainer.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;

class ImageContainer$2
  extends ControlAdapter
{
  ImageContainer$2(ImageContainer paramImageContainer) {}
  
  public void controlResized(ControlEvent e)
  {
    this$0.setSize(access$0this$0).getBounds().width, access$0this$0).getBounds().height);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.ImageContainer.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;

class ImageContainer$3
  implements DisposeListener
{
  ImageContainer$3(ImageContainer paramImageContainer) {}
  
  public void widgetDisposed(DisposeEvent e)
  {
    if ((ImageContainer.access$1(this$0)) && (ImageContainer.access$0(this$0) != null) && (!ImageContainer.access$0(this$0).isDisposed())) {
      ImageContainer.access$0(this$0).dispose();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.ImageContainer.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;

public class ImageContainer
  extends Composite
{
  private Image _image = null;
  private boolean _bCleanupImage;
  
  public ImageContainer(Composite parent)
  {
    super(parent, 0);
    
    setBackground(ColorConstants.white);
    
    addPaintListener(new PaintListener()
    {
      public void paintControl(PaintEvent e)
      {
        if (_image != null) {
          gc.drawImage(_image, 0, 0);
        }
      }
    });
    addControlListener(new ControlAdapter()
    {
      public void controlResized(ControlEvent e)
      {
        setSize(_image.getBounds().width, _image.getBounds().height);
      }
    });
    addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        if ((_bCleanupImage) && (_image != null) && (!_image.isDisposed())) {
          _image.dispose();
        }
      }
    });
  }
  
  public Image getImage()
  {
    return _image;
  }
  
  public boolean isCleanupImage()
  {
    return _bCleanupImage;
  }
  
  public void setImage(Image image)
  {
    setImage(image, false);
  }
  
  public void setImage(Image image, boolean bCleanupImage)
  {
    _image = image;
    _bCleanupImage = bCleanupImage;
    setSize(getBoundswidth, getBoundsheight);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.ImageContainer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.help.HelpSystem;
import org.eclipse.help.IContext;
import org.eclipse.help.IHelpResource;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

class IntroductionSection$1
  extends HyperlinkAdapter
{
  IntroductionSection$1(IntroductionSection paramIntroductionSection) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    IContext context = HelpSystem.getContext(IntroductionSection.access$0(this$0));
    if (context != null)
    {
      IHelpResource[] topics = context.getRelatedTopics();
      if ((topics != null) && (topics.length == 1)) {
        PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(topics[0]
          .getHref());
      } else {
        PlatformUI.getWorkbench().getHelpSystem().displayHelp(IntroductionSection.access$0(this$0));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.IntroductionSection.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.jface.action.IAction;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;

class IntroductionSection$2
  extends HyperlinkAdapter
{
  IntroductionSection$2(IntroductionSection paramIntroductionSection, IAction paramIAction) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    val$thisAction.run();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.IntroductionSection.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.help.HelpSystem;
import org.eclipse.help.IContext;
import org.eclipse.help.IHelpResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin;
import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.SectionPart;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.plugin.AbstractUIPlugin;

public class IntroductionSection
  extends SectionPart
{
  private static final String HELP_IMAGE_FILE = "help.gif";
  private static Logger _log = JSFUICommonPlugin.getLogger(IntroductionSection.class);
  private String _editorId;
  private FormToolkit _toolkit;
  private Composite _textClient;
  private String _helpContextId;
  private String _helpTooltip;
  
  public IntroductionSection(String editorId, IManagedForm managedForm, FormToolkit toolkit)
  {
    this(editorId, managedForm, toolkit, null, null);
  }
  
  public IntroductionSection(String editorId, IManagedForm managedForm, FormToolkit toolkit, String contextId, String helpTooltip)
  {
    super(managedForm.getForm().getBody(), toolkit, 384);
    super.initialize(managedForm);
    _editorId = editorId;
    _toolkit = toolkit;
    _helpContextId = contextId;
    _helpTooltip = helpTooltip;
    
    _textClient = _toolkit.createComposite(getSection(), 0);
    _textClient.setSize(32, 16);
    
    RowLayout rowLayout = new RowLayout();
    wrap = false;
    pack = false;
    justify = true;
    type = 256;
    marginLeft = 0;
    marginTop = 0;
    marginRight = 0;
    marginBottom = 0;
    spacing = 0;
    _textClient.setLayout(rowLayout);
    
    _toolkit.adapt(_textClient, true, true);
    getSection().setTextClient(_textClient);
    if (_helpContextId != null)
    {
      ImageHyperlink helpImage = new ImageHyperlink(_textClient, 
        0);
      _toolkit.adapt(helpImage, true, true);
      helpImage.setImage(JSFUICommonPlugin.getDefault().getImage("help.gif"));
      if (_helpTooltip != null) {
        helpImage.setToolTipText(_helpTooltip);
      }
      helpImage.setBackground(getSection()
        .getTitleBarGradientBackground());
      helpImage.addHyperlinkListener(new HyperlinkAdapter()
      {
        public void linkActivated(HyperlinkEvent e)
        {
          IContext context = HelpSystem.getContext(_helpContextId);
          if (context != null)
          {
            IHelpResource[] topics = context.getRelatedTopics();
            if ((topics != null) && (topics.length == 1)) {
              PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(topics[0]
                .getHref());
            } else {
              PlatformUI.getWorkbench().getHelpSystem().displayHelp(_helpContextId);
            }
          }
        }
      });
    }
    Composite client = _toolkit.createComposite(getSection());
    createClient(client, _toolkit);
    getSection().setClient(client);
  }
  
  private Composite createClient(Composite container, FormToolkit factory)
  {
    TableWrapLayout layout = new TableWrapLayout();
    numColumns = 2;
    makeColumnsEqualWidth = false;
    horizontalSpacing = 20;
    verticalSpacing = 20;
    container.setLayout(layout);
    
    IConfigurationElement element = getExtensions();
    if (element != null)
    {
      setPageDetails(element);
      
      IConfigurationElement[] children = element.getChildren();
      for (int ii = 0; ii < children.length; ii++) {
        processItems(container, factory, children[ii]);
      }
    }
    else
    {
      setText(Messages.IntroductionSection_noIntroTitle);
      
      setDescription(Messages.IntroductionSection_noIntroDescription);
    }
    factory.paintBordersFor(container);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(container, _helpContextId);
    return container;
  }
  
  private void setPageDetails(IConfigurationElement element)
  {
    setText(element.getAttribute("name"));
    setDescription(element.getAttribute("description"));
  }
  
  private void processItems(Composite parent, FormToolkit toolkit_, IConfigurationElement element)
  {
    String hyperlink = element.getAttribute("hyperlink");
    String iconPath = element.getAttribute("icon");
    String text = element.getAttribute("text");
    String heading = element.getAttribute("heading");
    String action = element.getAttribute("hyperlinkaction");
    if ((iconPath != null) && (iconPath.length() > 0))
    {
      String iconName;
      String iconName;
      if (iconPath.indexOf('/') != -1) {
        iconName = new Path(iconPath).lastSegment();
      } else {
        iconName = iconPath;
      }
      ImageDescriptor imageDescriptor = 
        AbstractUIPlugin.imageDescriptorFromPlugin(
        element.getDeclaringExtension()
        .getContributor().getName(), iconPath);
      if (imageDescriptor != null)
      {
        ImageRegistry imageRegistry = 
          JSFUICommonPlugin.getDefault().getImageRegistry();
        
        Image image = imageRegistry.get(iconName);
        if (image == null)
        {
          image = imageDescriptor.createImage();
          if (image != null) {
            imageRegistry.put(iconName, image);
          } else {
            image = ImageDescriptor.getMissingImageDescriptor().createImage();
          }
        }
        if (image != null)
        {
          ImageContainer img = new ImageContainer(parent);
          img.setImage(image);
          TableWrapData td = new TableWrapData();
          rowspan = 2;
          img.setLayoutData(td);
        }
        else
        {
          JSFUICommonPlugin.getLogger(getClass()).error(new Throwable("Image not created for " + element));
        }
      }
      else
      {
        JSFUICommonPlugin.getLogger(getClass()).error(new Throwable("Image Descriptor not found for " + element));
      }
    }
    if ((heading != null) && (heading.length() > 0))
    {
      Label lbl = toolkit_.createLabel(parent, heading);
      lbl.setFont(JFaceResources.getHeaderFont());
    }
    if ((hyperlink != null) && (hyperlink.length() > 0))
    {
      Hyperlink hypr = toolkit_.createHyperlink(parent, hyperlink, 
        0);
      if ((action != null) && (action.length() > 0)) {
        try
        {
          final IAction thisAction = (IAction)element
            .createExecutableExtension("hyperlinkaction");
          hypr.addHyperlinkListener(new HyperlinkAdapter()
          {
            public void linkActivated(HyperlinkEvent e)
            {
              thisAction.run();
            }
          });
        }
        catch (Exception ee)
        {
          _log.error("log.IntroductionSection.action.error", 
            hyperlink, ee);
          JSFUICommonPlugin.getAlerts().detailError(hyperlink, 
            "log.IntroductionSection.action.error", hyperlink, 
            ee);
        }
      }
    }
    if ((text != null) && (text.length() > 0))
    {
      FormText form = toolkit_.createFormText(parent, false);
      form.setText(text, false, false);
    }
  }
  
  private IConfigurationElement getExtensions()
  {
    IConfigurationElement element = null;
    
    IConfigurationElement[] elements = 
      Platform.getExtensionRegistry()
      .getConfigurationElementsFor(
      "org.eclipse.jst.jsf.common.ui.introductionPage");
    if (elements.length > 0) {
      for (int ii = 0; ii < elements.length; ii++)
      {
        String editorId1 = elements[ii].getDeclaringExtension()
          .getSimpleIdentifier();
        if (_editorId.equals(editorId1))
        {
          element = elements[ii];
          break;
        }
      }
    }
    return element;
  }
  
  private void setText(String text)
  {
    getSection().setText(text);
  }
  
  private void setDescription(String text)
  {
    getSection().setDescription(text);
  }
  
  public void setLayoutData(Object layoutData)
  {
    getSection().setLayoutData(layoutData);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.IntroductionSection
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.common.ui.internal.guiutils.messages";
  public static String IntroductionSection_noIntroDescription;
  public static String IntroductionSection_noIntroTitle;
  public static String BrowserWindow_loading;
  
  static
  {
    NLS.initializeMessages("org.eclipse.jst.jsf.common.ui.internal.guiutils.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.Messages
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.help.HelpSystem;
import org.eclipse.help.IContext;
import org.eclipse.help.IHelpResource;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

class OverviewSection$1
  extends HyperlinkAdapter
{
  OverviewSection$1(OverviewSection paramOverviewSection) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    IContext context = HelpSystem.getContext(OverviewSection.access$0(this$0));
    if (context != null)
    {
      IHelpResource[] topics = context.getRelatedTopics();
      if ((topics != null) && (topics.length == 1)) {
        PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(topics[0].getHref());
      } else {
        PlatformUI.getWorkbench().getHelpSystem().displayHelp(OverviewSection.access$0(this$0));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.OverviewSection.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.jface.action.IAction;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;

class OverviewSection$2
  extends HyperlinkAdapter
{
  OverviewSection$2(OverviewSection paramOverviewSection, IAction paramIAction) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    val$thisAction.run();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.OverviewSection.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.help.HelpSystem;
import org.eclipse.help.IContext;
import org.eclipse.help.IHelpResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin;
import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.SectionPart;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class OverviewSection
  extends SectionPart
{
  private static final String HELP_IMAGE_FILE = "help.gif";
  private static Logger log = JSFUICommonPlugin.getLogger(OverviewSection.class);
  private String editorId;
  private FormToolkit toolkit;
  private ImageHyperlink helpImage;
  private Composite textClient;
  private String helpContextId;
  private String helpTooltip;
  
  public OverviewSection(String editorId, IManagedForm managedForm, FormToolkit toolkit)
  {
    this(editorId, managedForm, toolkit, null, null);
  }
  
  public OverviewSection(String editorId, IManagedForm managedForm, FormToolkit toolkit, String helpContextId, String helpTooltip)
  {
    super(managedForm.getForm().getBody(), toolkit, 384);
    super.initialize(managedForm);
    this.editorId = editorId;
    this.toolkit = toolkit;
    this.helpContextId = helpContextId;
    this.helpTooltip = helpTooltip;
    
    textClient = this.toolkit.createComposite(getSection(), 0);
    textClient.setSize(32, 16);
    
    init();
    
    Composite client = this.toolkit.createComposite(getSection());
    
    getSection().setClient(client);
  }
  
  public OverviewSection(FormEditor editor, IManagedForm managedForm, FormToolkit toolkit, int style)
  {
    super(managedForm.getForm().getBody(), toolkit, 0x100 | style);
    super.initialize(managedForm);
    this.toolkit = toolkit;
    
    textClient = this.toolkit.createComposite(getSection(), 0);
    textClient.setSize(32, 16);
    
    init();
  }
  
  public OverviewSection(FormEditor editor, IManagedForm managedForm, FormToolkit toolkit, int style, String helpContextId, String helpTooltip)
  {
    super(managedForm.getForm().getBody(), toolkit, 0x100 | style);
    super.initialize(managedForm);
    this.toolkit = toolkit;
    
    textClient = toolkit.createComposite(getSection(), 0);
    textClient.setSize(32, 16);
    this.helpContextId = helpContextId;
    this.helpTooltip = helpTooltip;
    init();
  }
  
  public void initialize()
  {
    Composite client = toolkit.createComposite(getSection());
    
    getSection().setClient(client);
  }
  
  private void init()
  {
    RowLayout rowLayout = new RowLayout();
    wrap = false;
    pack = false;
    justify = true;
    type = 256;
    marginLeft = 0;
    marginTop = 0;
    marginRight = 0;
    marginBottom = 0;
    spacing = 0;
    textClient.setLayout(rowLayout);
    
    helpImage = new ImageHyperlink(textClient, 0);
    toolkit.adapt(helpImage, true, true);
    toolkit.adapt(textClient, true, true);
    helpImage.setImage(JSFUICommonPlugin.getDefault().getImage("help.gif"));
    getSection().setTextClient(textClient);
    if (helpTooltip != null) {
      helpImage.setToolTipText(helpTooltip);
    }
    helpImage.setBackground(getSection().getTitleBarGradientBackground());
    helpImage.addHyperlinkListener(new HyperlinkAdapter()
    {
      public void linkActivated(HyperlinkEvent e)
      {
        IContext context = HelpSystem.getContext(helpContextId);
        if (context != null)
        {
          IHelpResource[] topics = context.getRelatedTopics();
          if ((topics != null) && (topics.length == 1)) {
            PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(topics[0].getHref());
          } else {
            PlatformUI.getWorkbench().getHelpSystem().displayHelp(helpContextId);
          }
        }
      }
    });
  }
  
  protected void setPageDetails(IConfigurationElement element)
  {
    setText(element.getAttribute("name"));
    setDescription(element.getAttribute("description"));
  }
  
  public void processItems(Composite parent, FormToolkit toolkit_, IConfigurationElement element)
  {
    String hyperlink = element.getAttribute("hyperlink");
    String text = element.getAttribute("text");
    String action = element.getAttribute("hyperlinkaction");
    if ((hyperlink != null) && (hyperlink.length() > 0))
    {
      Hyperlink hypr = toolkit_.createHyperlink(parent, hyperlink, 
        0);
      if ((action != null) && (action.length() > 0)) {
        try
        {
          final IAction thisAction = (IAction)element
            .createExecutableExtension("hyperlinkaction");
          hypr.addHyperlinkListener(new HyperlinkAdapter()
          {
            public void linkActivated(HyperlinkEvent e)
            {
              thisAction.run();
            }
          });
        }
        catch (Exception ee)
        {
          log.error("log.OverviewSection.action.error", 
            hyperlink, ee);
          JSFUICommonPlugin.getAlerts().detailError(hyperlink, 
            "log.OverviewSection.action.error", hyperlink, ee);
        }
      }
    }
    if ((text != null) && (text.length() > 0))
    {
      FormText form = toolkit_.createFormText(parent, false);
      form.setText(text, false, false);
    }
  }
  
  public IConfigurationElement getExtensions(String extensionPoint)
  {
    IConfigurationElement element = null;
    
    IConfigurationElement[] elements = Platform.getExtensionRegistry()
      .getConfigurationElementsFor(extensionPoint);
    if (elements.length > 0) {
      for (int ii = 0; ii < elements.length; ii++)
      {
        String anEditorId = elements[ii].getDeclaringExtension()
          .getSimpleIdentifier();
        if (editorId.equals(anEditorId))
        {
          element = elements[ii];
          break;
        }
      }
    }
    return element;
  }
  
  private void setText(String text)
  {
    getSection().setText(text);
  }
  
  private void setDescription(String text)
  {
    getSection().setDescription(text);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.OverviewSection
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.swt.widgets.Composite;

class SWTUtils$1$1
  implements Runnable
{
  SWTUtils$1$1(SWTUtils.1 param1, Composite paramComposite) {}
  
  public void run()
  {
    if (!val$c.isDisposed())
    {
      val$c.layout(true);
      val$c.redraw();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.SWTUtils.1.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;

class SWTUtils$1
  implements ControlListener
{
  public void controlResized(ControlEvent e)
  {
    final Composite c = (Composite)widget;
    c.getDisplay().asyncExec(new Runnable()
    {
      public void run()
      {
        if (!c.isDisposed())
        {
          c.layout(true);
          c.redraw();
        }
      }
    });
  }
  
  public void controlMoved(ControlEvent e) {}
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.SWTUtils.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;

public class SWTUtils
{
  private static final int DEFAULT_BUTTON_WIDTH = 70;
  private static final int DEFAULT_COMBO_WIDTH = 100;
  private static final int DEFAULT_TEXTBOX_WIDTH = 100;
  private static final int DEFAULT_RADIO_FILL = 36;
  
  public static Button createCheckBox(Composite parent)
  {
    return createCheckBox(parent, null, 1, 0);
  }
  
  public static Button createCheckBox(Composite parent, String label, int numColumns)
  {
    return createCheckBox(parent, label, numColumns, 0);
  }
  
  public static Button createCheckBox(Composite parent, String label, int numColumns, int indent)
  {
    Button button = new Button(parent, 16416);
    if (label == null) {
      button.setAlignment(16777216);
    }
    GridData data = new GridData(4);
    horizontalSpan = numColumns;
    horizontalIndent = indent;
    button.setLayoutData(data);
    if (label != null) {
      button.setText(label);
    }
    return button;
  }
  
  public static Combo createCombo(Composite parent, String[] items, int numColumns)
  {
    return createCombo(parent, items, numColumns, 100);
  }
  
  public static Combo createCombo(Composite parent, String tokenString, int numColumns)
  {
    return createCombo(parent, getTokenNames(tokenString), numColumns, 
      100);
  }
  
  public static Combo createCombo(Composite parent, String tokenString, int numColumns, int minWidth)
  {
    return createCombo(parent, getTokenNames(tokenString), numColumns, 
      minWidth);
  }
  
  public static Combo createCombo(Composite parent, String[] items, int numColumns, int minWidth)
  {
    return createCombo(parent, items, numColumns, minWidth, false);
  }
  
  public static Combo createCombo(Composite parent, String tokenString, int numColumns, int minWidth, boolean editable)
  {
    return createCombo(parent, getTokenNames(tokenString), numColumns, 
      minWidth, editable);
  }
  
  public static Combo createCombo(Composite parent, String[] items, int numColumns, int minWidth, boolean editable)
  {
    GridData data;
    Combo combo;
    GridData data;
    if (editable)
    {
      Combo combo = new Combo(parent, 4);
      data = new GridData(768);
    }
    else
    {
      combo = new Combo(parent, 12);
      data = new GridData(4);
    }
    horizontalSpan = numColumns;
    widthHint = minWidth;
    combo.setLayoutData(data);
    combo.setItems(items);
    return combo;
  }
  
  public static Composite createComposite(Composite parent, int numColumns)
  {
    return createComposite(parent, numColumns, -1, -1, 
      768, -1, -1, -1);
  }
  
  public static Composite createComposite(Composite parent, int numColumns, int verticalSpacing, int horizontalSpan)
  {
    return createComposite(parent, numColumns, verticalSpacing, 
      horizontalSpan, 768, -1, -1, -1);
  }
  
  public static Composite createComposite(Composite parent, int numColumns, int verticalSpacing, int horizontalSpan, int gridDataFill)
  {
    return createComposite(parent, numColumns, verticalSpacing, 
      horizontalSpan, gridDataFill, -1, -1, -1);
  }
  
  public static Composite createComposite(Composite parent, int numColumns, int verticalSpacing, int horizontalSpan, int gridDataFill, int horizontalSpacing, int marginWidth, int marginHeight)
  {
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = numColumns;
    if (verticalSpacing >= 0) {
      verticalSpacing = verticalSpacing;
    }
    if (horizontalSpacing >= 0) {
      horizontalSpacing = horizontalSpacing;
    }
    if (marginWidth >= 0) {
      marginWidth = marginWidth;
    }
    if (marginHeight >= 0) {
      marginHeight = marginHeight;
    }
    composite.setLayout(layout);
    GridData gd = new GridData(gridDataFill);
    if (horizontalSpan > 0) {
      horizontalSpan = horizontalSpan;
    }
    composite.setLayoutData(gd);
    
    return composite;
  }
  
  public static Group createGroup(Composite parent, String title, int numColumns)
  {
    return createGroup(parent, title, numColumns, -1, 
      768);
  }
  
  public static Group createGroup(Composite parent, String title, int numColumns, int horizontalSpan, int gridDataFill)
  {
    Group group = new Group(parent, 16);
    GridLayout layout = new GridLayout();
    numColumns = numColumns;
    group.setLayout(layout);
    GridData data = new GridData(gridDataFill);
    if (horizontalSpan > 0) {
      horizontalSpan = horizontalSpan;
    }
    group.setLayoutData(data);
    group.setText(title);
    return group;
  }
  
  public static Label createLabel(Composite parent, String text, int numColumns)
  {
    return createLabel(parent, text, numColumns, 0);
  }
  
  public static Label createLabel(Composite parent, String text, int numColumns, int indent)
  {
    Label label = new Label(parent, 16384);
    GridData data = new GridData();
    horizontalSpan = numColumns;
    horizontalAlignment = 4;
    horizontalIndent = indent;
    label.setLayoutData(data);
    label.setText(text);
    return label;
  }
  
  public static Label createLabelImage(Composite parent, Image theImage, int numColumns, Color background)
  {
    Label label = new Label(parent, 16384);
    GridData data = new GridData();
    horizontalSpan = numColumns;
    horizontalAlignment = 4;
    label.setLayoutData(data);
    if (background != null) {
      label.setBackground(background);
    }
    label.setImage(theImage);
    return label;
  }
  
  public static Button createPushButton(Composite parent, String label)
  {
    return createPushButton(parent, label, 70);
  }
  
  public static Button createPushButton(Composite parent, String label, int widthHint)
  {
    Button button = new Button(parent, 8);
    GridData data = new GridData();
    horizontalAlignment = 768;
    widthHint = widthHint;
    button.setLayoutData(data);
    button.setText(label);
    return button;
  }
  
  public static Button createPushButton(Composite parent, Image theImage, int widthHint)
  {
    Button button = new Button(parent, 8);
    GridData data = new GridData();
    horizontalAlignment = 768;
    widthHint = widthHint;
    button.setLayoutData(data);
    button.setImage(theImage);
    button.setAlignment(16777216);
    return button;
  }
  
  public static Button createRadioButton(Composite parent, String label)
  {
    return createRadioButton(parent, label, 36);
  }
  
  public static Button createRadioButton(Composite parent, String label, int gridDataFill)
  {
    return createRadioButton(parent, label, gridDataFill, 1);
  }
  
  public static Button createRadioButton(Composite parent, String label, int gridDataFill, int horizontalSpan)
  {
    Button button = new Button(parent, 16400);
    GridData data = new GridData(gridDataFill);
    horizontalSpan = horizontalSpan;
    button.setLayoutData(data);
    button.setText(label);
    return button;
  }
  
  public static void createSpacer(Composite parent, int numColumns)
  {
    createSpacer(parent, numColumns, 0);
  }
  
  public static void createSpacer(Composite parent, int numColumns, int minWidth)
  {
    Label label = new Label(parent, 0);
    GridData data = new GridData();
    horizontalSpan = numColumns;
    widthHint = minWidth;
    label.setLayoutData(data);
  }
  
  public static void createSeparator(Composite parent, int numColumns)
  {
    Label separator = new Label(parent, 258);
    GridData data = new GridData();
    horizontalSpan = numColumns;
    horizontalAlignment = 4;
    grabExcessHorizontalSpace = true;
    separator.setLayoutData(data);
  }
  
  public static Table createTable(Composite composite, String tokenString, int tablewidth, int tableHeight)
  {
    int style = 68356;
    
    Table table = new Table(composite, style);
    GridData gridData = new GridData(1808);
    if (tablewidth > 0) {
      widthHint = tablewidth;
    }
    if (tableHeight > 0) {
      heightHint = tableHeight;
    }
    table.setLayoutData(gridData);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    if (tokenString != null)
    {
      String[] columns = getTokenNames(tokenString);
      
      int columnSize = 50;
      if (tablewidth > 0) {
        columnSize = tablewidth / columns.length;
      }
      for (int ii = 0; ii < columns.length; ii++) {
        createTableColumn(table, columns[ii], ii, 
          columnSize);
      }
    }
    return table;
  }
  
  public static Table createTable(Composite composite, String[] columns, int tablewidth)
  {
    int style = 67584;
    Table table = new Table(composite, style);
    GridData gridData = new GridData(1808);
    widthHint = tablewidth;
    table.setLayoutData(gridData);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    if (columns != null) {
      for (int i = 0; i < columns.length; i++) {
        createTableColumn(table, columns[i], i);
      }
    }
    return table;
  }
  
  public static TableColumn createTableColumn(Table parent, String name, int index)
  {
    TableColumn column = new TableColumn(parent, 16384, index);
    column.setText(name);
    return column;
  }
  
  public static TableColumn createTableColumn(Table parent, Image image, int index)
  {
    TableColumn column = new TableColumn(parent, 16384, index);
    column.setImage(image);
    column.setWidth(getBoundswidth);
    column.setResizable(false);
    return column;
  }
  
  public static TableColumn createTableColumn(Table parent, String name, int index, int tablewidth)
  {
    TableColumn column = new TableColumn(parent, 16384, index);
    column.setText(name);
    column.setWidth(tablewidth);
    return column;
  }
  
  public static Text createTextBox(Composite parent)
  {
    return createTextBox(parent, 1, 100);
  }
  
  public static Text createTextBox(Composite parent, String text)
  {
    Text textbox = createTextBox(parent, 1);
    textbox.setText(text);
    return textbox;
  }
  
  public static Text createTextBox(Composite parent, int numColumns)
  {
    return createTextBox(parent, numColumns, 100);
  }
  
  public static Text createTextBox(Composite parent, int numColumns, int minWidth)
  {
    return createTextBox(parent, numColumns, minWidth, -1);
  }
  
  public static Text createTextBox(Composite parent, int numColumns, int minWidth, int minHeight)
  {
    Text text = new Text(parent, 2052);
    GridData data = new GridData(4);
    horizontalSpan = numColumns;
    widthHint = minWidth;
    heightHint = minHeight;
    text.setLayoutData(data);
    return text;
  }
  
  public static Text createTextBoxScrollable(Composite parent, int numColumns, int minWidth, int minHeight)
  {
    Text text = new Text(parent, 2624);
    GridData data = new GridData(minWidth > 0 ? 4 : 
      768);
    horizontalSpan = numColumns;
    if (minWidth > 0) {
      widthHint = minWidth;
    }
    heightHint = minHeight;
    
    text.setLayoutData(data);
    return text;
  }
  
  public static List createList(Composite parent, int numColumns, int minWidth, int minHeight, String[] items)
  {
    return createList(parent, numColumns, minWidth, minHeight, items, true);
  }
  
  public static List createList(Composite parent, int numColumns, int minWidth, int minHeight, String[] items, boolean bmulti)
  {
    return createList(parent, numColumns, minWidth, minHeight, items, 
      bmulti, 1);
  }
  
  public static List createList(Composite parent, int numColumns, int minWidth, int minHeight, String[] items, boolean bmulti, int verticalSpan)
  {
    List theList;
    List theList;
    if (bmulti) {
      theList = new List(parent, 2818);
    } else {
      theList = new List(parent, 2820);
    }
    GridData data = new GridData(1810);
    
    horizontalSpan = numColumns;
    widthHint = minWidth;
    heightHint = minHeight;
    verticalSpan = verticalSpan;
    theList.setLayoutData(data);
    if (items != null) {
      theList.setItems(items);
    }
    return theList;
  }
  
  public static void computeScrollArea(ScrolledComposite parentComposite, Composite childComposite)
  {
    Point pt = childComposite.computeSize(-1, -1);
    parentComposite.setExpandHorizontal(true);
    parentComposite.setExpandVertical(true);
    parentComposite.setMinWidth(x);
    parentComposite.setMinHeight(y);
  }
  
  public static String[] getTokenNames(String tokenString)
  {
    if (tokenString == null) {
      return new String[0];
    }
    return tokenString.split(",");
  }
  
  public static void setWidgetState(Control widget, boolean state)
  {
    if ((widget instanceof Composite))
    {
      Control[] widgets = ((Composite)widget).getChildren();
      for (int i = 0; i < widgets.length; i++) {
        setWidgetState(widgets[i], state);
      }
    }
    widget.setEnabled(state);
  }
  
  static ControlListener _listener = new ControlListener()
  {
    public void controlResized(ControlEvent e)
    {
      final Composite c = (Composite)widget;
      c.getDisplay().asyncExec(new Runnable()
      {
        public void run()
        {
          if (!c.isDisposed())
          {
            c.layout(true);
            c.redraw();
          }
        }
      });
    }
    
    public void controlMoved(ControlEvent e) {}
  };
  
  public static void workaroundResize(Composite composite)
  {
    composite.addControlListener(_listener);
  }
}

/* Location:
 * Q
1 2 3 4 5 6 7 8 9 10 11

Further reading...

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

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd