Java Code Examples for org.openide.text.NbDocument#CustomToolbar

The following examples show how to use org.openide.text.NbDocument#CustomToolbar . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlMultiViewElement.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void runInAwt() {
    if (doc instanceof NbDocument.CustomToolbar) {
        realToolBar = ((NbDocument.CustomToolbar) doc).createToolbar(editorPane);
    }
    synchronized (XmlMultiViewElement.this) {
        if (realToolBar == null) {
            toolbar = new JPanel();
        } else {
            toolbar = realToolBar;
        }
        initializer = null;
    }
    if (realToolBar == null) {
        return;
    }
    
    // patch existing toolbars
    for (JComponent p : toolbarPanels) {
        if (p.isValid()) {
            p.add(realToolBar, BorderLayout.CENTER);
        }
    }
}
 
Example 2
Source File: BIEditorSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public JComponent getToolbarRepresentation() {
    JComponent toolbar = null;
    JEditorPane jepane = getEditorPane();
    if (jepane != null) {
        Document doc = jepane.getDocument();
        if (doc instanceof NbDocument.CustomToolbar) {
            toolbar = ((NbDocument.CustomToolbar)doc).createToolbar(jepane);
        }
    }
    return toolbar;
}
 
Example 3
Source File: MultiViewCloneableEditor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void fillInBar() {
    if (bar != null && bar.getComponentCount() == 0 && pane != null) {
        Document doc = pane.getDocument();
        if (doc instanceof NbDocument.CustomToolbar) {
            CustomToolbar custom = (NbDocument.CustomToolbar)doc;
            final JToolBar content = custom.createToolbar(pane);
            if (content != null) {
                bar.add(content, BorderLayout.CENTER);
            }
        }
    }
}
 
Example 4
Source File: PreviewMultiViewElement.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public JComponent getToolbarRepresentation() {
    if (des != null) {
        Document doc = getEditorPane().getDocument();
        if (doc instanceof NbDocument.CustomToolbar) {
            if (toolbar == null) {
                toolbar = ((NbDocument.CustomToolbar) doc).createToolbar(getEditorPane());
            }
            return toolbar;
        }
    }
    Toolbar tb = new Toolbar();
    return tb;
}
 
Example 5
Source File: SourceMultiViewElement.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public JComponent getToolbarRepresentation() {
    JEditorPane editorPane = getEditorPane();
    if (editorPane != null) {
        Document doc = editorPane.getDocument();
        if (doc instanceof NbDocument.CustomToolbar) {
            if (toolbar == null) {
                toolbar = ((NbDocument.CustomToolbar) doc).createToolbar(getEditorPane());
            }
            return toolbar;
        }
    }
    return null;
}
 
Example 6
Source File: SQLCloneableEditor.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public JComponent getToolbarRepresentation() {
    Document doc = getEditorPane().getDocument();
    if (doc instanceof NbDocument.CustomToolbar) {
        if (bar == null) {
            bar = ((NbDocument.CustomToolbar)doc).createToolbar(getEditorPane());
        }
    }
    if (bar == null) {
        bar = new JToolBar();
    }
    return bar;
}