git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
25e2a6f
)
JAL-4298 Remove a stray return in the processGroovyScript method. Mildy improve a...
author
Ben Soares
<b.soares@dundee.ac.uk>
Fri, 20 Oct 2023 15:57:29 +0000
(16:57 +0100)
committer
Ben Soares
<b.soares@dundee.ac.uk>
Fri, 20 Oct 2023 15:57:29 +0000
(16:57 +0100)
examples/groovy/stripUniprotPrefixes.groovy
patch
|
blob
|
history
src/jalview/bin/Commands.java
patch
|
blob
|
history
src/jalview/bin/Jalview.java
patch
|
blob
|
history
src/jalview/bin/groovy/JalviewObjectI.java
patch
|
blob
|
history
src/jalview/gui/AlignFrame.java
patch
|
blob
|
history
src/jalview/gui/Desktop.java
patch
|
blob
|
history
diff --git
a/examples/groovy/stripUniprotPrefixes.groovy
b/examples/groovy/stripUniprotPrefixes.groovy
index
2792604
..
5a01da4
100644
(file)
--- a/
examples/groovy/stripUniprotPrefixes.groovy
+++ b/
examples/groovy/stripUniprotPrefixes.groovy
@@
-47,5
+47,6
@@
for (ala in af)
}
}
}
}
}
}
+ ala.repaint();
}
}
diff --git
a/src/jalview/bin/Commands.java
b/src/jalview/bin/Commands.java
index
3006f1f
..
e02d132
100644
(file)
--- a/
src/jalview/bin/Commands.java
+++ b/
src/jalview/bin/Commands.java
@@
-851,7
+851,6
@@
public class Commands
if (af == null)
{
addWarn("Groovy script does not have an alignment window. Proceeding with caution!");
if (af == null)
{
addWarn("Groovy script does not have an alignment window. Proceeding with caution!");
- return;
}
if (avm.containsArg(Arg.GROOVY))
}
if (avm.containsArg(Arg.GROOVY))
diff --git
a/src/jalview/bin/Jalview.java
b/src/jalview/bin/Jalview.java
index
783f533
..
83efe7d
100755
(executable)
--- a/
src/jalview/bin/Jalview.java
+++ b/
src/jalview/bin/Jalview.java
@@
-1753,8
+1753,8
@@
public class Jalview implements JalviewObjectI
{
JalviewObjectI j = new JalviewObject(this);
Map<String, java.lang.Object> vbinding = new HashMap<>();
{
JalviewObjectI j = new JalviewObject(this);
Map<String, java.lang.Object> vbinding = new HashMap<>();
- vbinding.put("Jalview", j);
- vbinding.put("currentAlFrame",
+ vbinding.put(JalviewObjectI.jalviewObjectName, j);
+ vbinding.put(JalviewObjectI.currentAlFrameName,
af != null ? af : getCurrentAlignFrame());
Binding gbinding = new Binding(vbinding);
GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
af != null ? af : getCurrentAlignFrame());
Binding gbinding = new Binding(vbinding);
GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
diff --git
a/src/jalview/bin/groovy/JalviewObjectI.java
b/src/jalview/bin/groovy/JalviewObjectI.java
index
775ab2a
..
f365d30
100644
(file)
--- a/
src/jalview/bin/groovy/JalviewObjectI.java
+++ b/
src/jalview/bin/groovy/JalviewObjectI.java
@@
-8,7
+8,9
@@
public interface JalviewObjectI
public AlignFrame getCurrentAlignFrame();
public AlignFrame getCurrentAlignFrame();
- public static AlignFrame currentAlFrame = null;
+ public final static String currentAlFrameName = "currentAlFrame";
+
+ public final static String jalviewObjectName = "Jalview";
public void quit();
}
public void quit();
}
diff --git
a/src/jalview/gui/AlignFrame.java
b/src/jalview/gui/AlignFrame.java
index
ae14539
..
ac8ffb9
100644
(file)
--- a/
src/jalview/gui/AlignFrame.java
+++ b/
src/jalview/gui/AlignFrame.java
@@
-95,6
+95,7
@@
import jalview.api.analysis.SimilarityParamsI;
import jalview.bin.Cache;
import jalview.bin.Console;
import jalview.bin.Jalview;
import jalview.bin.Cache;
import jalview.bin.Console;
import jalview.bin.Jalview;
+import jalview.bin.groovy.JalviewObjectI;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
import jalview.commands.EditCommand.Action;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
import jalview.commands.EditCommand.Action;
@@
-5969,6
+5970,7
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
try
{
{
try
{
+ console.setVariable(JalviewObjectI.currentAlFrameName, this);
console.runScript();
} catch (Exception ex)
{
console.runScript();
} catch (Exception ex)
{
diff --git
a/src/jalview/gui/Desktop.java
b/src/jalview/gui/Desktop.java
index
b1f9000
..
1cedf3b
100644
(file)
--- a/
src/jalview/gui/Desktop.java
+++ b/
src/jalview/gui/Desktop.java
@@
-2663,8
+2663,9
@@
public class Desktop extends jalview.jbgui.GDesktop
{
JalviewObjectI j = new JalviewObject(this);
groovyConsole = new groovy.console.ui.Console();
{
JalviewObjectI j = new JalviewObject(this);
groovyConsole = new groovy.console.ui.Console();
- groovyConsole.setVariable("Jalview", j);
- groovyConsole.setVariable("currentAlFrame", getCurrentAlignFrame());
+ groovyConsole.setVariable(JalviewObjectI.jalviewObjectName, j);
+ groovyConsole.setVariable(JalviewObjectI.currentAlFrameName,
+ getCurrentAlignFrame());
groovyConsole.run();
/*
groovyConsole.run();
/*