1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-28 19:35:36 +02:00

[168870] stage 2 integration

removing extraneous classes and moving SystemPerspectiveHelpers
This commit is contained in:
David Dykstal 2007-02-09 16:35:59 +00:00
parent 672368f0af
commit a480341791
14 changed files with 35 additions and 570 deletions

View file

@ -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;
}

View file

@ -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 <code>true</code> if structural changes are to be picked up,
* and <code>false</code> 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)

View file

@ -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;
/**

View file

@ -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;

View file

@ -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;

View file

@ -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 <code>true</code> if structural changes are to be picked up,
* and <code>false</code> 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)

View file

@ -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<remoteElements.size(); idx++)
{
RemoteObject ro = (RemoteObject)remoteElements.elementAt(idx);
if (doTimings)
timer.setStartTime();
//event = new SystemResourceChangeEvent(ro.name,ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE,
// SystemViewDummyObject.getSingleton()); // This tells SystemView to expand this remote object, but don't select a child
//systemView.systemResourceChanged(event);
systemView.refreshRemoteObject(ro.name, SystemViewDummyObject.getSingleton(), true);
if (doTimings)
{
timer.setEndTime();
System.out.println("Time to restore "+ro.name+": " + timer);
}
}
}
}
@ -1192,15 +1179,8 @@ public class SystemViewPart
RemoteObject ro = (RemoteObject)remoteElements.elementAt(idx);
v.addElement(ro.name);
}
if (doTimings)
timer.setStartTime();
SystemResourceChangeEvent event = new SystemResourceChangeEvent(v,ISystemResourceChangeEvents.EVENT_SELECT_REMOTE,null);
systemView.systemResourceChanged(event);
if (doTimings)
{
timer.setEndTime();
System.out.println("Time to select "+v.size()+" elements: " + timer);
}
}
}
Tree tree= systemView.getTree();
@ -1545,9 +1525,6 @@ public class SystemViewPart
if (!SystemPreferencesManager.getPreferencesManager().getRememberState())
return Status.CANCEL_STATUS;
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;
@ -1649,8 +1626,6 @@ public class SystemViewPart
for (int idx = 0; idx < remoteElements.size(); idx++)
{
RemoteObject ro = (RemoteObject) remoteElements.elementAt(idx);
if (doTimings)
timer.setStartTime();
//event = new SystemResourceChangeEvent(ro.name,ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE,
// SystemViewDummyObject.getSingleton()); // This tells SystemView to expand this remote object, but don't select a child
//systemView.systemResourceChanged(event);
@ -1670,11 +1645,6 @@ public class SystemViewPart
ro.subsystem.getCacheManager().setRestoreFromMemento(false);
}
if (doTimings)
{
timer.setEndTime();
System.out.println("Time to restore " + ro.name + ": " + timer); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
@ -1714,15 +1684,8 @@ public class SystemViewPart
RemoteObject ro = (RemoteObject) remoteElements.elementAt(idx);
v.addElement(ro.name);
}
if (doTimings)
timer.setStartTime();
SystemResourceChangeEvent event = new SystemResourceChangeEvent(v, ISystemResourceChangeEvents.EVENT_SELECT_REMOTE, null);
systemView.systemResourceChanged(event);
if (doTimings)
{
timer.setEndTime();
System.out.println("Time to select " + v.size() + " elements: " + timer); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
Tree tree = systemView.getTree();

View file

@ -22,7 +22,6 @@ import java.util.Vector;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.SystemPerspectiveHelpers;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
import org.eclipse.rse.core.model.ISystemProfile;
@ -39,6 +38,7 @@ import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemConnectionForm;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.rse.ui.view.SystemPerspectiveHelpers;
/**

View file

@ -22,7 +22,6 @@ import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.SystemPerspectiveHelpers;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
import org.eclipse.rse.core.model.ISystemProfile;
@ -40,6 +39,7 @@ import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemConnectionForm;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.rse.ui.view.SystemPerspectiveHelpers;
import org.eclipse.ui.INewWizard;
/**

View file

@ -33,7 +33,6 @@ import org.eclipse.rse.core.IRSEUserIdConstants;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemAdapterHelpers;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.SystemPerspectiveHelpers;
import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
@ -83,6 +82,7 @@ import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.rse.ui.view.ISystemViewInputProvider;
import org.eclipse.rse.ui.view.SystemDNDTransferRunnable;
import org.eclipse.rse.ui.view.SystemPerspectiveHelpers;
import org.eclipse.rse.ui.view.SystemView;
import org.eclipse.rse.ui.view.SystemViewDataDropAdapter;
import org.eclipse.swt.dnd.Clipboard;

View file

@ -1,94 +0,0 @@
/********************************************************************************
* Copyright (c) 2000, 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.io.PrintWriter;
/**
* A utility helper class to help when making timings of potentially
* long operations, such as remote system calls.
*/
public class SystemElapsedTimer
{
private long startTime;
private long endTime;
public SystemElapsedTimer()
{
setStartTime();
}
public void setStartTime()
{
startTime = System.currentTimeMillis();
}
public SystemElapsedTimer setEndTime()
{
endTime = System.currentTimeMillis();
return this;
}
public long getElapsedTime()
{
return (endTime - startTime);
}
public String toString()
{
long deltaMillis = getElapsedTime();
// deltaMillis = n + s*1000 + m*60*1000 + h*60*60*1000;
long millis = (deltaMillis) %1000;
long deltaSeconds = (deltaMillis) /1000;
long deltaMinutes = deltaSeconds / 60;
long hours = (int)(deltaMillis / (60 * 60 * 1000));
long minutes= (int)(deltaMinutes - (hours*60) );
long seconds= (int)(deltaSeconds - (hours*60*60) - (minutes*60));
String result = "Elapsed time: " + hours + " hours, " + //$NON-NLS-1$ //$NON-NLS-2$
minutes + " minutes, " + //$NON-NLS-1$
seconds + " seconds, " + //$NON-NLS-1$
millis + " milliseconds"; //$NON-NLS-1$
return result;
}
public void writeElapsedTime(PrintWriter writer, String header)
{
writer.println(header);
writer.println(toString());
writer.flush();
}
// the following methods are for testing purposes only
public static void main(String args[])
{
SystemElapsedTimer me = new SystemElapsedTimer();
me.setET(5, 4, 3, 100);
System.out.println(me);
me.setET(25, 14, 53, 999);
System.out.println(me);
me.setET(25, 0, 53, 0);
System.out.println(me);
me.setET(0, 0, 13, 0);
System.out.println(me);
}
public void setET(long h, long m, long s, long n)
{
long et = n + s*1000 + m*60*1000 + h*60*60*1000;
setET(et);
}
public void setET(long givenET)
{
startTime = 0L;
endTime = givenET;
}
}

View file

@ -27,6 +27,7 @@ import org.eclipse.rse.core.model.ISystemModelChangeEvents;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.internal.model.SystemModelChangeEvent;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.view.SystemPerspectiveHelpers;
import org.eclipse.rse.ui.view.SystemPerspectiveLayout;
import org.eclipse.rse.ui.view.SystemView;
import org.eclipse.rse.ui.view.SystemViewPart;

View file

@ -1,73 +0,0 @@
/********************************************************************************
* Copyright (c) 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;
/**
* The SortOperation takes a collection of objects and returns
* a sorted collection of these objects. Concrete instances of this
* class provide the criteria for the sorting of the objects based on
* the type of the objects.
*/
public abstract class SystemSorter {
/**
* Returns true is elementTwo is 'greater than' elementOne
* This is the 'ordering' method of the sort operation.
* Each subclass overides this method with the particular
* implementation of the 'greater than' concept for the
* objects being sorted.
*/
public abstract boolean compare(Object elementOne, Object elementTwo);
/**
* Sort the objects in sorted collection and return that collection.
*/
private Object[] quickSort(Object[] sortedCollection, int left, int right) {
int originalLeft = left;
int originalRight = right;
Object mid = sortedCollection[ (left + right) / 2];
do {
while (compare(sortedCollection[left], mid))
left++;
while (compare(mid, sortedCollection[right]))
right--;
if (left <= right) {
Object tmp = sortedCollection[left];
sortedCollection[left] = sortedCollection[right];
sortedCollection[right] = tmp;
left++;
right--;
}
} while (left <= right);
if (originalLeft < right)
sortedCollection = quickSort(sortedCollection, originalLeft, right);
if (left < originalRight)
sortedCollection = quickSort(sortedCollection, left, originalRight);
return sortedCollection;
}
/**
* Return a new sorted collection from this unsorted collection.
* Sort using quick sort.
*/
public Object[] sort(Object[] unSortedCollection) {
int size = unSortedCollection.length;
Object[] sortedCollection = new Object[size];
//copy the array so can return a new sorted collection
System.arraycopy(unSortedCollection, 0, sortedCollection, 0, size);
if (size > 1)
quickSort(sortedCollection, 0, size - 1);
return sortedCollection;
}
}

View file

@ -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:
* <code>
* SystemStringTokenizer tokens = new SystemStringTokenizer(stringToParse, "___");
* while (tokens.hasMoreTokens())
* String nextToken = tokens.nextToken();
* </code>
*/
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<inpLen; idx++)
{
int remLen = inpLen - idx;
char currChar = inputString.charAt(idx);
if ((currChar == delimChar1) && (remLen >= 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;
}
}