Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Eugene Kudelevsky
2011-01-21 19:43:27 +03:00
12 changed files with 72 additions and 36 deletions
@@ -90,7 +90,8 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.after.imports"), "BLANK_LINES_AFTER_IMPORTS");
createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.around.class"), "BLANK_LINES_AROUND_CLASS");
createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.after.class.header"), "BLANK_LINES_AFTER_CLASS_HEADER");
createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.after.anonymous.class.header"), "BLANK_LINES_AFTER_ANONYMOUS_CLASS_HEADER");
createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.after.anonymous.class.header"),
"BLANK_LINES_AFTER_ANONYMOUS_CLASS_HEADER");
createOption(optionGroup, "Around field in interface:", "BLANK_LINES_AROUND_FIELD_IN_INTERFACE");
createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.around.field"), "BLANK_LINES_AROUND_FIELD");
createOption(optionGroup, "Around method in interface:", "BLANK_LINES_AROUND_METHOD_IN_INTERFACE");
@@ -127,7 +128,7 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
private void doCreateOption(OptionGroup optionGroup, String title, IntOption option, String fieldName) {
String renamed = myRenamedFields.get(fieldName);
if (renamed != null) title = renamed;
JLabel l = new JLabel(title);
optionGroup.add(l, option.myTextField);
myOptions.add(option);
@@ -152,7 +153,6 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
}
}
return false;
}
public JComponent getPanel() {
@@ -202,6 +202,9 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
@Override
public void renameStandardOption(String fieldName, String newTitle) {
if (myIsFirstUpdate) {
myRenamedFields.put(fieldName, newTitle);
}
for (IntOption option : myOptions) {
option.myTextField.invalidate();
}
@@ -221,6 +224,7 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
private IntOption(String fieldName) {
this(CodeStyleSettings.class, fieldName, false);
}
private IntOption(Class<? extends CustomCodeStyleSettings> targetClass, String fieldName) {
this(targetClass, fieldName, false);
myTargetClass = targetClass;
@@ -289,5 +293,4 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
}
}
}
}
@@ -33,13 +33,19 @@ public class TerminateRemoteProcessDialog extends DialogWrapper {
private JCheckBox myTerminateCheckBox;
private final String mySessionName;
private final boolean myDetachIsDefault;
private final boolean myAlwaysUseDefault;
public TerminateRemoteProcessDialog(final Project project, final String configurationName, final boolean detachIsDefault) {
public TerminateRemoteProcessDialog(final Project project,
final String configurationName,
final boolean detachIsDefault,
boolean alwaysUseDefault) {
super(project, true);
mySessionName = configurationName;
myDetachIsDefault = detachIsDefault;
myAlwaysUseDefault = alwaysUseDefault;
setTitle(ExecutionBundle.message("process.is.running.dialog.title", mySessionName));
setOKButtonText(ExecutionBundle.message("button.disconnect"));
setOKButtonText(alwaysUseDefault && !detachIsDefault ? ExecutionBundle.message("button.terminate")
: ExecutionBundle.message("button.disconnect"));
setButtonsAlignment(SwingUtilities.CENTER);
this.init();
}
@@ -49,8 +55,9 @@ public class TerminateRemoteProcessDialog extends DialogWrapper {
}
protected JComponent createNorthPanel() {
final String message;
message = ExecutionBundle.message("disconnect.process.confirmation.text", mySessionName);
final String message = myAlwaysUseDefault && !myDetachIsDefault ?
ExecutionBundle.message("terminate.process.confirmation.text", mySessionName) :
ExecutionBundle.message("disconnect.process.confirmation.text", mySessionName);
final JLabel label = new JLabel(message);
final JPanel panel = new JPanel(new BorderLayout());
panel.add(label, BorderLayout.CENTER);
@@ -64,25 +71,27 @@ public class TerminateRemoteProcessDialog extends DialogWrapper {
protected JComponent createCenterPanel() {
final JPanel panel = new JPanel(new BorderLayout());
myTerminateCheckBox = new JCheckBox(ExecutionBundle.message("terminate.after.disconnect.checkbox"));
myTerminateCheckBox.setSelected(!myDetachIsDefault);
final Icon icon = UIUtil.getOptionPanelWarningIcon();
if (icon != null) {
final Border border = myTerminateCheckBox.getBorder();
if (border != null) {
final Insets insets = border.getBorderInsets(myTerminateCheckBox);
final Border emptyBorder = BorderFactory.createEmptyBorder(0, icon.getIconWidth()+ICON_TEXT_GAP-insets.left, 0, 0);
myTerminateCheckBox.setBorder(BorderFactory.createCompoundBorder(emptyBorder, border));
}
else {
myTerminateCheckBox.setBorder(BorderFactory.createEmptyBorder(0, icon.getIconWidth()+ICON_TEXT_GAP, 0, 0));
if (!myAlwaysUseDefault) {
myTerminateCheckBox = new JCheckBox(ExecutionBundle.message("terminate.after.disconnect.checkbox"));
myTerminateCheckBox.setSelected(!myDetachIsDefault);
final Icon icon = UIUtil.getOptionPanelWarningIcon();
if (icon != null) {
final Border border = myTerminateCheckBox.getBorder();
if (border != null) {
final Insets insets = border.getBorderInsets(myTerminateCheckBox);
final Border emptyBorder = BorderFactory.createEmptyBorder(0, icon.getIconWidth()+ICON_TEXT_GAP-insets.left, 0, 0);
myTerminateCheckBox.setBorder(BorderFactory.createCompoundBorder(emptyBorder, border));
}
else {
myTerminateCheckBox.setBorder(BorderFactory.createEmptyBorder(0, icon.getIconWidth()+ICON_TEXT_GAP, 0, 0));
}
}
panel.add(myTerminateCheckBox, BorderLayout.WEST);
}
panel.add(myTerminateCheckBox, BorderLayout.WEST);
return panel;
}
public boolean forceTermination() {
return myTerminateCheckBox.isSelected();
return myAlwaysUseDefault ? !myDetachIsDefault : myTerminateCheckBox.isSelected();
}
}
@@ -59,6 +59,7 @@ import java.util.*;
public class RunContentManagerImpl implements RunContentManager, Disposable {
public static final Topic<RunContentWithExecutorListener> RUN_CONTENT_TOPIC = Topic.create("Run Content", RunContentWithExecutorListener.class);
public static final Key<Boolean> ALWAYS_USE_DEFAULT_STOPPING_BEHAVIOUR_KEY = Key.create("ALWAYS_USE_DEFAULT_STOPPING_BEHAVIOUR_KEY");
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.ui.RunContentManagerImpl");
private static final Key<RunContentDescriptor> DESCRIPTOR_KEY = new Key<RunContentDescriptor>("Descriptor");
@@ -574,8 +575,11 @@ public class RunContentManagerImpl implements RunContentManager, Disposable {
destroyProcess = true;
}
else {
//todo[nik] this is a temporary solution for the following problem: some configurations should not allow user to choose between 'terminating' and 'detaching'
final boolean useDefault = Boolean.TRUE.equals(processHandler.getUserData(ALWAYS_USE_DEFAULT_STOPPING_BEHAVIOUR_KEY));
final TerminateRemoteProcessDialog terminateDialog = new TerminateRemoteProcessDialog(myProject, descriptor.getDisplayName(),
processHandler.detachIsDefault());
processHandler.detachIsDefault(),
useDefault);
terminateDialog.show();
if (terminateDialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) return false;
destroyProcess = terminateDialog.forceTermination();
@@ -24,6 +24,7 @@ import com.intellij.lang.Language;
import com.intellij.openapi.progress.NonCancelableSection;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiInvalidElementAccessException;
@@ -75,14 +76,14 @@ public class StubBasedPsiElementBase<T extends StubElement> extends ASTDelegateP
node = myNode;
if (node == null) {
String message = new StringBuilder().
append("failed to bind stub to AST for element ").
append("Failed to bind stub to AST for element ").
append(getClass()).
append(" in ").
append(file.getVirtualFile() == null ? "<unknown file>" : file.getVirtualFile().getPath()).
append("\nFile stub tree:\n").
append(stubTree != null ? ((PsiFileStubImpl)stubTree.getRoot()).printTree() : " is null").
append(stubTree != null ? StringUtil.trimLog(((PsiFileStubImpl)stubTree.getRoot()).printTree(), 1024) : " is null").
append("\nLoaded file AST:\n").
append(DebugUtil.treeToString(fileElement, true)).
append(StringUtil.trimLog(DebugUtil.treeToString(fileElement, true), 1024)).
toString();
throw new IllegalArgumentException(message);
}
@@ -162,8 +162,7 @@ public class PositionPanel extends EditorBasedWidget implements StatusBarWidget.
appendLogicalPosition(caret, message);
if (selectionModel.hasSelection()) {
int len = Math.abs(selectionModel.getSelectionStart() - selectionModel.getSelectionEnd());
message.append("/");
message.append(len);
if (len != 0) message.append("/").append(len);
}
}
@@ -69,7 +69,9 @@ default.run.configuration.name=<unnamed>
process.is.running.dialog.title=Process ''{0}'' is running
button.disconnect=Disconnect
disconnect.process.confirmation.text=Disconnect from the process ''{0}''?
button.terminate=Terminate
disconnect.process.confirmation.text=Do you want to disconnect from the process ''{0}''?
terminate.process.confirmation.text=Do you want to terminate the process ''{0}''?
terminate.after.disconnect.checkbox=Terminate the process after disconnect
copy.configuration.action.name=Copy Configuration
junit.configuration.display.name=JUnit
@@ -412,11 +412,14 @@
<keyboard-shortcut first-keystroke="meta M"/>
</action>
<action id="Vcs.ShowMessageHistory">
<keyboard-shortcut first-keystroke="control M"/>
</action>
<action id="EditorScrollUp"/> <!-- Disables meta up -->
<action id="EditorScrollDown"/> <!-- Disables meta down -->
<action id="FindWordAtCaret"/> <!-- Disables meta F3 -->
<action id="EditorScrollToCenter"/> <!-- Disables meta M -->
<action id="Vcs.ShowMessageHistory"/> <!-- Disables meta M -->
<action id="$Undo">
<keyboard-shortcut first-keystroke="meta Z"/> <!-- Disables alt backspace -->
@@ -308,8 +308,11 @@
<keyboard-shortcut first-keystroke="meta M"/>
</action>
<action id="Vcs.ShowMessageHistory">
<keyboard-shortcut first-keystroke="control M"/>
</action>
<action id="EditorScrollToCenter"/> <!-- Disables meta M -->
<action id="Vcs.ShowMessageHistory"/> <!-- Disables meta M -->
<action id="QuickChangeScheme">
<keyboard-shortcut first-keystroke="control BACK_QUOTE"/>
@@ -19,6 +19,7 @@ import com.intellij.openapi.editor.EditorFactory;
import com.intellij.openapi.editor.impl.event.EditorEventMulticasterImpl;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.impl.ProjectManagerImpl;
import com.intellij.openapi.vfs.encoding.EncodingManager;
import com.intellij.util.containers.hash.LinkedHashMap;
import junit.framework.Assert;
@@ -33,6 +34,7 @@ public class EditorListenerTracker {
private final boolean myDefaultProjectInitialized;
public EditorListenerTracker() {
EncodingManager.getInstance(); //adds listeners
EditorEventMulticasterImpl multicaster = (EditorEventMulticasterImpl)EditorFactory.getInstance().getEventMulticaster();
before = multicaster.getListeners();
myDefaultProjectInitialized = ((ProjectManagerImpl)ProjectManager.getInstance()).isDefaultProjectInitialized();
@@ -20,14 +20,14 @@ import java.util.ArrayList;
import java.util.List;
/**
* This is a very primitive fast logging class, primary for race-conditions debugging
* This is a very primitive fast logging class, primary for race-conditions debugging.
*/
public class Log {
private static final List<String> myStrings = new ArrayList<String>();
private static final List<Throwable> myThrowables = new ArrayList<Throwable>();
private static final Object LOCK = new Object();
private static List<String> myStrings = new ArrayList<String>();
private static List<Throwable> myThrowables = new ArrayList<Throwable>();
private static Object LOCK = new Object();
private Log() { }
public static void print(String text) {
print(text, false);
@@ -40,6 +40,7 @@ public class Log {
}
}
@SuppressWarnings({"ThrowableResultOfMethodCallIgnored", "UseOfSystemOutOrSystemErr"})
public static void flush() {
synchronized (LOCK) {
for (int i = 0; i < myStrings.size(); i++) {
@@ -800,6 +800,13 @@ public class StringUtil {
return s;
}
public static String trimLog(final String text, final int limit) {
if (limit > 5 && text.length() > limit) {
return text.substring(0, limit - 5) + " ...\n";
}
return text;
}
public static boolean startsWithChar(@Nullable CharSequence s, char prefix) {
return s != null && s.length() != 0 && s.charAt(0) == prefix;
}
@@ -22,6 +22,8 @@ binlog
bool
btree
calc
cancelable
cancellable
capath
captcha
ccflags