Search in sources :

Example 11 with ModeImpl

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

the class UndockModeAction method isEnabled.

@Override
public boolean isEnabled() {
    ModeImpl contextMode = getMode2WorkWith();
    if (null == contextMode)
        return false;
    boolean docked = contextMode.getState() == Constants.MODE_STATE_JOINED;
    if (!docked)
        return false;
    if (contextMode.getKind() == Constants.MODE_KIND_EDITOR)
        return Switches.isEditorModeUndockingEnabled();
    return contextMode.getKind() == Constants.MODE_KIND_VIEW && Switches.isViewModeUndockingEnabled();
}
Also used : ModeImpl(org.netbeans.core.windows.ModeImpl)

Example 12 with ModeImpl

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

the class DefaultModel method createWindowSystemSnapshot.

// Controller updates <<
// ///////////////////////
@Override
public WindowSystemSnapshot createWindowSystemSnapshot() {
    WindowSystemSnapshot wsms = new WindowSystemSnapshot();
    // PENDING
    ModeStructureSnapshot mss = createModeStructureSnapshot();
    wsms.setModeStructureSnapshot(mss);
    ModeImpl activeMode = getActiveMode();
    wsms.setActiveModeSnapshot(activeMode == null ? null : mss.findModeSnapshot(activeMode.getName()));
    ModeImpl maximizedMode = null != getViewMaximizedMode() ? getViewMaximizedMode() : null;
    wsms.setMaximizedModeSnapshot(maximizedMode == null ? null : mss.findModeSnapshot(maximizedMode.getName()));
    wsms.setMainWindowBoundsJoined(getMainWindowBoundsJoined());
    wsms.setMainWindowBoundsSeparated(getMainWindowBoundsSeparated());
    wsms.setEditorAreaBounds(getEditorAreaBounds());
    wsms.setEditorAreaState(getEditorAreaState());
    wsms.setEditorAreaFrameState(getEditorAreaFrameState());
    wsms.setMainWindowFrameStateJoined(getMainWindowFrameStateJoined());
    wsms.setMainWindowFrameStateSeparated(getMainWindowFrameStateSeparated());
    wsms.setToolbarConfigurationName(getToolbarConfigName());
    return wsms;
}
Also used : WindowSystemSnapshot(org.netbeans.core.windows.WindowSystemSnapshot) ModeStructureSnapshot(org.netbeans.core.windows.ModeStructureSnapshot) ModeImpl(org.netbeans.core.windows.ModeImpl)

Example 13 with ModeImpl

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

the class DefaultModel method updateSlidingSelections.

/**
 * Keeps selected components of sliding modes in sync with given current
 * active mode. Sliding mode can have non-null selection (=slide) only if
 * it is active mode as well
 */
private void updateSlidingSelections(ModeImpl curActive) {
    Set slidingModes = modesSubModel.getSlidingModes();
    ModeImpl curSliding = null;
    for (Iterator iter = slidingModes.iterator(); iter.hasNext(); ) {
        curSliding = (ModeImpl) iter.next();
        if (!curSliding.equals(curActive)) {
            setModeSelectedTopComponent(curSliding, null);
        }
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ModeImpl(org.netbeans.core.windows.ModeImpl) Iterator(java.util.Iterator)

Example 14 with ModeImpl

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

the class DockingStatus method mark.

/**
 * Remember which TopComponents are docked and which are slided.
 */
public void mark() {
    Set<ModeImpl> modes = model.getModes();
    for (Iterator<ModeImpl> i = modes.iterator(); i.hasNext(); ) {
        ModeImpl modeImpl = i.next();
        if (modeImpl.getState() == Constants.MODE_STATE_SEPARATED)
            continue;
        List<String> views = model.getModeOpenedTopComponentsIDs(modeImpl);
        if (modeImpl.getKind() == Constants.MODE_KIND_VIEW) {
            docked.addAll(views);
            slided.removeAll(views);
        } else if (modeImpl.getKind() == Constants.MODE_KIND_SLIDING) {
            docked.removeAll(views);
            slided.addAll(views);
        }
    }
    marked = true;
}
Also used : ModeImpl(org.netbeans.core.windows.ModeImpl)

Example 15 with ModeImpl

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

the class DocumentsDlg method activate.

// GEN-LAST:event_closeDocuments
private void activate(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_activate
    // Add your handling code here:
    Node[] selNodes = explorer.getSelectedNodes();
    if (selNodes.length == 0) {
        return;
    }
    closeDialog();
    final TopComponent tc = ((TopComponentNode) selNodes[0]).getTopComponent();
    // Call using invokeLater to make sure it is performed after dialog
    // is closed.
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            // #37226-41075 Unmaximized the other mode if needed.
            WindowManagerImpl wm = WindowManagerImpl.getInstance();
            ModeImpl mode = (ModeImpl) wm.findMode(tc);
            if (mode != null && mode != wm.getCurrentMaximizedMode()) {
                wm.switchMaximizedMode(null);
            }
            tc.requestActive();
        }
    });
}
Also used : WindowManagerImpl(org.netbeans.core.windows.WindowManagerImpl) Node(org.openide.nodes.Node) AbstractNode(org.openide.nodes.AbstractNode) ModeImpl(org.netbeans.core.windows.ModeImpl) TopComponent(org.openide.windows.TopComponent)

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