Java Code Examples for com.intellij.openapi.ui.DialogWrapper#IdeModalityType

The following examples show how to use com.intellij.openapi.ui.DialogWrapper#IdeModalityType . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogWrapperPeerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public DialogWrapperPeerImpl(@Nonnull final DialogWrapper wrapper, final Window owner, final boolean canBeParent, final DialogWrapper.IdeModalityType ideModalityType) {
  myWrapper = wrapper;
  myWindowManager = null;
  Application application = ApplicationManager.getApplication();
  if (application != null) {
    myWindowManager = (DesktopWindowManagerImpl)WindowManager.getInstance();
  }
  createDialog(owner, canBeParent);

  if (!isHeadless()) {
    Dialog.ModalityType modalityType = DialogWrapper.IdeModalityType.IDE.toAwtModality();
    if (ModalityPerProjectEAPDescriptor.is()) {
      modalityType = ideModalityType.toAwtModality();
    }
    myDialog.setModalityType(modalityType);
  }
}
 
Example 2
Source File: DialogWrapperPeerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void createDialog(@Nullable Window owner, boolean canBeParent, @Nonnull DialogWrapper.IdeModalityType ideModalityType) {
  if (isHeadless()) {
    myDialog = new HeadlessDialog(myWrapper);
  }
  else {
    ActionCallback focused = new ActionCallback("DialogFocusedCallback");

    myDialog = new MyDialog(owner, myWrapper, myProject, focused);

    myDialog.setModalityType(ideModalityType.toAwtModality());

    myCanBeParent = canBeParent;
  }
}
 
Example 3
Source File: DialogWrapperPeerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected DialogWrapperPeerImpl(@Nonnull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent, @Nonnull DialogWrapper.IdeModalityType ideModalityType) {
  myWrapper = wrapper;
  myWindowManager = null;
  Application application = ApplicationManager.getApplication();
  if (application != null) {
    myWindowManager = (DesktopWindowManagerImpl)WindowManager.getInstance();
  }

  consulo.ui.Window window = null;
  if (myWindowManager != null) {

    if (project == null) {
      //noinspection deprecation
      project = DataManager.getInstance().getDataContext().getData(CommonDataKeys.PROJECT);
    }

    myProject = project;

    window = myWindowManager.suggestParentWindow(project);
    if (window == null) {
      consulo.ui.Window focusedWindow = myWindowManager.getMostRecentFocusedWindow();
      if (IdeFrameUtil.isRootIdeFrameWindow(focusedWindow)) {
        window = focusedWindow;
      }
    }
    if (window == null) {
      IdeFrame[] frames = myWindowManager.getAllProjectFrames();
      for (IdeFrame frame : frames) {
        if (frame.isActive()) {
          window = frame.getWindow();
          break;
        }
      }
    }
  }

  Window owner;
  if (window != null) {
    owner = TargetAWT.to(window);
  }
  else {
    if (!isHeadless()) {
      owner = JOptionPane.getRootFrame();
    }
    else {
      owner = null;
    }
  }

  createDialog(owner, canBeParent, ideModalityType);
}
 
Example 4
Source File: DialogWrapperPeerFactoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public DialogWrapperPeer createPeer(@Nonnull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType) {
  return new DialogWrapperPeerImpl(wrapper, project, canBeParent, ideModalityType);
}
 
Example 5
Source File: DialogWrapperPeerFactoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public DialogWrapperPeer createPeer(@Nonnull DialogWrapper wrapper, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType) {
  return new DialogWrapperPeerImpl(wrapper, (Window)null, canBeParent, ideModalityType);
}
 
Example 6
Source File: DialogWrapperPeerFactoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public DialogWrapperPeer createPeer(@Nonnull DialogWrapper wrapper, consulo.ui.Window owner, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType) {
  return new DialogWrapperPeerImpl(wrapper, TargetAWT.to(owner), canBeParent, ideModalityType);
}