1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-20 15:35:24 +02:00

[168197] Fix Terminal for CDC-1.1/Foundation-1.1

This commit is contained in:
Martin Oberhuber 2008-04-11 18:57:46 +00:00
parent 6bb3eeaebb
commit 1941a62e16
6 changed files with 126 additions and 82 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -1,8 +1,12 @@
#Sun Mar 16 19:48:21 CET 2008 #Fri Apr 11 20:49:09 CEST 2008
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.4 org.eclipse.jdt.core.compiler.compliance=1.4
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

View file

@ -10,7 +10,8 @@ Require-Bundle: org.junit,
org.eclipse.swt, org.eclipse.swt,
org.eclipse.jface, org.eclipse.jface,
org.eclipse.core.runtime org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: J2SE-1.4 Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
J2SE-1.4
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.emulator;x-internal:=true, org.eclipse.tm.internal.terminal.emulator;x-internal:=true,
org.eclipse.tm.internal.terminal.model;x-internal:=true, org.eclipse.tm.internal.terminal.model;x-internal:=true,

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Michael Scharf (Wind River) - initial API and implementation * Michael Scharf (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.emulator; package org.eclipse.tm.internal.terminal.emulator;
@ -50,7 +51,7 @@ public class VT100EmulatorBackendTest extends TestCase {
* @param actual * @param actual
*/ */
protected void assertEqualsTerm(String expected,String actual) { protected void assertEqualsTerm(String expected,String actual) {
assertEquals(expected.replaceAll(" ", "."), actual.replaceAll("\000", ".")); assertEquals(expected.replace(' ', '.'), actual.replace('\000', '.'));
} }
/** /**
* Used for simple text * Used for simple text

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,9 +7,12 @@
* *
* Contributors: * Contributors:
* Michael Scharf (Wind River) - initial API and implementation * Michael Scharf (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.model; package org.eclipse.tm.internal.terminal.model;
import java.util.ArrayList;
import org.eclipse.tm.terminal.model.ITerminalTextData; import org.eclipse.tm.terminal.model.ITerminalTextData;
import org.eclipse.tm.terminal.model.LineSegment; import org.eclipse.tm.terminal.model.LineSegment;
import org.eclipse.tm.terminal.model.Style; import org.eclipse.tm.terminal.model.Style;
@ -37,7 +40,26 @@ public class TerminalTextDataWindowTest extends AbstractITerminalTextDataTest {
} }
private String stripMultiLine(String s) { private String stripMultiLine(String s) {
StringBuffer b=new StringBuffer(); StringBuffer b=new StringBuffer();
String[] lines=s.split("\n"); // String[] lines=s.split("\n");
// <J2ME CDC-1.1 Foundation-1.1 variant>
ArrayList l = new ArrayList();
int j = 0;
for (int k = 0; k < s.length(); k++) {
if (s.charAt(k) == '\n') {
l.add(s.substring(j, k));
j = k;
}
}
j = l.size() - 1;
while (j >= 0 && "".equals(l.get(j))) {
j--;
}
String[] lines = new String[j + 1];
while (j >= 0) {
lines[j] = (String) l.get(j);
j--;
}
// </J2ME CDC-1.1 Foundation-1.1 variant>
for (int i = 0; i < lines.length; i++) { for (int i = 0; i < lines.length; i++) {
if(i>0) if(i>0)
b.append("\n"); //$NON-NLS-1$ b.append("\n"); //$NON-NLS-1$

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others. * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Michael Scharf (Wind River) - initial API and implementation * Michael Scharf (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [168197] Fix Terminal for CDC-1.1/Foundation-1.1
*******************************************************************************/ *******************************************************************************/
package org.eclipse.tm.internal.terminal.model; package org.eclipse.tm.internal.terminal.model;
@ -17,8 +18,7 @@ import org.eclipse.tm.terminal.model.StyleColor;
public class TerminalTextTestHelper { public class TerminalTextTestHelper {
static public String toSimple(ITerminalTextDataReadOnly term) { static public String toSimple(ITerminalTextDataReadOnly term) {
return toMultiLineText(term).replaceAll("\000", " ").replaceAll("\n", ""); return toSimple(toMultiLineText(term));
} }
static public String toMultiLineText(ITerminalTextDataReadOnly term) { static public String toMultiLineText(ITerminalTextDataReadOnly term) {
StringBuffer buff=new StringBuffer(); StringBuffer buff=new StringBuffer();
@ -33,8 +33,24 @@ public class TerminalTextTestHelper {
return buff.toString(); return buff.toString();
} }
static public String toSimple(String str) { static public String toSimple(String str) {
return str.replaceAll("\000", " ").replaceAll("\n", ""); //return str.replaceAll("\000", " ").replaceAll("\n", "");
// <J2ME CDC-1.1 Foundation-1.1 variant>
StringBuffer buf = new StringBuffer(str.length());
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
switch (c) {
case '\000':
buf.append(' ');
break;
case '\n':
break;
default:
buf.append(c);
break;
}
}
return buf.toString();
// </J2ME CDC-1.1 Foundation-1.1 variant>
} }
/** /**
* @param term * @param term