From 07e141e8134ec270ffdbae1a9111aa0d4cb44cf5 Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Jun 11 2018 14:42:05 +0000 Subject: Update to photon release --- diff --git a/eclipse-bug-517358.patch b/eclipse-bug-517358.patch deleted file mode 100644 index 60d8973..0000000 --- a/eclipse-bug-517358.patch +++ /dev/null @@ -1,158 +0,0 @@ -From 3ee6618da1282970ebb386f622c9c5b89ae0ab0b Mon Sep 17 00:00:00 2001 -From: Václav Kadlčík -Date: Fri, 2 Jun 2017 10:24:02 +0200 -Subject: Bug 517358 - RFE: method to read TextCanvas content - -Teach TextCanvas to provide all the text contained: getAllText(). - -The actual change takes place on the level of ITextCanvasModel -(interface) and AbstractTextCanvasModel (implementation); TextCanvas -just redirects the request there. - -One bit of the existing code has been refactored: part of -AbstractTextCanvasModel.extractSelectedText() has been extracted -into a separate method - scrubLine() - so it can be reused in the -new code. - -The primary (and probably the only one) use case of this new -extension is test automation: SWTBot- or Red Deer-based tests can -read content of TextCanvas instances and verify that they contain -what's expected, e.g. output of Docker containers or gdb sessions. - -Change-Id: I92092c0f9837639d13d6bc32ae5b47acd24c54c1 -Signed-off-by: Václav Kadlčík ---- - .../textcanvas/AbstractTextCanvasModel.java | 54 +++++++++++++++++----- - .../terminal/textcanvas/ITextCanvasModel.java | 11 +++++ - .../internal/terminal/textcanvas/TextCanvas.java | 16 +++++++ - 3 files changed, 70 insertions(+), 11 deletions(-) - -diff --git a/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/AbstractTextCanvasModel.java b/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/AbstractTextCanvasModel.java -index 7991014..f57b827 100644 ---- a/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/AbstractTextCanvasModel.java -+++ b/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/AbstractTextCanvasModel.java -@@ -277,6 +277,22 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel { - public String getSelectedText() { - return fCurrentSelection; - } -+ -+ // helper to sanitize text copied out of a snapshot -+ private static String scrubLine(String text) { -+ // get rid of the empty space at the end of the lines -+ // text=text.replaceAll("\000+$",""); //$NON-NLS-1$//$NON-NLS-2$ -+ // -+ int i = text.length() - 1; -+ while (i >= 0 && text.charAt(i) == '\000') { -+ i--; -+ } -+ text = text.substring(0, i + 1); -+ // -+ // null means space -+ return text.replace('\000', ' '); -+ } -+ - /** - * Calculates the currently selected text - * @return the currently selected text -@@ -294,17 +310,7 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel { - text=text.substring(0, Math.min(fSelectionEndColumn+1,text.length())); - if(line==fSelectionStartLine) - text=text.substring(Math.min(fSelectionStartCoumn,text.length())); -- // get rid of the empty space at the end of the lines -- // text=text.replaceAll("\000+$",""); //$NON-NLS-1$//$NON-NLS-2$ -- // -- int i = text.length() - 1; -- while (i >= 0 && text.charAt(i) == '\000') { -- i--; -- } -- text = text.substring(0, i + 1); -- // -- // null means space -- text=text.replace('\000', ' '); -+ text=scrubLine(text); - } else { - text=""; //$NON-NLS-1$ - } -@@ -345,4 +351,30 @@ abstract public class AbstractTextCanvasModel implements ITextCanvasModel { - } - } - -+ @Override -+ public String getAllText() { -+ -+ // Make a snapshot of the whole text data -+ ITerminalTextDataSnapshot snapshot = fSnapshot.getTerminalTextData().makeSnapshot(); -+ snapshot.updateSnapshot(true); -+ snapshot.detach(); -+ -+ // Extract the data -+ StringBuffer sb = new StringBuffer(); -+ for (int line = 0; line < snapshot.getHeight(); line++) { -+ char[] chars = snapshot.getChars(line); -+ String text; -+ if (chars != null) { -+ text = scrubLine(new String(chars)); // take care of NULs -+ } else { -+ text = ""; //$NON-NLS-1$ null arrays represent empty lines -+ } -+ sb.append(text); -+ // terminate lines except (1) the last one and (2) wrapped lines -+ if ((line < snapshot.getHeight() - 1) && !snapshot.isWrappedLine(line)) { -+ sb.append('\n'); -+ } -+ } -+ return sb.toString(); -+ } - } -\ No newline at end of file -diff --git a/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/ITextCanvasModel.java b/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/ITextCanvasModel.java -index 1891c60..2ecb84a 100644 ---- a/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/ITextCanvasModel.java -+++ b/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/ITextCanvasModel.java -@@ -81,4 +81,15 @@ public interface ITextCanvasModel { - boolean hasLineSelection(int line); - - String getSelectedText(); -+ -+ /** -+ * Collect and return all text present in the model. -+ * -+ *

Individual lines of the returned text are separated by '\n'. -+ * -+ *

The method is primarily designed for test automation. -+ * -+ * @since 4.3 -+ */ -+ String getAllText(); - } -\ No newline at end of file -diff --git a/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/TextCanvas.java b/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/TextCanvas.java -index a8b9508..02c6064 100644 ---- a/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/TextCanvas.java -+++ b/plugins/org.eclipse.tm.terminal.control/src/org/eclipse/tm/internal/terminal/textcanvas/TextCanvas.java -@@ -382,6 +382,22 @@ public class TextCanvas extends GridCanvas { - fCellCanvasModel.setSelection(-1,-1,-1,-1); - } - -+ /** -+ * Collect and return all text present in the widget. -+ * -+ *

Individual lines of the returned text are separated by '\n'. -+ * -+ *

The method is primarily designed for test automation. Tests need -+ * to check what happens in a terminal (e.g. if and how a CDT Debugger -+ * Console reacts in a GDB session) and this method allows to read the -+ * text present in the terminal. -+ * -+ * @since 4.3 -+ */ -+ public String getAllText() { -+ return fCellCanvasModel.getAllText(); -+ } -+ - public boolean isEmpty() { - return false; - } --- -cgit v1.1 - diff --git a/eclipse-tm-terminal.spec b/eclipse-tm-terminal.spec index 09afe36..556099d 100644 --- a/eclipse-tm-terminal.spec +++ b/eclipse-tm-terminal.spec @@ -1,11 +1,11 @@ -%global git_tag fa298da8b7e03c83acba40fc539b0dd6c654c16e +%global git_tag 121bc1f3ea828cf625634b25221ca1a8b3c73574 # Set this to avoid building CDT and remotes bundles to eliminate # a circular dep on CDT->tm-terminal->remote->CDT %bcond_without remote Name: eclipse-tm-terminal -Version: 4.3.0 +Version: 4.4.0 Release: 1%{?dist} Summary: Terminal plug-in for Eclipse @@ -14,8 +14,6 @@ URL: https://www.eclipse.org/tm/ Source0: http://git.eclipse.org/c/tm/org.eclipse.tm.terminal.git/snapshot/org.eclipse.tm.terminal-%{git_tag}.tar.xz BuildArch: noarch -Patch0: eclipse-bug-517358.patch - BuildRequires: maven-local BuildRequires: tycho-extras BuildRequires: eclipse-license @@ -54,8 +52,6 @@ Sources and developer resources for the Terminal plug-in for Eclipse. %prep %setup -q -n org.eclipse.tm.terminal-%{git_tag} -%patch0 -p1 - # Don't need to build repo %pom_disable_module repos/org.eclipse.tm.terminal.repo @@ -114,6 +110,9 @@ sed -i -e "s|p2.inf||g" features/org.eclipse.tm.terminal.view.feature/build.prop %files sdk -f .mfiles-sdk %changelog +* Mon Jun 11 2018 Mat Booth - 4.4.0-1 +- Update to photon release + * Wed Mar 21 2018 Mat Booth - 4.3.0-1 - Add patch to add API to read TextCanvas content diff --git a/sources b/sources index 517744b..1413569 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (org.eclipse.tm.terminal-fa298da8b7e03c83acba40fc539b0dd6c654c16e.tar.xz) = 2e7a9798240d3adc9ab760aa7dd784cfa30c7a7f0faba41ce0151cbac3494fc6bc107fd5ece197a184b4d5f3fcefaed62ec49897f9bcbc8d3b4a99ea37f63965 +SHA512 (org.eclipse.tm.terminal-121bc1f3ea828cf625634b25221ca1a8b3c73574.tar.xz) = eb05b3c7bac207d12b0d0cf901012d1e6d378b2415c5a68d8ee0f0efd8401ac0e8fc8ca1403dc73d3a58e941da6dc7b1568166b7e8bbcdf5b5a7ccb015bef0dd