From 3682c76eddb8aeaa5ab3b27648d2d7ca477c30e9 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Mon, 23 Apr 2012 14:36:09 +0400 Subject: [PATCH 1/7] Property for layout:gravity --- .../designer/model/PropertyParser.java | 7 +- .../designer/model/views-meta-model.xml | 6 +- .../designer/propertyTable/FlagProperty.java | 14 +- .../propertyTable/GravityProperty.java | 251 ++++++++++++++++++ .../AttributePropertyWithDefault.java | 7 - .../renderers/ResourceRenderer.java | 14 +- .../designer/propertyTable/PropertyTable.java | 11 + .../renderers/BooleanRenderer.java | 12 +- .../renderers/LabelPropertyRenderer.java | 11 +- 9 files changed, 284 insertions(+), 49 deletions(-) create mode 100644 plugins/android-designer/src/com/intellij/android/designer/propertyTable/GravityProperty.java delete mode 100644 plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/AttributePropertyWithDefault.java diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java index 72e0fba8c18e..c4b3f18faca9 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java @@ -269,7 +269,12 @@ public class PropertyParser { property = new AttributePropertyWithDefault(name, definition, "wrap_content"); } else if (formats.contains(AttributeFormat.Flag)) { - property = new FlagProperty(name, definition); + if ("layout:gravity".equals(name)) { + property = new GravityProperty(name, definition); + } + else { + property = new FlagProperty(name, definition); + } } else { property = new AttributeProperty(name, definition); diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml b/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml index e040f92995d9..a94922d56e41 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml +++ b/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml @@ -1044,7 +1044,7 @@ tooltip="A Layout that arranges its children in a single column or a single row."/> @@ -1068,7 +1068,7 @@ tooltip="FrameLayout is designed to block out an area on the screen to display a single item."/> @@ -1144,7 +1144,7 @@ implements IPropertyDecorator { private final PropertyRenderer myRenderer = new LabelPropertyRenderer(null); - private final AttributeDefinition myDefinition; - private final List> myOptions = new ArrayList>(); + protected final AttributeDefinition myDefinition; + protected final List> myOptions = new ArrayList>(); public FlagProperty(@NotNull String name, @NotNull AttributeDefinition definition) { super(null, name); @@ -114,11 +114,11 @@ public class FlagProperty extends Property implements IPropert } @Nullable - private XmlAttribute getAttribute(RadViewComponent component) { + protected XmlAttribute getAttribute(RadViewComponent component) { return component.getTag().getAttribute("android:" + myDefinition.getName()); } - private Set getOptions(RadViewComponent component) throws Exception { + protected Set getOptions(RadViewComponent component) throws Exception { String value = component.getTag().getAttributeValue("android:" + myDefinition.getName()); if (value == null) { return Collections.emptySet(); @@ -167,9 +167,9 @@ public class FlagProperty extends Property implements IPropert // ////////////////////////////////////////////////////////////////////////////////////////// - private class OptionProperty extends Property { - private PropertyRenderer myRenderer = new BooleanRenderer(); - private PropertyEditor myEditor = new BooleanEditor(); + protected class OptionProperty extends Property { + private final PropertyRenderer myRenderer = new BooleanRenderer(); + private final PropertyEditor myEditor = new BooleanEditor(); private final String myValueName; public OptionProperty(@Nullable Property parent, @NotNull String name, @NotNull String valueName) { diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/GravityProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/GravityProperty.java new file mode 100644 index 000000000000..da93bdff7794 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/GravityProperty.java @@ -0,0 +1,251 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.android.designer.propertyTable; + +import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.android.designer.propertyTable.editors.StringsComboEditor; +import com.intellij.designer.propertyTable.Property; +import com.intellij.designer.propertyTable.PropertyEditor; +import com.intellij.designer.propertyTable.PropertyRenderer; +import com.intellij.designer.propertyTable.renderers.LabelPropertyRenderer; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.xml.XmlAttribute; +import com.intellij.util.ArrayUtil; +import org.jetbrains.android.dom.attrs.AttributeDefinition; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * @author Alexander Lobas + */ +public class GravityProperty extends FlagProperty { + private static final String[] CENTER = {"center_horizontal", "center_vertical", "center"}; + private static final String[] FILL = {"fill_horizontal", "fill_vertical", "fill"}; + private static final String[] CLIP = {"clip_horizontal", "clip_vertical"}; + + private static final String[] COMBO_ITEMS = {"horizontal", "vertical", "both"}; + + public GravityProperty(@NotNull String name, @NotNull AttributeDefinition definition) { + super(name, definition); + + myOptions.remove(getProperty("center_horizontal")); + myOptions.remove(getProperty("center_vertical")); + myOptions.set(getProperty("center"), new ComboOptionProperty(this, "center", CENTER) { + @Override + protected void setValue(RadViewComponent component, int index) throws Exception { + if (index == 0) { + setOptions(component, new String[]{"center_horizontal"}, new String[]{"center_vertical", "center"}); + } + else if (index == 1) { + setOptions(component, new String[]{"center_vertical"}, new String[]{"center_horizontal", "center"}); + } + else { + setOptions(component, new String[]{"center"}, new String[]{"center_horizontal", "center_vertical"}); + } + } + }); + + myOptions.remove(getProperty("fill_horizontal")); + myOptions.remove(getProperty("fill_vertical")); + myOptions.set(getProperty("fill"), new ComboOptionProperty(this, "fill", FILL) { + @Override + protected void setValue(RadViewComponent component, int index) throws Exception { + if (index == 0) { + setOptions(component, new String[]{"fill_horizontal"}, new String[]{"fill_vertical", "fill"}); + } + else if (index == 1) { + setOptions(component, new String[]{"fill_vertical"}, new String[]{"fill_horizontal", "fill"}); + } + else { + setOptions(component, new String[]{"fill"}, new String[]{"fill_horizontal", "fill_vertical"}); + } + } + }); + + myOptions.remove(getProperty("clip_vertical")); + myOptions.set(getProperty("clip_horizontal"), new ComboOptionProperty(this, "clip", CLIP) { + @Override + protected void setValue(RadViewComponent component, int index) throws Exception { + if (index == 0) { + setOptions(component, new String[]{"clip_horizontal"}, new String[]{"clip_vertical"}); + } + else if (index == 1) { + setOptions(component, new String[]{"clip_vertical"}, new String[]{"clip_horizontal"}); + } + else { + setOptions(component, CLIP, null); + } + } + }); + } + + private int getProperty(String name) { + int size = myOptions.size(); + for (int i = 0; i < size; i++) { + if (name.equals(myOptions.get(i).getName())) { + return i; + } + } + return -1; + } + + @Override + public Object getValue(RadViewComponent component) throws Exception { + StringBuilder value = new StringBuilder("["); + Set options = getOptions(component); + int index = 0; + for (Property option : myOptions) { + String name = null; + + if (option instanceof OptionProperty) { + if (options.contains(((OptionProperty)option).getValueName())) { + name = option.getName(); + } + } + else { + name = ((ComboOptionProperty)option).getValue(options); + } + + if (name != null) { + if (index++ > 0) { + value.append(", "); + } + value.append(name); + } + } + return value.append("]").toString(); + } + + private void setOptions(final RadViewComponent component, @Nullable String[] setNames, @Nullable String[] unsetNames) throws Exception { + final Set options = new HashSet(getOptions(component)); + if (unsetNames != null) { + for (String name : unsetNames) { + options.remove(name); + } + } + if (setNames != null) { + Collections.addAll(options, setNames); + } + + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + if (options.isEmpty()) { + XmlAttribute attribute = getAttribute(component); + if (attribute != null) { + attribute.delete(); + } + } + else { + component.getTag().setAttribute("android:" + myDefinition.getName(), StringUtil.join(options, "|")); + } + } + }); + } + + private abstract class ComboOptionProperty extends Property { + private final PropertyRenderer myRenderer = new LabelPropertyRenderer(null); + private final PropertyEditor myEditor = new StringsComboEditor(COMBO_ITEMS); + private final String[] myValues; + + public ComboOptionProperty(@Nullable Property parent, @NotNull String name, String[] values) { + super(parent, name); + myValues = values; + } + + @Nullable + public String getValue(Set options) { + StringBuilder values = new StringBuilder(); + int index = 0; + for (String value : myValues) { + if (options.contains(value)) { + if (index++ > 0) { + values.append(", "); + } + values.append(value); + } + } + return index == 0 ? null : values.toString(); + } + + @Override + public Object getValue(RadViewComponent component) throws Exception { + Set options = getOptions(component); + int lastIndex = -1; + for (int i = 0; i < myValues.length; i++) { + if (options.contains(myValues[i])) { + lastIndex = i; + } + } + return lastIndex == -1 ? null : COMBO_ITEMS[lastIndex]; + } + + @Override + public void setValue(RadViewComponent component, Object value) throws Exception { + int index = ArrayUtil.indexOf(COMBO_ITEMS, value); + if (index == -1) { + setOptions(component, null, myValues); + } + else { + setValue(component, index); + } + } + + protected abstract void setValue(RadViewComponent component, int index) throws Exception; + + @Override + public boolean isDefaultValue(RadViewComponent component) throws Exception { + Set options = getOptions(component); + for (String value : myValues) { + if (options.contains(value)) { + return false; + } + } + return true; + } + + @Override + public void setDefaultValue(RadViewComponent component) throws Exception { + setValue(component, null); + } + + @Override + public Property createForNewPresentation(@Nullable Property parent, @NotNull String name) { + return null; + } + + @NotNull + @Override + public PropertyRenderer getRenderer() { + return myRenderer; + } + + @Override + public PropertyEditor getEditor() { + return myEditor; + } + + @Override + public boolean needRefreshPropertyList() { + return true; + } + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/AttributePropertyWithDefault.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/AttributePropertyWithDefault.java deleted file mode 100644 index 6f9a31b5874d..000000000000 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/AttributePropertyWithDefault.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.intellij.android.designer.propertyTable.renderers; - -/** - * @author Alexander Lobas - */ -public class AttributePropertyWithDefault { -} diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java index 79b1365d0568..6fdf76ee4e70 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/renderers/ResourceRenderer.java @@ -17,13 +17,13 @@ package com.intellij.android.designer.propertyTable.renderers; import com.intellij.designer.model.RadComponent; import com.intellij.designer.propertyTable.PropertyRenderer; +import com.intellij.designer.propertyTable.PropertyTable; import com.intellij.designer.propertyTable.renderers.BooleanRenderer; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.SimpleColoredComponent; import com.intellij.ui.SimpleTextAttributes; import com.intellij.util.ArrayUtil; import com.intellij.util.ui.EmptyIcon; -import com.intellij.util.ui.UIUtil; import org.jetbrains.android.dom.attrs.AttributeFormat; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -65,17 +65,7 @@ public class ResourceRenderer implements PropertyRenderer { } myColoredComponent.clear(); - - if (selected) { - myColoredComponent.setForeground(UIUtil.getTableSelectionForeground()); - Color background = UIUtil.getTableSelectionBackground(); - myColoredComponent.setBackground(background); - } - else { - myColoredComponent.setForeground(UIUtil.getTableForeground()); - myColoredComponent.setBackground(UIUtil.getTableBackground()); - } - + PropertyTable.updateRenderer(myColoredComponent, selected); formatValue(value); return myColoredComponent; diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java index 2fe0720f5257..e4c9310dd20a 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/PropertyTable.java @@ -898,6 +898,17 @@ public final class PropertyTable extends JBTable implements ComponentSelectionLi } } + public static void updateRenderer(JComponent component, boolean selected) { + if (selected) { + component.setForeground(UIUtil.getTableSelectionForeground()); + component.setBackground(UIUtil.getTableSelectionBackground()); + } + else { + component.setForeground(UIUtil.getTableForeground()); + component.setBackground(UIUtil.getTableBackground()); + } + } + private class PropertyCellRenderer implements TableCellRenderer { private final ColoredTableCellRenderer myPropertyNameRenderer; private final ColoredTableCellRenderer myErrorRenderer; diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/BooleanRenderer.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/BooleanRenderer.java index 87f0ef2da5c0..9c156c01eae2 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/BooleanRenderer.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/BooleanRenderer.java @@ -17,7 +17,7 @@ package com.intellij.designer.propertyTable.renderers; import com.intellij.designer.model.RadComponent; import com.intellij.designer.propertyTable.PropertyRenderer; -import com.intellij.util.ui.UIUtil; +import com.intellij.designer.propertyTable.PropertyTable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,15 +30,7 @@ import javax.swing.*; public class BooleanRenderer extends JCheckBox implements PropertyRenderer { @NotNull public JComponent getComponent(@Nullable RadComponent component, @Nullable Object value, boolean selected, boolean hasFocus) { - if (selected) { - setForeground(UIUtil.getTableSelectionForeground()); - setBackground(UIUtil.getTableSelectionBackground()); - } - else { - setForeground(UIUtil.getTableForeground()); - setBackground(UIUtil.getTableBackground()); - } - + PropertyTable.updateRenderer(this, selected); setSelected(value != null && (Boolean)value); return this; } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/LabelPropertyRenderer.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/LabelPropertyRenderer.java index ac1117365212..4bdde0ee4aaa 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/LabelPropertyRenderer.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/propertyTable/renderers/LabelPropertyRenderer.java @@ -17,7 +17,7 @@ package com.intellij.designer.propertyTable.renderers; import com.intellij.designer.model.RadComponent; import com.intellij.designer.propertyTable.PropertyRenderer; -import com.intellij.util.ui.UIUtil; +import com.intellij.designer.propertyTable.PropertyTable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,14 +47,7 @@ public class LabelPropertyRenderer extends JLabel implements PropertyRenderer { setIcon(null); // Background and foreground - if (selected) { - setForeground(UIUtil.getTableSelectionForeground()); - setBackground(UIUtil.getTableSelectionBackground()); - } - else { - setForeground(UIUtil.getTableForeground()); - setBackground(UIUtil.getTableBackground()); - } + PropertyTable.updateRenderer(this, selected); if (value != null) { customize(value); From 573bd3c0471c5dfe6e1dd02bd8052d4b7541f3b2 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Mon, 23 Apr 2012 15:17:15 +0400 Subject: [PATCH 2/7] When building stub indices, use created stub tree once just for indexing --- .../intellij/psi/stubs/SerializedStubTree.java | 18 +++++++++++++----- .../intellij/psi/stubs/StubTreeLoaderImpl.java | 2 +- .../intellij/psi/stubs/StubUpdatingIndex.java | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/SerializedStubTree.java b/platform/lang-impl/src/com/intellij/psi/stubs/SerializedStubTree.java index 7641d78d2afb..ddfd11b99314 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/SerializedStubTree.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/SerializedStubTree.java @@ -20,6 +20,7 @@ package com.intellij.psi.stubs; import com.intellij.util.io.UnsyncByteArrayInputStream; +import org.jetbrains.annotations.Nullable; import java.io.DataInput; import java.io.DataOutput; @@ -28,9 +29,9 @@ import java.io.IOException; public class SerializedStubTree { private final byte[] myBytes; private final int myLength; - private final StubElement myStubElement; + private StubElement myStubElement; - public SerializedStubTree(final byte[] bytes, int length, StubElement stubElement) { + public SerializedStubTree(final byte[] bytes, int length, @Nullable StubElement stubElement) { myBytes = bytes; myLength = length; myStubElement = stubElement; @@ -48,9 +49,16 @@ public class SerializedStubTree { out.write(myBytes, 0, myLength); } - public StubElement getStub() { - return myStubElement != null ? - myStubElement : SerializationManager.getInstance().deserialize(new UnsyncByteArrayInputStream(myBytes)); + // willIndexStub is one time optimization hint, once can safely pass false + public StubElement getStub(boolean willIndexStub) { + StubElement stubElement = myStubElement; + if (stubElement != null) { + // not null myStubElement means we just built SerializedStubTree for indexing, + // if we request stub for indexing we can safely use it + myStubElement = null; + if (willIndexStub) return stubElement; + } + return SerializationManager.getInstance().deserialize(new UnsyncByteArrayInputStream(myBytes)); } public boolean equals(final Object that) { diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java index 5545685a80a1..ff4c9c15930e 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java @@ -77,7 +77,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader { final int size = datas.size(); if (size == 1) { - StubElement stub = datas.get(0).getStub(); + StubElement stub = datas.get(0).getStub(false); return new StubTree((PsiFileStub)stub); } else if (size != 0) { diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java index bf13b83a1b8e..9bd15bedfd31 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubUpdatingIndex.java @@ -306,7 +306,7 @@ public class StubUpdatingIndex extends CustomImplementationFileBasedIndexExtensi final Map> stubTree; if (!data.isEmpty()) { final SerializedStubTree stub = data.values().iterator().next(); - stubTree = new StubTree((PsiFileStub)stub.getStub(), false).indexStubTree(); + stubTree = new StubTree((PsiFileStub)stub.getStub(true), false).indexStubTree(); } else { stubTree = Collections.emptyMap(); From 2dd9b94db4f120350a01f56888ad758cee01fec1 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 23 Apr 2012 13:57:06 +0400 Subject: [PATCH 3/7] GitRootScanner: invalidate the scanning flag in case of exception. --- .../git4idea/src/git4idea/roots/GitRootScanner.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/git4idea/src/git4idea/roots/GitRootScanner.java b/plugins/git4idea/src/git4idea/roots/GitRootScanner.java index 9c0c37bdffca..2634a44b8727 100644 --- a/plugins/git4idea/src/git4idea/roots/GitRootScanner.java +++ b/plugins/git4idea/src/git4idea/roots/GitRootScanner.java @@ -129,9 +129,13 @@ public class GitRootScanner implements BulkFileListener, ModuleRootListener, Dis return; } myScanning = true; - myRootProblemNotifier.rescanAndNotifyIfNeeded(); - myExecuteAfterScan.run(); - myScanning = false; + try { + myRootProblemNotifier.rescanAndNotifyIfNeeded(); + myExecuteAfterScan.run(); + } + finally { + myScanning = false; + } } } From 8f9a57b653df99554e924d09e4edd20f4cfcc86b Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 23 Apr 2012 15:25:44 +0400 Subject: [PATCH 4/7] IDEA-84886 Git pull in background. --- plugins/git4idea/src/git4idea/actions/GitPull.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git4idea/src/git4idea/actions/GitPull.java b/plugins/git4idea/src/git4idea/actions/GitPull.java index 9dad1b3a5f9c..23c62a27760c 100644 --- a/plugins/git4idea/src/git4idea/actions/GitPull.java +++ b/plugins/git4idea/src/git4idea/actions/GitPull.java @@ -68,7 +68,7 @@ public class GitPull extends GitRepositoryAction { final Label beforeLabel = LocalHistory.getInstance().putSystemLabel(project, "Before update"); final AtomicReference handlerReference = new AtomicReference(); - new Task.Modal(project, GitBundle.message("pulling.title", dialog.getRemote()), true) { + new Task.Backgroundable(project, GitBundle.message("pulling.title", dialog.getRemote()), true) { @Override public void run(@NotNull ProgressIndicator indicator) { final GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(myProject); From 7281d44b8b129ac91b1eb3b60fb08ba0cf62b890 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 23 Apr 2012 15:31:18 +0400 Subject: [PATCH 5/7] Git.runInBackground: don't use the queue. The most of Git activity is produce by commands invoked by the user. In this case there is no sense in making the user wait until the previous command is completed (for example, fetch can take a very long time, why should I wait for it to see the history of a file?) Most of the others (e.g. in GitChangeProvider or GitUpdateProcess) are executed in their own general VCS processes. The write-lock is taken anyway globally in GitHandler when needed. --- plugins/git4idea/src/git4idea/GitVcs.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/plugins/git4idea/src/git4idea/GitVcs.java b/plugins/git4idea/src/git4idea/GitVcs.java index 7dd147df97cb..a5a1dddf2796 100644 --- a/plugins/git4idea/src/git4idea/GitVcs.java +++ b/plugins/git4idea/src/git4idea/GitVcs.java @@ -127,7 +127,6 @@ public class GitVcs extends AbstractVcs { private GitVFSListener myVFSListener; // a VFS listener that tracks file addition, deletion, and renaming. - private final BackgroundTaskQueue myTaskQueue; // The queue that is used to schedule background task from actions private final ReadWriteLock myCommandLock = new ReentrantReadWriteLock(true); // The command read/write lock private final TreeDiffProvider myTreeDiffProvider; private final GitCommitAndPushExecutor myCommitAndPushExecutor; @@ -172,7 +171,6 @@ public class GitVcs extends AbstractVcs { myOutgoingChangesProvider = new GitOutgoingChangesProvider(myProject); myTreeDiffProvider = new GitTreeDiffProvider(myProject); myCommitAndPushExecutor = new GitCommitAndPushExecutor(myCheckinEnvironment); - myTaskQueue = new BackgroundTaskQueue(myProject, GitBundle.getString("task.queue.title")); myExecutableValidator = new GitExecutableValidator(myProject, this); myPlatformFacade = ServiceManager.getService(myProject, PlatformFacade.class); } @@ -187,10 +185,7 @@ public class GitVcs extends AbstractVcs { * @param task the task to run */ public static void runInBackground(Task.Backgroundable task) { - GitVcs vcs = getInstance(task.getProject()); - if (vcs != null) { - vcs.myTaskQueue.run(task); - } + task.queue(); } /** From 0409a6e2482a26a779372389c709c23221eeaecc Mon Sep 17 00:00:00 2001 From: nik Date: Mon, 23 Apr 2012 15:40:51 +0400 Subject: [PATCH 6/7] arrange outputs for modules with cyclic dependencies in installers builds --- build/scripts/dist.gant | 1 + 1 file changed, 1 insertion(+) diff --git a/build/scripts/dist.gant b/build/scripts/dist.gant index 7ff3cc0304e9..da143eacc73a 100644 --- a/build/scripts/dist.gant +++ b/build/scripts/dist.gant @@ -47,6 +47,7 @@ setProperty("paths", paths) target(compile: "Compile project") { loadProject() + project.builder.arrangeModuleCyclesOutputs = true project.stage("Cleaning up sandbox folder") forceDelete(paths.sandbox) From f3415e91a6f3de2f5e6c6f7d0d7aa457f0293f83 Mon Sep 17 00:00:00 2001 From: irengrig Date: Mon, 23 Apr 2012 15:54:03 +0400 Subject: [PATCH 7/7] IDEA-84856 Incoming changes doesn't work anymore in 117.222 --- .../vcs/changes/committed/ChangesCacheFile.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java index 2cab2ce6f96a..c702246ac5fa 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java @@ -935,7 +935,7 @@ public class ChangesCacheFile { // a previous incoming changes refresh. So we try to search for the deletion of this file through all // subsequent committed changelists, regardless of whether they are in "incoming" status. private boolean wasSubsequentlyDeleted(final FilePath file, long indexOffset) { - try { + try { // todo should be fixed here indexOffset += INDEX_ENTRY_SIZE; while(indexOffset < myIndexStream.length()) { IndexEntry e = getIndexEntryAtOffset(indexOffset); @@ -949,12 +949,14 @@ public class ChangesCacheFile { debug("Found subsequent deletion for file " + file); return true; } - } else if ((beforeRevision != null) && (c.getAfterRevision() != null) && - (beforeRevision.getFile().getIOFile().getAbsolutePath().equals( - c.getAfterRevision().getFile().getIOFile().getAbsolutePath()))) { - if (file.isUnder(beforeRevision.getFile(), true) && c.isIsReplaced()) { + } else if ((beforeRevision != null) && (c.getAfterRevision() != null)) { + boolean underBefore = file.isUnder(beforeRevision.getFile(), false); + if (underBefore && c.isIsReplaced() && (! file.equals(beforeRevision.getFile()))) { debug("For " + file + "some of parents is replaced: " + beforeRevision.getFile()); return true; + } else if (underBefore && (c.isMoved() || c.isRenamed())) { + debug("For " + file + "some of parents was renamed/moved: " + beforeRevision.getFile()); + return true; } } }