mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Move more terminal bundles to Java 8 BREE.
And run save actions to modernize code a bit. Change-Id: I4a718e73e8472679aa4ead7fdefe4259004ef6d6 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
cc8211514f
commit
ec7775edc7
35 changed files with 249 additions and 20 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -17,9 +17,10 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6.0";resolution:=optional
|
|||
org.eclipse.tm.terminal.connector.process;bundle-version="4.5.0",
|
||||
org.eclipse.tm.terminal.control;bundle-version="4.5.0",
|
||||
org.eclipse.ui;bundle-version="3.8.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Localization: plugin
|
||||
Export-Package: org.eclipse.tm.terminal.connector.local.activator;x-internal:=true,
|
||||
org.eclipse.tm.terminal.connector.local.controls,
|
||||
org.eclipse.tm.terminal.connector.local.launcher
|
||||
Automatic-Module-Name: org.eclipse.tm.terminal.connector.local
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -15,10 +15,11 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="5.6.0";resolution:=optional
|
|||
org.eclipse.tm.terminal.view.ui;bundle-version="4.5.0";resolution:=optional,
|
||||
org.eclipse.tm.terminal.control;bundle-version="4.5.0",
|
||||
org.eclipse.ui;bundle-version="3.8.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Localization: plugin
|
||||
Export-Package: org.eclipse.tm.terminal.connector.process,
|
||||
org.eclipse.tm.terminal.connector.process.activator;x-internal:=true,
|
||||
org.eclipse.tm.terminal.connector.process.help,
|
||||
org.eclipse.tm.terminal.connector.process.nls;x-internal:=true
|
||||
Automatic-Module-Name: org.eclipse.tm.terminal.connector.process
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
org.eclipse.ui
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-LazyStart: true
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ClassPath: .
|
||||
Export-Package: org.eclipse.tm.internal.terminal.connector;x-internal:=true,
|
||||
org.eclipse.tm.internal.terminal.control,
|
||||
|
@ -23,3 +23,4 @@ Export-Package: org.eclipse.tm.internal.terminal.connector;x-internal:=true,
|
|||
org.eclipse.tm.internal.terminal.provisional.api.provider,
|
||||
org.eclipse.tm.internal.terminal.textcanvas;x-internal:=true,
|
||||
org.eclipse.tm.terminal.model
|
||||
Automatic-Module-Name: org.eclipse.tm.terminal.control
|
||||
|
|
|
@ -68,14 +68,17 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
|
|||
static public class BufferInterceptor extends Interceptor {
|
||||
private final ByteArrayOutputStream fBuffer = new ByteArrayOutputStream();
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
fOriginal.write(fBuffer.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
fBuffer.write(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
fBuffer.write(b);
|
||||
}
|
||||
|
@ -84,6 +87,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
|
|||
private class TerminalFilterOutputStream extends OutputStream {
|
||||
final private Object fLock = TerminalToRemoteInjectionOutputStream.this;
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
synchronized (fLock) {
|
||||
if (fInjection == this) {
|
||||
|
@ -93,6 +97,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
synchronized (fLock) {
|
||||
checkStream();
|
||||
|
@ -100,6 +105,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
synchronized (fLock) {
|
||||
checkStream();
|
||||
|
@ -107,6 +113,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
synchronized (fLock) {
|
||||
checkStream();
|
||||
|
@ -114,6 +121,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
synchronized (fLock) {
|
||||
checkStream();
|
||||
|
@ -167,6 +175,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
|
|||
return grabOutput(new BufferInterceptor());
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void close() throws IOException {
|
||||
if (fInjection != null) {
|
||||
fInjection.close();
|
||||
|
@ -174,12 +183,14 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
|
|||
super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void flush() throws IOException {
|
||||
if (fInterceptor != null)
|
||||
fInterceptor.flush();
|
||||
out.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void write(byte[] b, int off, int len) throws IOException {
|
||||
if (fInterceptor != null)
|
||||
fInterceptor.write(b, off, len);
|
||||
|
@ -187,6 +198,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
|
|||
out.write(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void write(int b) throws IOException {
|
||||
if (fInterceptor != null)
|
||||
fInterceptor.write(b);
|
||||
|
|
|
@ -55,11 +55,12 @@ import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
|
|||
public class CommandInputFieldWithHistory implements ICommandInputField {
|
||||
private class FieldAssist implements IContentProposalProvider {
|
||||
|
||||
@Override
|
||||
public IContentProposal[] getProposals(String contents, int position) {
|
||||
String prefix = contents.substring(0, position);
|
||||
List<Proposal> result = new ArrayList<Proposal>();
|
||||
List<Proposal> result = new ArrayList<>();
|
||||
// show an entry only once
|
||||
Set<String> seen = new HashSet<String>();
|
||||
Set<String> seen = new HashSet<>();
|
||||
for (Iterator<String> iterator = fHistory.iterator(); iterator.hasNext();) {
|
||||
String history = iterator.next();
|
||||
if (history.startsWith(prefix) && !seen.contains(history)) {
|
||||
|
@ -85,24 +86,28 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
fLabel = label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContent() {
|
||||
return fContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return fLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorPosition() {
|
||||
return fContent.length();
|
||||
}
|
||||
}
|
||||
|
||||
final List<String> fHistory = new ArrayList<String>();
|
||||
final List<String> fHistory = new ArrayList<>();
|
||||
/**
|
||||
* Keeps a modifiable history while in history editing mode
|
||||
*/
|
||||
|
@ -189,7 +194,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
*/
|
||||
public String move(String currLine, int count) {
|
||||
if (!inHistoryMode()) {
|
||||
fEditedHistory = new ArrayList<Object>(fHistory.size() + 1);
|
||||
fEditedHistory = new ArrayList<>(fHistory.size() + 1);
|
||||
fEditedHistory.add(currLine);
|
||||
fEditedHistory.addAll(fHistory);
|
||||
fEditHistoryPos = 0;
|
||||
|
@ -227,6 +232,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
fEditHistoryPos = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createControl(final Composite parent, final ITerminalViewControl terminal) {
|
||||
// fSash = new Sash(parent,SWT.HORIZONTAL|SWT.SMOOTH);
|
||||
fSash = new Sash(parent, SWT.HORIZONTAL);
|
||||
|
@ -279,6 +285,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
new ContentAssistCommandAdapter(fInputField, new TextContentAdapter(), new FieldAssist(), null, null,
|
||||
installDecoration);
|
||||
fInputField.addKeyListener(new KeyListener() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
// if the field assist has handled the key already then
|
||||
// ignore it (https://bugs.eclipse.org/bugs/show_bug.cgi?id=211659)
|
||||
|
@ -310,16 +317,19 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
|||
fInputField.setSelection(fInputField.getCharCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFont(Font font) {
|
||||
fInputField.setFont(font);
|
||||
fInputField.getParent().layout(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
fSash.dispose();
|
||||
fSash = null;
|
||||
|
|
|
@ -57,6 +57,7 @@ public interface ITerminalViewControl {
|
|||
* @deprecated use {@link #setFont(String)} in order to support bold and italic variants of the given font
|
||||
* @param font
|
||||
*/
|
||||
@Deprecated
|
||||
void setFont(Font font);
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,6 +44,7 @@ public abstract class AbstractTerminalAction extends Action {
|
|||
setId(strId);
|
||||
}
|
||||
|
||||
@Override
|
||||
abstract public void run();
|
||||
|
||||
protected void setupAction(String strText, String strToolTip, String strImage, String strEnabledImage,
|
||||
|
|
|
@ -37,6 +37,7 @@ public class TerminalActionClearAll extends AbstractTerminalAction {
|
|||
ImageConsts.IMAGE_ELCL_CLEAR_ALL, ImageConsts.IMAGE_DLCL_CLEAR_ALL, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ITerminalViewControl target = getTarget();
|
||||
if (target != null) {
|
||||
|
@ -44,6 +45,7 @@ public class TerminalActionClearAll extends AbstractTerminalAction {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAction(boolean aboutToShow) {
|
||||
ITerminalViewControl target = getTarget();
|
||||
setEnabled(target != null && !target.isEmpty());
|
||||
|
|
|
@ -43,6 +43,7 @@ public class TerminalActionCopy extends AbstractTerminalAction {
|
|||
si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ITerminalViewControl target = getTarget();
|
||||
if (target != null) {
|
||||
|
@ -56,6 +57,7 @@ public class TerminalActionCopy extends AbstractTerminalAction {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAction(boolean aboutToShow) {
|
||||
ITerminalViewControl target = getTarget();
|
||||
boolean bEnabled = target != null;
|
||||
|
|
|
@ -40,6 +40,7 @@ public class TerminalActionCut extends AbstractTerminalAction {
|
|||
si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ITerminalViewControl target = getTarget();
|
||||
if (target != null) {
|
||||
|
@ -47,6 +48,7 @@ public class TerminalActionCut extends AbstractTerminalAction {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAction(boolean aboutToShow) {
|
||||
// Cut is always disabled
|
||||
setEnabled(false);
|
||||
|
|
|
@ -47,6 +47,7 @@ public class TerminalActionPaste extends AbstractTerminalAction {
|
|||
si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ITerminalViewControl target = getTarget();
|
||||
if (target != null) {
|
||||
|
@ -54,6 +55,7 @@ public class TerminalActionPaste extends AbstractTerminalAction {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAction(boolean aboutToShow) {
|
||||
ITerminalViewControl target = getTarget();
|
||||
boolean bEnabled = target != null && target.getClipboard() != null && !target.getClipboard().isDisposed();
|
||||
|
|
|
@ -36,6 +36,7 @@ public class TerminalActionSelectAll extends AbstractTerminalAction {
|
|||
setupAction(ActionMessages.SELECTALL, ActionMessages.SELECTALL, (ImageDescriptor) null, null, null, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ITerminalViewControl target = getTarget();
|
||||
if (target != null) {
|
||||
|
@ -43,6 +44,7 @@ public class TerminalActionSelectAll extends AbstractTerminalAction {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAction(boolean aboutToShow) {
|
||||
ITerminalViewControl target = getTarget();
|
||||
setEnabled(target != null && !target.isEmpty());
|
||||
|
|
|
@ -22,6 +22,7 @@ public class LoggingOutputStream extends FilterOutputStream {
|
|||
super(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
if (Logger.isLogEnabled())
|
||||
Logger.log("Received " + len + " bytes: '" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
@ -38,6 +39,7 @@ public class LoggingOutputStream extends FilterOutputStream {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
if (Logger.isLogEnabled())
|
||||
Logger.log("Received " + 1 + " bytes: '" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
|
|
@ -26,149 +26,180 @@ public class VT100BackendTraceDecorator implements IVT100EmulatorBackend {
|
|||
fWriter = out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendString(String buffer) {
|
||||
fWriter.println("appendString(\"" + buffer + "\")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.appendString(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearAll() {
|
||||
fWriter.println("clearAll()"); //$NON-NLS-1$
|
||||
fBackend.clearAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteCharacters(int n) {
|
||||
fWriter.println("deleteCharacters(" + n + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.deleteCharacters(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteLines(int n) {
|
||||
fWriter.println("deleteLines(" + n + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.deleteLines(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseAll() {
|
||||
fWriter.println("eraseAll()"); //$NON-NLS-1$
|
||||
fBackend.eraseAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseLine() {
|
||||
fWriter.println("eraseLine()"); //$NON-NLS-1$
|
||||
fBackend.eraseLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseLineToCursor() {
|
||||
fWriter.println("eraseLineToCursor()"); //$NON-NLS-1$
|
||||
fBackend.eraseLineToCursor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseLineToEnd() {
|
||||
fWriter.println("eraseLineToEnd()"); //$NON-NLS-1$
|
||||
fBackend.eraseLineToEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseToCursor() {
|
||||
fWriter.println("eraseToCursor()"); //$NON-NLS-1$
|
||||
fBackend.eraseToCursor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eraseToEndOfScreen() {
|
||||
fWriter.println("eraseToEndOfScreen()"); //$NON-NLS-1$
|
||||
fBackend.eraseToEndOfScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumns() {
|
||||
return fBackend.getColumns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorColumn() {
|
||||
return fBackend.getCursorColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorLine() {
|
||||
return fBackend.getCursorLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getDefaultStyle() {
|
||||
return fBackend.getDefaultStyle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLines() {
|
||||
return fBackend.getLines();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle() {
|
||||
return fBackend.getStyle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertCharacters(int charactersToInsert) {
|
||||
fWriter.println("insertCharacters(" + charactersToInsert + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.insertCharacters(charactersToInsert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertLines(int n) {
|
||||
fWriter.println("insertLines(" + n + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.insertLines(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processNewline() {
|
||||
fWriter.println("processNewline()"); //$NON-NLS-1$
|
||||
fBackend.processNewline();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursor(int targetLine, int targetColumn) {
|
||||
fWriter.println("setCursor(" + targetLine + ", " + targetColumn + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
fBackend.setCursor(targetLine, targetColumn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorColumn(int targetColumn) {
|
||||
fWriter.println("setCursorColumn(" + targetColumn + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.setCursorColumn(targetColumn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorLine(int targetLine) {
|
||||
fWriter.println("setCursorLine(" + targetLine + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.setCursorLine(targetLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultStyle(Style defaultStyle) {
|
||||
fWriter.println("setDefaultStyle(" + defaultStyle + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.setDefaultStyle(defaultStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDimensions(int lines, int cols) {
|
||||
fWriter.println("setDimensions(" + lines + "," + cols + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
fBackend.setDimensions(lines, cols);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStyle(Style style) {
|
||||
fWriter.println("setStyle(" + style + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.setStyle(style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVT100LineWrapping(boolean enable) {
|
||||
fWriter.println("setVT100LineWrapping(" + enable + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.setVT100LineWrapping(enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVT100LineWrapping() {
|
||||
return fBackend.isVT100LineWrapping();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInsertMode(boolean enable) {
|
||||
fWriter.println("setInsertMode(" + enable + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.setInsertMode(enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScrollRegion(int top, int bottom) {
|
||||
fWriter.println("setScrollRegion(" + top + ',' + bottom + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.setScrollRegion(top, bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollUp(int lines) {
|
||||
fWriter.println("scrollUp(" + lines + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.scrollUp(lines);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollDown(int lines) {
|
||||
fWriter.println("scrollDown(" + lines + ")"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fBackend.scrollDown(lines);
|
||||
|
|
|
@ -203,6 +203,7 @@ public class VT100Emulator implements ControlListener {
|
|||
* This method is required by interface ControlListener. It allows us to
|
||||
* know when the StyledText widget is moved.
|
||||
*/
|
||||
@Override
|
||||
public void controlMoved(ControlEvent event) {
|
||||
Logger.log("entered"); //$NON-NLS-1$
|
||||
// Empty.
|
||||
|
@ -212,6 +213,7 @@ public class VT100Emulator implements ControlListener {
|
|||
* This method is required by interface ControlListener. It allows us to
|
||||
* know when the StyledText widget is resized.
|
||||
*/
|
||||
@Override
|
||||
public void controlResized(ControlEvent event) {
|
||||
Logger.log("entered"); //$NON-NLS-1$
|
||||
adjustTerminalDimensions();
|
||||
|
|
|
@ -28,106 +28,132 @@ public class SynchronizedTerminalTextData implements ITerminalTextData {
|
|||
fData = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void addLine() {
|
||||
fData.addLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void cleanLine(int line) {
|
||||
fData.cleanLine(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void copy(ITerminalTextData source) {
|
||||
fData.copy(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void copyLine(ITerminalTextData source, int sourceLine, int destLine) {
|
||||
fData.copyLine(source, sourceLine, destLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) {
|
||||
fData.copyRange(source, sourceStartLine, destStartLine, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public char getChar(int line, int column) {
|
||||
return fData.getChar(line, column);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public char[] getChars(int line) {
|
||||
return fData.getChars(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public int getCursorColumn() {
|
||||
return fData.getCursorColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public int getCursorLine() {
|
||||
return fData.getCursorLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public int getHeight() {
|
||||
return fData.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public LineSegment[] getLineSegments(int line, int startCol, int numberOfCols) {
|
||||
return fData.getLineSegments(line, startCol, numberOfCols);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public int getMaxHeight() {
|
||||
return fData.getMaxHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public Style getStyle(int line, int column) {
|
||||
return fData.getStyle(line, column);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public Style[] getStyles(int line) {
|
||||
return fData.getStyles(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public int getWidth() {
|
||||
return fData.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public ITerminalTextDataSnapshot makeSnapshot() {
|
||||
return fData.makeSnapshot();
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void scroll(int startLine, int size, int shift) {
|
||||
fData.scroll(startLine, size, shift);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void setChar(int line, int column, char c, Style style) {
|
||||
fData.setChar(line, column, c, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void setChars(int line, int column, char[] chars, int start, int len, Style style) {
|
||||
fData.setChars(line, column, chars, start, len, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void setChars(int line, int column, char[] chars, Style style) {
|
||||
fData.setChars(line, column, chars, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void setCursorColumn(int column) {
|
||||
fData.setCursorColumn(column);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void setCursorLine(int line) {
|
||||
fData.setCursorLine(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void setDimensions(int height, int width) {
|
||||
fData.setDimensions(height, width);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void setMaxHeight(int height) {
|
||||
fData.setMaxHeight(height);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public boolean isWrappedLine(int line) {
|
||||
return fData.isWrappedLine(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void setWrappedLine(int line) {
|
||||
fData.setWrappedLine(line);
|
||||
}
|
||||
|
|
|
@ -91,15 +91,18 @@ public class TerminalTextData implements ITerminalTextData {
|
|||
fData = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return fData.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
// no need for an extra variable
|
||||
return fData.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDimensions(int height, int width) {
|
||||
int h = getHeight();
|
||||
int w = getWidth();
|
||||
|
@ -122,38 +125,46 @@ public class TerminalTextData implements ITerminalTextData {
|
|||
sendDimensionsChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LineSegment[] getLineSegments(int line, int column, int len) {
|
||||
return fData.getLineSegments(line, column, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getChar(int line, int column) {
|
||||
return fData.getChar(line, column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle(int line, int column) {
|
||||
return fData.getStyle(line, column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChar(int line, int column, char c, Style style) {
|
||||
fData.setChar(line, column, c, style);
|
||||
sendLineChangedToSnapshots(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChars(int line, int column, char[] chars, Style style) {
|
||||
fData.setChars(line, column, chars, style);
|
||||
sendLineChangedToSnapshots(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChars(int line, int column, char[] chars, int start, int len, Style style) {
|
||||
fData.setChars(line, column, chars, start, len, style);
|
||||
sendLineChangedToSnapshots(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scroll(int startLine, int size, int shift) {
|
||||
fData.scroll(startLine, size, shift);
|
||||
sendScrolledToSnapshots(startLine, size, shift);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return fData.toString();
|
||||
}
|
||||
|
@ -208,23 +219,25 @@ public class TerminalTextData implements ITerminalTextData {
|
|||
*/
|
||||
protected void removeSnapshot(TerminalTextDataSnapshot snapshot) {
|
||||
// poor mans approach to modify the array
|
||||
List<TerminalTextDataSnapshot> list = new ArrayList<TerminalTextDataSnapshot>();
|
||||
List<TerminalTextDataSnapshot> list = new ArrayList<>();
|
||||
list.addAll(Arrays.asList(fSnapshots));
|
||||
list.remove(snapshot);
|
||||
fSnapshots = list.toArray(new TerminalTextDataSnapshot[list.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITerminalTextDataSnapshot makeSnapshot() {
|
||||
// poor mans approach to modify the array
|
||||
TerminalTextDataSnapshot snapshot = new TerminalTextDataSnapshot(this);
|
||||
snapshot.markDimensionsChanged();
|
||||
List<TerminalTextDataSnapshot> list = new ArrayList<TerminalTextDataSnapshot>();
|
||||
List<TerminalTextDataSnapshot> list = new ArrayList<>();
|
||||
list.addAll(Arrays.asList(fSnapshots));
|
||||
list.add(snapshot);
|
||||
fSnapshots = list.toArray(new TerminalTextDataSnapshot[list.size()]);
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLine() {
|
||||
int oldHeight = getHeight();
|
||||
fData.addLine();
|
||||
|
@ -243,63 +256,77 @@ public class TerminalTextData implements ITerminalTextData {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copy(ITerminalTextData source) {
|
||||
fData.copy(source);
|
||||
fCursorLine = source.getCursorLine();
|
||||
fCursorColumn = source.getCursorColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyLine(ITerminalTextData source, int sourceLine, int destLine) {
|
||||
fData.copyLine(source, sourceLine, destLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) {
|
||||
fData.copyRange(source, sourceStartLine, destStartLine, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getChars(int line) {
|
||||
return fData.getChars(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style[] getStyles(int line) {
|
||||
return fData.getStyles(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight() {
|
||||
return fData.getMaxHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxHeight(int height) {
|
||||
fData.setMaxHeight(height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanLine(int line) {
|
||||
fData.cleanLine(line);
|
||||
sendLineChangedToSnapshots(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorColumn() {
|
||||
return fCursorColumn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorLine() {
|
||||
return fCursorLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorColumn(int column) {
|
||||
fCursorColumn = column;
|
||||
sendCursorChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorLine(int line) {
|
||||
fCursorLine = line;
|
||||
sendCursorChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrappedLine(int line) {
|
||||
return fData.isWrappedLine(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWrappedLine(int line) {
|
||||
fData.setWrappedLine(line);
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLine() {
|
||||
if (getHeight() < fMaxHeight) {
|
||||
setDimensions(getHeight() + 1, getWidth());
|
||||
|
@ -94,10 +95,12 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanLine(int line) {
|
||||
fData.cleanLine(getPositionOfLine(line));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copy(ITerminalTextData source) {
|
||||
int n = source.getHeight();
|
||||
setDimensions(source.getHeight(), source.getWidth());
|
||||
|
@ -106,10 +109,12 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyLine(ITerminalTextData source, int sourceLine, int destLine) {
|
||||
fData.copyLine(source, sourceLine, getPositionOfLine(destLine));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) {
|
||||
assert (destStartLine >= 0 && destStartLine + length <= fHeight) || throwRuntimeException();
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
@ -117,43 +122,52 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getChar(int line, int column) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
return fData.getChar(getPositionOfLine(line), column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getChars(int line) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
return fData.getChars(getPositionOfLine(line));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return fHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LineSegment[] getLineSegments(int line, int startCol, int numberOfCols) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
return fData.getLineSegments(getPositionOfLine(line), startCol, numberOfCols);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight() {
|
||||
return fMaxHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle(int line, int column) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
return fData.getStyle(getPositionOfLine(line), column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style[] getStyles(int line) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
return fData.getStyles(getPositionOfLine(line));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return fData.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITerminalTextDataSnapshot makeSnapshot() {
|
||||
return fData.makeSnapshot();
|
||||
}
|
||||
|
@ -164,6 +178,7 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scroll(int startLine, int size, int shift) {
|
||||
assert (startLine >= 0 && startLine + size <= fHeight) || throwRuntimeException();
|
||||
if (shift >= fMaxHeight || -shift >= fMaxHeight) {
|
||||
|
@ -198,21 +213,25 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChar(int line, int column, char c, Style style) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
fData.setChar(getPositionOfLine(line), column, c, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChars(int line, int column, char[] chars, int start, int len, Style style) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
fData.setChars(getPositionOfLine(line), column, chars, start, len, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChars(int line, int column, char[] chars, Style style) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
fData.setChars(getPositionOfLine(line), column, chars, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDimensions(int height, int width) {
|
||||
assert height >= 0 || throwRuntimeException();
|
||||
assert width >= 0 || throwRuntimeException();
|
||||
|
@ -223,6 +242,7 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
|
|||
fData.setDimensions(fMaxHeight, width);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxHeight(int maxHeight) {
|
||||
assert maxHeight >= fHeight || throwRuntimeException();
|
||||
// move everything to offset0
|
||||
|
@ -247,27 +267,33 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
|
|||
fMaxHeight = maxHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorColumn() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorLine() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorColumn(int column) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorLine(int line) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrappedLine(int line) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
return fData.isWrappedLine(getPositionOfLine(line));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWrappedLine(int line) {
|
||||
assert (line >= 0 && line < fHeight) || throwRuntimeException();
|
||||
fData.setWrappedLine(getPositionOfLine(line));
|
||||
|
|
|
@ -54,52 +54,62 @@ public class TerminalTextDataWindow implements ITerminalTextData {
|
|||
return line >= fWindowStartLine && line < fWindowStartLine + fWindowSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getChar(int line, int column) {
|
||||
if (!isInWindow(line))
|
||||
return 0;
|
||||
return fData.getChar(line - fWindowStartLine, column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] getChars(int line) {
|
||||
if (!isInWindow(line))
|
||||
return null;
|
||||
return fData.getChars(line - fWindowStartLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return fHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LineSegment[] getLineSegments(int line, int startCol, int numberOfCols) {
|
||||
if (!isInWindow(line))
|
||||
return new LineSegment[] { new LineSegment(startCol, new String(new char[numberOfCols]), null) };
|
||||
return fData.getLineSegments(line - fWindowStartLine, startCol, numberOfCols);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight() {
|
||||
return fMaxHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle(int line, int column) {
|
||||
if (!isInWindow(line))
|
||||
return null;
|
||||
return fData.getStyle(line - fWindowStartLine, column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style[] getStyles(int line) {
|
||||
if (!isInWindow(line))
|
||||
return null;
|
||||
return fData.getStyles(line - fWindowStartLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return fData.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITerminalTextDataSnapshot makeSnapshot() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLine() {
|
||||
if (fMaxHeight > 0 && getHeight() < fMaxHeight) {
|
||||
setDimensions(getHeight() + 1, getWidth());
|
||||
|
@ -108,6 +118,7 @@ public class TerminalTextDataWindow implements ITerminalTextData {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copy(ITerminalTextData source) {
|
||||
// we inherit the dimensions of the source
|
||||
setDimensions(source.getHeight(), source.getWidth());
|
||||
|
@ -116,6 +127,7 @@ public class TerminalTextDataWindow implements ITerminalTextData {
|
|||
fData.copyRange(source, fWindowStartLine, 0, n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) {
|
||||
int n = length;
|
||||
int dStart = destStartLine - fWindowStartLine;
|
||||
|
@ -133,11 +145,13 @@ public class TerminalTextDataWindow implements ITerminalTextData {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void copyLine(ITerminalTextData source, int sourceLine, int destLine) {
|
||||
if (isInWindow(destLine))
|
||||
fData.copyLine(source, sourceLine, destLine - fWindowStartLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scroll(int startLine, int size, int shift) {
|
||||
assert (startLine >= 0 && startLine + size <= fHeight) || throwRuntimeException();
|
||||
int n = size;
|
||||
|
@ -153,30 +167,35 @@ public class TerminalTextDataWindow implements ITerminalTextData {
|
|||
fData.scroll(start, n, shift);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChar(int line, int column, char c, Style style) {
|
||||
if (!isInWindow(line))
|
||||
return;
|
||||
fData.setChar(line - fWindowStartLine, column, c, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChars(int line, int column, char[] chars, int start, int len, Style style) {
|
||||
if (!isInWindow(line))
|
||||
return;
|
||||
fData.setChars(line - fWindowStartLine, column, chars, start, len, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChars(int line, int column, char[] chars, Style style) {
|
||||
if (!isInWindow(line))
|
||||
return;
|
||||
fData.setChars(line - fWindowStartLine, column, chars, style);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDimensions(int height, int width) {
|
||||
assert height >= 0 || throwRuntimeException();
|
||||
fData.setDimensions(fWindowSize, width);
|
||||
fHeight = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxHeight(int height) {
|
||||
fMaxHeight = height;
|
||||
}
|
||||
|
@ -199,33 +218,40 @@ public class TerminalTextDataWindow implements ITerminalTextData {
|
|||
fHeight = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanLine(int line) {
|
||||
if (isInWindow(line))
|
||||
fData.cleanLine(line - fWindowStartLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorColumn() {
|
||||
return fData.getCursorColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorLine() {
|
||||
return fData.getCursorLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorColumn(int column) {
|
||||
fData.setCursorColumn(column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorLine(int line) {
|
||||
fData.setCursorLine(line);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWrappedLine(int line) {
|
||||
if (isInWindow(line))
|
||||
return fData.isWrappedLine(line - fWindowStartLine);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWrappedLine(int line) {
|
||||
if (isInWindow(line))
|
||||
fData.setWrappedLine(line - fWindowStartLine);
|
||||
|
|
|
@ -32,6 +32,7 @@ public class TerminalPreferenceInitializer extends AbstractPreferenceInitializer
|
|||
public TerminalPreferenceInitializer() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeDefaultPreferences() {
|
||||
//DefaultScope.INSTANCE was added in Eclipse 3.7
|
||||
IEclipsePreferences defaultPrefs = DefaultScope.INSTANCE.getNode(TerminalPlugin.PLUGIN_ID);
|
||||
|
|
|
@ -44,10 +44,12 @@ public class TerminalPreferencePage extends FieldEditorPreferencePage implements
|
|||
super(GRID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
setupPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(IWorkbench workbench) {
|
||||
// do nothing
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class TerminalConnectorExtension {
|
|||
public static ITerminalConnector[] makeTerminalConnectors() {
|
||||
IConfigurationElement[] config = RegistryFactory.getRegistry()
|
||||
.getConfigurationElementsFor("org.eclipse.tm.terminal.control.connectors"); //$NON-NLS-1$
|
||||
List<ITerminalConnector> result = new ArrayList<ITerminalConnector>();
|
||||
List<ITerminalConnector> result = new ArrayList<>();
|
||||
for (int i = 0; i < config.length; i++) {
|
||||
result.add(makeConnector(config[i]));
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public class TerminalState {
|
|||
fState = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return fState;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.tm.terminal.model.ITerminalTextDataReadOnly;
|
|||
import org.eclipse.tm.terminal.model.ITerminalTextDataSnapshot;
|
||||
|
||||
abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
||||
protected List<ITextCanvasModelListener> fListeners = new ArrayList<ITextCanvasModelListener>();
|
||||
protected List<ITextCanvasModelListener> fListeners = new ArrayList<>();
|
||||
private int fCursorLine;
|
||||
private int fCursorColumn;
|
||||
private boolean fShowCursor;
|
||||
|
@ -50,10 +50,12 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
fLines = fSnapshot.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCellCanvasModelListener(ITextCanvasModelListener listener) {
|
||||
fListeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCellCanvasModelListener(ITextCanvasModelListener listener) {
|
||||
fListeners.remove(listener);
|
||||
}
|
||||
|
@ -81,6 +83,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITerminalTextDataReadOnly getTerminalText() {
|
||||
return fSnapshot;
|
||||
}
|
||||
|
@ -127,14 +130,17 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
updateCursor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorColumn() {
|
||||
return fCursorColumn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCursorLine() {
|
||||
return fCursorLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCursorOn() {
|
||||
return fShowCursor && fCursorIsEnabled;
|
||||
}
|
||||
|
@ -194,6 +200,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisibleRectangle(int startLine, int startCol, int height, int width) {
|
||||
fSnapshot.setInterestWindow(Math.max(0, startLine), Math.max(1, height));
|
||||
update();
|
||||
|
@ -203,6 +210,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
fShowCursor = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCursorEnabled(boolean visible) {
|
||||
fCursorTime = System.currentTimeMillis();
|
||||
fShowCursor = visible;
|
||||
|
@ -210,10 +218,12 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
fireCellRangeChanged(fCursorColumn, fCursorLine, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCursorEnabled() {
|
||||
return fCursorIsEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getSelectionEnd() {
|
||||
if (fSelectionStartLine < 0)
|
||||
return null;
|
||||
|
@ -221,6 +231,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
return new Point(fSelectionEndColumn, fSeletionEndLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getSelectionStart() {
|
||||
if (fSelectionStartLine < 0)
|
||||
return null;
|
||||
|
@ -228,17 +239,20 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
return new Point(fSelectionStartCoumn, fSelectionStartLine);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getSelectionAnchor() {
|
||||
if (fSelectionStartLine < 0)
|
||||
return null;
|
||||
return new Point(fSelectionAnchor.x, fSelectionAnchor.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectionAnchor(Point anchor) {
|
||||
fSelectionAnchor.x = anchor.x;
|
||||
fSelectionAnchor.y = anchor.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelection(int startLine, int endLine, int startColumn, int endColumn) {
|
||||
// System.err.println(startLine+","+endLine+","+startColumn+","+endColumn);
|
||||
doSetSelection(startLine, endLine, startColumn, endColumn);
|
||||
|
@ -282,6 +296,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLineSelection(int line) {
|
||||
if (fSelectionStartLine < 0)
|
||||
return false;
|
||||
|
@ -289,6 +304,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
|
|||
return line >= fSelectionStartLine && line <= fSeletionEndLine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSelectedText() {
|
||||
return fCurrentSelection;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ abstract public class GridCanvas extends VirtualCanvas {
|
|||
/** template method paint.
|
||||
* iterates over all cells in the clipping rectangle and paints them.
|
||||
*/
|
||||
@Override
|
||||
protected void paint(GC gc) {
|
||||
Rectangle clipping = gc.getClipping();
|
||||
if (clipping.width == 0 || clipping.height == 0)
|
||||
|
@ -157,6 +158,7 @@ abstract public class GridCanvas extends VirtualCanvas {
|
|||
return new Rectangle(x, y, fCellWidth, fCellHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void viewRectangleChanged(int x, int y, int width, int height) {
|
||||
int cellX = virtualXToCell(x);
|
||||
int cellY = virtualYToCell(y);
|
||||
|
@ -182,6 +184,7 @@ abstract public class GridCanvas extends VirtualCanvas {
|
|||
protected void visibleCellRectangleChanged(int x, int y, int width, int height) {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setVirtualExtend(int width, int height) {
|
||||
int cellHeight = getCellHeight();
|
||||
if (cellHeight > 0) {
|
||||
|
@ -190,6 +193,7 @@ abstract public class GridCanvas extends VirtualCanvas {
|
|||
super.setVirtualExtend(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setVirtualOrigin(int x, int y) {
|
||||
int cellHeight = getCellHeight();
|
||||
if (cellHeight > 0) {
|
||||
|
@ -203,6 +207,7 @@ abstract public class GridCanvas extends VirtualCanvas {
|
|||
super.setVirtualOrigin(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void scrollY(ScrollBar vBar) {
|
||||
int vSelection = vBar.getSelection();
|
||||
Rectangle bounds = getVirtualBounds();
|
||||
|
|
|
@ -177,6 +177,7 @@ public class PipedInputStream extends InputStream {
|
|||
*
|
||||
*/
|
||||
class PipedOutputStream extends OutputStream {
|
||||
@Override
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
try {
|
||||
synchronized (fQueue) {
|
||||
|
@ -203,6 +204,7 @@ public class PipedInputStream extends InputStream {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
try {
|
||||
synchronized (fQueue) {
|
||||
|
@ -215,6 +217,7 @@ public class PipedInputStream extends InputStream {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
synchronized (fQueue) {
|
||||
fQueue.close();
|
||||
|
@ -254,6 +257,7 @@ public class PipedInputStream extends InputStream {
|
|||
* Must be called in the Display Thread!
|
||||
* @return number of characters available for reading.
|
||||
*/
|
||||
@Override
|
||||
public int available() {
|
||||
synchronized (fQueue) {
|
||||
return fQueue.available();
|
||||
|
@ -264,6 +268,7 @@ public class PipedInputStream extends InputStream {
|
|||
* @return the next available byte. Check with {@link #available}
|
||||
* if characters are available.
|
||||
*/
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
try {
|
||||
synchronized (fQueue) {
|
||||
|
@ -280,12 +285,14 @@ public class PipedInputStream extends InputStream {
|
|||
* The stream will allow reading data that's still in the pipe after which it will
|
||||
* throw an <tt>IOException</tt>.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
synchronized (fQueue) {
|
||||
fQueue.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] cbuf, int off, int len) throws IOException {
|
||||
int n = 0;
|
||||
if (len == 0)
|
||||
|
|
|
@ -43,6 +43,7 @@ public class PollingTextCanvasModel extends AbstractTextCanvasModel {
|
|||
if (fPollInterval < 0) {
|
||||
fPollInterval = DEFAULT_POLL_INTERVAL;
|
||||
Display.getDefault().timerExec(fPollInterval, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
update();
|
||||
Display.getDefault().timerExec(fPollInterval, this);
|
||||
|
|
|
@ -48,9 +48,9 @@ public class StyleMap {
|
|||
|
||||
private static final String PREFIX = "org.eclipse.tm.internal."; //$NON-NLS-1$
|
||||
String fFontName = ITerminalConstants.FONT_DEFINITION;
|
||||
Map<StyleColor, Color> fColorMapForeground = new HashMap<StyleColor, Color>();
|
||||
Map<StyleColor, Color> fColorMapBackground = new HashMap<StyleColor, Color>();
|
||||
Map<StyleColor, Color> fColorMapIntense = new HashMap<StyleColor, Color>();
|
||||
Map<StyleColor, Color> fColorMapForeground = new HashMap<>();
|
||||
Map<StyleColor, Color> fColorMapBackground = new HashMap<>();
|
||||
Map<StyleColor, Color> fColorMapIntense = new HashMap<>();
|
||||
private Point fCharSize;
|
||||
private final Style fDefaultStyle;
|
||||
private boolean fInvertColors;
|
||||
|
|
|
@ -96,18 +96,21 @@ public class TextCanvas extends GridCanvas {
|
|||
setCellHeight(fCellRenderer.getCellHeight());
|
||||
fCellCanvasModel = model;
|
||||
fCellCanvasModel.addCellCanvasModelListener(new ITextCanvasModelListener() {
|
||||
@Override
|
||||
public void rangeChanged(int col, int line, int width, int height) {
|
||||
if (isDisposed())
|
||||
return;
|
||||
repaintRange(col, line, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dimensionsChanged(int cols, int rows) {
|
||||
if (isDisposed())
|
||||
return;
|
||||
calculateGrid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminalDataChanged() {
|
||||
if (isDisposed())
|
||||
return;
|
||||
|
@ -121,16 +124,19 @@ public class TextCanvas extends GridCanvas {
|
|||
});
|
||||
// let the cursor blink if the text canvas gets the focus...
|
||||
addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
fCellCanvasModel.setCursorEnabled(fCursorEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
fCellCanvasModel.setCursorEnabled(false);
|
||||
}
|
||||
});
|
||||
fMouseListeners = new ArrayList<ITerminalMouseListener>();
|
||||
fMouseListeners = new ArrayList<>();
|
||||
addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent e) {
|
||||
if (fMouseListeners.size() > 0) {
|
||||
Point pt = screenPointToCell(e.x, e.y);
|
||||
|
@ -142,6 +148,7 @@ public class TextCanvas extends GridCanvas {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
if (e.button == 1) { // left button
|
||||
fDraggingStart = screenPointToCell(e.x, e.y);
|
||||
|
@ -165,6 +172,7 @@ public class TextCanvas extends GridCanvas {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
if (e.button == 1) { // left button
|
||||
updateHasSelection(e);
|
||||
|
@ -291,6 +299,7 @@ public class TextCanvas extends GridCanvas {
|
|||
calculateGrid();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResize() {
|
||||
fResizing = true;
|
||||
try {
|
||||
|
@ -354,23 +363,28 @@ public class TextCanvas extends GridCanvas {
|
|||
repaint(r);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawLine(GC gc, int line, int x, int y, int colFirst, int colLast) {
|
||||
fCellRenderer.drawLine(fCellCanvasModel, gc, line, x, y, colFirst, colLast);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getTerminalBackgroundColor() {
|
||||
return fCellRenderer.getDefaultBackgroundColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void visibleCellRectangleChanged(int x, int y, int width, int height) {
|
||||
fCellCanvasModel.setVisibleRectangle(y, x, height, width);
|
||||
update();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getCols() {
|
||||
return fCellCanvasModel.getTerminalText().getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getRows() {
|
||||
return fCellCanvasModel.getTerminalText().getHeight();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public class LineSegment {
|
|||
return fCol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LineSegment(" + fCol + ", \"" + fText + "\"," + fStyle + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class Style {
|
|||
private final boolean fBlink;
|
||||
private final boolean fUnderline;
|
||||
private final boolean fReverse;
|
||||
private final static Map<Style, Style> fgStyles = new HashMap<Style, Style>();
|
||||
private final static Map<Style, Style> fgStyles = new HashMap<>();
|
||||
|
||||
private Style(StyleColor forground, StyleColor background, boolean bold, boolean blink, boolean underline,
|
||||
boolean reverse) {
|
||||
|
@ -119,6 +119,7 @@ public class Style {
|
|||
return fUnderline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
|
@ -131,6 +132,7 @@ public class Style {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
@ -155,6 +157,7 @@ public class Style {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuffer result = new StringBuffer();
|
||||
result.append("Style(foreground="); //$NON-NLS-1$
|
||||
|
|
|
@ -19,7 +19,7 @@ import java.util.Map;
|
|||
* Threadsafe.
|
||||
*/
|
||||
public class StyleColor {
|
||||
private final static Map<String, StyleColor> fgStyleColors = new HashMap<String, StyleColor>();
|
||||
private final static Map<String, StyleColor> fgStyleColors = new HashMap<>();
|
||||
final String fName;
|
||||
|
||||
/**
|
||||
|
@ -48,6 +48,7 @@ public class StyleColor {
|
|||
return fName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return fName;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue