本文整理了Java中org.netbeans.editor.Utilities.getLastActiveComponent()
方法的一些代码示例,展示了Utilities.getLastActiveComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.getLastActiveComponent()
方法的具体详情如下:
包路径:org.netbeans.editor.Utilities
类名称:Utilities
方法名:getLastActiveComponent
[英]Returns last activated component. If the component was closed, then previous component is returned
[中]返回上次激活的组件。如果组件已关闭,则返回上一个组件
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
public static void returnFocus() {
JTextComponent c = getLastActiveComponent();
if (c != null) {
requestFocus(c);
}
}
代码示例来源:origin: net.java.abeille/abeille
public static void returnFocus() {
JTextComponent c = getLastActiveComponent();
if (c != null) {
requestFocus(c);
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
private void updateCaretPosition() {
JTextComponent c = Utilities.getLastActiveComponent();
if (c != null) {
caretPosition = c.getCaret().getDot();
}
}
代码示例来源:origin: net.java.abeille/abeille
public static void checkAddEntry() {
JTextComponent c = Utilities.getLastActiveComponent();
if (c != null) {
checkAddEntry(c, c.getCaret().getDot());
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
public static void checkAddEntry() {
JTextComponent c = Utilities.getLastActiveComponent();
if (c != null) {
checkAddEntry(c, c.getCaret().getDot());
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
/** Set the dot to the component and position
* stored in the mark.
* @return true if the caret was successfully moved
*/
public boolean setDot() {
JTextComponent c = getComponent();
if (c != null) {
if (Utilities.getLastActiveComponent() != c) {
Utilities.requestFocus(c); // possibly request for the component
}
int pos = getPosition();
if (pos >= 0 && pos <= c.getDocument().getLength()) {
c.getCaret().setDot(pos); // set the dot
return true;
}
}
return false;
}
代码示例来源:origin: net.java.abeille/abeille
/**
* Set the dot to the component and position stored in the mark.
*
* @return true if the caret was successfully moved
*/
public boolean setDot() {
JTextComponent c = getComponent();
if (c != null) {
if (Utilities.getLastActiveComponent() != c) {
Utilities.requestFocus(c); // possibly request for the
// component
}
int pos = getPosition();
if (pos >= 0 && pos <= c.getDocument().getLength()) {
c.getCaret().setDot(pos); // set the dot
return true;
}
}
return false;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
public void insertUpdate(DocumentEvent evt) {
JTextComponent c = component;
if (c != null) {
BaseDocument doc = (BaseDocument)component.getDocument();
BaseDocumentEvent bevt = (BaseDocumentEvent)evt;
if ((bevt.isInUndo() || bevt.isInRedo())
&& component == Utilities.getLastActiveComponent()
) {
// in undo mode and current component
undoOffset = evt.getOffset() + evt.getLength();
} else {
undoOffset = -1;
}
modified = true;
modifiedUpdate();
}
}
代码示例来源:origin: net.java.abeille/abeille
public void replaceAll(Map props) {
incSearchReset();
JTextComponent c = Utilities.getLastActiveComponent();
BaseDocument doc = (BaseDocument) c.getDocument();
int maxCnt = doc.getLength();
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
protected void init(boolean isReplace, KeyEventBlocker blocker) {
this.blocker = blocker;
findHistory.setSelectedItem(null);
replaceHistory.setSelectedItem(null);
findWhat.getEditor().getEditorComponent().addFocusListener(this);
if (isReplace) {
replaceWith.getEditor().getEditorComponent().addFocusListener(this);
}
JTextComponent c = Utilities.getLastActiveComponent();
String selText = null;
if (c != null) {
selText = c.getSelectedText();
if (selText != null) {
int n = selText.indexOf( '\n' );
if (n >= 0 ) selText = selText.substring(0, n);
findWhat.getEditor().setItem(selText.trim());
changeFindWhat();
}
}
findProps.putAll(FindSupport.getFindSupport().getFindProperties());
highlightSearch.setSelected(getBooleanProperty(highlightSearch));
incSearch.setSelected(getBooleanProperty(incSearch));
matchCase.setSelected(getBooleanProperty(matchCase));
smartCase.setSelected(getBooleanProperty(smartCase));
wholeWords.setSelected(getBooleanProperty(wholeWords));
regExp.setSelected(getBooleanProperty(regExp));
bwdSearch.setSelected(getBooleanProperty(bwdSearch));
wrapSearch.setSelected(getBooleanProperty(wrapSearch));
}
代码示例来源:origin: net.java.abeille/abeille
public void incSearchReset() {
JTextComponent c = Utilities.getLastActiveComponent();
EditorUI editorUI = ((BaseTextUI) c.getUI()).getEditorUI();
DrawLayerFactory.IncSearchLayer incLayer = (DrawLayerFactory.IncSearchLayer) editorUI.findLayer(DrawLayerFactory.INC_SEARCH_LAYER_NAME);
if (incLayer != null) {
if (incLayer.isEnabled()) {
incLayer.setEnabled(false);
try {
editorUI.repaintOffset(incLayer.getOffset());
} catch (BadLocationException e) {
if (Boolean.getBoolean("netbeans.debug.exceptions")) { // NOI18N
e.printStackTrace();
}
}
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
public void removeUpdate(DocumentEvent evt) {
JTextComponent c = component;
if (c != null) {
BaseDocument doc = (BaseDocument)c.getDocument();
// make selection invisible if removal shrinked block to zero size
if (selectionVisible && (getDot() == getMark())) {
setSelectionVisible(false);
}
BaseDocumentEvent bevt = (BaseDocumentEvent)evt;
if ((bevt.isInUndo() || bevt.isInRedo())
&& c == Utilities.getLastActiveComponent()
) {
// in undo mode and current component
undoOffset = evt.getOffset();
} else {
undoOffset = -1;
}
modified = true;
modifiedUpdate();
}
}
代码示例来源:origin: net.java.abeille/abeille
public void run() {
JTextComponent c = Utilities.getLastActiveComponent();
if (c != null) {
String selText = c.getSelectedText();
if (selText != null) {
int n = selText.indexOf('\n');
if (n >= 0)
selText = selText.substring(0, n);
findPanel.updateFindWhat(selText.trim());
}
else {
if (getProperty(findWhat) != null) {
findWhat.getEditor().setItem(getProperty(findWhat));
}
}
}
findWhat.getEditor().getEditorComponent().requestFocus();
findWhat.requestFocus();
findWhat.getEditor().selectAll();
}
});
代码示例来源:origin: net.java.abeille/abeille
JTextComponent c = Utilities.getLastActiveComponent();
if (c != null) {
Caret caret = c.getCaret();
代码示例来源:origin: net.java.abeille/abeille
JTextComponent c = Utilities.getLastActiveComponent();
if (c != null) {
try {
代码示例来源:origin: net.java.abeille/abeille
public void removeUpdate(DocumentEvent evt) {
JTextComponent c = component;
if (c != null) {
BaseDocument doc = (BaseDocument) c.getDocument();
// make selection invisible if removal shrinked block to zero size
if (selectionVisible && (getDot() == getMark())) {
setSelectionVisible(false);
}
BaseDocumentEvent bevt = (BaseDocumentEvent) evt;
if ((bevt.isInUndo() || bevt.isInRedo()) && c == Utilities.getLastActiveComponent()) {
// in undo mode and current component
setDot(evt.getOffset());
}
else {
fireStateChanged();
// Scroll to caret only for component with focus
dispatchUpdate(c.hasFocus() ? this : null, EditorUI.SCROLL_MOVE);
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
public void incSearchReset() {
JTextComponent c = Utilities.getLastActiveComponent();
if (c==null) return; // #19558 bugfix. Editor window has been closed => c==null
EditorUI editorUI = ((BaseTextUI)c.getUI()).getEditorUI();
DrawLayerFactory.IncSearchLayer incLayer
= (DrawLayerFactory.IncSearchLayer)editorUI.findLayer(
DrawLayerFactory.INC_SEARCH_LAYER_NAME);
if (incLayer != null) {
if (incLayer.isEnabled()) {
incLayer.setEnabled(false);
try {
editorUI.repaintOffset(incLayer.getOffset());
} catch (BadLocationException e) {
Utilities.annotateLoggable(e);
}
}
}
}
代码示例来源:origin: net.java.abeille/abeille
public void insertUpdate(DocumentEvent evt) {
JTextComponent c = component;
if (c != null) {
BaseDocument doc = (BaseDocument) component.getDocument();
BaseDocumentEvent bevt = (BaseDocumentEvent) evt;
if ((bevt.isInUndo() || bevt.isInRedo()) && component == Utilities.getLastActiveComponent()) {
// in undo mode and current component
setDot(evt.getOffset() + evt.getLength());
}
else {
fireStateChanged();
if (evt.getLength() == 0) {
updateType();
setVisible(false);
setVisible(c.isEnabled() && c.hasFocus());
}
// Scroll to caret only for component with focus
dispatchUpdate(c.hasFocus() ? this : null, EditorUI.SCROLL_MOVE);
}
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
if (Utilities.getLastActiveComponent() != extEditorUI.getComponent()){
return; // bugfix of #43230
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-editor-deprecated-pre61completion
if (Utilities.getLastActiveComponent() != extEditorUI.getComponent()){
return; // bugfix of #43230
内容来源于网络,如有侵权,请联系作者删除!