org.eclipse.wst.internet.monitor.ui_1.0.507.v20110817_1651

16:49:03.829 INFO  jd.cli.Main - Decompiling org.eclipse.wst.internet.monitor.ui_1.0.507.v20110817_1651.jar
package org.eclipse.wst.internet.monitor.ui.internal;

public abstract interface ContextIds
{
  public static final String VIEW = "org.eclipse.wst.internet.monitor.ui.tmvw0000";
  public static final String VIEW_TREE = "org.eclipse.wst.internet.monitor.ui.tmvw0002";
  public static final String VIEW_REQUEST = "org.eclipse.wst.internet.monitor.ui.tmvw0004";
  public static final String VIEW_RESPONSE = "org.eclipse.wst.internet.monitor.ui.tmvw0006";
  public static final String PREF = "org.eclipse.wst.internet.monitor.ui.tmpr0000";
  public static final String PREF_SHOW = "org.eclipse.wst.internet.monitor.ui.tmpr0002";
  public static final String PREF_MONITORS = "org.eclipse.wst.internet.monitor.ui.tmpr0004";
  public static final String PREF_DIALOG = "org.eclipse.wst.internet.monitor.ui.tmpr0006";
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.ContextIds
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  public static String editMonitor;
  public static String newMonitor;
  public static String localPort;
  public static String remoteHost;
  public static String remotePort;
  public static String remoteGroup;
  public static String connectionTimeout;
  public static String autoStart;
  public static String parseType;
  public static String errorDialogTitle;
  public static String preferenceDescription;
  public static String prefShowView;
  public static String monitorList;
  public static String columnStatus;
  public static String columnRemote;
  public static String columnType;
  public static String columnLocal;
  public static String columnAutoStart;
  public static String add;
  public static String edit;
  public static String remove;
  public static String start;
  public static String stop;
  public static String started;
  public static String stopped;
  public static String headerLabel;
  public static String imageViewInvalid;
  public static String xmlViewInvalid;
  public static String htmlViewInvalid;
  public static String viewDateFormat;
  public static String viewTime;
  public static String viewResponseTime;
  public static String viewType;
  public static String viewResponseTimeFormat;
  public static String viewSize;
  public static String viewResponse;
  public static String viewRequest;
  public static String actionSortByResponseTime;
  public static String viewSizeFormat;
  public static String actionClearToolTip;
  public static String actionShowHeader;
  public static String actionPin;
  public static String actionProperties;
  public static String yes;
  public static String no;
  
  static
  {
    NLS.initializeMessages("org.eclipse.wst.internet.monitor.ui.internal.Messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.Messages
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.wst.internet.monitor.core.internal.provisional.MonitorCore;

public class MonitorContentProvider
  implements IStructuredContentProvider
{
  public void dispose() {}
  
  public Object[] getElements(Object inputElement)
  {
    return MonitorCore.getMonitors();
  }
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorContentProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class MonitorDialog$1
  extends SelectionAdapter
{
  MonitorDialog$1(MonitorDialog paramMonitorDialog, MonitorDialog.BooleanModifyListener paramBooleanModifyListener, Button paramButton) {}
  
  public void widgetSelected(SelectionEvent arg0)
  {
    val$listener.valueChanged(val$button.getSelection());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;

class MonitorDialog$10
  implements MonitorDialog.BooleanModifyListener
{
  MonitorDialog$10(MonitorDialog paramMonitorDialog) {}
  
  public void valueChanged(boolean b)
  {
    this$0.monitor.setAutoStart(b);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.10
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

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

class MonitorDialog$2
  implements ModifyListener
{
  MonitorDialog$2(MonitorDialog paramMonitorDialog, MonitorDialog.StringModifyListener paramStringModifyListener, Text paramText) {}
  
  public void modifyText(ModifyEvent e)
  {
    val$listener.valueChanged(val$text.getText());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

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

class MonitorDialog$3
  implements ModifyListener
{
  MonitorDialog$3(MonitorDialog paramMonitorDialog, MonitorDialog.IntModifyListener paramIntModifyListener, Spinner paramSpinner) {}
  
  public void modifyText(ModifyEvent e)
  {
    val$listener.valueChanged(val$s.getSelection());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Combo;

class MonitorDialog$4
  implements SelectionListener
{
  MonitorDialog$4(MonitorDialog paramMonitorDialog, MonitorDialog.StringModifyListener paramStringModifyListener, String[] paramArrayOfString, Combo paramCombo) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    val$listener.valueChanged(val$types[val$combo.getSelectionIndex()]);
  }
  
  public void widgetDefaultSelected(SelectionEvent e)
  {
    widgetSelected(e);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;

class MonitorDialog$5
  implements MonitorDialog.IntModifyListener
{
  MonitorDialog$5(MonitorDialog paramMonitorDialog) {}
  
  public void valueChanged(int i)
  {
    try
    {
      this$0.monitor.setLocalPort(i);
    }
    catch (Exception localException) {}
    this$0.validateFields();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;

class MonitorDialog$6
  implements MonitorDialog.StringModifyListener
{
  MonitorDialog$6(MonitorDialog paramMonitorDialog) {}
  
  public void valueChanged(String s)
  {
    this$0.monitor.setRemoteHost(s);
    this$0.validateFields();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.6
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;

class MonitorDialog$7
  implements MonitorDialog.IntModifyListener
{
  MonitorDialog$7(MonitorDialog paramMonitorDialog) {}
  
  public void valueChanged(int i)
  {
    try
    {
      this$0.monitor.setRemotePort(i);
    }
    catch (Exception localException) {}
    this$0.validateFields();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.7
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;

class MonitorDialog$8
  implements MonitorDialog.StringModifyListener
{
  MonitorDialog$8(MonitorDialog paramMonitorDialog) {}
  
  public void valueChanged(String protocolId)
  {
    this$0.monitor.setProtocol(protocolId);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.8
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;

class MonitorDialog$9
  implements MonitorDialog.IntModifyListener
{
  MonitorDialog$9(MonitorDialog paramMonitorDialog) {}
  
  public void valueChanged(int i)
  {
    this$0.monitor.setTimeout(i);
    this$0.validateFields();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.9
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

abstract interface MonitorDialog$BooleanModifyListener
{
  public abstract void valueChanged(boolean paramBoolean);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.BooleanModifyListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

abstract interface MonitorDialog$IntModifyListener
{
  public abstract void valueChanged(int paramInt);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.IntModifyListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

abstract interface MonitorDialog$StringModifyListener
{
  public abstract void valueChanged(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.StringModifyListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.wst.internet.monitor.core.internal.IProtocolAdapter;

abstract interface MonitorDialog$TypeModifyListener
{
  public abstract void valueChanged(IProtocolAdapter paramIProtocolAdapter);
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog.TypeModifyListener
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
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.Shell;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.wst.internet.monitor.core.internal.IProtocolAdapter;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;
import org.eclipse.wst.internet.monitor.core.internal.provisional.MonitorCore;

public class MonitorDialog
  extends Dialog
{
  protected IMonitorWorkingCopy monitor;
  protected boolean isEdit;
  private Button okButton;
  private Spinner monitorPort;
  private Label validateLabel;
  
  public MonitorDialog(Shell parentShell, IMonitorWorkingCopy monitor)
  {
    super(parentShell);
    this.monitor = monitor;
    isEdit = true;
  }
  
  public MonitorDialog(Shell parentShell)
  {
    super(parentShell);
    monitor = MonitorCore.createMonitor();
    isEdit = false;
  }
  
  protected void configureShell(Shell shell)
  {
    super.configureShell(shell);
    if (isEdit) {
      shell.setText(Messages.editMonitor);
    } else {
      shell.setText(Messages.newMonitor);
    }
  }
  
  protected Button createCheckBox(Composite comp, String txt, boolean selected, final BooleanModifyListener listener)
  {
    final Button button = new Button(comp, 32);
    button.setText(txt);
    button.setSelection(selected);
    button.setLayoutData(new GridData(36));
    if (listener != null) {
      button.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent arg0)
        {
          listener.valueChanged(button.getSelection());
        }
      });
    }
    return button;
  }
  
  protected Label createLabel(Composite comp, String txt)
  {
    Label label = new Label(comp, 0);
    label.setText(txt);
    label.setLayoutData(new GridData(36));
    return label;
  }
  
  protected Text createText(Composite comp, String txt, final StringModifyListener listener)
  {
    final Text text = new Text(comp, 2048);
    if (txt != null) {
      text.setText(txt);
    }
    GridData data = new GridData(772);
    widthHint = 150;
    text.setLayoutData(data);
    if (listener != null) {
      text.addModifyListener(new ModifyListener()
      {
        public void modifyText(ModifyEvent e)
        {
          listener.valueChanged(text.getText());
        }
      });
    }
    return text;
  }
  
  protected Spinner createSpinner(Composite comp, int v, final IntModifyListener listener)
  {
    final Spinner s = new Spinner(comp, 2048);
    s.setMinimum(0);
    s.setMaximum(Integer.MAX_VALUE);
    if (v != -1) {
      s.setSelection(v);
    }
    GridData data = new GridData(772);
    widthHint = 150;
    s.setLayoutData(data);
    if (listener != null) {
      s.addModifyListener(new ModifyListener()
      {
        public void modifyText(ModifyEvent e)
        {
          listener.valueChanged(s.getSelection());
        }
      });
    }
    return s;
  }
  
  protected Combo createTypeCombo(Composite comp, final String[] types, String sel, final StringModifyListener listener)
  {
    final Combo combo = new Combo(comp, 12);
    int size = types.length;
    String[] items = new String[size];
    int index = -1;
    for (int i = 0; i < size; i++)
    {
      items[i] = types[i];
      if (types[i].equals(sel)) {
        index = i;
      }
    }
    combo.setItems(items);
    if (index >= 0) {
      combo.select(index);
    }
    GridData data = new GridData(260);
    widthHint = 150;
    combo.setLayoutData(data);
    if (listener != null) {
      combo.addSelectionListener(new SelectionListener()
      {
        public void widgetSelected(SelectionEvent e)
        {
          listener.valueChanged(types[combo.getSelectionIndex()]);
        }
        
        public void widgetDefaultSelected(SelectionEvent e)
        {
          widgetSelected(e);
        }
      });
    }
    return combo;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = (Composite)super.createDialogArea(parent);
    getLayoutnumColumns = 2;
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, "org.eclipse.wst.internet.monitor.ui.tmpr0006");
    
    createLabel(composite, Messages.localPort);
    monitorPort = createSpinner(composite, monitor.getLocalPort(), new IntModifyListener()
    {
      public void valueChanged(int i)
      {
        try
        {
          monitor.setLocalPort(i);
        }
        catch (Exception localException) {}
        validateFields();
      }
    });
    Group group = new Group(composite, 0);
    GridLayout layout = new GridLayout(2, false);
    group.setLayout(layout);
    GridData data = new GridData(768);
    horizontalSpan = 2;
    group.setLayoutData(data);
    group.setText(Messages.remoteGroup);
    
    createLabel(group, Messages.remoteHost);
    createText(group, monitor.getRemoteHost(), new StringModifyListener()
    {
      public void valueChanged(String s)
      {
        monitor.setRemoteHost(s);
        validateFields();
      }
    });
    createLabel(group, Messages.remotePort);
    createSpinner(group, monitor.getRemotePort(), new IntModifyListener()
    {
      public void valueChanged(int i)
      {
        try
        {
          monitor.setRemotePort(i);
        }
        catch (Exception localException) {}
        validateFields();
      }
    });
    createLabel(group, Messages.parseType);
    createTypeCombo(group, new String[] { "TCP/IP", "HTTP" }, monitor.getProtocol(), new StringModifyListener()
    {
      public void valueChanged(String protocolId)
      {
        monitor.setProtocol(protocolId);
      }
    });
    createLabel(group, Messages.connectionTimeout);
    createSpinner(group, monitor.getTimeout(), new IntModifyListener()
    {
      public void valueChanged(int i)
      {
        monitor.setTimeout(i);
        validateFields();
      }
    });
    createLabel(group, "");
    createCheckBox(group, Messages.autoStart, monitor.isAutoStart(), new BooleanModifyListener()
    {
      public void valueChanged(boolean b)
      {
        monitor.setAutoStart(b);
      }
    });
    validateLabel = createLabel(composite, "");
    validateLabel.setForeground(composite.getDisplay().getSystemColor(3));
    
    return composite;
  }
  
  protected void okPressed()
  {
    IMonitor savedMonitor = null;
    try
    {
      savedMonitor = monitor.save();
    }
    catch (CoreException ce)
    {
      ErrorDialog.openError(getShell(), Messages.errorDialogTitle, ce.getLocalizedMessage(), ce.getStatus());
      return;
    }
    if ((savedMonitor != null) && (savedMonitor.isAutoStart())) {
      try
      {
        savedMonitor.start();
      }
      catch (CoreException ce)
      {
        ErrorDialog.openError(getShell(), Messages.errorDialogTitle, ce.getLocalizedMessage(), ce.getStatus());
      }
    }
    super.okPressed();
  }
  
  protected Control createButtonBar(Composite parent)
  {
    Control buttonControl = super.createButtonBar(parent);
    validateFields();
    return buttonControl;
  }
  
  private void setOKButtonEnabled(boolean curIsEnabled)
  {
    if (okButton == null) {
      okButton = getButton(0);
    }
    if (okButton != null) {
      okButton.setEnabled(curIsEnabled);
    }
  }
  
  protected void validateFields()
  {
    if (monitorPort == null) {
      return;
    }
    boolean result = true;
    IStatus status = monitor.validate();
    if (!status.isOK())
    {
      if ((monitor.getRemoteHost() == null) || (monitor.getRemoteHost().length() < 1)) {
        validateLabel.setText("");
      } else {
        validateLabel.setText(status.getMessage());
      }
      result = false;
    }
    else
    {
      validateLabel.setText("");
    }
    setOKButtonEnabled(result);
  }
  
  static abstract interface BooleanModifyListener
  {
    public abstract void valueChanged(boolean paramBoolean);
  }
  
  static abstract interface IntModifyListener
  {
    public abstract void valueChanged(int paramInt);
  }
  
  static abstract interface StringModifyListener
  {
    public abstract void valueChanged(String paramString);
  }
  
  static abstract interface TypeModifyListener
  {
    public abstract void valueChanged(IProtocolAdapter paramIProtocolAdapter);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class MonitorPreferencePage$1
  implements ISelectionChangedListener
{
  MonitorPreferencePage$1(MonitorPreferencePage paramMonitorPreferencePage) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    this$0.setSelection(event.getSelection());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorPreferencePage.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;
import org.eclipse.wst.internet.monitor.core.internal.provisional.MonitorCore;

class MonitorPreferencePage$2
  extends SelectionAdapter
{
  MonitorPreferencePage$2(MonitorPreferencePage paramMonitorPreferencePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    MonitorDialog dialog = new MonitorDialog(this$0.getShell());
    if (dialog.open() == 1) {
      return;
    }
    this$0.tableViewer.refresh();
    
    IMonitor[] monitors = MonitorCore.getMonitors();
    Object monitor = monitors[(monitors.length - 1)];
    this$0.tableViewer.setSelection(new StructuredSelection(monitor));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorPreferencePage.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import java.util.List;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;

class MonitorPreferencePage$3
  extends SelectionAdapter
{
  MonitorPreferencePage$3(MonitorPreferencePage paramMonitorPreferencePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    IMonitor monitor = (IMonitor)this$0.getSelection().get(0);
    IMonitorWorkingCopy wc = monitor.createWorkingCopy();
    
    MonitorDialog dialog = new MonitorDialog(this$0.getShell(), wc);
    if (dialog.open() != 1) {
      try
      {
        this$0.tableViewer.refresh(wc.save());
      }
      catch (Exception localException) {}
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorPreferencePage.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;
import org.eclipse.wst.internet.monitor.core.internal.provisional.MonitorCore;

class MonitorPreferencePage$4
  extends SelectionAdapter
{
  MonitorPreferencePage$4(MonitorPreferencePage paramMonitorPreferencePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    Iterator iterator = this$0.getSelection().iterator();
    while (iterator.hasNext())
    {
      IMonitor monitor = (IMonitor)iterator.next();
      try
      {
        monitor.delete();
      }
      catch (Exception localException) {}
      this$0.tableViewer.remove(monitor);
      
      IMonitor[] monitors = MonitorCore.getMonitors();
      if (monitors.length > 0)
      {
        Object monitor2 = monitors[(monitors.length - 1)];
        this$0.tableViewer.setSelection(new StructuredSelection(monitor2));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorPreferencePage.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;

class MonitorPreferencePage$5
  extends SelectionAdapter
{
  MonitorPreferencePage$5(MonitorPreferencePage paramMonitorPreferencePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    Iterator iterator = this$0.getSelection().iterator();
    while (iterator.hasNext())
    {
      IMonitor monitor = (IMonitor)iterator.next();
      try
      {
        monitor.start();
      }
      catch (CoreException ce)
      {
        MessageDialog.openError(this$0.getShell(), Messages.errorDialogTitle, ce.getStatus().getMessage());
      }
      catch (Exception ce)
      {
        MessageDialog.openError(this$0.getShell(), Messages.errorDialogTitle, ce.getMessage());
      }
      this$0.tableViewer.refresh(monitor, true);
    }
    this$0.tableViewer.setSelection(this$0.tableViewer.getSelection());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorPreferencePage.5
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import java.util.Iterator;
import java.util.List;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;

class MonitorPreferencePage$6
  extends SelectionAdapter
{
  MonitorPreferencePage$6(MonitorPreferencePage paramMonitorPreferencePage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    Iterator iterator = this$0.getSelection().iterator();
    while (iterator.hasNext())
    {
      IMonitor monitor = (IMonitor)iterator.next();
      try
      {
        monitor.stop();
      }
      catch (Exception localException) {}
      this$0.tableViewer.refresh(monitor, true);
    }
    this$0.tableViewer.setSelection(this$0.tableViewer.getSelection());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorPreferencePage.6
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;
import org.eclipse.wst.internet.monitor.core.internal.provisional.MonitorCore;

public class MonitorPreferencePage
  extends PreferencePage
  implements IWorkbenchPreferencePage
{
  protected Button displayButton;
  protected Table table;
  protected TableViewer tableViewer;
  protected Button edit;
  protected Button remove;
  protected Button start;
  protected Button stop;
  protected List<Object> selection2;
  
  public MonitorPreferencePage()
  {
    noDefaultAndApplyButton();
  }
  
  protected Control createContents(Composite parent)
  {
    initializeDialogUnits(parent);
    
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    horizontalSpacing = convertHorizontalDLUsToPixels(4);
    verticalSpacing = convertVerticalDLUsToPixels(3);
    marginWidth = 0;
    marginHeight = 0;
    composite.setLayout(layout);
    GridData data = new GridData(784);
    composite.setLayoutData(data);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, "org.eclipse.wst.internet.monitor.ui.tmpr0000");
    
    Label label = new Label(composite, 64);
    label.setText(Messages.preferenceDescription);
    data = new GridData(32);
    horizontalSpan = 2;
    label.setLayoutData(data);
    
    displayButton = new Button(composite, 32);
    displayButton.setText(Messages.prefShowView);
    displayButton.setSelection(MonitorUIPlugin.getShowOnActivityPreference());
    data = new GridData(32);
    horizontalSpan = 2;
    verticalIndent = 8;
    displayButton.setLayoutData(data);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(displayButton, "org.eclipse.wst.internet.monitor.ui.tmpr0002");
    
    label = new Label(composite, 64);
    label.setText(Messages.monitorList);
    data = new GridData(768);
    horizontalSpan = 2;
    verticalIndent = 8;
    label.setLayoutData(data);
    
    table = new Table(composite, 68354);
    data = new GridData(1808);
    widthHint = 350;
    table.setLayoutData(data);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(table, "org.eclipse.wst.internet.monitor.ui.tmpr0004");
    
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    
    TableLayout tableLayout = new TableLayout();
    
    TableColumn statusColumn = new TableColumn(table, 0);
    statusColumn.setText(Messages.columnStatus);
    ColumnWeightData colData = new ColumnWeightData(6, 60, true);
    tableLayout.addColumnData(colData);
    
    TableColumn remoteColumn = new TableColumn(table, 0);
    remoteColumn.setText(Messages.columnRemote);
    colData = new ColumnWeightData(12, 120, true);
    tableLayout.addColumnData(colData);
    
    TableColumn httpColumn = new TableColumn(table, 0);
    httpColumn.setText(Messages.columnType);
    colData = new ColumnWeightData(5, 50, true);
    tableLayout.addColumnData(colData);
    
    TableColumn localColumn = new TableColumn(table, 0);
    localColumn.setText(Messages.columnLocal);
    colData = new ColumnWeightData(6, 60, true);
    tableLayout.addColumnData(colData);
    
    TableColumn startOnStartupColumn = new TableColumn(table, 0);
    startOnStartupColumn.setText(Messages.columnAutoStart);
    colData = new ColumnWeightData(7, 70, true);
    tableLayout.addColumnData(colData);
    
    table.setLayout(tableLayout);
    
    tableViewer = new TableViewer(table);
    tableViewer.setContentProvider(new MonitorContentProvider());
    tableViewer.setLabelProvider(new MonitorTableLabelProvider());
    tableViewer.setInput("root");
    
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        setSelection(event.getSelection());
      }
    });
    Composite buttonComp = new Composite(composite, 0);
    layout = new GridLayout();
    horizontalSpacing = 0;
    verticalSpacing = convertVerticalDLUsToPixels(3);
    marginWidth = 0;
    marginHeight = 0;
    numColumns = 1;
    buttonComp.setLayout(layout);
    data = new GridData(144);
    buttonComp.setLayoutData(data);
    
    Button add = SWTUtil.createButton(buttonComp, Messages.add);
    add.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        MonitorDialog dialog = new MonitorDialog(getShell());
        if (dialog.open() == 1) {
          return;
        }
        tableViewer.refresh();
        
        IMonitor[] monitors = MonitorCore.getMonitors();
        Object monitor = monitors[(monitors.length - 1)];
        tableViewer.setSelection(new StructuredSelection(monitor));
      }
    });
    edit = SWTUtil.createButton(buttonComp, Messages.edit);
    edit.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        IMonitor monitor = (IMonitor)getSelection().get(0);
        IMonitorWorkingCopy wc = monitor.createWorkingCopy();
        
        MonitorDialog dialog = new MonitorDialog(getShell(), wc);
        if (dialog.open() != 1) {
          try
          {
            tableViewer.refresh(wc.save());
          }
          catch (Exception localException) {}
        }
      }
    });
    edit.setEnabled(false);
    
    remove = SWTUtil.createButton(buttonComp, Messages.remove);
    remove.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        Iterator iterator = getSelection().iterator();
        while (iterator.hasNext())
        {
          IMonitor monitor = (IMonitor)iterator.next();
          try
          {
            monitor.delete();
          }
          catch (Exception localException) {}
          tableViewer.remove(monitor);
          
          IMonitor[] monitors = MonitorCore.getMonitors();
          if (monitors.length > 0)
          {
            Object monitor2 = monitors[(monitors.length - 1)];
            tableViewer.setSelection(new StructuredSelection(monitor2));
          }
        }
      }
    });
    remove.setEnabled(false);
    
    start = SWTUtil.createButton(buttonComp, Messages.start);
    data = (GridData)start.getLayoutData();
    verticalIndent = 9;
    start.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        Iterator iterator = getSelection().iterator();
        while (iterator.hasNext())
        {
          IMonitor monitor = (IMonitor)iterator.next();
          try
          {
            monitor.start();
          }
          catch (CoreException ce)
          {
            MessageDialog.openError(getShell(), Messages.errorDialogTitle, ce.getStatus().getMessage());
          }
          catch (Exception ce)
          {
            MessageDialog.openError(getShell(), Messages.errorDialogTitle, ce.getMessage());
          }
          tableViewer.refresh(monitor, true);
        }
        tableViewer.setSelection(tableViewer.getSelection());
      }
    });
    start.setEnabled(false);
    
    stop = SWTUtil.createButton(buttonComp, Messages.stop);
    stop.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        Iterator iterator = getSelection().iterator();
        while (iterator.hasNext())
        {
          IMonitor monitor = (IMonitor)iterator.next();
          try
          {
            monitor.stop();
          }
          catch (Exception localException) {}
          tableViewer.refresh(monitor, true);
        }
        tableViewer.setSelection(tableViewer.getSelection());
      }
    });
    stop.setEnabled(false);
    
    Dialog.applyDialogFont(composite);
    
    return composite;
  }
  
  public void init(IWorkbench workbench) {}
  
  protected void performDefaults()
  {
    displayButton.setSelection(MonitorUIPlugin.getDefaultShowOnActivityPreference());
    super.performDefaults();
  }
  
  public boolean performOk()
  {
    MonitorUIPlugin.setShowOnActivityPreference(displayButton.getSelection());
    MonitorUIPlugin.getInstance().savePluginPreferences();
    return true;
  }
  
  protected List getSelection()
  {
    return selection2;
  }
  
  protected void setSelection(ISelection sel2)
  {
    IStructuredSelection sel = (IStructuredSelection)sel2;
    Iterator iterator = sel.iterator();
    selection2 = new ArrayList();
    while (iterator.hasNext())
    {
      Object obj = iterator.next();
      if ((obj instanceof IMonitor)) {
        selection2.add(obj);
      }
    }
    if (!selection2.isEmpty())
    {
      remove.setEnabled(true);
      
      boolean allStopped = true;
      boolean allStarted = true;
      
      iterator = selection2.iterator();
      while (iterator.hasNext())
      {
        IMonitor monitor = (IMonitor)iterator.next();
        if (monitor.isRunning()) {
          allStopped = false;
        } else {
          allStarted = false;
        }
      }
      start.setEnabled(allStopped);
      stop.setEnabled(allStarted);
      edit.setEnabled((selection2.size() == 1) && (allStopped));
    }
    else
    {
      edit.setEnabled(false);
      remove.setEnabled(false);
      start.setEnabled(false);
      stop.setEnabled(false);
    }
  }
  
  public void createControl(Composite parent)
  {
    super.createControl(parent);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "org.eclipse.wst.internet.monitor.ui.tmpr0000");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.wst.internet.monitor.ui.internal.MonitorPreferencePage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.wst.internet.monitor.ui.internal;

import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;

public class MonitorTableLabelProvider
  implements ITableLabelProvider
{
  public void addListener(ILabelProviderListener listener) {}
  
  public void dispose() {}
  
  public Image getColumnImage(Object element, int columnIndex)
  {
    if (columnIndex == 0)
    {
      IMonitor monitor = (IMonitor)element;
      if (monitor.isRunning()) {
        return MonitorUIPlugin.getImage("monitorOn");
      }
      return MonitorUIPlugin.getImage("monitorOff");
    }
    return null;
  }
  
  public String getColumnText(Object element, int columnIndex)
  {
    IMonitor monitor = (IMonitor)element;
    if (columnIndex == 0)
    {
      if (monitor.isRunning()) {
        return Messages.started;
      }
      return Messages.stopped;
    }
    if (columnIndex == 1) {
      return monitor.getRemoteHost() + ":" + monitor.getRemotePort();
    }
    if (columnIndex == 2) {
      return monitor.getProtocol();
    }
    if (columnIndex == 3) {
      return monitor.getLocalPort();
    }
    if (columnIndex == 4)
    {
      if (monitor.isAutoStart()) {
        return Messages.yes;
      }
      return Messages.no;
    }
    return "X";
  }
  
  protected 
1 2 3 4

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