Search in sources :

Example 46 with ModeImpl

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

the class UndockModeAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    WindowManagerImpl wmi = WindowManagerImpl.getInstance();
    ModeImpl contextMode = getMode2WorkWith();
    boolean isDocked = contextMode.getState() == Constants.MODE_STATE_JOINED;
    if (isDocked) {
        wmi.userUndockedMode(contextMode);
    } else {
        wmi.userDockedMode(contextMode);
    }
}
Also used : WindowManagerImpl(org.netbeans.core.windows.WindowManagerImpl) ModeImpl(org.netbeans.core.windows.ModeImpl)

Example 47 with ModeImpl

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

the class DesignViewComponent method modeNameActionPerformed.

private void modeNameActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_modeNameActionPerformed
    Mode mode = WindowManager.getDefault().findMode(this);
    if (mode instanceof ModeImpl) {
        ModeImpl mi = (ModeImpl) mode;
        mi.setModeName(modeName.getText());
    }
    for (TopComponent tc : mode.getTopComponents()) {
        if (tc instanceof DesignViewComponent) {
            DesignViewComponent dvc = (DesignViewComponent) tc;
            dvc.refresh();
        }
    }
}
Also used : Mode(org.openide.windows.Mode) ModeImpl(org.netbeans.core.windows.ModeImpl) TopComponent(org.openide.windows.TopComponent)

Example 48 with ModeImpl

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

the class CollapseTabGroupAction method updateEnabled.

private void updateEnabled() {
    ModeImpl contextMode = mode;
    if (contextMode == null) {
        // the updating instance will get the TC to close from winsys
        TopComponent tc = TopComponent.getRegistry().getActivated();
        if (null != tc)
            contextMode = (ModeImpl) WindowManagerImpl.getInstance().findMode(tc);
    }
    if (null == contextMode) {
        setEnabled(false);
        return;
    }
    boolean enable = contextMode.getState() == Constants.MODE_STATE_JOINED;
    enable &= contextMode.getKind() == Constants.MODE_KIND_EDITOR;
    boolean hasOtherEditorMode = false;
    for (ModeImpl m : WindowManagerImpl.getInstance().getModes()) {
        if (m.getKind() == Constants.MODE_KIND_EDITOR && m.getState() == Constants.MODE_STATE_JOINED && m != contextMode) {
            hasOtherEditorMode = true;
            break;
        }
    }
    enable &= hasOtherEditorMode;
    setEnabled(enable);
}
Also used : ModeImpl(org.netbeans.core.windows.ModeImpl) TopComponent(org.openide.windows.TopComponent)

Example 49 with ModeImpl

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

the class MinimizeModeAction method updateEnabled.

private void updateEnabled() {
    ModeImpl contextMode = mode;
    if (contextMode == null) {
        // the updating instance will get the TC to close from winsys
        TopComponent tc = TopComponent.getRegistry().getActivated();
        if (null != tc)
            contextMode = (ModeImpl) WindowManagerImpl.getInstance().findMode(tc);
    }
    if (null == contextMode) {
        setEnabled(false);
        return;
    }
    setEnabled(Switches.isModeSlidingEnabled() && contextMode.getKind() == Constants.MODE_KIND_VIEW && contextMode.getState() == Constants.MODE_STATE_JOINED);
}
Also used : ModeImpl(org.netbeans.core.windows.ModeImpl) TopComponent(org.openide.windows.TopComponent)

Example 50 with ModeImpl

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

the class MoveModeAction method updateEnabled.

private void updateEnabled() {
    ModeImpl contextMode = getModeToWorkWith();
    if (null == contextMode || // || contextMode.getKind() == Constants.MODE_KIND_EDITOR
    contextMode.getState() == Constants.MODE_STATE_SEPARATED || null == contextMode.getSelectedTopComponent() || WindowManagerImpl.getInstance().getCurrentMaximizedMode() != null) {
        setEnabled(false);
        return;
    }
    TopComponent tc = contextMode.getSelectedTopComponent();
    if (null == tc) {
        setEnabled(false);
        return;
    }
    setEnabled(true);
}
Also used : 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