[sikuli] 248/385: finally fixed the load lexer problem

Gilles Filippini pini at moszumanska.debian.org
Sun Jun 29 19:26:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

pini pushed a commit to tag upstream/1.1.0_beta1
in repository sikuli.

commit f9326ba277668380e9e168e7da2c1dd2bac9f168
Author: Raimund Hocke <rmhdevelop at me.com>
Date:   Fri Feb 21 18:31:16 2014 +0100

    finally fixed the load lexer problem
---
 IDE/src/main/java/org/sikuli/ide/EditorPane.java   | 65 +++++++++++-----------
 .../main/java/org/sikuli/syntaxhighlight/Util.java |  4 +-
 2 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/IDE/src/main/java/org/sikuli/ide/EditorPane.java b/IDE/src/main/java/org/sikuli/ide/EditorPane.java
index 5ce1917..bdd4687 100755
--- a/IDE/src/main/java/org/sikuli/ide/EditorPane.java
+++ b/IDE/src/main/java/org/sikuli/ide/EditorPane.java
@@ -350,8 +350,39 @@ public class EditorPane extends JTextPane implements KeyListener, CaretListener
 		setDirty(false);
 	}
 
-	private Lexer getLexer(File script) {
-		String scriptType = "python";
+	private void cleanBundle(String bundle) {
+		String scriptText = getText();
+		Lexer lexer = getLexer();
+		Iterable<Token> tokens = lexer.getTokens(scriptText);
+		List<String> usedImages = new ArrayList<String>();
+		boolean inString = false;
+		String current;
+		for (Token t : tokens) {
+			current = t.getValue();
+			if (!inString) {
+				if ("'\"".contains(current)) {
+					inString = true;
+				}
+				continue;
+			}
+			if ("'\"".contains(current)) {
+				inString = false;
+				continue;
+			}
+			if (current.endsWith(".png") || current.endsWith(".jpg")) {
+				Debug.log(3,"IDE: save: used image: %s", current);
+				usedImages.add(current);
+			}
+		}
+		if (usedImages.size() == 0) {
+			return;
+		}
+		FileManager.deleteNotUsedImages(bundle, usedImages);
+	}
+
+	private Lexer getLexer() {
+//TODO this only works for cleanbundle to find the image strings
+    String scriptType = "python";
 		if (null != lexers.get(scriptType)) {
 			return lexers.get(scriptType);
 		}
@@ -488,36 +519,6 @@ public class EditorPane extends JTextPane implements KeyListener, CaretListener
 		}
 	}
 
-	private void cleanBundle(String bundle) {
-		String scriptText = getText();
-		Lexer lexer = getLexer(_editingFile);
-		Iterable<Token> tokens = lexer.getTokens(scriptText);
-		List<String> usedImages = new ArrayList<String>();
-		boolean inString = false;
-		String current;
-		for (Token t : tokens) {
-			current = t.getValue();
-			if (!inString) {
-				if ("'\"".contains(current)) {
-					inString = true;
-				}
-				continue;
-			}
-			if ("'\"".contains(current)) {
-				inString = false;
-				continue;
-			}
-			if (current.endsWith(".png") || current.endsWith(".jpg")) {
-				Debug.log(3,"IDE: save: used image: %s", current);
-				usedImages.add(current);
-			}
-		}
-		if (usedImages.size() == 0) {
-			return;
-		}
-		FileManager.deleteNotUsedImages(bundle, usedImages);
-	}
-
 	public File copyFileToBundle(String filename) {
 		File f = new File(filename);
 		String bundlePath = getSrcBundle();
diff --git a/Jygments4SikuliX/src/main/java/org/sikuli/syntaxhighlight/Util.java b/Jygments4SikuliX/src/main/java/org/sikuli/syntaxhighlight/Util.java
index e6683f9..c9e7661 100644
--- a/Jygments4SikuliX/src/main/java/org/sikuli/syntaxhighlight/Util.java
+++ b/Jygments4SikuliX/src/main/java/org/sikuli/syntaxhighlight/Util.java
@@ -131,9 +131,9 @@ public class Util {
     } catch (URISyntaxException ex) {
       System.out.println("Util: getJsonFile: URISyntaxException: " + ex.toString());
     }
-    if (jarFileURI != null && !jarFileURI.getPath().contains(".jar")) {
+    if (jarFileURI != null ) {
       String jarFilePath = jarFileURI.getPath();
-      if (jarFileURI.getScheme().equals("file")) {
+      if (jarFileURI.getScheme().equals("file") && !jarFilePath.contains(".jar")) {
         if (!pack.isEmpty()) {
           pack = pack.replace(".", "/");
           if (!sub.isEmpty()) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/sikuli.git



More information about the pkg-java-commits mailing list