本文整理汇总了Java中org.netbeans.api.editor.EditorRegistry.componentList方法的典型用法代码示例。如果您正苦于以下问题:Java EditorRegistry.componentList方法的具体用法?Java EditorRegistry.componentList怎么用?Java EditorRegistry.componentList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.editor.EditorRegistry
的用法示例。
在下文中一共展示了EditorRegistry.componentList方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNextDoc
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
private BaseDocument getNextDoc(BaseDocument doc) {
if (doc == getStaticWordsDoc()) {
return null;
}
BaseDocument nextDoc = null;
Set<BaseDocument> list = new LinkedHashSet<BaseDocument>();
for(JTextComponent jtc : EditorRegistry.componentList()) {
list.add(Utilities.getDocument(jtc));
}
for(Iterator<? extends BaseDocument> i = list.iterator(); i.hasNext(); ) {
if (doc == i.next()) {
if (i.hasNext()) {
nextDoc = i.next();
}
break;
}
}
if (nextDoc == null) {
nextDoc = getStaticWordsDoc();
}
return nextDoc;
}
示例2: getNextDocument
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
private Document getNextDocument() {
// Initially documentIndex == -1
if (documentIndex == documents.size() - 1) { // Check adding
if (documentSet.isEmpty()) { // documents list not inited yet -> add 'doc'
documentSet.put(doc, Boolean.TRUE);
}
for (JTextComponent tc : EditorRegistry.componentList()) {
Document d = tc.getDocument();
if (!documentSet.containsKey(d)) {
documentSet.put(d, Boolean.TRUE);
documents.add(new WeakReference<Document>(d));
}
}
}
Document retDoc = null;
while (documentIndex < documents.size() - 1) {
documentIndex++;
retDoc = documents.get(documentIndex).get();
if (retDoc != null) {
break;
}
}
return retDoc;
}
示例3: getMostActiveJavaEditorContext
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
@Override
public EditorContext getMostActiveJavaEditorContext() {
for (JTextComponent component : EditorRegistry.componentList()) {
Document document = component.getDocument();
FileObject fileObject = NbEditorUtilities.getFileObject(document);
if ((fileObject != null) && fileObject.getExt().equalsIgnoreCase("java")) { // NOI18N
return new EditorContext(component, document, fileObject);
}
}
return null;
}
示例4: getPaneFor
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
public static JTextComponent getPaneFor(FileObject fo) {
JTextComponent pane = getOpenPane();
if (pane != null && findFileObject(pane) == fo) {
return pane;
}
for (JTextComponent c : EditorRegistry.componentList()) {
if (findFileObject(c) == fo) {
return c;
}
}
return null;
}
示例5: findEditor
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
/** TODO - MOVE TO UTILITTY LIBRARY */
private static JTextComponent findEditor(Document doc) {
JTextComponent comp = EditorRegistry.lastFocusedComponent();
if (comp.getDocument() == doc) {
return comp;
}
List<? extends JTextComponent> componentList = EditorRegistry.componentList();
for (JTextComponent component : componentList) {
if (comp.getDocument() == doc) {
return comp;
}
}
return null;
}
示例6: getActiveDocuments
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
@Override
public Set<? extends Document> getActiveDocuments() {
final Set<Document> res = Collections.newSetFromMap(new IdentityHashMap<Document, Boolean>());
for (JTextComponent jtc : EditorRegistry.componentList()) {
final Document doc = jtc.getDocument();
if (doc != null) {
res.add(doc);
}
}
return res;
}
示例7: refreshStatusLine
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
static void refreshStatusLine() {
LOG.fine("StatusLineFactories.refreshStatusLine()\n");
List<? extends JTextComponent> componentList = EditorRegistry.componentList();
for (JTextComponent component : componentList) {
boolean underMainWindow = (SwingUtilities.isDescendingFrom(component,
WindowManager.getDefault().getMainWindow()));
EditorUI editorUI = Utilities.getEditorUI(component);
if (LOG.isLoggable(Level.FINE)) {
String componentDesc = component.toString();
Document doc = component.getDocument();
Object streamDesc;
if (doc != null && ((streamDesc = doc.getProperty(Document.StreamDescriptionProperty)) != null)) {
componentDesc = streamDesc.toString();
}
LOG.fine(" underMainWindow=" + underMainWindow + // NOI18N
", text-component: " + componentDesc + "\n");
}
if (editorUI != null) {
StatusBar statusBar = editorUI.getStatusBar();
statusBar.setVisible(!underMainWindow);
boolean shouldUpdateGlobal = underMainWindow && component.isShowing();
if (shouldUpdateGlobal) {
statusBar.updateGlobal();
LOG.fine(" end of refreshStatusLine() - found main window component\n\n"); // NOI18N
return; // First non-docked one found and updated -> quit
}
}
}
clearStatusLine();
LOG.fine(" end of refreshStatusLine() - no components - status line cleared\n\n"); // NOI18N
}
示例8: resultsUpdated
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
@Override
public void resultsUpdated(Project project, CoverageProvider provider) {
Set<String> mimeTypes = provider.getMimeTypes();
for (JTextComponent target : EditorRegistry.componentList()) {
Document document = target.getDocument();
String mimeType = (String) document.getProperty(MIME_TYPE);
if (mimeType != null && mimeTypes.contains(mimeType)) {
FileObject fo = GsfUtilities.findFileObject(document);
if (fo != null && FileOwnerQuery.getOwner(fo) == project) {
FileCoverageDetails hitCounts = (FileCoverageDetails) document.getProperty(COVERAGE_DOC_PROPERTY);
if (hitCounts == null) {
document.putProperty(COVERAGE_DOC_PROPERTY, null); // ehh... what?
}
if (isEnabled(project)) {
focused(fo, target);
} else {
CoverageHighlightsContainer container = CoverageHighlightsLayerFactory.getContainer(target);
if (container != null) {
container.refresh();
}
}
}
}
}
final CoverageReportTopComponent report = showingReports.get(project);
if (report != null) {
final List<FileCoverageSummary> coverage = provider.getResults();
Mutex.EVENT.readAccess(new Runnable() {
public @Override
void run() {
report.updateData(coverage);
}
});
}
}
示例9: setShowEditorBar
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
public void setShowEditorBar(boolean on) {
this.showEditorBar = on;
NbPreferences.forModule(CoverageManager.class).putBoolean(PREF_EDITOR_BAR, on);
// Update existing editors
for (JTextComponent target : EditorRegistry.componentList()) {
Document document = target.getDocument();
CoverageSideBar sb = CoverageSideBar.getSideBar(target);
if (sb != null) {
sb.showCoveragePanel(on);
}
}
}
示例10: getLeastActiveComponent
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
public static JTextComponent getLeastActiveComponent() {
registerListener();
List<? extends JTextComponent> l = EditorRegistry.componentList();
return l.size() > 0 ? l.get(l.size() - 1) : null;
}
示例11: finish
import org.netbeans.api.editor.EditorRegistry; //导入方法依赖的package包/类
private void finish() {
EditorRegistry.removePropertyChangeListener(editorsTracker);
for(JTextComponent jtc : EditorRegistry.componentList()) {
AbbrevDetection.remove(jtc);
}
}