[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[tm-cvs-commit] dmcknight org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor MonitorViewWorkbook.java MonitorViewPage.java SystemMonitorViewPart.java
|
- From: Eclipse CVS Genie <genie@xxxxxxxxxxx>
- Date: Thu, 08 Mar 2012 17:42:29 +0000
- Delivered-to: tm-cvs-commit@eclipse.org
Update of /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor
In directory dev2:/tmp/cvs-serv15410/UI/org/eclipse/rse/internal/ui/view/monitor
Modified Files:
MonitorViewWorkbook.java MonitorViewPage.java
SystemMonitorViewPart.java
Log Message:
[372674] Enhancement - Preserve state of Remote Monitor view
Index: SystemMonitorViewPart.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorViewPart.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** SystemMonitorViewPart.java 24 Mar 2011 21:07:15 -0000 1.13
--- SystemMonitorViewPart.java 8 Mar 2012 17:42:27 -0000 1.14
***************
*** 1,4 ****
/********************************************************************************
! * Copyright (c) 2002, 2011 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
--- 1,4 ----
/********************************************************************************
! * Copyright (c) 2002, 2012 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
***************
*** 24,27 ****
--- 24,28 ----
* David McKnight (IBM) - [294663] bad cast in monitor view part refresh action
* David McKnight (IBM) - [340912] inconsistencies with columns in RSE table viewers
+ * David McKnight (IBM) - [372674] Enhancement - Preserve state of Remote Monitor view
********************************************************************************/
***************
*** 29,35 ****
--- 30,44 ----
import java.util.ArrayList;
+ import java.util.HashMap;
+ import java.util.Iterator;
+ import java.util.Map;
import java.util.Vector;
import org.eclipse.core.runtime.IAdaptable;
+ import org.eclipse.core.runtime.IProgressMonitor;
+ import org.eclipse.core.runtime.IStatus;
+ import org.eclipse.core.runtime.NullProgressMonitor;
+ import org.eclipse.core.runtime.Status;
+ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
***************
*** 49,54 ****
--- 58,68 ----
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
import org.eclipse.rse.core.events.ISystemResourceChangeListener;
+ import org.eclipse.rse.core.filters.ISystemFilterReference;
+ import org.eclipse.rse.core.model.IHost;
+ import org.eclipse.rse.core.model.IRSECallback;
import org.eclipse.rse.core.model.ISystemContainer;
+ import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry;
+ import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.internal.ui.SystemPropertyResources;
import org.eclipse.rse.internal.ui.SystemResources;
***************
*** 56,59 ****
--- 70,74 ----
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
+ import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
***************
*** 66,69 ****
--- 81,86 ----
import org.eclipse.rse.ui.view.SystemTableViewProvider;
import org.eclipse.swt.SWT;
+ import org.eclipse.swt.custom.CTabFolder;
+ import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
***************
*** 82,88 ****
--- 99,108 ----
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.IActionBars;
+ import org.eclipse.ui.IMemento;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.ISelectionService;
+ import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPart;
+ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.CellEditorActionHandler;
import org.eclipse.ui.part.ViewPart;
***************
*** 105,116 ****
ISelectionProvider
{
- class RestoreStateRunnable implements Runnable
- {
- public void run()
- {
- }
}
class PositionToAction extends BrowseAction
{
--- 125,412 ----
ISelectionProvider
{
+ class RestoreStateRunnable extends Job
+ {
+ private IMemento _rmemento;
+ public RestoreStateRunnable(IMemento memento)
+ {
+ super(SystemResources.RESID_RESTORE_RSE_MONITOR_JOB);
+ _rmemento = memento;
+ }
+ public IStatus run(IProgressMonitor monitor)
+ {
+ try {
+ IStatus wstatus = RSECorePlugin.waitForInitCompletion();
+ if (!wstatus.isOK() && wstatus.getSeverity() == IStatus.ERROR){
+ return wstatus;
+ }
+ }
+ catch (InterruptedException e){
+ return Status.CANCEL_STATUS;
+ }
+
+ Integer tabCountInt = _memento.getInteger(TAG_MONITOR_TAB_COUNT_ID);
+ if (tabCountInt != null){
+ int tabCount = tabCountInt.intValue();
+ for (int i = 0; i < tabCount && !monitor.isCanceled(); i++){
+ restoreTab(i, monitor);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected void restoreTab(int index, IProgressMonitor monitor){
+ final IMemento memento = _rmemento;
+
+ // matches new format for column width memento
+ // new code - as of RSE 3.1
+ final HashMap cachedColumnWidths = new HashMap();
+
+ // set the cached column widths (for later use)
+ String columnWidths = memento.getString(TAG_MONITOR_TAB_COLUMN_WIDTHS_ID+index);
+ if (columnWidths != null){
+ if (columnWidths.indexOf(";") > 0){ //$NON-NLS-1$
+
+
+ // parse out set of columns
+ String[] columnSets = columnWidths.split(";"); //$NON-NLS-1$
+ for (int i = 0; i < columnSets.length; i++){
+ String columnSet = columnSets[i];
+
+ // parse out columns for set
+ String[] pair = columnSet.split("="); //$NON-NLS-1$
+ String key = pair[0];
+
+ // parse out widths
+ String widthArray = pair[1];
+ String[] widthStrs = widthArray.split(","); //$NON-NLS-1$
+
+ int[] widths = new int[widthStrs.length];
+ for (int w = 0; w < widths.length; w++){
+ widths[w] = Integer.parseInt(widthStrs[w]);
+ }
+ cachedColumnWidths.put(key, widths);
+ }
+ }
+ }
+
+ Boolean pollingOnBool = memento.getBoolean(TAG_MONITOR_TAB_POLLING_ON_ID+index);
+ Integer pollingIntervalInteger = memento.getInteger(TAG_MONITOR_TAB_POLLING_INTERVAL_ID+index);
+ boolean pollingOn = false;
+ int pollingInterval = 100;
+ if (pollingOnBool != null){
+ pollingOn = pollingOnBool.booleanValue();
+ }
+ if (pollingIntervalInteger != null){
+ pollingInterval = pollingIntervalInteger.intValue();
+ }
+
+
+ String profileId = memento.getString(TAG_MONITOR_TAB_PROFILE_ID+index);
+ String connectionId = memento.getString(TAG_MONITOR_TAB_CONNECTION_ID+index);
+ String subsystemId = memento.getString(TAG_MONITOR_TAB_SUBSYSTEM_ID+index);
+ final String filterID = memento.getString(TAG_MONITOR_TAB_FILTER_ID+index);
+ final String objectID = memento.getString(TAG_MONITOR_TAB_OBJECT_ID+index);
+
+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+
+ Object input = null;
+ if (subsystemId == null){
+ if (connectionId != null){
+ ISystemProfile profile = registry.getSystemProfile(profileId);
+ input = registry.getHost(profile, connectionId);
+ }
+ else{
+ // 191288 we now use registry instead of registry ui as input
+ input = registry;
+ }
+ }
+ else {
+ // from the subsystem ID determine the profile, system and subsystem
+ final ISubSystem subsystem = registry.getSubSystem(subsystemId);
+
+ if (subsystem != null) {
+ if (filterID == null && objectID == null) {
+ input = subsystem;
+ }
+ else {
+ if (!subsystem.isConnected()) {
+ try {
+ final Object finInput = input;
+ final boolean fpollingOn = pollingOn;
+ final int fpollingInterval = pollingInterval;
+ subsystem.connect(false, new IRSECallback() {
+ public void done(IStatus status, Object result) {
+ // this needs to be done on the main thread
+ // so doing an asynchExec()
+ runOnceConnected(new NullProgressMonitor(), finInput, subsystem, filterID, objectID, cachedColumnWidths, fpollingOn, fpollingInterval);
+ }
+ });
+ }
+ catch (Exception e) {
+ }
+ }
+ else {
+ runOnceConnected(monitor, input, subsystem, filterID, objectID, cachedColumnWidths, pollingOn, pollingInterval);
+ }
+ return;
+ } // end else
+ } // end if (subsystem != null)
+ } // end else
+ if (input != null){
+ runWithInput(monitor, input, cachedColumnWidths, pollingOn, pollingInterval);
+ }
+ }
+
+
+ public IStatus runOnceConnected(IProgressMonitor monitor, Object input, ISubSystem subsystem, String filterID, String objectID,
+ HashMap cachedColumnWidths, boolean pollingOn, int pollingInterval)
+ {
+ if (monitor.isCanceled()){
+ return Status.CANCEL_STATUS;
+ }
+ if (subsystem.isConnected()) {
+ if (filterID != null) {
+ try {
+ input = subsystem.getObjectWithAbsoluteName(filterID, monitor);
+ }
+ catch (Exception e) {
+ //ignore
+ }
+ }
+ else {
+ if (objectID != null) {
+ try {
+ input = subsystem.getObjectWithAbsoluteName(objectID, monitor);
+ }
+ catch (Exception e) {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ } // end else
+ } // end if (subsystem.isConnected)
+
+ if (input != null){
+ runWithInput(monitor, input, cachedColumnWidths, pollingOn, pollingInterval);
+ return Status.OK_STATUS;
+ }
+ else {
+ return Status.CANCEL_STATUS;
+ }
+ }
+
+ private class WaitForAdapterJob extends Job {
+ private IAdaptable _input;
+ private HashMap _cachedColumnWidths;
+ private boolean _pollingOn;
+ private int _pollingInterval;
+ public WaitForAdapterJob(IAdaptable input, HashMap cachedColumnWidths, boolean pollingOn, int pollingInterval){
+ super(SystemResources.RESID_RESTORE_RSE_MONITOR_JOB);
+ _input = input;
+ _cachedColumnWidths = cachedColumnWidths;
+ _pollingOn = pollingOn;
+ _pollingInterval = pollingInterval;
+ }
+
+ protected IStatus run(IProgressMonitor monitor) {
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)_input.getAdapter(ISystemViewElementAdapter.class);
+ while (adapter == null || monitor.isCanceled()){
+ try {
+ synchronized (_input){
+ _input.wait(1000);
+ }
+ } catch (InterruptedException e) {
+ }
+ adapter = (ISystemViewElementAdapter)_input.getAdapter(ISystemViewElementAdapter.class);
+ }
+ if (monitor.isCanceled()){
+ return Status.CANCEL_STATUS;
+ }
+
+ // got an adapter now
+ // set input needs to be run on the main thread
+ Display.getDefault().asyncExec(new Runnable()
+ {
+ public void run(){
+ addItemToMonitor(_input);
+ MonitorViewPage page = _folder.getCurrentTabItem(); // get the viewer
+
+ // restore column widths
+ page.getViewer().setCachedColumnWidths(_cachedColumnWidths);
+
+ // restoring polling
+ page.setPollingEnabled(_pollingOn);
+ page.setPollingInterval(_pollingInterval);
+ }
+ });
+
+ return Status.OK_STATUS;
+ }
+ }
+
+ public IStatus runWithInput(IProgressMonitor monitor, Object input, HashMap cachedColumnWidths, boolean pollingOn, int pollingInterval)
+ {
+ if (input != null && input instanceof IAdaptable){
+ final IAdaptable mementoInput = (IAdaptable) input;
+ final HashMap fcachedColumnWidths = cachedColumnWidths;
+ final boolean fpollingOn = pollingOn;
+ final int fpollingInterval = pollingInterval;
+ if (mementoInput != null)
+ {
+ // first make sure the adapter factories are ready
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)mementoInput.getAdapter(ISystemViewElementAdapter.class);
+ if (adapter == null){
+ WaitForAdapterJob job = new WaitForAdapterJob(mementoInput, cachedColumnWidths, pollingOn, pollingInterval);
+ job.schedule();
+ }
+ else {
+ // set input needs to be run on the main thread
+ Display.getDefault().asyncExec(new Runnable(){
+ public void run(){
+ addItemToMonitor(mementoInput);
+ MonitorViewPage page = _folder.getCurrentTabItem(); // get the viewer
+
+ // restore column widths
+ page.getViewer().setCachedColumnWidths(fcachedColumnWidths);
+
+ // restoring polling
+ page.setPollingEnabled(fpollingOn);
+ page.setPollingInterval(fpollingInterval);
+ }
+ });
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
}
+
+
+
+
+ // Restore memento tags
+ public static final String TAG_MONITOR_TAB_COUNT_ID = "monitorTabCountID"; //$NON-NLS-1$
+
+ public static final String TAG_MONITOR_TAB_PROFILE_ID = "monitorTabProfileID_"; //$NON-NLS-1$
+ public static final String TAG_MONITOR_TAB_CONNECTION_ID = "monitorTabConnectionID_"; //$NON-NLS-1$
+ public static final String TAG_MONITOR_TAB_SUBSYSTEM_ID = "monitorTabSubsystemID_"; //$NON-NLS-1$
+ public static final String TAG_MONITOR_TAB_OBJECT_ID = "monitorTabObjectID_"; //$NON-NLS-1$
+ public static final String TAG_MONITOR_TAB_FILTER_ID = "monitorTabFilterID_"; //$NON-NLS-1$
+
+ // Subset memento tags
+ public static final String TAG_MONITOR_TAB_SUBSET_ID = "monitorTabSubsetID_"; //$NON-NLS-1$
+
+ // polling
+ public static final String TAG_MONITOR_TAB_POLLING_ON_ID = "monitorTabPollingOnID_"; //$NON-NLS-1$
+ public static final String TAG_MONITOR_TAB_POLLING_INTERVAL_ID= "monitorTabPollingIntervalID_"; // $NON-NLS-1$
+
+ // layout memento tags
+ public static final String TAG_MONITOR_TAB_COLUMN_WIDTHS_ID = "monitorTabColumnWidths_"; //$NON-NLS-1$
+
+
+
+
+
class PositionToAction extends BrowseAction
{
***************
*** 670,675 ****
--- 966,978 ----
// matches id in plugin.xml, view tag
+ private IMemento _memento = null;
+
public void setFocus()
{
+ if (_folder.getInput() == null){
+ if (_memento != null){
+ restoreState(_memento);
+ }
+ }
_folder.showCurrentPage();
}
***************
*** 714,721 ****
registry.addSystemRemoteChangeListener(this);
-
- RestoreStateRunnable restore = new RestoreStateRunnable();
- Display.getCurrent().asyncExec(restore);
-
getSite().setSelectionProvider(this);
selectionListener = new ISelectionChangedListener() {
--- 1017,1020 ----
***************
*** 1167,1170 ****
--- 1466,1602 ----
}
+ private void restoreState(IMemento memento)
+ {
+ RestoreStateRunnable rsr = new RestoreStateRunnable(memento);
+ rsr.setRule(RSECorePlugin.getTheSystemRegistry());
+ rsr.schedule();
+ }
+
+ /**
+ * Initializes this view with the given view site. A memento is passed to
+ * the view which contains a snapshot of the views state from a previous
+ * session. Where possible, the view should try to recreate that state
+ * within the part controls.
+ * <p>
+ * The parent's default implementation will ignore the memento and initialize
+ * the view in a fresh state. Subclasses may override the implementation to
+ * perform any state restoration as needed.
+ */
+ public void init(IViewSite site, IMemento memento) throws PartInitException
+ {
+ super.init(site, memento);
+
+ if (memento != null && SystemPreferencesManager.getRememberState()){
+ _memento = memento;
+ }
+ }
+
+ protected void saveTabState(IMemento memento, CTabItem item, int index){
+ MonitorViewPage page = (MonitorViewPage) item.getData();
+ Object input = page.getInput();
+
+ if (input != null){
+ if (input instanceof ISystemRegistry){
+ }
+ else if (input instanceof IHost){
+ IHost connection = (IHost) input;
+ String connectionID = connection.getAliasName();
+ String profileID = connection.getSystemProfileName();
+ memento.putString(TAG_MONITOR_TAB_CONNECTION_ID+index, connectionID);
+ memento.putString(TAG_MONITOR_TAB_PROFILE_ID+index, profileID);
+ }
+ else{
+ ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) input).getAdapter(ISystemViewElementAdapter.class);
+
+ ISubSystem subsystem = va.getSubSystem(input);
+ if (subsystem != null){
+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+ String subsystemID = registry.getAbsoluteNameForSubSystem(subsystem);
+ String profileID = subsystem.getHost().getSystemProfileName();
+ String connectionID = subsystem.getHost().getAliasName();
+ String objectID = va.getAbsoluteName(input);
+
+ memento.putString(TAG_MONITOR_TAB_PROFILE_ID+index, profileID);
+ memento.putString(TAG_MONITOR_TAB_CONNECTION_ID+index, connectionID);
+ memento.putString(TAG_MONITOR_TAB_SUBSYSTEM_ID+index, subsystemID);
+
+ if (input instanceof ISystemFilterReference){
+ memento.putString(TAG_MONITOR_TAB_FILTER_ID+index, objectID);
+ memento.putString(TAG_MONITOR_TAB_OBJECT_ID+index, null);
+ }
+ else if (input instanceof ISubSystem){
+ memento.putString(TAG_MONITOR_TAB_OBJECT_ID+index, null);
+ memento.putString(TAG_MONITOR_TAB_FILTER_ID+index, null);
+ }
+ else {
+ memento.putString(TAG_MONITOR_TAB_OBJECT_ID+index, objectID);
+ memento.putString(TAG_MONITOR_TAB_FILTER_ID+index, null);
+ }
+ }
+ }
+
+
+ boolean isConnected = false;
+ // don't reconnect
+ ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)input).getAdapter(ISystemViewElementAdapter.class);
+ if (adapter != null){
+ ISubSystem ss = adapter.getSubSystem(input);
+ if (ss != null){
+ isConnected = ss.isConnected();
+ }
+ }
+
+ SystemTableView viewer = page.getViewer();
+ if (isConnected){ // calling this requires a connect so only do it if already connected
+ viewer.inputChanged(input, input);
+ }
+ Map cachedColumnWidths = viewer.getCachedColumnWidths();
+ StringBuffer columnWidths = new StringBuffer();
+ Iterator keyIter = cachedColumnWidths.keySet().iterator();
+ while (keyIter.hasNext()){
+ String key = (String)keyIter.next();
+ int[] widths = (int[])cachedColumnWidths.get(key);
+ columnWidths.append(key);
+ columnWidths.append('=');
+
+ for (int w = 0; w < widths.length; w++){
+ columnWidths.append(widths[w]);
+ if (w != widths.length - 1){
+ columnWidths.append(',');
+ }
+ }
+
+ // always append this, even with last item
+ columnWidths.append(';');
+ }
+
+ memento.putString(TAG_MONITOR_TAB_COLUMN_WIDTHS_ID+index, columnWidths.toString());
+ memento.putBoolean(TAG_MONITOR_TAB_POLLING_ON_ID+index, page.isPollingEnabled());
+ memento.putInteger(TAG_MONITOR_TAB_POLLING_INTERVAL_ID+index, page.getPollingInterval());
+ }
+ }
+
+ /**
+ * Method declared on IViewPart.
+ */
+ public void saveState(IMemento memento)
+ {
+ super.saveState(memento);
+
+ if (!SystemPreferencesManager.getRememberState())
+ return;
+
+ if (_folder != null){
+ CTabFolder flder = _folder.getFolder();
+ int itemCount = flder.getItemCount();
+ memento.putInteger(TAG_MONITOR_TAB_COUNT_ID, itemCount);
+
+ for (int i = 0; i < itemCount; i++){
+ CTabItem item = flder.getItem(i);
+ saveTabState(memento, item, i);
+ }
+ }
+ }
+
}
\ No newline at end of file
Index: MonitorViewPage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewPage.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** MonitorViewPage.java 16 Mar 2011 16:46:05 -0000 1.11
--- MonitorViewPage.java 8 Mar 2012 17:42:27 -0000 1.12
***************
*** 1,4 ****
/********************************************************************************
! * Copyright (c) 2002, 2011 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
--- 1,4 ----
/********************************************************************************
! * Copyright (c) 2002, 2012 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
***************
*** 20,23 ****
--- 20,24 ----
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
* David McKnight (IBM) - [330398] RSE leaks SWT resources
+ * David McKnight (IBM) - [372674] Enhancement - Preserve state of Remote Monitor view
********************************************************************************/
***************
*** 110,119 ****
{
Thread.sleep(interval);
! doQuery();
! // while (_querying)
! // {
! // Thread.sleep(100);
! // }
! doRedraw();
}
catch (InterruptedException e)
--- 111,118 ----
{
Thread.sleep(interval);
! if (isPollingEnabled()){
! doQuery();
! doRedraw();
! }
}
catch (InterruptedException e)
***************
*** 300,303 ****
--- 299,310 ----
}
+ public void setPollingInterval(int interval){
+ _pollingInterval = interval;
+ if (_scale != null){
+ _scaleValue.setText(_pollingInterval + "s"); //$NON-NLS-1$
+ _scale.setSelection(_pollingInterval);
+ }
+ }
+
public int getPollingInterval()
{
***************
*** 317,320 ****
--- 324,337 ----
{
_isPolling = flag;
+ if (_pollCheckbox != null){
+ _pollCheckbox.setSelection(_isPolling);
+ _scale.setEnabled(_isPolling);
+ _scaleValue.setEnabled(_isPolling);
+
+ if (_pollingThread == null){
+ _pollingThread = new PollingThread();
+ _pollingThread.start();
+ }
+ }
}
***************
*** 491,498 ****
public void updateTitle(IAdaptable object)
{
! ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)object.getAdapter(ISystemViewElementAdapter.class);
!
String title = adapter.getText(object);
_tabFolderPage.setText(title);
}
--- 508,516 ----
public void updateTitle(IAdaptable object)
{
! ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)object.getAdapter(ISystemViewElementAdapter.class);
! if (adapter != null){
String title = adapter.getText(object);
_tabFolderPage.setText(title);
+ }
}
Index: MonitorViewWorkbook.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewWorkbook.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MonitorViewWorkbook.java 3 Jul 2009 15:13:55 -0000 1.6
--- MonitorViewWorkbook.java 8 Mar 2012 17:42:27 -0000 1.7
***************
*** 29,32 ****
--- 29,34 ----
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
+ import org.eclipse.swt.events.DisposeEvent;
+ import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
***************
*** 49,53 ****
super(parent, SWT.NONE);
! _folder = new CTabFolder(this, SWT.NONE);
_folder.setLayout(new TabFolderLayout());
_folder.setLayoutData(new GridData(GridData.FILL_BOTH));
--- 51,55 ----
super(parent, SWT.NONE);
! _folder = new CTabFolder(this, SWT.NULL);
_folder.setLayout(new TabFolderLayout());
_folder.setLayoutData(new GridData(GridData.FILL_BOTH));
***************
*** 158,163 ****
{
int index = _folder.getSelectionIndex();
! CTabItem item = _folder.getItem(index);
! return (MonitorViewPage) item.getData();
}
return null;
--- 160,167 ----
{
int index = _folder.getSelectionIndex();
! if (index >= 0){
! CTabItem item = _folder.getItem(index);
! return (MonitorViewPage) item.getData();
! }
}
return null;
***************
*** 224,228 ****
MonitorViewPage monitorViewPage = new MonitorViewPage(_viewPart);
! CTabItem titem = new CTabItem(_folder, SWT.NULL);
setTabTitle(root, titem);
--- 228,232 ----
MonitorViewPage monitorViewPage = new MonitorViewPage(_viewPart);
! CTabItem titem = new CTabItem(_folder, SWT.CLOSE);
setTabTitle(root, titem);
***************
*** 241,244 ****
--- 245,265 ----
}
monitorViewPage.setFocus();
+
+ titem.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Object source = e.getSource();
+ if (source instanceof CTabItem) {
+ CTabItem currentItem = (CTabItem) source;
+ Object data = currentItem.getData();
+ if (data instanceof MonitorViewPage) {
+ MonitorViewPage page = (MonitorViewPage)data;
+ page.setPollingEnabled(false); // stop polling
+ page.dispose();
+ }
+ updateActionStates();
+ }
+ }
+
+ });
}