1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +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:
Alexander Kurtakov 2020-02-15 22:32:24 +02:00
parent cc8211514f
commit ec7775edc7
35 changed files with 249 additions and 20 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <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="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

View file

@ -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.connector.process;bundle-version="4.5.0",
org.eclipse.tm.terminal.control;bundle-version="4.5.0", org.eclipse.tm.terminal.control;bundle-version="4.5.0",
org.eclipse.ui;bundle-version="3.8.0" org.eclipse.ui;bundle-version="3.8.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin Bundle-Localization: plugin
Export-Package: org.eclipse.tm.terminal.connector.local.activator;x-internal:=true, 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.controls,
org.eclipse.tm.terminal.connector.local.launcher org.eclipse.tm.terminal.connector.local.launcher
Automatic-Module-Name: org.eclipse.tm.terminal.connector.local

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <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="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

View file

@ -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.view.ui;bundle-version="4.5.0";resolution:=optional,
org.eclipse.tm.terminal.control;bundle-version="4.5.0", org.eclipse.tm.terminal.control;bundle-version="4.5.0",
org.eclipse.ui;bundle-version="3.8.0" org.eclipse.ui;bundle-version="3.8.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin Bundle-Localization: plugin
Export-Package: org.eclipse.tm.terminal.connector.process, Export-Package: org.eclipse.tm.terminal.connector.process,
org.eclipse.tm.terminal.connector.process.activator;x-internal:=true, org.eclipse.tm.terminal.connector.process.activator;x-internal:=true,
org.eclipse.tm.terminal.connector.process.help, org.eclipse.tm.terminal.connector.process.help,
org.eclipse.tm.terminal.connector.process.nls;x-internal:=true org.eclipse.tm.terminal.connector.process.nls;x-internal:=true
Automatic-Module-Name: org.eclipse.tm.terminal.connector.process

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <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="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/> <classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>

View file

@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui org.eclipse.ui
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: . Bundle-ClassPath: .
Export-Package: org.eclipse.tm.internal.terminal.connector;x-internal:=true, Export-Package: org.eclipse.tm.internal.terminal.connector;x-internal:=true,
org.eclipse.tm.internal.terminal.control, 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.provisional.api.provider,
org.eclipse.tm.internal.terminal.textcanvas;x-internal:=true, org.eclipse.tm.internal.terminal.textcanvas;x-internal:=true,
org.eclipse.tm.terminal.model org.eclipse.tm.terminal.model
Automatic-Module-Name: org.eclipse.tm.terminal.control

View file

@ -68,14 +68,17 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
static public class BufferInterceptor extends Interceptor { static public class BufferInterceptor extends Interceptor {
private final ByteArrayOutputStream fBuffer = new ByteArrayOutputStream(); private final ByteArrayOutputStream fBuffer = new ByteArrayOutputStream();
@Override
public void close() throws IOException { public void close() throws IOException {
fOriginal.write(fBuffer.toByteArray()); fOriginal.write(fBuffer.toByteArray());
} }
@Override
public void write(byte[] b, int off, int len) throws IOException { public void write(byte[] b, int off, int len) throws IOException {
fBuffer.write(b, off, len); fBuffer.write(b, off, len);
} }
@Override
public void write(int b) throws IOException { public void write(int b) throws IOException {
fBuffer.write(b); fBuffer.write(b);
} }
@ -84,6 +87,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
private class TerminalFilterOutputStream extends OutputStream { private class TerminalFilterOutputStream extends OutputStream {
final private Object fLock = TerminalToRemoteInjectionOutputStream.this; final private Object fLock = TerminalToRemoteInjectionOutputStream.this;
@Override
public void close() throws IOException { public void close() throws IOException {
synchronized (fLock) { synchronized (fLock) {
if (fInjection == this) { if (fInjection == this) {
@ -93,6 +97,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
} }
} }
@Override
public void write(byte[] b, int off, int len) throws IOException { public void write(byte[] b, int off, int len) throws IOException {
synchronized (fLock) { synchronized (fLock) {
checkStream(); checkStream();
@ -100,6 +105,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
} }
} }
@Override
public void write(byte[] b) throws IOException { public void write(byte[] b) throws IOException {
synchronized (fLock) { synchronized (fLock) {
checkStream(); checkStream();
@ -107,6 +113,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
} }
} }
@Override
public void flush() throws IOException { public void flush() throws IOException {
synchronized (fLock) { synchronized (fLock) {
checkStream(); checkStream();
@ -114,6 +121,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
} }
} }
@Override
public void write(int b) throws IOException { public void write(int b) throws IOException {
synchronized (fLock) { synchronized (fLock) {
checkStream(); checkStream();
@ -167,6 +175,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
return grabOutput(new BufferInterceptor()); return grabOutput(new BufferInterceptor());
} }
@Override
synchronized public void close() throws IOException { synchronized public void close() throws IOException {
if (fInjection != null) { if (fInjection != null) {
fInjection.close(); fInjection.close();
@ -174,12 +183,14 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
super.close(); super.close();
} }
@Override
synchronized public void flush() throws IOException { synchronized public void flush() throws IOException {
if (fInterceptor != null) if (fInterceptor != null)
fInterceptor.flush(); fInterceptor.flush();
out.flush(); out.flush();
} }
@Override
synchronized public void write(byte[] b, int off, int len) throws IOException { synchronized public void write(byte[] b, int off, int len) throws IOException {
if (fInterceptor != null) if (fInterceptor != null)
fInterceptor.write(b, off, len); fInterceptor.write(b, off, len);
@ -187,6 +198,7 @@ public class TerminalToRemoteInjectionOutputStream extends FilterOutputStream {
out.write(b, off, len); out.write(b, off, len);
} }
@Override
synchronized public void write(int b) throws IOException { synchronized public void write(int b) throws IOException {
if (fInterceptor != null) if (fInterceptor != null)
fInterceptor.write(b); fInterceptor.write(b);

View file

@ -55,11 +55,12 @@ import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
public class CommandInputFieldWithHistory implements ICommandInputField { public class CommandInputFieldWithHistory implements ICommandInputField {
private class FieldAssist implements IContentProposalProvider { private class FieldAssist implements IContentProposalProvider {
@Override
public IContentProposal[] getProposals(String contents, int position) { public IContentProposal[] getProposals(String contents, int position) {
String prefix = contents.substring(0, position); String prefix = contents.substring(0, position);
List<Proposal> result = new ArrayList<Proposal>(); List<Proposal> result = new ArrayList<>();
// show an entry only once // show an entry only once
Set<String> seen = new HashSet<String>(); Set<String> seen = new HashSet<>();
for (Iterator<String> iterator = fHistory.iterator(); iterator.hasNext();) { for (Iterator<String> iterator = fHistory.iterator(); iterator.hasNext();) {
String history = iterator.next(); String history = iterator.next();
if (history.startsWith(prefix) && !seen.contains(history)) { if (history.startsWith(prefix) && !seen.contains(history)) {
@ -85,24 +86,28 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
fLabel = label; fLabel = label;
} }
@Override
public String getContent() { public String getContent() {
return fContent; return fContent;
} }
@Override
public String getLabel() { public String getLabel() {
return fLabel; return fLabel;
} }
@Override
public String getDescription() { public String getDescription() {
return null; return null;
} }
@Override
public int getCursorPosition() { public int getCursorPosition() {
return fContent.length(); 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 * 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) { public String move(String currLine, int count) {
if (!inHistoryMode()) { if (!inHistoryMode()) {
fEditedHistory = new ArrayList<Object>(fHistory.size() + 1); fEditedHistory = new ArrayList<>(fHistory.size() + 1);
fEditedHistory.add(currLine); fEditedHistory.add(currLine);
fEditedHistory.addAll(fHistory); fEditedHistory.addAll(fHistory);
fEditHistoryPos = 0; fEditHistoryPos = 0;
@ -227,6 +232,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
fEditHistoryPos = 0; fEditHistoryPos = 0;
} }
@Override
public void createControl(final Composite parent, final ITerminalViewControl terminal) { public void createControl(final Composite parent, final ITerminalViewControl terminal) {
// fSash = new Sash(parent,SWT.HORIZONTAL|SWT.SMOOTH); // fSash = new Sash(parent,SWT.HORIZONTAL|SWT.SMOOTH);
fSash = new Sash(parent, SWT.HORIZONTAL); fSash = new Sash(parent, SWT.HORIZONTAL);
@ -279,6 +285,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
new ContentAssistCommandAdapter(fInputField, new TextContentAdapter(), new FieldAssist(), null, null, new ContentAssistCommandAdapter(fInputField, new TextContentAdapter(), new FieldAssist(), null, null,
installDecoration); installDecoration);
fInputField.addKeyListener(new KeyListener() { fInputField.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
// if the field assist has handled the key already then // if the field assist has handled the key already then
// ignore it (https://bugs.eclipse.org/bugs/show_bug.cgi?id=211659) // 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()); fInputField.setSelection(fInputField.getCharCount());
} }
@Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
} }
}); });
} }
@Override
public void setFont(Font font) { public void setFont(Font font) {
fInputField.setFont(font); fInputField.setFont(font);
fInputField.getParent().layout(true); fInputField.getParent().layout(true);
} }
@Override
public void dispose() { public void dispose() {
fSash.dispose(); fSash.dispose();
fSash = null; fSash = null;

View file

@ -57,6 +57,7 @@ public interface ITerminalViewControl {
* @deprecated use {@link #setFont(String)} in order to support bold and italic variants of the given font * @deprecated use {@link #setFont(String)} in order to support bold and italic variants of the given font
* @param font * @param font
*/ */
@Deprecated
void setFont(Font font); void setFont(Font font);
/** /**

View file

@ -44,6 +44,7 @@ public abstract class AbstractTerminalAction extends Action {
setId(strId); setId(strId);
} }
@Override
abstract public void run(); abstract public void run();
protected void setupAction(String strText, String strToolTip, String strImage, String strEnabledImage, protected void setupAction(String strText, String strToolTip, String strImage, String strEnabledImage,

View file

@ -37,6 +37,7 @@ public class TerminalActionClearAll extends AbstractTerminalAction {
ImageConsts.IMAGE_ELCL_CLEAR_ALL, ImageConsts.IMAGE_DLCL_CLEAR_ALL, false); ImageConsts.IMAGE_ELCL_CLEAR_ALL, ImageConsts.IMAGE_DLCL_CLEAR_ALL, false);
} }
@Override
public void run() { public void run() {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
if (target != null) { if (target != null) {
@ -44,6 +45,7 @@ public class TerminalActionClearAll extends AbstractTerminalAction {
} }
} }
@Override
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
setEnabled(target != null && !target.isEmpty()); setEnabled(target != null && !target.isEmpty());

View file

@ -43,6 +43,7 @@ public class TerminalActionCopy extends AbstractTerminalAction {
si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED), true); si.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED), true);
} }
@Override
public void run() { public void run() {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
if (target != null) { if (target != null) {
@ -56,6 +57,7 @@ public class TerminalActionCopy extends AbstractTerminalAction {
} }
} }
@Override
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
boolean bEnabled = target != null; boolean bEnabled = target != null;

View file

@ -40,6 +40,7 @@ public class TerminalActionCut extends AbstractTerminalAction {
si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED), true); si.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED), true);
} }
@Override
public void run() { public void run() {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
if (target != null) { if (target != null) {
@ -47,6 +48,7 @@ public class TerminalActionCut extends AbstractTerminalAction {
} }
} }
@Override
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
// Cut is always disabled // Cut is always disabled
setEnabled(false); setEnabled(false);

View file

@ -47,6 +47,7 @@ public class TerminalActionPaste extends AbstractTerminalAction {
si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED), false); si.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED), false);
} }
@Override
public void run() { public void run() {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
if (target != null) { if (target != null) {
@ -54,6 +55,7 @@ public class TerminalActionPaste extends AbstractTerminalAction {
} }
} }
@Override
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
boolean bEnabled = target != null && target.getClipboard() != null && !target.getClipboard().isDisposed(); boolean bEnabled = target != null && target.getClipboard() != null && !target.getClipboard().isDisposed();

View file

@ -36,6 +36,7 @@ public class TerminalActionSelectAll extends AbstractTerminalAction {
setupAction(ActionMessages.SELECTALL, ActionMessages.SELECTALL, (ImageDescriptor) null, null, null, false); setupAction(ActionMessages.SELECTALL, ActionMessages.SELECTALL, (ImageDescriptor) null, null, null, false);
} }
@Override
public void run() { public void run() {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
if (target != null) { if (target != null) {
@ -43,6 +44,7 @@ public class TerminalActionSelectAll extends AbstractTerminalAction {
} }
} }
@Override
public void updateAction(boolean aboutToShow) { public void updateAction(boolean aboutToShow) {
ITerminalViewControl target = getTarget(); ITerminalViewControl target = getTarget();
setEnabled(target != null && !target.isEmpty()); setEnabled(target != null && !target.isEmpty());

View file

@ -22,6 +22,7 @@ public class LoggingOutputStream extends FilterOutputStream {
super(out); super(out);
} }
@Override
public void write(byte[] b, int off, int len) throws IOException { public void write(byte[] b, int off, int len) throws IOException {
if (Logger.isLogEnabled()) if (Logger.isLogEnabled())
Logger.log("Received " + len + " bytes: '" + //$NON-NLS-1$ //$NON-NLS-2$ 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 { public void write(int b) throws IOException {
if (Logger.isLogEnabled()) if (Logger.isLogEnabled())
Logger.log("Received " + 1 + " bytes: '" + //$NON-NLS-1$ //$NON-NLS-2$ Logger.log("Received " + 1 + " bytes: '" + //$NON-NLS-1$ //$NON-NLS-2$

View file

@ -26,149 +26,180 @@ public class VT100BackendTraceDecorator implements IVT100EmulatorBackend {
fWriter = out; fWriter = out;
} }
@Override
public void appendString(String buffer) { public void appendString(String buffer) {
fWriter.println("appendString(\"" + buffer + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("appendString(\"" + buffer + "\")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.appendString(buffer); fBackend.appendString(buffer);
} }
@Override
public void clearAll() { public void clearAll() {
fWriter.println("clearAll()"); //$NON-NLS-1$ fWriter.println("clearAll()"); //$NON-NLS-1$
fBackend.clearAll(); fBackend.clearAll();
} }
@Override
public void deleteCharacters(int n) { public void deleteCharacters(int n) {
fWriter.println("deleteCharacters(" + n + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("deleteCharacters(" + n + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.deleteCharacters(n); fBackend.deleteCharacters(n);
} }
@Override
public void deleteLines(int n) { public void deleteLines(int n) {
fWriter.println("deleteLines(" + n + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("deleteLines(" + n + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.deleteLines(n); fBackend.deleteLines(n);
} }
@Override
public void eraseAll() { public void eraseAll() {
fWriter.println("eraseAll()"); //$NON-NLS-1$ fWriter.println("eraseAll()"); //$NON-NLS-1$
fBackend.eraseAll(); fBackend.eraseAll();
} }
@Override
public void eraseLine() { public void eraseLine() {
fWriter.println("eraseLine()"); //$NON-NLS-1$ fWriter.println("eraseLine()"); //$NON-NLS-1$
fBackend.eraseLine(); fBackend.eraseLine();
} }
@Override
public void eraseLineToCursor() { public void eraseLineToCursor() {
fWriter.println("eraseLineToCursor()"); //$NON-NLS-1$ fWriter.println("eraseLineToCursor()"); //$NON-NLS-1$
fBackend.eraseLineToCursor(); fBackend.eraseLineToCursor();
} }
@Override
public void eraseLineToEnd() { public void eraseLineToEnd() {
fWriter.println("eraseLineToEnd()"); //$NON-NLS-1$ fWriter.println("eraseLineToEnd()"); //$NON-NLS-1$
fBackend.eraseLineToEnd(); fBackend.eraseLineToEnd();
} }
@Override
public void eraseToCursor() { public void eraseToCursor() {
fWriter.println("eraseToCursor()"); //$NON-NLS-1$ fWriter.println("eraseToCursor()"); //$NON-NLS-1$
fBackend.eraseToCursor(); fBackend.eraseToCursor();
} }
@Override
public void eraseToEndOfScreen() { public void eraseToEndOfScreen() {
fWriter.println("eraseToEndOfScreen()"); //$NON-NLS-1$ fWriter.println("eraseToEndOfScreen()"); //$NON-NLS-1$
fBackend.eraseToEndOfScreen(); fBackend.eraseToEndOfScreen();
} }
@Override
public int getColumns() { public int getColumns() {
return fBackend.getColumns(); return fBackend.getColumns();
} }
@Override
public int getCursorColumn() { public int getCursorColumn() {
return fBackend.getCursorColumn(); return fBackend.getCursorColumn();
} }
@Override
public int getCursorLine() { public int getCursorLine() {
return fBackend.getCursorLine(); return fBackend.getCursorLine();
} }
@Override
public Style getDefaultStyle() { public Style getDefaultStyle() {
return fBackend.getDefaultStyle(); return fBackend.getDefaultStyle();
} }
@Override
public int getLines() { public int getLines() {
return fBackend.getLines(); return fBackend.getLines();
} }
@Override
public Style getStyle() { public Style getStyle() {
return fBackend.getStyle(); return fBackend.getStyle();
} }
@Override
public void insertCharacters(int charactersToInsert) { public void insertCharacters(int charactersToInsert) {
fWriter.println("insertCharacters(" + charactersToInsert + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("insertCharacters(" + charactersToInsert + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.insertCharacters(charactersToInsert); fBackend.insertCharacters(charactersToInsert);
} }
@Override
public void insertLines(int n) { public void insertLines(int n) {
fWriter.println("insertLines(" + n + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("insertLines(" + n + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.insertLines(n); fBackend.insertLines(n);
} }
@Override
public void processNewline() { public void processNewline() {
fWriter.println("processNewline()"); //$NON-NLS-1$ fWriter.println("processNewline()"); //$NON-NLS-1$
fBackend.processNewline(); fBackend.processNewline();
} }
@Override
public void setCursor(int targetLine, int targetColumn) { public void setCursor(int targetLine, int targetColumn) {
fWriter.println("setCursor(" + targetLine + ", " + targetColumn + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ fWriter.println("setCursor(" + targetLine + ", " + targetColumn + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fBackend.setCursor(targetLine, targetColumn); fBackend.setCursor(targetLine, targetColumn);
} }
@Override
public void setCursorColumn(int targetColumn) { public void setCursorColumn(int targetColumn) {
fWriter.println("setCursorColumn(" + targetColumn + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("setCursorColumn(" + targetColumn + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.setCursorColumn(targetColumn); fBackend.setCursorColumn(targetColumn);
} }
@Override
public void setCursorLine(int targetLine) { public void setCursorLine(int targetLine) {
fWriter.println("setCursorLine(" + targetLine + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("setCursorLine(" + targetLine + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.setCursorLine(targetLine); fBackend.setCursorLine(targetLine);
} }
@Override
public void setDefaultStyle(Style defaultStyle) { public void setDefaultStyle(Style defaultStyle) {
fWriter.println("setDefaultStyle(" + defaultStyle + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("setDefaultStyle(" + defaultStyle + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.setDefaultStyle(defaultStyle); fBackend.setDefaultStyle(defaultStyle);
} }
@Override
public void setDimensions(int lines, int cols) { public void setDimensions(int lines, int cols) {
fWriter.println("setDimensions(" + lines + "," + cols + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ fWriter.println("setDimensions(" + lines + "," + cols + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fBackend.setDimensions(lines, cols); fBackend.setDimensions(lines, cols);
} }
@Override
public void setStyle(Style style) { public void setStyle(Style style) {
fWriter.println("setStyle(" + style + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("setStyle(" + style + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.setStyle(style); fBackend.setStyle(style);
} }
@Override
public void setVT100LineWrapping(boolean enable) { public void setVT100LineWrapping(boolean enable) {
fWriter.println("setVT100LineWrapping(" + enable + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("setVT100LineWrapping(" + enable + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.setVT100LineWrapping(enable); fBackend.setVT100LineWrapping(enable);
} }
@Override
public boolean isVT100LineWrapping() { public boolean isVT100LineWrapping() {
return fBackend.isVT100LineWrapping(); return fBackend.isVT100LineWrapping();
} }
@Override
public void setInsertMode(boolean enable) { public void setInsertMode(boolean enable) {
fWriter.println("setInsertMode(" + enable + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("setInsertMode(" + enable + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.setInsertMode(enable); fBackend.setInsertMode(enable);
} }
@Override
public void setScrollRegion(int top, int bottom) { public void setScrollRegion(int top, int bottom) {
fWriter.println("setScrollRegion(" + top + ',' + bottom + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("setScrollRegion(" + top + ',' + bottom + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.setScrollRegion(top, bottom); fBackend.setScrollRegion(top, bottom);
} }
@Override
public void scrollUp(int lines) { public void scrollUp(int lines) {
fWriter.println("scrollUp(" + lines + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("scrollUp(" + lines + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.scrollUp(lines); fBackend.scrollUp(lines);
} }
@Override
public void scrollDown(int lines) { public void scrollDown(int lines) {
fWriter.println("scrollDown(" + lines + ")"); //$NON-NLS-1$ //$NON-NLS-2$ fWriter.println("scrollDown(" + lines + ")"); //$NON-NLS-1$ //$NON-NLS-2$
fBackend.scrollDown(lines); fBackend.scrollDown(lines);

View file

@ -203,6 +203,7 @@ public class VT100Emulator implements ControlListener {
* This method is required by interface ControlListener. It allows us to * This method is required by interface ControlListener. It allows us to
* know when the StyledText widget is moved. * know when the StyledText widget is moved.
*/ */
@Override
public void controlMoved(ControlEvent event) { public void controlMoved(ControlEvent event) {
Logger.log("entered"); //$NON-NLS-1$ Logger.log("entered"); //$NON-NLS-1$
// Empty. // Empty.
@ -212,6 +213,7 @@ public class VT100Emulator implements ControlListener {
* This method is required by interface ControlListener. It allows us to * This method is required by interface ControlListener. It allows us to
* know when the StyledText widget is resized. * know when the StyledText widget is resized.
*/ */
@Override
public void controlResized(ControlEvent event) { public void controlResized(ControlEvent event) {
Logger.log("entered"); //$NON-NLS-1$ Logger.log("entered"); //$NON-NLS-1$
adjustTerminalDimensions(); adjustTerminalDimensions();

View file

@ -28,106 +28,132 @@ public class SynchronizedTerminalTextData implements ITerminalTextData {
fData = data; fData = data;
} }
@Override
synchronized public void addLine() { synchronized public void addLine() {
fData.addLine(); fData.addLine();
} }
@Override
synchronized public void cleanLine(int line) { synchronized public void cleanLine(int line) {
fData.cleanLine(line); fData.cleanLine(line);
} }
@Override
synchronized public void copy(ITerminalTextData source) { synchronized public void copy(ITerminalTextData source) {
fData.copy(source); fData.copy(source);
} }
@Override
synchronized public void copyLine(ITerminalTextData source, int sourceLine, int destLine) { synchronized public void copyLine(ITerminalTextData source, int sourceLine, int destLine) {
fData.copyLine(source, sourceLine, destLine); fData.copyLine(source, sourceLine, destLine);
} }
@Override
synchronized public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) { synchronized public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) {
fData.copyRange(source, sourceStartLine, destStartLine, length); fData.copyRange(source, sourceStartLine, destStartLine, length);
} }
@Override
synchronized public char getChar(int line, int column) { synchronized public char getChar(int line, int column) {
return fData.getChar(line, column); return fData.getChar(line, column);
} }
@Override
synchronized public char[] getChars(int line) { synchronized public char[] getChars(int line) {
return fData.getChars(line); return fData.getChars(line);
} }
@Override
synchronized public int getCursorColumn() { synchronized public int getCursorColumn() {
return fData.getCursorColumn(); return fData.getCursorColumn();
} }
@Override
synchronized public int getCursorLine() { synchronized public int getCursorLine() {
return fData.getCursorLine(); return fData.getCursorLine();
} }
@Override
synchronized public int getHeight() { synchronized public int getHeight() {
return fData.getHeight(); return fData.getHeight();
} }
@Override
synchronized public LineSegment[] getLineSegments(int line, int startCol, int numberOfCols) { synchronized public LineSegment[] getLineSegments(int line, int startCol, int numberOfCols) {
return fData.getLineSegments(line, startCol, numberOfCols); return fData.getLineSegments(line, startCol, numberOfCols);
} }
@Override
synchronized public int getMaxHeight() { synchronized public int getMaxHeight() {
return fData.getMaxHeight(); return fData.getMaxHeight();
} }
@Override
synchronized public Style getStyle(int line, int column) { synchronized public Style getStyle(int line, int column) {
return fData.getStyle(line, column); return fData.getStyle(line, column);
} }
@Override
synchronized public Style[] getStyles(int line) { synchronized public Style[] getStyles(int line) {
return fData.getStyles(line); return fData.getStyles(line);
} }
@Override
synchronized public int getWidth() { synchronized public int getWidth() {
return fData.getWidth(); return fData.getWidth();
} }
@Override
synchronized public ITerminalTextDataSnapshot makeSnapshot() { synchronized public ITerminalTextDataSnapshot makeSnapshot() {
return fData.makeSnapshot(); return fData.makeSnapshot();
} }
@Override
synchronized public void scroll(int startLine, int size, int shift) { synchronized public void scroll(int startLine, int size, int shift) {
fData.scroll(startLine, size, shift); fData.scroll(startLine, size, shift);
} }
@Override
synchronized public void setChar(int line, int column, char c, Style style) { synchronized public void setChar(int line, int column, char c, Style style) {
fData.setChar(line, column, c, style); fData.setChar(line, column, c, style);
} }
@Override
synchronized public void setChars(int line, int column, char[] chars, int start, int len, Style style) { synchronized public void setChars(int line, int column, char[] chars, int start, int len, Style style) {
fData.setChars(line, column, chars, start, len, style); fData.setChars(line, column, chars, start, len, style);
} }
@Override
synchronized public void setChars(int line, int column, char[] chars, Style style) { synchronized public void setChars(int line, int column, char[] chars, Style style) {
fData.setChars(line, column, chars, style); fData.setChars(line, column, chars, style);
} }
@Override
synchronized public void setCursorColumn(int column) { synchronized public void setCursorColumn(int column) {
fData.setCursorColumn(column); fData.setCursorColumn(column);
} }
@Override
synchronized public void setCursorLine(int line) { synchronized public void setCursorLine(int line) {
fData.setCursorLine(line); fData.setCursorLine(line);
} }
@Override
synchronized public void setDimensions(int height, int width) { synchronized public void setDimensions(int height, int width) {
fData.setDimensions(height, width); fData.setDimensions(height, width);
} }
@Override
synchronized public void setMaxHeight(int height) { synchronized public void setMaxHeight(int height) {
fData.setMaxHeight(height); fData.setMaxHeight(height);
} }
@Override
synchronized public boolean isWrappedLine(int line) { synchronized public boolean isWrappedLine(int line) {
return fData.isWrappedLine(line); return fData.isWrappedLine(line);
} }
@Override
synchronized public void setWrappedLine(int line) { synchronized public void setWrappedLine(int line) {
fData.setWrappedLine(line); fData.setWrappedLine(line);
} }

View file

@ -91,15 +91,18 @@ public class TerminalTextData implements ITerminalTextData {
fData = data; fData = data;
} }
@Override
public int getWidth() { public int getWidth() {
return fData.getWidth(); return fData.getWidth();
} }
@Override
public int getHeight() { public int getHeight() {
// no need for an extra variable // no need for an extra variable
return fData.getHeight(); return fData.getHeight();
} }
@Override
public void setDimensions(int height, int width) { public void setDimensions(int height, int width) {
int h = getHeight(); int h = getHeight();
int w = getWidth(); int w = getWidth();
@ -122,38 +125,46 @@ public class TerminalTextData implements ITerminalTextData {
sendDimensionsChanged(); sendDimensionsChanged();
} }
@Override
public LineSegment[] getLineSegments(int line, int column, int len) { public LineSegment[] getLineSegments(int line, int column, int len) {
return fData.getLineSegments(line, column, len); return fData.getLineSegments(line, column, len);
} }
@Override
public char getChar(int line, int column) { public char getChar(int line, int column) {
return fData.getChar(line, column); return fData.getChar(line, column);
} }
@Override
public Style getStyle(int line, int column) { public Style getStyle(int line, int column) {
return fData.getStyle(line, column); return fData.getStyle(line, column);
} }
@Override
public void setChar(int line, int column, char c, Style style) { public void setChar(int line, int column, char c, Style style) {
fData.setChar(line, column, c, style); fData.setChar(line, column, c, style);
sendLineChangedToSnapshots(line); sendLineChangedToSnapshots(line);
} }
@Override
public void setChars(int line, int column, char[] chars, Style style) { public void setChars(int line, int column, char[] chars, Style style) {
fData.setChars(line, column, chars, style); fData.setChars(line, column, chars, style);
sendLineChangedToSnapshots(line); sendLineChangedToSnapshots(line);
} }
@Override
public void setChars(int line, int column, char[] chars, int start, int len, Style style) { public void setChars(int line, int column, char[] chars, int start, int len, Style style) {
fData.setChars(line, column, chars, start, len, style); fData.setChars(line, column, chars, start, len, style);
sendLineChangedToSnapshots(line); sendLineChangedToSnapshots(line);
} }
@Override
public void scroll(int startLine, int size, int shift) { public void scroll(int startLine, int size, int shift) {
fData.scroll(startLine, size, shift); fData.scroll(startLine, size, shift);
sendScrolledToSnapshots(startLine, size, shift); sendScrolledToSnapshots(startLine, size, shift);
} }
@Override
public String toString() { public String toString() {
return fData.toString(); return fData.toString();
} }
@ -208,23 +219,25 @@ public class TerminalTextData implements ITerminalTextData {
*/ */
protected void removeSnapshot(TerminalTextDataSnapshot snapshot) { protected void removeSnapshot(TerminalTextDataSnapshot snapshot) {
// poor mans approach to modify the array // poor mans approach to modify the array
List<TerminalTextDataSnapshot> list = new ArrayList<TerminalTextDataSnapshot>(); List<TerminalTextDataSnapshot> list = new ArrayList<>();
list.addAll(Arrays.asList(fSnapshots)); list.addAll(Arrays.asList(fSnapshots));
list.remove(snapshot); list.remove(snapshot);
fSnapshots = list.toArray(new TerminalTextDataSnapshot[list.size()]); fSnapshots = list.toArray(new TerminalTextDataSnapshot[list.size()]);
} }
@Override
public ITerminalTextDataSnapshot makeSnapshot() { public ITerminalTextDataSnapshot makeSnapshot() {
// poor mans approach to modify the array // poor mans approach to modify the array
TerminalTextDataSnapshot snapshot = new TerminalTextDataSnapshot(this); TerminalTextDataSnapshot snapshot = new TerminalTextDataSnapshot(this);
snapshot.markDimensionsChanged(); snapshot.markDimensionsChanged();
List<TerminalTextDataSnapshot> list = new ArrayList<TerminalTextDataSnapshot>(); List<TerminalTextDataSnapshot> list = new ArrayList<>();
list.addAll(Arrays.asList(fSnapshots)); list.addAll(Arrays.asList(fSnapshots));
list.add(snapshot); list.add(snapshot);
fSnapshots = list.toArray(new TerminalTextDataSnapshot[list.size()]); fSnapshots = list.toArray(new TerminalTextDataSnapshot[list.size()]);
return snapshot; return snapshot;
} }
@Override
public void addLine() { public void addLine() {
int oldHeight = getHeight(); int oldHeight = getHeight();
fData.addLine(); fData.addLine();
@ -243,63 +256,77 @@ public class TerminalTextData implements ITerminalTextData {
} }
@Override
public void copy(ITerminalTextData source) { public void copy(ITerminalTextData source) {
fData.copy(source); fData.copy(source);
fCursorLine = source.getCursorLine(); fCursorLine = source.getCursorLine();
fCursorColumn = source.getCursorColumn(); fCursorColumn = source.getCursorColumn();
} }
@Override
public void copyLine(ITerminalTextData source, int sourceLine, int destLine) { public void copyLine(ITerminalTextData source, int sourceLine, int destLine) {
fData.copyLine(source, sourceLine, destLine); fData.copyLine(source, sourceLine, destLine);
} }
@Override
public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) { public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) {
fData.copyRange(source, sourceStartLine, destStartLine, length); fData.copyRange(source, sourceStartLine, destStartLine, length);
} }
@Override
public char[] getChars(int line) { public char[] getChars(int line) {
return fData.getChars(line); return fData.getChars(line);
} }
@Override
public Style[] getStyles(int line) { public Style[] getStyles(int line) {
return fData.getStyles(line); return fData.getStyles(line);
} }
@Override
public int getMaxHeight() { public int getMaxHeight() {
return fData.getMaxHeight(); return fData.getMaxHeight();
} }
@Override
public void setMaxHeight(int height) { public void setMaxHeight(int height) {
fData.setMaxHeight(height); fData.setMaxHeight(height);
} }
@Override
public void cleanLine(int line) { public void cleanLine(int line) {
fData.cleanLine(line); fData.cleanLine(line);
sendLineChangedToSnapshots(line); sendLineChangedToSnapshots(line);
} }
@Override
public int getCursorColumn() { public int getCursorColumn() {
return fCursorColumn; return fCursorColumn;
} }
@Override
public int getCursorLine() { public int getCursorLine() {
return fCursorLine; return fCursorLine;
} }
@Override
public void setCursorColumn(int column) { public void setCursorColumn(int column) {
fCursorColumn = column; fCursorColumn = column;
sendCursorChanged(); sendCursorChanged();
} }
@Override
public void setCursorLine(int line) { public void setCursorLine(int line) {
fCursorLine = line; fCursorLine = line;
sendCursorChanged(); sendCursorChanged();
} }
@Override
public boolean isWrappedLine(int line) { public boolean isWrappedLine(int line) {
return fData.isWrappedLine(line); return fData.isWrappedLine(line);
} }
@Override
public void setWrappedLine(int line) { public void setWrappedLine(int line) {
fData.setWrappedLine(line); fData.setWrappedLine(line);
} }

View file

@ -86,6 +86,7 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
return true; return true;
} }
@Override
public void addLine() { public void addLine() {
if (getHeight() < fMaxHeight) { if (getHeight() < fMaxHeight) {
setDimensions(getHeight() + 1, getWidth()); setDimensions(getHeight() + 1, getWidth());
@ -94,10 +95,12 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
} }
} }
@Override
public void cleanLine(int line) { public void cleanLine(int line) {
fData.cleanLine(getPositionOfLine(line)); fData.cleanLine(getPositionOfLine(line));
} }
@Override
public void copy(ITerminalTextData source) { public void copy(ITerminalTextData source) {
int n = source.getHeight(); int n = source.getHeight();
setDimensions(source.getHeight(), source.getWidth()); setDimensions(source.getHeight(), source.getWidth());
@ -106,10 +109,12 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
} }
} }
@Override
public void copyLine(ITerminalTextData source, int sourceLine, int destLine) { public void copyLine(ITerminalTextData source, int sourceLine, int destLine) {
fData.copyLine(source, sourceLine, getPositionOfLine(destLine)); fData.copyLine(source, sourceLine, getPositionOfLine(destLine));
} }
@Override
public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) { public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) {
assert (destStartLine >= 0 && destStartLine + length <= fHeight) || throwRuntimeException(); assert (destStartLine >= 0 && destStartLine + length <= fHeight) || throwRuntimeException();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
@ -117,43 +122,52 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
} }
} }
@Override
public char getChar(int line, int column) { public char getChar(int line, int column) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
return fData.getChar(getPositionOfLine(line), column); return fData.getChar(getPositionOfLine(line), column);
} }
@Override
public char[] getChars(int line) { public char[] getChars(int line) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
return fData.getChars(getPositionOfLine(line)); return fData.getChars(getPositionOfLine(line));
} }
@Override
public int getHeight() { public int getHeight() {
return fHeight; return fHeight;
} }
@Override
public LineSegment[] getLineSegments(int line, int startCol, int numberOfCols) { public LineSegment[] getLineSegments(int line, int startCol, int numberOfCols) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
return fData.getLineSegments(getPositionOfLine(line), startCol, numberOfCols); return fData.getLineSegments(getPositionOfLine(line), startCol, numberOfCols);
} }
@Override
public int getMaxHeight() { public int getMaxHeight() {
return fMaxHeight; return fMaxHeight;
} }
@Override
public Style getStyle(int line, int column) { public Style getStyle(int line, int column) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
return fData.getStyle(getPositionOfLine(line), column); return fData.getStyle(getPositionOfLine(line), column);
} }
@Override
public Style[] getStyles(int line) { public Style[] getStyles(int line) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
return fData.getStyles(getPositionOfLine(line)); return fData.getStyles(getPositionOfLine(line));
} }
@Override
public int getWidth() { public int getWidth() {
return fData.getWidth(); return fData.getWidth();
} }
@Override
public ITerminalTextDataSnapshot makeSnapshot() { public ITerminalTextDataSnapshot makeSnapshot() {
return fData.makeSnapshot(); return fData.makeSnapshot();
} }
@ -164,6 +178,7 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
} }
} }
@Override
public void scroll(int startLine, int size, int shift) { public void scroll(int startLine, int size, int shift) {
assert (startLine >= 0 && startLine + size <= fHeight) || throwRuntimeException(); assert (startLine >= 0 && startLine + size <= fHeight) || throwRuntimeException();
if (shift >= fMaxHeight || -shift >= fMaxHeight) { 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) { public void setChar(int line, int column, char c, Style style) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
fData.setChar(getPositionOfLine(line), column, c, style); fData.setChar(getPositionOfLine(line), column, c, style);
} }
@Override
public void setChars(int line, int column, char[] chars, int start, int len, Style style) { public void setChars(int line, int column, char[] chars, int start, int len, Style style) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
fData.setChars(getPositionOfLine(line), column, chars, start, len, style); fData.setChars(getPositionOfLine(line), column, chars, start, len, style);
} }
@Override
public void setChars(int line, int column, char[] chars, Style style) { public void setChars(int line, int column, char[] chars, Style style) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
fData.setChars(getPositionOfLine(line), column, chars, style); fData.setChars(getPositionOfLine(line), column, chars, style);
} }
@Override
public void setDimensions(int height, int width) { public void setDimensions(int height, int width) {
assert height >= 0 || throwRuntimeException(); assert height >= 0 || throwRuntimeException();
assert width >= 0 || throwRuntimeException(); assert width >= 0 || throwRuntimeException();
@ -223,6 +242,7 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
fData.setDimensions(fMaxHeight, width); fData.setDimensions(fMaxHeight, width);
} }
@Override
public void setMaxHeight(int maxHeight) { public void setMaxHeight(int maxHeight) {
assert maxHeight >= fHeight || throwRuntimeException(); assert maxHeight >= fHeight || throwRuntimeException();
// move everything to offset0 // move everything to offset0
@ -247,27 +267,33 @@ public class TerminalTextDataFastScroll implements ITerminalTextData {
fMaxHeight = maxHeight; fMaxHeight = maxHeight;
} }
@Override
public int getCursorColumn() { public int getCursorColumn() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public int getCursorLine() { public int getCursorLine() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void setCursorColumn(int column) { public void setCursorColumn(int column) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void setCursorLine(int line) { public void setCursorLine(int line) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public boolean isWrappedLine(int line) { public boolean isWrappedLine(int line) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
return fData.isWrappedLine(getPositionOfLine(line)); return fData.isWrappedLine(getPositionOfLine(line));
} }
@Override
public void setWrappedLine(int line) { public void setWrappedLine(int line) {
assert (line >= 0 && line < fHeight) || throwRuntimeException(); assert (line >= 0 && line < fHeight) || throwRuntimeException();
fData.setWrappedLine(getPositionOfLine(line)); fData.setWrappedLine(getPositionOfLine(line));

View file

@ -54,52 +54,62 @@ public class TerminalTextDataWindow implements ITerminalTextData {
return line >= fWindowStartLine && line < fWindowStartLine + fWindowSize; return line >= fWindowStartLine && line < fWindowStartLine + fWindowSize;
} }
@Override
public char getChar(int line, int column) { public char getChar(int line, int column) {
if (!isInWindow(line)) if (!isInWindow(line))
return 0; return 0;
return fData.getChar(line - fWindowStartLine, column); return fData.getChar(line - fWindowStartLine, column);
} }
@Override
public char[] getChars(int line) { public char[] getChars(int line) {
if (!isInWindow(line)) if (!isInWindow(line))
return null; return null;
return fData.getChars(line - fWindowStartLine); return fData.getChars(line - fWindowStartLine);
} }
@Override
public int getHeight() { public int getHeight() {
return fHeight; return fHeight;
} }
@Override
public LineSegment[] getLineSegments(int line, int startCol, int numberOfCols) { public LineSegment[] getLineSegments(int line, int startCol, int numberOfCols) {
if (!isInWindow(line)) if (!isInWindow(line))
return new LineSegment[] { new LineSegment(startCol, new String(new char[numberOfCols]), null) }; return new LineSegment[] { new LineSegment(startCol, new String(new char[numberOfCols]), null) };
return fData.getLineSegments(line - fWindowStartLine, startCol, numberOfCols); return fData.getLineSegments(line - fWindowStartLine, startCol, numberOfCols);
} }
@Override
public int getMaxHeight() { public int getMaxHeight() {
return fMaxHeight; return fMaxHeight;
} }
@Override
public Style getStyle(int line, int column) { public Style getStyle(int line, int column) {
if (!isInWindow(line)) if (!isInWindow(line))
return null; return null;
return fData.getStyle(line - fWindowStartLine, column); return fData.getStyle(line - fWindowStartLine, column);
} }
@Override
public Style[] getStyles(int line) { public Style[] getStyles(int line) {
if (!isInWindow(line)) if (!isInWindow(line))
return null; return null;
return fData.getStyles(line - fWindowStartLine); return fData.getStyles(line - fWindowStartLine);
} }
@Override
public int getWidth() { public int getWidth() {
return fData.getWidth(); return fData.getWidth();
} }
@Override
public ITerminalTextDataSnapshot makeSnapshot() { public ITerminalTextDataSnapshot makeSnapshot() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void addLine() { public void addLine() {
if (fMaxHeight > 0 && getHeight() < fMaxHeight) { if (fMaxHeight > 0 && getHeight() < fMaxHeight) {
setDimensions(getHeight() + 1, getWidth()); setDimensions(getHeight() + 1, getWidth());
@ -108,6 +118,7 @@ public class TerminalTextDataWindow implements ITerminalTextData {
} }
} }
@Override
public void copy(ITerminalTextData source) { public void copy(ITerminalTextData source) {
// we inherit the dimensions of the source // we inherit the dimensions of the source
setDimensions(source.getHeight(), source.getWidth()); setDimensions(source.getHeight(), source.getWidth());
@ -116,6 +127,7 @@ public class TerminalTextDataWindow implements ITerminalTextData {
fData.copyRange(source, fWindowStartLine, 0, n); fData.copyRange(source, fWindowStartLine, 0, n);
} }
@Override
public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) { public void copyRange(ITerminalTextData source, int sourceStartLine, int destStartLine, int length) {
int n = length; int n = length;
int dStart = destStartLine - fWindowStartLine; int dStart = destStartLine - fWindowStartLine;
@ -133,11 +145,13 @@ public class TerminalTextDataWindow implements ITerminalTextData {
} }
@Override
public void copyLine(ITerminalTextData source, int sourceLine, int destLine) { public void copyLine(ITerminalTextData source, int sourceLine, int destLine) {
if (isInWindow(destLine)) if (isInWindow(destLine))
fData.copyLine(source, sourceLine, destLine - fWindowStartLine); fData.copyLine(source, sourceLine, destLine - fWindowStartLine);
} }
@Override
public void scroll(int startLine, int size, int shift) { public void scroll(int startLine, int size, int shift) {
assert (startLine >= 0 && startLine + size <= fHeight) || throwRuntimeException(); assert (startLine >= 0 && startLine + size <= fHeight) || throwRuntimeException();
int n = size; int n = size;
@ -153,30 +167,35 @@ public class TerminalTextDataWindow implements ITerminalTextData {
fData.scroll(start, n, shift); fData.scroll(start, n, shift);
} }
@Override
public void setChar(int line, int column, char c, Style style) { public void setChar(int line, int column, char c, Style style) {
if (!isInWindow(line)) if (!isInWindow(line))
return; return;
fData.setChar(line - fWindowStartLine, column, c, style); fData.setChar(line - fWindowStartLine, column, c, style);
} }
@Override
public void setChars(int line, int column, char[] chars, int start, int len, Style style) { public void setChars(int line, int column, char[] chars, int start, int len, Style style) {
if (!isInWindow(line)) if (!isInWindow(line))
return; return;
fData.setChars(line - fWindowStartLine, column, chars, start, len, style); fData.setChars(line - fWindowStartLine, column, chars, start, len, style);
} }
@Override
public void setChars(int line, int column, char[] chars, Style style) { public void setChars(int line, int column, char[] chars, Style style) {
if (!isInWindow(line)) if (!isInWindow(line))
return; return;
fData.setChars(line - fWindowStartLine, column, chars, style); fData.setChars(line - fWindowStartLine, column, chars, style);
} }
@Override
public void setDimensions(int height, int width) { public void setDimensions(int height, int width) {
assert height >= 0 || throwRuntimeException(); assert height >= 0 || throwRuntimeException();
fData.setDimensions(fWindowSize, width); fData.setDimensions(fWindowSize, width);
fHeight = height; fHeight = height;
} }
@Override
public void setMaxHeight(int height) { public void setMaxHeight(int height) {
fMaxHeight = height; fMaxHeight = height;
} }
@ -199,33 +218,40 @@ public class TerminalTextDataWindow implements ITerminalTextData {
fHeight = height; fHeight = height;
} }
@Override
public void cleanLine(int line) { public void cleanLine(int line) {
if (isInWindow(line)) if (isInWindow(line))
fData.cleanLine(line - fWindowStartLine); fData.cleanLine(line - fWindowStartLine);
} }
@Override
public int getCursorColumn() { public int getCursorColumn() {
return fData.getCursorColumn(); return fData.getCursorColumn();
} }
@Override
public int getCursorLine() { public int getCursorLine() {
return fData.getCursorLine(); return fData.getCursorLine();
} }
@Override
public void setCursorColumn(int column) { public void setCursorColumn(int column) {
fData.setCursorColumn(column); fData.setCursorColumn(column);
} }
@Override
public void setCursorLine(int line) { public void setCursorLine(int line) {
fData.setCursorLine(line); fData.setCursorLine(line);
} }
@Override
public boolean isWrappedLine(int line) { public boolean isWrappedLine(int line) {
if (isInWindow(line)) if (isInWindow(line))
return fData.isWrappedLine(line - fWindowStartLine); return fData.isWrappedLine(line - fWindowStartLine);
return false; return false;
} }
@Override
public void setWrappedLine(int line) { public void setWrappedLine(int line) {
if (isInWindow(line)) if (isInWindow(line))
fData.setWrappedLine(line - fWindowStartLine); fData.setWrappedLine(line - fWindowStartLine);

View file

@ -32,6 +32,7 @@ public class TerminalPreferenceInitializer extends AbstractPreferenceInitializer
public TerminalPreferenceInitializer() { public TerminalPreferenceInitializer() {
} }
@Override
public void initializeDefaultPreferences() { public void initializeDefaultPreferences() {
//DefaultScope.INSTANCE was added in Eclipse 3.7 //DefaultScope.INSTANCE was added in Eclipse 3.7
IEclipsePreferences defaultPrefs = DefaultScope.INSTANCE.getNode(TerminalPlugin.PLUGIN_ID); IEclipsePreferences defaultPrefs = DefaultScope.INSTANCE.getNode(TerminalPlugin.PLUGIN_ID);

View file

@ -44,10 +44,12 @@ public class TerminalPreferencePage extends FieldEditorPreferencePage implements
super(GRID); super(GRID);
} }
@Override
protected void createFieldEditors() { protected void createFieldEditors() {
setupPage(); setupPage();
} }
@Override
public void init(IWorkbench workbench) { public void init(IWorkbench workbench) {
// do nothing // do nothing
} }

View file

@ -90,7 +90,7 @@ public class TerminalConnectorExtension {
public static ITerminalConnector[] makeTerminalConnectors() { public static ITerminalConnector[] makeTerminalConnectors() {
IConfigurationElement[] config = RegistryFactory.getRegistry() IConfigurationElement[] config = RegistryFactory.getRegistry()
.getConfigurationElementsFor("org.eclipse.tm.terminal.control.connectors"); //$NON-NLS-1$ .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++) { for (int i = 0; i < config.length; i++) {
result.add(makeConnector(config[i])); result.add(makeConnector(config[i]));
} }

View file

@ -48,6 +48,7 @@ public class TerminalState {
fState = state; fState = state;
} }
@Override
public String toString() { public String toString() {
return fState; return fState;
} }

View file

@ -23,7 +23,7 @@ import org.eclipse.tm.terminal.model.ITerminalTextDataReadOnly;
import org.eclipse.tm.terminal.model.ITerminalTextDataSnapshot; import org.eclipse.tm.terminal.model.ITerminalTextDataSnapshot;
abstract public class AbstractTextCanvasModel implements ITextCanvasModel { abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
protected List<ITextCanvasModelListener> fListeners = new ArrayList<ITextCanvasModelListener>(); protected List<ITextCanvasModelListener> fListeners = new ArrayList<>();
private int fCursorLine; private int fCursorLine;
private int fCursorColumn; private int fCursorColumn;
private boolean fShowCursor; private boolean fShowCursor;
@ -50,10 +50,12 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
fLines = fSnapshot.getHeight(); fLines = fSnapshot.getHeight();
} }
@Override
public void addCellCanvasModelListener(ITextCanvasModelListener listener) { public void addCellCanvasModelListener(ITextCanvasModelListener listener) {
fListeners.add(listener); fListeners.add(listener);
} }
@Override
public void removeCellCanvasModelListener(ITextCanvasModelListener listener) { public void removeCellCanvasModelListener(ITextCanvasModelListener listener) {
fListeners.remove(listener); fListeners.remove(listener);
} }
@ -81,6 +83,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
} }
@Override
public ITerminalTextDataReadOnly getTerminalText() { public ITerminalTextDataReadOnly getTerminalText() {
return fSnapshot; return fSnapshot;
} }
@ -127,14 +130,17 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
updateCursor(); updateCursor();
} }
@Override
public int getCursorColumn() { public int getCursorColumn() {
return fCursorColumn; return fCursorColumn;
} }
@Override
public int getCursorLine() { public int getCursorLine() {
return fCursorLine; return fCursorLine;
} }
@Override
public boolean isCursorOn() { public boolean isCursorOn() {
return fShowCursor && fCursorIsEnabled; 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) { public void setVisibleRectangle(int startLine, int startCol, int height, int width) {
fSnapshot.setInterestWindow(Math.max(0, startLine), Math.max(1, height)); fSnapshot.setInterestWindow(Math.max(0, startLine), Math.max(1, height));
update(); update();
@ -203,6 +210,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
fShowCursor = true; fShowCursor = true;
} }
@Override
public void setCursorEnabled(boolean visible) { public void setCursorEnabled(boolean visible) {
fCursorTime = System.currentTimeMillis(); fCursorTime = System.currentTimeMillis();
fShowCursor = visible; fShowCursor = visible;
@ -210,10 +218,12 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
fireCellRangeChanged(fCursorColumn, fCursorLine, 1, 1); fireCellRangeChanged(fCursorColumn, fCursorLine, 1, 1);
} }
@Override
public boolean isCursorEnabled() { public boolean isCursorEnabled() {
return fCursorIsEnabled; return fCursorIsEnabled;
} }
@Override
public Point getSelectionEnd() { public Point getSelectionEnd() {
if (fSelectionStartLine < 0) if (fSelectionStartLine < 0)
return null; return null;
@ -221,6 +231,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
return new Point(fSelectionEndColumn, fSeletionEndLine); return new Point(fSelectionEndColumn, fSeletionEndLine);
} }
@Override
public Point getSelectionStart() { public Point getSelectionStart() {
if (fSelectionStartLine < 0) if (fSelectionStartLine < 0)
return null; return null;
@ -228,17 +239,20 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
return new Point(fSelectionStartCoumn, fSelectionStartLine); return new Point(fSelectionStartCoumn, fSelectionStartLine);
} }
@Override
public Point getSelectionAnchor() { public Point getSelectionAnchor() {
if (fSelectionStartLine < 0) if (fSelectionStartLine < 0)
return null; return null;
return new Point(fSelectionAnchor.x, fSelectionAnchor.y); return new Point(fSelectionAnchor.x, fSelectionAnchor.y);
} }
@Override
public void setSelectionAnchor(Point anchor) { public void setSelectionAnchor(Point anchor) {
fSelectionAnchor.x = anchor.x; fSelectionAnchor.x = anchor.x;
fSelectionAnchor.y = anchor.y; fSelectionAnchor.y = anchor.y;
} }
@Override
public void setSelection(int startLine, int endLine, int startColumn, int endColumn) { public void setSelection(int startLine, int endLine, int startColumn, int endColumn) {
// System.err.println(startLine+","+endLine+","+startColumn+","+endColumn); // System.err.println(startLine+","+endLine+","+startColumn+","+endColumn);
doSetSelection(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) { public boolean hasLineSelection(int line) {
if (fSelectionStartLine < 0) if (fSelectionStartLine < 0)
return false; return false;
@ -289,6 +304,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel {
return line >= fSelectionStartLine && line <= fSeletionEndLine; return line >= fSelectionStartLine && line <= fSeletionEndLine;
} }
@Override
public String getSelectedText() { public String getSelectedText() {
return fCurrentSelection; return fCurrentSelection;
} }

View file

@ -45,6 +45,7 @@ abstract public class GridCanvas extends VirtualCanvas {
/** template method paint. /** template method paint.
* iterates over all cells in the clipping rectangle and paints them. * iterates over all cells in the clipping rectangle and paints them.
*/ */
@Override
protected void paint(GC gc) { protected void paint(GC gc) {
Rectangle clipping = gc.getClipping(); Rectangle clipping = gc.getClipping();
if (clipping.width == 0 || clipping.height == 0) if (clipping.width == 0 || clipping.height == 0)
@ -157,6 +158,7 @@ abstract public class GridCanvas extends VirtualCanvas {
return new Rectangle(x, y, fCellWidth, fCellHeight); return new Rectangle(x, y, fCellWidth, fCellHeight);
} }
@Override
protected void viewRectangleChanged(int x, int y, int width, int height) { protected void viewRectangleChanged(int x, int y, int width, int height) {
int cellX = virtualXToCell(x); int cellX = virtualXToCell(x);
int cellY = virtualYToCell(y); 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) { protected void visibleCellRectangleChanged(int x, int y, int width, int height) {
} }
@Override
protected void setVirtualExtend(int width, int height) { protected void setVirtualExtend(int width, int height) {
int cellHeight = getCellHeight(); int cellHeight = getCellHeight();
if (cellHeight > 0) { if (cellHeight > 0) {
@ -190,6 +193,7 @@ abstract public class GridCanvas extends VirtualCanvas {
super.setVirtualExtend(width, height); super.setVirtualExtend(width, height);
} }
@Override
protected void setVirtualOrigin(int x, int y) { protected void setVirtualOrigin(int x, int y) {
int cellHeight = getCellHeight(); int cellHeight = getCellHeight();
if (cellHeight > 0) { if (cellHeight > 0) {
@ -203,6 +207,7 @@ abstract public class GridCanvas extends VirtualCanvas {
super.setVirtualOrigin(x, y); super.setVirtualOrigin(x, y);
} }
@Override
protected void scrollY(ScrollBar vBar) { protected void scrollY(ScrollBar vBar) {
int vSelection = vBar.getSelection(); int vSelection = vBar.getSelection();
Rectangle bounds = getVirtualBounds(); Rectangle bounds = getVirtualBounds();

View file

@ -177,6 +177,7 @@ public class PipedInputStream extends InputStream {
* *
*/ */
class PipedOutputStream extends OutputStream { class PipedOutputStream extends OutputStream {
@Override
public void write(byte[] b, int off, int len) throws IOException { public void write(byte[] b, int off, int len) throws IOException {
try { try {
synchronized (fQueue) { synchronized (fQueue) {
@ -203,6 +204,7 @@ public class PipedInputStream extends InputStream {
} }
} }
@Override
public void write(int b) throws IOException { public void write(int b) throws IOException {
try { try {
synchronized (fQueue) { synchronized (fQueue) {
@ -215,6 +217,7 @@ public class PipedInputStream extends InputStream {
} }
} }
@Override
public void close() throws IOException { public void close() throws IOException {
synchronized (fQueue) { synchronized (fQueue) {
fQueue.close(); fQueue.close();
@ -254,6 +257,7 @@ public class PipedInputStream extends InputStream {
* Must be called in the Display Thread! * Must be called in the Display Thread!
* @return number of characters available for reading. * @return number of characters available for reading.
*/ */
@Override
public int available() { public int available() {
synchronized (fQueue) { synchronized (fQueue) {
return fQueue.available(); return fQueue.available();
@ -264,6 +268,7 @@ public class PipedInputStream extends InputStream {
* @return the next available byte. Check with {@link #available} * @return the next available byte. Check with {@link #available}
* if characters are available. * if characters are available.
*/ */
@Override
public int read() throws IOException { public int read() throws IOException {
try { try {
synchronized (fQueue) { 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 * The stream will allow reading data that's still in the pipe after which it will
* throw an <tt>IOException</tt>. * throw an <tt>IOException</tt>.
*/ */
@Override
public void close() throws IOException { public void close() throws IOException {
synchronized (fQueue) { synchronized (fQueue) {
fQueue.close(); fQueue.close();
} }
} }
@Override
public int read(byte[] cbuf, int off, int len) throws IOException { public int read(byte[] cbuf, int off, int len) throws IOException {
int n = 0; int n = 0;
if (len == 0) if (len == 0)

View file

@ -43,6 +43,7 @@ public class PollingTextCanvasModel extends AbstractTextCanvasModel {
if (fPollInterval < 0) { if (fPollInterval < 0) {
fPollInterval = DEFAULT_POLL_INTERVAL; fPollInterval = DEFAULT_POLL_INTERVAL;
Display.getDefault().timerExec(fPollInterval, new Runnable() { Display.getDefault().timerExec(fPollInterval, new Runnable() {
@Override
public void run() { public void run() {
update(); update();
Display.getDefault().timerExec(fPollInterval, this); Display.getDefault().timerExec(fPollInterval, this);

View file

@ -48,9 +48,9 @@ public class StyleMap {
private static final String PREFIX = "org.eclipse.tm.internal."; //$NON-NLS-1$ private static final String PREFIX = "org.eclipse.tm.internal."; //$NON-NLS-1$
String fFontName = ITerminalConstants.FONT_DEFINITION; String fFontName = ITerminalConstants.FONT_DEFINITION;
Map<StyleColor, Color> fColorMapForeground = new HashMap<StyleColor, Color>(); Map<StyleColor, Color> fColorMapForeground = new HashMap<>();
Map<StyleColor, Color> fColorMapBackground = new HashMap<StyleColor, Color>(); Map<StyleColor, Color> fColorMapBackground = new HashMap<>();
Map<StyleColor, Color> fColorMapIntense = new HashMap<StyleColor, Color>(); Map<StyleColor, Color> fColorMapIntense = new HashMap<>();
private Point fCharSize; private Point fCharSize;
private final Style fDefaultStyle; private final Style fDefaultStyle;
private boolean fInvertColors; private boolean fInvertColors;

View file

@ -96,18 +96,21 @@ public class TextCanvas extends GridCanvas {
setCellHeight(fCellRenderer.getCellHeight()); setCellHeight(fCellRenderer.getCellHeight());
fCellCanvasModel = model; fCellCanvasModel = model;
fCellCanvasModel.addCellCanvasModelListener(new ITextCanvasModelListener() { fCellCanvasModel.addCellCanvasModelListener(new ITextCanvasModelListener() {
@Override
public void rangeChanged(int col, int line, int width, int height) { public void rangeChanged(int col, int line, int width, int height) {
if (isDisposed()) if (isDisposed())
return; return;
repaintRange(col, line, width, height); repaintRange(col, line, width, height);
} }
@Override
public void dimensionsChanged(int cols, int rows) { public void dimensionsChanged(int cols, int rows) {
if (isDisposed()) if (isDisposed())
return; return;
calculateGrid(); calculateGrid();
} }
@Override
public void terminalDataChanged() { public void terminalDataChanged() {
if (isDisposed()) if (isDisposed())
return; return;
@ -121,16 +124,19 @@ public class TextCanvas extends GridCanvas {
}); });
// let the cursor blink if the text canvas gets the focus... // let the cursor blink if the text canvas gets the focus...
addFocusListener(new FocusListener() { addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) { public void focusGained(FocusEvent e) {
fCellCanvasModel.setCursorEnabled(fCursorEnabled); fCellCanvasModel.setCursorEnabled(fCursorEnabled);
} }
@Override
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
fCellCanvasModel.setCursorEnabled(false); fCellCanvasModel.setCursorEnabled(false);
} }
}); });
fMouseListeners = new ArrayList<ITerminalMouseListener>(); fMouseListeners = new ArrayList<>();
addMouseListener(new MouseListener() { addMouseListener(new MouseListener() {
@Override
public void mouseDoubleClick(MouseEvent e) { public void mouseDoubleClick(MouseEvent e) {
if (fMouseListeners.size() > 0) { if (fMouseListeners.size() > 0) {
Point pt = screenPointToCell(e.x, e.y); Point pt = screenPointToCell(e.x, e.y);
@ -142,6 +148,7 @@ public class TextCanvas extends GridCanvas {
} }
} }
@Override
public void mouseDown(MouseEvent e) { public void mouseDown(MouseEvent e) {
if (e.button == 1) { // left button if (e.button == 1) { // left button
fDraggingStart = screenPointToCell(e.x, e.y); fDraggingStart = screenPointToCell(e.x, e.y);
@ -165,6 +172,7 @@ public class TextCanvas extends GridCanvas {
} }
} }
@Override
public void mouseUp(MouseEvent e) { public void mouseUp(MouseEvent e) {
if (e.button == 1) { // left button if (e.button == 1) { // left button
updateHasSelection(e); updateHasSelection(e);
@ -291,6 +299,7 @@ public class TextCanvas extends GridCanvas {
calculateGrid(); calculateGrid();
} }
@Override
protected void onResize() { protected void onResize() {
fResizing = true; fResizing = true;
try { try {
@ -354,23 +363,28 @@ public class TextCanvas extends GridCanvas {
repaint(r); repaint(r);
} }
@Override
protected void drawLine(GC gc, int line, int x, int y, int colFirst, int colLast) { protected void drawLine(GC gc, int line, int x, int y, int colFirst, int colLast) {
fCellRenderer.drawLine(fCellCanvasModel, gc, line, x, y, colFirst, colLast); fCellRenderer.drawLine(fCellCanvasModel, gc, line, x, y, colFirst, colLast);
} }
@Override
protected Color getTerminalBackgroundColor() { protected Color getTerminalBackgroundColor() {
return fCellRenderer.getDefaultBackgroundColor(); return fCellRenderer.getDefaultBackgroundColor();
} }
@Override
protected void visibleCellRectangleChanged(int x, int y, int width, int height) { protected void visibleCellRectangleChanged(int x, int y, int width, int height) {
fCellCanvasModel.setVisibleRectangle(y, x, height, width); fCellCanvasModel.setVisibleRectangle(y, x, height, width);
update(); update();
} }
@Override
protected int getCols() { protected int getCols() {
return fCellCanvasModel.getTerminalText().getWidth(); return fCellCanvasModel.getTerminalText().getWidth();
} }
@Override
protected int getRows() { protected int getRows() {
return fCellCanvasModel.getTerminalText().getHeight(); return fCellCanvasModel.getTerminalText().getHeight();
} }

View file

@ -33,6 +33,7 @@ public class LineSegment {
return fCol; return fCol;
} }
@Override
public String toString() { public String toString() {
return "LineSegment(" + fCol + ", \"" + fText + "\"," + fStyle + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ return "LineSegment(" + fCol + ", \"" + fText + "\"," + fStyle + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} }

View file

@ -28,7 +28,7 @@ public class Style {
private final boolean fBlink; private final boolean fBlink;
private final boolean fUnderline; private final boolean fUnderline;
private final boolean fReverse; 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, private Style(StyleColor forground, StyleColor background, boolean bold, boolean blink, boolean underline,
boolean reverse) { boolean reverse) {
@ -119,6 +119,7 @@ public class Style {
return fUnderline; return fUnderline;
} }
@Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
@ -131,6 +132,7 @@ public class Style {
return result; return result;
} }
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
return true; return true;
@ -155,6 +157,7 @@ public class Style {
return true; return true;
} }
@Override
public String toString() { public String toString() {
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
result.append("Style(foreground="); //$NON-NLS-1$ result.append("Style(foreground="); //$NON-NLS-1$

View file

@ -19,7 +19,7 @@ import java.util.Map;
* Threadsafe. * Threadsafe.
*/ */
public class StyleColor { 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; final String fName;
/** /**
@ -48,6 +48,7 @@ public class StyleColor {
return fName; return fName;
} }
@Override
public String toString() { public String toString() {
return fName; return fName;
} }