本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.RSyntaxTextArea类的典型用法代码示例。如果您正苦于以下问题:Java RSyntaxTextArea类的具体用法?Java RSyntaxTextArea怎么用?Java RSyntaxTextArea使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RSyntaxTextArea类属于org.fife.ui.rsyntaxtextarea包,在下文中一共展示了RSyntaxTextArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
if (textField.getText().length() == 0)
return;
RSyntaxTextArea pane = mainWindow.getModel().getCurrentTextArea();
if (pane == null)
return;
SearchContext context = new SearchContext();
context.setSearchFor(textField.getText());
context.setMatchCase(mcase.isSelected());
context.setRegularExpression(regex.isSelected());
context.setSearchForward(!reverse.isSelected());
context.setWholeWord(wholew.isSelected());
if (!SearchEngine.find(pane, context).wasFound()) {
pane.setSelectionStart(0);
pane.setSelectionEnd(0);
}
}
示例2: actionPerformed
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
if (textField.getText().length() == 0)
return;
RSyntaxTextArea pane = mainWindow.getModel().getCurrentTextArea();
if (pane == null)
return;
SearchContext context = new SearchContext();
context.setSearchFor(textField.getText());
context.setMatchCase(mcase.isSelected());
context.setRegularExpression(regex.isSelected());
context.setSearchForward(!reverse.isSelected());
context.setWholeWord(wholew.isSelected());
if (!SearchEngine.find(pane, context).wasFound()) {
if (wrap.isSelected()) {
pane.setSelectionStart(0);
pane.setSelectionEnd(0);
} else {
mainWindow.getLabel().setText("Search Complete");
}
}
}
示例3: findOpenFoldClosestTo
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
private Fold findOpenFoldClosestTo(Point p) {
Fold fold = null;
RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
if (rsta.isCodeFoldingEnabled()) { // Should always be true
int offs = rsta.viewToModel(p); // TODO: Optimize me
if (offs>-1) {
try {
int line = rsta.getLineOfOffset(offs);
FoldManager fm = rsta.getFoldManager();
fold = fm.getFoldForLine(line);
if (fold==null) {
fold = fm.getDeepestOpenFoldContaining(offs);
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Never happens
}
}
}
return fold;
}
示例4: mouseClicked
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
// // TODO: Implement code folding with word wrap enabled
// if (textArea.getLineWrap()) {
// UIManager.getLookAndFeel().provideErrorFeedback(textArea);
// return;
// }
Point p = e.getPoint();
int line = rowAtPoint(p);
RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
FoldManager fm = rsta.getFoldManager();
Fold fold = fm.getFoldForLine(line);
if (fold!=null) {
fold.toggleCollapsedState();
getGutter().repaint();
textArea.repaint();
}
}
示例5: propertyChange
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent e) {
String name = e.getPropertyName();
if (RSyntaxTextArea.SYNTAX_STYLE_PROPERTY.equals(name)) {
// Syntax style changed in editor.
updateFoldParser();
reparse(); // Even if no fold parser change, highlighting did
}
else if ("document".equals(name)) {
// The document switched out from under us
RDocument old = (RDocument)e.getOldValue();
if (old != null) {
old.removeDocumentListener(this);
}
RDocument newDoc = (RDocument)e.getNewValue();
if (newDoc != null) {
newDoc.addDocumentListener(this);
}
reparse();
}
}
示例6: getTagCloseInfo
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
/**
* Grabs the token representing the closing of a tag (i.e.
* "<code>></code>" or "<code>/></code>"). This should only be
* called after a tag name has been parsed, to ensure the "closing" of
* other tags is not identified.
*
* @param tagNameToken The token denoting the name of the tag.
* @param textArea The text area whose contents are being parsed.
* @param line The line we're currently on.
* @param info On return, information about the closing of the tag is
* returned in this object.
* @return The line number of the closing tag token.
*/
private int getTagCloseInfo(Token tagNameToken, RSyntaxTextArea textArea,
int line, TagCloseInfo info) {
info.reset();
Token t = tagNameToken.getNextToken();
do {
while (t!=null && t.getType()!=Token.MARKUP_TAG_DELIMITER) {
t = t.getNextToken();
}
if (t!=null) {
info.closeToken = t;
info.line = line;
break;
}
} while (++line<textArea.getLineCount() &&
(t=textArea.getTokenListForLine(line))!=null);
return line;
}
示例7: uninstall
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
/**
* Uninstalls this listener from the current text component.
*/
public void uninstall() {
JTextComponent tc = ac.getTextComponent();
tc.removeCaretListener(this);
tc.removeFocusListener(this);
tc.getDocument().removeDocumentListener(this);
uninstallKeyBindings();
if (markOccurrencesEnabled) {
((RSyntaxTextArea) tc).setMarkOccurrences(markOccurrencesEnabled);
}
// Remove WeakReferences in javax.swing.text.
maxPos = null;
minPos = -1;
removeParameterHighlights();
}
示例8: newTextArea
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
private RSyntaxTextArea newTextArea(){
// JTextArea textArea = new JTextArea();
// textArea.setAutoscrolls(true);
//// textArea.getDocument().addUndoableEditListener(undoMg);
// textArea.addMouseListener(new TextAreaMouseListener());
RSyntaxTextArea textArea = new RSyntaxTextArea();
textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
textArea.setCodeFoldingEnabled(true);
textArea.setAntiAliasingEnabled(true);
textArea.setAutoscrolls(true);
SyntaxScheme scheme = textArea.getSyntaxScheme();
// scheme.getStyle(Token.COMMENT_KEYWORD).foreground = Color.red;
// scheme.getStyle(Token.DATA_TYPE).foreground = Color.blue;
scheme.getStyle(Token.LITERAL_STRING_DOUBLE_QUOTE).foreground = Color.BLUE;
scheme.getStyle(Token.LITERAL_NUMBER_DECIMAL_INT).foreground = new Color(164, 0, 0);
scheme.getStyle(Token.LITERAL_NUMBER_FLOAT).foreground = new Color(164, 0, 0);
scheme.getStyle(Token.LITERAL_BOOLEAN).foreground = Color.RED;
scheme.getStyle(Token.OPERATOR).foreground = Color.BLACK;
textArea.revalidate();
textArea.addMouseListener(new TextAreaMouseListener());
return textArea;
}
示例9: createTextComponentImpl
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
@Override
protected RSyntaxTextArea createTextComponentImpl() {
RSyntaxTextArea impl = new RSyntaxTextArea();
int height = (int) impl.getPreferredSize().getHeight();
impl.setMinimumSize(new Dimension(0, height));
RTextScrollPane scrollPane = new RTextScrollPane(impl);
scrollPane.setLineNumbersEnabled(showGutter);
composition = scrollPane;
composition.setPreferredSize(new Dimension(150, height));
composition.setMinimumSize(new Dimension(0, height));
doc.putProperty("filterNewlines", false);
return impl;
}
示例10: propertyChange
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent e) {
String name = e.getPropertyName();
// If they change the text area's font, we need to update cell
// heights to match the font's height.
if ("font".equals(name) ||
RSyntaxTextArea.SYNTAX_SCHEME_PROPERTY.equals(name)) {
for (int i = 0; i < getComponentCount(); i++) {
AbstractGutterComponent agc =
(AbstractGutterComponent) getComponent(i);
agc.lineHeightsChanged();
}
}
}
示例11: setVisible
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
@Override
public void setVisible(boolean b) {
tfSearchEditor.setText("");
if (tfReplaceEditor != null) {
tfReplaceEditor.setText("");
}
RSyntaxTextArea ta = parent.getScriptEditorTA();
if (b) {
currentLine = ta.getCaretLineNumber();
initialRunningStep = parent.getCurrentRunningStep();
initialLine = ta.getCaretLineNumber();
tfSearchEditor.requestFocusInWindow();
} else {
// if (initialRunningStep >= 0 && initialRunningStep < ta.getLineCount() -1) {
// ta.setActiveLineRange(initialRunningStep + 1, initialRunningStep + 1);
// } else {
// ta.setActiveLineRange(-1, -1);
// }
// parent.fireStepChanged(initialRunningStep);
// ta.setCurrentLine(initialLine);
// parent.repaint();
}
super.setVisible(b);
}
示例12: createBottomPanel
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
/**
* @param debuggerActions
* @param loadChooser
* @return
*/
static Component createBottomPanel(final AgentDebuggerFrame frame) {
JPanel panel = new JPanel(new BorderLayout());
RSyntaxTextArea loggerTA = new RSyntaxTextArea();
frame.setLoggerTA(loggerTA);
loggerTA.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
loggerTA.setHyperlinksEnabled(false);
loggerTA.setEditable(false);
loggerTA.setHighlightCurrentLine(false);
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.add(frame.getDebuggerActions().getSaveLogAction());
popupMenu.add(frame.getDebuggerActions().getClearLogOutputAction());
loggerTA.setPopupMenu(popupMenu);
RTextScrollPane sp = new RTextScrollPane(loggerTA);
sp.setIconRowHeaderEnabled(false);
sp.getGutter().setBookmarkingEnabled(false);
panel.add(sp, BorderLayout.CENTER);
DebuggerAppender.addTextArea(loggerTA);
return panel;
}
示例13: StepDialog
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
public StepDialog(AgentDebuggerFrame f, String text, String type) {
super(f, true);
this.f = f;
setLayout(new BorderLayout());
ta = new RSyntaxTextArea();
ta.setSyntaxEditingStyle(type);
ta.setHyperlinksEnabled(false);
ta.setText(text);
ta.setCaretPosition(0);
RTextScrollPane sp = new RTextScrollPane(ta);
sp.setIconRowHeaderEnabled(true);
add(BorderLayout.CENTER, sp);
add(createButtonPanel(), BorderLayout.SOUTH);
setSize(new Dimension(800, 600));
setBounds(new Rectangle(getSize()));
setPreferredSize(getSize());
WindowUtil.centerOnParent(this);
}
示例14: addComponenets
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
protected void addComponenets() {
this.codingArea = new RSyntaxTextArea(18, 60);
codingArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
codingArea.setCodeFoldingEnabled(true);
codingArea.setText(standardScript());
bodyPanel.setLayout(new BorderLayout());
JPanel northPanel = addToNorth();
if (northPanel != null) {
bodyPanel.add(northPanel, BorderLayout.NORTH);
}
bodyPanel.add(new RTextScrollPane(codingArea), BorderLayout.CENTER);
// insert footer button
okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
returnedValue = RETURNED_VALUES.SUCCESS;
CodeDialog.this.dispose();
}
});
addFooterButton(okButton, true);
}
示例15: uninstall
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入依赖的package包/类
/**
* Uninstalls this listener from the current text component.
*/
public void uninstall() {
JTextComponent tc = ac.getTextComponent();
tc.removeCaretListener(this);
tc.removeFocusListener(this);
tc.getDocument().removeDocumentListener(this);
uninstallKeyBindings();
if (markOccurrencesEnabled) {
((RSyntaxTextArea)tc).setMarkOccurrences(markOccurrencesEnabled);
}
// Remove WeakReferences in javax.swing.text.
maxPos = null;
minPos = -1;
removeParameterHighlights();
}