Merge remote-tracking branch 'origin/master'

This commit is contained in:
Yann Cébron
2013-05-29 07:17:29 +02:00
9 changed files with 133 additions and 38 deletions
+1
View File
@@ -134,6 +134,7 @@
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-java/tasks-java.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-java/tasks-java.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-tests/tasks-tests.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-tests/tasks-tests.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/plugins/tasks/tasks-time-tracking/tasks-time-tracking.iml" filepath="$PROJECT_DIR$/plugins/tasks/tasks-time-tracking/tasks-time-tracking.iml" group="plugins/tasks" />
<module fileurl="file://$PROJECT_DIR$/plugins/terminal/terminal.iml" filepath="$PROJECT_DIR$/plugins/terminal/terminal.iml" group="plugins" />
<module fileurl="file://$PROJECT_DIR$/platform/testFramework/testFramework.iml" filepath="$PROJECT_DIR$/platform/testFramework/testFramework.iml" group="platform" />
<module fileurl="file://$PROJECT_DIR$/java/testFramework/testFramework-java.iml" filepath="$PROJECT_DIR$/java/testFramework/testFramework-java.iml" group="java" />
<module fileurl="file://$PROJECT_DIR$/platform/testRunner/testRunner.iml" filepath="$PROJECT_DIR$/platform/testRunner/testRunner.iml" group="platform" />
@@ -531,7 +531,7 @@ public interface Test {
@Override
void fillCompletionVariants(CompletionParameters parameters, CompletionResultSet result) {
result.runRemainingContributors(parameters, true)
Thread.sleep 1000
Thread.sleep 500
}
}
@@ -809,7 +809,6 @@ class Foo {
int actions = 4
for (a1 in 0..actions) {
println "a1 = $a1"
for (a2 in 0..actions) {
myFixture.configureByText("$a1 $a2 .java", src)
myFixture.type 'i'
@@ -1417,8 +1416,28 @@ class Foo {
myFixture.configureByText "a.java", "class Foo {{ <caret> }}"
myFixture.type('a')
joinAutopopup()
type '\n'
type('\n')
assert !lookup
}
public void "test pressing enter and a letter while autopopup is calculating variants should restart autopopup"() {
registerContributor(LongContributor, LoadingOrder.FIRST)
myFixture.configureByText "a.java", "class Foo {{ <caret> }}"
myFixture.type('a')
joinAutopopup()
myFixture.type('\na')
joinCompletion()
assert lookup
}
public void "test a random write action shouldn't cancel autopopup"() {
registerContributor(LongContributor, LoadingOrder.FIRST)
myFixture.configureByText "a.java", "class Foo {{ <caret> }}"
myFixture.type('a')
joinAutopopup()
edt { ApplicationManager.application.runWriteAction {} }
joinCompletion()
assert lookup
}
}
@@ -110,6 +110,7 @@ public class AutoPopupController implements Disposable {
final CompletionPhase.CommittingDocuments phase = new CompletionPhase.CommittingDocuments(null, editor);
CompletionServiceImpl.setCompletionPhase(phase);
phase.ignoreCurrentDocumentChange();
CompletionAutoPopupHandler.runLaterWithCommitted(myProject, editor.getDocument(), new Runnable() {
@Override
@@ -25,6 +25,9 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.ex.AnActionListener;
import com.intellij.openapi.application.ApplicationAdapter;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandAdapter;
import com.intellij.openapi.command.CommandEvent;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.actionSystem.TypedAction;
import com.intellij.openapi.editor.event.*;
@@ -79,6 +82,7 @@ public abstract class CompletionPhase implements Disposable {
private final Editor myEditor;
private final Expirable focusStamp;
private final Project myProject;
private boolean ignoreDocumentChanges;
public CommittingDocuments(@Nullable CompletionProgressIndicator prevIndicator, Editor editor) {
super(prevIndicator);
@@ -91,6 +95,29 @@ public abstract class CompletionPhase implements Disposable {
actionsHappened = true;
}
}, this);
myEditor.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
if (!ignoreDocumentChanges) {
actionsHappened = true;
}
}
}, this);
}
public void ignoreCurrentDocumentChange() {
ignoreDocumentChanges = true;
CommandProcessor.getInstance().addCommandListener(new CommandAdapter() {
@Override
public void commandFinished(CommandEvent event) {
CommandProcessor.getInstance().removeCommandListener(this);
ignoreDocumentChanges = false;
}
});
}
public boolean isRestartingCompletion() {
return indicator != null;
}
public boolean checkExpired() {
@@ -108,16 +135,6 @@ public abstract class CompletionPhase implements Disposable {
return false;
}
public boolean restartCompletion() {
if (indicator != null) {
replaced = true;
indicator.scheduleRestart();
assert this != CompletionServiceImpl.getCompletionPhase();
CompletionServiceImpl.assertPhase(CommittingDocuments.class);
}
return replaced;
}
@Override
public int newCompletionStarted(int time, boolean repeated) {
return time;
@@ -156,11 +173,7 @@ public abstract class CompletionPhase implements Disposable {
@Override
public void beforeWriteActionStart(Object action) {
if (!indicator.getLookup().isLookupDisposed() && !indicator.isCanceled()) {
if (indicator.isAutopopupCompletion()) {
indicator.closeAndFinish(true);
} else {
indicator.scheduleRestart();
}
indicator.scheduleRestart();
}
}
}, this);
@@ -16,7 +16,6 @@
package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.AutoPopupController;
import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.codeInsight.completion.impl.CompletionServiceImpl;
import com.intellij.codeInsight.completion.impl.CompletionSorterImpl;
@@ -422,9 +421,10 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
CompletionServiceImpl
.assertPhase(CompletionPhase.BgCalculation.class, CompletionPhase.ItemsCalculated.class, CompletionPhase.Synchronous.class,
CompletionPhase.CommittingDocuments.class);
if (CompletionServiceImpl.getCompletionPhase() instanceof CompletionPhase.CommittingDocuments) {
LOG.assertTrue(CompletionServiceImpl.getCompletionPhase().indicator != null, CompletionServiceImpl.getCompletionPhase());
((CompletionPhase.CommittingDocuments)CompletionServiceImpl.getCompletionPhase()).replaced = true;
CompletionPhase oldPhase = CompletionServiceImpl.getCompletionPhase();
if (oldPhase instanceof CompletionPhase.CommittingDocuments) {
LOG.assertTrue(((CompletionPhase.CommittingDocuments)oldPhase).isRestartingCompletion(), oldPhase);
((CompletionPhase.CommittingDocuments)oldPhase).replaced = true;
}
CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion);
if (disposeOffsetMap) {
@@ -626,15 +626,6 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
LOG.error(current + "!=" + this);
}
if (isAutopopupCompletion() && !myLookup.isShown()) {
if (CompletionServiceImpl.getCompletionService().getCurrentCompletion() == this) {
closeAndFinish(true);
}
AutoPopupController.getInstance(getProject()).scheduleAutoPopup(myEditor, null);
return;
}
hideAutopopupIfMeaningless();
CompletionPhase oldPhase = CompletionServiceImpl.getCompletionPhase();
@@ -50,7 +50,8 @@ public class CompletionAutoPopupHandler extends TypedHandlerDelegate {
}
if (oldPhase instanceof CompletionPhase.CommittingDocuments && ((CompletionPhase.CommittingDocuments)oldPhase).restartCompletion()) {
if (oldPhase instanceof CompletionPhase.CommittingDocuments && ((CompletionPhase.CommittingDocuments)oldPhase).isRestartingCompletion()) {
((CompletionPhase.CommittingDocuments)oldPhase).ignoreCurrentDocumentChange();
return Result.STOP;
}
@@ -40,12 +40,15 @@ import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorFontType;
import com.intellij.openapi.editor.event.EditorMouseEventArea;
import com.intellij.openapi.editor.ex.*;
import com.intellij.openapi.editor.ex.util.EditorUtil;
import com.intellij.openapi.editor.markup.*;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.ui.HintHint;
import com.intellij.ui.JBColor;
import com.intellij.ui.awt.RelativePoint;
@@ -104,6 +107,14 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
installDnD();
}
setOpaque(true);
if (Registry.is("editor.distraction.free.mode")) {
editor.getComponent().addComponentListener(new ComponentAdapter(){
@Override
public void componentResized(ComponentEvent event) {
updateSize();
}
});
}
}
@SuppressWarnings({"ConstantConditions"})
@@ -261,7 +272,8 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
if (w == 0) return;
paintBackground(g, clip, getAnnotationsAreaOffset(), w);
final Color background = Registry.is("editor.distraction.free.mode") ? myEditor.getBackgroundColor() : getBackground();
paintBackground(g, clip, getAnnotationsAreaOffset(), w, background);
Color color = myEditor.getColorsScheme().getColor(EditorColors.ANNOTATIONS_COLOR);
g.setColor(color != null ? color : JBColor.blue);
@@ -320,7 +332,15 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
}
private void paintBackground(final Graphics g, final Rectangle clip, final int x, final int width) {
g.setColor(getBackground());
paintBackground(g, clip, x, width, getBackground());
}
private void paintBackground(final Graphics g,
final Rectangle clip,
final int x,
final int width,
Color background) {
g.setColor(background);
g.fillRect(x, clip.y, width, clip.height);
paintCaretRowBackground(g, x, width);
@@ -527,6 +547,22 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
myTextAnnotationGutterSizes.set(j, gutterSize);
myTextAnnotationGuttersSize += gutterSize;
}
if (myEditor.getComponent().isShowing() && Registry.is("editor.distraction.free.mode") && !isMirrored()) {
centerEditorByAnnotationArea();
}
}
private void centerEditorByAnnotationArea() {
EditorSettings settings = myEditor.getSettings();
int editorLocation = (int)myEditor.getComponent().getLocationOnScreen().getX();
int rightMargin = settings.getRightMargin(myEditor.getProject());
int rightMarginX = rightMargin * EditorUtil.getSpaceWidth(Font.PLAIN, myEditor) + editorLocation;
int width = (int)WindowManager.getInstance().getIdeFrame(myEditor.getProject()).getComponent().getSize().getWidth();
if (rightMarginX < width && editorLocation < width - rightMarginX) {
myTextAnnotationGuttersSize = Math.max(myTextAnnotationGuttersSize, (width - rightMarginX - editorLocation)/2 - myIconsAreaWidth - 10);
}
}
private TIntObjectHashMap<ArrayList<GutterIconRenderer>> myLineToGutterRenderers;
@@ -114,6 +114,7 @@ editor.use.new.tabs=true
editor.use.scrollable.tabs=true
editor.smarterSelectionQuoting=true
editor.skip.copy.and.cut.for.empty.selection=false
editor.distraction.free.mode=false
ide.showIndexRebuildMessage=false
+36 -4
View File
@@ -9,11 +9,43 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="lang-api" />
<orderEntry type="library" name="jna" level="project" />
<orderEntry type="library" name="jediterm-pty" level="project" />
<orderEntry type="library" name="jpty" level="project" />
<orderEntry type="library" name="purejavacomm" level="project" />
<orderEntry type="module" module-name="platform-impl" />
<orderEntry type="module-library">
<library name="jna">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jna.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jpty">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/JPty.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="purejavacomm">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/purejavacomm-0.0.16.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jediterm-pty">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jediterm-pty-0.04.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>