more plugin work
parent
23bd9f26fe
commit
7cc79432df
16
actions.xml
16
actions.xml
|
@ -3,6 +3,12 @@
|
||||||
<!DOCTYPE ACTIONS SYSTEM "actions.dtd">
|
<!DOCTYPE ACTIONS SYSTEM "actions.dtd">
|
||||||
|
|
||||||
<ACTIONS>
|
<ACTIONS>
|
||||||
|
<ACTION NAME="factor-listener">
|
||||||
|
<CODE>
|
||||||
|
wm.addDockableWindow("console");
|
||||||
|
wm.getDockableWindow("console").setShell("Factor");
|
||||||
|
</CODE>
|
||||||
|
</ACTION>
|
||||||
<ACTION NAME="factor-restart">
|
<ACTION NAME="factor-restart">
|
||||||
<CODE>
|
<CODE>
|
||||||
FactorPlugin.stopExternalInstance();
|
FactorPlugin.stopExternalInstance();
|
||||||
|
@ -15,7 +21,7 @@
|
||||||
if(sel == null)
|
if(sel == null)
|
||||||
view.toolkit.beep();
|
view.toolkit.beep();
|
||||||
else
|
else
|
||||||
FactorPlugin.eval(view,sel);
|
FactorPlugin.evalInListener(view,sel);
|
||||||
</CODE>
|
</CODE>
|
||||||
</ACTION>
|
</ACTION>
|
||||||
<ACTION NAME="factor-run-file">
|
<ACTION NAME="factor-run-file">
|
||||||
|
@ -35,7 +41,7 @@
|
||||||
view.toolkit.beep();
|
view.toolkit.beep();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FactorPlugin.eval(view,
|
FactorPlugin.evalInListener(view,
|
||||||
"\""
|
"\""
|
||||||
+ FactorReader.charsToEscapes(word)
|
+ FactorReader.charsToEscapes(word)
|
||||||
+ "\" apropos.");
|
+ "\" apropos.");
|
||||||
|
@ -44,12 +50,12 @@
|
||||||
</ACTION>
|
</ACTION>
|
||||||
<ACTION NAME="factor-see">
|
<ACTION NAME="factor-see">
|
||||||
<CODE>
|
<CODE>
|
||||||
FactorPlugin.factorWordOperation(view,"see");
|
FactorPlugin.factorWordOutputOp(view,"see");
|
||||||
</CODE>
|
</CODE>
|
||||||
</ACTION>
|
</ACTION>
|
||||||
<ACTION NAME="factor-edit">
|
<ACTION NAME="factor-edit">
|
||||||
<CODE>
|
<CODE>
|
||||||
FactorPlugin.factorWordOperation(view,"jedit");
|
FactorPlugin.factorWordWireOp(view,"jedit");
|
||||||
</CODE>
|
</CODE>
|
||||||
</ACTION>
|
</ACTION>
|
||||||
<ACTION NAME="factor-edit-dialog">
|
<ACTION NAME="factor-edit-dialog">
|
||||||
|
@ -60,7 +66,7 @@
|
||||||
</ACTION>
|
</ACTION>
|
||||||
<ACTION NAME="factor-usages">
|
<ACTION NAME="factor-usages">
|
||||||
<CODE>
|
<CODE>
|
||||||
FactorPlugin.factorWordOperation(view,"usages.");
|
FactorPlugin.factorWordOutputOp(view,"usages.");
|
||||||
</CODE>
|
</CODE>
|
||||||
</ACTION>
|
</ACTION>
|
||||||
<ACTION NAME="factor-insert-use">
|
<ACTION NAME="factor-insert-use">
|
||||||
|
|
|
@ -36,9 +36,11 @@ import javax.swing.text.Document;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.gjt.sp.jedit.gui.EnhancedDialog;
|
import org.gjt.sp.jedit.gui.EnhancedDialog;
|
||||||
import org.gjt.sp.jedit.*;
|
import org.gjt.sp.jedit.*;
|
||||||
|
import org.gjt.sp.util.Log;
|
||||||
|
|
||||||
public class EditWordDialog extends WordListDialog
|
public class EditWordDialog extends WordListDialog
|
||||||
{
|
{
|
||||||
|
@ -80,8 +82,15 @@ public class EditWordDialog extends WordListDialog
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String code = FactorPlugin.factorWord(word);
|
try
|
||||||
FactorPlugin.eval(view,code + " jedit");
|
{
|
||||||
|
FactorPlugin.evalInWire(FactorPlugin.factorWord(word) + " jedit");
|
||||||
|
}
|
||||||
|
catch(IOException e)
|
||||||
|
{
|
||||||
|
/* Don't care */
|
||||||
|
Log.log(Log.ERROR,this,e);
|
||||||
|
}
|
||||||
dispose();
|
dispose();
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
|
|
|
@ -158,8 +158,8 @@ public class FactorPlugin extends EditPlugin
|
||||||
"sidekick.SideKickParser","factor");
|
"sidekick.SideKickParser","factor");
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
//{{{ eval() method
|
//{{{ evalInListener() method
|
||||||
public static void eval(View view, String cmd)
|
public static void evalInListener(View view, String cmd)
|
||||||
{
|
{
|
||||||
DockableWindowManager wm = view.getDockableWindowManager();
|
DockableWindowManager wm = view.getDockableWindowManager();
|
||||||
wm.addDockableWindow("console");
|
wm.addDockableWindow("console");
|
||||||
|
@ -167,6 +167,12 @@ public class FactorPlugin extends EditPlugin
|
||||||
console.run(Shell.getShell("Factor"),console,cmd);
|
console.run(Shell.getShell("Factor"),console,cmd);
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
|
//{{{ evalInWire() method
|
||||||
|
public static void evalInWire(String cmd) throws IOException
|
||||||
|
{
|
||||||
|
getExternalInstance().eval(cmd);
|
||||||
|
} //}}}
|
||||||
|
|
||||||
//{{{ factorWord() method
|
//{{{ factorWord() method
|
||||||
/**
|
/**
|
||||||
* Build a Factor expression for pushing the selected word on the stack
|
* Build a Factor expression for pushing the selected word on the stack
|
||||||
|
@ -202,17 +208,30 @@ public class FactorPlugin extends EditPlugin
|
||||||
return null;
|
return null;
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
//{{{ factorWordOperation() method
|
//{{{ factorWordOutputOp() method
|
||||||
/**
|
/**
|
||||||
* Apply a Factor word to the selected word.
|
* Apply a Factor word to the selected word.
|
||||||
*/
|
*/
|
||||||
public static void factorWordOperation(View view, String op)
|
public static void factorWordOutputOp(View view, String op)
|
||||||
{
|
{
|
||||||
String word = factorWord(view);
|
String word = factorWord(view);
|
||||||
if(word == null)
|
if(word == null)
|
||||||
view.getToolkit().beep();
|
view.getToolkit().beep();
|
||||||
else
|
else
|
||||||
eval(view,word + " " + op);
|
evalInListener(view,word + " " + op);
|
||||||
|
} //}}}
|
||||||
|
|
||||||
|
//{{{ factorWordWireOp() method
|
||||||
|
/**
|
||||||
|
* Apply a Factor word to the selected word.
|
||||||
|
*/
|
||||||
|
public static void factorWordWireOp(View view, String op) throws IOException
|
||||||
|
{
|
||||||
|
String word = factorWord(view);
|
||||||
|
if(word == null)
|
||||||
|
view.getToolkit().beep();
|
||||||
|
else
|
||||||
|
evalInWire(word + " " + op);
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
//{{{ getCompletions() method
|
//{{{ getCompletions() method
|
||||||
|
|
|
@ -81,8 +81,7 @@ public class WordPreview implements ActionListener, CaretListener
|
||||||
{
|
{
|
||||||
View view = textArea.getView();
|
View view = textArea.getView();
|
||||||
|
|
||||||
SideKickParsedData data = SideKickParsedData
|
SideKickParsedData data = SideKickParsedData.getParsedData(view);
|
||||||
.getParsedData(view);
|
|
||||||
if(data instanceof FactorParsedData)
|
if(data instanceof FactorParsedData)
|
||||||
{
|
{
|
||||||
int line = textArea.getCaretLine();
|
int line = textArea.getCaretLine();
|
||||||
|
|
Loading…
Reference in New Issue