Noise reduction

This commit is contained in:
Roman Shevchenko
2013-01-25 12:15:43 +04:00
parent 28b46c87bb
commit 113b4bf902
12 changed files with 50 additions and 34 deletions
@@ -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.
@@ -145,7 +145,7 @@ public class BuildArtifactsBeforeRunTaskProvider extends BeforeRunTaskProvider<B
builder.addOkAction();
builder.addCancelAction();
builder.setCenterPanel(chooser);
builder.setPreferedFocusComponent(chooser);
builder.setPreferredFocusComponent(chooser);
if (builder.show() == DialogWrapper.OK_EXIT_CODE) {
task.setArtifactPointers(chooser.getMarkedElements());
return true;
@@ -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.
@@ -879,7 +879,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
final DialogBuilder dialogBuilder = new DialogBuilder(myTree);
dialogBuilder.setTitle(ProjectBundle.message("copy.module.dialog.title"));
dialogBuilder.setCenterPanel(component);
dialogBuilder.setPreferedFocusComponent(component.getNameComponent());
dialogBuilder.setPreferredFocusComponent(component.getNameComponent());
dialogBuilder.setOkOperation(new Runnable() {
@Override
public void run() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 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.
@@ -256,7 +256,7 @@ public class FileTypeConfigurable extends BaseConfigurable implements Searchable
final Language oldLanguage = item == null ? null : myTempTemplateDataLanguages.findAssociatedFileType(item);
final FileTypePatternDialog dialog = new FileTypePatternDialog(item, type, oldLanguage);
final DialogBuilder builder = new DialogBuilder(myPatterns);
builder.setPreferedFocusComponent(dialog.getPatternField());
builder.setPreferredFocusComponent(dialog.getPatternField());
builder.setCenterPanel(dialog.getMainPanel());
builder.setTitle(title);
builder.showModal(true);
@@ -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.
@@ -84,12 +84,27 @@ public class DialogBuilder implements Disposable {
return myDialogWrapper;
}
public void setCenterPanel(JComponent centerPanel) { myCenterPanel = centerPanel; }
public void setTitle(String title) { myTitle = title; }
@Deprecated
public void setPreferedFocusComponent(JComponent component) { setPreferredFocusComponent(component); }
public void setPreferredFocusComponent(JComponent component) { myPreferedFocusComponent = component; }
public void setDimensionServiceKey(@NonNls String dimensionServiceKey) { myDimensionServiceKey = dimensionServiceKey; }
public void setCenterPanel(JComponent centerPanel) {
myCenterPanel = centerPanel;
}
public void setTitle(String title) {
myTitle = title;
}
/** @deprecated use {@linkplain #setPreferredFocusComponent(JComponent)} (to remove in IDEA 13) */
@SuppressWarnings({"UnusedDeclaration", "SpellCheckingInspection"})
public void setPreferedFocusComponent(JComponent component) {
setPreferredFocusComponent(component);
}
public void setPreferredFocusComponent(JComponent component) {
myPreferedFocusComponent = component;
}
public void setDimensionServiceKey(@NonNls String dimensionServiceKey) {
myDimensionServiceKey = dimensionServiceKey;
}
public void addAction(Action action) {
addActionDescriptor(new CustomActionDescriptor(action));
@@ -195,7 +210,7 @@ public class DialogBuilder implements Disposable {
public abstract static class DialogActionDescriptor implements ActionDescriptor {
private final String myName;
private final Object myMnemonicChar;
private boolean myIsDeafult = false;
private boolean myIsDefault = false;
protected DialogActionDescriptor(String name, int mnemonicChar) {
myName = name;
@@ -206,12 +221,12 @@ public class DialogBuilder implements Disposable {
Action action = createAction(dialogWrapper);
action.putValue(Action.NAME, myName);
if (myMnemonicChar != null) action.putValue(Action.MNEMONIC_KEY, myMnemonicChar);
if (myIsDeafult) action.putValue(Action.DEFAULT, Boolean.TRUE);
if (myIsDefault) action.putValue(Action.DEFAULT, Boolean.TRUE);
return action;
}
public void setDefault(boolean isDefault) {
myIsDeafult = isDefault;
myIsDefault = isDefault;
}
protected abstract Action createAction(DialogWrapper dialogWrapper);
@@ -367,6 +382,7 @@ public class DialogBuilder implements Disposable {
HelpManager.getInstance().invokeHelp(myHelpId);
}
@NotNull
protected Action[] createActions() {
if (myActions == null) return super.createActions();
ArrayList<Action> actions = new ArrayList<Action>(myActions.size());
@@ -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.
@@ -860,7 +860,7 @@ public class Messages {
final DialogBuilder builder = new DialogBuilder(textField);
builder.setDimensionServiceKey(dimensionServiceKey);
builder.setCenterPanel(ScrollPaneFactory.createScrollPane(textArea));
builder.setPreferedFocusComponent(textArea);
builder.setPreferredFocusComponent(textArea);
String rawText = title;
if (StringUtil.endsWithChar(rawText, ':')) {
rawText = rawText.substring(0, rawText.length() - 1);
@@ -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.
@@ -69,7 +69,7 @@ public class FrameDiffTool implements DiffTool {
builder.removeAllActions();
}
builder.setCenterPanel(diffPanel.getComponent());
builder.setPreferedFocusComponent(diffPanel.getPreferredFocusedComponent());
builder.setPreferredFocusComponent(diffPanel.getPreferredFocusedComponent());
builder.setTitle(request.getWindowTitle());
builder.setDimensionServiceKey(request.getGroupKey());
@@ -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.
@@ -77,7 +77,7 @@ public class MultiLevelDiffTool implements DiffTool, DiscloseMultiRequest {
builder.removeAllActions();
}
builder.setCenterPanel(diffPanel.getComponent());
builder.setPreferedFocusComponent(diffPanel.getPreferredFocusedComponent());
builder.setPreferredFocusComponent(diffPanel.getPreferredFocusedComponent());
builder.setTitle(request.getWindowTitle());
builder.setDimensionServiceKey(request.getGroupKey());
@@ -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.
@@ -58,7 +58,7 @@ public class MergeTool implements DiffTool {
builder.addDisposable(parent);
MergePanel2 mergePanel = createMergeComponent(data, builder, parent);
builder.setCenterPanel(mergePanel.getComponent());
builder.setPreferedFocusComponent(mergePanel.getPreferredFocusedComponent());
builder.setPreferredFocusComponent(mergePanel.getPreferredFocusedComponent());
builder.setHelpId(data.getHelpId());
int result = builder.show();
MergeRequestImpl lastData = mergePanel.getMergeRequest();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 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.
@@ -71,7 +71,7 @@ public class BuildFilePropertiesPanel {
DialogBuilder builder = new DialogBuilder(myBuildFile.getProject());
builder.setCenterPanel(myForm.myWholePanel);
builder.setDimensionServiceKey(DIMENSION_SERVICE_KEY);
builder.setPreferedFocusComponent(myForm.getPreferedFocusComponent());
builder.setPreferredFocusComponent(myForm.getPreferedFocusComponent());
builder.setTitle(AntBundle.message("build.file.properties.dialog.title"));
builder.removeAllActions();
builder.addOkAction();
@@ -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.
@@ -63,8 +63,8 @@ public class GroupList extends JPanel
GroupList groupList = new GroupList(classes);
DialogBuilder builder = new DialogBuilder(component);
builder.setCenterPanel(groupList);
builder.setPreferedFocusComponent(groupList.list);
builder.setTitle("Choose Test Group");
builder.setPreferredFocusComponent(groupList.list);
builder.setTitle("Choose Test Group");
return builder.show() != 0 ? null : groupList.getSelected();
}
}
@@ -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.
@@ -96,8 +96,8 @@ public class MethodList extends JPanel
MethodList list = new MethodList(psiClass);
DialogBuilder builder = new DialogBuilder(component);
builder.setCenterPanel(list);
builder.setPreferedFocusComponent(list.list);
builder.setTitle("Choose Test Method");
builder.setPreferredFocusComponent(list.list);
builder.setTitle("Choose Test Method");
return builder.show() != 0 ? null : list.getSelected();
}
}
@@ -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.
@@ -99,7 +99,7 @@ public class TextControl extends EditorTextFieldControl<TextPanel> {
DialogBuilder builder = new DialogBuilder(project);
builder.setDimensionServiceKey("TextControl");
builder.setCenterPanel(textArea);
builder.setPreferedFocusComponent(textArea);
builder.setPreferredFocusComponent(textArea);
builder.setTitle(UIBundle.message("big.text.control.window.title"));
builder.addCloseButton();
builder.show();