Java Code Examples for org.openide.awt.Toolbar

The following examples show how to use org.openide.awt.Toolbar. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example 2
Source Project: jdk8u60   Source File: OutlineTopComponent.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example 3
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example 4
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example 5
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(GarbageCollectAction.get(GarbageCollectAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }
    }
 
Example 6
Source Project: hottub   Source File: OutlineTopComponent.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example 7
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example 8
private void initToolbar() {

        Toolbar toolbar = new Toolbar();
        Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
        toolbar.setBorder(b);
        this.add(toolbar, BorderLayout.NORTH);

        toolbar.add(ImportAction.get(ImportAction.class));
        toolbar.add(((NodeAction) RemoveAction.get(RemoveAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(RemoveAllAction.get(RemoveAllAction.class));

        toolbar.add(((NodeAction) SaveAsAction.get(SaveAsAction.class)).createContextAwareInstance(this.getLookup()));
        toolbar.add(SaveAllAction.get(SaveAllAction.class));

        toolbar.add(StructuredViewAction.get(StructuredViewAction.class).getToolbarPresenter());

        for (Toolbar tb : ToolbarPool.getDefault().getToolbars()) {
            tb.setVisible(false);
        }

        initOrganizers();
    }
 
Example 9
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example 10
Source Project: jdk8u60   Source File: FilterTopComponent.java    License: GNU General Public License v2.0 5 votes vote down vote up
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example 11
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example 12
Source Project: netbeans   Source File: ToolbarConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
/** Make toolbar visible/invisible in this configuration
 * @param tb toolbar
 * @param b true to make toolbar visible
 */
public void setToolbarVisible(Toolbar tb, boolean visible) {
    ToolbarConstraints tc = getConstraints( tb.getName() );
    boolean isBarVisible = tc.isVisible();
    tc.setVisible(visible);
    if( visible != isBarVisible ) {
        refresh();
        save();
    }
}
 
Example 13
Source Project: netbeans   Source File: MainWindowOperator.java    License: Apache License 2.0 5 votes vote down vote up
public boolean checkComponent(Component comp) {
    if(comp instanceof org.openide.awt.Toolbar) {
        count++;
        if(comparator != null) {
            return comparator.equals(((Toolbar)comp).getDisplayName(), toolbarName);
        } else {
            return true;
        }
    }
    return false;
}
 
Example 14
Source Project: netbeans   Source File: PreviewMultiViewElement.java    License: 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 15
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example 16
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example 17
Source Project: hottub   Source File: FilterTopComponent.java    License: GNU General Public License v2.0 5 votes vote down vote up
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example 18
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example 19
Source Project: openjdk-8   Source File: FilterTopComponent.java    License: GNU General Public License v2.0 5 votes vote down vote up
private FilterTopComponent() {
    filterSettingsChangedEvent = new ChangedEvent<FilterTopComponent>(this);
    initComponents();
    setName(NbBundle.getMessage(FilterTopComponent.class, "CTL_FilterTopComponent"));
    setToolTipText(NbBundle.getMessage(FilterTopComponent.class, "HINT_FilterTopComponent"));
    //        setIcon(Utilities.loadImage(ICON_PATH, true));

    sequence = new FilterChain();
    filterChain = new FilterChain();
    initFilters();
    manager = new ExplorerManager();
    manager.setRootContext(new AbstractNode(new FilterChildren()));
    associateLookup(ExplorerUtils.createLookup(manager, getActionMap()));
    view = new CheckListView();

    ToolbarPool.getDefault().setPreferredIconSize(16);
    Toolbar toolBar = new Toolbar();
    Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N
    toolBar.setBorder(b);
    comboBox = new JComboBox();
    toolBar.add(comboBox);
    this.add(toolBar, BorderLayout.NORTH);
    toolBar.add(SaveFilterSettingsAction.get(SaveFilterSettingsAction.class));
    toolBar.add(RemoveFilterSettingsAction.get(RemoveFilterSettingsAction.class));
    toolBar.addSeparator();
    toolBar.add(MoveFilterUpAction.get(MoveFilterUpAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(MoveFilterDownAction.get(MoveFilterDownAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(RemoveFilterAction.get(RemoveFilterAction.class).createContextAwareInstance(this.getLookup()));
    toolBar.add(NewFilterAction.get(NewFilterAction.class));
    this.add(view, BorderLayout.CENTER);

    filterSettings = new ArrayList<FilterSetting>();
    updateComboBox();

    comboBox.addActionListener(comboBoxActionListener);
    setChain(filterChain);
}
 
Example 20
@Override
public void componentOpened() {
    super.componentOpened();
    Toolbar tb = ToolbarPool.getDefault().findToolbar("SceneComposer-Tools");
    if (tb != null) {
        if (!tb.isVisible()) {
            tb.setVisible(true);
        }
    }
    if (currentRequest == null) {
        close();
    }
}
 
Example 21
@Override
public void componentClosed() {
    super.componentClosed();
    if (currentRequest != null) {
        SceneApplication.getApplication().closeScene(currentRequest);
    }
    Toolbar tb = ToolbarPool.getDefault().findToolbar("SceneComposer-Tools");
    if (tb != null) {
        if (tb.isVisible()) {
            tb.setVisible(false);
        }
    }
}
 
Example 22
Source Project: netbeans   Source File: DnDSupport.java    License: Apache License 2.0 4 votes vote down vote up
public void dragGestureRecognized(DragGestureEvent e) {
    Component c = e.getComponent();
    if( !(c instanceof JComponent) )
        return;

    Transferable t = null;
    try {
        final DataObject dob = (DataObject) ((JComponent) c).getClientProperty("file");
        if( dob != null && c.getParent() instanceof Toolbar && buttonDndAllowed ) {
            //dragging a toolbar button
            sourceToolbar = (Toolbar) c.getParent();
            t = new ExTransferable.Single(buttonDataFlavor) {
                public Object getData() {
                    return dob;
                }
            };
            isToolbarDrag = false;
            isButtonDrag = true;
            dragSourceButtonIndex = sourceToolbar.getComponentIndex(c);
        } else if( Boolean.TRUE.equals( ((JComponent) c).getClientProperty(ToolbarContainer.PROP_DRAGGER) ) ) {
            //dragging the whole toolbar
            final ToolbarContainer container = (ToolbarContainer) c.getParent().getParent();
            if( container.isShowing() ) {
                sourceContainer = container;
                sourceRow = (ToolbarRow) container.getParent();
                t = new ExTransferable.Single(toolbarDataFlavor) {

                    public Object getData() {
                        return container;
                    }
                };
                isToolbarDrag = true;
                isButtonDrag = false;
                startingPoint = new Point(e.getDragOrigin());
                Rectangle bounds = new Rectangle(sourceContainer.getPreferredSize());
                bounds.setLocation(sourceContainer.getLocationOnScreen());
                dragImage = createContentImage(sourceContainer, bounds.getSize());
                sourceRow.dragStarted( sourceContainer );
                dragWindow = createDragWindow( dragImage, bounds );
            }
        }
        if( c instanceof JButton ) {
            ((JButton) c).getModel().setArmed(false);
            ((JButton) c).getModel().setPressed(false);
            ((JButton) c).getModel().setRollover(true);
        }
        if( t != null ) {
            e.startDrag(dragMoveCursor, t, this);
        }
    } catch( InvalidDnDOperationException idoE ) {
        log.log(Level.INFO, null, idoE);
    }
}
 
Example 23
Source Project: netbeans   Source File: DnDSupport.java    License: Apache License 2.0 4 votes vote down vote up
private DataFolder getBackingFolder( Toolbar bar ) {
    Object res = bar.getClientProperty("folder"); //NOI18N
    if( res instanceof DataFolder )
        return (DataFolder) res;
    return null;
}
 
Example 24
Source Project: netbeans   Source File: DnDSupport.java    License: Apache License 2.0 4 votes vote down vote up
private ToolbarContainer getContainer( Toolbar bar ) {
    return (ToolbarContainer) bar.getParent();
}
 
Example 25
Source Project: netbeans   Source File: ToolbarConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
/** Returns true if the toolbar is visible in this configuration
 * @param tb toolbar
 * @return true if the toolbar is visible
 */
public boolean isToolbarVisible(Toolbar tb) {
    ToolbarConstraints tc = getConstraints(tb.getName());
    return tc.isVisible();
}
 
Example 26
Source Project: netbeans   Source File: ToolbarContainer.java    License: Apache License 2.0 4 votes vote down vote up
Toolbar getToolbar() {
    return toolbar;
}
 
Example 27
Source Project: netbeans   Source File: MainWindowOperatorTest.java    License: Apache License 2.0 4 votes vote down vote up
/** Test of getToolbarName method. */
public void testGetToolbarName() {
    String toolbarName = mainWindowOper.getToolbarName(0);
    String expected = ((Toolbar) mainWindowOper.getToolbar(0).getSource()).getDisplayName();
    assertEquals("Wrong toolbar name", expected, toolbarName);
}
 
Example 28
Source Project: netbeans   Source File: DebuggerManagerListener.java    License: Apache License 2.0 4 votes vote down vote up
private void setupToolbar(final DebuggerEngine engine) {
    final List<Component> buttonsToClose = new ArrayList<Component>();
    buttonsToClose.add(new java.awt.Label("EMPTY"));
    final boolean isFirst;
    synchronized (closedToolbarButtons) {
        isFirst = closedToolbarButtons.isEmpty();
        closedToolbarButtons.put(engine, buttonsToClose);
    }
    RequestProcessor rp = engine.lookupFirst(null, RequestProcessor.class);
    if (rp == null) {
        rp = RP;
    }
    rp.post(new Runnable() {
        @Override
        public void run() {
            List<? extends ActionsProvider> actionsProviderList = engine.lookup(null, ActionsProvider.class);
            final Set engineActions = new HashSet();
            for (ActionsProvider ap : actionsProviderList) {
                engineActions.addAll(ap.getActions());
            }
            ToolbarPool.getDefault().waitFinished();
            SwingUtilities.invokeLater (new Runnable () {
                @Override
                public void run () {
                    List<Component> buttonsClosed = new ArrayList<Component>();
                    List<Component> buttonsUsed = new ArrayList<Component>();
                    try {
                        if (ToolbarPool.getDefault ().getConfiguration ().equals(ToolbarPool.DEFAULT_CONFIGURATION)) {
                            ToolbarPool.getDefault ().setConfiguration("Debugging"); // NOI18N
                        }
                        Toolbar debugToolbar = ToolbarPool.getDefault ().findToolbar("Debug");
                        if (debugToolbar == null) return ;
                        registerToolbarListener(debugToolbar);
                        for (Component c : debugToolbar.getComponents()) {
                            DebuggerAction a = getDebuggerAction(c);
                            if (a != null) {
                                Object action = a.getAction();
                                //System.err.println("Engine "+engine+" contains action "+a+"("+action+") = "+engineActions.contains(action));
                                boolean containsAction = engineActions.contains(action);
                                if (isFirst && !containsAction) {
                                    // For the first engine disable toolbar buttons for actions that are not provided
                                    c.setVisible(false);
                                    buttonsClosed.add(c);
                                    toolbarButtonsPrefferedSize.put(c, c.getPreferredSize());
                                    c.setPreferredSize(new Dimension(0, 0));
                                }
                                if (!isFirst && containsAction) {
                                    // For next engine enable toolbar buttons that could be previously disabled
                                    // and are used for actions that are provided.
                                    Dimension d = toolbarButtonsPrefferedSize.remove(c);
                                    if (d != null) {
                                        c.setPreferredSize(d);
                                    }
                                    c.setVisible(true);
                                }
                                if (containsAction) {
                                    // Keep track of buttons used by individual engines.
                                    buttonsUsed.add(c);
                                }
                            }
                        }
                        debugToolbar.revalidate();
                        debugToolbar.repaint();
                    } finally {
                        synchronized (closedToolbarButtons) {
                            usedToolbarButtons.put(engine, buttonsUsed);
                            buttonsToClose.clear();
                            buttonsToClose.addAll(buttonsClosed);
                            closedToolbarButtons.notifyAll();
                        }
                    }
                }
            });
        }
    });
}
 
Example 29
Source Project: netbeans   Source File: DebuggerManagerListener.java    License: Apache License 2.0 4 votes vote down vote up
private void registerToolbarListener(Toolbar debugToolbar) {
    if (toolbarContainerListener == null) {
        toolbarContainerListener = new ToolbarContainerListener();
        debugToolbar.addContainerListener(toolbarContainerListener);
    }
}
 
Example 30
Source Project: netbeans   Source File: DebuggerManagerListener.java    License: Apache License 2.0 4 votes vote down vote up
private void unregisterToolbarListener(Toolbar debugToolbar) {
    if (toolbarContainerListener != null) {
        debugToolbar.removeContainerListener(toolbarContainerListener);
        toolbarContainerListener = null;
    }
}