Java Code Examples for com.intellij.openapi.ui.DialogWrapper#isModal()

The following examples show how to use com.intellij.openapi.ui.DialogWrapper#isModal() . 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: ArchiveDiffTool.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public boolean canShow(DiffRequest request) {
  final DiffContent[] contents = request.getContents();
  final DialogWrapper instance = DialogWrapper.findInstance(IdeFocusManager.getInstance(request.getProject()).getFocusOwner());
  if (instance != null && instance.isModal()) return false;
  if (contents.length == 2) {
    final VirtualFile file1 = contents[0].getFile();
    final VirtualFile file2 = contents[1].getFile();
    if (file1 != null && file2 != null) {
      final FileType type1 = contents[0].getContentType();
      final FileType type2 = contents[1].getContentType();
      return type1 == type2 && type1 instanceof ArchiveFileType;
    }
  }
  return false;
}
 
Example 2
Source File: EditSourceForDialogAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
  final Navigatable[] navigatableArray = e.getData(CommonDataKeys.NAVIGATABLE_ARRAY);
  if (navigatableArray != null && navigatableArray.length > 0) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        OpenSourceUtil.navigate(navigatableArray);
      }
    });
    DialogWrapper dialog = DialogWrapper.findInstance(mySourceComponent);
    if (dialog != null && dialog.isModal()) {
      dialog.doCancelAction();
    }
  }
}
 
Example 3
Source File: DirDiffManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static boolean isFromModalDialog(Project project) {
  final Component owner = IdeFocusManager.getInstance(project).getFocusOwner();
  if (owner != null) {
    final DialogWrapper instance = DialogWrapper.findInstance(owner);
    return instance != null && instance.isModal();
  }
  return false;
}