Java 类com.intellij.ui.docking.DockContainer 实例源码

项目:intellij-ce-playground    文件:StatusBarUtil.java   
/**
 * Finds the current file editor.
 */
@Nullable
public static FileEditor getCurrentFileEditor(@NotNull Project project, @Nullable StatusBar statusBar) {
  if (statusBar == null) {
    return null;
  }

  DockContainer c = DockManager.getInstance(project).getContainerFor(statusBar.getComponent());
  EditorsSplitters splitters = null;
  if (c instanceof DockableEditorTabbedContainer) {
    splitters = ((DockableEditorTabbedContainer)c).getSplitters();
  }

  if (splitters != null && splitters.getCurrentWindow() != null) {
    EditorWithProviderComposite editor = splitters.getCurrentWindow().getSelectedEditor();
    if (editor != null) {
      return editor.getSelectedEditorWithProvider().getFirst();
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:EditorTabbedContainer.java   
@Override
public void dragOutFinished(MouseEvent event, TabInfo source) {
  boolean copy = UIUtil.isControlKeyDown(event) || mySession.getResponse(event) == DockContainer.ContentResponse.ACCEPT_COPY;
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, Boolean.TRUE);
    FileEditorManagerEx.getInstanceEx(myProject).closeFile(myFile, myWindow);
  }
  else {
    source.setHidden(false);
  }

  mySession.process(event);
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, null);
  }

  myFile = null;
  mySession = null;
}
项目:tools-idea    文件:StatusBarUtil.java   
/**
 * Finds the current file editor.
 */
@Nullable
public static FileEditor getCurrentFileEditor(@NotNull Project project, @Nullable StatusBar statusBar) {
  if (statusBar == null) {
    return null;
  }

  DockContainer c = DockManager.getInstance(project).getContainerFor(statusBar.getComponent());
  EditorsSplitters splitters = null;
  if (c instanceof DockableEditorTabbedContainer) {
    splitters = ((DockableEditorTabbedContainer)c).getSplitters();
  }

  if (splitters != null && splitters.getCurrentWindow() != null) {
    EditorWithProviderComposite editor = splitters.getCurrentWindow().getSelectedEditor();
    if (editor != null) {
      return editor.getSelectedEditorWithProvider().getFirst();
    }
  }
  return null;
}
项目:tools-idea    文件:EditorTabbedContainer.java   
@Override
public void dragOutFinished(MouseEvent event, TabInfo source) {
  boolean copy = UIUtil.isControlKeyDown(event) || mySession.getResponse(event) == DockContainer.ContentResponse.ACCEPT_COPY;
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, Boolean.TRUE);
    FileEditorManagerEx.getInstanceEx(myProject).closeFile(myFile, myWindow);
  }
  else {
    source.setHidden(false);
  }

  mySession.process(event);
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, null);
  }

  myFile = null;
  mySession = null;
}
项目:consulo-tasks    文件:OpenEditorsContextProvider.java   
@Override
public void clearContext()
{
    if(myFileEditorManager != null)
    {
        myFileEditorManager.closeAllFiles();
        myFileEditorManager.getMainSplitters().clear();
    }
    for(DockContainer container : myDockManager.getContainers())
    {
        if(container instanceof DockableEditorTabbedContainer)
        {
            container.closeAll();
        }
    }
}
项目:consulo    文件:StatusBarUtil.java   
/**
 * Finds the current file editor.
 */
@Nullable
public static FileEditor getCurrentFileEditor(@Nonnull Project project, @Nullable StatusBar statusBar) {
  if (statusBar == null) {
    return null;
  }

  DockContainer c = DockManager.getInstance(project).getContainerFor(statusBar.getComponent());
  DesktopEditorsSplitters splitters = null;
  if (c instanceof DockableEditorTabbedContainer) {
    splitters = ((DockableEditorTabbedContainer)c).getSplitters();
  }

  if (splitters != null && splitters.getCurrentWindow() != null) {
    EditorWithProviderComposite editor = splitters.getCurrentWindow().getSelectedEditor();
    if (editor != null) {
      return editor.getSelectedEditorWithProvider().getFirst();
    }
  }
  return null;
}
项目:consulo    文件:EditorTabbedContainer.java   
@Override
public void dragOutFinished(MouseEvent event, TabInfo source) {
  boolean copy = UIUtil.isControlKeyDown(event) || mySession.getResponse(event) == DockContainer.ContentResponse.ACCEPT_COPY;
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, Boolean.TRUE);
    FileEditorManagerEx.getInstanceEx(myProject).closeFile(myFile, myWindow);
  }
  else {
    source.setHidden(false);
  }

  mySession.process(event);
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, null);
  }

  myFile = null;
  mySession = null;
}
项目:consulo    文件:FileEditorManagerImpl.java   
@Nonnull
private AsyncResult<EditorSplitters> getActiveSplittersAsync() {
  final AsyncResult<EditorSplitters> result = new AsyncResult<>();
  final IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
  fm.doWhenFocusSettlesDown(() -> {
    if (myProject.isDisposed()) {
      result.setRejected();
      return;
    }
    Component focusOwner = fm.getFocusOwner();
    DockContainer container = myDockManager.getContainerFor(focusOwner);
    if (container instanceof DockableEditorTabbedContainer) {
      result.setDone(((DockableEditorTabbedContainer)container).getSplitters());
    }
    else {
      result.setDone(getMainSplitters());
    }
  });
  return result;
}
项目:consulo    文件:FileEditorManagerImpl.java   
private EditorSplitters getActiveSplittersSync() {
  assertDispatchThread();

  final IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
  Component focusOwner = fm.getFocusOwner();
  if (focusOwner == null) {
    focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
  }
  if (focusOwner == null) {
    focusOwner = fm.getLastFocusedFor(fm.getLastFocusedFrame());
  }

  DockContainer container = myDockManager.getContainerFor(focusOwner);
  if (container == null) {
    focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    container = myDockManager.getContainerFor(focusOwner);
  }

  if (container instanceof DockableEditorTabbedContainer) {
    return ((DockableEditorTabbedContainer)container).getSplitters();
  }
  return getMainSplitters();
}
项目:intellij-ce-playground    文件:FileEditorManagerTestCase.java   
@Override
protected void tearDown() throws Exception {
  for (DockContainer container : DockManager.getInstance(getProject()).getContainers()) {
    if (!myOldDockContainers.contains(container)) {
      Disposer.dispose(container);
    }
  }
  myOldDockContainers = null;
  ((ComponentManagerImpl)getProject()).registerComponentInstance(FileEditorManager.class, myOldManager);
  myManager.closeAllFiles();
  ((FileEditorProviderManagerImpl)FileEditorProviderManager.getInstance()).clearSelectedProviders();
  super.tearDown();
}
项目:intellij-ce-playground    文件:FileEditorManagerImpl.java   
@NotNull
public Set<EditorsSplitters> getAllSplitters() {
  Set<EditorsSplitters> all = new LinkedHashSet<EditorsSplitters>();
  all.add(getMainSplitters());
  Set<DockContainer> dockContainers = myDockManager.getContainers();
  for (DockContainer each : dockContainers) {
    if (each instanceof DockableEditorTabbedContainer) {
      all.add(((DockableEditorTabbedContainer)each).getSplitters());
    }
  }

  return Collections.unmodifiableSet(all);
}
项目:intellij-ce-playground    文件:FileEditorManagerImpl.java   
@Override
public EditorsSplitters getSplittersFor(Component c) {
  EditorsSplitters splitters = null;
  DockContainer dockContainer = myDockManager.getContainerFor(c);
  if (dockContainer instanceof DockableEditorTabbedContainer) {
    splitters = ((DockableEditorTabbedContainer)dockContainer).getSplitters();
  }

  if (splitters == null) {
    splitters = getMainSplitters();
  }

  return splitters;
}
项目:intellij-ce-playground    文件:OpenEditorsContextProvider.java   
public void clearContext() {
  if (myFileEditorManager != null) {
    myFileEditorManager.closeAllFiles();
    myFileEditorManager.getMainSplitters().clear();
  }
  for (DockContainer container : myDockManager.getContainers()) {
    if (container instanceof DockableEditorTabbedContainer) {
      container.closeAll();
    }
  }
}
项目:tools-idea    文件:FileEditorManagerImpl.java   
public Set<EditorsSplitters> getAllSplitters() {
  HashSet<EditorsSplitters> all = new HashSet<EditorsSplitters>();
  all.add(getMainSplitters());
  Set<DockContainer> dockContainers = myDockManager.getContainers();
  for (DockContainer each : dockContainers) {
    if (each instanceof DockableEditorTabbedContainer) {
      all.add(((DockableEditorTabbedContainer)each).getSplitters());
    }
  }

  return Collections.unmodifiableSet(all);
}
项目:tools-idea    文件:FileEditorManagerImpl.java   
public EditorsSplitters getSplittersFor(Component c) {
  EditorsSplitters splitters = null;
  DockContainer dockContainer = myDockManager.getContainerFor(c);
  if (dockContainer instanceof DockableEditorTabbedContainer) {
    splitters = ((DockableEditorTabbedContainer)dockContainer).getSplitters();
  }

  if (splitters == null) {
    splitters = getMainSplitters();
  }

  return splitters;
}
项目:consulo    文件:FileEditorManagerImpl.java   
@Nonnull
public Set<EditorSplitters> getAllSplitters() {
  Set<EditorSplitters> all = new LinkedHashSet<>();
  all.add(getMainSplitters());
  Set<DockContainer> dockContainers = myDockManager.getContainers();
  for (DockContainer each : dockContainers) {
    if (each instanceof DockableEditorTabbedContainer) {
      all.add(((DockableEditorTabbedContainer)each).getSplitters());
    }
  }

  return Collections.unmodifiableSet(all);
}
项目:consulo    文件:FileEditorManagerImpl.java   
@Override
public EditorSplitters getSplittersFor(Component c) {
  EditorSplitters splitters = null;
  DockContainer dockContainer = myDockManager.getContainerFor(c);
  if (dockContainer instanceof DockableEditorTabbedContainer) {
    splitters = ((DockableEditorTabbedContainer)dockContainer).getSplitters();
  }

  if (splitters == null) {
    splitters = getMainSplitters();
  }

  return splitters;
}
项目:intellij-ce-playground    文件:DockableEditorContainerFactory.java   
@Override
public DockContainer createContainer(DockableContent content) {
  return createContainer(false);
}
项目:intellij-ce-playground    文件:DockableEditorContainerFactory.java   
@Override
public DockContainer loadContainerFrom(Element element) {
  DockableEditorTabbedContainer container = (DockableEditorTabbedContainer)createContainer(true);
  container.getSplitters().readExternal(element.getChild("state"));
  return container;
}
项目:intellij-ce-playground    文件:FileEditorManagerImpl.java   
@NotNull
private AsyncResult<EditorsSplitters> getActiveSplitters(boolean syncUsage) {
  final boolean async = Registry.is("ide.windowSystem.asyncSplitters") && !syncUsage;

  final AsyncResult<EditorsSplitters> result = new AsyncResult<EditorsSplitters>();
  final IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
  Runnable run = new Runnable() {
    @Override
    public void run() {
      if (myProject.isDisposed()) {
        result.setRejected();
        return;
      }

      Component focusOwner = fm.getFocusOwner();
      if (focusOwner == null && !async) {
        focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
      }

      if (focusOwner == null && !async) {
        focusOwner = fm.getLastFocusedFor(fm.getLastFocusedFrame());
      }

      DockContainer container = myDockManager.getContainerFor(focusOwner);
      if (container == null && !async) {
        focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
        container = myDockManager.getContainerFor(focusOwner);
      }

      if (container instanceof DockableEditorTabbedContainer) {
        result.setDone(((DockableEditorTabbedContainer)container).getSplitters());
      }
      else {
        result.setDone(getMainSplitters());
      }
    }
  };

  if (async) {
    fm.doWhenFocusSettlesDown(run);
  }
  else {
    UIUtil.invokeLaterIfNeeded(run);
  }

  return result;
}
项目:intellij-ce-playground    文件:DockableGridContainerFactory.java   
@Override
public DockContainer createContainer(DockableContent content) {
  final RunnerContentUi.DockableGrid dockableGrid = (RunnerContentUi.DockableGrid)content;
  return new RunnerContentUi(dockableGrid.getRunnerUi(), dockableGrid.getOriginalRunnerUi(), dockableGrid.getWindow());
}
项目:tools-idea    文件:DockableEditorContainerFactory.java   
@Override
public DockContainer createContainer(DockableContent content) {
  return createContainer(false);
}
项目:tools-idea    文件:DockableEditorContainerFactory.java   
@Override
public DockContainer loadContainerFrom(Element element) {
  DockableEditorTabbedContainer container = (DockableEditorTabbedContainer)createContainer(true);
  container.getSplitters().readExternal(element.getChild("state"));
  return container;
}
项目:tools-idea    文件:FileEditorManagerImpl.java   
private AsyncResult<EditorsSplitters> getActiveSplitters(boolean syncUsage) {
  final boolean async = Registry.is("ide.windowSystem.asyncSplitters") && !syncUsage;

  final AsyncResult<EditorsSplitters> result = new AsyncResult<EditorsSplitters>();
  final IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
  Runnable run = new Runnable() {
    @Override
    public void run() {
      if (myProject.isDisposed()) {
        result.setRejected();
        return;
      }

      Component focusOwner = fm.getFocusOwner();
      if (focusOwner == null && !async) {
        focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
      }

      if (focusOwner == null && !async) {
        focusOwner = fm.getLastFocusedFor(fm.getLastFocusedFrame());
      }

      DockContainer container = myDockManager.getContainerFor(focusOwner);
      if (container == null && !async) {
        focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
        container = myDockManager.getContainerFor(focusOwner);
      }

      if (container instanceof DockableEditorTabbedContainer) {
        result.setDone(((DockableEditorTabbedContainer)container).getSplitters());
      }
      else {
        result.setDone(getMainSplitters());
      }
    }
  };

  if (async) {
    fm.doWhenFocusSettlesDown(run);
  }
  else {
    run.run();
  }

  return result;
}
项目:tools-idea    文件:DockableGridContainerFactory.java   
@Override
public DockContainer createContainer(DockableContent content) {
  final RunnerContentUi.DockableGrid dockableGrid = (RunnerContentUi.DockableGrid)content;
  return new RunnerContentUi(dockableGrid.getRunnerUi(), dockableGrid.getOriginalRunnerUi(), dockableGrid.getWindow());
}
项目:consulo    文件:DockableEditorContainerFactory.java   
@Override
public DockContainer createContainer(DockableContent content) {
  return createContainer(false);
}
项目:consulo    文件:DockableEditorContainerFactory.java   
@Override
public DockContainer loadContainerFrom(Element element) {
  DockableEditorTabbedContainer container = (DockableEditorTabbedContainer)createContainer(true);
  container.getSplitters().readExternal(element.getChild("state"));
  return container;
}
项目:consulo    文件:DockableGridContainerFactory.java   
@Override
public DockContainer createContainer(DockableContent content) {
  final RunnerContentUi.DockableGrid dockableGrid = (RunnerContentUi.DockableGrid)content;
  return new RunnerContentUi(dockableGrid.getRunnerUi(), dockableGrid.getOriginalRunnerUi(), dockableGrid.getWindow());
}