harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r438510 [4/5] - in /incubator/harmony/enhanced/tools/trunk/jmx_console: ./ doc/ doc/Images/ make/ src/ src/icons/ src/org/ src/org/apache/ src/org/apache/harmony/ src/org/apache/harmony/x/ src/org/apache/harmony/x/management/ src/org/apache...
Date Wed, 30 Aug 2006 15:03:03 GMT
Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeListener.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeListener.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeListener.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeListener.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,37 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Widget;
+
+public class MBeanTreeListener extends SelectionAdapter {
+	
+	IMBeanTreeDependant view;
+	
+	MBeanTreeListener(IMBeanTreeDependant view) {
+		this.view = view;
+	}
+	
+	public void widgetSelected(SelectionEvent event) {
+		Widget item = event.item;
+		view.redraw((MBeanTreeNode)item.getData());
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeNode.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeNode.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeNode.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeNode.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,59 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import java.util.Vector;
+
+public class MBeanTreeNode {
+	boolean isSubscribed;
+
+	Vector notifications;
+	String name;
+
+	public MBeanTreeNode(String name) {
+		isSubscribed = false;
+		this.name = name;
+	}
+
+	public void setSubscribed(boolean val) {
+		isSubscribed = val;
+		if (val) {
+			notifications = new Vector();
+		} else {
+			notifications = null;
+		}
+	}
+
+	public boolean getSubscribed() {
+		return isSubscribed;
+	}
+
+	public Vector getNotifications() {
+		return notifications;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+
+	public String toString() {
+		return "MBeanTreeNode{"+name+"}";
+	}
+}
\ No newline at end of file

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeView.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeView.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeView.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeView.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,212 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+public class MBeanTreeView extends ViewPart {
+
+	public static final String ID = "org.apache.harmony.x.management.console.plugin.view.mbeantree";
+	
+	private Tree mbean_TREE = null;
+
+	private Composite parent = null;
+
+	/*
+	 * Icons and images. 
+	 */
+	static Image mainIcon = null;
+
+	static Image errorIcon = null;
+
+	static Image resultIcon = null;
+
+	static Image connectIcon = null;
+	
+	static MBeanTreeView instance; 
+	private TreeItem root;
+	
+	public MBeanTreeView() {
+		super();
+		instance = this;
+		OutputView.print("MBeanTreeView.<init>");
+	}
+	
+	class ViewLabelProvider extends LabelProvider implements
+			ITableLabelProvider {
+		public String getColumnText(Object obj, int index) {
+			return getText(obj);
+		}
+
+		public Image getColumnImage(Object obj, int index) {
+			return getImage(obj);
+		}
+
+		public Image getImage(Object obj) {
+			return PlatformUI.getWorkbench().getSharedImages().getImage(
+					ISharedImages.IMG_OBJ_ELEMENT);
+		}
+	}
+
+	/**
+	 * This is a callback that will allow us to create the viewer and initialize
+	 * it.
+	 */
+	public void createPartControl(Composite parent) {
+
+		this.parent=parent;
+		
+		OutputView.print("MBeanTreeView.createPartControl: started");
+		Conn.setMBeanTreeView(this);
+		parent.setLayout(new FillLayout());
+		
+		parent.addDisposeListener( new DisposeListener() {
+
+			public void widgetDisposed(DisposeEvent e) {
+				OutputView.print("MBeanTreeView was disposed.");
+				Conn.setMBeanTreeView(null);
+			}
+		});
+
+		mbean_TREE = new Tree(parent, SWT.NONE);
+		mbean_TREE.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent event) {
+				
+				if(Conn.DEBUG) {
+					OutputView.print("Event on MBean Tree: "+event);
+				}
+				
+				TreeItem treeItem = (TreeItem) event.item;
+				MBeanTreeNode node = (MBeanTreeNode) treeItem.getData();
+
+				if(Conn.DEBUG) {
+					OutputView.print("selected node: "+node);
+				}
+				
+				if (node == null) {
+					return;
+				}
+				
+				Conn.setActiveNode(node);
+
+				updateDependViewList();
+			}
+		});
+		
+		root = new TreeItem(mbean_TREE, SWT.NONE);
+		
+		fill();
+	}
+
+	void fill() {
+
+		//Tools.cleanComposite(parent);
+
+		root.removeAll();
+		
+		mbean_TREE.setVisible(true);
+		
+		root.setText(Conn.getStatus());
+
+		if(Conn.getMode() == Conn.NOT_CONNECTED) {
+			return;
+		}
+
+		/*
+		 * Retrieving the domains.
+		 */
+		String[] domains = null;
+
+		try {
+			domains = Conn.getMBeanOperations().getAllDomains();
+		} catch (Exception e) {
+			Tools.fireErrorDialog(parent, e);
+			e.printStackTrace();
+			return;
+		}
+
+		
+		for (int i = 0; i < domains.length; i++) {
+
+			String[] mbeans = null;
+
+			try {
+				mbeans = Conn.getMBeanOperations().getMBeansOfDomain(domains[i]);
+			} catch (Exception e) {
+				Tools.fireErrorDialog(parent, e);
+				e.printStackTrace();
+				return;
+			}
+
+			TreeItem domain_TRI = new TreeItem(root, SWT.NULL);
+
+			domain_TRI.setText(domains[i]);
+
+			for (int j = 0; j < mbeans.length; j++) {
+				TreeItem mbean_TRI = new TreeItem(domain_TRI, SWT.NULL);
+				mbean_TRI.setText(mbeans[j]);
+				MBeanTreeNode node = new MBeanTreeNode(mbeans[j]);
+				mbean_TRI.setData(node);
+			}
+		}
+
+		/* Refresh all components */
+		parent.layout();
+	}
+	/*
+	 */
+	public void setFocus() {
+	//	treeViewer.getControl().setFocus();
+	}
+
+	private void updateDependViewList() {
+		IMBeanTreeDependant views[] = Conn.getViews();
+
+		if(Conn.DEBUG) {
+			OutputView.print("UpdateDependViewList: views length="+views.length);
+		}
+
+		for(int i=0; i < views.length; i++) {
+			
+			Composite parent = views[i].getParent();
+			if(parent.isDisposed()) {
+				mbean_TREE.removeSelectionListener(views[i].getMBeanTreeListener());
+				Conn.removeView(views[i]);
+			} else if(!views[i].getSubscribed()){
+				mbean_TREE.addSelectionListener(views[i].getMBeanTreeListener());
+				views[i].setSubscribed(true);
+			}
+		}
+	}
+}
\ No newline at end of file

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/MBeanTreeView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Menu.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Menu.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Menu.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Menu.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,40 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+public class Menu implements IWorkbenchWindowActionDelegate {
+
+	public void dispose() {
+	}
+
+	public void init(IWorkbenchWindow window) {
+	}
+
+	public void run(IAction action) {
+	}
+
+	public void selectionChanged(IAction action, ISelection selection) {
+	}
+	
+}
\ No newline at end of file

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Menu.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/NotificationView.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/NotificationView.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/NotificationView.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/NotificationView.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,266 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.management.Notification;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.part.ViewPart;
+
+
+public class NotificationView extends ViewPart implements IMBeanTreeDependant {
+
+	public static final String ID = "org.apache.harmony.x.management.console.plugin.view.notification";
+
+	/*
+	 * The Hashtable containing notifications sent by MBeans.
+	 * key - MBean Name (String)
+	 * value - Vector of notifications 
+	 */
+	private Hashtable notifications_H = new Hashtable();
+
+	private Table notifications_TABLE = null;
+
+	private Composite notifications_COMPOSITE = null;
+
+	private Button subscribe_BUTTON = null;
+
+	private Button clear_BUTTON = null;
+
+	private Button update_BUTTON = null;
+	
+	Composite parent = null;
+	
+	private MBeanTreeNode node = null;
+	
+	private boolean subscribed;
+	
+	public void createPartControl(Composite parent) {
+
+		Conn.addView(this);
+
+		this.parent = parent;
+		/*
+		 * The Composite containing table of notifications caught and Subscribe/Unsubscribe of notifications.
+		 */
+		notifications_COMPOSITE = new Composite(parent, SWT.NONE);
+
+		notifications_TABLE = new Table(notifications_COMPOSITE, SWT.BORDER);
+
+		notifications_TABLE.setHeaderVisible(true);
+		notifications_TABLE.setLinesVisible(true);
+
+		notifications_TABLE.pack();
+
+		subscribe_BUTTON = new Button(notifications_COMPOSITE, SWT.CHECK);
+		subscribe_BUTTON.setText("Subscribe");
+		subscribe_BUTTON
+				.setToolTipText("Subscribe/Unsubscribe to notifications of current MBean");
+		final Composite fParent = parent; 
+		subscribe_BUTTON.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent event) {
+
+
+				try {
+					Button button = (Button) event.widget;
+
+					if (button.getSelection()) {
+						Conn.getNotificationHandler().subscribe(node.getName());
+						notifications_H.put(node.getName(), new Vector());
+						update_BUTTON.setEnabled(true);
+						clear_BUTTON.setEnabled(true);
+						node.setSubscribed(true);
+					} else {
+						Conn.getNotificationHandler().unsubscribe(node.getName());
+						notifications_H.put(node.getName(), new Vector());
+						update_BUTTON.setEnabled(false);
+						clear_BUTTON.setEnabled(false);
+						node.setSubscribed(false);
+					}
+				} catch (Exception exc) {
+					subscribe_BUTTON.setSelection(false);
+					Tools.fireErrorDialog(fParent, exc);
+					exc.printStackTrace();
+					return;
+				}
+			}
+		});
+
+		clear_BUTTON = new Button(notifications_COMPOSITE, SWT.PUSH);
+		update_BUTTON = new Button(notifications_COMPOSITE, SWT.PUSH);
+
+		clear_BUTTON.setEnabled(false);
+		update_BUTTON.setEnabled(false);
+
+		clear_BUTTON.setText("Clear List");
+		clear_BUTTON.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent arg0) {
+
+				notifications_TABLE.removeAll();
+				node.getNotifications().removeAllElements();
+			}
+		});
+
+		update_BUTTON.setText("Update");
+
+		update_BUTTON.addSelectionListener(new SelectionAdapter() {
+
+			public synchronized void widgetSelected(SelectionEvent arg0) {
+
+				Vector new_notifications = null;
+
+				try {
+					new_notifications = 
+						Conn.getNotificationHandler().getNotifications(node.getName());
+				} catch (Exception exc) {
+					Tools.fireErrorDialog(fParent, exc);
+					exc.printStackTrace();
+					return;
+				}
+
+				node.getNotifications().addAll(new_notifications);
+				refillNotificationTable(notifications_TABLE, node);
+			}
+		});
+
+		final TableColumn source_TCOL = new TableColumn(notifications_TABLE,
+				SWT.NONE);
+		final TableColumn message_TCOL = new TableColumn(notifications_TABLE,
+				SWT.NONE);
+		final TableColumn sequence_number_TCOL = new TableColumn(
+				notifications_TABLE, SWT.NONE);
+		final TableColumn time_stamp_TCOL = new TableColumn(
+				notifications_TABLE, SWT.NONE);
+		final TableColumn type_TCOL = new TableColumn(notifications_TABLE,
+				SWT.NONE);
+		final TableColumn user_data_TCOL = new TableColumn(notifications_TABLE,
+				SWT.NONE);
+
+		source_TCOL.setText("Source");
+		message_TCOL.setText("Message");
+		sequence_number_TCOL.setText("Sequence Number");
+		time_stamp_TCOL.setText("Time Stamp");
+		type_TCOL.setText("Type");
+		user_data_TCOL.setText("User Data");
+
+		notifications_COMPOSITE.addPaintListener(new PaintListener() {
+
+			public void paintControl(PaintEvent e) {
+				int w = notifications_COMPOSITE.getSize().x;
+				int h = notifications_COMPOSITE.getSize().y;
+
+				notifications_TABLE.setBounds(0, 0, w, h - 50);
+
+				source_TCOL.setWidth(w / 6);
+				message_TCOL.setWidth(w / 6);
+				sequence_number_TCOL.setWidth(w / 6);
+				time_stamp_TCOL.setWidth(w / 6);
+				type_TCOL.setWidth(w / 6);
+				user_data_TCOL.setWidth(w / 6);
+				subscribe_BUTTON.setBounds(w - 300, h - 40, 70, 30);
+				clear_BUTTON.setBounds(w - 150, h - 40, 70, 30);
+				update_BUTTON.setBounds(w - 75, h - 40, 70, 30);
+			}
+		});
+
+	}
+
+	public void setFocus() {
+		
+	}
+	
+	private void refillNotificationTable(Table notifications_TABLE, MBeanTreeNode node) {
+
+		boolean subscribed = node.getSubscribed();
+		subscribe_BUTTON.setSelection(subscribed);
+
+		if(!subscribed) {
+			clear_BUTTON.setEnabled(false);
+			update_BUTTON.setEnabled(false);
+			return;
+		}
+		else {
+			clear_BUTTON.setEnabled(true);
+			update_BUTTON.setEnabled(true);
+		}
+
+		notifications_TABLE.removeAll();
+
+		Vector notifications = (Vector) node.getNotifications();
+
+		if (notifications == null) {
+			return;
+		}
+
+		Iterator iter = notifications.iterator();
+
+		while (iter.hasNext()) {
+			Notification notification = (Notification) iter.next();
+			String[] fields = new String[6];
+			fields[0] = notification.getSource() + "";
+			fields[1] = notification.getMessage();
+			fields[2] = notification.getSequenceNumber() + "";
+			fields[3] = notification.getTimeStamp() + "";
+			fields[4] = notification.getType();
+			fields[5] = notification.getUserData() + "";
+
+			TableItem ti = new TableItem(notifications_TABLE, SWT.NONE);
+			ti.setText(fields);
+		}
+	}
+	
+	public void redraw(MBeanTreeNode node) {
+
+		if (node == null) {
+			return;
+		}
+		
+		refillNotificationTable(notifications_TABLE, node);
+	}
+
+	public Composite getParent() {
+		return parent;
+	}
+
+	public MBeanTreeListener getMBeanTreeListener() {
+		return new MBeanTreeListener(this);
+	}
+
+	public boolean getSubscribed() {
+		return subscribed;
+	}
+
+	public void setSubscribed(boolean val) {
+		subscribed = val;
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/NotificationView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OperationView.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OperationView.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OperationView.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OperationView.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,227 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import java.util.List;
+
+import org.apache.harmony.x.management.console.controller.OperationInfo;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.ViewPart;
+
+public class OperationView extends ViewPart implements IMBeanTreeDependant {
+	
+	public static final String ID = "org.apache.harmony.x.management.console.plugin.view.operation";
+
+	private ScrolledComposite ops_SCROLLCOMPOSITE = null;
+
+	private Composite ops_COMPOSITE = null;
+	
+	Composite parent;
+	
+	private MBeanTreeListener listener;
+	private boolean subscribed;
+
+	public OperationView () {
+		super();
+		OutputView.print("OperationView.<init>");
+		listener = new MBeanTreeListener(this);
+	}
+	
+	
+	public void createPartControl(Composite parent) {
+		/*
+		 * The Composite containing operations.
+		 */
+		Conn.addView(this);
+		this.parent = parent;
+		redraw(null);
+	}
+	
+	public void setFocus() {
+		//This section was intentionally left empty
+	}
+	
+	public void redraw(final MBeanTreeNode activeNode) {
+
+		Tools.cleanComposite(parent);
+
+		if(Conn.getMode() == Conn.NOT_CONNECTED) {
+			new Label(parent, SWT.NONE).setText(Conn.getStatus());
+			return;
+		}
+
+		List list = null;
+
+		int min_width = 0;
+		int min_height = 0;
+
+		ops_SCROLLCOMPOSITE = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+
+		ops_SCROLLCOMPOSITE.setMinSize(600, 600);
+		ops_SCROLLCOMPOSITE.setExpandHorizontal(true);
+		ops_SCROLLCOMPOSITE.setExpandVertical(true);
+
+		ops_COMPOSITE = new Composite(ops_SCROLLCOMPOSITE, SWT.NONE);
+		ops_COMPOSITE.setLayout(new GridLayout(1, false));
+
+		ops_SCROLLCOMPOSITE.setContent(ops_COMPOSITE);
+
+		if(activeNode == null || activeNode.getName() == null) {
+			new Label(ops_COMPOSITE, SWT.NONE).setText("No operations available");
+			ops_COMPOSITE.layout(true);
+			ops_SCROLLCOMPOSITE.layout(true);
+			parent.layout(true);
+			return;
+		}
+		
+		try {
+			list = Conn.getMBeanOperations().listOperations(activeNode.getName());
+		} catch (Exception e) {
+			Tools.fireErrorDialog(parent, e);
+			e.printStackTrace();
+			return;
+		}
+
+		OperationInfo ops_info[] = (OperationInfo[]) list
+				.toArray(new OperationInfo[0]);
+
+		if (ops_info.length == 0) {
+			new Label(ops_COMPOSITE, SWT.NONE)
+					.setText("No operations available.");
+		}
+
+		for (int i = 0; i < ops_info.length; i++) {
+
+			if (i != 0) {
+				Label separator_LABEL = new Label(ops_COMPOSITE, SWT.SEPARATOR
+						| SWT.HORIZONTAL);
+				separator_LABEL.setSize(320, 10);
+			}
+
+			Composite op_row_COMPOSITE = new Composite(ops_COMPOSITE, SWT.NONE);
+			op_row_COMPOSITE.setLayout(new GridLayout(3, false));
+
+			Label return_type_method_LABEL = new Label(op_row_COMPOSITE,
+					SWT.NONE);
+			return_type_method_LABEL.setText(ops_info[i].getReturnType() + " "
+					+ ops_info[i].getName() + "(");
+			return_type_method_LABEL
+					.setToolTipText("The name and the return value of operation");
+
+			final String[] signature = ops_info[i].getSign();
+
+			if (signature.length != 0) {
+				new Label(op_row_COMPOSITE, SWT.NONE);
+				new Label(op_row_COMPOSITE, SWT.NONE);
+			}
+			final Text vals_TEXT[] = new Text[signature.length];
+
+			for (int j = 0; j < signature.length; j++) {
+
+				Label type_LABEL = new Label(op_row_COMPOSITE, SWT.NONE);
+				type_LABEL.setText("    " + signature[j] + ":");
+				vals_TEXT[j] = new Text(op_row_COMPOSITE, SWT.BORDER);
+				vals_TEXT[j].setToolTipText("Edit the parameter");
+
+				if (j != (signature.length - 1)) {
+					new Label(op_row_COMPOSITE, SWT.NONE).setText(", ");
+				}
+			}
+
+			Label parenthesis_r_LABEL = new Label(op_row_COMPOSITE, SWT.NONE);
+			parenthesis_r_LABEL.setAlignment(SWT.CENTER);
+			parenthesis_r_LABEL.setText(")");
+
+			Button invoke_operation_BUTTON = new Button(op_row_COMPOSITE,
+					SWT.NONE);
+			invoke_operation_BUTTON.setText("Invoke");
+			invoke_operation_BUTTON
+					.setToolTipText("Invokes the named operation");
+
+			op_row_COMPOSITE.pack();
+
+			int w = op_row_COMPOSITE.getSize().x;
+			int h = op_row_COMPOSITE.getSize().y;
+
+			min_width = (w > min_width) ? w : min_width;
+			min_height += h;
+
+			ops_SCROLLCOMPOSITE.setMinSize(min_width, min_height);
+
+			final String operation = ops_info[i].getName();
+			invoke_operation_BUTTON
+					.addSelectionListener(new SelectionAdapter() {
+						public void widgetSelected(SelectionEvent e) {
+							String[] vals = new String[signature.length];
+
+							for (int j = 0; j < signature.length; j++) {
+								vals[j] = vals_TEXT[j].getText();
+							}
+
+							Object result = null;
+
+							try {
+								OutputView.print("<< Invoking operation >>");
+								OutputView.print("MBean="
+										+ activeNode.getName() + ", op="
+										+ operation + ", vals=" + vals
+										+ ", signature=" + signature);
+								result = Conn.getMBeanOperations().execute(
+										activeNode.getName(), operation,
+										vals, signature);
+							} catch (Exception exc) {
+								Tools.fireErrorDialog(parent, exc);
+								OutputView.print(exc);
+								return;
+							}
+
+							new ResultDialog(parent, activeNode.getName(), operation, vals, result);
+						}
+					});
+		}
+	
+
+	parent.layout(true);
+}	
+
+	public Composite getParent() {
+		return parent;
+	}
+
+	public MBeanTreeListener getMBeanTreeListener() {
+		return listener;
+	}
+
+
+	public boolean getSubscribed() {
+		return subscribed;
+	}
+
+	public void setSubscribed(boolean val) {
+		subscribed = val;
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OperationView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OutputView.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OutputView.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OutputView.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OutputView.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,105 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.Vector;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * This view is designed to hold debug information that is printed by the console.
+ * 
+ * @author Victor A. Martynov
+ */
+public class OutputView extends ViewPart {
+
+	public static final String ID = "org.apache.harmony.x.management.console.plugin.view.output";
+	public static final String MESSAGE_CONSOLE_NAME = "Message Console";
+	
+	private static Text text = null;
+	private static Composite parent = null; 
+
+	private static ByteArrayOutputStream baos = new ByteArrayOutputStream();
+	private static PrintStream ps = new PrintStream(baos);
+	private static Vector messages = new Vector();
+	
+
+	public OutputView() {
+		super();
+	}
+
+	public void createPartControl(Composite parent) {
+			OutputView.parent = parent;
+			parent.setLayout(new FillLayout());
+			text = new Text(parent, SWT.MULTI | SWT.WRAP);
+			String s = "";
+
+			for(int i = 0; i < messages.size(); i++) {
+				s += messages.get(i);
+			}
+			
+			text.setText(s);
+	}
+
+	public void setFocus() {
+		
+	}
+
+	/**
+	 * This method stores the given string in an internal storage and
+	 * shows it in OutputView.
+	 * @param s The string that will be printed in output view.
+	 */
+	public static void print(String s) {
+		
+		messages.add(s+"\n");
+		
+		if(parent != null     && 
+		   text != null       && 
+		   !text.isDisposed() &&
+		   !parent.isDisposed()) {
+			
+			text.append(s+"\n");
+			parent.layout(true);
+		}
+	}
+
+	/**
+	 * This method stores stack trace of the given exception in an internal storage and
+	 * shows it in OutputView.
+	 * @param t The throwable/exception that will be printed in output view.
+	 */
+	public static void print(Throwable t) {
+		t.printStackTrace(ps);
+		String s = baos.toString()+"\n";
+		messages.add(s);
+
+		if(text != null && !text.isDisposed()) {
+			text.append(s);
+		}
+
+		baos.reset();
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/OutputView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Perspective.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Perspective.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Perspective.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Perspective.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,49 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+public class Perspective implements IPerspectiveFactory {
+
+	public static final String ID = "org.apache.harmony.x.management.console.plugin.perspective";
+	
+	public void createInitialLayout(IPageLayout layout) {
+
+		String editorArea = layout.getEditorArea();
+
+		layout.setEditorAreaVisible(false);
+//		layout.setFixed(true);
+
+		layout.addNewWizardShortcut("org.apache.harmony.x.management.console.plugin.wizard.new");
+		
+		IFolderLayout treeFolder = layout.createFolder("tree", IPageLayout.LEFT, 0.25f, editorArea);
+		treeFolder.addView(MBeanTreeView.ID);
+		
+		layout.addView(AttributeView.ID, IPageLayout.TOP, 0.5f, editorArea);
+
+		layout.addView(OperationView.ID, IPageLayout.TOP, 0.5f, editorArea);
+
+		IFolderLayout outputfolder= layout.createFolder("bottom", IPageLayout.BOTTOM, 0.25f, editorArea);
+		outputfolder.addView(NotificationView.ID);
+		outputfolder.addView(OutputView.ID);
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Perspective.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/ResultDialog.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/ResultDialog.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/ResultDialog.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/ResultDialog.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,99 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+
+class ResultDialog {
+
+	private Shell result_SHELL = null;
+
+	private Button res_ok_BUTTON = null;
+	private Label  invoke_LABEL = null;
+	private Label result_LABEL = null;
+	private Composite result_COMPOSITE = null;
+
+	/**
+	 * This method initializes result_SHELL.
+	 * 
+	 * @param parent - the parent Shell of this ResultDialog
+	 * @param mbean   the name of the MBean which operation was invoked.
+	 * @param op - the name of the operation inoked.
+	 * @param params - the array of the values of the parameters of the operation.
+ 	 * @param result - the object returned from the invocation of the operation.
+	 */
+	ResultDialog(Composite parent, String mbean, String op, String[] params, Object result) {
+		result_SHELL = new Shell(parent.getShell(), SWT.APPLICATION_MODAL | SWT.CLOSE | SWT.RESIZE);
+		result_SHELL.setText("Result: ");
+		result_SHELL.setMinimumSize(500, 100);
+		result_SHELL.setLayout(new FillLayout());
+		result_SHELL.setImage(parent.getDisplay().getSystemImage(SWT.ICON_INFORMATION));
+		
+		result_COMPOSITE = new Composite(result_SHELL, SWT.NONE);
+		
+		String s = "["+mbean+"]."+op+"(";
+		for(int i = 0; i < params.length; i++) {
+			if(i != 0) {
+				s = s+", ";
+			}
+			s = s+params[i];
+		}
+		
+		s = s+");";
+
+		invoke_LABEL = new Label(result_COMPOSITE, SWT.NONE);
+		invoke_LABEL.setText("Method: "+s);
+		
+		result_LABEL = new Label(result_COMPOSITE, SWT.NONE);
+		result_LABEL.setText("Result: "+ result);
+
+		res_ok_BUTTON = new Button(result_COMPOSITE, SWT.NONE);
+		res_ok_BUTTON.setText("OK");
+
+		res_ok_BUTTON.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent event) {
+				result_SHELL.close();
+				result_SHELL.dispose();
+			}
+		});
+
+		result_COMPOSITE.addPaintListener(new PaintListener() {
+
+			public void paintControl(PaintEvent e) {
+				int w = result_COMPOSITE.getSize().x;
+				int h = result_COMPOSITE.getSize().y;
+				invoke_LABEL.setBounds(0, 0, w, h/3);
+				result_LABEL.setBounds(0, h/3, w, h/3);
+				res_ok_BUTTON.setBounds(w/2-50, h/3 > 24 ? h-24 : h*2/3 + 2, 100, (h/3-4) > 20? 20:(h/3-4)); 
+			}
+		});
+
+		result_SHELL.pack();
+		result_SHELL.open();
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/ResultDialog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Tools.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Tools.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Tools.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Tools.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,48 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class Tools {
+	
+	public static void cleanComposite(Composite composite) {
+
+		if(composite == null) return;
+
+		Control[] controls = composite.getChildren();
+		for (int i = 0; i < controls.length; i++) {
+			controls[i].dispose();
+		}
+	}
+	
+	public static void fireErrorDialog(Composite parent, Throwable exception) {
+		if(parent != null && !parent.isDisposed()) {
+			Shell shell = new Shell(parent.getDisplay());
+			new ErrorDialog(shell, exception);
+		}
+	}
+
+	public static void fireErrorDialog(Shell shell, Throwable exception) {
+		if(shell != null && !shell.isDisposed()) {
+			new ErrorDialog(shell, exception);
+		}
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/Tools.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/VMView.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/VMView.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/VMView.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/VMView.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,195 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+
+package org.apache.harmony.x.management.console.plugin;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.swt.widgets.Label;
+
+public class VMView extends ViewPart {
+
+	public static final String ID = "org.apache.harmony.x.management.console.plugin.view.vm";
+	
+	private Composite VMView_COMPOSITE = null;
+
+	private Composite classLoadingMXBean_COMPOSITE = null;
+
+	private Composite compilationMXBean_COMPOSITE = null;
+
+	private Composite garbageCollectorMXBean_COMPOSITE = null;
+
+	private Composite memoryManagerMXBean_COMPOSITE = null;
+
+	private Composite memoryMXBean_COMPOSITE = null;
+
+	private Composite memoryPoolMXBean_COMPOSITE = null;
+
+	private Composite operatingSystemMXBean_COMPOSITE = null;
+
+	private Composite runtimeMXBean_COMPOSITE = null;
+
+	private Composite threadMXBean_COMPOSITE = null;
+	
+	public void createPartControl(Composite parent) {
+		try {
+			VMView_COMPOSITE = new Composite(parent, SWT.NONE);
+			VMView_COMPOSITE.setLayout(new FillLayout());
+
+			TabFolder VMView_TABFOLDER = new TabFolder(VMView_COMPOSITE,
+					SWT.NONE);
+
+			TabItem classLoadingMXBean_TABITEM = new TabItem(VMView_TABFOLDER,
+					SWT.NONE);
+			TabItem compilationMXBean_TABITEM = new TabItem(VMView_TABFOLDER,
+					SWT.NONE);
+			TabItem garbageCollectorMXBean_TABITEM = new TabItem(
+					VMView_TABFOLDER, SWT.NONE);
+			TabItem memoryManagerMXBean_TABITEM = new TabItem(VMView_TABFOLDER,
+					SWT.NONE);
+			TabItem memoryMXBean_TABITEM = new TabItem(VMView_TABFOLDER,
+					SWT.NONE);
+			TabItem memoryPoolMXBean_TABITEM = new TabItem(VMView_TABFOLDER,
+					SWT.NONE);
+			TabItem operatingSystemMXBean_TABITEM = new TabItem(
+					VMView_TABFOLDER, SWT.NONE);
+			TabItem runtimeMXBean_TABITEM = new TabItem(VMView_TABFOLDER,
+					SWT.NONE);
+			TabItem threadMXBean_TABITEM = new TabItem(VMView_TABFOLDER,
+					SWT.NONE);
+
+			classLoadingMXBean_TABITEM.setText("Class Loading");
+			compilationMXBean_TABITEM.setText("Compilation");
+			garbageCollectorMXBean_TABITEM.setText("Garbage Collector");
+			memoryManagerMXBean_TABITEM.setText("Memory Manager");
+			memoryMXBean_TABITEM.setText("Memory");
+			memoryPoolMXBean_TABITEM.setText("Memory Pool");
+			operatingSystemMXBean_TABITEM.setText("Operating System");
+			runtimeMXBean_TABITEM.setText("Runtime");
+			threadMXBean_TABITEM.setText("Threads");
+
+			classLoadingMXBean_TABITEM.setToolTipText("Class Loading");
+			compilationMXBean_TABITEM.setToolTipText("Compilation");
+			garbageCollectorMXBean_TABITEM.setToolTipText("Garbage Collector");
+			memoryManagerMXBean_TABITEM.setToolTipText("Memory Manager");
+			memoryMXBean_TABITEM.setToolTipText("Memory");
+			memoryPoolMXBean_TABITEM.setToolTipText("Memory Pool");
+			operatingSystemMXBean_TABITEM.setToolTipText("Operating System");
+			runtimeMXBean_TABITEM.setToolTipText("Runtime");
+			threadMXBean_TABITEM.setToolTipText("Threads");
+
+			classLoadingMXBean_COMPOSITE = new Composite(VMView_TABFOLDER,
+					SWT.NONE);
+			compilationMXBean_COMPOSITE = new Composite(VMView_TABFOLDER,
+					SWT.NONE);
+			garbageCollectorMXBean_COMPOSITE = new Composite(VMView_TABFOLDER,
+					SWT.NONE);
+			memoryManagerMXBean_COMPOSITE = new Composite(VMView_TABFOLDER,
+					SWT.NONE);
+			memoryMXBean_COMPOSITE = new Composite(VMView_TABFOLDER, SWT.NONE);
+			memoryPoolMXBean_COMPOSITE = new Composite(VMView_TABFOLDER,
+					SWT.NONE);
+			operatingSystemMXBean_COMPOSITE = new Composite(VMView_TABFOLDER,
+					SWT.NONE);
+			runtimeMXBean_COMPOSITE = new Composite(VMView_TABFOLDER, SWT.NONE);
+			threadMXBean_COMPOSITE = new Composite(VMView_TABFOLDER, SWT.NONE);
+
+			classLoadingMXBean_TABITEM.setControl(classLoadingMXBean_COMPOSITE);
+			compilationMXBean_TABITEM.setControl(compilationMXBean_COMPOSITE);
+			garbageCollectorMXBean_TABITEM
+					.setControl(garbageCollectorMXBean_COMPOSITE);
+			memoryManagerMXBean_TABITEM
+					.setControl(memoryManagerMXBean_COMPOSITE);
+			memoryMXBean_TABITEM.setControl(memoryMXBean_COMPOSITE);
+			memoryPoolMXBean_TABITEM.setControl(memoryPoolMXBean_COMPOSITE);
+			operatingSystemMXBean_TABITEM
+					.setControl(operatingSystemMXBean_COMPOSITE);
+			runtimeMXBean_TABITEM.setControl(runtimeMXBean_COMPOSITE);
+			threadMXBean_TABITEM.setControl(threadMXBean_COMPOSITE);
+
+			createVMView();
+
+			//timer.schedule(new VMViewRefresher(), 0L, REFRESH_RATE);	TODO	
+		} catch (Exception exc) {
+			exc.printStackTrace();
+			parent.setLayout(new FillLayout());
+			new Label(parent, SWT.NONE).setText("No VM view available.");
+		}		
+
+	}
+
+	public void setFocus() {
+
+	}
+	
+	/* ************************************************************************
+	 * Private methods.
+	 *************************************************************************/
+	private void createVMView() {
+
+		operatingSystemMXBean_COMPOSITE.setLayout(new GridLayout(1, false));
+		classLoadingMXBean_COMPOSITE.setLayout(new GridLayout(1, false));
+
+		Hashtable hashtable = null;
+		Enumeration keys = null;
+		/* Filling Operating System Info composite */
+
+		try {
+			hashtable = Conn.getVMMonitor().getOSInfo();
+		} catch (Exception e) {
+//			fireErrorDialog(main_SHELL, e); TODO
+			e.printStackTrace();
+			return;
+		}
+
+		keys = hashtable.keys();
+
+		while (keys.hasMoreElements()) {
+			Object o = keys.nextElement();
+			Label label = new Label(operatingSystemMXBean_COMPOSITE, SWT.NONE);
+			label.setText(o + ": " + hashtable.get(o));
+		}
+
+		/* Filling Class Loading composite */
+
+		try {
+			hashtable = Conn.getVMMonitor().getClassLoadingInfo();
+		} catch (Exception e) {
+//			fireErrorDialog(main_SHELL, e); TODO
+			e.printStackTrace();
+			return;
+		}
+
+		keys = hashtable.keys();
+
+		while (keys.hasMoreElements()) {
+			Object o = keys.nextElement();
+			Label label = new Label(classLoadingMXBean_COMPOSITE, SWT.NONE);
+			label.setText(o + ": " + hashtable.get(o));
+		}
+	}
+
+
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/VMView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/AbstractEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/AbstractEditor.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/AbstractEditor.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/AbstractEditor.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,187 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.plugin.editor;
+
+import org.apache.harmony.x.management.console.plugin.Conn;
+import org.apache.harmony.x.management.console.plugin.Tools;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Represents single attribute editor.
+ * Each attribute editor consists of 2 parts: the left  and the right part. 
+ * Left part holds name/type of attribute and optionally expand/collapse button.
+ * Right part contains the representation of this attribute according to its type.
+ * It means that in the case of text based attributes (i.e. String, ObjectName)
+ * the right part of editor will contain text box and optionally Submit button.
+ * On the other hand if the attribute is of array type or TabularData the right 
+ * part of editor will contain the table. 
+ * 
+ * @author Victor A. Martynov
+ */
+public abstract class AbstractEditor extends Composite {
+	
+	protected static final int NAME_WIDTH_PERCENTAGE = 30;
+	
+	protected String mbean_name;
+	protected String attribute_name;
+	protected String type;
+	protected Composite parent;
+	boolean collapsed;
+	protected boolean isEditable;
+	
+	protected int rightPartWidth; 
+	protected int leftPartWidth; 
+	private Button expandCollapseButton;
+
+	protected Composite row;
+	
+	/**
+	 * Each editor should have the main element which obtains focus when the 
+	 * attribute is edited. If the focus was given to main UI element of the 
+	 * editor, the refresh should stop to allow editing. Each editor 
+	 * implements this method in its own way.
+	 * 
+	 * @return true if the main element of editor got focus, false otherwise.
+	 */
+	public abstract boolean isFocused(); 
+	
+	/**
+	 * Each editor implementation should convert its contents into a String and return
+	 * it here. 
+	 * 
+	 * @return The value of the attribute as a String.
+	 */
+	public abstract String getValue();
+
+	/**
+	 * This method sets the value of this editor to the given value. It is a 
+	 * responsibility of the editor implementations to convert 
+	 * <code>value</code> into something suitable for this type of editor.
+	 * 
+	 * @param value The value of attribute.
+	 */
+	public abstract void setValue(Object value);
+	
+	/**
+	 * Brief view has the height of 25 pixels. 
+	 */
+	public abstract void brief();
+	
+	/**
+	 * Full view has the height returned by <code>getFullHeight</code> method. 
+	 */
+	public abstract void full();
+
+	protected AbstractEditor(final Composite parent, 
+			                 final String mbean_name, 
+			                 final String attribute_name, 
+			                 final String type, 
+			                 boolean isEditable) {
+		super(parent, SWT.NONE);
+		
+		this.mbean_name = mbean_name;
+		this.attribute_name = attribute_name;
+		this.type = type;
+		this.parent = parent;
+		this.isEditable = isEditable;
+		collapsed = true;
+		rightPartWidth = parent.getSize().x*(100-NAME_WIDTH_PERCENTAGE)/100 - 25; 
+		leftPartWidth = parent.getSize().x*NAME_WIDTH_PERCENTAGE/100;
+
+		rightPartWidth = (rightPartWidth <= 0) ? 600 : rightPartWidth;
+		leftPartWidth = (leftPartWidth <= 0) ? 300 : leftPartWidth;
+		
+		setAttributeNameAndType();
+		setSize(leftPartWidth+rightPartWidth, 25);
+	}
+
+	
+	protected void showExpandCollapseButton(boolean visible) {
+		expandCollapseButton.setVisible(visible);
+	}
+	
+	
+	protected void commit() {
+		try {
+			Conn.getMBeanOperations().setAttribute(mbean_name, attribute_name, getValue(), type);
+		} catch (Exception e) {
+			Tools.fireErrorDialog(getParent(), e);
+		}
+	}
+	
+	/* ************************************************************************
+	 * Private Methods
+	 *************************************************************************/
+	
+	/**
+	 * 
+	 */
+	private void setAttributeNameAndType() {
+
+		int dotPosition = type.lastIndexOf("."); //Last Dot position 
+		String short_attr_type = (dotPosition == -1) 
+		                         ? type 
+		                         : type.substring(dotPosition + 1);
+		
+		Label name_type_LABEL = new Label(this, SWT.NONE);
+		name_type_LABEL.setText(attribute_name + "[" + short_attr_type+ "]: ");
+		name_type_LABEL.setToolTipText(attribute_name + "[" + type+ "]");
+		name_type_LABEL.setBounds(0,0, leftPartWidth-25, 25);
+
+		expandCollapseButton = new Button(this, SWT.NONE);
+		expandCollapseButton.setVisible(false);
+		
+		expandCollapseButton.setText("+");
+		expandCollapseButton.setToolTipText("Expand");
+		
+		expandCollapseButton.setBounds(leftPartWidth-25+5, 5, 15, 15);
+		expandCollapseButton.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent e) {
+
+				if(collapsed) {
+					expandCollapseButton.setText("-");
+					expandCollapseButton.setToolTipText("Collapse");
+					full();
+					collapsed = false;
+				} else {
+					expandCollapseButton.setText("+");
+					expandCollapseButton.setToolTipText("Expand");
+					brief();
+					collapsed = true;
+				}
+				
+				layout(true);
+
+				Composite attributeTable = getParent();
+				attributeTable.layout(true);
+				Point preferredSize = attributeTable.computeSize(getParent().getSize().x, SWT.DEFAULT);
+				ScrolledComposite sc = (ScrolledComposite)getParent().getParent();
+				sc.setMinSize(preferredSize);
+				sc.layout(true);
+			}
+		});
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/AbstractEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/ArrayEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/ArrayEditor.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/ArrayEditor.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/ArrayEditor.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,141 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.plugin.editor;
+
+import java.util.Vector;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+public class ArrayEditor extends AbstractEditor {
+
+	private static final int BUTTON_WIDTH=70;
+
+	Table table;
+	TableColumn column;
+	Button button;
+	Text text;
+	
+	public ArrayEditor(Composite parent, String mbean_name,
+			String attribute_name, String type, boolean isEditable) {
+		super(parent, mbean_name, attribute_name, type, isEditable);
+
+		int tableWidth = rightPartWidth - (isEditable ? BUTTON_WIDTH : 0);  
+
+		table = new Table(this, SWT.MULTI);
+		table.setLinesVisible(true);
+		table.setHeaderVisible(true);
+		column = new TableColumn(table, SWT.LEFT);
+		column.setWidth(tableWidth-25);
+
+		if(isEditable) {
+			button = new Button(this, SWT.NONE);
+			button.setText("Set");
+			button.setToolTipText("Set attribute value in the MBean");
+			button.setBounds(leftPartWidth+tableWidth, 0, BUTTON_WIDTH, 25);
+			button.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent e) {
+				ArrayEditor.this.commit();
+			}
+			});
+		} 
+		
+		showExpandCollapseButton(true);
+		brief();
+	}
+
+	public void setValue(Object value) {
+		Object []array = convertArray(value).toArray();
+		table.removeAll();
+		column.setText(convertType(type)+"["+array.length+"]");
+		for(int i = 0; i < array.length; i++) {
+			TableItem tableItem = new TableItem(table, SWT.NONE);
+			tableItem.setText(0, array[i]+"");
+		} 
+	}
+
+	public void brief() {
+		int tableWidth = rightPartWidth - (isEditable ? BUTTON_WIDTH : 0);  
+		table.setBounds(leftPartWidth, 0, tableWidth, 25);
+	}
+
+	public void full() {
+		int tableWidth = rightPartWidth - (isEditable ? BUTTON_WIDTH : 0);  
+		Point preferredSize = table.computeSize(tableWidth, SWT.DEFAULT);
+		table.setBounds(leftPartWidth, 0, tableWidth, preferredSize.y);
+	}
+
+	public boolean isFocused() {
+		return table.isFocusControl();
+	}
+
+	public String getValue() {
+		return null;
+	}
+	
+	private Vector convertArray(Object o) {
+		
+		Vector v = new Vector();
+		
+		if(o instanceof Object[]) {
+			Object oo[] = (Object[]) o;
+			for(int i = 0; i < oo.length; i++) {
+				v.add(oo[i]);
+			}
+		} else if(o instanceof long[]) {
+			long ol[] = (long[]) o;
+			for(int i = 0; i < ol.length; i++) {
+				v.add(new Long(ol[i]));
+			}
+		}
+		return v;
+	}
+
+	private String convertType(String type) {
+		if(       type.equals("[B")) {
+			return "byte";
+		} else if(type.equals("[C")) {
+			return "char";
+		} else if(type.equals("[D")) {
+			return "double";
+		} else if(type.equals("[F")) {
+			return "float";
+		} else if(type.equals("[I")) {
+			return "int";
+		} else if(type.equals("[J")) {
+			return "long";
+		} else if(type.equals("[S")) {
+			return "short";
+		} else if(type.equals("[Z")) {
+			return "boolean";
+		} else if(type.startsWith("[L")) {
+			return type.substring(2, type.length()-1);
+		} else {			
+			return type;
+		}
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/ArrayEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/BooleanEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/BooleanEditor.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/BooleanEditor.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/BooleanEditor.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,81 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.plugin.editor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+public class BooleanEditor extends AbstractEditor {
+
+	Button button;
+	
+	public BooleanEditor(Composite parent, 
+                   String mbean_name, 
+                   String attribute_name, 
+                   String type, 
+                   boolean isEditable) {
+		
+		super(parent, mbean_name, attribute_name, type, isEditable);
+
+		button = new Button(this, SWT.CHECK);
+		button.setBounds(leftPartWidth, 0, rightPartWidth, 25);
+		
+		if(isEditable) {
+			button.setEnabled(true);
+			button.addSelectionListener(new SelectionAdapter() {
+
+				public void widgetSelected(SelectionEvent e) {
+					BooleanEditor.this.commit();
+				}
+			});
+		} else {
+			button.setEnabled(false);
+		}
+		
+		button.setToolTipText("Set the value");
+
+		brief();
+	}
+	
+	public void setValue(Object value) {
+		String s = value+"";
+		button.setSelection(new Boolean(s).booleanValue());
+	}
+	
+	public String getValue() {
+		return button.getSelection()+"";
+	}
+
+	public void brief() {
+	}
+
+	public void full() {
+	}
+	
+	public void addMouseListener(MouseListener listener) {
+		button.addMouseListener(listener);
+	}
+
+	public boolean isFocused() {
+		return button.isFocusControl();
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/BooleanEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/CommonEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/CommonEditor.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/CommonEditor.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/CommonEditor.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,95 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.plugin.editor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+public class CommonEditor extends AbstractEditor {
+
+	Text text;
+	Button setButton;
+	private final int BUTTON_WIDTH = 70; 
+	
+	
+	public CommonEditor(Composite parent, 
+			            String mbean_name, 
+			            String attribute_name,
+			            String type,
+			            boolean isEditable) {
+		super(parent, mbean_name, attribute_name, type, isEditable);
+
+		text = new Text(this, SWT.BORDER | SWT.WRAP | SWT.MULTI);
+
+		int textWidth = rightPartWidth - (isEditable ? BUTTON_WIDTH : 0); 
+		
+		text.setBounds(leftPartWidth, 0, textWidth, 25);
+		text.setEditable(isEditable);
+
+		if(isEditable) {
+			setButton = new Button(this, SWT.NONE);
+			setButton.setText("Set");
+			setButton.setToolTipText("Set attribute value in the MBean");
+			setButton.setBounds(leftPartWidth+textWidth, 0, BUTTON_WIDTH, 25);
+			setButton.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent e) {
+				CommonEditor.this.commit();
+			}
+			});
+		} else {
+			text.setEditable(false);
+		}
+		
+		showExpandCollapseButton(true);
+		brief();
+	}
+
+	public void setValue(Object value) {
+		text.setText(value+"");
+	}
+	
+	public String getValue() {
+		return text.getText();
+	}
+
+	public void brief() {
+		text.setSize(text.getSize().x, 25);
+	}
+
+	public void full() {
+		int textWidth = text.getSize().x;
+		
+		Point preferredSize = text.computeSize(textWidth, SWT.DEFAULT);
+		
+		int setTextHeight = (preferredSize.y > text.getSize().y) 
+		                    ? preferredSize.y 
+		                    : text.getSize().y;
+		
+		text.setBounds(leftPartWidth, 0, textWidth, setTextHeight);
+	}
+
+	public boolean isFocused() {
+		return text.isFocusControl();
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/CommonEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/EditorFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/EditorFactory.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/EditorFactory.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/EditorFactory.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,47 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.4 $
+ */
+package org.apache.harmony.x.management.console.plugin.editor;
+
+import org.eclipse.swt.widgets.Composite;
+
+public class EditorFactory {
+
+	public static AbstractEditor create(Composite parent, 
+                                        String mbean_name, 
+                                        String attribute_name, 
+                                        String type, 
+                                        boolean isEditable) { 
+		
+		if(type.equals("boolean")) {
+			return new BooleanEditor(parent, mbean_name, attribute_name, type, isEditable);
+		} else if(type.equals("byte") 
+			   || type.equals("short") 
+			   || type.equals("int")
+			   || type.equals("long")
+			   || type.equals("float")
+			   || type.equals("double")) {
+			return new NumericEditor(parent, mbean_name, attribute_name, type, isEditable);
+		} if(type.indexOf("[") != -1) { // Array
+			return new ArrayEditor(parent, mbean_name, attribute_name, type, isEditable);
+		}else {
+			return new CommonEditor(parent, mbean_name, attribute_name, type, isEditable);
+		}
+		
+	}
+
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/EditorFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/NumericEditor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/NumericEditor.java?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/NumericEditor.java (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/NumericEditor.java Wed Aug 30 08:02:59 2006
@@ -0,0 +1,80 @@
+/* Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+ *  
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+/**
+ * @author Victor A. Martynov
+ * @version $Revision: 1.3 $
+ */
+package org.apache.harmony.x.management.console.plugin.editor;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+public class NumericEditor extends AbstractEditor {
+
+	Text text;
+	Button setButton;
+	private final int BUTTON_WIDTH = 70; 
+
+	public NumericEditor(Composite parent, String mbean_name,
+			String attribute_name, String type, boolean isEditable) {
+		super(parent, mbean_name, attribute_name, type, isEditable);
+		
+		text = new Text(this, SWT.BORDER);
+
+		int textWidth = rightPartWidth - (isEditable ? BUTTON_WIDTH : 0); 
+		
+		text.setBounds(leftPartWidth, 0, textWidth, 25);
+		text.setEditable(isEditable);
+		
+		if(isEditable) {
+			setButton = new Button(this, SWT.NONE);
+			setButton.setText("Set");
+			setButton.setToolTipText("Set attribute value in the MBean");
+			setButton.setBounds(leftPartWidth+textWidth, 0, BUTTON_WIDTH, 25);
+			setButton.addSelectionListener(new SelectionAdapter() {
+
+			public void widgetSelected(SelectionEvent e) {
+				NumericEditor.this.commit();
+			}
+			});
+		} else {
+			text.setEditable(false);
+		}
+		
+		showExpandCollapseButton(false);
+		brief();
+	}
+
+	public void brief() {
+	}
+
+	public void full() {
+	}
+
+	public boolean isFocused() {
+		return text.isFocusControl();
+	}
+
+	public String getValue() {
+		return text.getText();
+	}
+	
+	public void setValue(Object value) {
+		text.setText(value+"");
+	}
+}

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/editor/NumericEditor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/resources/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/resources/MANIFEST.MF?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/resources/MANIFEST.MF (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/resources/MANIFEST.MF Wed Aug 30 08:02:59 2006
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JMXConsole Plug-in
+Bundle-SymbolicName: JMXConsole; singleton:=true
+Bundle-Version: 3.1.1
+Bundle-Activator: org.apache.harmony.x.management.console.plugin.JMXConsolePlugin
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime
+Eclipse-AutoStart: true
+Bundle-Vendor: Intel Corp.

Added: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/resources/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/resources/plugin.xml?rev=438510&view=auto
==============================================================================
--- incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/resources/plugin.xml (added)
+++ incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/resources/plugin.xml Wed Aug 30 08:02:59 2006
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2005-2006 The Apache Software Foundation or its licensors, as applicable.
+  
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<!--
+Author: Victor A. Martynov
+Version: $Revision: 1.2 $
+-->
+
+<?eclipse version="3.0"?>
+<plugin>
+
+   <extension
+         id="org.apache.harmony.x.management.console.plugin.application"
+         name="JMX Console Application"
+         point="org.eclipse.core.runtime.applications">
+      <application>
+         <run
+               class="org.apache.harmony.x.management.console.plugin.Application">
+         </run>
+      </application>
+   </extension>
+   <extension
+         point="org.eclipse.ui.perspectives">
+      <perspective
+            class="org.apache.harmony.x.management.console.plugin.Perspective"
+            icon="icons/7_16x16.PNG"
+            id="org.apache.harmony.x.management.console.plugin.perspective"
+            name="JMX Perspective">
+      </perspective>
+   </extension>
+   <extension
+         point="org.eclipse.ui.views">
+      <view
+            allowMultiple="false"
+            category="org.apache.harmony.x.management.console.plugin.view.category"
+            class="org.apache.harmony.x.management.console.plugin.MBeanTreeView"
+            icon="icons/9_16x16.PNG"
+            id="org.apache.harmony.x.management.console.plugin.view.mbeantree"
+            name="MBean Tree View">
+      </view>
+      <view
+            allowMultiple="false"
+            category="org.apache.harmony.x.management.console.plugin.view.category"
+            class="org.apache.harmony.x.management.console.plugin.AttributeView"
+            icon="icons/4_16x16.PNG"
+            id="org.apache.harmony.x.management.console.plugin.view.attribute"
+            name="MBean Attribute View">
+      </view>
+      <category
+            id="org.apache.harmony.x.management.console.plugin.view.category"
+            name="JMX Console"/>
+      <view
+            category="org.apache.harmony.x.management.console.plugin.view.category"
+            class="org.apache.harmony.x.management.console.plugin.VMView"
+            id="org.apache.harmony.x.management.console.view.vm"
+            name="JVM View"/>
+      <view
+            allowMultiple="false"
+            category="org.apache.harmony.x.management.console.plugin.view.category"
+            class="org.apache.harmony.x.management.console.plugin.OperationView"
+            icon="icons/5_16x16.PNG"
+            id="org.apache.harmony.x.management.console.plugin.view.operation"
+            name="MBean Operations View"/>
+      <view
+            allowMultiple="false"
+            category="org.apache.harmony.x.management.console.plugin.view.category"
+            class="org.apache.harmony.x.management.console.plugin.NotificationView"
+            icon="icons/6_16x16.PNG"
+            id="org.apache.harmony.x.management.console.plugin.view.notification"
+            name="MBean Notification Table"/>
+      <view
+            allowMultiple="false"
+            category="org.apache.harmony.x.management.console.plugin.view.category"
+            class="org.apache.harmony.x.management.console.plugin.IndicatorView"
+            id="org.apache.harmony.x.management.console.view.indicator"
+            name="Connection Indicator"/>
+      <view
+            category="org.apache.harmony.x.management.console.plugin.view.category"
+            class="org.apache.harmony.x.management.console.plugin.OutputView"
+            id="org.apache.harmony.x.management.console.plugin.view.output"
+            name="Output"/>
+   </extension>
+
+ <extension point="org.eclipse.ui.newWizards"> 
+      <category 
+        id="org.apache.harmony.x.management.console.plugin.wizard.category" 
+        name="JMX Console"> 
+      </category> 
+      <wizard
+            category="org.apache.harmony.x.management.console.plugin.wizard.category"
+            class="org.apache.harmony.x.management.console.plugin.ConnectWizard"
+            descriptionImage="icons/8_320x213.PNG"
+            icon="icons/1_16x16.PNG"
+            id="org.apache.harmony.x.management.console.wizard.new"
+            name="JMX Connection Wizard"> 
+          <description> 
+              Create a JMX Connection and set initial content 
+          </description> 
+           <selection
+                 class="org.eclipse.core.resources.IResource"
+                 name="JMX Connection Wizard"/>          
+      </wizard> 
+   </extension>
+</plugin>

Propchange: incubator/harmony/enhanced/tools/trunk/jmx_console/src/org/apache/harmony/x/management/console/plugin/resources/plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message