From a480341791d51293842d3eb7342c8ff4455ec23d Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Fri, 9 Feb 2007 16:35:59 +0000 Subject: [PATCH] [168870] stage 2 integration removing extraneous classes and moving SystemPerspectiveHelpers --- .../model/SystemFileTransferModeRegistry.java | 34 ++--- .../rse/internal/ui/view/SystemView.java | 119 ++---------------- .../SystemOpenRSEPerspectiveAction.java | 2 +- .../actions/SystemWorkWithProfilesAction.java | 2 +- .../ui/view}/SystemPerspectiveHelpers.java | 6 +- .../org/eclipse/rse/ui/view/SystemView.java | 119 ++---------------- .../eclipse/rse/ui/view/SystemViewPart.java | 37 ------ ...RSEDefaultNewConnectionWizardDelegate.java | 2 +- .../ui/wizards/SystemNewConnectionWizard.java | 2 +- .../org/eclipse/rse/model/SystemRegistry.java | 2 +- .../eclipse/rse/core/SystemElapsedTimer.java | 94 -------------- .../rse/core/SystemResourceListener.java | 1 + .../org/eclipse/rse/core/SystemSorter.java | 73 ----------- .../rse/core/SystemStringTokenizer.java | 112 ----------------- 14 files changed, 35 insertions(+), 570 deletions(-) rename rse/plugins/org.eclipse.rse.ui/{systems/org/eclipse/rse/core => UI/org/eclipse/rse/ui/view}/SystemPerspectiveHelpers.java (96%) delete mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemElapsedTimer.java delete mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemSorter.java delete mode 100644 rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemStringTokenizer.java diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/SystemFileTransferModeRegistry.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/SystemFileTransferModeRegistry.java index ccbbd837b6a..2967bc69ee7 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/SystemFileTransferModeRegistry.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/SystemFileTransferModeRegistry.java @@ -22,14 +22,16 @@ import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; import org.eclipse.core.resources.IFile; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.rse.core.SystemBasePlugin; -import org.eclipse.rse.core.SystemSorter; import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants; import org.eclipse.rse.services.clientserver.SystemEncodingUtil; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; @@ -169,34 +171,16 @@ public class SystemFileTransferModeRegistry * typically only needed for certain dialogs/choices etc. */ private List sortedTypeModeMappings() { - - Object[] array = new Object[typeModeMappings.size()]; - Iterator iter = typeModeMappings.values().iterator(); - - int j = 0; - - while (iter.hasNext()) { - array[j++] = iter.next(); - } - - SystemSorter s = new SystemSorter() { - - public boolean compare(Object o1, Object o2) { - + Comparator c = new Comparator() { + public int compare(Object o1, Object o2) { String s1 = ((ISystemFileTransferModeMapping)o1).getLabel().toUpperCase(); String s2 = ((ISystemFileTransferModeMapping)o2).getLabel().toUpperCase(); - return s2.compareTo(s1) > 0; + return s1.compareTo(s2); } }; - - array = s.sort(array); - - List result = new ArrayList(); - - for (int i = 0; i < array.length; i++) { - result.add(array[i]); - } - + SortedSet s = new TreeSet(c); + s.addAll(typeModeMappings.values()); + List result = new ArrayList(s); return result; } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java index 6322f2e5977..7e05fb0d765 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java @@ -56,7 +56,6 @@ import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.jface.window.SameShellProvider; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.SystemBasePlugin; -import org.eclipse.rse.core.SystemElapsedTimer; import org.eclipse.rse.core.SystemPreferencesManager; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterContainer; @@ -204,8 +203,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe public boolean debug = false; public boolean debugRemote = false; public boolean debugProperties = debug && false; - public boolean doTimings = false; - public SystemElapsedTimer elapsedTime = new SystemElapsedTimer(); // for support of Expand To actions ... transient filters really. // we need to record these per tree node they are applied to. protected Hashtable expandToFiltersByObject; // most efficient way to find these is by binary object @@ -1235,16 +1232,10 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe } Shell shell = getShell(); Object data = item.getData(); - boolean isTiming = (data != null) && doTimings; boolean showBusy = (data instanceof IHost) && ((IHost)data).isOffline(); - if (isTiming) elapsedTime.setStartTime(); if (showBusy) SystemPromptDialog.setDisplayCursor(shell, busyCursor); super.handleTreeExpand(event); if (showBusy) SystemPromptDialog.setDisplayCursor(shell, null); - if (isTiming) { - elapsedTime.setEndTime(); - System.out.println("Time to expand for " + item.getItemCount() + " items: " + elapsedTime); //$NON-NLS-1$ //$NON-NLS-2$ - } } /** @@ -1888,8 +1879,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe Vector selectedRemoteObjects = new Vector(); items = getTree().getSelection(); int itemIdx = 0; - SystemElapsedTimer timer = null; - if (doTimings) timer = new SystemElapsedTimer(); //System.out.println("Inside EVENT_REFRESH_SELECTED. FIRST SELECTED OBJECT = " + items[0].handle); while (i.hasNext()) { @@ -1925,10 +1914,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe else { smartRefresh(getTree().getSelection()); } - if (doTimings && timer != null) { - timer.setEndTime(); - System.out.println("Time to refresh selected: " + timer); //$NON-NLS-1$ - } //else //{ //i = selected.iterator(); @@ -2765,7 +2750,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe * @param doStruct true if structural changes are to be picked up, * and false if only label provider changes are of interest */ - protected void ourInternalRefresh(Widget widget, Object element, boolean doStruct, boolean forceRemote, boolean doTimings) { + protected void ourInternalRefresh(Widget widget, Object element, boolean doStruct, boolean forceRemote) { final Widget fWidget = widget; final Object fElement = element; final boolean fDoStruct = doStruct; @@ -2775,16 +2760,15 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe if (!isTreeItemSelected(widget)) // it is one of our kids that is selected { clearSelection(); // there is nothing much else we can do. Calling code will restore it anyway hopefully - doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings, true); + doOurInternalRefresh(fWidget, fElement, fDoStruct, true); } else // it is us that is selected. This might be a refresh selected operation. TreeItem address won't change { - doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings, true); + doOurInternalRefresh(fWidget, fElement, fDoStruct, true); } } else { - final boolean finalDoTimings = doTimings; preservingSelection(new Runnable() { public void run() { - doOurInternalRefresh(fWidget, fElement, fDoStruct, finalDoTimings, true); + doOurInternalRefresh(fWidget, fElement, fDoStruct, true); } }); } @@ -2800,86 +2784,30 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe return false; } - protected void doOurInternalRefresh(Widget widget, Object element, boolean doStruct, boolean doTimings, boolean firstCall) { + protected void doOurInternalRefresh(Widget widget, Object element, boolean doStruct, boolean firstCall) { if (debug) { logDebugMsg("in doOurInternalRefresh on " + getAdapter(element).getName(element)); //$NON-NLS-1$ logDebugMsg("...current selection is " + getFirstSelectionName(getSelection())); //$NON-NLS-1$ } - ISystemViewElementAdapter adapter = getAdapter(element); - if (adapter != null) - { - //String name = adapter.getName(element); - //System.out.println("refreshing "+ ((TreeItem)widget).getText() + " with " + name); - } - SystemElapsedTimer timer = null; - if (doTimings) timer = new SystemElapsedTimer(); if (widget instanceof Item) { - //System.out.println("Inside doOurInternalRefresh. widget = " + ((TreeItem)widget).handle); if (doStruct) { updatePlus((Item) widget, element); } updateItem(widget, element); - if (doTimings && timer != null) { - System.out.println("doOurInternalRefresh timer 1: time to updatePlus and updateItem:" + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } } - if (doStruct) { - // pass null for children, to allow updateChildren to get them only if needed - // Object[] newChildren = null; - if ((widget instanceof Item) && getExpanded((Item) widget)) { - // DKM - get raw children does a query but so does internalRefresh() - // newChildren = getRawChildren(widget); - if (doTimings && timer != null) { - System.out.println("doOurInternalRefresh timer 2: time to getRawChildren:" + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } - } - // DKM - without the else we get duplicate queries on expanded folder - // uncommented - seems new results after query aren't showing up - //else -// { -// internalRefresh(element); -// } - - if (doTimings && timer != null) { - System.out.println("doOurInternalRefresh timer 3: time to updateChildren:" + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } - } // recurse Item[] children = getChildren(widget); if (children != null) { - //SystemElapsedTimer timer2 = null; - //int intervalCount = 0; - //if (doTimings) - //timer2 = new SystemElapsedTimer(); for (int i = 0; i < children.length; i++) { Widget item = children[i]; Object data = item.getData(); - if (data != null) doOurInternalRefresh(item, data, doStruct, false, false); - /* - if (doTimings) - { - ++intervalCount; - if (intervalCount == 1000) - { - System.out.println("...time to recurse next 1000 children: " + timer2.setEndTime()); - intervalCount = 0; - timer2.setStartTime(); - } - }*/ + if (data != null) doOurInternalRefresh(item, data, doStruct, false); } } - if (firstCall) - { + if (firstCall) { internalRefresh(element); } - if (doTimings && timer != null) { - System.out.println("doOurInternalRefresh timer 4: time to recurse children:" + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } } protected Object[] getRawChildren(Widget w) { @@ -3118,8 +3046,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe } protected void smartRefresh(TreeItem[] itemsToRefresh, ArrayList expandedChildren, boolean forceRemote) { - SystemElapsedTimer timer = null; - if (doTimings) timer = new SystemElapsedTimer(); areAnyRemote = false; // set in ExpandedItem constructor boolean fullRefresh = false; // for each selected tree item gather a list of expanded child nodes... @@ -3142,10 +3068,8 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe setExpandedState(data, false); // collapse temp expansion of prompts else if (currItem.getExpanded()) { //expandedChildren.add(new ExpandedItem(currItem)); we don't need special processing for given items themselves as they will not be refreshed, only their kids - if (doTimings && timer != null) timer.setStartTime(); gatherExpandedChildren((fullRefresh ? null : currItem), currItem, expandedChildren); wasExpanded[idx] = true; - if (doTimings && timer != null) System.out.println("Refresh Timer 1: time to gatherExpandedChildren: " + timer.setEndTime()); //$NON-NLS-1$ } else wasExpanded[idx] = false; } @@ -3155,7 +3079,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe if (!areAnyRemote) { for (int idx = 0; idx < itemsToRefresh.length; idx++) //ourInternalRefresh(itemsToRefresh[idx], itemsToRefresh[idx].getData(), wasExpanded[idx]); - ourInternalRefresh(itemsToRefresh[idx], itemsToRefresh[idx].getData(), true, forceRemote, doTimings); // defect 42321 + ourInternalRefresh(itemsToRefresh[idx], itemsToRefresh[idx].getData(), true, forceRemote); // defect 42321 return; } getControl().setRedraw(false); @@ -3165,28 +3089,11 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe // address won't change, only that of its children. for (int idx = 0; idx < itemsToRefresh.length; idx++) { TreeItem currItem = itemsToRefresh[idx]; - if (doTimings && timer != null) timer.setStartTime(); setExpanded(currItem, false); // collapse node - if (doTimings && timer != null) { - System.out.println("Refresh Timer 2: time to setExpanded(false): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } - ourInternalRefresh(currItem, currItem.getData(), true, true, doTimings); // dispose of children, update plus - if (doTimings && timer != null) { - System.out.println("Refresh Timer 3: time to do ourInternalRefresh(...): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } + ourInternalRefresh(currItem, currItem.getData(), true, true); // dispose of children, update plus if (wasExpanded[idx]) { createChildren(currItem); // re-expand - if (doTimings && timer != null) { - System.out.println("Refresh Timer 4: time to createChildren(...): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } currItem.setExpanded(true); - if (doTimings && timer != null) { - System.out.println("Refresh Timer 5: time to setExpanded(true): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } } else // hmm, item was not expanded so just flush its memory { @@ -3215,15 +3122,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe if (debug) System.out.println("Re-Expanded non-remote Item: " + itemToExpand.data); //$NON-NLS-1$ } } - if (doTimings && timer != null) { - System.out.println("Refresh Timer 6: time to reExpanded expanded subnodes: " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } getControl().setRedraw(true); - if (doTimings && timer != null) { - System.out.println("Refresh Timer 7: time to setRedraw(true): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } } public void refreshRemote(Object element) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java index b402d077d44..4cde0964570 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemOpenRSEPerspectiveAction.java @@ -17,7 +17,7 @@ package org.eclipse.rse.ui.actions; import org.eclipse.jface.action.Action; -import org.eclipse.rse.core.SystemPerspectiveHelpers; +import org.eclipse.rse.ui.view.SystemPerspectiveHelpers; /** diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java index 2beecf79faa..5793e53e00a 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemWorkWithProfilesAction.java @@ -15,9 +15,9 @@ ********************************************************************************/ package org.eclipse.rse.ui.actions; -import org.eclipse.rse.core.SystemPerspectiveHelpers; import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.SystemResources; +import org.eclipse.rse.ui.view.SystemPerspectiveHelpers; import org.eclipse.rse.ui.view.team.SystemTeamViewPart; import org.eclipse.swt.widgets.Shell; diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPerspectiveHelpers.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveHelpers.java similarity index 96% rename from rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPerspectiveHelpers.java rename to rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveHelpers.java index 25222f1b5f7..4df797bfcdc 100644 --- a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPerspectiveHelpers.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemPerspectiveHelpers.java @@ -14,10 +14,8 @@ * {Name} (company) - description of contribution. ********************************************************************************/ -package org.eclipse.rse.core; -import org.eclipse.rse.ui.view.SystemPerspectiveLayout; -import org.eclipse.rse.ui.view.SystemView; -import org.eclipse.rse.ui.view.SystemViewPart; +package org.eclipse.rse.ui.view; +import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.ui.IPerspectiveDescriptor; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchPage; diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java index 6322f2e5977..7e05fb0d765 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemView.java @@ -56,7 +56,6 @@ import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.jface.window.SameShellProvider; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.SystemBasePlugin; -import org.eclipse.rse.core.SystemElapsedTimer; import org.eclipse.rse.core.SystemPreferencesManager; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterContainer; @@ -204,8 +203,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe public boolean debug = false; public boolean debugRemote = false; public boolean debugProperties = debug && false; - public boolean doTimings = false; - public SystemElapsedTimer elapsedTime = new SystemElapsedTimer(); // for support of Expand To actions ... transient filters really. // we need to record these per tree node they are applied to. protected Hashtable expandToFiltersByObject; // most efficient way to find these is by binary object @@ -1235,16 +1232,10 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe } Shell shell = getShell(); Object data = item.getData(); - boolean isTiming = (data != null) && doTimings; boolean showBusy = (data instanceof IHost) && ((IHost)data).isOffline(); - if (isTiming) elapsedTime.setStartTime(); if (showBusy) SystemPromptDialog.setDisplayCursor(shell, busyCursor); super.handleTreeExpand(event); if (showBusy) SystemPromptDialog.setDisplayCursor(shell, null); - if (isTiming) { - elapsedTime.setEndTime(); - System.out.println("Time to expand for " + item.getItemCount() + " items: " + elapsedTime); //$NON-NLS-1$ //$NON-NLS-2$ - } } /** @@ -1888,8 +1879,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe Vector selectedRemoteObjects = new Vector(); items = getTree().getSelection(); int itemIdx = 0; - SystemElapsedTimer timer = null; - if (doTimings) timer = new SystemElapsedTimer(); //System.out.println("Inside EVENT_REFRESH_SELECTED. FIRST SELECTED OBJECT = " + items[0].handle); while (i.hasNext()) { @@ -1925,10 +1914,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe else { smartRefresh(getTree().getSelection()); } - if (doTimings && timer != null) { - timer.setEndTime(); - System.out.println("Time to refresh selected: " + timer); //$NON-NLS-1$ - } //else //{ //i = selected.iterator(); @@ -2765,7 +2750,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe * @param doStruct true if structural changes are to be picked up, * and false if only label provider changes are of interest */ - protected void ourInternalRefresh(Widget widget, Object element, boolean doStruct, boolean forceRemote, boolean doTimings) { + protected void ourInternalRefresh(Widget widget, Object element, boolean doStruct, boolean forceRemote) { final Widget fWidget = widget; final Object fElement = element; final boolean fDoStruct = doStruct; @@ -2775,16 +2760,15 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe if (!isTreeItemSelected(widget)) // it is one of our kids that is selected { clearSelection(); // there is nothing much else we can do. Calling code will restore it anyway hopefully - doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings, true); + doOurInternalRefresh(fWidget, fElement, fDoStruct, true); } else // it is us that is selected. This might be a refresh selected operation. TreeItem address won't change { - doOurInternalRefresh(fWidget, fElement, fDoStruct, doTimings, true); + doOurInternalRefresh(fWidget, fElement, fDoStruct, true); } } else { - final boolean finalDoTimings = doTimings; preservingSelection(new Runnable() { public void run() { - doOurInternalRefresh(fWidget, fElement, fDoStruct, finalDoTimings, true); + doOurInternalRefresh(fWidget, fElement, fDoStruct, true); } }); } @@ -2800,86 +2784,30 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe return false; } - protected void doOurInternalRefresh(Widget widget, Object element, boolean doStruct, boolean doTimings, boolean firstCall) { + protected void doOurInternalRefresh(Widget widget, Object element, boolean doStruct, boolean firstCall) { if (debug) { logDebugMsg("in doOurInternalRefresh on " + getAdapter(element).getName(element)); //$NON-NLS-1$ logDebugMsg("...current selection is " + getFirstSelectionName(getSelection())); //$NON-NLS-1$ } - ISystemViewElementAdapter adapter = getAdapter(element); - if (adapter != null) - { - //String name = adapter.getName(element); - //System.out.println("refreshing "+ ((TreeItem)widget).getText() + " with " + name); - } - SystemElapsedTimer timer = null; - if (doTimings) timer = new SystemElapsedTimer(); if (widget instanceof Item) { - //System.out.println("Inside doOurInternalRefresh. widget = " + ((TreeItem)widget).handle); if (doStruct) { updatePlus((Item) widget, element); } updateItem(widget, element); - if (doTimings && timer != null) { - System.out.println("doOurInternalRefresh timer 1: time to updatePlus and updateItem:" + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } } - if (doStruct) { - // pass null for children, to allow updateChildren to get them only if needed - // Object[] newChildren = null; - if ((widget instanceof Item) && getExpanded((Item) widget)) { - // DKM - get raw children does a query but so does internalRefresh() - // newChildren = getRawChildren(widget); - if (doTimings && timer != null) { - System.out.println("doOurInternalRefresh timer 2: time to getRawChildren:" + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } - } - // DKM - without the else we get duplicate queries on expanded folder - // uncommented - seems new results after query aren't showing up - //else -// { -// internalRefresh(element); -// } - - if (doTimings && timer != null) { - System.out.println("doOurInternalRefresh timer 3: time to updateChildren:" + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } - } // recurse Item[] children = getChildren(widget); if (children != null) { - //SystemElapsedTimer timer2 = null; - //int intervalCount = 0; - //if (doTimings) - //timer2 = new SystemElapsedTimer(); for (int i = 0; i < children.length; i++) { Widget item = children[i]; Object data = item.getData(); - if (data != null) doOurInternalRefresh(item, data, doStruct, false, false); - /* - if (doTimings) - { - ++intervalCount; - if (intervalCount == 1000) - { - System.out.println("...time to recurse next 1000 children: " + timer2.setEndTime()); - intervalCount = 0; - timer2.setStartTime(); - } - }*/ + if (data != null) doOurInternalRefresh(item, data, doStruct, false); } } - if (firstCall) - { + if (firstCall) { internalRefresh(element); } - if (doTimings && timer != null) { - System.out.println("doOurInternalRefresh timer 4: time to recurse children:" + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } } protected Object[] getRawChildren(Widget w) { @@ -3118,8 +3046,6 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe } protected void smartRefresh(TreeItem[] itemsToRefresh, ArrayList expandedChildren, boolean forceRemote) { - SystemElapsedTimer timer = null; - if (doTimings) timer = new SystemElapsedTimer(); areAnyRemote = false; // set in ExpandedItem constructor boolean fullRefresh = false; // for each selected tree item gather a list of expanded child nodes... @@ -3142,10 +3068,8 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe setExpandedState(data, false); // collapse temp expansion of prompts else if (currItem.getExpanded()) { //expandedChildren.add(new ExpandedItem(currItem)); we don't need special processing for given items themselves as they will not be refreshed, only their kids - if (doTimings && timer != null) timer.setStartTime(); gatherExpandedChildren((fullRefresh ? null : currItem), currItem, expandedChildren); wasExpanded[idx] = true; - if (doTimings && timer != null) System.out.println("Refresh Timer 1: time to gatherExpandedChildren: " + timer.setEndTime()); //$NON-NLS-1$ } else wasExpanded[idx] = false; } @@ -3155,7 +3079,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe if (!areAnyRemote) { for (int idx = 0; idx < itemsToRefresh.length; idx++) //ourInternalRefresh(itemsToRefresh[idx], itemsToRefresh[idx].getData(), wasExpanded[idx]); - ourInternalRefresh(itemsToRefresh[idx], itemsToRefresh[idx].getData(), true, forceRemote, doTimings); // defect 42321 + ourInternalRefresh(itemsToRefresh[idx], itemsToRefresh[idx].getData(), true, forceRemote); // defect 42321 return; } getControl().setRedraw(false); @@ -3165,28 +3089,11 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe // address won't change, only that of its children. for (int idx = 0; idx < itemsToRefresh.length; idx++) { TreeItem currItem = itemsToRefresh[idx]; - if (doTimings && timer != null) timer.setStartTime(); setExpanded(currItem, false); // collapse node - if (doTimings && timer != null) { - System.out.println("Refresh Timer 2: time to setExpanded(false): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } - ourInternalRefresh(currItem, currItem.getData(), true, true, doTimings); // dispose of children, update plus - if (doTimings && timer != null) { - System.out.println("Refresh Timer 3: time to do ourInternalRefresh(...): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } + ourInternalRefresh(currItem, currItem.getData(), true, true); // dispose of children, update plus if (wasExpanded[idx]) { createChildren(currItem); // re-expand - if (doTimings && timer != null) { - System.out.println("Refresh Timer 4: time to createChildren(...): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } currItem.setExpanded(true); - if (doTimings && timer != null) { - System.out.println("Refresh Timer 5: time to setExpanded(true): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } } else // hmm, item was not expanded so just flush its memory { @@ -3215,15 +3122,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe if (debug) System.out.println("Re-Expanded non-remote Item: " + itemToExpand.data); //$NON-NLS-1$ } } - if (doTimings && timer != null) { - System.out.println("Refresh Timer 6: time to reExpanded expanded subnodes: " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } getControl().setRedraw(true); - if (doTimings && timer != null) { - System.out.println("Refresh Timer 7: time to setRedraw(true): " + timer.setEndTime()); //$NON-NLS-1$ - timer.setStartTime(); - } } public void refreshRemote(Object element) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java index 7f2a101eb52..3d38be1ba22 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewPart.java @@ -44,7 +44,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.rse.core.SystemBasePlugin; -import org.eclipse.rse.core.SystemElapsedTimer; import org.eclipse.rse.core.SystemPreferencesManager; import org.eclipse.rse.core.filters.ISystemFilterPoolReference; import org.eclipse.rse.core.filters.ISystemFilterReference; @@ -138,10 +137,8 @@ public class SystemViewPart protected SystemMessage sysErrorMessage; protected IStatusLineManager statusLine = null; protected boolean inputIsRoot = true; - protected boolean doTimings = false; protected boolean isLinkingEnabled = false; - protected SystemElapsedTimer timer; protected FrameList frameList; protected SystemViewPartGotoActionGroup gotoActionGroup; protected ToggleLinkingAction toggleLinkingAction; @@ -1082,9 +1079,6 @@ public class SystemViewPart if (!SystemPreferencesManager.getPreferencesManager().getRememberState()) return; - if (doTimings) - timer = new SystemElapsedTimer(); - // restore the show filter pools and show filter strings settings as they were when this was saved boolean showFilterPools = false; boolean showFilterStrings = false; @@ -1151,17 +1145,10 @@ public class SystemViewPart for (int idx=0; idx 1) - quickSort(sortedCollection, 0, size - 1); - return sortedCollection; - } -} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemStringTokenizer.java b/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemStringTokenizer.java deleted file mode 100644 index 8eb2a6fcbcf..00000000000 --- a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemStringTokenizer.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - ********************************************************************************/ - -package org.eclipse.rse.core; -import java.util.Vector; - -/** - * Similar to java's StringTokenizer, but supports multi-character delimiter - * versus just single character delimiters. Eg usage is: - * - * SystemStringTokenizer tokens = new SystemStringTokenizer(stringToParse, "___"); - * while (tokens.hasMoreTokens()) - * String nextToken = tokens.nextToken(); - * - */ -public class SystemStringTokenizer -{ - private Vector tokens; - private int nextToken; - - /** - * Constructor - * @param inputString The string to be tokenized - * @param delimiter The multi-char string that delimits the tokens. Eg "___" - */ - public SystemStringTokenizer(String inputString, String delimiter) - { - tokens = tokenize(inputString, delimiter); - nextToken = 0; - } - - /** - * Return a count of the number of tokens in the input string - * @return int number of tokens - */ - public int countTokens() - { - return tokens.size(); - } - - /** - * @return true if there are more tokens - */ - public boolean hasMoreTokens() - { - return (nextToken < tokens.size()); - } - - /** - * @return String the next token - */ - public String nextToken() - { - if (nextToken < tokens.size()) - return (String)tokens.elementAt(nextToken++); - else - return null; - } - - /** - * Parse a string into tokens. - * @param inputString String to parse - * @param delimiter Delimiter String, may be multi-character. - * @return Vector of tokens found - */ - public static Vector tokenize(String inputString, String delimiter) - { - Vector v = new Vector(); - StringBuffer token = new StringBuffer(); - String lastToken = null; - int inpLen = inputString.length(); - int delimLen = delimiter.length(); - char delimChar1 = delimiter.charAt(0); - for (int idx=0; idx= delimLen) && - inputString.substring(idx,idx+delimLen).equals(delimiter)) - { - lastToken = token.toString(); - v.addElement(lastToken); - //System.out.println("...token: " + token); - token.setLength(0); - idx += delimLen-1; - } - else - token.append(currChar); - } - if (token.length() > 0) - { - lastToken = token.toString(); - v.addElement(lastToken); - //System.out.println("...token: " + token); - } - return v; - } - -} \ No newline at end of file