本文整理汇总了Java中org.fife.ui.rtextarea.RTextArea类的典型用法代码示例。如果您正苦于以下问题:Java RTextArea类的具体用法?Java RTextArea怎么用?Java RTextArea使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RTextArea类属于org.fife.ui.rtextarea包,在下文中一共展示了RTextArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformedImpl
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
@Override
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
if (rsta.isCodeFoldingEnabled()) {
FoldCollapser collapser = new FoldCollapser() {
@Override
public boolean getShouldCollapse(Fold fold) {
return true;
}
};
collapser.collapseFolds(rsta.getFoldManager());
possiblyRepaintGutter(textArea);
}
else {
UIManager.getLookAndFeel().provideErrorFeedback(rsta);
}
}
示例2: getWordEnd
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
@Override
protected int getWordEnd(RTextArea textArea, int offs)
throws BadLocationException {
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
Element root = doc.getDefaultRootElement();
int line = root.getElementIndex(offs);
Element elem = root.getElement(line);
int end = elem.getEndOffset() - 1;
int wordEnd = offs;
while (wordEnd <= end) {
if (!isIdentifierChar(doc.charAt(wordEnd))) {
break;
}
wordEnd++;
}
return wordEnd;
}
示例3: doDefaultInsert
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
private final void doDefaultInsert(RTextArea textArea) {
// FIXME: We need a way to get the "trigger string" (i.e.,
// the text that was just typed); however, the text area's
// template manager might be null (if templates are disabled).
// Also, the manager's trigger string doesn't yet match up with
// that defined in RSyntaxTextAreaEditorKit.java (which is
// hardcoded as a space)...
//String str = manager.getInsertTriggerString();
//int mod = manager.getInsertTrigger().getModifiers();
//if (str!=null && str.length()>0 &&
// ((mod&ActionEvent.ALT_MASK)==(mod&ActionEvent.CTRL_MASK))) {
// char ch = str.charAt(0);
// if (ch>=0x20 && ch!=0x7F)
// textArea.replaceSelection(str);
//}
textArea.replaceSelection(" ");
}
示例4: actionPerformedImpl
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
if (!textArea.isEditable() || !textArea.isEnabled()) {
UIManager.getLookAndFeel().provideErrorFeedback(textArea);
return;
}
RSyntaxTextArea rsta = (RSyntaxTextArea) getTextComponent(e);
RSyntaxDocument doc = (RSyntaxDocument) rsta.getDocument();
int line = textArea.getCaretLineNumber();
int type = doc.getLastTokenTypeOnLine(line);
// Only in MLC's should we try this
if (type == Token.COMMENT_DOCUMENTATION ||
type == Token.COMMENT_MULTILINE) {
insertBreakInMLC(e, rsta, line);
}
else {
handleInsertBreak(rsta, true);
}
}
示例5: actionPerformedImpl
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
if (!textArea.isEditable() || !textArea.isEnabled()) {
UIManager.getLookAndFeel().provideErrorFeedback(textArea);
return;
}
RSyntaxTextArea sta = (RSyntaxTextArea) textArea;
boolean noSelection = sta.getSelectionStart() == sta.getSelectionEnd();
// First, see if this language wants to handle inserting newlines
// itself.
boolean handled = false;
if (noSelection) {
RSyntaxDocument doc = (RSyntaxDocument) sta.getDocument();
handled = doc.insertBreakSpecialHandling(e);
}
// If not...
if (!handled) {
handleInsertBreak(sta, noSelection);
}
}
示例6: doDefaultInsert
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
private final void doDefaultInsert(RTextArea textArea) {
// FIXME: We need a way to get the "trigger string" (i.e.,
// the text that was just typed); however, the text area's
// template manager might be null (if templates are disabled).
// Also, the manager's trigger string doesn't yet match up with
// that defined in RSyntaxTextAreaEditorKit.java (which is
// hardcoded as a space)...
// String str = manager.getInsertTriggerString();
// int mod = manager.getInsertTrigger().getModifiers();
// if (str!=null && str.length()>0 &&
// ((mod&ActionEvent.ALT_MASK)==(mod&ActionEvent.CTRL_MASK))) {
// char ch = str.charAt(0);
// if (ch>=0x20 && ch!=0x7F)
// textArea.replaceSelection(str);
// }
textArea.replaceSelection(" ");
}
示例7: createRTextScrollPane
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
public static RTextScrollPane createRTextScrollPane(RTextArea textArea){
Constructor[] ctors = RTextScrollPane.class.getConstructors();
Constructor ctor = null;
for(Constructor tmpCtor : ctors){
Class[] paramClasses = tmpCtor.getParameterTypes();
if(paramClasses != null && paramClasses.length == 1 && paramClasses[0].isAssignableFrom(RTextArea.class)){
ctor = tmpCtor;
break;
}
}
try {
return (RTextScrollPane) ctor.newInstance(textArea);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
SoapUI.logError(e);
return null;
}
}
示例8: createRTextScrollPane
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
public static RTextScrollPane createRTextScrollPane(RTextArea textArea) {
Constructor[] ctors = RTextScrollPane.class.getConstructors();
Constructor ctor = null;
for (Constructor tmpCtor : ctors) {
Class[] paramClasses = tmpCtor.getParameterTypes();
if (paramClasses != null && paramClasses.length == 1 && paramClasses[0].isAssignableFrom(RTextArea.class)) {
ctor = tmpCtor;
break;
}
}
try {
return (RTextScrollPane) ctor.newInstance(textArea);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
LOGGER.error(e);
return null;
}
}
示例9: EditorPanel
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
public EditorPanel(Script script) {
try {
filename = script.getName();
editor = new TextEditorPane(RTextArea.INSERT_MODE, false, FileLocation.create(new File(filename)));
editor.setText(script.getCode());
editor.setCaretPosition(0);
// editor tweaks
editor.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PYTHON);
editor.setCodeFoldingEnabled(true);
editor.setAntiAliasingEnabled(true);
// auto-completion
/*
if (ac != null) {
ac.install(editor);
ac.setShowDescWindow(true);
}
*/
panel = new RTextScrollPane(editor);
} catch (Exception e) {
Logging.logError(e);
}
}
示例10: actionPerformedImpl
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
if (!textArea.isEditable() || !textArea.isEnabled()) {
UIManager.getLookAndFeel().provideErrorFeedback(textArea);
return;
}
RSyntaxTextArea rsta = (RSyntaxTextArea)getTextComponent(e);
RSyntaxDocument doc = (RSyntaxDocument)rsta.getDocument();
int line = textArea.getCaretLineNumber();
int type = doc.getLastTokenTypeOnLine(line);
if (type<0) {
type = doc.getClosestStandardTokenTypeForInternalType(type);
}
// Only in MLC's should we try this
if (type==Token.COMMENT_DOCUMENTATION ||
type==Token.COMMENT_MULTILINE) {
insertBreakInMLC(e, rsta, line);
}
else {
handleInsertBreak(rsta, true);
}
}
示例11: actionPerformedImpl
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
if (!textArea.isEditable() || !textArea.isEnabled()) {
UIManager.getLookAndFeel().provideErrorFeedback(textArea);
return;
}
RSyntaxTextArea sta = (RSyntaxTextArea)textArea;
boolean noSelection= sta.getSelectionStart()==sta.getSelectionEnd();
// First, see if this language wants to handle inserting newlines
// itself.
boolean handled = false;
if (noSelection) {
RSyntaxDocument doc = (RSyntaxDocument)sta.getDocument();
handled = doc.insertBreakSpecialHandling(e);
}
// If not...
if (!handled) {
handleInsertBreak(sta, noSelection);
}
}
示例12: PanelRightPopup
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
public PanelRightPopup(PanelRightUi panelMessage) {
this.panelMessage = panelMessage;
menu = new JPopupMenu("Message");
menuCopy = new JMenuItem(RSyntaxTextArea.getAction(RTextArea.COPY_ACTION));
menu.add(menuCopy);
menuRepeater = new JMenuItem("Send to Repeater");
menuRepeater.addActionListener(this);
menu.add(menuRepeater);
menuToSentinel = new JMenuItem("Send to Sentinel");
menuToSentinel.addActionListener(this);
menu.add(menuToSentinel);
/*
menuReissue = new JMenuItem("Send again");
menuReissue.addActionListener(this);
menu.add(menuReissue);
*/
menuCopySmart = new JMenuItem("Copy Smart");
menuCopySmart.addActionListener(this);
menu.add(menuCopySmart);
}
示例13: getErsScripts
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
/**
* Generates Map of all scripts within this role
*/
public Map<String, String> getErsScripts(){
Map<String, String> ersScript = new LinkedHashMap<String, String>();
int indexes = this.getTabCount()-1;
if(indexes > 0){
for(int index = 0;index <= indexes;index++){
Component comp = this.getComponentAt(index);
if(comp instanceof RTextScrollPane){
String scriptName = this.getTitleAt(index);
if(!scriptName.equals("+")){
RTextArea textArea = ((RTextScrollPane) comp).getTextArea();
if(textArea != null){
ersScript.put(scriptName, textArea.getText());
}
}
}
}
}
return ersScript;
}
示例14: getGutter
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
/**
* Returns the gutter component of the scroll pane containing a text
* area, if any.
*
* @param textArea The text area.
* @return The gutter, or <code>null</code> if the text area is not in
* an {@link RTextScrollPane}.
* @see RTextScrollPane#getGutter()
*/
public static Gutter getGutter(RTextArea textArea) {
Gutter gutter = null;
Container parent = textArea.getParent();
if (parent instanceof JViewport) {
parent = parent.getParent();
if (parent instanceof RTextScrollPane) {
RTextScrollPane sp = (RTextScrollPane)parent;
gutter = sp.getGutter(); // Should always be non-null
}
}
return gutter;
}
示例15: actionPerformedImpl
import org.fife.ui.rtextarea.RTextArea; //导入依赖的package包/类
@Override
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
if (!textArea.isEditable() || !textArea.isEnabled()) {
UIManager.getLookAndFeel().provideErrorFeedback(textArea);
return;
}
RSyntaxTextArea rsta = (RSyntaxTextArea)getTextComponent(e);
RSyntaxDocument doc = (RSyntaxDocument)rsta.getDocument();
int line = textArea.getCaretLineNumber();
int type = doc.getLastTokenTypeOnLine(line);
if (type<0) {
type = doc.getClosestStandardTokenTypeForInternalType(type);
}
// Only in MLC's should we try this
if (type==Token.COMMENT_DOCUMENTATION ||
type==Token.COMMENT_MULTILINE) {
insertBreakInMLC(e, rsta, line);
}
else {
handleInsertBreak(rsta, true);
}
}