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

Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.guiutils;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;

class Alerts$1
  implements Runnable
{
  Alerts$1(Alerts paramAlerts, String paramString, IStatus paramIStatus) {}
  
  public void run()
  {
    ErrorDialog.openError(null, val$ftitle, null, val$fstatus);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.Alerts.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.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;

class Alerts$2
  implements Runnable
{
  Alerts$2(Alerts paramAlerts, String paramString1, String paramString2, IStatus paramIStatus) {}
  
  public void run()
  {
    ErrorDialog.openError(null, val$ftitle, val$fmsg, val$fstatus);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.Alerts.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.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;

class Alerts$3
  implements Runnable
{
  Alerts$3(Alerts paramAlerts, String paramString, IStatus paramIStatus) {}
  
  public void run()
  {
    ErrorDialog.openError(null, val$ftitle, null, val$fstatus);
  }
}

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

import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;

public class Alerts
{
  private static boolean _noAlerts = false;
  private ResourceBundle _rb;
  private String _pluginId;
  
  public Alerts(AbstractUIPlugin plugin, ResourceBundle rb)
  {
    _rb = rb;
    if (_rb == null) {
      throw new NullPointerException(
        "No resource bundle was provided to the Alerts.");
    }
    if (plugin == null) {
      throw new NullPointerException(
        "No plugin was provided to the Alerts.");
    }
    _pluginId = plugin.getBundle().getSymbolicName();
  }
  
  public String getInput(String titleKey, String msgKey, String initialValue, IInputValidator validator)
  {
    if (_noAlerts) {
      return null;
    }
    InputDialog inDialog = new InputDialog(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), getResourceString(msgKey), 
      initialValue, validator);
    inDialog.open();
    return inDialog.getValue();
  }
  
  public void error(String titleKey, String msgKey)
  {
    if (_noAlerts) {
      return;
    }
    MessageDialog.openError(
      PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), getResourceString(msgKey));
  }
  
  public void error(String titleKey, String msgKey, Object arg0)
  {
    if (_noAlerts) {
      return;
    }
    Object[] args = new Object[1];
    args[0] = arg0;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    MessageDialog.openError(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), formatter.format(args));
  }
  
  public void error(String titleKey, String msgKey, Object arg0, Object arg1)
  {
    if (_noAlerts) {
      return;
    }
    Object[] args = new Object[2];
    args[0] = arg0;
    args[1] = arg1;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    MessageDialog.openError(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), formatter.format(args));
  }
  
  public void error(String titleKey, String msgKey, Object arg0, Object arg1, Object arg2)
  {
    if (_noAlerts) {
      return;
    }
    Object[] args = new Object[3];
    args[0] = arg0;
    args[1] = arg1;
    args[2] = arg2;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    MessageDialog.openError(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), formatter.format(args));
  }
  
  public void error(String titleKey, String msgKey, Object arg0, Object arg1, Object arg2, Object arg3)
  {
    if (_noAlerts) {
      return;
    }
    Object[] args = new Object[4];
    args[0] = arg0;
    args[1] = arg1;
    args[2] = arg2;
    args[3] = arg3;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    MessageDialog.openError(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), formatter.format(args));
  }
  
  public void error(Shell shell, String titleKey, String msgKey)
  {
    if (_noAlerts) {
      return;
    }
    MessageDialog.openError(shell, getResourceString(titleKey), 
      getResourceString(msgKey));
  }
  
  public void detailError(String titleKey, String msgKey)
  {
    if (_noAlerts) {
      return;
    }
    final IStatus fstatus = new Status(4, _pluginId, 
      0, getResourceString(msgKey), null);
    final String ftitle = getResourceString(titleKey);
    
    Display display = getStandardDisplay();
    display.asyncExec(new Runnable()
    {
      public void run()
      {
        ErrorDialog.openError(null, ftitle, null, fstatus);
      }
    });
  }
  
  public void detailError(String titleKey, String msgKey, Throwable tt)
  {
    if (_noAlerts) {
      return;
    }
    internalDetailError(getResourceString(titleKey), 
      getResourceString(msgKey), tt);
  }
  
  public void detailError(String titleKey, String msgKey, Object arg0, Throwable tt)
  {
    if (_noAlerts) {
      return;
    }
    Object[] args = new Object[1];
    args[0] = arg0;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    internalDetailError(getResourceString(titleKey), 
      formatter.format(args), tt);
  }
  
  public void detailError(String titleKey, String msgKey, Object arg0, Object arg1, Throwable tt)
  {
    if (_noAlerts) {
      return;
    }
    Object[] args = new Object[1];
    args[0] = arg0;
    args[1] = arg1;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    internalDetailError(getResourceString(titleKey), 
      formatter.format(args), tt);
  }
  
  private void internalDetailError(String title, String msg, Throwable tt)
  {
    if (_noAlerts) {
      return;
    }
    if ((tt instanceof InvocationTargetException)) {
      tt = ((InvocationTargetException)tt).getTargetException();
    }
    IStatus status = null;
    if ((tt instanceof CoreException))
    {
      status = ((CoreException)tt).getStatus();
      if (!(status instanceof MultiStatus))
      {
        Throwable th = status.getException();
        if (th == null) {
          th = tt;
        }
        status = buildStackTraceStatus(4, status
          .getPlugin(), status.getMessage(), th);
      }
    }
    else
    {
      status = buildStackTraceStatus(4, _pluginId, tt
        .getMessage(), tt);
    }
    final String ftitle = title;
    final IStatus fstatus = status;
    final String fmsg = msg;
    Display display = getStandardDisplay();
    display.asyncExec(new Runnable()
    {
      public void run()
      {
        ErrorDialog.openError(null, ftitle, fmsg, fstatus);
      }
    });
  }
  
  public IStatus buildStackTraceStatus(int code, String pluginId, String message, Throwable tt)
  {
    if (tt == null) {
      return new Status(code, pluginId, 0, message, tt);
    }
    MultiStatus mstat = new MultiStatus(pluginId, code, message, tt);
    
    StackTraceElement[] trace = tt.getStackTrace();
    
    mstat.add(new Status(code, pluginId, 0, tt.toString(), null));
    for (int ii = 0; ii < trace.length; ii++) {
      mstat.add(new Status(code, pluginId, 0, trace[ii]
        .toString(), null));
    }
    return mstat;
  }
  
  public void detailError(String title, IStatus status)
  {
    if (_noAlerts) {
      return;
    }
    final IStatus fstatus = status;
    final String ftitle = title;
    Display display = getStandardDisplay();
    display.asyncExec(new Runnable()
    {
      public void run()
      {
        ErrorDialog.openError(null, ftitle, null, fstatus);
      }
    });
  }
  
  public void info(String titleKey, String msgKey)
  {
    if (_noAlerts) {
      return;
    }
    MessageDialog.openInformation(
      PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), getResourceString(msgKey));
  }
  
  public void info(String titleKey, String msgKey, Object arg0)
  {
    if (_noAlerts) {
      return;
    }
    Object[] args = new Object[1];
    args[0] = arg0;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    MessageDialog.openInformation(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), formatter.format(args));
  }
  
  public boolean confirm(String titleKey, String msgKey)
  {
    if (_noAlerts) {
      return true;
    }
    return MessageDialog.openConfirm(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), getResourceString(msgKey));
  }
  
  public boolean confirm(String titleKey, String msgKey, Object arg0)
  {
    if (_noAlerts) {
      return true;
    }
    Object[] args = new Object[1];
    args[0] = arg0;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    return MessageDialog.openConfirm(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), formatter.format(args));
  }
  
  public boolean question(String titleKey, String msgKey)
  {
    if (_noAlerts) {
      return true;
    }
    return MessageDialog.openQuestion(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), getResourceString(msgKey));
  }
  
  public boolean question(String titleKey, String msgKey, Object arg0)
  {
    if (_noAlerts) {
      return true;
    }
    Object[] args = new Object[1];
    args[0] = arg0;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    return MessageDialog.openQuestion(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), formatter.format(args));
  }
  
  public void warning(String titleKey, String msgKey)
  {
    if (_noAlerts) {
      return;
    }
    MessageDialog.openWarning(
      PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), getResourceString(msgKey));
  }
  
  public void warning(String titleKey, String msgKey, Object arg0)
  {
    if (_noAlerts) {
      return;
    }
    Object[] args = new Object[1];
    args[0] = arg0;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    MessageDialog.openWarning(PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getShell(), 
      getResourceString(titleKey), formatter.format(args));
  }
  
  private Display getStandardDisplay()
  {
    Display display = Display.getCurrent();
    if (display == null) {
      display = Display.getDefault();
    }
    return display;
  }
  
  private String getResourceString(String key)
  {
    if (key == null) {
      return null;
    }
    try
    {
      return _rb.getString(key);
    }
    catch (MissingResourceException localMissingResourceException) {}
    return key;
  }
  
  public void throwCoreException(String msgKey)
    throws CoreException
  {
    IStatus status = new Status(4, _pluginId, 0, 
      getResourceString(msgKey), null);
    throw new CoreException(status);
  }
  
  public void throwCoreException(Throwable ee)
    throws CoreException
  {
    IStatus status = new Status(4, _pluginId, 0, ee
      .getMessage(), ee);
    throw new CoreException(status);
  }
  
  public void throwCoreException(String msgKey, Throwable ee)
    throws CoreException
  {
    IStatus status = new Status(4, _pluginId, 0, 
      getResourceString(msgKey), ee);
    throw new CoreException(status);
  }
  
  public void throwCoreException(String msgKey, Object arg0)
    throws CoreException
  {
    Object[] args = new Object[1];
    args[0] = arg0;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    IStatus status = new Status(4, _pluginId, 0, 
      formatter.format(args), null);
    throw new CoreException(status);
  }
  
  public void throwCoreException(String msgKey, Object arg0, Throwable ee)
    throws CoreException
  {
    Object[] args = new Object[1];
    args[0] = arg0;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    IStatus status = new Status(4, _pluginId, 0, 
      formatter.format(args), ee);
    throw new CoreException(status);
  }
  
  public void throwCoreException(String msgKey, Object arg0, Object arg1)
    throws CoreException
  {
    Object[] args = new Object[2];
    args[0] = arg0;
    args[1] = arg1;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    IStatus status = new Status(4, _pluginId, 0, 
      formatter.format(args), null);
    throw new CoreException(status);
  }
  
  public void throwCoreException(String msgKey, Object arg0, Object arg1, Throwable ee)
    throws CoreException
  {
    Object[] args = new Object[2];
    args[0] = arg0;
    args[1] = arg1;
    
    MessageFormat formatter = new MessageFormat(getResourceString(msgKey));
    
    IStatus status = new Status(4, _pluginId, 0, 
      formatter.format(args), ee);
    throw new CoreException(status);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.Alerts
 * 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.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.ScrollBar;

class BrowserWindow$1
  extends ControlAdapter
{
  BrowserWindow$1(BrowserWindow paramBrowserWindow) {}
  
  public void controlResized(ControlEvent e)
  {
    Point pt = BrowserWindow.access$0(this$0).getParent().getSize();
    Rectangle rect = BrowserWindow.access$1(this$0).getBounds();
    
    x -= x;
    y -= y;
    
    x -= 10;
    y -= 60;
    if ((x <= 0) || (y <= 0)) {
      return;
    }
    Rectangle innerRect = BrowserWindow.access$0(this$0).getContent().getBounds();
    Rectangle outerRect = BrowserWindow.access$0(this$0).getBounds();
    if (width > width) {
      y -= access$0this$0).getHorizontalBar().getSize().y;
    }
    if (height > height) {
      x -= access$0this$0).getVerticalBar().getSize().x;
    }
    BrowserWindow.access$1(this$0).setSize(pt);
    BrowserWindow.access$1(this$0).getParent().layout(true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow.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.browser.StatusTextEvent;
import org.eclipse.swt.browser.StatusTextListener;

class BrowserWindow$2
  implements StatusTextListener
{
  BrowserWindow$2(BrowserWindow paramBrowserWindow) {}
  
  public void changed(StatusTextEvent event)
  {
    this$0.setStatus(text);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow.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.browser.Browser;
import org.eclipse.swt.browser.LocationAdapter;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.widgets.ToolItem;

class BrowserWindow$3
  extends LocationAdapter
{
  BrowserWindow$3(BrowserWindow paramBrowserWindow) {}
  
  public void changed(LocationEvent event)
  {
    BrowserWindow.access$2(this$0).setEnabled(BrowserWindow.access$3(this$0).isBackEnabled());
    BrowserWindow.access$4(this$0).setEnabled(BrowserWindow.access$3(this$0).isForwardEnabled());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow.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.swt.browser.OpenWindowListener;
import org.eclipse.swt.browser.WindowEvent;

class BrowserWindow$4
  implements OpenWindowListener
{
  BrowserWindow$4(BrowserWindow paramBrowserWindow) {}
  
  public void open(WindowEvent event)
  {
    if (BrowserWindow.access$5(this$0))
    {
      BrowserWindow window = new BrowserWindow(this$0.getShell());
      window.open();
      browser = window.getBrowser();
    }
    else
    {
      browser = this$0.getBrowser();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow.4
 * 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.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class BrowserWindow$5
  extends SelectionAdapter
{
  BrowserWindow$5(BrowserWindow paramBrowserWindow) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    this$0.browserCmd(1);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow.5
 * 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.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class BrowserWindow$6
  extends SelectionAdapter
{
  BrowserWindow$6(BrowserWindow paramBrowserWindow) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    this$0.browserCmd(2);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow.6
 * 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.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class BrowserWindow$7
  extends SelectionAdapter
{
  BrowserWindow$7(BrowserWindow paramBrowserWindow) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    this$0.browserCmd(3);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow.7
 * 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.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class BrowserWindow$8
  extends SelectionAdapter
{
  BrowserWindow$8(BrowserWindow paramBrowserWindow) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    this$0.browserCmd(4);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow.8
 * 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.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class BrowserWindow$9
  extends SelectionAdapter
{
  BrowserWindow$9(BrowserWindow paramBrowserWindow) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    this$0.browserCmd(5);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow.9
 * 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.window.ApplicationWindow;
import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.LocationAdapter;
import org.eclipse.swt.browser.LocationEvent;
import org.eclipse.swt.browser.OpenWindowListener;
import org.eclipse.swt.browser.StatusTextEvent;
import org.eclipse.swt.browser.StatusTextListener;
import org.eclipse.swt.browser.WindowEvent;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;

public class BrowserWindow
  extends ApplicationWindow
{
  private static final String RELOAD_ITEM_IMAGE_FILE = "reload_nav_16.gif";
  private static final String REFRESH_ITEM_IMAGE_FILE = "refresh_nav_16.gif";
  private static final String STOP_ITEM_IMAGE_FILE = "stop_nav_16.gif";
  private static final String FORWARD_ITEM_IMAGE_FILE = "forward_nav_16.gif";
  private static final String BACK_ITEM_IMAGE_FILE = "back_nav_16.gif";
  private static final int BROWSER_CMD_BACK = 1;
  private static final int BROWSER_CMD_FORWARD = 2;
  private static final int BROWSER_CMD_STOP = 3;
  private static final int BROWSER_CMD_REFRESH = 4;
  private static final int BROWSER_CMD_RELOAD = 5;
  private boolean _bIncludeToolbar;
  private boolean _bPopups;
  private String _title;
  private ScrolledComposite _scomp;
  private Composite _browserComposite;
  private Browser _browser;
  private String _startLocation;
  private String _startContent;
  private ToolItem _backItem;
  private ToolItem _forwardItem;
  
  public BrowserWindow(Shell parentShell)
  {
    this(parentShell, false, null, false);
  }
  
  public BrowserWindow(Shell parentShell, boolean bPopups, String title)
  {
    this(parentShell, bPopups, title, false);
  }
  
  public BrowserWindow(Shell parentShell, boolean bPopups, String title, boolean bModal)
  {
    super(parentShell);
    addStatusLine();
    _bPopups = bPopups;
    _title = title;
    includeToolbar(true);
    if ((bModal) && (parentShell != null))
    {
      setShellStyle(getShellStyle() | 0x10000);
      setBlockOnOpen(true);
    }
  }
  
  public void includeToolbar(boolean bIncludeToolbar)
  {
    _bIncludeToolbar = bIncludeToolbar;
  }
  
  public void setTitle(String title)
  {
    if ((title != null) && (super.getShell() != null)) {
      super.getShell().setText(title);
    }
  }
  
  public void setStartLocation(String startLocation)
  {
    _startLocation = startLocation;
  }
  
  public void setStartContent(String startContent)
  {
    _startContent = startContent;
  }
  
  public Browser getBrowser()
  {
    return _browser;
  }
  
  protected Control createContents(Composite parent)
  {
    _scomp = new ScrolledComposite(parent, 768);
    
    Composite innerComposite = SWTUtils.createComposite(_scomp, 1, 10, -1);
    _scomp.setContent(innerComposite);
    ControlListener listener = new ControlAdapter()
    {
      public void controlResized(ControlEvent e)
      {
        Point pt = _scomp.getParent().getSize();
        Rectangle rect = _browserComposite.getBounds();
        
        x -= x;
        y -= y;
        
        x -= 10;
        y -= 60;
        if ((x <= 0) || (y <= 0)) {
          return;
        }
        Rectangle innerRect = _scomp.getContent().getBounds();
        Rectangle outerRect = _scomp.getBounds();
        if (width > width) {
          y -= _scomp.getHorizontalBar().getSize().y;
        }
        if (height > height) {
          x -= _scomp.getVerticalBar().getSize().x;
        }
        _browserComposite.setSize(pt);
        _browserComposite.getParent().layout(true);
      }
    };
    _scomp.addControlListener(listener);
    if (_bIncludeToolbar)
    {
      ToolBar tb = new ToolBar(innerComposite, 8388864);
      fillToolbar(tb);
    }
    _browserComposite = new Composite(innerComposite, 0);
    _browserComposite.setLayout(new FillLayout());
    
    _browser = new Browser(_browserComposite, 0);
    if (_startLocation != null) {
      _browser.setUrl(_startLocation);
    } else if (_startContent != null) {
      _browser.setText(_startContent);
    } else {
      _browser.setText(Messages.BrowserWindow_loading);
    }
    _browser.addStatusTextListener(new StatusTextListener()
    {
      public void changed(StatusTextEvent event)
      {
        setStatus(text);
      }
    });
    if (_bIncludeToolbar) {
      _browser.addLocationListener(new LocationAdapter()
      {
        public void changed(LocationEvent event)
        {
          _backItem.setEnabled(_browser.isBackEnabled());
          _forwardItem.setEnabled(_browser.isForwardEnabled());
        }
      });
    }
    _browser.addOpenWindowListener(new OpenWindowListener()
    {
      public void open(WindowEvent event)
      {
        if (_bPopups)
        {
          BrowserWindow window = new BrowserWindow(getShell());
          window.open();
          browser = window.getBrowser();
        }
        else
        {
          browser = getBrowser();
        }
      }
    });
    setTitle(_title);
    SWTUtils.computeScrollArea(_scomp, innerComposite);
    return _scomp;
  }
  
  protected void fillToolbar(ToolBar tb)
  {
    _backItem = new ToolItem(tb, 8);
    _backItem.setImage(JSFUICommonPlugin.getDefault()
      .getImage("back_nav_16.gif"));
    _backItem.setToolTipText(
      JSFUICommonPlugin.getResourceString("BrowserWindow.back.tooltip"));
    SelectionListener backSelectionListener = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        browserCmd(1);
      }
    };
    _backItem.addSelectionListener(backSelectionListener);
    
    _forwardItem = new ToolItem(tb, 8);
    _forwardItem.setImage(JSFUICommonPlugin.getDefault().getImage(
      "forward_nav_16.gif"));
    _forwardItem.setToolTipText(
      JSFUICommonPlugin.getResourceString("BrowserWindow.forward.tooltip"));
    SelectionListener forwardSelectionListener = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        browserCmd(2);
      }
    };
    _forwardItem.addSelectionListener(forwardSelectionListener);
    
    ToolItem stopItem = new ToolItem(tb, 8);
    stopItem
      .setImage(JSFUICommonPlugin.getDefault().getImage("stop_nav_16.gif"));
    stopItem.setToolTipText(
      JSFUICommonPlugin.getResourceString("BrowserWindow.stop.tooltip"));
    SelectionListener stopSelectionListener = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        browserCmd(3);
      }
    };
    stopItem.addSelectionListener(stopSelectionListener);
    
    ToolItem refreshItem = new ToolItem(tb, 8);
    refreshItem.setImage(JSFUICommonPlugin.getDefault().getImage(
      "refresh_nav_16.gif"));
    refreshItem.setToolTipText(
      JSFUICommonPlugin.getResourceString("BrowserWindow.refresh.tooltip"));
    SelectionListener refreshServiceSelectionListener = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        browserCmd(4);
      }
    };
    refreshItem.addSelectionListener(refreshServiceSelectionListener);
    if ((_startLocation != null) || (_startContent != null))
    {
      ToolItem reloadItem = new ToolItem(tb, 8);
      reloadItem.setImage(JSFUICommonPlugin.getDefault().getImage(
        "reload_nav_16.gif"));
      reloadItem.setToolTipText(
        JSFUICommonPlugin.getResourceString("BrowserWindow.reload.tooltip"));
      SelectionListener reloadSelectionListener = new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent event)
        {
          browserCmd(5);
        }
      };
      reloadItem.addSelectionListener(reloadSelectionListener);
    }
  }
  
  public boolean browserCmd(int cmd)
  {
    switch (cmd)
    {
    case 1: 
      return _browser.back();
    case 2: 
      return _browser.forward();
    case 3: 
      _browser.stop();
      return true;
    case 4: 
      _browser.refresh();
      return true;
    case 5: 
      if (_startLocation != null) {
        _browser.setUrl(_startLocation);
      } else if (_startContent != null) {
        _browser.setText(_startContent);
      }
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.BrowserWindow
 * 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.widgets.Composite;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;

class CollapsableSection$1
  extends ExpansionAdapter
{
  CollapsableSection$1(CollapsableSection paramCollapsableSection) {}
  
  public void expansionStateChanged(ExpansionEvent event)
  {
    SWTUtils.computeScrollArea(CollapsableSection.access$0(this$0), 
      (Composite)CollapsableSection.access$0(this$0).getContent());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.CollapsableSection.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.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;

public abstract class CollapsableSection
{
  private FormToolkit _toolkit;
  private Section _section;
  private ScrolledComposite _scomp;
  private String _title;
  private int _expansionStyle;
  
  public CollapsableSection(FormToolkit toolkit, ScrolledComposite scomp, String title, boolean bCollapsed)
  {
    _toolkit = toolkit;
    _scomp = scomp;
    _title = title;
    _expansionStyle = 10;
    if (bCollapsed) {
      _expansionStyle |= 0x20;
    } else {
      _expansionStyle |= 0x40;
    }
  }
  
  public abstract void setCollapsableContent(Composite paramComposite);
  
  public Control createControl(Composite parent, int horizontalSpan)
  {
    _section = _toolkit.createSection(parent, _expansionStyle);
    _section.clientVerticalSpacing = 5;
    
    _section.setText(_title);
    _toolkit.createCompositeSeparator(_section);
    _section.addExpansionListener(new ExpansionAdapter()
    {
      public void expansionStateChanged(ExpansionEvent event)
      {
        SWTUtils.computeScrollArea(_scomp, 
          (Composite)_scomp.getContent());
      }
    });
    Composite content = new Composite(_section, 0);
    setCollapsableContent(content);
    
    _section.setClient(content);
    GridData gd = new GridData(768);
    horizontalSpan = horizontalSpan;
    _section.setLayoutData(gd);
    
    return _section;
  }
  
  public void setExpanded(boolean expanded)
  {
    if (_section != null)
    {
      _section.setExpanded(expanded);
      
      SWTUtils.computeScrollArea(_scomp, (Composite)_scomp.getContent());
    }
  }
  
  public Section getSection()
  {
    return _section;
  }
}

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

import java.util.Properties;
import org.eclipse.jst.jsf.common.ui.internal.utils.FavoriteConfigurations;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Combo;

class FavoriteSection$1
  extends SelectionAdapter
{
  FavoriteSection$1(FavoriteSection paramFavoriteSection) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    String favName = FavoriteSection.access$0(this$0).getText().trim();
    if (favName.length() > 0)
    {
      Properties favProp = FavoriteSection.access$1(this$0).getFavorite(FavoriteSection.access$0(this$0)
        .getText().trim());
      if (favProp != null) {
        this$0.setFavorites(favProp);
      }
    }
  }
}

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

import java.util.Properties;
import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin;
import org.eclipse.jst.jsf.common.ui.internal.utils.FavoriteConfigurations;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Combo;

class FavoriteSection$2
  extends SelectionAdapter
{
  FavoriteSection$2(FavoriteSection paramFavoriteSection) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    String favName = FavoriteSection.access$0(this$0).getText().trim();
    if (favName.length() == 0) {
      favName = 
        JSFUICommonPlugin.getResourceString("favorites.default");
    }
    Properties favProp = new Properties();
    this$0.saveFavorites(favProp);
    
    FavoriteSection.access$1(this$0).addFavorite(favName, favProp);
    FavoriteSection.access$1(this$0).saveFavorites();
    
    FavoriteSection.access$0(this$0).removeAll();
    String[] names = FavoriteSection.access$1(this$0).getFavoritesList();
    
    FavoriteSection.access$0(this$0).setItems(names);
    FavoriteSection.access$0(this$0).setText(favName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.FavoriteSection.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.jst.jsf.common.ui.internal.utils.FavoriteConfigurations;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Combo;

class FavoriteSection$3
  extends SelectionAdapter
{
  FavoriteSection$3(FavoriteSection paramFavoriteSection) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    String favName = FavoriteSection.access$0(this$0).getText().trim();
    if (favName.length() > 0)
    {
      FavoriteSection.access$1(this$0).removeFavorite(favName);
      FavoriteSection.access$1(this$0).saveFavorites();
      
      this$0.removeFavorites();
      
      FavoriteSection.access$0(this$0).removeAll();
      String[] names = FavoriteSection.access$1(this$0).getFavoritesList();
      FavoriteSection.access$0(this$0).setItems(names);
    }
  }
}

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

import java.util.Properties;
import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin;
import org.eclipse.jst.jsf.common.ui.internal.utils.FavoriteConfigurations;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.plugin.AbstractUIPlugin;

public abstract class FavoriteSection
{
  private FavoriteConfigurations _favorites;
  private Combo _favoriteCombo;
  
  public FavoriteSection(AbstractUIPlugin plugin, String favoriteName)
  {
    _favorites = new FavoriteConfigurations(plugin, favoriteName);
  }
  
  public Combo createFavoriteGroup(Composite parent, int horizontalSpan, int comboMinWidth)
  {
    Group favGroup = SWTUtils.createGroup(parent, 
      JSFUICommonPlugin.getResourceString("favorites.group.label"), 4, horizontalSpan, 
      3);
    
    SWTUtils.createLabel(favGroup, 
      JSFUICommonPlugin.getResourceString("favorites.label"), 1);
    _favoriteCombo = SWTUtils.createCombo(favGroup, _favorites
      .getFavoritesList(), 1, comboMinWidth, true);
    _favoriteCombo.setToolTipText(
      JSFUICommonPlugin.getResourceString("favorites.tooltip"));
    _favoriteCombo.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        String favName = _favoriteCombo.getText().trim();
        if (favName.length() > 0)
        {
          Properties favProp = _favorites.getFavorite(_favoriteCombo
            .getText().trim());
          if (favProp != null) {
            setFavorites(favProp);
          }
        }
      }
    });
    Button saveButton = SWTUtils.createPushButton(favGroup, 
      JSFUICommonPlugin.getResourceString("button.save"));
    saveButton.setToolTipText(
      JSFUICommonPlugin.getResourceString("favorites.save.tooltip"));
    saveButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        String favName = _favoriteCombo.getText().trim();
        if (favName.length() == 0) {
          favName = 
            JSFUICommonPlugin.getResourceString("favorites.default");
        }
        Properties favProp = new Properties();
        saveFavorites(favProp);
        
        _favorites.addFavorite(favName, favProp);
        _favorites.saveFavorites();
        
        _favoriteCombo.removeAll();
        String[] names = _favorites.getFavoritesList();
        
        _favoriteCombo.setItems(names);
        _favoriteCombo.setText(favName);
      }
    });
    Button removeButton = SWTUtils.createPushButton(favGroup, 
      JSFUICommonPlugin.getResourceString("button.remove"));
    removeButton.setToolTipText(
      JSFUICommonPlugin.getResourceString("favorites.remove.tooltip"));
    removeButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        String favName = _favoriteCombo.getText().trim();
        if (favName.length() > 0)
        {
          _favorites.removeFavorite(favName);
          _favorites.saveFavorites();
          
          removeFavorites();
          
          _favoriteCombo.removeAll();
          String[] names = _favorites.getFavoritesList();
          _favoriteCombo.setItems(names);
        }
      }
    });
    return _favoriteCombo;
  }
  
  public abstract void setFavorites(Properties paramProperties);
  
  public abstract void saveFavorites(Properties paramProperties);
  
  public void removeFavorites() {}
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.guiutils.FavoriteSection
 * Java Class Version: 5 (49.0)
 * JD-Core Vers
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