Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 94374 Details for
Bug 224989
[terminal][api] Support contributed services over Terminal connections
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to add requested feature
Terminal.patch (text/plain), 14.70 KB, created by
Alex Chapiro
on 2008-04-01 11:20:50 EDT
(
hide
)
Description:
Patch to add requested feature
Filename:
MIME Type:
Creator:
Alex Chapiro
Created:
2008-04-01 11:20:50 EDT
Size:
14.70 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tm.terminal >Index: src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java,v >retrieving revision 1.18 >diff -u -r1.18 VT100TerminalControl.java >--- src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java 29 Feb 2008 16:48:59 -0000 1.18 >+++ src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java 1 Apr 2008 14:42:56 -0000 >@@ -20,6 +20,8 @@ > * Michael Scharf (Wind River) - [209665] Add ability to log byte streams from terminal > * Ruslan Sychev (Xored Software) - [217675] NPE or SWTException when closing Terminal View while connection establishing > * Michael Scharf (Wing River) - [196447] The optional terminal input line should be resizeable >+ * Alex Chapiro (QNX) - [224989] Expanded interface with change of state >+ * notification infrastructure > *******************************************************************************/ > package org.eclipse.tm.internal.terminal.emulator; > >@@ -27,6 +29,10 @@ > import java.io.OutputStream; > import java.io.UnsupportedEncodingException; > import java.net.SocketException; >+import java.util.ArrayList; >+import java.util.Collections; >+import java.util.Iterator; >+import java.util.List; > > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; >@@ -84,7 +90,7 @@ > * in this package). > * > * @author Chris Thew <chris.thew@windriver.com> >- */ >+ **/ > public class VT100TerminalControl implements ITerminalControlForText, ITerminalControl, ITerminalViewControl > { > protected final static String[] LINE_DELIMITERS = { "\n" }; //$NON-NLS-1$ >@@ -113,6 +119,8 @@ > > private final ITerminalTextData fTerminalModel; > >+ private List fSynchronizedTerminalListeners; >+ > /** > * Is protected by synchronize on this > */ >@@ -904,6 +912,7 @@ > public void setState(TerminalState state) { > fState=state; > fTerminalListener.setState(state); >+ notifyTerminalStateChanged(state); > } > > public String getSettingsSummary() { >@@ -955,4 +964,32 @@ > public void setInvertedColors(boolean invert) { > fCtlText.setInvertedColors(invert); > } >+ >+ public void addTerminalStateListener(ITerminalListener listener) { >+ if(null == fSynchronizedTerminalListeners) >+ fSynchronizedTerminalListeners = Collections.synchronizedList(new ArrayList()); >+ >+ synchronized(fSynchronizedTerminalListeners) { >+ if(!fSynchronizedTerminalListeners.contains(listener)) >+ fSynchronizedTerminalListeners.add(listener); >+ } >+ } >+ >+ public void removeTerminalStateListener(ITerminalListener listener) { >+ synchronized(fSynchronizedTerminalListeners) { >+ if(null != fSynchronizedTerminalListeners) >+ fSynchronizedTerminalListeners.remove(listener); >+ } >+ } >+ >+ private void notifyTerminalStateChanged(TerminalState newState) { >+ synchronized(fSynchronizedTerminalListeners) { >+ if(null != fSynchronizedTerminalListeners) { >+ for(Iterator i = fSynchronizedTerminalListeners.iterator(); i.hasNext(); ) { >+ ((ITerminalListener)i.next()).setState(newState); >+ } >+ } >+ } >+ } >+ > } >Index: src/org/eclipse/tm/internal/terminal/provisional/api/ITerminalConnector.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/ITerminalConnector.java,v >retrieving revision 1.4 >diff -u -r1.4 ITerminalConnector.java >--- src/org/eclipse/tm/internal/terminal/provisional/api/ITerminalConnector.java 26 May 2007 04:15:43 -0000 1.4 >+++ src/org/eclipse/tm/internal/terminal/provisional/api/ITerminalConnector.java 1 Apr 2008 14:42:56 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. >+ * Copyright (c) 2006, 2008 Wind River Systems, Inc. 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 >@@ -8,9 +8,12 @@ > * Contributors: > * Michael Scharf (Wind River) - initial API and implementation > * Martin Oberhuber (Wind River) - fixed copyright headers and beautified >+ * Alex Chapiro (QNX) - added public method to get access to InputStream >+ * associated with current connection > *******************************************************************************/ > package org.eclipse.tm.internal.terminal.provisional.api; > >+import java.io.InputStream; > import java.io.OutputStream; > > >@@ -64,6 +67,11 @@ > */ > OutputStream getOutputStream(); > >+ /** >+ * @return a stream through which we send data to the remote site. >+ */ >+ InputStream getInputStream(); >+ > /** > * Load the state of this connection. Is typically called before > * {@link #connect(ITerminalControl)}. >Index: src/org/eclipse/tm/internal/terminal/provisional/api/TerminalConnectorExtension.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/TerminalConnectorExtension.java,v >retrieving revision 1.7 >diff -u -r1.7 TerminalConnectorExtension.java >--- src/org/eclipse/tm/internal/terminal/provisional/api/TerminalConnectorExtension.java 6 Jun 2007 17:37:04 -0000 1.7 >+++ src/org/eclipse/tm/internal/terminal/provisional/api/TerminalConnectorExtension.java 1 Apr 2008 14:42:58 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. >+ * Copyright (c) 2006, 2008 Wind River Systems, Inc. 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 >@@ -8,9 +8,12 @@ > * Contributors: > * Michael Scharf (Wind River) - initial API and implementation > * Martin Oberhuber (Wind River) - fixed copyright headers and beautified >+ * Alex Chapiro (QNX) - added public method to get access to InputStream >+ * associated with current connection > *******************************************************************************/ > package org.eclipse.tm.internal.terminal.provisional.api; > >+import java.io.InputStream; > import java.io.OutputStream; > import java.util.ArrayList; > import java.util.List; >@@ -22,7 +25,6 @@ > * A factory to get {@link ITerminalConnector} instances. > * > * @author Michael Scharf >- * > * <p> > * <strong>EXPERIMENTAL</strong>. This class or interface has been added as > * part of a work in progress. There is no guarantee that this API will >@@ -133,6 +135,9 @@ > public OutputStream getOutputStream() { > return getConnector().getOutputStream(); > } >+ public InputStream getInputStream() { >+ return getConnector().getInputStream(); >+ } > public String getSettingsSummary() { > if(fConnector!=null) > return getConnector().getSettingsSummary(); >Index: src/org/eclipse/tm/internal/terminal/control/ITerminalViewControl.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/control/ITerminalViewControl.java,v >retrieving revision 1.10 >diff -u -r1.10 ITerminalViewControl.java >--- src/org/eclipse/tm/internal/terminal/control/ITerminalViewControl.java 13 Oct 2007 02:19:59 -0000 1.10 >+++ src/org/eclipse/tm/internal/terminal/control/ITerminalViewControl.java 1 Apr 2008 14:42:55 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. >+ * Copyright (c) 2006, 2008 Wind River Systems, Inc. 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 >@@ -8,6 +8,8 @@ > * Contributors: > * Michael Scharf (Wind River) - initial API and implementation > * Martin Oberhuber (Wind River) - fixed copyright headers and beautified >+ * Alex Chapiro (QNX) - [224989] Expanded interface with change of state >+ * notification infrastructure > *******************************************************************************/ > package org.eclipse.tm.internal.terminal.control; > >@@ -19,7 +21,6 @@ > > /** > * @author Michael Scharf >- * > */ > public interface ITerminalViewControl { > boolean isEmpty(); >@@ -76,4 +77,21 @@ > public void setBufferLineLimit(int bufferLineLimit); > boolean isScrollLock(); > void setScrollLock(boolean on); >+ >+ /** >+ * Attach listener to the control to be notified >+ * if status of connection, associated with this >+ * control has been changed >+ * @param listener >+ */ >+ void addTerminalStateListener(ITerminalListener listener); >+ >+ /** >+ * Detach listener attached to the control to be notified >+ * if status of connection, associated with this >+ * control has been changed >+ * @param listener >+ */ >+ void removeTerminalStateListener(ITerminalListener listener); >+ > } >\ No newline at end of file >#P org.eclipse.tm.terminal.view >Index: src/org/eclipse/tm/internal/terminal/view/ITerminalView.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ITerminalView.java,v >retrieving revision 1.4 >diff -u -r1.4 ITerminalView.java >--- src/org/eclipse/tm/internal/terminal/view/ITerminalView.java 11 Oct 2007 20:00:56 -0000 1.4 >+++ src/org/eclipse/tm/internal/terminal/view/ITerminalView.java 1 Apr 2008 14:42:58 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. >+ * Copyright (c) 2006, 2008 Wind River Systems, Inc. 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 >@@ -7,10 +7,16 @@ > * > * Contributors: > * Michael Scharf (Wind River) - initial API and implementation >+ * Alex Chapiro (QNX) - [224989] Expanded interface with change of state >+ * notification infrastructure, and exposed ITerminalConnectorInfo > *******************************************************************************/ > package org.eclipse.tm.internal.terminal.view; > >-public interface ITerminalView { >+import org.eclipse.tm.internal.terminal.control.ITerminalListener; >+import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnectorInfo; >+import org.eclipse.ui.IViewPart; >+ >+public interface ITerminalView extends IViewPart { > > /** > * Display a new Terminal view. This method is called when the user clicks the New >@@ -30,4 +36,25 @@ > public void setCommandInputField(boolean on); > public boolean isScrollLock(); > public void setScrollLock(boolean b); >+ /** >+ * @return reference to the instance of {@link ITerminalConnectorInfo} >+ * connected to this terminal view >+ */ >+ public ITerminalConnectorInfo getTerminalConnectorInfo(); >+ >+ /** >+ * Attach listener to the view to be notified >+ * if status of connection, associated with this >+ * control has been changed >+ * @param listener >+ */ >+ void addTerminalStateListener(ITerminalListener listener); >+ >+ /** >+ * Detach listener attached to the view to be notified >+ * if status of connection, associated with this >+ * control has been changed >+ * @param listener >+ */ >+ void removeTerminalStateListener(ITerminalListener listener); > } >Index: src/org/eclipse/tm/internal/terminal/view/TerminalView.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java,v >retrieving revision 1.24 >diff -u -r1.24 TerminalView.java >--- src/org/eclipse/tm/internal/terminal/view/TerminalView.java 26 Feb 2008 02:44:06 -0000 1.24 >+++ src/org/eclipse/tm/internal/terminal/view/TerminalView.java 1 Apr 2008 14:43:00 -0000 >@@ -17,6 +17,8 @@ > * Michael Scharf (Wind River) - [209656] ClassCastException in TerminalView under Eclipse-3.4M3 > * Michael Scharf (Wind River) - [189774] Ctrl+V does not work in the command input field. > * Michael Scharf (Wind River) - [217999] Duplicate context menu entries in Terminal >+ * Alex Chapiro (QNX) - [224989] Expanded interface with change of state >+ * notification infrastructure, and exposed ITerminalConnectorInfo > *******************************************************************************/ > package org.eclipse.tm.internal.terminal.view; > >@@ -111,6 +113,7 @@ > private SettingsStore fStore; > > private CommandInputFieldWithHistory fCommandInputField; >+ > > /** > * Listens to changes in the preferences >@@ -239,6 +242,10 @@ > public void onTerminalDisconnect() { > fCtlTerminal.disconnectTerminal(); > } >+ >+ public TerminalState getState() { >+ return fCtlTerminal.getState(); >+ } > > public void updateTerminalDisconnect() { > boolean bEnabled = ((isConnecting()) || (fCtlTerminal.isConnected())); >@@ -430,6 +437,7 @@ > > onTerminalStatus(); > onTerminalFontChanged(); >+ > } > public void dispose() { > Logger.log("entered."); //$NON-NLS-1$ >@@ -453,6 +461,7 @@ > protected void setupControls(Composite wndParent) { > ITerminalConnectorInfo[] connectors=TerminalConnectorExtension.getTerminalConnectors(); > fCtlTerminal = TerminalViewControlFactory.makeControl(this, wndParent, connectors); >+ fCtlTerminal.addTerminalStateListener(this); > String connectionType=fStore.get(STORE_CONNECTION_TYPE); > for (int i = 0; i < connectors.length; i++) { > connectors[i].getConnector().load(getStore(connectors[i])); >@@ -609,4 +618,17 @@ > public void setScrollLock(boolean on) { > fCtlTerminal.setScrollLock(on); > } >+ >+ public ITerminalConnectorInfo getTerminalConnectorInfo() { >+ return fCtlTerminal.getTerminalConnectorInfo(); >+ } >+ >+ public void addTerminalStateListener(ITerminalListener listener) { >+ fCtlTerminal.addTerminalStateListener(listener); >+ } >+ >+ public void removeTerminalStateListener(ITerminalListener listener) { >+ fCtlTerminal.removeTerminalStateListener(listener); >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 224989
: 94374