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