diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java index ae6a063b3873..22e7e2111fb0 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java @@ -1002,7 +1002,7 @@ public class JavaDocInfoGenerator { aClass = ((PsiMember)myElement).getContainingClass(); } else { - LOG.error("Class or member expected but found " + myElement.getClass().getName()); + aClass = PsiTreeUtil.getParentOfType(myElement, PsiClass.class); } if (aClass == null) { diff --git a/java/jdkAnnotations/java/util/annotations.xml b/java/jdkAnnotations/java/util/annotations.xml index 58ea64749e50..9699f06c123b 100644 --- a/java/jdkAnnotations/java/util/annotations.xml +++ b/java/jdkAnnotations/java/util/annotations.xml @@ -462,11 +462,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -482,6 +567,16 @@ + + + + + + + + + + diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java index 235771dadca4..0a25d16fdba2 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/actions/GotoDeclarationAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,7 +153,7 @@ public class GotoDeclarationAction extends BaseCodeInsightAction implements Code else { final TextRange range = reference.getRangeInElement(); final String elementText = reference.getElement().getText(); - LOG.assertTrue(range.getStartOffset() >= 0 && range.getEndOffset() <= elementText.length(), Arrays.toString(elements)); + LOG.assertTrue(range.getStartOffset() >= 0 && range.getEndOffset() <= elementText.length(), Arrays.toString(elements) + ";" + reference); final String refText = range.substring(elementText); title = MessageFormat.format(titlePattern, refText); } diff --git a/platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java b/platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java index 1d4a3fd714c3..d206283375e2 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/EditConfigurationsDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ public class EditConfigurationsDialog extends SingleConfigurableEditor implement protected Executor myExecutor; public EditConfigurationsDialog(final Project project) { - super(project, new RunConfigurable(project)); + super(project, new RunConfigurable(project), IdeModalityType.PROJECT); ((RunConfigurable)getConfigurable()).setRunDialog(this); setTitle(ExecutionBundle.message("run.debug.dialog.title")); setHorizontalStretch(1.3F); diff --git a/platform/lang-impl/src/com/intellij/execution/impl/RunDialog.java b/platform/lang-impl/src/com/intellij/execution/impl/RunDialog.java index e5bdc5ca39fd..bcf2f61299a5 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/RunDialog.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/RunDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -113,7 +113,7 @@ public class RunDialog extends DialogWrapper implements RunConfigurable.RunDialo public static boolean editConfiguration(final Project project, final RunnerAndConfigurationSettings configuration, final String title, @Nullable final Executor executor) { final SingleConfigurationConfigurable configurable = SingleConfigurationConfigurable.editSettings(configuration, executor); - final SingleConfigurableEditor dialog = new SingleConfigurableEditor(project, configurable) { + final SingleConfigurableEditor dialog = new SingleConfigurableEditor(project, configurable, IdeModalityType.PROJECT) { { if (executor != null) setOKButtonText(executor.getActionName()); if (executor != null) setOKButtonIcon(executor.getIcon()); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java index 550465ed533e..3734037f3836 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java @@ -73,6 +73,22 @@ import java.util.Set; */ @SuppressWarnings({"SSBasedInspection", "MethodMayBeStatic", "UnusedDeclaration"}) public abstract class DialogWrapper { + + public static enum IdeModalityType { + IDE, + PROJECT, + MODELESS; + + public Dialog.ModalityType toAwtModality () { + switch (this) { + case IDE: return Dialog.ModalityType.APPLICATION_MODAL; + case PROJECT: return Dialog.ModalityType.DOCUMENT_MODAL; + case MODELESS: return Dialog.ModalityType.MODELESS; + } + return null; + } + } + /** * The default exit code for "OK" action. */ @@ -180,7 +196,11 @@ public abstract class DialogWrapper { * @throws IllegalStateException if the dialog is invoked not on the event dispatch thread */ protected DialogWrapper(@Nullable Project project, boolean canBeParent) { - myPeer = createPeer(project, canBeParent); + this(project, canBeParent, IdeModalityType.IDE); + } + + protected DialogWrapper(@Nullable Project project, boolean canBeParent, IdeModalityType ideModalityType) { + myPeer = createPeer(project, canBeParent, ideModalityType); final Window window = myPeer.getWindow(); if (window != null) { myResizeListener = new ComponentAdapter() { @@ -303,16 +323,16 @@ public abstract class DialogWrapper { myErrorPainter.setValidationInfo(info); if (! myErrorText.isTextSet(info.message)) { - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - if (myDisposed) return; - setErrorText(info.message); - myPeer.getRootPane().getGlassPane().repaint(); - getOKAction().setEnabled(false); - } - }); - } + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + if (myDisposed) return; + setErrorText(info.message); + myPeer.getRootPane().getGlassPane().repaint(); + getOKAction().setEnabled(false); + } + }); + } } private void installErrorPainter() { @@ -725,8 +745,17 @@ public abstract class DialogWrapper { return createPeer(null, canBeParent, applicationModalIfPossible); } + protected DialogWrapperPeer createPeer(final Window owner, final boolean canBeParent, final IdeModalityType ideModalityType) { + return DialogWrapperPeerFactory.getInstance().createPeer(this, owner, canBeParent, ideModalityType); + } + + @Deprecated protected DialogWrapperPeer createPeer(final Window owner, final boolean canBeParent, final boolean applicationModalIfPossible) { - return DialogWrapperPeerFactory.getInstance().createPeer(this, owner, canBeParent, applicationModalIfPossible); + return DialogWrapperPeerFactory.getInstance().createPeer(this, owner, canBeParent, applicationModalIfPossible ? IdeModalityType.IDE : IdeModalityType.PROJECT); + } + + protected DialogWrapperPeer createPeer(@Nullable final Project project, final boolean canBeParent, final IdeModalityType ideModalityType) { + return DialogWrapperPeerFactory.getInstance().createPeer(this, project, canBeParent, ideModalityType); } protected DialogWrapperPeer createPeer(@Nullable final Project project, final boolean canBeParent) { diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapperPeerFactory.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapperPeerFactory.java index 8074c5cd6496..6c39569a8f56 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapperPeerFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapperPeerFactory.java @@ -40,10 +40,17 @@ public abstract class DialogWrapperPeerFactory { public abstract DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent); public abstract DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, boolean canBeParent); + public abstract DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType); + /** @see DialogWrapper#DialogWrapper(boolean, boolean) */ @Deprecated public abstract DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, boolean canBeParent, boolean applicationModalIfPossible); + @Deprecated public abstract DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, Window owner, boolean canBeParent, boolean applicationModalIfPossible); + @Deprecated public abstract DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, @NotNull Component parent, boolean canBeParent); + + public abstract DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType); + public abstract DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, Window owner, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType); } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java index e77c33388d63..fabd1a3eb99f 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowSettingsUtilImpl.java @@ -63,7 +63,7 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil { private static void _showSettingsDialog(final Project project, ConfigurableGroup[] group, @Nullable Configurable toSelect) { group = filterEmptyGroups(group); - if (Registry.is("ide.mac.modalDialogsOnFullscreen")) { + if (Registry.is("ide.perProjectModality")) { new OptionsEditorDialog(project, group, toSelect, true).show(); } else { if (Registry.is("ide.new.preferences")) { @@ -113,7 +113,7 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil { group = filterEmptyGroups(group); OptionsEditorDialog dialog; - if (Registry.is("ide.mac.modalDialogsOnFullscreen")) { + if (Registry.is("ide.perProjectModality")) { dialog = new OptionsEditorDialog(actualProject, group, nameToSelect, true); } else { dialog = new OptionsEditorDialog(actualProject, group, nameToSelect); @@ -137,7 +137,7 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil { final Configurable configurable2Select = findConfigurable2Select(id2Select, group); final OptionsEditorDialog dialog; - if (Registry.is("ide.mac.modalDialogsOnFullscreen")) { + if (Registry.is("ide.perProjectModality")) { dialog = new OptionsEditorDialog(actualProject, group, configurable2Select, true); } else { dialog = new OptionsEditorDialog(actualProject, group, configurable2Select); diff --git a/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java b/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java index a29207c7f681..e871ff1872c2 100644 --- a/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java +++ b/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java @@ -45,6 +45,7 @@ public class DnDAwareTree extends Tree implements DnDAware { super(root); } + @Override public void processMouseEvent(final MouseEvent e) { //todo [kirillk] to delegate this to DnDEnabler if (getToolTipText() == null && e.getID() == MouseEvent.MOUSE_ENTERED) return; @@ -57,6 +58,7 @@ public class DnDAwareTree extends Tree implements DnDAware { super.processMouseMotionEvent(e); } + @Override public final boolean isOverSelection(final Point point) { final TreeUI ui = getUI(); final TreePath path = ui instanceof WideSelectionTreeUI && ((WideSelectionTreeUI)ui).isWideSelection() @@ -65,10 +67,12 @@ public class DnDAwareTree extends Tree implements DnDAware { return isPathSelected(path); } + @Override public void dropSelectionButUnderPoint(final Point point) { TreeUtil.dropSelectionButUnderPoint(this, point); } + @Override @NotNull public final JComponent getComponent() { return this; diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java index 52018f14ae49..7281b7242a6a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java @@ -146,7 +146,7 @@ public class MergePanel2 implements DiffViewer { toolbar.addAction(PreviousDiffAction.find()); toolbar.addAction(NextDiffAction.find()); toolbar.addSeparator(); - toolbar.addAction(new OpenPartialDiffAction(1, 0, AllIcons.Diff.LeftDiff)); + toolbar.addAction(new OpenPartialDiffAction(0, 1, AllIcons.Diff.LeftDiff)); toolbar.addAction(new OpenPartialDiffAction(1, 2, AllIcons.Diff.RightDiff)); toolbar.addAction(new OpenPartialDiffAction(0, 2, AllIcons.Diff.BranchDiff)); toolbar.addSeparator(); diff --git a/platform/platform-impl/src/com/intellij/openapi/options/ex/SingleConfigurableEditor.java b/platform/platform-impl/src/com/intellij/openapi/options/ex/SingleConfigurableEditor.java index 7b5248b7a9e1..005d94003647 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/ex/SingleConfigurableEditor.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/ex/SingleConfigurableEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,8 +53,9 @@ public class SingleConfigurableEditor extends DialogWrapper { public SingleConfigurableEditor(@Nullable Project project, Configurable configurable, @NonNls String dimensionKey, - final boolean showApplyButton) { - super(project, true); + final boolean showApplyButton, + final IdeModalityType ideModalityType) { + super(project, true, ideModalityType); myDimensionKey = dimensionKey; myShowApplyButton = showApplyButton; setTitle(createTitleString(configurable)); @@ -68,7 +69,8 @@ public class SingleConfigurableEditor extends DialogWrapper { public SingleConfigurableEditor(Component parent, Configurable configurable, String dimensionServiceKey, - final boolean showApplyButton) { + final boolean showApplyButton, + final IdeModalityType ideModalityType) { super(parent, true); myDimensionKey = dimensionServiceKey; myShowApplyButton = showApplyButton; @@ -80,6 +82,24 @@ public class SingleConfigurableEditor extends DialogWrapper { myConfigurable.reset(); } + public SingleConfigurableEditor(@Nullable Project project, + Configurable configurable, + @NonNls String dimensionKey, + final boolean showApplyButton) { + this(project, configurable, dimensionKey, showApplyButton, IdeModalityType.IDE); + } + + public SingleConfigurableEditor(Component parent, + Configurable configurable, + String dimensionServiceKey, + final boolean showApplyButton) { + this(parent, configurable, dimensionServiceKey, showApplyButton, IdeModalityType.IDE); + } + + public SingleConfigurableEditor(@Nullable Project project, Configurable configurable, @NonNls String dimensionKey, IdeModalityType ideModalityType) { + this(project, configurable, dimensionKey, true, ideModalityType); + } + public SingleConfigurableEditor(@Nullable Project project, Configurable configurable, @NonNls String dimensionKey) { this(project, configurable, dimensionKey, true); } @@ -88,6 +108,10 @@ public class SingleConfigurableEditor extends DialogWrapper { this(parent, configurable, dimensionServiceKey, true); } + public SingleConfigurableEditor(@Nullable Project project, Configurable configurable, IdeModalityType ideModalityType) { + this(project, configurable, ShowSettingsUtilImpl.createDimensionKey(configurable), ideModalityType); + } + public SingleConfigurableEditor(@Nullable Project project, Configurable configurable) { this(project, configurable, ShowSettingsUtilImpl.createDimensionKey(configurable)); } diff --git a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorDialog.java b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorDialog.java index ee75c3e83cd5..e0d4a03a4e14 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/newEditor/OptionsEditorDialog.java @@ -53,7 +53,7 @@ public class OptionsEditorDialog extends DialogWrapper implements DataProvider{ @NonNls static final String LAST_SELECTED_CONFIGURABLE = "options.lastSelected"; /** This constructor should be eliminated after the new modality approach - * will have been checked. See a {@code Registry} key ide.mac.modalDialogsOnFullscreen + * will have been checked. See a {@code Registry} key ide.perProjectModality * @deprecated */ public OptionsEditorDialog(Project project, ConfigurableGroup[] groups, @@ -63,7 +63,7 @@ public class OptionsEditorDialog extends DialogWrapper implements DataProvider{ } /** This constructor should be eliminated after the new modality approach - * will have been checked. See a {@code Registry} key ide.mac.modalDialogsOnFullscreen + * will have been checked. See a {@code Registry} key ide.perProjectModality * @deprecated */ public OptionsEditorDialog(Project project, ConfigurableGroup[] groups, diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/AbstractDialog.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/AbstractDialog.java index c2eed8e02958..ad6f92ae54d8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/AbstractDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/AbstractDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ interface AbstractDialog extends Disposable { void addKeyListener(KeyListener listener); + @Deprecated // Use setModalityType instead void setModal(boolean b); void toFront(); @@ -87,8 +88,13 @@ interface AbstractDialog extends Disposable { void setLocation(int x, int y); + @Deprecated // use getModalityTypeInstead boolean isModal(); + void setModalityType(Dialog.ModalityType modalityType); + + Dialog.ModalityType getModalityType(); + void show(); IdeFocusManager getFocusManager(); diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerFactoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerFactoryImpl.java index 134416ef20d3..349272acaa8c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerFactoryImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerFactoryImpl.java @@ -30,6 +30,10 @@ public class DialogWrapperPeerFactoryImpl extends DialogWrapperPeerFactory { return new DialogWrapperPeerImpl(wrapper, project, canBeParent); } + public DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType) { + return new DialogWrapperPeerImpl(wrapper, project, canBeParent, ideModalityType); + } + @Override public DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, boolean canBeParent) { return new DialogWrapperPeerImpl(wrapper, canBeParent); @@ -53,4 +57,17 @@ public class DialogWrapperPeerFactoryImpl extends DialogWrapperPeerFactory { public DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, @NotNull Component parent, boolean canBeParent) { return new DialogWrapperPeerImpl(wrapper, parent, canBeParent); } + + @Override + public DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType) { + return new DialogWrapperPeerImpl(wrapper, (Window)null, canBeParent, ideModalityType); + } + + @Override + public DialogWrapperPeer createPeer(@NotNull DialogWrapper wrapper, + Window owner, + boolean canBeParent, + DialogWrapper.IdeModalityType ideModalityType) { + return new DialogWrapperPeerImpl(wrapper, owner, canBeParent, ideModalityType); + } } \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java index a312cc42e7a3..bff6d208005a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java @@ -77,16 +77,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra private final ActionCallback myTypeAheadDone = new ActionCallback("DialogTypeAheadDone"); private ActionCallback myTypeAheadCallback; - /** - * Creates modal DialogWrapper. The currently active window will be the dialog's parent. - * - * @param project parent window for the dialog will be calculated based on focused window for the - * specified project. This parameter can be null. In this case parent window - * will be suggested based on current focused window. - * @param canBeParent specifies whether the dialog can be parent for other windows. This parameter is used - * by WindowManager. - */ - protected DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent) { + protected DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType) { myWrapper = wrapper; myTypeAheadCallback = myWrapper.isTypeAheadEnabled() ? new ActionCallback() : null; myWindowManager = null; @@ -135,7 +126,20 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra } } - createDialog(owner, canBeParent); + createDialog(owner, canBeParent, ideModalityType); + } + + /** + * Creates modal DialogWrapper. The currently active window will be the dialog's parent. + * + * @param project parent window for the dialog will be calculated based on focused window for the + * specified project. This parameter can be null. In this case parent window + * will be suggested based on current focused window. + * @param canBeParent specifies whether the dialog can be parent for other windows. This parameter is used + * by WindowManager. + */ + protected DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper, @Nullable Project project, boolean canBeParent) { + this(wrapper, project, canBeParent, DialogWrapper.IdeModalityType.IDE); } protected DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper, boolean canBeParent) { @@ -181,14 +185,8 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra createDialog(owner, canBeParent); } - /** @see DialogWrapper#DialogWrapper(boolean, boolean) - */ - @Deprecated - public DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper, final boolean canBeParent, final boolean applicationModalIfPossible) { - this(wrapper, null, canBeParent, applicationModalIfPossible); - } - - public DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper,final Window owner, final boolean canBeParent, final boolean applicationModalIfPossible) { + public DialogWrapperPeerImpl(@NotNull final DialogWrapper wrapper,final Window owner, final boolean canBeParent, + final DialogWrapper.IdeModalityType ideModalityType ) { myWrapper = wrapper; myWindowManager = null; Application application = ApplicationManager.getApplication(); @@ -196,15 +194,28 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra myWindowManager = (WindowManagerEx)WindowManager.getInstance(); } createDialog(owner, canBeParent); - if (applicationModalIfPossible && !isHeadless()) { - Dialog.ModalityType modalityType = Dialog.ModalityType.TOOLKIT_MODAL; - if (Registry.is("ide.mac.modalDialogsOnFullscreen")) { - modalityType = Dialog.ModalityType.APPLICATION_MODAL; + + if (!isHeadless()) { + Dialog.ModalityType modalityType = DialogWrapper.IdeModalityType.IDE.toAwtModality(); + if (Registry.is("ide.perProjectModality")) { + modalityType = ideModalityType.toAwtModality(); } - ((MyDialog)myDialog).setModalityType(modalityType); + myDialog.setModalityType(modalityType); } } + /** @see DialogWrapper#DialogWrapper(boolean, boolean) + */ + @Deprecated + public DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper, final boolean canBeParent, final boolean applicationModalIfPossible) { + this(wrapper, null, canBeParent, applicationModalIfPossible); + } + + @Deprecated + public DialogWrapperPeerImpl(@NotNull DialogWrapper wrapper,final Window owner, final boolean canBeParent, final boolean applicationModalIfPossible) { + this(wrapper, owner, canBeParent, applicationModalIfPossible ? DialogWrapper.IdeModalityType.IDE : DialogWrapper.IdeModalityType.PROJECT); + } + @Override public void setUndecorated(boolean undecorated) { myDialog.setUndecorated(undecorated); @@ -225,19 +236,22 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra myDialog.addKeyListener(listener); } - private void createDialog(@Nullable Window owner, boolean canBeParent) { + private void createDialog(@Nullable Window owner, boolean canBeParent, DialogWrapper.IdeModalityType ideModalityType) { if (isHeadless()) { myDialog = new HeadlessDialog(); return; } myDialog = new MyDialog(owner, myWrapper, myProject, myWindowFocusedCallback, myTypeAheadDone, myTypeAheadCallback); - if (!Registry.is("ide.mac.modalDialogsOnFullscreen")) { - myDialog.setModal(true); - } + myDialog.setModalityType(ideModalityType.toAwtModality()); + myCanBeParent = canBeParent; } + private void createDialog(@Nullable Window owner, boolean canBeParent) { + createDialog(owner, canBeParent, DialogWrapper.IdeModalityType.IDE); + } + @Override public void toFront() { myDialog.toFront(); @@ -546,10 +560,6 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra @NotNull ActionCallback typeAheadDone, ActionCallback typeAheadCallback) { super(owner); - if (Registry.is("ide.mac.modalDialogsOnFullscreen")) { - //todo should be passed in the super method - setModalityType(ModalityType.DOCUMENT_MODAL); - } myDialogWrapper = new WeakReference(dialogWrapper); myProject = project != null ? new WeakReference(project) : null; diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/HeadlessDialog.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/HeadlessDialog.java index 6f690739b700..ebbe98d2f4b4 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/HeadlessDialog.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/HeadlessDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -131,6 +131,15 @@ class HeadlessDialog implements AbstractDialog { return false; } + @Override + public void setModalityType(Dialog.ModalityType modalityType) { + } + + @Override + public Dialog.ModalityType getModalityType() { + return null; + } + public void show() { } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/CommandProcessor.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/CommandProcessor.java index 15996cb6c624..30777377bc49 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/CommandProcessor.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/CommandProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Condition; +import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.wm.impl.commands.FinalizableCommand; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -78,7 +79,8 @@ public final class CommandProcessor implements Runnable { // definitely have some since runnables in command list may (and do) request some PSI activity final boolean queueNext = myCommandCount > 0; Application application = ApplicationManager.getApplication(); - application.getInvokator().invokeLater(command, ModalityState.NON_MODAL, expire == null ? application.getDisposed() : expire).doWhenDone(new Runnable() { + ModalityState modalityState = Registry.is("ide.perProjectModality") ? ModalityState.defaultModalityState() : ModalityState.NON_MODAL; + application.getInvokator().invokeLater(command, modalityState, expire == null ? application.getDisposed() : expire).doWhenDone(new Runnable() { public void run() { if (queueNext) { CommandProcessor.this.run(); diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index fa2647634a7c..9580850531a2 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -131,9 +131,9 @@ ide.mac.hide.cursor.when.typing=true ide.mac.show.native.help=true ide.mac.useNativeClipboard=false ide.mac.boldEditorTabs=false -ide.mac.modalDialogsOnFullscreen=false +ide.perProjectModality=false # suppress inspection "UnusedProperty" -ide.mac.modalDialogsOnFullscreen.description=New modality approach. All dialogs are DOCUMENT_MODAL expect ide-wide dialogs +ide.perProjectModality.description=New modality approach. All dialogs are DOCUMENT_MODAL expect ide-wide dialogs ide.mac.retina.disableDrawingFix=false @@ -318,4 +318,4 @@ GRADLE.system.in.process=true # suppress inspection "UnusedProperty" GRADLE.system.in.process.description=Whether IDEA should use 'in-process' mode for interaction with gradle api -grails.advanced.mode=false \ No newline at end of file +grails.advanced.mode=false diff --git a/plugins/junit/src/com/intellij/execution/junit2/TestProxy.java b/plugins/junit/src/com/intellij/execution/junit2/TestProxy.java index 572b862b21c2..93736671723c 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/TestProxy.java +++ b/plugins/junit/src/com/intellij/execution/junit2/TestProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package com.intellij.execution.junit2; import com.intellij.execution.Location; import com.intellij.execution.junit2.events.*; import com.intellij.execution.junit2.info.TestInfo; +import com.intellij.execution.junit2.states.IgnoredState; import com.intellij.execution.junit2.states.Statistics; import com.intellij.execution.junit2.states.TestState; import com.intellij.execution.testframework.AbstractTestProxy; @@ -144,7 +145,7 @@ public class TestProxy extends AbstractTestProxy { @Override public boolean isIgnored() { - return getMagnitude() == PoolOfTestStates.IGNORED_INDEX; + return myState instanceof IgnoredState; } public boolean isPassed() {