diff --git a/rse/plugins/org.eclipse.rse.services.dstore/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.services.dstore/META-INF/MANIFEST.MF
index e7e236af6ae..4d14d3e4768 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/META-INF/MANIFEST.MF
+++ b/rse/plugins/org.eclipse.rse.services.dstore/META-INF/MANIFEST.MF
@@ -8,8 +8,7 @@ Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.rse.services;bundle-version="[2.0.0,3.0.0)",
org.eclipse.dstore.core;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.dstore.extra;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.ui
+ org.eclipse.dstore.extra;bundle-version="[2.0.0,3.0.0)"
Eclipse-LazyStart: true
Export-Package: org.eclipse.rse.dstore.universal.miners,
org.eclipse.rse.internal.dstore.universal.miners.command;x-internal:=true,
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreFileTransferStatusListener.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreFileTransferStatusListener.java
deleted file mode 100644
index 8afb7cc1f46..00000000000
--- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreFileTransferStatusListener.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2004, 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.services.dstore.util;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.dstore.core.model.DE;
-import org.eclipse.dstore.core.model.DataElement;
-import org.eclipse.dstore.core.model.DataStore;
-import org.eclipse.dstore.core.model.DataStoreSchema;
-import org.eclipse.rse.services.clientserver.IServiceConstants;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author mjberger
- *
- * copyright 2003 IBM Corp.
- */
-public class DStoreFileTransferStatusListener extends StatusChangeListener
-{
-
- protected String _remotePath;
- protected DataElement _log;
- protected DataElement _statusElement;
-
- public DStoreFileTransferStatusListener(String remotePath, Shell shell, IProgressMonitor monitor, DataStore ds, DataElement uploadLog) throws Exception
- {
- super(shell, monitor);
- _remotePath = remotePath.replace('\\', '/');
-
- _log = uploadLog;
- if (_log == null)
- {
- throw new Exception("Could not find log in DataStore."); //$NON-NLS-1$
- }
- setStatus(findOrCreateUploadStatus(ds));
- }
-
- protected DataElement findOrCreateUploadStatus(DataStore ds)
- {
- DataElement result = ds.find(_log, DE.A_NAME, _remotePath,1);
-
- // first upload, this will always ben null
- // but also need to handle case where it's been uploaded before in the sessoin (i.e. for reseting values)
- if (result == null)
- {
- result = _log.getDataStore().createObject(_log, "uploadstatus", _remotePath); //$NON-NLS-1$
- result.setAttribute(DE.A_SOURCE, "running"); //$NON-NLS-1$
- result.setAttribute(DE.A_VALUE, ""); //$NON-NLS-1$
-
- DataElement cmd = ds.findCommandDescriptor(DataStoreSchema.C_SET);
-
-// DataElement setstatus = ds.command(cmd, _log, true);
- ds.command(cmd, _log, true);
- /*
- try
- {
- StatusMonitorFactory.getInstance().getStatusMonitorFor(system, ds).waitForUpdate(setstatus);
- }
- catch (Exception e)
- {
- }
- */
- // DKM: no need for this - turns out the problem was that we need to send the LOG not the result -
- // since the server needs to know the parent!
- //ds.waitUntil(setstatus, "done");
-
- }
- else
- {
-
- result.setAttribute(DE.A_SOURCE, "running"); //$NON-NLS-1$
- result.setAttribute(DE.A_VALUE, ""); //$NON-NLS-1$
- }
- _statusElement = result;
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.services.dstore.util.StatusChangeListener#determineStatusDone()
- */
- protected boolean determineStatusDone()
- {
- return getStatus().getAttribute(DE.A_SOURCE).equals(IServiceConstants.SUCCESS) || getStatus().getAttribute(DE.A_SOURCE).equals(IServiceConstants.FAILED);
-
- }
-
- public boolean uploadHasFailed()
- {
- return getStatus().getAttribute(DE.A_SOURCE).equals(IServiceConstants.FAILED);
- }
-
- public String getErrorMessage()
- {
- return getStatus().getAttribute(DE.A_VALUE);
- }
-
- public String getRemotePath()
- {
- return _remotePath;
- }
-
- public void setRemotePath(String remotePath)
- {
- _remotePath = remotePath;
- }
-
-
-}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreStatusMonitor.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreStatusMonitor.java
index 3a7ea0d0ce1..2a2cabe34a7 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreStatusMonitor.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DStoreStatusMonitor.java
@@ -14,6 +14,7 @@
* Contributors:
* David McKnight (IBM) - [190803] Canceling a long-running dstore job prints "InterruptedException" to stdout
* David McKnight (IBM) - [190010] When status is "cancelled" the wait should complete
+ * David McKnight (IBM) - [197480] eliminating UI dependencies
*******************************************************************************/
package org.eclipse.rse.services.dstore.util;
@@ -28,8 +29,6 @@ import org.eclipse.dstore.core.model.DataStore;
import org.eclipse.dstore.extra.DomainEvent;
import org.eclipse.dstore.extra.IDomainListener;
import org.eclipse.dstore.extra.IDomainNotifier;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
/*
@@ -49,8 +48,6 @@ import org.eclipse.swt.widgets.Shell;
public class DStoreStatusMonitor implements IDomainListener
{
- protected Shell _shell;
-
protected boolean _networkDown = false;
protected List _workingStatuses;
@@ -59,30 +56,7 @@ public class DStoreStatusMonitor implements IDomainListener
protected DataStore _dataStore;
- protected class FindShell implements Runnable
- {
- private Shell shell;
-
- /**
- * @see Runnable#run()
- */
- public void run()
- {
- Display display = Display.getCurrent();
- if (display != null)
- {
- try {
- Shell[] shells = Display.getCurrent().getShells();
- for (int loop = 0; loop < shells.length && shell == null; loop++) {
- if (shells[loop].isEnabled()) {
- shell = shells[loop];
- }
- }
- } catch (Exception e) {
- }
- }
- }
- }
+
/**
* Construct a StatusChangeListener
@@ -233,18 +207,7 @@ public class DStoreStatusMonitor implements IDomainListener
return false;
}
- public Shell getShell()
- {
- // dy: DomainNotifier (which calls this method) requires the shell not be disposed
- //if (shell == null) {
- if (_shell == null || _shell.isDisposed())
- {
- FindShell findShell = new FindShell();
- Display.getDefault().syncExec(findShell);
- _shell = findShell.shell;
- }
- return _shell;
- }
+
@@ -285,8 +248,6 @@ public class DStoreStatusMonitor implements IDomainListener
}
setWorking(status);
-
- Display display = Display.getCurrent();
// Prevent infinite looping by introducing a threshold for wait
@@ -298,54 +259,7 @@ public class DStoreStatusMonitor implements IDomainListener
int nudges = 0; // nudges used for waking up server with slow connections
// nudge up to 12 times before giving up
-
- if (display != null)
- {
- // Current thread is UI thread
- while (_workingStatuses.contains(status))
- {
-
- while (display.readAndDispatch()) {
- //Process everything on event queue
- }
- /*
- if ((monitor != null) && (monitor.isCanceled()))
- {
- setCancelled(status);
- throw new InterruptedException();
- }
- */
-
- boolean statusDone = determineStatusDone(status);
-
- if (statusDone)
- {
- setDone(status);
- }
- else
- {
- waitForUpdate();
- //Thread.sleep(100);
-
- if (WaitThreshold > 0) // update timer count if
- // threshold not reached
- --WaitThreshold; // decrement the timer count
-
- if (WaitThreshold == 0)
- {
- // no diagnostic factory but there is a timeout
- return status; // returning the undone status object
- }
- else if (_networkDown)
- {
- dispose();
- throw new InterruptedException();
- }
- }
- }
-
- }
- else
+
{
// Current thread is not UI thread
while (_workingStatuses.contains(status))
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DownloadListener.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DownloadListener.java
index 64c3431b49b..eb80426e990 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DownloadListener.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/DownloadListener.java
@@ -13,6 +13,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
* David McKnight (IBM) - [162195] new APIs for upload multi and download multi
+ * David McKnight (IBM) - [197480] eliminating UI dependencies
********************************************************************************/
package org.eclipse.rse.services.dstore.util;
@@ -31,7 +32,6 @@ import org.eclipse.dstore.extra.IDomainListener;
import org.eclipse.rse.dstore.universal.miners.IUniversalDataStoreConstants;
import org.eclipse.rse.internal.services.dstore.ServiceResources;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.swt.widgets.Display;
public class DownloadListener implements IDomainListener
{
@@ -40,7 +40,6 @@ public class DownloadListener implements IDomainListener
private IProgressMonitor _monitor;
private DataStore _dataStore;
private File _localFile;
- private Display _display;
private boolean _networkDown = false;
private boolean _isDone = false;
@@ -55,7 +54,6 @@ public class DownloadListener implements IDomainListener
_monitor = monitor;
_status = status;
_totalLength = totalLength;
- _display = Display.getCurrent();
if (_status == null)
{
@@ -242,7 +240,6 @@ public class DownloadListener implements IDomainListener
*/
public DataElement waitForUpdate(int wait) throws InterruptedException
{
- Display display = _display;
if (wait > 0)
{
@@ -251,45 +248,7 @@ public class DownloadListener implements IDomainListener
{
}
-
-
- if (display != null)
- {
-
- // Current thread is UI thread
- while (!_isDone && !_isCancelled && !_networkDown)
- {
- while (display.readAndDispatch()) {
- //Process everything on event queue
- }
-
- if ((_monitor != null) && (_monitor.isCanceled()))
- {
- // cancel remote request
- cancelDownload();
- _isCancelled = true;
- setDone(true);
- }
- else if (_networkDown)
- {
- _isCancelled = true;
- setDone(true);
- throw new InterruptedException();
- }
-
- if (getStatus().getAttribute(DE.A_NAME).equals("done")) //$NON-NLS-1$
- {
- setDone(true);
- }
- else
- {
- Thread.sleep(100);
- updateDownloadState();
- }
- }
-
- }
- else
+
{
// Current thread is not UI thread
while (!_isDone && !_isCancelled && !_networkDown)
diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/StatusChangeListener.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/StatusChangeListener.java
deleted file mode 100644
index d6281a274c0..00000000000
--- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/services/dstore/util/StatusChangeListener.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * 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.services.dstore.util;
-
-
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.dstore.core.model.DE;
-import org.eclipse.dstore.core.model.DataElement;
-import org.eclipse.dstore.extra.DomainEvent;
-import org.eclipse.dstore.extra.IDomainListener;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/*
- * Utility class for determining when a DataStore command is complete via the status.
- */
-public class StatusChangeListener implements IDomainListener
-{
-
- protected DataElement target;
- protected Shell shell;
- protected IProgressMonitor monitor;
-
- protected boolean _networkDown = false;
- protected boolean done = false;
- protected boolean cancelled = false;
-
- protected Vector historyOfTargets;
-
- protected static class FindShell implements Runnable {
- private Shell shell;
-
- /**
- * @see Runnable#run()
- */
- public void run() {
- try {
- Shell[] shells = Display.getCurrent().getShells();
- for (int loop = 0; loop < shells.length && shell == null; loop++) {
- if (shells[loop].isEnabled()) {
- shell = shells[loop];
- }
- }
- } catch (Exception e) {
- }
- }
- }
-
-
- /**
- * Construct a StatusChangeListener
- *
- * @param shell A valid Shell object
- *
- * @param monitor A progress monitor if you want this object to check if
- * the user presses cancel while waiting for the status object
- * to be updated
- *
- * @param target The status DataElement for which you wish to wait for an update
- */
- public StatusChangeListener(Shell shell, IProgressMonitor monitor, DataElement target) {
- this.shell = shell;
- this.monitor = monitor;
- this.target = target;
- historyOfTargets = new Vector();
- }
-
-
- public StatusChangeListener(Shell shell, IProgressMonitor monitor) {
- this(shell, monitor, null);
- }
-
-
-// public StatusChangeListener(Shell shell, DataElement target) {
-// this(shell, null, target);
-// }
-
-
- /**
- *
- */
- public void setStatus(DataElement p_target)
- {
- this.target = p_target;
-
- for (int i = 0; i < historyOfTargets.size(); i++)
- {
- if (target == historyOfTargets.elementAt(i))
- {
- setDone( true );
- historyOfTargets.clear();
- return;
- }
- }
-
- historyOfTargets.clear();
- }
-
- /**
- *
- */
- public DataElement getStatus()
- {
- return target;
- }
-
- /**
- * @see IDomainListener#listeningTo(DomainEvent)
- */
- public boolean listeningTo(DomainEvent event) {
- if (target == null)
- {
- return true;
- }
-
- if (target == event.getParent()) {
- return true;
- }
-
- return false;
- }
-
-
- /**
- * @see IDomainListener#domainChanged(DomainEvent)
- */
- public void domainChanged(DomainEvent event) {
- if (target == null)
- {
- if (historyOfTargets.size() < 1000)
- {
- historyOfTargets.addElement(event.getParent());
- }
- }
-
- if (target == event.getParent())
- {
- boolean isStatusDone = determineStatusDone();
-
- if (isStatusDone)
- {
- setDone( true );
- }
- }
- }
-
-
- /**
- * setDone(boolean)
- */
- public void setDone(boolean done)
- {
- this.done = done;
- }
-
- public Shell getShell() {
- // dy: DomainNotifier (which calls this method) requires the shell not be disposed
- //if (shell == null) {
- if (shell == null || shell.isDisposed())
- {
- FindShell findShell = new FindShell();
- Display.getDefault().syncExec(findShell);
- shell = findShell.shell;
- }
- return shell;
- }
-
- /**
- *
- */
- public boolean wasCancelled() {
- return cancelled;
- }
-
-
-
-
- /**
- * Wait for the the status DataElement to be refreshed.
- *
- * @return The status DataElement after it has been updated, or the user
- * has pressed cancel
- *
- * @throws InterruptedException if the thread was interrupted.
- */
- public DataElement waitForUpdate() throws InterruptedException
- {
- return waitForUpdate( 0); //No diagnostic
- }
-
-
- /**
- * Wait for the the status DataElement to be refreshed.
- *
- * @param wait threshold for starting diagnostic. Default is 60 seconds; a zero means to use the default.
- * -1 means to force a timeout; mainly for testing purpose.
- *
- * @return The status DataElement after it has been updated, or the user
- * has pressed cancel
- *
- * @throws InterruptedException if the thread was interrupted.
- */
- public DataElement waitForUpdate(int wait) throws InterruptedException
- {
- boolean statusDone = determineStatusDone();
- if (statusDone)
- {
- setDone(true);
- }
- else
- {
- Display display = Display.getCurrent();
-
- if ( wait > 0 )
- {
- }
- else if ( wait == -1 )
- {
- }
-
-
- if (display != null) {
- if (shell == null || shell.isDisposed()) {
- shell = Display.getDefault().getActiveShell();
- }
- // Current thread is UI thread
- while (!done && !cancelled) {
- while (display.readAndDispatch()) {
- //Process everything on event queue
- }
-
- if ((monitor != null) && (monitor.isCanceled())) {
- cancelled = true;
- target.getDataStore().getDomainNotifier().removeDomainListener(this);
- throw new InterruptedException();
- }
-
- statusDone = determineStatusDone();
-
- if (statusDone)
- {
- setDone(true);
- }
- else
- {
- Thread.sleep(100);
- if (_networkDown)
- {
- target.getDataStore().getDomainNotifier().removeDomainListener(this);
- throw new InterruptedException();
- }
- }
- }
-
- } else {
- // Current thread is not UI thread
- while (!done && !cancelled)
- {
-
- if ((monitor != null) && (monitor.isCanceled()))
- {
- cancelled = true;
- target.getDataStore().getDomainNotifier().removeDomainListener(this);
- throw new InterruptedException();
- }
-
- statusDone = determineStatusDone();
-
- if (statusDone)
- {
- setDone(true);
- }
- else {
- Thread.sleep(100);
-
- if (_networkDown)
- {
- target.getDataStore().getDomainNotifier().removeDomainListener(this);
- throw new InterruptedException();
- }
- }
- }
- }
- }
-
- // Reset done so we can detect the next event if waitForUpdate
- // is called again
- done = false;
-
- return target;
- }
-
- /**
- * Determines whether the status is done.
- * @return true
if status done, false
otherwise.
- */
- protected boolean determineStatusDone() {
- return getStatus().getAttribute(DE.A_VALUE).equals("done") || getStatus().getAttribute(DE.A_NAME).equals("done"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- public boolean isPassiveCommunicationsListener() {
- return false;
- }
-
-
- /**
- * Test if the StatusChangeListener returned because the network connection to the
- * remote system was broken.
- */
- public boolean isNetworkDown() {
- return _networkDown;
- }
-}