Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2012-03-21 20:06:35 +04:00
9 changed files with 86 additions and 70 deletions
@@ -268,6 +268,10 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
myDelegateMessageHandler.processMessage(msg);
}
public boolean errorsDetected() {
return myErrorsFound;
}
public void processFilesToRecompile(ModuleChunk chunk, FileProcessor processor) throws IOException {
for (Module module : chunk.getModules()) {
myFsState.processFilesToRecompile(this, module, processor);
@@ -56,6 +56,9 @@ public abstract class ModuleLevelBuilder extends Builder {
* @throws Exception
*/
public final boolean updateMappings(CompileContext context, final Mappings delta, ModuleChunk chunk, Collection<File> filesToCompile, Collection<File> successfullyCompiled) throws IOException {
if (context.errorsDetected()) {
return false;
}
try {
boolean additionalPassRequired = false;
@@ -44,7 +44,7 @@ abstract class CharArray implements CharSequenceBackedByArray {
private static final boolean DISABLE_DEFERRED_PROCESSING = Boolean.getBoolean("idea.document.deny.deferred.changes");
@SuppressWarnings("UseOfArchaicSystemPropertyAccessors")
private static final boolean DEBUG_DEFERRED_PROCESSING = LOG.isDebugEnabled() || Boolean.getBoolean("idea.document.debug.bulk.processing") || DocumentImpl.CHECK_DOCUMENT_CONSISTENCY;
private static final boolean DEBUG_DEFERRED_PROCESSING = LOG.isDebugEnabled() || Boolean.getBoolean("idea.document.debug.bulk.processing");
/**
* We can't exclude possibility of situation when <code>'defer changes'</code> state is {@link #setDeferredChangeMode(boolean) entered}
* but not exited, hence, we want to perform automatic flushing if necessary in order to avoid memory leaks. This constant holds
@@ -75,7 +75,7 @@ abstract class CharArray implements CharSequenceBackedByArray {
private final boolean myDebug = isDebug();
boolean isDebug() {
return DEBUG_DEFERRED_PROCESSING;
return DEBUG_DEFERRED_PROCESSING || DocumentImpl.CHECK_DOCUMENT_CONSISTENCY;
}
/**
@@ -180,6 +180,8 @@ abstract class CharArray implements CharSequenceBackedByArray {
}
private void assertConsistency() {
if (!myDebug) return;
if (isDeferredChangeMode()) {
assert myOriginalSequence == null;
}
@@ -187,45 +189,48 @@ abstract class CharArray implements CharSequenceBackedByArray {
int origLen = originalSequence == null ? -1 : originalSequence.length();
String string = myStringRef == null ? null : myStringRef.get();
int stringLen = string == null ? -1 : string.length();
char[] array = myArray;
assert origLen == stringLen || origLen==-1 || stringLen==-1;
int count = myCount + myDeferredShift;
assert count == origLen || origLen==-1;
assert count == stringLen || stringLen==-1;
if (array != null) {
assert myCount <= array.length;
final String stringFromCharArray;
if (myArray != null) {
assert myCount <= myArray.length;
stringFromCharArray = new String(myArray, myStart, myCount);
} else {
stringFromCharArray = null;
}
if (myDebug) {
if (array != null && originalSequence != null) {
assert new String(array, myStart, myCount).equals(originalSequence);
}
if (!isDeferredChangeMode() && array != null && string != null) {
assert new String(array, myStart, myCount).equals(string);
}
if (originalSequence != null && string != null) {
assert string.equals(originalSequence.toString());
}
myDebugArray.assertConsistency();
if (stringFromCharArray != null && originalSequence != null) {
assert stringFromCharArray.equals(originalSequence);
}
if (!isDeferredChangeMode() && stringFromCharArray != null && string != null) {
assert stringFromCharArray.equals(string);
}
if (originalSequence != null && string != null) {
assert string.equals(originalSequence.toString());
}
String str = myStringRef == null ? null : myStringRef.get();
if (str == null) {
if (hasDeferredChanges()) {
str = doSubString(0, myCount + myDeferredShift).toString();
}
else if (myOriginalSequence != null) {
str = myOriginalSequence.toString();
}
else {
str = new String(myArray, myStart, myCount);
}
myDebugArray.assertConsistency();
String str = myStringRef == null ? null : myStringRef.get();
if (str == null) {
if (hasDeferredChanges()) {
str = doSubString(0, myCount + myDeferredShift).toString();
}
assert count == str.length();
if (isDeferredChangeMode()) {
String expected = myDebugArray.toString();
checkStrings("toString()", expected, str);
else if (myOriginalSequence != null) {
str = myOriginalSequence.toString();
}
else {
str = stringFromCharArray;
}
}
assert count == str.length();
if (isDeferredChangeMode()) {
String expected = myDebugArray.toString();
checkStrings("toString()", expected, str);
}
}
@@ -135,7 +135,7 @@ public class FileStructurePopup implements Disposable {
else {
myTreeActionsOwner = null;
myTreeModel = structureViewModel;
}
}
myTreeStructure = new SmartTreeStructure(project, myTreeModel){
public void rebuildTree() {
@@ -233,7 +233,7 @@ public class FileStructurePopup implements Disposable {
}
})
.createPopup();
myTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
@@ -255,6 +255,7 @@ public class FileStructurePopup implements Disposable {
}
}
});
myTree.getEmptyText().setText("Loading...");
final Point location = DimensionService.getInstance().getLocation(getDimensionServiceKey(), myProject);
if (location != null) {
myPopup.showInScreenCoordinates(myEditor.getContentComponent(), location);
@@ -267,29 +268,24 @@ public class FileStructurePopup implements Disposable {
myPopup.setSize(new Dimension(myPreferredWidth + 10, myPopup.getSize().height));
}
//final long cur = System.currentTimeMillis();
final Runnable expandIsDone = new Runnable() {
IdeFocusManager.getInstance(myProject).requestFocus(myTree, true);
myAbstractTreeBuilder.queueUpdate().doWhenDone(new Runnable() {
@Override
public void run() {
//System.out.println(System.currentTimeMillis() - cur);
IdeFocusManager.getInstance(myProject).requestFocus(myTree, true);
myAbstractTreeBuilder.queueUpdate().doWhenDone(new Runnable() {
@Override
myTreeHasBuilt.setDone();
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
selectPsiElement(myInitialPsiElement);
myTreeHasBuilt.setDone();
//long t = System.currentTimeMillis() - time;
//System.out.println("Shown in " + t + "ms");
myFilteringStructure.rebuild();
myAbstractTreeBuilder.queueUpdate(true).doWhenDone(new Runnable() {
@Override
public void run() {
selectPsiElement(myInitialPsiElement);
}
});
}
});
}
};
//if (myTree.isAlwaysExpanded() || true) {
expandIsDone.run();
//} else {
// myAbstractTreeBuilder.expandAll(expandIsDone);
//}
});
if (!ApplicationManager.getApplication().isUnitTestMode()) {
final Alarm alarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, myPopup);
@@ -457,11 +453,11 @@ public class FileStructurePopup implements Disposable {
}
}
}.registerCustomShortcutSet(CustomShortcutSet.fromString("ESCAPE"), myTree);
myTree.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1) {
if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() > 1) {
navigateSelectedElement();
}
}
@@ -497,7 +493,7 @@ public class FileStructurePopup implements Disposable {
return null;
}
});
myFilteringStructure.rebuild();
return panel;
}
@@ -566,7 +562,7 @@ public class FileStructurePopup implements Disposable {
private void addCheckbox(final JPanel panel, final TreeAction action) {
String text = action instanceof FileStructureFilter ? ((FileStructureFilter)action).getCheckBoxText() :
action instanceof FileStructureNodeProvider ? ((FileStructureNodeProvider)action).getCheckBoxText() : null;
action instanceof FileStructureNodeProvider ? ((FileStructureNodeProvider)action).getCheckBoxText() : null;
if (text == null) return;
@@ -574,7 +570,7 @@ public class FileStructurePopup implements Disposable {
((FileStructureFilter)action).getShortcut() : ((FileStructureNodeProvider)action).getShortcut();
final JCheckBox chkFilter = new JCheckBox();
final boolean selected = getDefaultValue(action);
chkFilter.setSelected(selected);
@@ -592,7 +588,7 @@ public class FileStructurePopup implements Disposable {
}
myTreeStructure.rebuildTree();
myFilteringStructure.rebuild();
final Object sel = selection;
final Runnable runnable = new Runnable() {
public void run() {
@@ -745,8 +741,8 @@ public class FileStructurePopup implements Disposable {
} else {
return false;
}
}
}
return true;
}
@@ -300,7 +300,7 @@ public class UISettings implements PersistentStateComponent<UISettings>, Exporta
UISettings uiSettings=getInstance();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
GraphicsUtil.setupAntialiasing(g2d, uiSettings == null || uiSettings.ANTIALIASING_IN_EDITOR);
GraphicsUtil.setupAntialiasing(g2d, uiSettings == null || uiSettings.ANTIALIASING_IN_EDITOR, true);
}
/**
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -303,16 +303,22 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
});
c.addMouseListener(new MouseAdapter() {
public void mouseReleased(final MouseEvent e) {
public void mousePressed(final MouseEvent e) {
myLastPoint[0] = e.getPoint();
SwingUtilities.convertPointToScreen(myLastPoint[0], c);
if (!e.isPopupTrigger()) {
if (!UIUtil.isCloseClick(e)) {
ui.myWindow.fireActivated();
}
}
}
@Override
public void mouseReleased(MouseEvent e) {
if (!e.isPopupTrigger()) {
if (UIUtil.isCloseClick(e, MouseEvent.MOUSE_RELEASED)) {
ui.processHide(e);
}
else {
ui.myWindow.fireActivated();
}
}
}
});
@@ -200,4 +200,6 @@ editor.dumb.mode.available=true
enable.animation.on.dialogs=false
vcs.remote.management.ready=false
type.ahead.logging.enabled=false
fast.tree.expand.in.structure.view=false
fast.tree.expand.in.structure.view=false
python.exported.names.local.cache=false
@@ -25,21 +25,21 @@ import java.util.Map;
*/
public class GraphicsUtil {
public static void setupAntialiasing(@NotNull Graphics g2) {
setupAntialiasing(g2, true);
setupAntialiasing(g2, true, false);
}
public static void setupAntialiasing(Graphics g2, boolean enable) {
public static void setupAntialiasing(Graphics g2, boolean enableAA, boolean ignoreSystemSettings) {
if (g2 instanceof Graphics2D) {
Graphics2D g = (Graphics2D)g2;
Toolkit tk = Toolkit.getDefaultToolkit();
//noinspection HardCodedStringLiteral
Map map = (Map)tk.getDesktopProperty("awt.font.desktophints");
if (map != null) {
if (map != null && !ignoreSystemSettings) {
g.addRenderingHints(map);
} else {
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
enable ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
enableAA ? RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
}
}
}