当前位置: 首页>>代码示例>>Java>>正文


Java HighlightsChangeEvent类代码示例

本文整理汇总了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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:DirectMergeContainer.java

示例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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:AbstractHighlightsContainer.java

示例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);
//                }
//            }
//        });
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:BracesMatchHighlighting.java

示例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());
        }
    });
}
 
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:18,代码来源:AbstractSemanticHighlighter.java

示例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());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:CaretBasedBlockHighlighting.java

示例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());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ProxyHighlightsContainer.java

示例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());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:CompoundHighlightsContainer.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:WhitespaceHighlightingTest.java

示例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));
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:MergePane.java

示例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
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:55,代码来源:HighlightsViewFactory.java

示例11: highlightChanged

import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
public void highlightChanged(HighlightsChangeEvent event) {
    fireHighlightsChange(event.getStartOffset(), event.getEndOffset());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:BlockHighlighting.java

示例12: fireHighlightsChange

import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
private void fireHighlightsChange(HighlightsChangeEvent evt) {
    for (HighlightsChangeListener listener : listenerList.getListeners()) {
        listener.highlightChanged(evt);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:CaretOverwriteModeHighlighting.java

示例13: highlightChanged

import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
public void highlightChanged(HighlightsChangeEvent event) {
    eventsCnt++;
    lastStartOffset = event.getStartOffset();
    lastEndOffset = event.getEndOffset();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:SyntaxHighlightingTest.java

示例14: highlightChanged

import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
public void highlightChanged(HighlightsChangeEvent event) {
    eventsCnt++;
    lastEventStartOffset = event.getStartOffset();
    lastEventEndOffset = event.getEndOffset();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:ProxyHighlightsContainerTest.java

示例15: highlightChanged

import org.netbeans.spi.editor.highlighting.HighlightsChangeEvent; //导入依赖的package包/类
@Override
public void highlightChanged(HighlightsChangeEvent event) {
    fireHighlightsChange(event.getStartOffset(), event.getEndOffset());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:TextSearchHighlighting.java


注:本文中的org.netbeans.spi.editor.highlighting.HighlightsChangeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。