Search in sources :

Example 21 with ModeImpl

use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.

the class PreviousTabAction method actionPerformed.

public void actionPerformed(ActionEvent evt) {
    TopComponent tc = TopComponent.getRegistry().getActivated();
    if (tc == null) {
        return;
    }
    ModeImpl mode = (ModeImpl) WindowManagerImpl.getInstance().findMode(tc);
    List openedTcs = mode.getOpenedTopComponents();
    int index = openedTcs.indexOf(tc);
    if (index == -1) {
        return;
    }
    // Previous tab.
    index--;
    if (index < 0) {
        index = openedTcs.size() - 1;
    }
    TopComponent select = (TopComponent) openedTcs.get(index);
    if (select == null) {
        return;
    }
    mode.setSelectedTopComponent(select);
    select.requestActive();
}
Also used : ModeImpl(org.netbeans.core.windows.ModeImpl) List(java.util.List) TopComponent(org.openide.windows.TopComponent)

Example 22 with ModeImpl

use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.

the class ResetWindowsAction method collectEditors.

private TopComponent[] collectEditors() {
    TopComponentTracker tcTracker = TopComponentTracker.getDefault();
    ArrayList<TopComponent> editors = new ArrayList<TopComponent>(TopComponent.getRegistry().getOpened().size());
    // collect from the main editor mode first
    ModeImpl editorMode = (ModeImpl) WindowManagerImpl.getInstance().findMode("editor");
    if (null != editorMode) {
        for (TopComponent tc : editorMode.getOpenedTopComponents()) {
            if (tcTracker.isViewTopComponent(tc))
                continue;
            editors.add(tc);
        }
    }
    for (ModeImpl m : WindowManagerImpl.getInstance().getModes()) {
        if ("editor".equals(m.getName()))
            continue;
        for (TopComponent tc : m.getOpenedTopComponents()) {
            if (tcTracker.isViewTopComponent(tc))
                continue;
            editors.add(tc);
        }
    }
    return editors.toArray(new TopComponent[editors.size()]);
}
Also used : ModeImpl(org.netbeans.core.windows.ModeImpl) ArrayList(java.util.ArrayList) TopComponentTracker(org.netbeans.core.windows.TopComponentTracker) TopComponent(org.openide.windows.TopComponent)

Example 23 with ModeImpl

use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.

the class ResizeModeAction method actionPerformed.

@Override
public void actionPerformed(java.awt.event.ActionEvent ev) {
    updateEnabled();
    if (!isEnabled())
        return;
    ModeImpl contextMode = getModeToWorkWith();
    Component c = contextMode.getSelectedTopComponent();
    MultiSplitPane splitPane = (MultiSplitPane) SwingUtilities.getAncestorOfClass(MultiSplitPane.class, c);
    splitPane.startResizing(c);
}
Also used : ModeImpl(org.netbeans.core.windows.ModeImpl) MultiSplitPane(org.netbeans.core.windows.view.ui.MultiSplitPane) TopComponent(org.openide.windows.TopComponent) Component(java.awt.Component)

Example 24 with ModeImpl

use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.

the class DockWindowAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    // contextTC shound never be null thanks to isEnabled impl
    WindowManagerImpl wmi = WindowManagerImpl.getInstance();
    TopComponent contextTC = getTC2WorkWith();
    if (null == contextTC)
        // just being paranoid
        return;
    if (wmi.isTopComponentMinimized(contextTC)) {
        // restore from minimized state
        wmi.setTopComponentMinimized(contextTC, false);
    } else {
        // dock floating window
        boolean isDocked = wmi.isDocked(contextTC);
        ModeImpl mode = (ModeImpl) wmi.findMode(contextTC);
        if (!isDocked) {
            wmi.userDockedTopComponent(contextTC, mode);
        }
    }
}
Also used : WindowManagerImpl(org.netbeans.core.windows.WindowManagerImpl) ModeImpl(org.netbeans.core.windows.ModeImpl) TopComponent(org.openide.windows.TopComponent)

Example 25 with ModeImpl

use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.

the class MoveModeAction method actionPerformed.

@Override
public void actionPerformed(java.awt.event.ActionEvent ev) {
    updateEnabled();
    if (!isEnabled())
        return;
    ModeImpl contextMode = getModeToWorkWith();
    if (null == contextMode)
        return;
    WindowManagerImpl.getInstance().userStartedKeyboardDragAndDrop(new TopComponentDraggable(contextMode));
}
Also used : ModeImpl(org.netbeans.core.windows.ModeImpl) TopComponentDraggable(org.netbeans.core.windows.view.dnd.TopComponentDraggable)

Aggregations

ModeImpl (org.netbeans.core.windows.ModeImpl)60 TopComponent (org.openide.windows.TopComponent)35 WindowManagerImpl (org.netbeans.core.windows.WindowManagerImpl)22 ArrayList (java.util.ArrayList)5 IOException (java.io.IOException)3 List (java.util.List)3 FileObject (org.openide.filesystems.FileObject)3 Component (java.awt.Component)2 File (java.io.File)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)2 BackingStoreException (java.util.prefs.BackingStoreException)2 Preferences (java.util.prefs.Preferences)2 WindowSystem (org.netbeans.core.WindowSystem)2 ModeStructureSnapshot (org.netbeans.core.windows.ModeStructureSnapshot)2 TopComponentTracker (org.netbeans.core.windows.TopComponentTracker)2 MultiSplitPane (org.netbeans.core.windows.view.ui.MultiSplitPane)2 TabActionEvent (org.netbeans.swing.tabcontrol.event.TabActionEvent)2 NbPreferences (org.openide.util.NbPreferences)2