mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -25,6 +25,7 @@ import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Provides services for registering actions which are activated by typing in the editor.
|
||||
@@ -97,7 +98,7 @@ public class TypedAction {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public final void actionPerformed(final Editor editor, final char charTyped, final DataContext dataContext) {
|
||||
public final void actionPerformed(@Nullable final Editor editor, final char charTyped, final DataContext dataContext) {
|
||||
if (editor == null) return;
|
||||
|
||||
Runnable command = new TypingCommand(editor, charTyped, dataContext);
|
||||
|
||||
@@ -17,11 +17,12 @@ package com.intellij.openapi.help;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class HelpManager {
|
||||
public static HelpManager getInstance() {
|
||||
return ServiceManager.getService(HelpManager.class);
|
||||
}
|
||||
|
||||
public abstract void invokeHelp(@NonNls String id);
|
||||
public abstract void invokeHelp(@Nullable @NonNls String id);
|
||||
}
|
||||
|
||||
@@ -687,7 +687,7 @@ public abstract class DialogWrapper {
|
||||
return DialogWrapperPeerFactory.getInstance().createPeer(this, canBeParent, toolkitModalIfPossible);
|
||||
}
|
||||
|
||||
protected DialogWrapperPeer createPeer(final Project project, final boolean canBeParent) {
|
||||
protected DialogWrapperPeer createPeer(@Nullable final Project project, final boolean canBeParent) {
|
||||
return DialogWrapperPeerFactory.getInstance().createPeer(this, project, canBeParent);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -36,7 +37,7 @@ public abstract class DialogWrapperPeerFactory {
|
||||
return ServiceManager.getService(DialogWrapperPeerFactory.class);
|
||||
}
|
||||
|
||||
public abstract DialogWrapperPeer createPeer(DialogWrapper wrapper, Project project, boolean canBeParent);
|
||||
public abstract DialogWrapperPeer createPeer(DialogWrapper wrapper, @Nullable Project project, boolean canBeParent);
|
||||
public abstract DialogWrapperPeer createPeer(DialogWrapper wrapper, boolean canBeParent);
|
||||
public abstract DialogWrapperPeer createPeer(DialogWrapper wrapper, boolean canBeParent, boolean tryToolkitModal);
|
||||
public abstract DialogWrapperPeer createPeer(DialogWrapper wrapper, @NotNull Component parent, boolean canBeParent);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class Messages {
|
||||
return showIdeaMessageDialog(project, message, title, options, defaultOptionIndex, icon, doNotAskOption);
|
||||
}
|
||||
|
||||
public static int showIdeaMessageDialog(@Nullable Project project, String message, String title, String[] options, int defaultOptionIndex, Icon icon,
|
||||
public static int showIdeaMessageDialog(@Nullable Project project, String message, String title, String[] options, int defaultOptionIndex, @Nullable Icon icon,
|
||||
@Nullable DialogWrapper.DoNotAskOption doNotAskOption) {
|
||||
MessageDialog dialog = new MessageDialog(project, message, title, options, defaultOptionIndex, -1, icon, doNotAskOption, false);
|
||||
dialog.show();
|
||||
@@ -156,7 +156,7 @@ public class Messages {
|
||||
return (application != null && (application.isUnitTestMode() || application.isHeadlessEnvironment()));
|
||||
}
|
||||
|
||||
public static int showDialog(Component parent, String message, String title, String[] options, int defaultOptionIndex, Icon icon) {
|
||||
public static int showDialog(Component parent, String message, String title, String[] options, int defaultOptionIndex, @Nullable Icon icon) {
|
||||
if (isApplicationInUnitTestOrHeadless()) {
|
||||
return ourTestImplementation.show(message);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ public class Messages {
|
||||
/**
|
||||
* @see com.intellij.openapi.ui.DialogWrapper#DialogWrapper(Project,boolean)
|
||||
*/
|
||||
public static void showMessageDialog(Project project, String message, String title, @Nullable Icon icon) {
|
||||
public static void showMessageDialog(@Nullable Project project, String message, String title, @Nullable Icon icon) {
|
||||
if (canShowMacSheetPanel()) {
|
||||
MacMessages.getInstance().showOkMessageDialog(title, message, OK_BUTTON, WindowManager.getInstance().suggestParentWindow(project));
|
||||
return;
|
||||
@@ -535,7 +535,7 @@ public class Messages {
|
||||
* @see #showYesNoCancelDialog(Component, String, String, String, String, String, Icon)
|
||||
*/
|
||||
public static int showYesNoCancelDialog(String message, String title, String yes, String no, String cancel, Icon icon,
|
||||
DialogWrapper.DoNotAskOption doNotAskOption) {
|
||||
@Nullable DialogWrapper.DoNotAskOption doNotAskOption) {
|
||||
if (canShowMacSheetPanel()) {
|
||||
return MacMessages.getInstance().showYesNoCancelDialog(title, message, yes, no, cancel, null, doNotAskOption);
|
||||
}
|
||||
@@ -602,7 +602,7 @@ public class Messages {
|
||||
* @return trimmed input string or <code>null</code> if user cancelled dialog.
|
||||
*/
|
||||
@Nullable
|
||||
public static String showInputDialog(Project project, String message, String title, @Nullable Icon icon) {
|
||||
public static String showInputDialog(@Nullable Project project, String message, String title, @Nullable Icon icon) {
|
||||
return showInputDialog(project, message, title, icon, null, null);
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ public class Messages {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String showInputDialog(Project project,
|
||||
public static String showInputDialog(@Nullable Project project,
|
||||
@Nls String message,
|
||||
@Nls String title,
|
||||
@Nullable Icon icon,
|
||||
@@ -927,17 +927,17 @@ public class Messages {
|
||||
protected int myFocusedOptionIndex;
|
||||
protected Icon myIcon;
|
||||
|
||||
public MessageDialog(Project project, String message, String title, String[] options, int defaultOptionIndex, @Nullable Icon icon, boolean canBeParent) {
|
||||
public MessageDialog(@Nullable Project project, String message, String title, String[] options, int defaultOptionIndex, @Nullable Icon icon, boolean canBeParent) {
|
||||
this(project, message, title, options, defaultOptionIndex, -1, icon, canBeParent);
|
||||
}
|
||||
|
||||
public MessageDialog(Project project, String message, String title, String[] options, int defaultOptionIndex, int focusedOptionIndex, @Nullable Icon icon,
|
||||
public MessageDialog(@Nullable Project project, String message, String title, String[] options, int defaultOptionIndex, int focusedOptionIndex, @Nullable Icon icon,
|
||||
@Nullable DoNotAskOption doNotAskOption, boolean canBeParent) {
|
||||
super(project, canBeParent);
|
||||
_init(title, message, options, defaultOptionIndex, focusedOptionIndex, icon, doNotAskOption);
|
||||
}
|
||||
|
||||
public MessageDialog(Project project, String message, String title, String[] options, int defaultOptionIndex, int focusedOptionIndex, @Nullable Icon icon,
|
||||
public MessageDialog(@Nullable Project project, String message, String title, String[] options, int defaultOptionIndex, int focusedOptionIndex, @Nullable Icon icon,
|
||||
boolean canBeParent) {
|
||||
super(project, canBeParent);
|
||||
_init(title, message, options, defaultOptionIndex, focusedOptionIndex, icon, null);
|
||||
@@ -966,7 +966,7 @@ public class Messages {
|
||||
_init(title, message, options, defaultOptionIndex, -1, icon, null);
|
||||
}
|
||||
|
||||
public MessageDialog(String message, String title, String[] options, int defaultOptionIndex, int focusedOptionIndex, Icon icon, DoNotAskOption doNotAskOption) {
|
||||
public MessageDialog(String message, String title, String[] options, int defaultOptionIndex, int focusedOptionIndex, @Nullable Icon icon, @Nullable DoNotAskOption doNotAskOption) {
|
||||
super(false);
|
||||
_init(title, message, options, defaultOptionIndex, focusedOptionIndex, icon, doNotAskOption);
|
||||
}
|
||||
@@ -990,7 +990,7 @@ public class Messages {
|
||||
myDefaultOptionIndex = defaultOptionIndex;
|
||||
myFocusedOptionIndex = focusedOptionIndex;
|
||||
myIcon = icon;
|
||||
setButtonsAlignment(SwingUtilities.CENTER);
|
||||
setButtonsAlignment(SwingConstants.CENTER);
|
||||
setDoNotAskOption(doNotAskOption);
|
||||
init();
|
||||
}
|
||||
@@ -1055,9 +1055,9 @@ public class Messages {
|
||||
if (myMessage.length() > 100) {
|
||||
final JScrollPane pane = ScrollPaneFactory.createScrollPane(messageComponent);
|
||||
pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
|
||||
pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
final int scrollSize = (int)new JScrollBar(JScrollBar.VERTICAL).getPreferredSize().getWidth();
|
||||
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
final int scrollSize = (int)new JScrollBar(Adjustable.VERTICAL).getPreferredSize().getWidth();
|
||||
final Dimension preferredSize =
|
||||
new Dimension(Math.min(textSize.width, screenSize.width / 2) + scrollSize,
|
||||
Math.min(textSize.height, screenSize.height / 3) + scrollSize);
|
||||
@@ -1191,7 +1191,7 @@ public class Messages {
|
||||
protected JTextComponent myField;
|
||||
private final InputValidator myValidator;
|
||||
|
||||
public InputDialog(Project project,
|
||||
public InputDialog(@Nullable Project project,
|
||||
String message,
|
||||
String title,
|
||||
@Nullable Icon icon,
|
||||
@@ -1204,7 +1204,7 @@ public class Messages {
|
||||
myField.setText(initialValue);
|
||||
}
|
||||
|
||||
public InputDialog(Project project,
|
||||
public InputDialog(@Nullable Project project,
|
||||
String message,
|
||||
String title,
|
||||
@Nullable Icon icon,
|
||||
@@ -1556,7 +1556,7 @@ public class Messages {
|
||||
return myComboBox;
|
||||
}
|
||||
|
||||
public void setValidator(InputValidator validator) {
|
||||
public void setValidator(@Nullable InputValidator validator) {
|
||||
myValidator = validator;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public abstract class MacMessages {
|
||||
String defaultButton,
|
||||
String alternateButton,
|
||||
String otherButton,
|
||||
Window window,
|
||||
@Nullable Window window,
|
||||
@Nullable DialogWrapper.DoNotAskOption doNotAskOption);
|
||||
|
||||
public static MacMessages getInstance() {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class HelpManagerImpl extends HelpManager {
|
||||
private HelpSet myHelpSet = null;
|
||||
private IdeaHelpBroker myBroker = null;
|
||||
|
||||
public void invokeHelp(String id) {
|
||||
public void invokeHelp(@Nullable String id) {
|
||||
if (MacHelpUtil.isApplicable()) {
|
||||
if (MacHelpUtil.invokeHelp(id)) return;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,10 @@ import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
||||
import com.intellij.openapi.editor.actionSystem.TypedAction;
|
||||
import com.intellij.openapi.ui.playback.commands.KeyCodeTypeCommand;
|
||||
import com.intellij.openapi.ui.playback.commands.TypeCommand;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.intellij.lang.annotations.JdkConstants;
|
||||
import org.jdom.Element;
|
||||
|
||||
@@ -328,7 +328,7 @@ public class ActionMacroManager implements ExportableApplicationComponent, Named
|
||||
}
|
||||
}
|
||||
|
||||
public void stopRecording(Project project) {
|
||||
public void stopRecording(@Nullable Project project) {
|
||||
LOG.assertTrue(myIsRecording);
|
||||
|
||||
if (myWidget != null) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ide.actionMacro;
|
||||
|
||||
import com.intellij.openapi.options.ex.SingleConfigurableEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
@@ -26,7 +27,7 @@ import com.intellij.openapi.project.Project;
|
||||
* To change this template use Options | File Templates.
|
||||
*/
|
||||
public class EditMacrosDialog extends SingleConfigurableEditor {
|
||||
public EditMacrosDialog(Project project) {
|
||||
public EditMacrosDialog(@Nullable Project project) {
|
||||
super(project, new ActionMacroConfigurable());
|
||||
}
|
||||
|
||||
|
||||
+11
-3
@@ -2,7 +2,9 @@ package com.intellij.ide.actionMacro.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.ListPopup;
|
||||
|
||||
/**
|
||||
* User: Evgeny.Zakrevsky
|
||||
@@ -11,8 +13,14 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
public class PlaySavedMacros extends AnAction {
|
||||
@Override
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
JBPopupFactory.getInstance()
|
||||
.createActionGroupPopup("Play Saved Macros", new MacrosGroup(), e.getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false)
|
||||
.showCenteredInCurrentWindow(e.getProject());
|
||||
final ListPopup popup = JBPopupFactory.getInstance()
|
||||
.createActionGroupPopup("Play Saved Macros", new MacrosGroup(), e.getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH,
|
||||
false);
|
||||
final Project project = e.getProject();
|
||||
if (project != null ) {
|
||||
popup.showCenteredInCurrentWindow(project);
|
||||
} else {
|
||||
popup.showInFocusCenter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -31,6 +31,7 @@ import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
|
||||
import com.intellij.util.Alarm;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -48,7 +49,7 @@ public class SingleConfigurableEditor extends DialogWrapper {
|
||||
private final boolean myShowApplyButton;
|
||||
private boolean myChangesWereApplied;
|
||||
|
||||
public SingleConfigurableEditor(Project project,
|
||||
public SingleConfigurableEditor(@Nullable Project project,
|
||||
Configurable configurable,
|
||||
@NonNls String dimensionKey,
|
||||
final boolean showApplyButton) {
|
||||
@@ -78,7 +79,7 @@ public class SingleConfigurableEditor extends DialogWrapper {
|
||||
myConfigurable.reset();
|
||||
}
|
||||
|
||||
public SingleConfigurableEditor(Project project, Configurable configurable, @NonNls String dimensionKey) {
|
||||
public SingleConfigurableEditor(@Nullable Project project, Configurable configurable, @NonNls String dimensionKey) {
|
||||
this(project, configurable, dimensionKey, true);
|
||||
}
|
||||
|
||||
@@ -86,7 +87,7 @@ public class SingleConfigurableEditor extends DialogWrapper {
|
||||
this(parent, configurable, dimensionServiceKey, true);
|
||||
}
|
||||
|
||||
public SingleConfigurableEditor(Project project, Configurable configurable) {
|
||||
public SingleConfigurableEditor(@Nullable Project project, Configurable configurable) {
|
||||
this(project, configurable, ShowSettingsUtilImpl.createDimensionKey(configurable));
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -20,11 +20,12 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.DialogWrapperPeer;
|
||||
import com.intellij.openapi.ui.DialogWrapperPeerFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class DialogWrapperPeerFactoryImpl extends DialogWrapperPeerFactory {
|
||||
public DialogWrapperPeer createPeer(DialogWrapper wrapper, Project project, boolean canBeParent) {
|
||||
public DialogWrapperPeer createPeer(DialogWrapper wrapper, @Nullable Project project, boolean canBeParent) {
|
||||
return new DialogWrapperPeerImpl(wrapper, project, canBeParent);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
* @param canBeParent specifies whether the dialog can be parent for other windows. This parameter is used
|
||||
* by <code>WindowManager</code>.
|
||||
*/
|
||||
protected DialogWrapperPeerImpl(DialogWrapper wrapper, Project project, boolean canBeParent) {
|
||||
protected DialogWrapperPeerImpl(DialogWrapper wrapper, @Nullable Project project, boolean canBeParent) {
|
||||
myWrapper = wrapper;
|
||||
myTypeAheadCallback = myWrapper.isTypeAheadEnabled() ? new ActionCallback() : (ActionCallback)null;
|
||||
myWindowManager = null;
|
||||
@@ -205,7 +205,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
myDialog.addKeyListener(listener);
|
||||
}
|
||||
|
||||
private void createDialog(Window owner, boolean canBeParent) {
|
||||
private void createDialog(@Nullable Window owner, boolean canBeParent) {
|
||||
if (isHeadless()) {
|
||||
myDialog = new HeadlessDialog();
|
||||
return;
|
||||
|
||||
+1
-1
@@ -404,7 +404,7 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
|
||||
myRefreshIcon.setToolTipText(tooltip);
|
||||
}
|
||||
|
||||
public BalloonHandler notifyByBalloon(MessageType type, String htmlBody, Icon icon, HyperlinkListener listener) {
|
||||
public BalloonHandler notifyByBalloon(MessageType type, String htmlBody, @Nullable Icon icon, @Nullable HyperlinkListener listener) {
|
||||
final Balloon balloon = JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(
|
||||
htmlBody.replace("\n", "<br>"),
|
||||
icon != null ? icon : type.getDefaultIcon(),
|
||||
|
||||
@@ -131,7 +131,7 @@ public class TextPanel extends JComponent {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public final void setText(final String text) {
|
||||
public final void setText(@Nullable final String text) {
|
||||
myText = text == null ? "" : text;
|
||||
repaint();
|
||||
}
|
||||
@@ -159,6 +159,7 @@ public class TextPanel extends JComponent {
|
||||
/**
|
||||
* @return the text that is used to calculate the preferred size
|
||||
*/
|
||||
@Nullable
|
||||
protected String getTextForPreferredSize() {
|
||||
return myMaxPossibleString;
|
||||
}
|
||||
|
||||
@@ -55,15 +55,17 @@ public class Pair<A, B> {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
public Pair(A first, B second) {
|
||||
public Pair(@Nullable A first, @Nullable B second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final A getFirst() {
|
||||
return first;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final B getSecond() {
|
||||
return second;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user