diff options
Diffstat (limited to 'plugins/org.eclipse.wst.internet.monitor.ui')
58 files changed, 0 insertions, 4170 deletions
diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/.classpath b/plugins/org.eclipse.wst.internet.monitor.ui/.classpath deleted file mode 100644 index 3590fb510..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="monitorui/"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/.cvsignore b/plugins/org.eclipse.wst.internet.monitor.ui/.cvsignore deleted file mode 100644 index 2eeb8bd1c..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -bin -monitorui.jar -build.xml -temp.folder -org.eclipse.wst.internet.monitor.ui_3.0.0.jar -@dot -src.zip diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/.options b/plugins/org.eclipse.wst.internet.monitor.ui/.options deleted file mode 100644 index 08412eac4..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/.options +++ /dev/null @@ -1,4 +0,0 @@ -# Debugging options for the org.eclipse.wst.internet.monitor.ui plugin - -# Turn on general debugging -org.eclipse.wst.internet.monitor.ui/debug=true diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/.project b/plugins/org.eclipse.wst.internet.monitor.ui/.project deleted file mode 100644 index b81173e59..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.wst.internet.monitor.ui</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - </natures> -</projectDescription> diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.internet.monitor.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 4469ec31f..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,17 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.wst.internet.monitor.ui; singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.eclipse.wst.internet.monitor.ui.internal.MonitorUIPlugin -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Export-Package: org.eclipse.wst.internet.monitor.ui.internal;x-internal:=true, - org.eclipse.wst.internet.monitor.ui.internal.provisional, - org.eclipse.wst.internet.monitor.ui.internal.view;x-internal:=true, - org.eclipse.wst.internet.monitor.ui.internal.viewers;x-internal:=true -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.ui.ide, - org.eclipse.ui, - org.eclipse.wst.internet.monitor.core -Eclipse-AutoStart: true diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/about.html b/plugins/org.eclipse.wst.internet.monitor.ui/about.html deleted file mode 100644 index 6f6b96c4c..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/about.html +++ /dev/null @@ -1,22 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>February 24, 2005</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p> - -</body> -</html>
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/build.properties b/plugins/org.eclipse.wst.internet.monitor.ui/build.properties deleted file mode 100644 index 7454728d1..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/build.properties +++ /dev/null @@ -1,22 +0,0 @@ -############################################################################### -# Copyright (c) 2004 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -bin.includes = plugin.xml,\ - .,\ - plugin.properties,\ - icons/,\ - META-INF/,\ - about.html -bin.excludes = bin/**,\ - @dot/**,\ - temp.folder/** -src.includes = schema/ -source.. = monitorui/ -output.. = bin/
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/clcl16/clear.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/clcl16/clear.gif Binary files differdeleted file mode 100644 index 389954fbb..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/clcl16/clear.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/clcl16/httpHeader.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/clcl16/httpHeader.gif Binary files differdeleted file mode 100644 index fb20c389d..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/clcl16/httpHeader.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/clcl16/sortResponseTime.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/clcl16/sortResponseTime.gif Binary files differdeleted file mode 100644 index e334e9f77..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/clcl16/sortResponseTime.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/cview16/monitorView.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/cview16/monitorView.gif Binary files differdeleted file mode 100644 index c374f1349..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/cview16/monitorView.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/dlcl16/clear.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/dlcl16/clear.gif Binary files differdeleted file mode 100644 index 3bf98c0ec..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/dlcl16/clear.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/dlcl16/httpHeader.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/dlcl16/httpHeader.gif Binary files differdeleted file mode 100644 index 6d71a8b8a..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/dlcl16/httpHeader.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/dlcl16/sortResponseTime.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/dlcl16/sortResponseTime.gif Binary files differdeleted file mode 100644 index 06e0c7326..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/dlcl16/sortResponseTime.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/clear.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/clear.gif Binary files differdeleted file mode 100644 index 389954fbb..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/clear.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/httpHeader.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/httpHeader.gif Binary files differdeleted file mode 100644 index fb20c389d..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/httpHeader.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/resendRequest.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/resendRequest.gif Binary files differdeleted file mode 100644 index cf62b63ae..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/resendRequest.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/sortResponseTime.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/sortResponseTime.gif Binary files differdeleted file mode 100644 index e334e9f77..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/elcl16/sortResponseTime.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/etool16/editRequest.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/etool16/editRequest.gif Binary files differdeleted file mode 100644 index d044e5977..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/etool16/editRequest.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/eview16/monitorView.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/eview16/monitorView.gif Binary files differdeleted file mode 100644 index c374f1349..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/eview16/monitorView.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/host.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/host.gif Binary files differdeleted file mode 100644 index b51ae39b8..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/host.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/monitorOff.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/monitorOff.gif Binary files differdeleted file mode 100644 index 42e5f318a..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/monitorOff.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/monitorOn.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/monitorOn.gif Binary files differdeleted file mode 100644 index 2ff3974ef..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/monitorOn.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/tcp.gif b/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/tcp.gif Binary files differdeleted file mode 100644 index 8a6e21912..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/icons/obj16/tcp.gif +++ /dev/null diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/ContextIds.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/ContextIds.java deleted file mode 100644 index df1d1c7c0..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/ContextIds.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; -/** - * Constant ids for context help. - */ -public interface ContextIds { - public static final String VIEW = MonitorUIPlugin.PLUGIN_ID + ".tmvw0000"; - public static final String VIEW_TREE = MonitorUIPlugin.PLUGIN_ID + ".tmvw0002"; - public static final String VIEW_REQUEST = MonitorUIPlugin.PLUGIN_ID + ".tmvw0004"; - public static final String VIEW_RESPONSE = MonitorUIPlugin.PLUGIN_ID + ".tmvw0006"; - - public static final String PREF = MonitorUIPlugin.PLUGIN_ID + ".tmpr0000"; - public static final String PREF_SHOW = MonitorUIPlugin.PLUGIN_ID + ".tmpr0002"; - public static final String PREF_MONITORS = MonitorUIPlugin.PLUGIN_ID + ".tmpr0004"; - public static final String PREF_DIALOG = MonitorUIPlugin.PLUGIN_ID + ".tmpr0006"; -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Messages.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Messages.java deleted file mode 100644 index cb3d5caa0..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Messages.java +++ /dev/null @@ -1,62 +0,0 @@ -/********************************************************************** - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - **********************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; - -import org.eclipse.osgi.util.NLS; -/** - * Translated messages. - */ -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 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 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 actionProperties; - - static { - NLS.initializeMessages(MonitorUIPlugin.PLUGIN_ID + ".internal.Messages", Messages.class); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Messages.properties b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Messages.properties deleted file mode 100644 index 16b4d7364..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Messages.properties +++ /dev/null @@ -1,72 +0,0 @@ -############################################################################### -# Copyright (c) 2005 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -# --------------- TCP/IP Monitor view --------------- - -# Labels -viewRequest=Request: {0} -viewResponse=Response: {0} -viewTime=Time of request: {0} -viewType=Type: {0} -viewResponseTime=Response Time: {0} -viewSize=Size: {0} -viewResponseTimeFormat={0} ms -viewSizeFormat={0} ({1}) bytes - -# The following string allows you to change the time format of the TCP/IP monitor -# view. It uses the formatting options found in java.text.SimpleDateFormat: -# k - hour in day, h - hour in am/pm, m - minute, s - second, S - millisecond, -# a - am/pm marker. use duplicate chars (e.g. 'mm') to fill with zeros (i.e. -# '01' instead of '1') -viewDateFormat=h:mm.s.S a - -# Actions -actionSortByResponseTime=Sort By Response Time -actionClearToolTip=Clear -actionShowHeader=Show Header -actionProperties=Properties - - -# --------------- RequestResponse Viewers --------------- -headerLabel=Header: {0} -imageViewInvalid=<Not a valid image file> -xmlViewInvalid=<Not a valid XML file> -htmlViewInvalid=<Not a valid HTML file> - -# --------------- Errors --------------- -errorDialogTitle=Error - -# --------------- General UI --------------- -monitorList=TCP/IP &Monitors: -columnLocal=Local Port -columnRemote=Host name -columnType=Type -columnStatus=Status -add=&Add... -edit=&Edit... -remove=&Remove -start=&Start -stop=S&top -started=Started -stopped=Stopped - -newMonitor=New Monitor -editMonitor=Edit Monitor - -localPort=&Local monitoring port: -remoteGroup=Monitor -remoteHost=&Host name: -remotePort=&Port: -parseType=&Type: -connectionTimeout=T&imeout (in milliseconds): - -preferenceDescription=Configure TCP/IP monitors on local and remote ports. -prefShowView=S&how the TCP/IP Monitor view when there is activity
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorContentProvider.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorContentProvider.java deleted file mode 100644 index e87b3cb92..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorContentProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.wst.internet.monitor.core.internal.provisional.MonitorCore; -/** - * Monitor content provider. - */ -public class MonitorContentProvider implements IStructuredContentProvider { - /** - * MonitorContentProvider constructor comment. - */ - public MonitorContentProvider() { - super(); - } - - /* - * Disposes of this content provider. - */ - public void dispose() { - // do nothing - } - - /* - * Returns the elements to display in the viewer - * when its input is set to the given element. - */ - public Object[] getElements(Object inputElement) { - return MonitorCore.getMonitors(); - } - - /* - * Notifies this content provider that the given viewer's input - * has been switched to a different element. - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // do nothing - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorDialog.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorDialog.java deleted file mode 100644 index 571a3b414..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorDialog.java +++ /dev/null @@ -1,265 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -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.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; -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.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.PlatformUI; -import org.eclipse.wst.internet.monitor.core.internal.IProtocolAdapter; -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; - - interface StringModifyListener { - public void valueChanged(String s); - } - - interface BooleanModifyListener { - public void valueChanged(boolean b); - } - - interface TypeModifyListener { - public void valueChanged(IProtocolAdapter type); - } - - interface IntModifyListener { - public void valueChanged(int i); - } - - /** - * Create a new monitor dialog. - * - * @param parentShell - * @param monitor - */ - 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 Label createLabel(Composite comp, String txt) { - Label label = new Label(comp, SWT.NONE); - label.setText(txt); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER)); - return label; - } - - protected Text createText(Composite comp, String txt, final StringModifyListener listener) { - final Text text = new Text(comp, SWT.BORDER); - if (txt != null) - text.setText(txt); - GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); - data.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, SWT.BORDER); - s.setMinimum(0); - s.setMaximum(Integer.MAX_VALUE); - if (v != -1) - s.setSelection(v); - GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); - data.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, SWT.DROP_DOWN | SWT.READ_ONLY); - 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(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); - data.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; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - ((GridLayout)composite.getLayout()).numColumns = 2; - - PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_DIALOG); - - createLabel(composite, Messages.localPort); - monitorPort = createSpinner(composite, monitor.getLocalPort(), new IntModifyListener() { - public void valueChanged(int i) { - try { - monitor.setLocalPort(i); - } catch (Exception e) { - // ignore - } - validateFields(); - } - }); - - Group group = new Group(composite, SWT.NONE); - GridLayout layout = new GridLayout(2, false); - group.setLayout(layout); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.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 e) { - // ignore - } - 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) { - try { - monitor.setTimeout(i); - } catch (Exception e) { - // ignore - } - validateFields(); - } - }); - - return composite; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#okPressed() - */ - protected void okPressed() { - try { - monitor.save(); - } catch (CoreException ce) { - ErrorDialog.openError(getShell(), Messages.errorDialogTitle, ce.getLocalizedMessage(), ce.getStatus()); - return; - } - 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(IDialogConstants.OK_ID); - - if (okButton != null) - okButton.setEnabled(curIsEnabled); - } - - protected void validateFields() { - if (monitorPort == null) - return; - - boolean result = true; - IStatus status = monitor.validate(); - if (!status.isOK()) - result = false; - - setOKButtonEnabled(result); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorPreferencePage.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorPreferencePage.java deleted file mode 100644 index a08746990..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorPreferencePage.java +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.swt.*; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.*; -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.core.runtime.CoreException; -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.jface.window.Window; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; -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; -/** - * The preference page that holds monitor properties. - */ -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 selection2; - - /** - * MonitorPreferencePage constructor comment. - */ - public MonitorPreferencePage() { - super(); - noDefaultAndApplyButton(); - } - - /** - * Create the preference options. - * - * @param parent org.eclipse.swt.widgets.Composite - * @return org.eclipse.swt.widgets.Control - */ - protected Control createContents(Composite parent) { - initializeDialogUnits(parent); - - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.horizontalSpacing = convertHorizontalDLUsToPixels(4); - layout.verticalSpacing = convertVerticalDLUsToPixels(3); - layout.marginWidth = 0; - layout.marginHeight = 0; - composite.setLayout(layout); - GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); - composite.setLayoutData(data); - PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF); - - Label label = new Label(composite, SWT.WRAP); - label.setText(Messages.preferenceDescription); - data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); - data.horizontalSpan = 2; - label.setLayoutData(data); - - displayButton = new Button(composite, SWT.CHECK); - displayButton.setText(Messages.prefShowView); - displayButton.setSelection(MonitorUIPlugin.getShowOnActivityPreference()); - data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); - data.horizontalSpan = 2; - displayButton.setLayoutData(data); - PlatformUI.getWorkbench().getHelpSystem().setHelp(displayButton, ContextIds.PREF_SHOW); - - label = new Label(composite, SWT.NONE); - label.setText(""); - data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); - data.horizontalSpan = 2; - label.setLayoutData(data); - - label = new Label(composite, SWT.WRAP); - label.setText(Messages.monitorList); - data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - label.setLayoutData(data); - - table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); - data = new GridData(GridData.FILL_BOTH); - PlatformUI.getWorkbench().getHelpSystem().setHelp(table, ContextIds.PREF_MONITORS); - - table.setLayoutData(data); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableLayout tableLayout = new TableLayout(); - - TableColumn statusColumn = new TableColumn(table, SWT.NONE); - statusColumn.setText(Messages.columnStatus); - ColumnWeightData colData = new ColumnWeightData(6, 60, true); - tableLayout.addColumnData(colData); - - TableColumn remoteColumn = new TableColumn(table, SWT.NONE); - remoteColumn.setText(Messages.columnRemote); - colData = new ColumnWeightData(12, 120, true); - tableLayout.addColumnData(colData); - - TableColumn httpColumn = new TableColumn(table, SWT.NONE); - httpColumn.setText(Messages.columnType); - colData = new ColumnWeightData(5, 55, true); - tableLayout.addColumnData(colData); - - TableColumn localColumn = new TableColumn(table, SWT.NONE); - localColumn.setText(Messages.columnLocal); - colData = new ColumnWeightData(5, 50, 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, SWT.NONE); - layout = new GridLayout(); - layout.horizontalSpacing = 0; - layout.verticalSpacing = convertVerticalDLUsToPixels(3); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.numColumns = 1; - buttonComp.setLayout(layout); - data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL); - 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() == Window.CANCEL) - 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() != Window.CANCEL) { - try { - tableViewer.refresh(wc.save()); - } catch (Exception ex) { - // ignore - } - } - } - }); - 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 ex) { - // ignore - } - 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(); - data.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 ex) { - // ignore - } - tableViewer.refresh(monitor, true); - } - tableViewer.setSelection(tableViewer.getSelection()); - } - }); - stop.setEnabled(false); - - Dialog.applyDialogFont(composite); - - return composite; - } - - /** - * Initializes this preference page using the passed workbench. - * - * @param workbench the current workbench - */ - public void init(IWorkbench workbench) { - // do nothing - } - - /** - * Performs special processing when this page's Defaults button has been pressed. - * <p> - * This is a framework hook method for sublcasses to do special things when - * the Defaults button has been pressed. - * Subclasses may override, but should call <code>super.performDefaults</code>. - * </p> - */ - protected void performDefaults() { - displayButton.setSelection(MonitorUIPlugin.getDefaultShowOnActivityPreference()); - super.performDefaults(); - } - - /** - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - 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); - } - } - - /** - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ContextIds.PREF); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorTableLabelProvider.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorTableLabelProvider.java deleted file mode 100644 index 430cbb00e..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorTableLabelProvider.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; - -import org.eclipse.jface.viewers.ILabelProviderListener; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor; -import org.eclipse.jface.viewers.ITableLabelProvider; -/** - * Monitor table label provider. - */ -public class MonitorTableLabelProvider implements ITableLabelProvider { - /** - * MonitorTableLabelProvider constructor comment. - */ - public MonitorTableLabelProvider() { - super(); - } - - /** - * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) - */ - public void addListener(ILabelProviderListener listener) { - // do nothing - } - - /** - * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() - */ - public void dispose() { - // do nothing - } - - /** - * @see ITableLabelProvider#getColumnImage(Object, int) - */ - public Image getColumnImage(Object element, int columnIndex) { - if (columnIndex == 0) { - IMonitor monitor = (IMonitor) element; - if (monitor.isRunning()) - return MonitorUIPlugin.getImage(MonitorUIPlugin.IMG_MONITOR_ON); - return MonitorUIPlugin.getImage(MonitorUIPlugin.IMG_MONITOR_OFF); - } - return null; - } - - /** - * @see ITableLabelProvider#getColumnText(Object, int) - */ - public String getColumnText(Object element, int columnIndex) { - IMonitor monitor = (IMonitor) element; - if (columnIndex == 0) { - if (monitor.isRunning()) - return Messages.started; - return Messages.stopped; - } else if (columnIndex == 1) - return monitor.getRemoteHost() + ":" + monitor.getRemotePort(); - else if (columnIndex == 2) - return monitor.getProtocol(); - else if (columnIndex == 3) - return monitor.getLocalPort() + ""; - else - return "X"; - } - - protected String notNull(String s) { - if (s == null) - return ""; - - return s; - } - - /** - * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(Object, String) - */ - public boolean isLabelProperty(Object element, String property) { - return false; - } - - /** - * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) - */ - public void removeListener(ILabelProviderListener listener) { - // do nothing - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorUIPlugin.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorUIPlugin.java deleted file mode 100644 index b1e2340df..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/MonitorUIPlugin.java +++ /dev/null @@ -1,297 +0,0 @@ -/********************************************************************** - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - **********************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.InputStreamReader; -import java.net.URL; -import java.util.*; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.internet.monitor.core.internal.Trace; -import org.eclipse.wst.internet.monitor.core.internal.provisional.*; -import org.eclipse.wst.internet.monitor.ui.internal.view.MonitorView; -import org.osgi.framework.BundleContext; -/** - * The TCP/IP monitor UI plugin. - */ -public class MonitorUIPlugin extends AbstractUIPlugin { - public static final String PLUGIN_ID = "org.eclipse.wst.internet.monitor.ui"; - - private static MonitorUIPlugin singleton; - - protected Map imageDescriptors = new HashMap(); - - private static final String lineSeparator = System.getProperty("line.separator"); - - private static URL ICON_BASE_URL; - private static final String URL_CLCL = "clcl16/"; - private static final String URL_ELCL = "elcl16/"; - private static final String URL_DLCL = "dlcl16/"; - private static final String URL_OBJ = "obj16/"; - - public static final String IMG_ELCL_SORT_RESPONSE_TIME = "IMG_ELCL_SORT_RESPONSE_TIME"; - public static final String IMG_ELCL_CLEAR = "IMG_ELCL_CLEAR"; - public static final String IMG_ELCL_HTTP_HEADER = "IMG_ELCL_HTTP_HEADER"; - public static final String IMG_CLCL_SORT_RESPONSE_TIME = "IMG_CLCL_SORT_RESPONSE_TIME"; - public static final String IMG_CLCL_CLEAR = "IMG_CLCL_CLEAR"; - public static final String IMG_CLCL_HTTP_HEADER = "IMG_CLCL_HTTP_HEADER"; - public static final String IMG_DLCL_SORT_RESPONSE_TIME = "IMG_DLCL_SORT_RESPONSE_TIME"; - public static final String IMG_DLCL_CLEAR = "IMG_DLCL_CLEAR"; - public static final String IMG_DLCL_HTTP_HEADER = "IMG_DLCL_HTTP_HEADER"; - - public static final String IMG_REQUEST_RESPONSE = "requestResponse"; - public static final String IMG_RESEND_REQUEST_RESPONSE = "resendRequestResponse"; - - public static final String IMG_HOST = "host"; - public static final String IMG_MONITOR_ON = "monitorOn"; - public static final String IMG_MONITOR_OFF = "monitorOff"; - - private static final String SHOW_VIEW_ON_ACTIVITY = "show-view"; - private static final String SHOW_HEADER = "show-header"; - - protected List requests = new ArrayList(); - - protected IMonitorListener monitorListener = new IMonitorListener() { - public void monitorAdded(IMonitor monitor) { - monitor.addRequestListener(requestListener); - } - - public void monitorChanged(IMonitor monitor) { - // ignore - } - - public void monitorRemoved(IMonitor monitor) { - monitor.removeRequestListener(requestListener); - } - }; - - protected IRequestListener requestListener = new IRequestListener() { - public void requestAdded(IMonitor monitor, Request request) { - addRequest(request); - - if (MonitorView.view != null) - MonitorView.view.doRequestAdded(request); - else if (MonitorUIPlugin.getShowOnActivityPreference()) - MonitorView.open(request); - } - - public void requestChanged(IMonitor monitor, Request request) { - if (MonitorView.view != null) - MonitorView.view.doRequestChanged(request); - } - }; - - /** - * MonitorUIPlugin constructor comment. - */ - public MonitorUIPlugin() { - super(); - singleton = this; - } - - /** - * Creates and pre-loads the image registry. - * - * @return ImageRegistry - */ - protected ImageRegistry createImageRegistry() { - ImageRegistry registry = super.createImageRegistry(); - - registerImage(registry, IMG_REQUEST_RESPONSE, URL_OBJ + "tcp.gif"); - registerImage(registry, IMG_RESEND_REQUEST_RESPONSE, URL_ELCL + "resendRequest.gif"); - - registerImage(registry, IMG_HOST, URL_OBJ + "host.gif"); - registerImage(registry, IMG_MONITOR_ON, URL_OBJ + "monitorOn.gif"); - registerImage(registry, IMG_MONITOR_OFF, URL_OBJ + "monitorOff.gif"); - - registerImage(registry, IMG_CLCL_CLEAR, URL_CLCL + "clear.gif"); - registerImage(registry, IMG_CLCL_SORT_RESPONSE_TIME, URL_CLCL + "sortResponseTime.gif"); - registerImage(registry, IMG_CLCL_HTTP_HEADER, URL_CLCL + "httpHeader.gif"); - - registerImage(registry, IMG_ELCL_CLEAR, URL_ELCL + "clear.gif"); - registerImage(registry, IMG_ELCL_SORT_RESPONSE_TIME, URL_ELCL + "sortResponseTime.gif"); - registerImage(registry, IMG_ELCL_HTTP_HEADER, URL_ELCL + "httpHeader.gif"); - - registerImage(registry, IMG_DLCL_CLEAR, URL_DLCL + "clear.gif"); - registerImage(registry, IMG_DLCL_SORT_RESPONSE_TIME, URL_DLCL + "sortResponseTime.gif"); - registerImage(registry, IMG_DLCL_HTTP_HEADER, URL_DLCL + "httpHeader.gif"); - - return registry; - } - - /** - * Return the image with the given key from the image registry. - * - * @param key the key - * @return the image - */ - public static Image getImage(String key) { - return getInstance().getImageRegistry().get(key); - } - - /** - * Return the image with the given key from the image registry. - * - * @param key the key - * @return an image descriptor - */ - public static ImageDescriptor getImageDescriptor(String key) { - try { - getInstance().getImageRegistry(); - return (ImageDescriptor) getInstance().imageDescriptors.get(key); - } catch (Exception e) { - return null; - } - } - - /** - * Returns the singleton instance of this plugin. - * - * @return the plugin - */ - public static MonitorUIPlugin getInstance() { - return singleton; - } - - /** - * Register an image with the registry. - * - * @param key the key - * @param partialURL - */ - private void registerImage(ImageRegistry registry, String key, String partialURL) { - if (ICON_BASE_URL == null) { - String pathSuffix = "icons/"; - ICON_BASE_URL = singleton.getBundle().getEntry(pathSuffix); - } - - try { - ImageDescriptor id = ImageDescriptor.createFromURL(new URL(ICON_BASE_URL, partialURL)); - registry.put(key, id); - imageDescriptors.put(key, id); - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Error registering image", e); - } - } - - /** - * @see AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - - getPreferenceStore().setDefault(MonitorUIPlugin.SHOW_VIEW_ON_ACTIVITY, true); - - MonitorCore.addMonitorListener(monitorListener); - - IMonitor[] monitors = MonitorCore.getMonitors(); - if (monitors != null) { - int size = monitors.length; - for (int i = 0; i < size; i++) { - monitors[i].addRequestListener(requestListener); - } - } - } - - /** - * @see AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - - IMonitor[] monitors = MonitorCore.getMonitors(); - if (monitors != null) { - int size = monitors.length; - for (int i = 0; i < size; i++) { - monitors[i].removeRequestListener(requestListener); - } - } - - MonitorCore.removeMonitorListener(monitorListener); - } - - public static boolean getDefaultShowOnActivityPreference() { - return getInstance().getPreferenceStore().getDefaultBoolean(SHOW_VIEW_ON_ACTIVITY); - } - - public static boolean getShowOnActivityPreference() { - return getInstance().getPreferenceStore().getBoolean(SHOW_VIEW_ON_ACTIVITY); - } - - public static void setShowOnActivityPreference(boolean b) { - getInstance().getPreferenceStore().setValue(SHOW_VIEW_ON_ACTIVITY, b); - getInstance().savePluginPreferences(); - } - - public static boolean getShowHeaderPreference() { - return getInstance().getPreferenceStore().getBoolean(SHOW_HEADER); - } - - public static void setShowHeaderPreference(boolean b) { - getInstance().getPreferenceStore().setValue(SHOW_HEADER, b); - getInstance().savePluginPreferences(); - } - - /** - * Convenience method to parse the given bytes into String form. The bytes - * are parsed into a line delimited string. The byte array must not be null. - * - * @param b a byte array - * @return the string after the conversion - */ - public static String parse(byte[] b) { - if (b == null) - throw new IllegalArgumentException(); - - ByteArrayInputStream bin = new ByteArrayInputStream(b); - BufferedReader br = new BufferedReader(new InputStreamReader(bin)); - StringBuffer sb = new StringBuffer(); - try { - String s = br.readLine(); - - while (s != null) { - sb.append(s); - s = br.readLine(); - if (s != null) - sb.append(lineSeparator); - } - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Error parsing input", e); - } - - return sb.toString(); - } - - public void addRequest(Request request) { - if (!requests.contains(request)) - requests.add(request); - } - - /** - * Returns a list of the current requests. - * - * @return java.util.List - */ - public Request[] getRequests() { - Request[] r = new Request[requests.size()]; - requests.toArray(r); - return r; - } - - public void clearRequests() { - requests = new ArrayList(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/RequestActionFilter.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/RequestActionFilter.java deleted file mode 100644 index d2a927a76..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/RequestActionFilter.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; - -import org.eclipse.ui.IActionFilter; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -/** - * An action filter for requests. - */ -public class RequestActionFilter implements IActionFilter{ - public static final String REQUEST_SENT = "requestsent"; - - /** - * @see IActionFilter#testAttribute(Object, String, String) - */ - public boolean testAttribute(Object target, String name, String value) { - Request request = (Request) target; - if (name.equals(REQUEST_SENT)) { - if (value.equals("true")) - return request.getResponseTime() != -1; - - return request.getResponseTime() == -1; - } - return false; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/RequestAdapterFactory.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/RequestAdapterFactory.java deleted file mode 100644 index ac7d68504..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/RequestAdapterFactory.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.ui.IActionFilter; -/** - * Adapter factory to adapt Requests to IActionFilter. - */ -public class RequestAdapterFactory implements IAdapterFactory { - private RequestActionFilter reqActionFilter = null; - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adapterType == IActionFilter.class) { - if (reqActionFilter == null) { - reqActionFilter = new RequestActionFilter(); - } - return reqActionFilter; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ - public Class[] getAdapterList() { - return new Class[] { IActionFilter.class }; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/SWTUtil.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/SWTUtil.java deleted file mode 100644 index ac622b37c..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/SWTUtil.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.FontMetrics; -import org.eclipse.swt.graphics.GC; -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; -/** - * SWT Utility class. - */ -public class SWTUtil { - private static FontMetrics fontMetrics; - - protected static void initializeDialogUnits(Control testControl) { - // Compute and store a font metric - GC gc = new GC(testControl); - gc.setFont(JFaceResources.getDialogFont()); - fontMetrics = gc.getFontMetrics(); - gc.dispose(); - } - - /** - * Returns a width hint for a button control. - */ - protected static int getButtonWidthHint(Button button) { - int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH); - return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - } - - /** - * Create a new button with the standard size. - * - * @param comp the component to add the button to - * @param label the button label - * @return a button - */ - public static Button createButton(Composite comp, String label) { - Button b = new Button(comp, SWT.PUSH); - b.setText(label); - if (fontMetrics == null) - initializeDialogUnits(comp); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING); - data.widthHint = getButtonWidthHint(b); - b.setLayoutData(data); - return b; - } - - public static Button createCheckbox(Composite comp, String txt, boolean isSelected){ - Button button = new Button(comp, SWT.CHECK); - button.setText(txt); - GridLayout layout = new GridLayout(); - comp.setLayout(layout); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING); - data.horizontalIndent = 10; - button.setLayoutData(data); - button.setSelection(isSelected); - return button; - } - - public static Label createLabel(Composite comp, String txt) { - Label label = new Label(comp, SWT.NONE); - label.setText(txt); - label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING)); - return label; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Startup.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Startup.java deleted file mode 100644 index 1b83e00c7..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Startup.java +++ /dev/null @@ -1,24 +0,0 @@ -/********************************************************************** - * Copyright (c) 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - **********************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; - -import org.eclipse.wst.internet.monitor.core.internal.IStartup; -/** - * Startup hook. - */ -public class Startup implements IStartup { - /* (non-Javadoc) - * @see org.eclipse.wst.internet.monitor.core.IStartup#startup() - */ - public void startup() { - // do nothing - plugin loading is enough - } -} diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Trace.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Trace.java deleted file mode 100644 index c4d230a3a..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/Trace.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal; -/** - * Helper class to route trace output. - */ -public class Trace { - public static byte CONFIG = 0; - public static byte WARNING = 1; - public static byte SEVERE = 2; - public static byte FINEST = 3; - - /** - * Trace constructor comment. - */ - private Trace() { - super(); - } - - /** - * Trace the given text. - * - * @param level the trace level - * @param s a message - */ - public static void trace(byte level, String s) { - trace(level, s, null); - } - - /** - * Trace the given message and exception. - * - * @param level the trace level - * @param s a message - * @param t a throwable - */ - public static void trace(byte level, String s, Throwable t) { - if (!MonitorUIPlugin.getInstance().isDebugging()) - return; - - System.out.println(MonitorUIPlugin.PLUGIN_ID + " " + s); - if (t != null) - t.printStackTrace(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/ContentViewer.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/ContentViewer.java deleted file mode 100644 index 474378b09..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/ContentViewer.java +++ /dev/null @@ -1,133 +0,0 @@ -/********************************************************************** - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - **********************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.provisional; - -import org.eclipse.swt.widgets.Composite; -/** - * Editable viewer for displaying and editing requests and responses. - * <p> - * This abstract class is intended to be subclassed only by clients - * to extend the <code>contentViewers</code> extension point. - * The subclass must have a public 0-argument constructor, which will be used - * automatically to instantiate the viewer when required. - * Once instantiated, {@link #init(Composite)} is called to create - * the viewer's controls. Then {@link #setContent(byte[])} is called, - * one or more times, to cause the viewer to display particular - * content. Finally, when the viewer is no longer needed, {@link #dispose()} - * is called to free up any resources tied up by the viewer. - * </p> - * <p> - * [issue: It's unclear how these content viewers are used. - * Is it just that the UI provides a list of available - * views for the user to make a manual selection from, regardless - * of the actual content of the message traffic?] - * </p> - * [issue: CS - If a ContentViewer is editable, does that mean we can edit the - * bytes of the message and resend it across the wire? How is an editable ContentViewer - * handled differently by the framework? Perhaps an example of what an editeable viewer would do. ] - * @plannedfor 1.0 - */ -public abstract class ContentViewer { - /** - * Creates a new content viewer instance. - */ - protected ContentViewer() { - // do nothing - } - - /** - * Creates the controls for this viewer as children of the given composite. - * <p> - * The default implementation of this method does nothing. - * Subclasses should override this method. - * </p> - * - * @param parent the parent composite - */ - public abstract void init(Composite parent); - - /** - * Sets the content that the viewer should display. - * The parameter may be null if no content should be displayed. - * <p> - * The default implementation of this method does nothing. - * Subclasses should override this method. - * </p> - * <p> - * [issue: Since this is for displaying request-reponse messages, - * why not pass an Request? The problem as it stands now is that - * it is unclear from specs how content viewers relate to anything - * else having to do with the monitor.] - * </p> - * - * @param b the content to display, or <code>null</code> to - * display nothing - */ - public abstract void setContent(byte[] b); - - /** - * Get the content from the viewer. This is usually only interesting if the - * content has changed. - * <p> - * The default implementation of this method does nothing and - * returns null. Subclasses should override this method. - * </p> - * - * @return the content from the viewer, or <code>null</code> if none - */ - public abstract byte[] getContent(); - - /** - * Disposes this viewer and any underlying resources such as a composite. - * This method will be called whenever the user switches to use another - * viewer or the monitor view is closed. The parent composite should not - * be disposed since it may be used to display another viewer. - * <p> - * The default implementation of this method does nothing. - * Subclasses should override this method to provide specialized cleanup. - * </p> - */ - public void dispose() { - // do nothing - } - - /** - * Set whether the current viewer is editable, that is, the user is able to - * edit the content. - * <p> - * The default implementation of this method does nothing. - * Subclasses should override this method to allows instances - * to be made editable. - * </p> - * - * @param editable <code>true</code> if true the content can be edited, - * and <code>false</code> otherwise - */ - public void setEditable(boolean editable) { - // do nothing - } - - /** - * Returns whether the current viewer is editable, that is, the user is able to - * edit the content. - * <p> - * The default implementation of this method does nothing. - * Subclasses should override this method to allows instances - * to be made editable. - * </p> - * - * @return <code>true</code> if true the content can be edited, - * and <code>false</code> otherwise - */ - public boolean getEditable() { - return false; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/MonitorUICore.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/MonitorUICore.java deleted file mode 100644 index 3fb435161..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/MonitorUICore.java +++ /dev/null @@ -1,41 +0,0 @@ -/********************************************************************** - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - **********************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.provisional; - -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.internet.monitor.ui.internal.MonitorUIPlugin; -/** - * Main class for access to the monitor UI. - * <p> - * This class provides all functionality through static members. It is not intended - * to be instantiated or subclassed. - * </p> - * - * @plannedfor 1.0 - */ -public final class MonitorUICore { - /** - * Cannot create MonitorUICore - use static methods. - */ - private MonitorUICore() { - // can't create - } - - /** - * Returns an array of the requests currently being displayed in the TCP/IP - * monitor view. - * - * @return an array of requests - */ - public static Request[] getRequests() { - return MonitorUIPlugin.getInstance().getRequests(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/package.html b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/package.html deleted file mode 100644 index d28b6c2a2..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/package.html +++ /dev/null @@ -1,21 +0,0 @@ -<html> -<head> -<META http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<link rel="stylesheet" href="../../../../../..//apistyles.css" type="text/css"> -<title>WTP API overview</title> -</head> -<body> -<p>TCP/IP monitor UI</p> -<table width="500"> -<tr> -<td> -<p>The ContentViewer class is provided to -implement the viewers extension point that allows external plugins to provide -a view for viewing request and response data content in the monitor view. -</p> -</td> -</tr> -</table> -</body> -</html> diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/package.xml b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/package.xml deleted file mode 100644 index be41a2701..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/provisional/package.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<html> -<head> - <!-- Escape to the root of your source folder --> - <meta - name="root" - content="../../../../../../" /> - <title>WTP API overview</title> -</head> - -<body> -<abstract>TCP/IP monitor UI</abstract> - -<p>The ContentViewer class is provided to -implement the viewers extension point that allows external plugins to provide -a view for viewing request and response data content in the monitor view. -</p> - -</body> -</html>
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/FilterAction.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/FilterAction.java deleted file mode 100644 index 3c4d83f96..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/FilterAction.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.view; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; -import org.eclipse.wst.internet.monitor.core.internal.IContentFilter; -/** - * - */ -public class FilterAction extends Action { - protected ViewerManager vm; - protected IContentFilter filter; - protected boolean enabled; - - public FilterAction(ViewerManager vm, IContentFilter filter) { - super(filter.getName(), IAction.AS_CHECK_BOX); - this.vm = vm; - this.filter = filter; - } - - public void run() { - if (!isChecked()) - vm.removeFilter(filter); - else - vm.addFilter(filter); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ModifyMessageAction.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ModifyMessageAction.java deleted file mode 100644 index f1f0f5806..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ModifyMessageAction.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.view; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.wst.internet.monitor.core.internal.MonitorManager; -import org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -/** - * Modify the selected message. Creates a new resendrequest and adds it - * to the tree. - */ -public class ModifyMessageAction implements IViewActionDelegate{ - ISelection selection = null; - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - // do nothing - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - if (selection != null) { - Object element = ((StructuredSelection) selection).getFirstElement(); - if (element != null && element instanceof Request) { - Request req = (Request) element; - ResendHTTPRequest newReq = MonitorManager.createResendRequest(req); - MonitorManager.getInstance().addResendRequest(req, newReq); - TreeViewer treeViewer = MonitorView.view.treeViewer; - treeViewer.add(req, newReq); - treeViewer.setSelection(new StructuredSelection(newReq), false); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection2) { - this.selection = selection2; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorTreeContentProvider.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorTreeContentProvider.java deleted file mode 100644 index 5a8d392d1..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorTreeContentProvider.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.view; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.wst.internet.monitor.core.internal.MonitorManager; -import org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.internet.monitor.ui.internal.MonitorUIPlugin; -/** - * Content provider for the monitor server view. - */ -public class MonitorTreeContentProvider implements ITreeContentProvider{ - protected static final String ROOT = "root"; - - protected boolean sortByResponseTime; - - /** - * ProxyTreeContentProvider constructor comment. - */ - public MonitorTreeContentProvider() { - super(); - } - - /** - * Disposes of this content provider. - * <p> - * [Issue: This method should be changed to take a Viewer, - * renamed and repurposed to disconnect a content provider from - * a viewer. This is over and above what inputChanged does, - * which is disconnecting a content provider from the viewer's - * input (but not the viewer itself). - * ] - * </p> - */ - public void dispose() { - // do nothing - } - - /** - * Returns an iterator over the child elements of the given element. - * <p> - * Note: The difference between this method and - * <code>IStructuredContentProvider.getElements</code> is - * that <code>getElements</code> is called to obtain the - * tree viewer's root elements, whereas <code>getChildren</code> is used - * to obtain the children of a given node in the tree - * (including a root). - * </p> - * <p> - * [Issue: Don't know what above is trying to say. - * See IStructuredContentProvider.getElements. - * ] - * </p> - * - * @param element the element - * @return an iterator over the child elements - * (element type: <code>Object</code>) - */ - public Object[] getChildren(Object element) { - if (element instanceof Integer) { - Integer in = (Integer) element; - List list = new ArrayList(); - Request[] requests = MonitorUIPlugin.getInstance().getRequests(); - if (requests != null) { - int size = requests.length; - for (int i = 0; i < size; i++) { - Request req = requests[i]; - if ((req.getLocalPort() == in.intValue()) - && !(req instanceof ResendHTTPRequest)) - list.add(req); - } - } - if (sortByResponseTime) - sortByResponseTime(list); - return list.toArray(); - } else if (element instanceof Request) { - Request req = (Request) element; - ResendHTTPRequest[] rr = MonitorManager.getInstance().getResendRequests(req); - List list = new ArrayList(); - if (rr != null) { - int size = rr.length; - for (int i = 0; i < size; i++) { - list.add(rr[i]); - } - } - if (sortByResponseTime) - sortByResponseTime(list); - return list.toArray(); - } - return null; - } - - /* - * Returns an iterator over the elements belonging to the - * given element. These elements can be presented as rows in a table, - * items in a list, etc. - */ - public Object[] getElements(Object element) { - if (ROOT.equals(element)) { - List list = new ArrayList(); - Request[] requests = MonitorUIPlugin.getInstance().getRequests(); - if (requests != null) { - int size = requests.length; - for (int i = 0; i < size; i++) { - Request req = requests[i]; - Integer in = new Integer(req.getLocalPort()); - if (!list.contains(in)) - list.add(in); - } - } - if (sortByResponseTime) - sortByResponseTime(list); - return list.toArray(); - } - return getChildren(element); - } - - /* - * Returns the parent for the given element, or <code>null</code> - * indicating that the parent can't be computed. - */ - public Object getParent(Object element) { - if (element != null) { - if (element instanceof Integer) - return ROOT; - Request call = (Request) element; - if (call instanceof ResendHTTPRequest) { - ResendHTTPRequest callResend = (ResendHTTPRequest) call; - Request parent = callResend.getOriginalRequest(); - if (parent != null) - return parent; - } - return new Integer(call.getLocalPort()); - } - return null; - } - - /* - * Returns true if the elements are currently being sorted by response time. - */ - public boolean getSortByResponseTime() { - return sortByResponseTime; - } - - /* - * Returns whether the given element has children. - */ - public boolean hasChildren(Object element) { - if (element instanceof Integer) - return true; - if (element instanceof Request) - return MonitorManager.getInstance().getResendRequests((Request) element).length > 0; - - return false; - } - - /* - * Notifies this content provider that the given viewer's input - * has been switched to a different element. - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // do nothing - } - - /** - * Sets the sort by response time option. - * @param b boolean - */ - public void setSortByResponseTime(boolean b) { - sortByResponseTime = b; - } - - /** - * - */ - protected void sortByResponseTime(List list) { - int size = list.size(); - for (int i = 0; i < size - 1; i++) { - for (int j = i + 1; j < size; j++) { - Request c1 = (Request) list.get(i); - Request c2 = (Request) list.get(j); - if (c1.getResponseTime() < c2.getResponseTime()) { - list.set(i, c2); - list.set(j, c1); - } - } - } - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorView.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorView.java deleted file mode 100644 index 078e699cc..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/MonitorView.java +++ /dev/null @@ -1,543 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.view; - -import java.text.SimpleDateFormat; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.action.*; -import org.eclipse.jface.preference.IPreferenceNode; -import org.eclipse.jface.preference.PreferenceDialog; -import org.eclipse.jface.preference.PreferenceManager; -import org.eclipse.jface.viewers.*; -import org.eclipse.jface.window.Window; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.custom.SashForm; -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.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.*; -import org.eclipse.ui.part.ViewPart; -import org.eclipse.wst.internet.monitor.core.internal.IContentFilter; -import org.eclipse.wst.internet.monitor.core.internal.MonitorPlugin; -import org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest; -import org.eclipse.wst.internet.monitor.core.internal.provisional.IRequestListener; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.internet.monitor.ui.internal.*; -/** - * View of TCP/IP activity. - */ -public class MonitorView extends ViewPart { - protected Tree tree; - protected TreeViewer treeViewer; - protected MonitorTreeContentProvider contentProvider; - - protected IRequestListener listener; - protected ViewerManager vm; - protected List requestViewers; - protected List responseViewers; - - protected static SimpleDateFormat format; - protected static final String VIEW_ID = "org.eclipse.wst.internet.monitor.view"; - protected static final String DEFAULT_VIEWER = "org.eclipse.wst.internet.monitor.viewers.byte"; - - protected IAction httpHeaderAction; - protected IAction preferenceAction; - - public static MonitorView view; - - protected Request currentRequest = null; - protected StructuredSelection currentSelection = null; - - /** - * MonitorView constructor comment. - */ - public MonitorView() { - super(); - view = this; - - // try specified format, and fall back to standard format - try { - format = new SimpleDateFormat(Messages.viewDateFormat); - } catch (Exception e) { - format = new SimpleDateFormat("h:mm.s.S a"); - } - } - - public void doRequestAdded(final Request rr) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - if (!(rr instanceof ResendHTTPRequest)) { - Integer in = new Integer(rr.getLocalPort()); - treeViewer.add(MonitorTreeContentProvider.ROOT, in); - treeViewer.add(in, rr); - treeViewer.setSelection(new StructuredSelection(rr), true); - } - } - }); - } - - public void doRequestChanged(final Request rr) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - if (treeViewer == null) - return; - IStructuredSelection sel = (IStructuredSelection) treeViewer.getSelection(); - - treeViewer.refresh(rr); - if (!sel.isEmpty()) - treeViewer.setSelection(sel); - } - }); - } - - /** - * Clear the view. - */ - protected void clear() { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - treeViewer.setSelection(null); - treeViewer.setInput(MonitorTreeContentProvider.ROOT); - } - }); - } - - protected void setSelection(Request request) { - if (treeViewer != null) - treeViewer.setSelection(new StructuredSelection(request)); - } - - /** - * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ - public void createPartControl(Composite parent) { - SashForm sashFparent = new SashForm(parent, SWT.VERTICAL); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.horizontalSpacing = 4; - layout.verticalSpacing = 4; - sashFparent.setLayout(layout); - sashFparent.setLayoutData(new GridData(GridData.FILL_BOTH)); - PlatformUI.getWorkbench().getHelpSystem().setHelp(sashFparent, ContextIds.VIEW); - - // create tree panel - Composite treePanel = new Composite(sashFparent, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 2; - layout.marginHeight = 0; - layout.marginWidth = 0; - treePanel.setLayout(layout); - GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - data.heightHint = 110; - data.horizontalSpan = 2; - treePanel.setLayoutData(data); - - tree = new Tree(treePanel, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE); - data = new GridData(GridData.FILL_BOTH); - //data.widthHint = 120; - tree.setLayoutData(data); - treeViewer = new TreeViewer(tree); - contentProvider = new MonitorTreeContentProvider(); - treeViewer.setContentProvider(contentProvider); - treeViewer.setInput(MonitorTreeContentProvider.ROOT); - treeViewer.setLabelProvider(new TreeLabelProvider()); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(tree, ContextIds.VIEW_TREE); - - Composite detailsPanel = new Composite(treePanel, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 1; - layout.marginHeight = 2; - layout.marginWidth = 0; - detailsPanel.setLayout(layout); - data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL); - data.widthHint = 200; - detailsPanel.setLayoutData(data); - - final Label label = new Label(detailsPanel, SWT.NONE); - label.setText(NLS.bind(Messages.viewTime, "")); - label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); - - final Label label2 = new Label(detailsPanel, SWT.NONE); - label2.setText(NLS.bind(Messages.viewResponseTime, "")); - label2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); - - final Label label3 = new Label(detailsPanel, SWT.NONE); - label3.setText(NLS.bind(Messages.viewType, "")); - label3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); - - // create center and right panels - SashForm sashFchild = new SashForm(sashFparent, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 2; - layout.horizontalSpacing = 2; - layout.verticalSpacing = 4; - sashFchild.setLayout(layout); - sashFparent.setWeights(new int[] { 30, 70 }); - - // request panel - Composite request = new Composite(sashFchild, SWT.NONE); - layout = new GridLayout(); - layout.verticalSpacing = 3; - layout.marginHeight = 2; - layout.marginWidth = 0; - request.setLayout(layout); - request.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Composite requestHeader = new Composite(request, SWT.NONE); - layout = new GridLayout(); - layout.verticalSpacing = 1; - layout.numColumns = 2; - layout.marginHeight = 0; - layout.marginWidth = 2; - data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - requestHeader.setLayout(layout); - requestHeader.setLayoutData(data); - - final Label requestLabel = new Label(requestHeader, SWT.NONE); - requestLabel.setText(NLS.bind(Messages.viewRequest, "")); - requestLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - final Combo requestViewerCombo = new Combo(requestHeader, SWT.DROP_DOWN | SWT.READ_ONLY); - data = new GridData(GridData.HORIZONTAL_ALIGN_END); - data.verticalSpan = 2; - requestViewerCombo.setLayoutData(data); - - final Label requestSizeLabel = new Label(requestHeader, SWT.NONE); - requestSizeLabel.setText(NLS.bind(Messages.viewSize, "")); - requestSizeLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // response panel - Composite response = new Composite(sashFchild, SWT.NONE); - layout = new GridLayout(); - layout.verticalSpacing = 3; - layout.marginHeight = 2; - layout.marginWidth = 0; - response.setLayout(layout); - response.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Composite responseHeader = new Composite(response, SWT.NONE); - layout = new GridLayout(); - layout.verticalSpacing = 1; - layout.numColumns = 2; - layout.marginHeight = 0; - layout.marginWidth = 2; - data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - responseHeader.setLayout(layout); - responseHeader.setLayoutData(data); - - final Label responseLabel = new Label(responseHeader, SWT.NONE); - responseLabel.setText(NLS.bind(Messages.viewResponse, "")); - responseLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - final Combo responseViewerCombo = new Combo(responseHeader, SWT.DROP_DOWN | SWT.READ_ONLY); - data = new GridData(GridData.HORIZONTAL_ALIGN_END); - data.verticalSpan = 2; - responseViewerCombo.setLayoutData(data); - - final Label responseSizeLabel = new Label(responseHeader, SWT.NONE); - responseSizeLabel.setText(NLS.bind(Messages.viewSize, "")); - responseSizeLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // viewer manager - vm = new ViewerManager(request, request, response, response); - requestViewers = vm.getRequestViewers(); - responseViewers = vm.getResponseViewers(); - - // set up the viewer combo boxes - Iterator iterator = requestViewers.iterator(); - int ctr = 0; - while (iterator.hasNext()) { - Viewer viewer = (Viewer) iterator.next(); - requestViewerCombo.add(viewer.getLabel(), ctr); - if (viewer.getId().equals(DEFAULT_VIEWER)) { - requestViewerCombo.select(ctr); - vm.setRequestViewer(viewer); - } - ctr++; - } - requestViewerCombo.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - Viewer viewer = (Viewer) requestViewers.get(requestViewerCombo.getSelectionIndex()); - if (currentRequest != null && viewer != null) - currentRequest.setProperty("request-viewer", viewer.getId()); - vm.setRequestViewer(viewer); - } - - public void widgetDefaultSelected(SelectionEvent e) { - // ignore - } - }); - requestHeader.layout(true); - - iterator = responseViewers.iterator(); - ctr = 0; - while (iterator.hasNext()) { - Viewer viewer = (Viewer) iterator.next(); - responseViewerCombo.add(viewer.getLabel(), ctr); - if (viewer.getId().equals(DEFAULT_VIEWER)) { - responseViewerCombo.select(ctr); - vm.setResponseViewer(viewer); - } - ctr++; - } - responseViewerCombo.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - Viewer viewer = (Viewer) responseViewers.get(responseViewerCombo.getSelectionIndex()); - if (currentRequest != null && viewer != null) - currentRequest.setProperty("response-viewer", viewer.getId()); - vm.setResponseViewer(viewer); - } - - public void widgetDefaultSelected(SelectionEvent e) { - // ignore - } - }); - responseHeader.layout(true); - - // selection listener - treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - ISelection selection = event.getSelection(); - - currentRequest = null; - if (selection != null && !selection.isEmpty()) { - StructuredSelection sel = (StructuredSelection) selection; - currentSelection = sel; - Object obj = sel.iterator().next(); - if (obj instanceof Request) - currentRequest = (Request) obj; - } - - if (currentRequest != null) { - label.setText(NLS.bind(Messages.viewTime, format.format(currentRequest.getDate()))); - - if (currentRequest.getResponseTime() == -1) - label2.setText(NLS.bind(Messages.viewResponseTime, "")); - else { - String time = NLS.bind(Messages.viewResponseTimeFormat, currentRequest.getResponseTime() + ""); - label2.setText(NLS.bind(Messages.viewResponseTime, time)); - } - label3.setText(NLS.bind(Messages.viewType, currentRequest.getProtocol())); - - // request information - requestLabel.setText(NLS.bind(Messages.viewRequest, "localhost:" + currentRequest.getLocalPort())); - requestSizeLabel.setText(getSizeString(currentRequest.getRequest(Request.CONTENT), currentRequest.getRequest(Request.ALL))); - - // response information - responseLabel.setText(NLS.bind(Messages.viewResponse, currentRequest.getRemoteHost() + ":" + currentRequest.getRemotePort())); - responseSizeLabel.setText(getSizeString(currentRequest.getResponse(Request.CONTENT), currentRequest.getResponse(Request.ALL))); - - vm.setRequest(currentRequest); - - Viewer viewer = vm.findViewer((String) currentRequest.getProperty("request-viewer")); - if (viewer == null) - viewer = vm.findViewer(DEFAULT_VIEWER); - if (viewer != null) { - vm.setRequestViewer(viewer); - requestViewerCombo.select(requestViewers.indexOf(viewer)); - } - - viewer = vm.findViewer((String) currentRequest.getProperty("response-viewer")); - if (viewer == null && currentRequest.getName() != null) - viewer = vm.getDefaultViewer(currentRequest.getName()); - if (viewer != null) { - vm.setResponseViewer(viewer); - responseViewerCombo.select(responseViewers.indexOf(viewer)); - } - } else { - label.setText(NLS.bind(Messages.viewTime, "")); - label2.setText(NLS.bind(Messages.viewResponseTime, "")); - requestLabel.setText(NLS.bind(Messages.viewRequest, "")); - requestSizeLabel.setText(NLS.bind(Messages.viewSize, "")); - responseLabel.setText(NLS.bind(Messages.viewResponse, "")); - responseSizeLabel.setText(NLS.bind(Messages.viewSize, "")); - vm.setRequest(currentRequest); - } - } - }); - treeViewer.expandToLevel(2); - - // create a menu manager for a context menu - MenuManager menuManager = new MenuManager(); - menuManager.setRemoveAllWhenShown(true); - menuManager.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager menu) { - menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - menu.add(preferenceAction); - } - }); - - // create the menu - Menu menu = menuManager.createContextMenu(treeViewer.getControl()); - treeViewer.getControl().setMenu(menu); - - // register the menu with the platform - getSite().registerContextMenu(menuManager, treeViewer); - - initializeActions(); - } - - protected String getSizeString(byte[] a, byte[] b) { - String aa = "0"; - String bb = "0"; - if (a != null) - aa = a.length + ""; - if (b != null) - bb = b.length + ""; - String size = NLS.bind(Messages.viewSizeFormat, new Object[] { aa, bb}); - return NLS.bind(Messages.viewSize, size); - } - - public void dispose() { - super.dispose(); - treeViewer = null; - view = null; - } - - /** - * - */ - public void initializeActions() { - final IAction sortByResponseTimeAction = new Action() { - public void run() { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - boolean b = contentProvider.getSortByResponseTime(); - contentProvider.setSortByResponseTime(!b); - treeViewer.refresh(); - setChecked(!b); - } - }); - } - }; - sortByResponseTimeAction.setChecked(false); - sortByResponseTimeAction.setToolTipText(Messages.actionSortByResponseTime); - sortByResponseTimeAction.setImageDescriptor(MonitorUIPlugin.getImageDescriptor(MonitorUIPlugin.IMG_ELCL_SORT_RESPONSE_TIME)); - sortByResponseTimeAction.setHoverImageDescriptor(MonitorUIPlugin.getImageDescriptor(MonitorUIPlugin.IMG_CLCL_SORT_RESPONSE_TIME)); - sortByResponseTimeAction.setDisabledImageDescriptor(MonitorUIPlugin.getImageDescriptor(MonitorUIPlugin.IMG_DLCL_SORT_RESPONSE_TIME)); - - IAction clearAction = new Action() { - public void run() { - MonitorUIPlugin.getInstance().clearRequests(); - clear(); - } - }; - clearAction.setToolTipText(Messages.actionClearToolTip); - clearAction.setImageDescriptor(MonitorUIPlugin.getImageDescriptor(MonitorUIPlugin.IMG_ELCL_CLEAR)); - clearAction.setHoverImageDescriptor(MonitorUIPlugin.getImageDescriptor(MonitorUIPlugin.IMG_CLCL_CLEAR)); - clearAction.setDisabledImageDescriptor(MonitorUIPlugin.getImageDescriptor(MonitorUIPlugin.IMG_DLCL_CLEAR)); - - httpHeaderAction = new Action() { - public void run() { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - boolean b = vm.getDisplayHeaderInfo(); - vm.setDisplayHeaderInfo(!b); - setChecked(!b); - } - }); - } - }; - httpHeaderAction.setChecked(vm.getDisplayHeaderInfo()); - httpHeaderAction.setText(Messages.actionShowHeader); - - preferenceAction = new Action() { - public void run() { - showPreferencePage(); - } - }; - preferenceAction.setText(Messages.actionProperties); - - - IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager(); - tbm.add(sortByResponseTimeAction); - tbm.add(clearAction); - - IContentFilter[] filters = MonitorPlugin.getInstance().getContentFilters(); - IMenuManager menuManager = getViewSite().getActionBars().getMenuManager(); - menuManager.add(httpHeaderAction); - int size = filters.length; - for (int i = 0; i < size; i++) { - FilterAction action = new FilterAction(vm, filters[i]); - menuManager.add(action); - } - menuManager.add(new Separator()); - menuManager.add(preferenceAction); - } - - protected boolean showPreferencePage() { - PreferenceManager manager = PlatformUI.getWorkbench().getPreferenceManager(); - IPreferenceNode node = manager.find("org.eclipse.debug.ui.DebugPreferencePage").findSubNode("org.eclipse.wst.internet.monitor.preferencePage"); - PreferenceManager manager2 = new PreferenceManager(); - manager2.addToRoot(node); - - final PreferenceDialog dialog = new PreferenceDialog(getSite().getShell(), manager2); - final boolean[] result = new boolean[] { false }; - BusyIndicator.showWhile(getSite().getShell().getDisplay(), new Runnable() { - public void run() { - dialog.create(); - if (dialog.open() == Window.OK) - result[0] = true; - } - }); - return result[0]; - } - - /** - * Open a request. - * - * @param request the request - */ - public static void open(final Request request) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - try { - IWorkbench workbench = MonitorUIPlugin.getInstance().getWorkbench(); - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - - IWorkbenchPage page = workbenchWindow.getActivePage(); - - IViewPart view2 = page.findView(VIEW_ID); - - if (view2 != null) - page.bringToTop(view2); - else - page.showView(VIEW_ID); - - if (view != null) - view.setSelection(request); - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Error opening TCP/IP view", e); - } - } - }); - } - - /** - * - */ - public void setFocus() { - if (tree != null) - tree.setFocus(); - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ResendMessageAction.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ResendMessageAction.java deleted file mode 100644 index 0df04dee5..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ResendMessageAction.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.view; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.wst.internet.monitor.core.internal.MonitorManager; -import org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -/** - * Resends the selected request and adds the result to the request/response tree. - */ -public class ResendMessageAction implements IViewActionDelegate{ - protected ISelection selection = null; - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - // do nothing - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - if (selection != null) { - Object element = ((StructuredSelection) selection).getFirstElement(); - if (element != null && element instanceof Request) { - Request req = (Request) element; - ResendHTTPRequest newReq = MonitorManager.createResendRequest(req); - MonitorManager.getInstance().addResendRequest(req, newReq); - TreeViewer treeViewer = MonitorView.view.treeViewer; - treeViewer.add(req, newReq); - treeViewer.setSelection(new StructuredSelection(newReq), false); - newReq.sendRequest(); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection2) { - this.selection = selection2; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/SendModifiedMessageAction.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/SendModifiedMessageAction.java deleted file mode 100644 index 830b433b8..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/SendModifiedMessageAction.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.view; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IViewActionDelegate; -import org.eclipse.ui.IViewPart; -import org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer; -import org.eclipse.wst.internet.monitor.ui.internal.viewers.HeaderViewer; -/** - * Send a modified message. - */ -public class SendModifiedMessageAction implements IViewActionDelegate{ - ISelection selection = null; - - /* (non-Javadoc) - * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) - */ - public void init(IViewPart view) { - // do nothing - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ - public void run(IAction action) { - if (selection != null) { - Object element = ((StructuredSelection) selection).getFirstElement(); - if (element != null && element instanceof ResendHTTPRequest) { - ResendHTTPRequest req = (ResendHTTPRequest) element; - ContentViewer curViewer = MonitorView.view.vm.getCurrentRequestViewer(); - HeaderViewer curHeaderViewer = MonitorView.view.vm.getCurrentRequestHeaderViewer(); - req.setRequest(curViewer.getContent(), Request.CONTENT); - - if (curHeaderViewer != null) - req.setRequest(curHeaderViewer.getContent(), Request.TRANSPORT); - - req.sendRequest(); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) - */ - public void selectionChanged(IAction action, ISelection selection2) { - this.selection = selection2; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/TreeLabelProvider.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/TreeLabelProvider.java deleted file mode 100644 index 99c1df34b..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/TreeLabelProvider.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.view; - -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.internet.monitor.ui.internal.MonitorUIPlugin; -/** - * A label provider for the monitor server view. - */ -public class TreeLabelProvider implements ILabelProvider { - /** - * TreeLabelProvider constructor comment. - */ - public TreeLabelProvider() { - super(); - } - - /* - * Adds a listener to this label provider. - */ - public void addListener(ILabelProviderListener listener) { - // do nothing - } - - /* - * Disposes of this label provider. - */ - public void dispose() { - // do nothing - } - - /* - * Returns the image for the label of the given element for use - * in the given viewer. - */ - public Image getImage(Object element) { - if (element instanceof Request) { - if (element instanceof ResendHTTPRequest) { - if (!((ResendHTTPRequest) element).hasBeenSent()) - return MonitorUIPlugin.getImage(MonitorUIPlugin.IMG_RESEND_REQUEST_RESPONSE); - } - return MonitorUIPlugin.getImage(MonitorUIPlugin.IMG_REQUEST_RESPONSE); - } - return MonitorUIPlugin.getImage(MonitorUIPlugin.IMG_HOST); - } - - /* - * Returns the text for the label of the given element for use - * in the given viewer. - */ - public String getText(Object element) { - if (element instanceof Request) { - Request call = (Request) element; - return call.getName(); - } else if (element instanceof Integer) { - Integer in = (Integer) element; - return "localhost:" + in.intValue(); - } else - return element.toString(); - } - - /* - * Returns whether the label would be affected - * by a change to the given property of the given element. - */ - public boolean isLabelProperty(Object element, String property) { - return false; - } - - /* - * Removes a listener to this label provider. - */ - public void removeListener(ILabelProviderListener listener) { - // do nothing - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/Viewer.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/Viewer.java deleted file mode 100644 index b5cce39d3..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/Viewer.java +++ /dev/null @@ -1,73 +0,0 @@ -/********************************************************************** - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - **********************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.view; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.wst.internet.monitor.ui.internal.Trace; -import org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer; -/** - * - */ -public class Viewer { - private IConfigurationElement element; - - /** - * Create a new content viewer. - * - * @param element a configuration element - */ - public Viewer(IConfigurationElement element) { - super(); - this.element = element; - } - - public String getId() { - return element.getAttribute("id"); - } - - public String getLabel() { - String label = element.getAttribute("label"); - if (label == null) - return "n/a"; - return label; - } - - /** - * Create an instance of the viewer. - * - * @return the viewer, or <code>null</code> if it couldn't be loaded - */ - public ContentViewer createViewer() { - try { - return (ContentViewer) element.createExecutableExtension("class"); - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Could not create viewer" + toString() + ": " + e.getMessage()); - return null; - } - } - - public boolean isRequestViewer() { - return element.getAttribute("type").toLowerCase().indexOf("request") >= 0; - } - - public boolean isResponseViewer() { - return element.getAttribute("type").toLowerCase().indexOf("response") >= 0; - } - - /** - * Return a string representation of this object. - * - * @return String - */ - public String toString() { - return "ContentViewer[" + getId() + "]"; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ViewerManager.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ViewerManager.java deleted file mode 100644 index 67486c57f..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/view/ViewerManager.java +++ /dev/null @@ -1,292 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.view; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.core.runtime.*; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.internet.monitor.core.internal.IContentFilter; -import org.eclipse.wst.internet.monitor.core.internal.http.ResendHTTPRequest; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.internet.monitor.ui.internal.MonitorUIPlugin; -import org.eclipse.wst.internet.monitor.ui.internal.Trace; -import org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer; -import org.eclipse.wst.internet.monitor.ui.internal.viewers.ByteViewer; -import org.eclipse.wst.internet.monitor.ui.internal.viewers.HeaderViewer; -/** - * - */ -public class ViewerManager { - private boolean displayHeaderInf; - - protected ContentViewer reqViewer; - protected ContentViewer respViewer; - protected Viewer requestViewer; - protected Viewer responseViewer; - - protected HeaderViewer reqHeader; - protected HeaderViewer respHeader; - - protected Composite reqHComp; - protected Composite reqVComp; - - protected Composite respHComp; - protected Composite respVComp; - - protected List viewers; - - protected Request request; - - protected List filters = new ArrayList(); - - public ViewerManager(Composite reqHeadParent, Composite reqViewParent, Composite respHeadParent, Composite respViewParent) { - reqHComp = reqHeadParent; - respHComp = respHeadParent; - reqVComp = reqViewParent; - respVComp = respViewParent; - reqHeader = new HeaderViewer(reqHComp, HeaderViewer.REQUEST_HEADER); - respHeader = new HeaderViewer(respHComp, HeaderViewer.RESPONSE_HEADER); - reqViewer = new ByteViewer(); - reqViewer.init(reqVComp); - respViewer = new ByteViewer(); - respViewer.init(respVComp); - setDisplayHeaderInfo(MonitorUIPlugin.getShowHeaderPreference()); - loadAvailableViewers(); - } - - protected Viewer getDefaultViewer(String name) { - if (name == null) - return null; - - String name2 = name.toLowerCase(); - if (name2.endsWith(".xml")) - return findViewer("org.eclipse.wst.internet.monitor.viewers.xml"); - else if (name2.endsWith(".html")) - return findViewer("org.eclipse.wst.internet.monitor.viewers.browser"); - else if (name2.endsWith(".gif") || name2.endsWith(".jpg") || - name2.endsWith(".jpeg") || name2.endsWith(".png")) - return findViewer("org.eclipse.wst.internet.monitor.viewers.image"); - else - return findViewer("org.eclipse.wst.internet.monitor.viewers.byte"); - } - - protected Viewer findViewer(String id) { - if (id == null) - return null; - - Iterator iterator = viewers.iterator(); - while (iterator.hasNext()) { - Viewer viewer = (Viewer) iterator.next(); - if (id.equals(viewer.getId())) - return viewer; - } - return null; - } - - private void loadAvailableViewers() { - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IConfigurationElement[] cf = registry.getConfigurationElementsFor(MonitorUIPlugin.PLUGIN_ID, "viewers"); - int size = cf.length; - viewers = new ArrayList(size); - for (int i = 0; i < size; i++) { - viewers.add(new Viewer(cf[i])); - } - } - - /* (non-Javadoc) - * @see org.eclipse.wst.internet.monitor.internal.view.IViewerManager#setDisplayHeaderInfo(boolean) - */ - public void setDisplayHeaderInfo(boolean b) { - displayHeaderInf = b; - reqHeader.setDisplayHeader(b); - respHeader.setDisplayHeader(b); - MonitorUIPlugin.setShowHeaderPreference(b); - if (b) { - reqHeader.setEditable(false); - if (request instanceof ResendHTTPRequest && request.getResponse(Request.TRANSPORT) == null) { - reqHeader.setEditable(true); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.wst.internet.monitor.internal.view.IViewerManager#getDisplayHeaderInfo() - */ - public boolean getDisplayHeaderInfo() { - return displayHeaderInf; - } - - public void setRequest(Request rr) { - // maintain the state of the request and request header if they've been modified. - if (request instanceof ResendHTTPRequest && request.getResponse(Request.ALL) == null) { - ResendHTTPRequest resRequest = (ResendHTTPRequest) request; - //EditableContentViewer editViewer = (ContentViewer) reqViewer; - byte[] content = reqViewer.getContent(); - byte[] b = resRequest.getRequest(Request.CONTENT); - if (content != null && b != null && !MonitorUIPlugin.parse(b).equals(MonitorUIPlugin.parse(content))) { - resRequest.setRequest(content, Request.CONTENT); - } - byte[] header = reqHeader.getContent(); - b = resRequest.getRequest(Request.TRANSPORT); - if (header != null && b != null && !MonitorUIPlugin.parse(b).equals(MonitorUIPlugin.parse(header))) { - resRequest.setRequest(header, Request.TRANSPORT); - } - } - reqHeader.setRequestResponse(rr); - respHeader.setRequestResponse(rr); - byte[] b = null; - if (rr != null) - b = filter(rr.getRequest(Request.CONTENT)); - reqViewer.setContent(b); - b = null; - if (rr != null) - b = filter(rr.getResponse(Request.CONTENT)); - respViewer.setContent(b); - request = rr; - - // set the editor to editable if the request hasn't been sent and the - // editor can be set as editable - if (request instanceof ResendHTTPRequest && request.getResponse(Request.ALL) == null) { - if (displayHeaderInf) { - reqHeader.setEditable(true); - } - reqViewer.setEditable(true); - } else { - if (displayHeaderInf) { - reqHeader.setEditable(false); - } - reqViewer.setEditable(false); - } - } - - public void addFilter(IContentFilter filter) { - filters.add(filter); - setRequest(request); - } - - public void removeFilter(IContentFilter filter) { - filters.remove(filter); - setRequest(request); - } - - protected byte[] filter(byte[] b) { - if (b == null) - return null; - Iterator iterator = filters.iterator(); - while (iterator.hasNext()) { - IContentFilter filter = (IContentFilter) iterator.next(); - try { - b = filter.filter(request, false, b); - } catch (Exception e) { - Trace.trace(Trace.SEVERE, "Error while filtering with " + filter.getId(), e); - } - } - return b; - } - - /* (non-Javadoc) - * @see org.eclipse.tcpip.monitor.internal.view.IViewerManager#getRequestViewers() - */ - public List getRequestViewers() { - Iterator iterator = viewers.iterator(); - List temp = new ArrayList(); - while (iterator.hasNext()) { - Viewer viewer = (Viewer) iterator.next(); - if (viewer.isRequestViewer()) - temp.add(viewer); - } - return temp; - } - - /* (non-Javadoc) - * @see org.eclipse.tcpip.monitor.internal.view.IViewerManager#getResponseViewers() - */ - public List getResponseViewers() { - Iterator iterator = viewers.iterator(); - List temp = new ArrayList(); - while (iterator.hasNext()) { - Viewer viewer = (Viewer) iterator.next(); - if (viewer.isResponseViewer()) - temp.add(viewer); - } - return temp; - } - - /* (non-Javadoc) - * @see org.eclipse.tcpip.monitor.internal.view.IViewerManager#setRequestViewer(java.lang.String) - */ - public void setRequestViewer(Viewer viewer) { - if (viewer != null && viewer.equals(requestViewer)) - return; - - // call set request to save and reset the request - setRequest(request); - reqViewer.dispose(); - - requestViewer = viewer; - reqViewer = viewer.createViewer(); - if (reqViewer == null) - return; - - reqViewer.init(reqVComp); - //reqViewer.setRequestResponse(rr); - byte[] b = null; - if (request != null) { - b = filter(request.getRequest(Request.CONTENT)); - // set the editor to editable if the request hasn't been sent and the - // editor can be set as editable - if (request instanceof ResendHTTPRequest && request.getResponse(Request.TRANSPORT) == null) { - reqViewer.setEditable(true); - } else { - reqViewer.setEditable(false); - } - } - reqViewer.setContent(b); - reqVComp.layout(true); - } - - /* (non-Javadoc) - * @see org.eclipse.tcpip.monitor.internal.view.IViewerManager#setResponseViewer(java.lang.String) - */ - public void setResponseViewer(Viewer viewer) { - if (viewer != null && viewer.equals(responseViewer)) - return; - respViewer.dispose(); - - responseViewer = viewer; - respViewer = viewer.createViewer(); - if (respViewer == null) - return; - respViewer.init(respVComp); - //respViewer.setRequestResponse(rr); - byte[] b = null; - if (request != null) - b = filter(request.getResponse(Request.CONTENT)); - respViewer.setContent(b); - respVComp.layout(true); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.internet.monitor.ui.internal.view.IViewerManager#getCurrentRequestViewer() - */ - public ContentViewer getCurrentRequestViewer() { - return reqViewer; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.internet.monitor.ui.internal.view.IViewerManager#getCurrentRequestHeaderViewer() - */ - public HeaderViewer getCurrentRequestHeaderViewer() { - return reqHeader; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/BrowserViewer.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/BrowserViewer.java deleted file mode 100644 index 4cdfd8483..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/BrowserViewer.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.viewers; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.browser.Browser; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.internet.monitor.ui.internal.Messages; -import org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer; -/** - * A browser viewer. - */ -public class BrowserViewer extends ContentViewer { - protected Browser browser; - - protected byte[] content; - - /** (non-Javadoc) - * @see ContentViewer#init(Composite) - */ - public void init(Composite parent) { - browser = new Browser(parent, SWT.BORDER); - browser.setLayoutData(new GridData(GridData.FILL_BOTH)); - } - - /** (non-Javadoc) - * @see ContentViewer#setContent(byte[]) - */ - public void setContent(byte[] b) { - content = b; - if (b == null || b.length == 0) { - browser.setText(Messages.htmlViewInvalid); - } else { - byte cr = '\r'; - byte lf = '\n'; - int trimFront = 0; - int trimBack = 0; - int len = b.length - 1; - while (b[trimFront] == cr || b[trimFront] == lf) - trimFront++; - while (b[len - trimBack] == cr || b[len - trimBack] == lf) - trimBack++; - - if (trimFront + trimBack > 0) { - byte[] temp = b; - b = new byte[temp.length - trimBack - trimFront]; - for (int i = trimFront; i < temp.length - trimBack; i++) { - b[i - trimFront] = temp[i]; - } - } - browser.setText(new String(b)); - } - } - - /** - * @see ContentViewer#getContent() - */ - public byte[] getContent() { - return content; - } - - /** (non-Javadoc) - * @see ContentViewer#dispose() - */ - public void dispose() { - browser.dispose(); - browser = null; - content = null; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/ByteViewer.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/ByteViewer.java deleted file mode 100644 index 30377dd28..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/ByteViewer.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.viewers; - -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.internet.monitor.ui.internal.ContextIds; -import org.eclipse.wst.internet.monitor.ui.internal.MonitorUIPlugin; -import org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer; -/** - * A basic byte viewer. - */ -public class ByteViewer extends ContentViewer { - protected Text text; - - /** (non-Javadoc) - * @see ContentViewer#init(Composite) - */ - public void init(Composite parent) { - text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL); - Display display = parent.getDisplay(); - text.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND)); - text.setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND)); - text.setLayoutData(new GridData(GridData.FILL_BOTH)); - text.setFont(JFaceResources.getTextFont()); - PlatformUI.getWorkbench().getHelpSystem().setHelp(text, ContextIds.VIEW_RESPONSE); - } - - /** (non-Javadoc) - * @see ContentViewer#setEditable(boolean) - */ - public void setEditable(boolean editable) { - text.setEditable(editable); - } - - /** (non-Javadoc) - * @see ContentViewer#getContent() - */ - public byte[] getContent() { - if (text == null) { - return new byte[0]; - } - String content = text.getText().trim(); - if (content.equals("")) { - return new byte[0]; - } - // Need to ensure that there is a newline at the end of the content. - // getBytes() removes the newline. - byte[] twoNewlines = new byte[] { '\015', '\012' }; - byte[] contentBytes = content.getBytes(); - byte[] retBytes = new byte[contentBytes.length + 2]; - System.arraycopy(contentBytes, 0, retBytes, 0, contentBytes.length); - System.arraycopy(twoNewlines, 0, retBytes, contentBytes.length, 2); - return retBytes; - } - - /** (non-Javadoc) - * @see ContentViewer#setContent(byte[]) - */ - public void setContent(byte[] b) { - String out = ""; - if (b != null) - out = MonitorUIPlugin.parse(b); - - String lineSeparator = System.getProperty("line.separator"); - int ls = lineSeparator.length(); - if (out.length() > ls) { - while (out.substring(0, ls).indexOf(lineSeparator) >= 0) - out = out.substring(ls, out.length()); - } - - text.setText(out); - } - - /** (non-Javadoc) - * @see ContentViewer#dispose() - */ - public void dispose() { - text.dispose(); - text = null; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/HeaderViewer.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/HeaderViewer.java deleted file mode 100644 index 9edfbc131..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/HeaderViewer.java +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.viewers; - -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.internet.monitor.core.internal.provisional.Request; -import org.eclipse.wst.internet.monitor.ui.internal.ContextIds; -import org.eclipse.wst.internet.monitor.ui.internal.Messages; -import org.eclipse.wst.internet.monitor.ui.internal.MonitorUIPlugin; -/** - * An transport (header) viewer. - */ -public class HeaderViewer { - private static final int HEADER_TEXT_SIZE = 110; - - protected boolean displayHeader; - - protected Composite headerComp; - protected Composite innerComp; - - protected Label headerLabel; - protected Text headerText; - protected Request rr; - protected byte msg; - protected GridLayout layout; - protected GridData data; - - protected boolean hidden; - - /** - * Request header constant. - */ - public static byte REQUEST_HEADER = 0; - - /** - * Response header constant. - */ - public static byte RESPONSE_HEADER = 1; - - /** - * Create a new header viewer. - * - * @param parent - * @param message - */ - public HeaderViewer(Composite parent, byte message) { - displayHeader = true; - hidden = false; - - headerComp = new Composite(parent, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 1; - layout.marginHeight = 0; - layout.marginWidth = 0; - headerComp.setLayout(layout); - data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - headerComp.setLayoutData(data); - - innerComp = new Composite(headerComp, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 1; - layout.marginHeight = 0; - layout.marginWidth = 2; - innerComp.setLayout(layout); - data = new GridData(GridData.FILL_BOTH); - innerComp.setLayoutData(data); - - rr = null; - msg = message; - - setDisplayHeader(false); - } - - /** - * - * @param request - */ - public void setRequestResponse(Request request) { - rr = request; - if (!hidden) - getView(); - } - - /** - * - * @param b - */ - public void setDisplayHeader(boolean b) { - if (displayHeader != b) { - displayHeader = b; - if (displayHeader) { - innerComp.dispose(); - - data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - data.heightHint = HEADER_TEXT_SIZE; - headerComp.setLayoutData(data); - - innerComp = new Composite(headerComp, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 1; - layout.marginHeight = 0; - layout.marginWidth = 0; - innerComp.setLayout(layout); - data = new GridData(GridData.FILL_BOTH); - data.heightHint = HEADER_TEXT_SIZE; - innerComp.setLayoutData(data); - - headerText = new Text(innerComp, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL); - Display display = innerComp.getDisplay(); - headerText.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND)); - headerText.setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND)); - headerText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); - headerText.setFont(JFaceResources.getTextFont()); - PlatformUI.getWorkbench().getHelpSystem().setHelp(headerText, ContextIds.VIEW_RESPONSE); - - headerComp.getParent().layout(true); - } else { - innerComp.dispose(); - - data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING); - headerComp.setLayoutData(data); - - innerComp = new Composite(headerComp, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 1; - layout.marginHeight = 0; - layout.marginWidth = 2; - innerComp.setLayout(layout); - data = new GridData(GridData.FILL_BOTH); - innerComp.setLayoutData(data); - - headerLabel = new Label(innerComp, SWT.NONE); - headerLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING)); - - headerComp.getParent().layout(true); - } - } - getView(); - } - - private void getView() { - String out = ""; - if (rr != null) { - if (msg == REQUEST_HEADER) { - byte[] b = rr.getRequest(Request.TRANSPORT); - if (b != null) - out = MonitorUIPlugin.parse(b); - } else if (msg == RESPONSE_HEADER) { - byte[] b = rr.getResponse(Request.TRANSPORT); - if (b != null) - out = MonitorUIPlugin.parse(b); - } - } - - if (displayHeader) - headerText.setText(out); - else { - String lineSeparator = System.getProperty("line.separator"); - int index = out.indexOf(lineSeparator); - if (index > 0) - headerLabel.setText(NLS.bind(Messages.headerLabel, out.substring(0, index))); - else - headerLabel.setText(NLS.bind(Messages.headerLabel, out)); - } - } - - /** - * Dispose the header. - */ - public void dispose() { - headerComp.dispose(); - } - - /** - * Set whether the header can be edited. - * - * @param editable If true the header can be edited, otherwise the header cannot be edited. - */ - public void setEditable(boolean editable) { - headerText.setEditable(editable); - } - - /** - * Get the content from the header. - * - * @return The content from the header. - */ - public byte[] getContent() { - if (headerText == null || headerText.isDisposed()) - return null; - - String header = headerText.getText().trim(); - // Need to ensure that the following 4 bytes end the header. The getBytes() - // method removes spaces at the end of the string. - byte[] twoNewlines = new byte[] { '\015', '\012', '\015', '\012' }; - byte[] headerBytes = header.getBytes(); - byte[] retBytes = new byte[headerBytes.length + 4]; - System.arraycopy(headerBytes, 0, retBytes, 0, headerBytes.length); - System.arraycopy(twoNewlines, 0, retBytes, headerBytes.length, 4); - return retBytes; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/ImageViewer.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/ImageViewer.java deleted file mode 100644 index f8618ed17..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/ImageViewer.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.viewers; - -import java.io.ByteArrayInputStream; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.wst.internet.monitor.ui.internal.Messages; -import org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer; -/** - * An image viewer. - */ -public class ImageViewer extends ContentViewer { - protected Label messageLabel; - - protected byte[] content; - - /** (non-Javadoc) - * @see ContentViewer#init(Composite) - */ - public void init(Composite parent) { - messageLabel = new Label(parent, SWT.NONE); - messageLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING)); - messageLabel.setText(Messages.imageViewInvalid); - } - - /** (non-Javadoc) - * @see ContentViewer#setContent(byte[]) - */ - public void setContent(byte[] b) { - content = b; - if (b == null || b.length == 0) { - messageLabel.setImage(null); - } else { - byte cr = '\r'; - byte lf = '\n'; - int trimFront = 0; - int trimBack = 0; - int len = b.length - 1; - while (b[trimFront] == cr || b[trimFront] == lf) - trimFront++; - while (b[len - trimBack] == cr || b[len - trimBack] == lf) - trimBack++; - - if (trimFront + trimBack > 0) { - byte[] temp = b; - b = new byte[temp.length - trimBack - trimFront]; - for (int i = trimFront; i < temp.length - trimBack; i++) { - b[i - trimFront] = temp[i]; - } - } - try { - ImageData imgD = new ImageData(new ByteArrayInputStream(b)); - Image img = new Image(null, imgD); - messageLabel.setImage(img); - } catch(Exception e) { - messageLabel.setImage(null); - } - } - - Composite parent = messageLabel.getParent(); - messageLabel.setFont(parent.getFont()); - parent.layout(true); - } - - /** - * @see ContentViewer#getContent() - */ - public byte[] getContent() { - return content; - } - - /** (non-Javadoc) - * @see ContentViewer#dispose() - */ - public void dispose() { - messageLabel.dispose(); - messageLabel = null; - content = null; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/XMLViewer.java b/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/XMLViewer.java deleted file mode 100644 index 9113d1cc2..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/monitorui/org/eclipse/wst/internet/monitor/ui/internal/viewers/XMLViewer.java +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - Initial API and implementation - * - * 2005-11-25 Arthur Ryman, ryman@ca.ibm.com - * - fixed bug 118102: set xmlTagMissing correctly each time setContent() is called - *******************************************************************************/ -package org.eclipse.wst.internet.monitor.ui.internal.viewers; - -import java.io.*; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.*; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.eclipse.jface.resource.JFaceResources; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.internet.monitor.ui.internal.ContextIds; -import org.eclipse.wst.internet.monitor.ui.internal.Messages; -import org.eclipse.wst.internet.monitor.ui.internal.MonitorUIPlugin; -import org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer; - -import org.w3c.dom.*; -import org.xml.sax.*; -/** - * XML Viewer. - */ -public class XMLViewer extends ContentViewer { - protected Composite viewerComp; - protected StackLayout layout; - protected Text messageText; - protected Label messageLabel; - - protected boolean xmlTagMissing = false; - protected boolean setEncoding = false; - protected boolean missingEncoding = false; - protected String originalEncoding; - - protected byte[] content; - - /** (non-Javadoc) - * @see ContentViewer#setContent(byte[]) - */ - public void setContent(byte[] b) { - content = b; - String out = ""; - if (b != null) - out = MonitorUIPlugin.parse(b); - - String lineSeparator = System.getProperty("line.separator"); - int ls = lineSeparator.length(); - if (out.length() > ls) { - while (out.substring(0, ls).indexOf(lineSeparator) >= 0) - out = out.substring(ls, out.length()); - } - - String out_temp = out.toLowerCase(); - xmlTagMissing = !out_temp.startsWith("<?xml"); - - if (out.length() > 0) { - byte[] b1 = createDocument(out); - String finalMsg = new String (b1); - if (finalMsg.startsWith("Invalid XML")) { - //case: error parsing - messageText.setVisible(false); - layout.topControl = messageLabel; - messageLabel.setVisible(true); - messageLabel.setText(Messages.xmlViewInvalid); - } else if (xmlTagMissing && finalMsg.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")) { - int x = finalMsg.indexOf("\n") + 1; - String Msg = finalMsg.substring(x); - finalMsg = Msg; - - messageText.setText(finalMsg); - } else if (setEncoding) { - //change back to original Encoding - int begin = finalMsg.indexOf("UTF-8"); //location of opening " - int last = begin + 5; //location of closing " - String first_half = finalMsg.substring(0,begin); - String second_half = finalMsg.substring(last); - finalMsg = first_half + originalEncoding + second_half; - - messageText.setText(finalMsg); - } else if (missingEncoding) { - //remove encoding completely - int begin = finalMsg.indexOf("encoding=\"UTF-8\""); //location of opening " - int last = begin + 16; //location of closing " - String first_half = finalMsg.substring(0,begin); - String second_half = finalMsg.substring(last); - finalMsg = first_half + second_half; - - messageText.setText(finalMsg); - } - } else - messageText.setText(out); - } - - /** - * @see ContentViewer#getContent() - */ - public byte[] getContent() { - return content; - } - - /** (non-Javadoc) - * @see ContentViewer#init(Composite) - */ - public void init(Composite parent) { - viewerComp = new Composite(parent, SWT.NONE); - layout = new StackLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - viewerComp.setLayout(layout); - viewerComp.setLayoutData(new GridData(GridData.FILL_BOTH)); - - messageText = new Text(viewerComp, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL); - Display display = viewerComp.getDisplay(); - messageText.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND)); - messageText.setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND)); - messageText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); - messageText.setFont(JFaceResources.getTextFont()); - messageText.setVisible(true); - PlatformUI.getWorkbench().getHelpSystem().setHelp(messageText, ContextIds.VIEW_RESPONSE); - - messageLabel = new Label(viewerComp, SWT.NONE); - messageLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING)); - messageLabel.setVisible(false); - - layout.topControl = messageText; - } - - /* (non-Javadoc) - * @#createDocument(String) - */ - protected byte[] createDocument(String str) { - byte[] parseArray = null; - Document document = null; - byte[] result = null; - - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - try { - factory.setAttribute("http://apache.org/xml/features/allow-java-encodings", new Boolean(true)); - factory.setAttribute("http://apache.org/xml/features/continue-after-fatal-error", new Boolean(true)); - } catch (Exception e) { - // ignore - } - DocumentBuilder parser = factory.newDocumentBuilder(); - - if (xmlTagMissing) { - str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + str; - } else { - String str_temp = str.toLowerCase(); - - //if encoding present,then save original Encoding, change to UTF-8 - if (str_temp.indexOf("encoding=") >= 0) { - setEncoding = true; - String temp1 = str.substring(str_temp.indexOf("encoding=")); - int beginIndex = temp1.indexOf("\"") + 1; - String temp2 = temp1.substring(beginIndex); - int endIndex = temp2.indexOf("\""); - originalEncoding = temp2.substring(0, endIndex); - } - - //if no encoding at all,then no changes to be made - else if (str_temp.indexOf("encoding") < 0) { - setEncoding = false; - missingEncoding = true; - } - } - parseArray = str.getBytes(); - document = parser.parse(new InputSource(new ByteArrayInputStream(parseArray))); - result = getContents(document); - - } catch (Exception e) { - result = "Invalid XML".getBytes(); - } - return result; - } - - protected byte[] getContents(Document document) throws IOException { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Result result = new StreamResult(out); - Source source = new DOMSource(document); - try { - Transformer transformer = TransformerFactory.newInstance().newTransformer(); - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$ - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ - transformer.transform(source, result); - } catch (TransformerConfigurationException e) { - throw (IOException) (new IOException().initCause(e)); - } catch (TransformerException e) { - throw (IOException) (new IOException().initCause(e)); - } - return out.toByteArray(); - } - - /** (non-Javadoc) - * @see ContentViewer#dispose() - */ - public void dispose() { - viewerComp.dispose(); - viewerComp = null; - content = null; - } -}
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/plugin.properties b/plugins/org.eclipse.wst.internet.monitor.ui/plugin.properties deleted file mode 100644 index 6a4857602..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/plugin.properties +++ /dev/null @@ -1,27 +0,0 @@ -############################################################################### -# Copyright (c) 2005 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -pluginName=TCP/IP Monitor -providerName=Eclipse.org - -extensionPointViewers=Viewers - -viewTitle=TCP/IP Monitor -actionResend=Resend request -actionModify=Modify request -actionModifyResend=Send Modified Request - -byteView=Byte -imageView=Image -xmlView=XML -browserView=Web Browser - -preferenceTitle=TCP/IP Monitor -preferenceKeywords=debug
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/plugin.xml b/plugins/org.eclipse.wst.internet.monitor.ui/plugin.xml deleted file mode 100644 index 383610e61..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/plugin.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.0"?> - -<plugin> - -<extension-point name="%extensionPointViewers" id="viewers" schema="schema/viewers.exsd"/> - -<extension point="org.eclipse.wst.internet.monitor.core.internalStartup"> - <startup - id="org.eclipse.wst.internet.monitor.ui" - class="org.eclipse.wst.internet.monitor.ui.internal.Startup"/> -</extension> - -<extension point="org.eclipse.ui.views"> - <view - id="org.eclipse.wst.internet.monitor.view" - name="%viewTitle" - category="org.eclipse.debug.ui" - class="org.eclipse.wst.internet.monitor.ui.internal.view.MonitorView" - icon="icons/cview16/monitorView.gif"> - </view> -</extension> - -<extension point="org.eclipse.ui.preferencePages"> - <page - id="org.eclipse.wst.internet.monitor.preferencePage" - name="%preferenceTitle" - category="org.eclipse.debug.ui.DebugPreferencePage" - class="org.eclipse.wst.internet.monitor.ui.internal.MonitorPreferencePage"> - <keywordReference id="org.eclipse.wst.internet.monitor.preferenceKeywords"/> - </page> -</extension> - -<extension point="org.eclipse.ui.keywords"> - <keyword - label="%preferenceKeywords" - id="org.eclipse.wst.internet.monitor.preferenceKeywords"/> -</extension> - -<extension point="org.eclipse.wst.internet.monitor.ui.viewers"> - <viewer - id="org.eclipse.wst.internet.monitor.viewers.byte" - class="org.eclipse.wst.internet.monitor.ui.internal.viewers.ByteViewer" - type="requestresponse" - label="%byteView"/> - <viewer - id="org.eclipse.wst.internet.monitor.viewers.image" - class="org.eclipse.wst.internet.monitor.ui.internal.viewers.ImageViewer" - type="requestresponse" - label="%imageView"/> - <viewer - id="org.eclipse.wst.internet.monitor.viewers.xml" - class="org.eclipse.wst.internet.monitor.ui.internal.viewers.XMLViewer" - type="requestresponse" - label="%xmlView"/> - <viewer - id="org.eclipse.wst.internet.monitor.viewers.browser" - class="org.eclipse.wst.internet.monitor.ui.internal.viewers.BrowserViewer" - type="requestresponse" - label="%browserView"/> -</extension> - -<extension point="org.eclipse.core.runtime.adapters"> - <factory - class="org.eclipse.wst.internet.monitor.ui.internal.RequestAdapterFactory" - adaptableType="org.eclipse.wst.internet.monitor.core.internal.provisional.Request"> - <adapter type="org.eclipse.ui.IActionFilter"/> - </factory> -</extension> - -<extension point="org.eclipse.ui.popupMenus"> - <objectContribution - objectClass="org.eclipse.wst.internet.monitor.core.internal.provisional.Request" - id="org.eclipse.wst.internet.monitor.ui.modifyaction"> - <filter name="requestsent" value="true"/> - <action - label="%actionResend" - menubarPath="additions" - class="org.eclipse.wst.internet.monitor.ui.internal.view.ResendMessageAction" - enablesFor="1" - id="org.eclipse.wst.internet.monitor.ui.internal.view.ResendMessageAction" - icon="icons/elcl16/resendRequest.gif"> - </action> - <action - label="%actionModify" - menubarPath="additions" - class="org.eclipse.wst.internet.monitor.ui.internal.view.ModifyMessageAction" - enablesFor="1" - id="org.eclipse.wst.internet.monitor.ui.internal.view.ModifyMessageAction" - icon="icons/etool16/editRequest.gif"> - </action> - </objectContribution> - <objectContribution - objectClass="org.eclipse.wst.internet.monitor.core.internal.provisional.Request" - id="org.eclipse.wst.internet.monitor.ui.sendmodifyaction"> - <filter name="requestsent" value="false"/> - <action - label="%actionModifyResend" - menubarPath="additions" - class="org.eclipse.wst.internet.monitor.ui.internal.view.SendModifiedMessageAction" - enablesFor="1" - id="org.eclipse.wst.internet.monitor.ui.internal.view.SendModifiedMessageAction" - icon="icons/elcl16/resendRequest.gif"> - </action> - </objectContribution> -</extension> - -</plugin>
\ No newline at end of file diff --git a/plugins/org.eclipse.wst.internet.monitor.ui/schema/viewers.exsd b/plugins/org.eclipse.wst.internet.monitor.ui/schema/viewers.exsd deleted file mode 100644 index c64ce10e8..000000000 --- a/plugins/org.eclipse.wst.internet.monitor.ui/schema/viewers.exsd +++ /dev/null @@ -1,145 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.internet.monitor.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.internet.monitor.ui" id="viewers" name="Content Viewers"/>
- </appInfo>
- <documentation>
- This extension point is used to provide a viewer for a specific type of content. (e.g. a viewer for a particular image format)
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="viewer">
- <annotation>
- <appInfo>
- <meta.element labelAttribute="name"/>
- </appInfo>
- </annotation>
- <complexType>
- <sequence>
- </sequence>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- specifies a unique identifier for this extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- specifies the fully qualified name of the Java class that extends <samp>org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer</samp>. Viewers instances of this type will delegate to instances of this class.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn="org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="label" type="string" use="required">
- <annotation>
- <documentation>
- a translatable name used to identify the content viewer
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- [issue: what is this used for?]
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- The following is an example of a content viewer extension point:
-
-<pre>
- <extension
- point="org.eclipse.wst.internet.monitor.ui.viewers">
- <viewer
- id="com.example.byteviewer"
- class="com.example.ByteContentViewer"
- type="requestresponse"
- label="%byteView"/>
- </extension>
-</pre>
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- Value of the attribute <b>class</b> must be a fully qualified name of a Java class that extends the abstract class <code>org.eclipse.wst.internet.monitor.ui.internal.provisional.ContentViewer</code>.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2003, 2005 IBM Corporation and others.<br>
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at
-<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
|