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 97bf644beed866064e62fd5ae37427bdbbb2d634
Author: Raimund Hocke <[email protected]>
Date:   Wed Feb 19 14:21:11 2014 +0100

    finalized the switching of content type in the current tab (tab context 
menu)
---
 .../java/org/sikuli/ide/SikuliIDEPopUpMenu.java    | 32 +++++++++++++++++-----
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/IDE/src/main/java/org/sikuli/ide/SikuliIDEPopUpMenu.java 
b/IDE/src/main/java/org/sikuli/ide/SikuliIDEPopUpMenu.java
index 9b294b5..9d7c97c 100644
--- a/IDE/src/main/java/org/sikuli/ide/SikuliIDEPopUpMenu.java
+++ b/IDE/src/main/java/org/sikuli/ide/SikuliIDEPopUpMenu.java
@@ -4,6 +4,7 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.MouseEvent;
 import java.lang.reflect.Method;
+import java.util.Set;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
 import javax.swing.JPopupMenu;
@@ -205,12 +206,28 @@ public class SikuliIDEPopUpMenu extends JPopupMenu {
                        Debug.log(3, "doSetType: selected");
                        String error = "";
                        EditorPane cp = 
SikuliIDE.getInstance().getCurrentCodePane();
-                       String targetType = Settings.CRUBY;
-                       String targetEnding = Settings.ERUBY;
-                       if (cp.getSikuliContentType().equals(Settings.CRUBY)) {
-                               targetEnding = Settings.EPYTHON;
-                               targetType = Settings.CPYTHON;
+                       Set<String> types = Settings.TypeEndings.keySet();
+                       String[] selOptions = new String[types.size()];
+                       int i = 0;
+                       for (String e : types) {
+                               if (e.contains("plain")) {
+                                       continue;
+                               }
+                               selOptions[i++] = e.replaceFirst(".*?\\/", "");
+                       }
+                       String currentType = cp.getSikuliContentType();
+                       String targetType = SikuliX.popSelect("Select the 
Scripting Language ...",
+                                                       selOptions, 
currentType.replaceFirst(".*?\\/", ""));
+                       if (targetType == null) {
+                               targetType = currentType;
+                       } else {
+                               targetType = "text/" + targetType;
+                       }
+                       if (currentType.equals(targetType)) {
+                               
SikuliIDE.getStatusbar().setCurrentContentType(currentType);
+                               return;
                        }
+                       String targetEnding = 
Settings.TypeEndings.get(targetType);
                        if (cp.reparseBefore() != null) {
                                if (!cp.reparseCheckContent()) {
                                        if (!SikuliX.popAsk(String.format(
@@ -218,7 +235,7 @@ public class SikuliIDEPopUpMenu extends JPopupMenu {
                                                                        + 
"Click YES, to discard content and switch\n"
                                                                        + 
"Click NO to cancel this action and keep content.",
                                                                        
targetType))) {
-                                               error = "with errors";
+                                               error = ": with errors";
                                        }
                                }
                        }
@@ -226,8 +243,9 @@ public class SikuliIDEPopUpMenu extends JPopupMenu {
                                cp.reInit(targetEnding);
 //                             
cp.setText(String.format(Settings.TypeCommentDefault, 
cp.getSikuliContentType()));
                                cp.setText("");
+                               error = ": (" + targetType + ")";
                        }
-                       String msg = "doSetType: completed " + error + " (" + 
targetType + ")";
+                       String msg = "doSetType: completed" + error ;
                        SikuliIDE.getStatusbar().setMessage(msg);
                        
SikuliIDE.getStatusbar().setCurrentContentType(targetType);
                        Debug.log(3, msg);

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

_______________________________________________
pkg-java-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to