Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-08-12 16:59:08 +0000
committerUwe Stieber2012-08-12 16:59:08 +0000
commit8e75b57e4a49282013a4d70d8844373bbe623c96 (patch)
treeefa7351f6390519ef1d2725f77f6e355255dbb5a /target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core
parent87db079b512afec89f418e1b2797d9da2127e112 (diff)
downloadorg.eclipse.tcf-8e75b57e4a49282013a4d70d8844373bbe623c96.tar.gz
org.eclipse.tcf-8e75b57e4a49282013a4d70d8844373bbe623c96.tar.xz
org.eclipse.tcf-8e75b57e4a49282013a4d70d8844373bbe623c96.zip
Target Explorer: Bug 378625 - [Terminals] Cannot open two tabs to the same host in one view
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java102
2 files changed, 71 insertions, 32 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java
index 9da0fc1a1..f0a563064 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsLauncher.java
@@ -405,6 +405,7 @@ public class TerminalsLauncher extends PlatformObject implements ITerminalsLaunc
PropertiesContainer props = new PropertiesContainer();
props.setProperty(ITerminalsConnectorConstants.PROP_CONNECTOR_TYPE_ID, "org.eclipse.tcf.te.ui.terminals.type.terminals"); //$NON-NLS-1$
props.setProperty(ITerminalsConnectorConstants.PROP_ID, "org.eclipse.tcf.te.ui.terminals.TerminalsView"); //$NON-NLS-1$
+ props.setProperty(ITerminalsConnectorConstants.PROP_FORCE_NEW, true);
// Set the terminal tab title
String terminalTitle = getTerminalTitle();
if (terminalTitle != null) {
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java
index ec094c2ae..21ea4aa62 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.terminals.core/src/org/eclipse/tcf/te/tcf/terminals/core/launcher/TerminalsStreamsListener.java
@@ -311,18 +311,7 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
// Disconnect from the stream
if (svcStreams != null) {
- svcStreams.disconnect(streamId, new IStreams.DoneDisconnect() {
- @Override
- @SuppressWarnings("synthetic-access")
- public void doneDisconnect(IToken token, Exception error) {
- synchronized (this) {
- // Mark the runnable definitely stopped
- stopped = true;
- }
- // Disconnect is done, ignore any error, invoke the callback
- if (getCallback() != null) getCallback().done(this, Status.OK_STATUS);
- }
- });
+ disconnect(svcStreams, streamId);
} else {
synchronized (this) {
// Mark the runnable definitely stopped
@@ -374,6 +363,36 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
}
/**
+ * Disconnects from the stream.
+ *
+ * @param service The streams service. Must not be <code>null</code>.
+ * @param streamId The stream id. Must not be <code>null</code>.
+ */
+ protected final void disconnect(final IStreams service, final String streamId) {
+ Assert.isNotNull(service);
+ Assert.isNotNull(streamId);
+ Assert.isTrue(!Protocol.isDispatchThread());
+
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ service.disconnect(streamId, new IStreams.DoneDisconnect() {
+ @Override
+ @SuppressWarnings("synthetic-access")
+ public void doneDisconnect(IToken token, Exception error) {
+ synchronized (this) {
+ // Mark the runnable definitely stopped
+ stopped = true;
+ }
+ // Disconnect is done, ignore any error, invoke the callback
+ if (getCallback() != null) getCallback().done(this, Status.OK_STATUS);
+ }
+ });
+ }
+ });
+ }
+
+ /**
* Notify the data receiver that some data has been received.
*
* @param data The data or <code>null</code>.
@@ -560,25 +579,7 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
// Disconnect from the stream
if (svcStreams != null) {
- // Write EOS first
- svcStreams.eos(streamId, new IStreams.DoneEOS() {
- @Override
- public void doneEOS(IToken token, Exception error) {
- // Disconnect now
- svcStreams.disconnect(streamId, new IStreams.DoneDisconnect() {
- @Override
- @SuppressWarnings("synthetic-access")
- public void doneDisconnect(IToken token, Exception error) {
- synchronized (this) {
- // Mark the runnable definitely stopped
- stopped = true;
- }
- // Disconnect is done, ignore any error, invoke the callback
- if (getCallback() != null) getCallback().done(this, Status.OK_STATUS);
- }
- });
- }
- });
+ disconnect(svcStreams, streamId);
} else {
synchronized (this) {
// Mark the runnable definitely stopped
@@ -628,7 +629,44 @@ public class TerminalsStreamsListener implements IStreams.StreamsListener, ITerm
// Execute the write
task.get();
}
- }
+
+ /**
+ * Disconnects from the stream.
+ *
+ * @param service The streams service. Must not be <code>null</code>.
+ * @param streamId The stream id. Must not be <code>null</code>.
+ */
+ protected final void disconnect(final IStreams service, final String streamId) {
+ Assert.isNotNull(service);
+ Assert.isNotNull(streamId);
+ Assert.isTrue(!Protocol.isDispatchThread());
+
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ // Write EOS first
+ service.eos(streamId, new IStreams.DoneEOS() {
+ @Override
+ public void doneEOS(IToken token, Exception error) {
+ // Disconnect now
+ service.disconnect(streamId, new IStreams.DoneDisconnect() {
+ @Override
+ @SuppressWarnings("synthetic-access")
+ public void doneDisconnect(IToken token, Exception error) {
+ synchronized (this) {
+ // Mark the runnable definitely stopped
+ stopped = true;
+ }
+ // Disconnect is done, ignore any error, invoke the callback
+ if (getCallback() != null) getCallback().done(this, Status.OK_STATUS);
+ }
+ });
+ }
+ });
+ }
+ });
+ }
+}
/**
* Constructor.

Back to the top