1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 09:15:38 +02:00

[225510][api] Fix OutputRefreshJob API leakage

This commit is contained in:
Martin Oberhuber 2008-04-03 09:45:01 +00:00
parent a7c5de4b79
commit c2d0336a1b
6 changed files with 171 additions and 196 deletions

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
* Copyright (c) 2002, 2008 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
@ -287,7 +287,8 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh
/**
* Set the current working directory for this command
* @param file
*
* @param file the working directory.
*/
public void setWorkingDirectory(IRemoteFile file)
{

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2008 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
@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
*******************************************************************************/
package org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem;
@ -34,7 +34,7 @@ import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteOutput;
public class ServiceCommandShell extends RemoteCommandShell implements IServiceCommandShell
{
protected IHostShell _hostShell;
protected OutputRefreshJob _lastRefreshJob;
private OutputRefreshJob _lastRefreshJob;
public ServiceCommandShell(IRemoteCmdSubSystem cmdSS, IHostShell hostShell)
{
super(cmdSS);
@ -88,6 +88,7 @@ public class ServiceCommandShell extends RemoteCommandShell implements IServiceC
outputs[i] = output;
}
}
// FIXME unify with notifyListeners() below?
if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
{
_lastRefreshJob = new OutputRefreshJob(this, outputs, false);
@ -99,6 +100,25 @@ public class ServiceCommandShell extends RemoteCommandShell implements IServiceC
}
}
/**
* Notify listeners about new outputs. This will update any shell views with
* the new data.
*
* @param outputs the output objects to notify
* @param cwdChanged <code>true</code> if the current directory changed
* @since org.eclipse.rse.subsystems.shells.core 3.0
*/
protected void notifyOutputChanged(IRemoteOutput[] outputs, boolean cwdChanged) {
// if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
{
_lastRefreshJob = new OutputRefreshJob(this, outputs, cwdChanged);
_lastRefreshJob.schedule();
}
/*
* else { _lastRefreshJob.addOutputs(outputs);
* _lastRefreshJob.schedule(); }
*/
}
public ICandidateCommand[] getCandidateCommands()
{

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2008 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
@ -12,8 +12,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [202822] cleanup output datalements after use
* David McKnight (IBM) - [202822] cleanup output datalements after use
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.shells.dstore;
@ -26,7 +26,6 @@ import org.eclipse.dstore.extra.IDomainListener;
import org.eclipse.rse.internal.services.dstore.shells.DStoreHostOutput;
import org.eclipse.rse.internal.services.dstore.shells.DStoreHostShell;
import org.eclipse.rse.internal.services.dstore.shells.DStoreShellOutputReader;
import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob;
import org.eclipse.rse.services.shells.IHostOutput;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
@ -200,18 +199,7 @@ public class DStoreServiceCommandShell extends ServiceCommandShell
outputs[i] = output;
}
}
//if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
{
_lastRefreshJob = new OutputRefreshJob(this, outputs, false);
_lastRefreshJob.schedule();
}
/*
else
{
_lastRefreshJob.addOutputs(outputs);
_lastRefreshJob.schedule();
}
*/
notifyOutputChanged(outputs, false);
}
public boolean isActive()

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2008 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
@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.shells.local.model;
@ -22,7 +22,6 @@ import java.io.File;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob;
import org.eclipse.rse.services.shells.IHostOutput;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
@ -141,18 +140,7 @@ public class LocalServiceCommandShell extends ServiceCommandShell
addOutput(output);
outputs[i] = output;
}
//if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
{
_lastRefreshJob = new OutputRefreshJob(this, outputs, false);
_lastRefreshJob.schedule();
}
/*
else
{
_lastRefreshJob.addOutputs(outputs);
_lastRefreshJob.schedule();
}
*/
notifyOutputChanged(outputs, false);
}
public void writeToShell(String cmd)

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2008 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
@ -13,6 +13,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - Adapted from LocalServiceCommandShell
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.shells.ssh;
@ -26,7 +27,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.internal.services.ssh.shell.SshHostShell;
import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob;
import org.eclipse.rse.services.shells.IHostOutput;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
@ -169,18 +169,7 @@ public class SshServiceCommandShell extends ServiceCommandShell
outputs.add(output);
}
IRemoteOutput[] remoteOutputs = (IRemoteOutput[])outputs.toArray(new IRemoteOutput[outputs.size()]);
//if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
{
_lastRefreshJob = new OutputRefreshJob(this, remoteOutputs, false);
_lastRefreshJob.schedule();
}
/*
else
{
_lastRefreshJob.addOutputs(remoteOutputs);
_lastRefreshJob.schedule();
}
*/
notifyOutputChanged(remoteOutputs, false);
}
/**

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation and others.
* Copyright (c) 2006, 2008 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
@ -14,6 +14,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - Adapted from LocalServiceCommandShell
* Sheldon D'souza (Celunite) - Adapted from SshServiceCommandShell
* Martin Oberhuber (Wind River) - [225510][api] Fix OutputRefreshJob API leakage
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.shells.telnet;
@ -25,7 +26,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.internal.services.telnet.shell.TelnetHostShell;
import org.eclipse.rse.internal.subsystems.shells.servicesubsystem.OutputRefreshJob;
import org.eclipse.rse.services.shells.IHostOutput;
import org.eclipse.rse.services.shells.IHostShell;
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
@ -162,18 +162,7 @@ public class TelnetServiceCommandShell extends ServiceCommandShell {
outputs.add(output);
}
IRemoteOutput[] remoteOutputs = (IRemoteOutput[])outputs.toArray(new IRemoteOutput[outputs.size()]);
//if (_lastRefreshJob == null || _lastRefreshJob.isComplete())
{
_lastRefreshJob = new OutputRefreshJob(this, remoteOutputs, false);
_lastRefreshJob.schedule();
}
/*
else
{
_lastRefreshJob.addOutputs(remoteOutputs);
_lastRefreshJob.schedule();
}
*/
notifyOutputChanged(remoteOutputs, false);
}
/**