org.openide.windows.Mode.dockInto()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.openide.windows.Mode.dockInto()方法的一些代码示例,展示了Mode.dockInto()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mode.dockInto()方法的具体详情如下:
包路径:org.openide.windows.Mode
类名称:Mode
方法名:dockInto

Mode.dockInto介绍

[英]Attaches a component to a mode for this workspace. If the component is in different mode on this workspace, it is removed from the original and moved to this one.
[中]将组件附加到此工作区的模式。如果该组件在此工作区上处于不同的模式,则会将其从原始工作区中删除并移动到此工作区。

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Dock this top component to editor mode if it is not docked
 * in some mode at this time  */
private void dockIfNeeded(Workspace workspace) {
  // dock into editor mode if possible
  Mode ourMode = workspace.findMode(this);
  if (ourMode == null) {
    editorMode(workspace).dockInto(this);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Dock this top component to editor mode if it is not docked
 * in some mode at this time  */
private void dockIfNeeded(Workspace workspace) {
  // dock into editor mode if possible
  Mode ourMode = workspace.findMode(this);
  if (ourMode == null) {
    editorMode(workspace).dockInto(this);
  }
}

代码示例来源:origin: senbox-org/snap-desktop

/**
 * Opens a top component in the given mode.
 *
 * @param topComponent The top component to open.
 * @param modeName     The mode's name.
 * @return {@code true} on success.
 */
public static boolean openInMode(TopComponent topComponent, String modeName) {
  Mode mode = WindowManager.getDefault().findMode(modeName);
  if (mode != null) {
    if (!Arrays.asList(mode.getTopComponents()).contains(topComponent)) {
      if (mode.dockInto(topComponent)) {
        topComponent.open();
        return true;
      }
    } else {
      topComponent.open();
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-profiler

public void open() {
  if (needsDocking()) { // needs docking
    Mode mode = WindowManager.getDefault().findMode(Bundle.ProfilerControlPanel2_WindowMode());
    if (mode != null) {
      mode.dockInto(this);
    }
  }
  super.open();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-profiler

public void open() {
  if (needsDocking()) { // needs docking
    Mode mode = WindowManager.getDefault().findMode(Bundle.TelemetryOverviewPanel_WindowMode());
    if (mode != null) {
      mode.dockInto(this);
    }
  }
  super.open();
}

代码示例来源:origin: senbox-org/snap-desktop

private TopComponent dockInternalFrame(JInternalFrame internalFrame) {
  TopComponent topComponent = closeInternalFrame(internalFrame, true);
  Mode mode = WindowManager.getDefault().findMode("editor");
  mode.dockInto(topComponent);
  if (!topComponent.isOpened()) {
    topComponent.open();
  }
  return topComponent;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

@Override
public void open() {
if (isOpened() && isShowing())
  return;
// Workaround per http://wiki.netbeans.org/DevFaqWindowsOpenInMode
WindowManager wm = WindowManager.getDefault();
Mode mode = wm.findMode(this);        // mode to which we belong
if (mode == null) {
  // if not in any mode, dock us into the default mode
  mode = wm.findMode("output"); // NOI18N
}
mode.dockInto(this);
super.open();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

@Override
public void open() {
if (isOpened() && isShowing())
  return;
// Workaround per http://wiki.netbeans.org/DevFaqWindowsOpenInMode
WindowManager wm = WindowManager.getDefault();
Mode mode = wm.findMode(this);        // mode to which we belong
if (mode == null) {
  // if not in any mode, dock us into the default mode
  mode = wm.findMode("output"); // NOI18N
}
mode.dockInto(this);
super.open();
}

代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-docking

/*******************************************************************************************************************
   *
   * {@inheritDoc}
   *
   ******************************************************************************************************************/
  @Override
  public final void performAction()
   {
    if (activeComponent != null)
     {
      assert EventQueue.isDispatchThread() : "Not in EDT!";
      final Mode targetMode = WindowManager.getDefault().findMode(getModeName());

      logger.fine("doPerformAction() - docking to %s", targetMode);

      if (targetMode != null)
       {   
        activeComponent.close();
        targetMode.dockInto(activeComponent);
        activeComponent.open();
//                component.requestVisible();
        activeComponent.requestActive();  // see BM-333
       }
     }
   }

代码示例来源:origin: senbox-org/snap-desktop

/**
 * Opens a new window in SNAP Desktop.
 *
 * @param window The window which must must be an instance of {@link TopComponent}.
 * @param location The location where the window should appear when it is first opened.
 *                 Possible docking areas are
 *                 "explorer" (upper left), "navigator" (lower left), "properties" (upper right),
 *                 "output" (bottom). You may choose "floating" to not dock the window at all. Note
 *                 that this mode requires explicitly setting the window's position and size.
 * @param requestActive {@code true} if a request will be made to activate the window after opening it.
 */
public static void openWindow(TopComponent window, String location, boolean requestActive) {
  WindowManager.getDefault().invokeWhenUIReady(() -> {
    Mode mode = WindowManager.getDefault().findMode(location);
    if (mode != null) {
      mode.dockInto(window);
    }
    window.open();
    if (requestActive) {
      window.requestActive();
    }
  });
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public void actionPerformed(ActionEvent e) {
  String defaultName = WindowUtilities.getUniqueTitle(Bundle.VAL_NewWorkspaceActionValue(),
                            WorkspaceTopComponent.class);
  NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine(Bundle.LBL_NewWorkspaceActionName(),
                                 Bundle.CTL_NewWorkspaceActionName());
  d.setInputText(defaultName);
  Object result = DialogDisplayer.getDefault().notify(d);
  if (NotifyDescriptor.OK_OPTION.equals(result)) {
    WorkspaceTopComponent workspaceTopComponent = new WorkspaceTopComponent(d.getInputText());
    Mode editor = WindowManager.getDefault().findMode("editor");
    Assert.notNull(editor, "editor");
    editor.dockInto(workspaceTopComponent);
    workspaceTopComponent.open();
    workspaceTopComponent.requestActive();
  }
}

代码示例来源:origin: senbox-org/snap-desktop

/**
 * Opens a document window.
 * <p>
 * Document windows are initially opened in the NetBeans {@code "editor"} mode which
 * is the central panel of the main frame.
 *
 * @param documentWindow The document window to be opened.
 * @return {@code true} on success
 */
public boolean openWindow(DocumentWindow documentWindow) {
  TopComponent topComponent = documentWindow.getTopComponent();
  WorkspaceTopComponent workspaceTopComponent = WorkspaceTopComponent.findShowingInstance();
  if (workspaceTopComponent != null) {
    workspaceTopComponent.addTopComponent(topComponent);
    return true;
  }
  Mode editor = WindowManager.getDefault().findMode("editor");
  if (editor.dockInto(topComponent)) {
    topComponent.open();
    return true;
  }
  return false;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-designer

mode.dockInto(btc);

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-cnd-gizmo

private GizmoIndicatorsTopComponent(boolean dock) {
  initComponents();
  this.dock = dock;
  setSession(null);
  setName(getMessage("CTL_DLightIndicatorsTopComponent")); // NOI18N
  setToolTipText(getMessage("CTL_DLightIndicatorsTopComponent"));//NOI18N
  setIcon(ImageUtilities.loadImage(ICON_PATH, true));
  if (dock) {
    if (WindowManager.getDefault().findMode(this) == null || WindowManager.getDefault().findMode(this).getName().equals("navigator")) { // NOI18N
      if (WindowManager.getDefault().findMode("navigator") != null) { // NOI18N
        WindowManager.getDefault().findMode("navigator").dockInto(this);//NOI18N
      }
    }
  }
  setFocusTraversalPolicyProvider(true);
  setFocusTraversalPolicy(focusPolicy);
  ActionMap map = new ActionMap();
  map.put("org.openide.actions.PopupAction", popupAction);//NOI18N
  this.associateLookup(ExplorerUtils.createLookup(manager, map));
  installActions();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-core-ui

private DLightIndicatorsTopComponent(boolean dock) {
    initComponents();
    this.dock = dock;
    setSession(null);
    setName(getMessage("CTL_DLightIndicatorsTopComponent")); // NOI18N
    setToolTipText(getMessage("CTL_DLightIndicatorsTopComponent"));//NOI18N
    setIcon(ImageUtilities.loadImage(ICON_PATH, true));
    if (dock) {
      if (WindowManager.getDefault().findMode(this) == null || WindowManager.getDefault().findMode(this).getName().equals("navigator")) { // NOI18N
        if (WindowManager.getDefault().findMode("navigator") != null) { // NOI18N
          WindowManager.getDefault().findMode("navigator").dockInto(this);//NOI18N
        }
      }
    }
    setFocusTraversalPolicyProvider(true);
    setFocusTraversalPolicy(focusPolicy);
//        ActionMap map = new ActionMap();
//        map.put("org.openide.actions.PopupAction", popupAction);//NOI18N
//        this.associateLookup(ExplorerUtils.createLookup(manager, map));
//        installActions();
  }

相关文章