Java Code Examples for org.openide.awt.ToolbarPool#getDefault()

The following examples show how to use org.openide.awt.ToolbarPool#getDefault() . 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: ConfigureToolbarPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void addNotify() {
    super.addNotify();

    ToolbarPool pool = ToolbarPool.getDefault();
    checkSmallIcons.setSelected( pool.getPreferredIconSize() == 16 );

    ToolbarConfiguration tc = ToolbarConfiguration.findConfiguration( pool.getConfiguration() );
    if( null != tc ) {
        tc.setToolbarButtonDragAndDropAllowed( true );
    }
}
 
Example 2
Source File: ConfigureToolbarPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void removeNotify() {
    super.removeNotify();

    ToolbarPool pool = ToolbarPool.getDefault();
    final ToolbarConfiguration tc = ToolbarConfiguration.findConfiguration( pool.getConfiguration() );
    if( null != tc ) {
        tc.setToolbarButtonDragAndDropAllowed( false );
    }
    //remove empty toolbars
    DataFolder folder = pool.getFolder();
    DataObject[] children = folder.getChildren();
    for( int i=0; i<children.length; i++ ) {
        final DataFolder subFolder = children[i].getCookie( DataFolder.class );
        if( null != subFolder && subFolder.getChildren().length == 0 ) {
            SwingUtilities.invokeLater( new Runnable() {

                @Override
                public void run() {
                    try {
                        subFolder.delete();
                        ToolbarPool.getDefault().waitFinished();
                        if( null != tc ) {
                            tc.removeEmptyRows();
                            tc.save();
                        }
                    }
                    catch (IOException e) {
                        LOG.log(Level.WARNING, null, e);
                    }
                }
            });
        }
    }
}
 
Example 3
Source File: DnDSupport.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private boolean isInToolbarPanel( Point p ) {
    Component c = ToolbarPool.getDefault();
    SwingUtilities.convertPointFromScreen( p, c );
    return c.contains( p );
}
 
Example 4
Source File: ToolbarConfiguration.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static final ToolbarPool getToolbarPool() {
    return ToolbarPool.getDefault ();
}
 
Example 5
Source File: CustomMenuBarTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testNoToolbar() throws Exception {
    MainWindow mw = MainWindow.getInstance();
    mw.initializeComponents();
    ToolbarPool tp = ToolbarPool.getDefault();
    assertTrue(!findComponent(mw.getFrame(), tp));
}