本文整理汇总了Java中org.netbeans.spi.editor.highlighting.HighlightsChangeEvent类的典型用法代码示例。如果您正苦于以下问题:Java HighlightsChangeEvent类的具体用法?Java HighlightsChangeEvent怎么用?Java HighlightsChangeEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HighlightsChangeEvent类属于org.netbeans.spi.editor.highlighting包,在下文中一共展示了HighlightsChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
@Override
public void highlightChanged(HighlightsChangeEvent event) {
layerEvent = event;
try {
if (!listeners.isEmpty()) {
HighlightsChangeEvent thisEvt = new HighlightsChangeEvent(this, event.getStartOffset(), event.getEndOffset());
for (HighlightsChangeListener l : listeners) {
l.highlightChanged(thisEvt);
}
}
synchronized (activeHlSeqs) {
for (Reference<HlSequence> hlSeqRef : activeHlSeqs) {
HlSequence seq = hlSeqRef.get();
if (seq != null) {
seq.notifyLayersChanged();
}
}
activeHlSeqs.clear();
}
} finally {
layerEvent = null;
}
}
示例2: fireHighlightsChange
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
/**
* Notifies all registered listeners about a change in this container. The
* area of a document where highlights changed is specified by the
* <code>changeStartOffset</code> and <code>changeEndOffset</code> parameters.
*
* @param changeStartOffset The starting offset of the changed area.
* @param changeEndOffset The ending offset of the changed area.
*/
protected final void fireHighlightsChange(int changeStartOffset, int changeEndOffset) {
List<HighlightsChangeListener> targets;
synchronized (listeners) {
targets = listeners.getListeners();
}
if (targets.size() > 0) {
HighlightsChangeEvent evt = new HighlightsChangeEvent(this, changeStartOffset, changeEndOffset);
for(HighlightsChangeListener l : targets) {
l.highlightChanged(evt);
}
}
}
示例3: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
public void highlightChanged(HighlightsChangeEvent event) {
fireHighlightsChange(event.getStartOffset(), event.getEndOffset());
// XXX: not neccessary
// final int startOffset = event.getStartOffset();
// final int endOffset = event.getEndOffset();
//
// SwingUtilities.invokeLater(new Runnable() {
// private boolean inDocumentRender = false;
// public void run() {
// if (inDocumentRender) {
// fireHighlightsChange(startOffset, endOffset);
// } else {
// inDocumentRender = true;
// document.render(this);
// }
// }
// });
}
示例4: AbstractSemanticHighlighter
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
protected AbstractSemanticHighlighter(@NonNull StyledDocument document, @NonNull ParserDataDefinition<? extends SemanticData> semanticDataDefinition) {
Parameters.notNull("document", document);
Parameters.notNull("semanticDataDefinition", semanticDataDefinition);
this.document = document;
this.semanticDataDefinition = semanticDataDefinition;
this.taskManager = Lookup.getDefault().lookup(ParserTaskManager.class);
this.versionedDocument = VersionedDocumentUtilities.getVersionedDocument(document);
this.dataListener = new DataListener();
this.container = new OffsetsBag(document, true);
this.container.addHighlightsChangeListener(new HighlightsChangeListener() {
@Override
public void highlightChanged(HighlightsChangeEvent event) {
fireHighlightsChange(event.getStartOffset(), event.getEndOffset());
}
});
}
示例5: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
@Override
public void highlightChanged(HighlightsChangeEvent evt) {
if (hlChangeStartOffset == -1) {
hlChangeStartOffset = evt.getStartOffset();
hlChangeEndOffset = evt.getEndOffset();
} else {
hlChangeStartOffset = Math.min(hlChangeStartOffset, evt.getStartOffset());
hlChangeEndOffset = Math.max(hlChangeEndOffset, evt.getEndOffset());
}
}
示例6: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
public @Override void highlightChanged(HighlightsChangeEvent event) {
ProxyHighlightsContainer container = ref.get();
if (container != null) {
container.layerChanged(
(HighlightsContainer)event.getSource(),
event.getStartOffset(),
event.getEndOffset());
}
}
示例7: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
public @Override void highlightChanged(HighlightsChangeEvent event) {
CompoundHighlightsContainer container = ref.get();
if (container != null) {
container.layerChanged(
(HighlightsContainer)event.getSource(),
event.getStartOffset(),
event.getEndOffset());
}
}
示例8: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
@Override
public void highlightChanged(HighlightsChangeEvent event) {
int startOffset = event.getStartOffset();
int endOffset = event.getEndOffset();
String range = "change range <" + startOffset + "," + endOffset + ">";
checkRemoveChangeOffset(startOffset, "Invalid startOffset of " + range);
checkRemoveChangeOffset(endOffset, "Invalid endOffset of " + range);
}
示例9: fireHilitingChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
void fireHilitingChanged() {
synchronized(listeners) {
for (HighlightsChangeListener listener : listeners) {
listener.highlightChanged(new HighlightsChangeEvent(this, 0, Integer.MAX_VALUE));
}
}
}
示例10: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
@Override
public void highlightChanged(final HighlightsChangeEvent evt) {
if (isReleased()) {
return;
}
// Since still many highlighting layers fire changes without document lock acquired
// do an extra read lock so that view hierarchy surely operates under document lock
document().render(new Runnable() {
@Override
public void run() {
int startOffset = evt.getStartOffset();
int endOffset = evt.getEndOffset();
if (evt.getSource() == highlightsContainer) {
if (usageCount != 0) { // When views are being created => notify stale creation
notifyStaleCreation();
}
int docTextLength = document().getLength() + 1;
assert (startOffset >= 0) : "startOffset=" + startOffset + " < 0"; // NOI18N
assert (endOffset >= 0) : "startOffset=" + endOffset + " < 0"; // NOI18N
startOffset = Math.min(startOffset, docTextLength);
endOffset = Math.min(endOffset, docTextLength);
if (ViewHierarchyImpl.CHANGE_LOG.isLoggable(Level.FINE)) {
HighlightsChangeEvent layerEvent = (highlightsContainer instanceof DirectMergeContainer)
? ((DirectMergeContainer) highlightsContainer).layerEvent()
: null;
String layerInfo = (layerEvent != null)
? " " + highlightingManager.findLayer((HighlightsContainer)layerEvent.getSource()) // NOI18N
: ""; // NOI18N
ViewUtils.log(ViewHierarchyImpl.CHANGE_LOG, "VIEW-REBUILD-HC:<" + // NOI18N
startOffset + "," + endOffset + ">" + layerInfo + "\n"); // NOI18N
}
if (startOffset <= endOffset) { // May possibly be == e.g. for cut-line action
fireEvent(EditorViewFactoryChange.createList(startOffset, endOffset,
EditorViewFactoryChange.Type.CHARACTER_CHANGE));
}
} else if (evt.getSource() == paintHighlightsContainer) { // Paint highlights change
if (ViewHierarchyImpl.CHANGE_LOG.isLoggable(Level.FINE)) {
HighlightsChangeEvent layerEvent = (paintHighlightsContainer instanceof DirectMergeContainer)
? ((DirectMergeContainer) paintHighlightsContainer).layerEvent()
: null;
String layerInfo = (layerEvent != null)
? " " + highlightingManager.findLayer((HighlightsContainer) layerEvent.getSource()) // NOI18N
: ""; // NOI18N
ViewUtils.log(ViewHierarchyImpl.CHANGE_LOG, "REPAINT-HC:<" + // NOI18N
startOffset + "," + endOffset + ">" + layerInfo + "\n"); // NOI18N
}
offsetRepaint(startOffset, endOffset);
} // else: can happen when updateHighlightsContainer() being called => ignore
}
});
}
示例11: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
public void highlightChanged(HighlightsChangeEvent event) {
fireHighlightsChange(event.getStartOffset(), event.getEndOffset());
}
示例12: fireHighlightsChange
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
private void fireHighlightsChange(HighlightsChangeEvent evt) {
for (HighlightsChangeListener listener : listenerList.getListeners()) {
listener.highlightChanged(evt);
}
}
示例13: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
public void highlightChanged(HighlightsChangeEvent event) {
eventsCnt++;
lastStartOffset = event.getStartOffset();
lastEndOffset = event.getEndOffset();
}
示例14: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
public void highlightChanged(HighlightsChangeEvent event) {
eventsCnt++;
lastEventStartOffset = event.getStartOffset();
lastEventEndOffset = event.getEndOffset();
}
示例15: highlightChanged
import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
@Override
public void highlightChanged(HighlightsChangeEvent event) {
fireHighlightsChange(event.getStartOffset(), event.getEndOffset());
}