Merge remote branch 'origin/master'

This commit is contained in:
Dmitry Jemerov
2011-08-22 17:09:52 +02:00
57 changed files with 644 additions and 321 deletions
@@ -38,13 +38,12 @@ public final class EmptySubstitutorImpl extends EmptySubstitutor {
}
public PsiSubstitutor put(PsiTypeParameter classParameter, PsiType mapping){
final PsiSubstitutor substitutor = new PsiSubstitutorImpl();
return substitutor.put(classParameter, mapping);
return new PsiSubstitutorImpl(classParameter, mapping);
}
public PsiSubstitutor putAll(PsiClass parentClass, PsiType[] mappings){
if(!parentClass.hasTypeParameters()) return this;
final PsiSubstitutor substitutor = new PsiSubstitutorImpl();
return substitutor.putAll(parentClass, mappings);
return new PsiSubstitutorImpl(parentClass, mappings);
}
public PsiSubstitutor putAll(PsiSubstitutor another) {
@@ -59,6 +59,16 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
mySubstitutionMap = new THashMap<PsiTypeParameter, PsiType>(2, PSI_EQUIVALENCE);
}
PsiSubstitutorImpl(@NotNull PsiTypeParameter typeParameter, PsiType mapping) {
this();
mySubstitutionMap.put(typeParameter, mapping);
}
PsiSubstitutorImpl(@NotNull PsiClass parentClass, PsiType[] mappings) {
this();
putAllInternal(parentClass, mappings);
}
public PsiType substitute(@NotNull PsiTypeParameter typeParameter) {
if (containsInMap(typeParameter)) {
return getFromMap(typeParameter);
@@ -353,26 +363,30 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
return new PsiSubstitutorImpl(mySubstitutionMap);
}
public synchronized PsiSubstitutor put(@NotNull PsiTypeParameter typeParameter, PsiType mapping) {
public PsiSubstitutor put(@NotNull PsiTypeParameter typeParameter, PsiType mapping) {
PsiSubstitutorImpl ret = clone();
ret.mySubstitutionMap.put(typeParameter, mapping);
return ret;
}
public synchronized PsiSubstitutor putAll(@NotNull PsiClass parentClass, PsiType[] mappings) {
private void putAllInternal(@NotNull PsiClass parentClass, PsiType[] mappings) {
final PsiTypeParameter[] params = parentClass.getTypeParameters();
PsiSubstitutorImpl substitutor = clone();
for (int i = 0; i < params.length; i++) {
PsiTypeParameter param = params[i];
assert param != null;
if (mappings != null && mappings.length > i) {
substitutor.mySubstitutionMap.put(param, mappings[i]);
mySubstitutionMap.put(param, mappings[i]);
}
else {
substitutor.mySubstitutionMap.put(param, null);
mySubstitutionMap.put(param, null);
}
}
}
public PsiSubstitutor putAll(@NotNull PsiClass parentClass, PsiType[] mappings) {
PsiSubstitutorImpl substitutor = clone();
substitutor.putAllInternal(parentClass, mappings);
return substitutor;
}
-3
View File
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ClearCaseSharedConfig">
<option name="myUseUcmModel" value="true" />
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
+16 -28
View File
@@ -71,17 +71,7 @@
<favorites_list name="project1" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="PsiManager.java" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/module1/src/com/intellij/testProject/idea/PsiManager.java">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="3" selection-start="191" selection-end="191" vertical-scroll-proportion="0.1923077">
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
<leaf />
</component>
<component name="FindManager">
<FindUsagesManager>
@@ -100,10 +90,10 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="2662" />
<option name="y" value="185" />
<option name="width" value="1106" />
<option name="height" value="744" />
<option name="x" value="2739" />
<option name="y" value="101" />
<option name="width" value="970" />
<option name="height" value="919" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
@@ -118,7 +108,7 @@
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectReloadState">
<option name="STATE" value="2" />
<option name="STATE" value="0" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
@@ -133,7 +123,6 @@
<sortByType />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<PATH>
@@ -210,6 +199,7 @@
</PATH>
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="Favorites" />
</panes>
@@ -227,8 +217,8 @@
<property name="WebServerToolWindowFactoryState" value="true" />
<property name="MemberChooser.showClasses" value="true" />
<property name="GoToClass.includeLibraries" value="false" />
<property name="options.splitter.details.proportions" value="0.2" />
<property name="options.searchVisible" value="true" />
<property name="options.splitter.details.proportions" value="0.2" />
</component>
<component name="PublishConfig">
<servers>
@@ -252,7 +242,6 @@
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
<option name="Maven.BeforeRunTask" enabled="false" />
<option name="PhingTarget" enabled="false" />
</method>
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
@@ -355,7 +344,7 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="2662" y="185" width="1106" height="744" extended-state="0" />
<frame x="2739" y="101" width="970" height="919" extended-state="0" />
<editor active="false" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
@@ -371,16 +360,19 @@
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32911393" sideWeight="0.0" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32886598" sideWeight="0.0" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
@@ -405,6 +397,7 @@
<option name="SHOW_ONLY_CHANGED_IN_SELECTION_DIFF" value="true" />
<option name="CHECK_COMMIT_MESSAGE_SPELLING" value="true" />
<option name="DEFAULT_PATCH_EXTENSION" value="patch" />
<option name="SHORT_DIFF_HORISONTALLY" value="false" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="LAST_COMMIT_MESSAGE" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
@@ -449,14 +442,9 @@
<state line="9" column="30" selection-start="222" selection-end="222" vertical-scroll-proportion="0.21634616" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/module1/scripts/navigation.ijs">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/module1/src/com/intellij/testProject/idea/PsiManager.java">
<provider selected="true" editor-type-id="text-editor">
<state line="8" column="3" selection-start="191" selection-end="191" vertical-scroll-proportion="0.1923077">
<state line="8" column="3" selection-start="191" selection-end="191" vertical-scroll-proportion="0.15018773">
<folding />
</state>
</provider>
@@ -1 +1,3 @@
%include ../community/platform/funcTests/project1/module1/scripts/selectIn/projectView.ijs
%cd ../community/platform/funcTests/project1/module1/scripts
%include selectIn/projectView.ijs
Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

@@ -141,6 +141,10 @@ class UpdateFoldRegionsOperation implements Runnable {
}
private boolean shouldExpandNewRegion(PsiElement element, TextRange range, Map<TextRange, Boolean> rangeToExpandStatusMap) {
if (myApplyDefaultState) {
// Considering that this code is executed only on initial fold regions construction on editor opening.
return !FoldingPolicy.isCollapseByDefault(element);
}
boolean caretInside;
if (myEditor.getUserData(ALLOW_FOLDING_ON_CARET_LINE_KEY) == Boolean.TRUE) {
caretInside = FoldingUtil.caretInsideRange(myEditor, range);
@@ -157,10 +161,6 @@ class UpdateFoldRegionsOperation implements Runnable {
caretInside = firstLine <= currentLine && currentLine <= lastLine;
}
if (myApplyDefaultState) {
return caretInside || !FoldingPolicy.isCollapseByDefault(element);
}
final Boolean oldStatus = rangeToExpandStatusMap.get(range);
return oldStatus == null || caretInside || oldStatus.booleanValue();
}
@@ -20,7 +20,6 @@ import com.intellij.execution.process.ConsoleHistoryModel;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import java.io.IOException;
import java.io.OutputStream;
@@ -444,7 +444,7 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
else if (object instanceof Project) {
return;
}
hideHint();
hideHint(true);
}
private void ctrlClick(final int index) {
@@ -521,16 +521,25 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner, Dis
}
void cancelPopup() {
cancelPopup(false);
}
void cancelPopup(boolean ok) {
if (myNodePopup != null) {
myNodePopup.hide();
myNodePopup.hide(ok);
myNodePopup = null;
}
}
void hideHint() {
cancelPopup();
hideHint(false);
}
void hideHint(boolean ok) {
cancelPopup(ok);
if (myHint != null) {
myHint.hide();
myHint.hide(ok);
myHint = null;
}
}
@@ -136,7 +136,7 @@ public abstract class AbstractInplaceVariableIntroducer<E extends PsiElement> ex
final JComponent component = getComponent();
if (component == null) return;
if (ApplicationManager.getApplication().isHeadlessEnvironment()) return;
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(component, null);
final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createDialogBalloonBuilder(component, null).setSmallVariant(true);
myBalloon = balloonBuilder.createBalloon();
Disposer.register(myBalloon, new Disposable() {
@Override
@@ -37,11 +37,10 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.event.HyperlinkEvent;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.*;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.util.Arrays;
public class ChangeListStorageImpl implements ChangeListStorage {
private static final int VERSION = 5;
@@ -209,9 +208,12 @@ public class ChangeListStorageImpl implements ChangeListStorage {
try {
int id = myStorage.createNextRecord();
byte[] writtenBytes = changeSetToBytes(changeSet);
assertCorrectlyWritten(writtenBytes);
AbstractStorage.StorageDataOutput out = myStorage.writeStream(id, true);
try {
changeSet.write(out);
out.write(writtenBytes);
}
finally {
out.close();
@@ -221,12 +223,15 @@ public class ChangeListStorageImpl implements ChangeListStorage {
// todo remove this when bug is found
Pair<Long, Integer> os = myStorage.getOffsetAndSize(id);
LocalHistoryLog.LOG.info("Block was written: " + id + " offset: " + os.first + " size: " + os.second);
LocalHistoryLog.LOG
.info("Block was written: " + id + " offset: " + os.first + " size: " + os.second + " real bytes size: " + writtenBytes.length);
if (os.second != writtenBytes.length) throw new IOException("wrong space was allocated for the record!");
// todo remove this when bug is found
if (ApplicationManagerEx.getApplicationEx().isInternal()) {
try {
doReadBlock(id);
byte[] readBytes = myStorage.readBytes(id);
assertCorrectlyWritten(readBytes);
}
catch (IOException e) {
handleError(e, "failed to check the just-written block: " + id);
@@ -238,6 +243,38 @@ public class ChangeListStorageImpl implements ChangeListStorage {
}
}
private byte[] changeSetToBytes(ChangeSet changeSet) throws IOException {
ByteArrayOutputStream byteOS = new ByteArrayOutputStream();
DataOutputStream dataOS = new DataOutputStream(byteOS);
try {
changeSet.write(dataOS);
}
finally {
dataOS.close();
}
return byteOS.toByteArray();
}
private void assertCorrectlyWritten(byte[] writtenBytes) throws IOException {
ChangeSet read;
DataInputStream in = new DataInputStream(new ByteArrayInputStream(writtenBytes));
try {
read = new ChangeSet(in);
}
finally {
in.close();
}
byte[] readBytes = changeSetToBytes(read);
assertBytes(writtenBytes, readBytes);
}
private void assertBytes(byte[] writtenBytes, byte[] readBytes) throws IOException {
if (!Arrays.equals(writtenBytes, readBytes)) {
throw new IOException("bytes was written incorrectly. written: " + writtenBytes.length
+ " read: " + readBytes.length);
}
}
public synchronized void purge(long period, int intervalBetweenActivities, Consumer<ChangeSet> processor) {
if (isCompletelyBroken) return;
@@ -147,4 +147,9 @@ public class LocalHistoryStorage extends AbstractStorage {
}
}
}
@Override
public byte[] readBytes(int record) throws IOException {
return super.readBytes(record);
}
}
@@ -22,9 +22,11 @@ import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ProjectManagerAdapter;
import com.intellij.openapi.util.BusyObject;
import com.intellij.util.containers.HashSet;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -59,34 +61,50 @@ public class UiActivityMonitor implements ApplicationComponent {
}
public void addActivity(@NotNull Project project, Object activity) {
if (!hasObjectFor(project)) {
Project[] open = ProjectManager.getInstance().getOpenProjects();
for (Project each : open) {
if (each == project) {
initBusyObjectFor(project);
break;
public void addActivity(@NotNull final Project project, final Object activity) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (!hasObjectFor(project)) {
Project[] open = ProjectManager.getInstance().getOpenProjects();
for (Project each : open) {
if (each == project) {
initBusyObjectFor(project);
break;
}
}
}
_getBusy(project).addActivity(activity);
}
}
_getBusy(project).addActivity(activity);
});
}
boolean hasObjectFor(Project project) {
return myObjects.containsKey(project);
public void removeActivity(@NotNull final Project project, final Object activity) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
_getBusy(project).removeActivity(activity);
}
});
}
public void removeActivity(@NotNull Project project, Object activity) {
_getBusy(project).removeActivity(activity);
public void addActivity(final Object activity) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
_getBusy(null).addActivity(activity);
}
});
}
public void addActivity(Object activity) {
_getBusy(null).addActivity(activity);
}
public void removeActivity(Object activity) {
_getBusy(null).removeActivity(activity);
public void removeActivity(final Object activity) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
_getBusy(null).removeActivity(activity);
}
});
}
private BusyImpl _getBusy(@Nullable Object key) {
@@ -99,6 +117,10 @@ public class UiActivityMonitor implements ApplicationComponent {
myObjects.put(key, object);
}
boolean hasObjectFor(Project project) {
return myObjects.containsKey(project);
}
private BusyObjectGlobalImpl getGlobalBusy() {
return (BusyObjectGlobalImpl)myObjects.get(null);
}
@@ -138,8 +160,16 @@ public class UiActivityMonitor implements ApplicationComponent {
}
public void removeActivity(Object activity) {
if (!myActivities.contains(activity)) return;
myActivities.remove(activity);
onReady();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
onReady();
}
});
}
}
@@ -87,4 +87,7 @@ public interface BalloonBuilder {
@NotNull
BalloonBuilder setShadow(boolean shadow);
@NotNull
BalloonBuilder setSmallVariant(boolean smallVariant);
}
@@ -163,7 +163,8 @@ class TableToolbarDecorator extends ToolbarDecorator {
protected void installDnD() {
if (myUpAction != null && myUpActionEnabled
&& myDownAction != null && myDownActionEnabled
&& !ApplicationManager.getApplication().isHeadlessEnvironment()) {
&& !ApplicationManager.getApplication().isHeadlessEnvironment()
&& myTableModel instanceof EditableModel) {
TableRowsDnDSupport.install(myTable, (EditableModel)myTableModel);
}
}
@@ -38,7 +38,6 @@ import java.util.List;
*/
@SuppressWarnings("UnusedDeclaration")
public abstract class ToolbarDecorator implements DataProvider, AddRemoveUpDownPanel.ListenerFactory {
private ListModel myListModel;
protected Border myToolbarBorder;
protected boolean myAddActionEnabled;
protected boolean myRemoveActionEnabled;
@@ -57,7 +56,6 @@ public abstract class ToolbarDecorator implements DataProvider, AddRemoveUpDownP
private String myMoveDownName;
private Dimension myPreferredSize;
private AddRemoveUpDownPanel myPanel;
private JList myList;
public ToolbarDecorator() {
}
@@ -80,7 +78,6 @@ public abstract class ToolbarDecorator implements DataProvider, AddRemoveUpDownP
}
};
protected ToolbarDecorator initPositionAndBorder() {
myToolbarPosition = SystemInfo.isMac ? ActionToolbarPosition.BOTTOM : ActionToolbarPosition.RIGHT;
myBorder = SystemInfo.isMac ? new CustomLineBorder(0,1,1,1) : new CustomLineBorder(0, 1, 0, 0);
@@ -2121,8 +2121,15 @@ public class JBTabsImpl extends JComponent
private void addHeaderSize(Dimension size, final int tabsCount) {
Dimension header = computeHeaderPreferredSize(tabsCount);
size.height += header.height;
size.width += header.width;
final boolean horizontal = getTabsPosition() == JBTabsPosition.top || getTabsPosition() == JBTabsPosition.bottom;
if (horizontal) {
size.height += header.height;
size.width = Math.max(size.width, header.width);
}
else {
size.height += Math.max(size.height, header.height);
size.width += header.width;
}
final Insets insets = getLayoutInsets();
size.width += insets.left + insets.right + 1;
@@ -38,6 +38,7 @@ import java.util.StringTokenizer;
public class UnixProcessManager {
public static final int SIGINT = 2;
public static final int SIGKILL = 9;
public static final int SIGCONT = 19;
private static CLib C_LIB;
@@ -318,7 +318,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
public void attributesChanged(@NotNull RangeHighlighterEx highlighter) {
int textLength = myDocument.getTextLength();
int start = Math.max(0, Math.min(textLength - 1, highlighter.getAffectedAreaStartOffset()));
int end = Math.max(0, Math.min(start, highlighter.getAffectedAreaEndOffset()));
int end = Math.max(0, Math.min(textLength - 1, highlighter.getAffectedAreaEndOffset()));
int startLine = myDocument.getLineNumber(start);
int endLine = myDocument.getLineNumber(end);
@@ -15,17 +15,20 @@
*/
package com.intellij.openapi.ui.playback;
import com.intellij.ide.RecentProjectsManagerBase;
import com.intellij.ide.UiActivityMonitor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ProjectManagerAdapter;
import com.intellij.openapi.project.ProjectManagerListener;
import com.intellij.openapi.project.*;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.AsyncResult;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.openapi.wm.IdeFrame;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;
@@ -44,9 +47,9 @@ public class PlaybackCallFacade {
public static AsyncResult<String> openProjectClone(final PlaybackContext context, String path) {
try {
File parentDir = FileUtil.createTempDirectory("funcTest", "");
File sourceDir = getFile(path);
File sourceDir = getFile(context.getCurrentCmd().getBaseDir(), path);
FileUtil.copyDir(sourceDir, parentDir);
FileUtil.copyDir(sourceDir, parentDir);
File projectDir = new File(parentDir, sourceDir.getName());
return openProject(context, projectDir.getAbsolutePath());
}
@@ -55,12 +58,8 @@ public class PlaybackCallFacade {
}
}
public static File getFile(String path) {
File sourceDir = new File(path);
if (!sourceDir.isAbsolute()) {
sourceDir = new File(System.getProperty("work.dir"), path);
}
return sourceDir;
public static AsyncResult<String> openLastProject(final PlaybackContext context) {
return openProject(context, RecentProjectsManagerBase.getInstance().getLastProjectPath());
}
public static AsyncResult<String> openProject(final PlaybackContext context, String path) {
@@ -74,7 +73,12 @@ public class PlaybackCallFacade {
@Override
public void run() {
pm.removeProjectManagerListener(listener.get());
result.setDone("opened successfully: " + project.getProjectFilePath());
DumbService.getInstance(project).runWhenSmart(new Runnable() {
@Override
public void run() {
result.setDone("opened successfully: " + project.getProjectFilePath());
}
});
}
});
}
@@ -92,10 +96,16 @@ public class PlaybackCallFacade {
return result;
}
public static AsyncResult<String> flushUiActivity(PlaybackContext context) {
AsyncResult<String> result = new AsyncResult<String>();
getActivityReady(context).notify(result);
return result;
}
public static AsyncResult<String> printFocus(final PlaybackContext context) {
final AsyncResult result = new AsyncResult<String>();
UiActivityMonitor.getInstance().getBusy().getReady(context).doWhenProcessed(new Runnable() {
getActivityReady(context).doWhenProcessed(new Runnable() {
@Override
public void run() {
final LinkedHashMap<String, String> focusInfo = getFocusInfo();
@@ -136,7 +146,7 @@ public class PlaybackCallFacade {
}
}
UiActivityMonitor.getInstance().getBusy().getReady(context).doWhenDone(new Runnable() {
getActivityReady(context).doWhenDone(new Runnable() {
@Override
public void run() {
try {
@@ -151,6 +161,10 @@ public class PlaybackCallFacade {
return result;
}
private static ActionCallback getActivityReady(PlaybackContext context) {
return UiActivityMonitor.getInstance().getBusy().getReady(context);
}
private static void doAssert(Map<String, String> expected, AsyncResult<String> result, PlaybackContext context) throws AssertionError {
final LinkedHashMap<String, String> actual = getFocusInfo();
@@ -211,4 +225,13 @@ public class PlaybackCallFacade {
}
return actual;
}
public static File getFile(File baseDir, String path) {
File sourceDir = new File(path);
if (!sourceDir.isAbsolute()) {
sourceDir = new File(baseDir, path);
}
return sourceDir;
}
}
@@ -18,8 +18,11 @@ package com.intellij.openapi.ui.playback;
import com.intellij.openapi.util.ActionCallback;
import java.awt.*;
import java.io.File;
public interface PlaybackCommand {
ActionCallback execute(PlaybackContext context);
boolean canGoFurther();
File getBaseDir();
}
@@ -16,6 +16,7 @@
package com.intellij.openapi.ui.playback;
import java.awt.*;
import java.io.File;
/**
* Created by IntelliJ IDEA.
@@ -30,12 +31,14 @@ public class PlaybackContext {
private int myCurrentLine;
private Robot myRobot;
private boolean myUseDirectActionCall;
private PlaybackCommand myCurrentCmd;
public PlaybackContext(PlaybackRunner.StatusCallback callback, int currentLine, Robot robot, boolean useDriectActionCall) {
public PlaybackContext(PlaybackRunner.StatusCallback callback, int currentLine, Robot robot, boolean useDriectActionCall, PlaybackCommand currentCmd) {
myCallback = callback;
myCurrentLine = currentLine;
myRobot = robot;
myUseDirectActionCall = useDriectActionCall;
myCurrentCmd = currentCmd;
}
public PlaybackRunner.StatusCallback getCallback() {
@@ -53,4 +56,8 @@ public class PlaybackContext {
public boolean isUseDirectActionCall() {
return myUseDirectActionCall;
}
public PlaybackCommand getCurrentCmd() {
return myCurrentCmd;
}
}
@@ -43,6 +43,7 @@ public class PlaybackRunner {
private ActionCallback myActionCallback;
private boolean myStopRequested;
private final boolean myUseDirectActionCall;
private File myBaseDir;
public PlaybackRunner(String script, StatusCallback callback, final boolean useDirectActionCall) {
myScript = script;
@@ -91,7 +92,7 @@ public class PlaybackRunner {
myActionCallback.setRejected();
return;
}
final ActionCallback cmdCallback = cmd.execute(new PlaybackContext(myCallback, cmdIndex, myRobot, myUseDirectActionCall));
final ActionCallback cmdCallback = cmd.execute(new PlaybackContext(myCallback, cmdIndex, myRobot, myUseDirectActionCall, cmd));
cmdCallback.doWhenDone(new Runnable() {
public void run() {
if (cmd.canGoFurther()) {
@@ -123,9 +124,11 @@ public class PlaybackRunner {
while (tokens.hasMoreTokens()) {
final String eachLine = tokens.nextToken();
String cdCmd = AbstractCommand.CMD_PREFIX + "cd";
String includeCmd = AbstractCommand.CMD_PREFIX + "include";
if (eachLine.startsWith(includeCmd)) {
File file = PlaybackCallFacade.getFile(eachLine.substring(includeCmd.length()).trim());
File file = PlaybackCallFacade.getFile(getBaseDir(), eachLine.substring(includeCmd.length()).trim());
if (!file.exists()) {
commandList.add(new ErrorCommand("Cannot find file to include: " + file.getAbsolutePath(), line));
return;
@@ -139,6 +142,27 @@ public class PlaybackRunner {
commandList.add(new ErrorCommand("Error reading file: " + file.getAbsolutePath(), line));
return;
}
} else if (eachLine.startsWith(cdCmd)) {
File dir = new File(eachLine.substring(cdCmd.length()).trim());
if (!dir.exists()) {
commandList.add(new ErrorCommand("Cannot cd to: " + dir.getPath(), line));
return;
}
if (dir.isAbsolute()) {
myBaseDir = dir;
commandList.add(new PrintCommand("Base dir set to: " + myBaseDir.getAbsolutePath(), line++));
} else {
dir = new File(getBaseDir(), dir.getPath());
if (!dir.exists()) {
commandList.add(new ErrorCommand("Cannot cd to: " + dir.getAbsolutePath(), line));
return;
} else {
myBaseDir = dir;
commandList.add(new PrintCommand("Base dir set to: " + myBaseDir.getAbsolutePath(), line++));
}
}
} else {
final PlaybackCommand cmd = createCommand(eachLine, line++);
commandList.add(cmd);
@@ -147,41 +171,32 @@ public class PlaybackRunner {
}
private PlaybackCommand createCommand(String string, int line) {
AbstractCommand cmd;
String actualString = string.toLowerCase();
if (actualString.startsWith(AbstractCommand.CMD_PREFIX + AbstractCommand.CMD_PREFIX)) {
return new EmptyCommand(line);
}
if (actualString.startsWith(KeyCodeTypeCommand.PREFIX)) {
return new KeyCodeTypeCommand(string, line);
}
if (actualString.startsWith(DelayCommand.PREFIX)) {
return new DelayCommand(string, line);
}
if (actualString.startsWith(KeyShortcutCommand.PREFIX)) {
return new KeyShortcutCommand(string, line);
}
if (actualString.startsWith(ActionCommand.PREFIX)) {
cmd = new EmptyCommand(line);
} else if (actualString.startsWith(KeyCodeTypeCommand.PREFIX)) {
cmd = new KeyCodeTypeCommand(string, line);
} else if (actualString.startsWith(DelayCommand.PREFIX)) {
cmd = new DelayCommand(string, line);
} else if (actualString.startsWith(KeyShortcutCommand.PREFIX)) {
cmd = new KeyShortcutCommand(string, line);
} else if (actualString.startsWith(ActionCommand.PREFIX)) {
return new ActionCommand(string, line);
}
if (actualString.startsWith(StopCommand.PREFIX)) {
} else if (actualString.startsWith(StopCommand.PREFIX)) {
return new StopCommand(string, line);
}
if (actualString.startsWith(AssertFocused.PREFIX)) {
} else if (actualString.startsWith(AssertFocused.PREFIX)) {
return new AssertFocused(string, line);
}
if (actualString.startsWith(CallCommand.PREFIX)) {
} else if (actualString.startsWith(CallCommand.PREFIX)) {
return new CallCommand(string, line);
} else {
cmd = new AlphaNumericTypeCommand(string, line);
}
return new AlphaNumericTypeCommand(string, line);
cmd.setBaseDir(getBaseDir());
return cmd;
}
private void setDone() {
@@ -192,6 +207,10 @@ public class PlaybackRunner {
myStopRequested = true;
}
public File getBaseDir() {
return myBaseDir != null ? myBaseDir : new File(System.getProperty("user.dir"));
}
public interface StatusCallback {
void error(String text, int currentLine);
@@ -21,6 +21,8 @@ import com.intellij.openapi.ui.playback.PlaybackContext;
import com.intellij.openapi.ui.playback.PlaybackRunner;
import com.intellij.openapi.util.ActionCallback;
import java.io.File;
public abstract class AbstractCommand implements PlaybackCommand {
public static String CMD_PREFIX = "%";
@@ -28,6 +30,8 @@ public abstract class AbstractCommand implements PlaybackCommand {
private final String myText;
private final int myLine;
private File myBaseDir;
public AbstractCommand(String text, int line) {
myText = text != null ? text : null;
myLine = line;
@@ -81,4 +85,15 @@ public abstract class AbstractCommand implements PlaybackCommand {
public void dumpError(final PlaybackRunner.StatusCallback cb, final String text) {
cb.error(text, getLine());
}
@Override
public File getBaseDir() {
return myBaseDir;
}
public PlaybackCommand setBaseDir(File baseDir) {
myBaseDir = baseDir;
return this;
}
}
@@ -74,7 +74,7 @@ public class CallCommand extends AbstractCommand {
}
Object[] actualArgs = noArgs ? new Object[1] : new Object[args.length + 1];
actualArgs[0] = new PlaybackContext(context.getCallback(), getLine(), context.getRobot(), context.isUseDirectActionCall());
actualArgs[0] = context;
for (int i = 1; i < actualArgs.length; i++) {
actualArgs[i] = args[i - 1];
}
@@ -1,9 +0,0 @@
package com.intellij.openapi.vfs.impl.local;
public aspect VfsLocalImplUse {
pointcut everyUseOfImpl() : call(* com.intellij.openapi.vfs.impl.local..*.*(..)) || call (com.intellij.openapi.vfs.impl.local..*.new(..));
pointcut outsideImpl() : !within(com.intellij.openapi.vfs.impl.local..*);
declare warning : everyUseOfImpl() && outsideImpl(): "Classes from openapi.vfs.impl.local should only be used in openapi.vfs.impl.local";
}
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.wm.impl;
import com.intellij.ide.UiActivityMonitor;
import com.intellij.ide.impl.ContentManagerWatcher;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.application.ApplicationManager;
@@ -119,15 +120,25 @@ public final class ToolWindowImpl implements ToolWindowEx {
public void activate(@Nullable final Runnable runnable, boolean autoFocusContents, boolean forced) {
ApplicationManager.getApplication().assertIsDispatchThread();
final String activity = "toolWindow:" + getId();
UiActivityMonitor.getInstance().addActivity(myToolWindowManager.getProject(), activity);
myToolWindowManager.activateToolWindow(myId, forced, autoFocusContents);
if (runnable != null) {
getActivation().doWhenDone(new Runnable() {
public void run() {
myToolWindowManager.invokeLater(runnable);
}
});
}
getActivation().doWhenDone(new Runnable() {
public void run() {
myToolWindowManager.invokeLater(new Runnable() {
@Override
public void run() {
if (runnable != null) {
runnable.run();
}
UiActivityMonitor.getInstance().removeActivity(myToolWindowManager.getProject(), activity);
}
});
}
});
}
public final boolean isActive() {
@@ -551,7 +551,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
}
private void activateEditorComponent(final boolean forced) {
activateEditorComponent(forced, true); //TODO[kirillk]: runnable in activateEditorComponent(boolean, boolean) never runs
activateEditorComponent(forced, false); //TODO[kirillk]: runnable in activateEditorComponent(boolean, boolean) never runs
}
private void activateEditorComponent(final boolean forced, boolean now) {
if (LOG.isDebugEnabled()) {
@@ -148,7 +148,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi
private boolean myAnimationEnabled = true;
private boolean myShadow = false;
public boolean isInsideBalloon(MouseEvent me) {
public boolean isInsideBalloon(MouseEvent me) {
return isInside(new RelativePoint(me));
}
@@ -202,7 +202,8 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi
boolean dialogMode,
String title,
Insets contentInsets,
boolean shadow) {
boolean shadow,
boolean smallVariant) {
myBorderColor = borderColor;
myFillColor = fillColor;
myContent = content;
@@ -248,7 +249,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi
myFadeoutTime = fadeoutTime;
myAnimationCycle = animationCycle;
if (myDialogMode) {
if (smallVariant) {
new AwtVisitor(myContent) {
@Override
public boolean visit(Component component) {
@@ -1455,7 +1456,7 @@ public class BalloonImpl implements Disposable, Balloon, LightweightWindow, Posi
//pane.setBorder(new LineBorder(Color.blue));
balloon.set(new BalloonImpl(new JLabel("FUCK"), Color.black, MessageType.ERROR.getPopupBackground(), true, true, true, true, true, 0, true, null, false, 500, 5, 0, 0, false, "This is the title",
new Insets(2, 2, 2, 2), true));
new Insets(2, 2, 2, 2), true, false));
balloon.get().setShowPointer(true);
if (e.isShiftDown()) {
@@ -307,9 +307,17 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
}
public void hide() {
hide(false);
}
public void hide(boolean ok) {
if (isVisible()) {
if (myIsRealPopup) {
myPopup.cancel();
if (ok) {
myPopup.closeOk(null);
} else {
myPopup.cancel();
}
myPopup = null;
}
else {
@@ -52,6 +52,7 @@ public class BalloonPopupBuilderImpl implements BalloonBuilder {
private String myTitle;
private Insets myContentInsets = new Insets(2, 2, 2, 2);
private boolean myShadow = false;
private boolean mySmallVariant = false;
public BalloonPopupBuilderImpl(@NotNull final JComponent content) {
myContent = content;
@@ -148,7 +149,7 @@ public class BalloonPopupBuilderImpl implements BalloonBuilder {
@NotNull
public Balloon createBalloon() {
return new BalloonImpl(myContent, myBorder, myFill, myHideOnMouseOutside, myHideOnKeyOutside, myHideOnAction, myShowCalllout, myCloseButtonEnabled, myFadeoutTime, myHideOnFrameResize, myClickHandler, myCloseOnClick, myAnimationCycle,
myCalloutShift, myPositionChangeXShift, myPositionChangeYShift, myDialogMode, myTitle, myContentInsets, myShadow);
myCalloutShift, myPositionChangeXShift, myPositionChangeYShift, myDialogMode, myTitle, myContentInsets, myShadow, mySmallVariant);
}
@NotNull
@@ -191,4 +192,11 @@ public class BalloonPopupBuilderImpl implements BalloonBuilder {
myShadow = shadow;
return this;
}
@NotNull
@Override
public BalloonBuilder setSmallVariant(boolean smallVariant) {
mySmallVariant = smallVariant;
return this;
}
}
@@ -23,6 +23,8 @@ action.ShowPopupMenu.text=Show Context Menu
action.CloseWindow.text=Close Active Window
action.Vcs.ShowMessageHistory.text=Message History
action.Vcs.ShowMessageHistory.description=Show commit message history
action.Vcs.CheckCommitMessageSpelling.text=Check commit message spelling
action.Vcs.CheckCommitMessageSpelling.description=Toggle checking commit message spelling errors
action.Vcs.ShowHistoryForBlock.text=Show History _for Selection
action.Vcs.ShowHistoryForBlock.description=Show history for editor selection
action.Vcs.ShowTabbedFileHistory.text=Show _History
@@ -35,7 +35,6 @@ border.standard.after.checkin.options.group=After {0}
checkbox.checkin.options.check.files.up.to.date=Check remote status
checkbox.checkin.options.optimize.imports=&Optimize imports
checkbox.checkin.options.reformat.code=&Reformat code
checkbox.check.commit.message.spelling=Check commit message spelling
progress.text.searching.for.modified.files=Searching for modified files
button.text.overwrite.modified.file=&Overwrite Modified File
button.text.overwrite.modified.files=&Overwrite Modified Files
@@ -192,6 +192,9 @@
</group>
<group id="Vcs.MessageActionGroup">
<action id="Vcs.CheckCommitMessageSpelling"
class="com.intellij.openapi.vcs.actions.CheckCommitMessageSpellingAction"
icon="/vcs/checkSpelling.png"/>
<action id="Vcs.ShowMessageHistory"
class="com.intellij.openapi.vcs.actions.ShowMessageHistoryAction"
icon="/vcs/messageHistory.png"/>
@@ -220,6 +220,9 @@ public class SMTestRunnerConnectionUtil {
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(final ProcessEvent event) {
outputConsumer.flushBufferBeforeTerminating();
eventsProcessor.onFinishTesting();
Disposer.dispose(eventsProcessor);
Disposer.dispose(outputConsumer);
}
@@ -229,12 +232,6 @@ public class SMTestRunnerConnectionUtil {
eventsProcessor.onStartTesting();
}
@Override
public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
outputConsumer.flushBufferBeforeTerminating();
eventsProcessor.onFinishTesting();
}
@Override
public void onTextAvailable(final ProcessEvent event, final Key outputType) {
outputConsumer.process(event.getText(), outputType);
@@ -31,8 +31,6 @@ public class SMTRunnerEventsAdapter implements SMTRunnerEventsListener {
public void onTestFailed(@NotNull final SMTestProxy test) {}
public void onTestIgnored(@NotNull final SMTestProxy test) {}
public void onFinish() {}
public void onSuiteStarted(@NotNull final SMTestProxy suite) {}
public void onSuiteFinished(@NotNull final SMTestProxy suite) {}
@@ -44,8 +44,6 @@ public interface SMTRunnerEventsListener {
void onTestFailed(@NotNull SMTestProxy test);
void onTestIgnored(@NotNull SMTestProxy test);
void onFinish();
void onSuiteFinished(@NotNull SMTestProxy suite);
void onSuiteStarted(@NotNull SMTestProxy suite);
@@ -17,9 +17,6 @@ package com.intellij.execution.testframework.sm.runner.ui;
import com.intellij.execution.configurations.ConfigurationPerRunnerSettings;
import com.intellij.execution.configurations.RunnerSettings;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.process.ProcessListener;
import com.intellij.execution.testframework.TestConsoleProperties;
import com.intellij.execution.testframework.TestFrameworkRunningModel;
import com.intellij.execution.testframework.sm.SMRunnerUtil;
@@ -27,7 +24,6 @@ import com.intellij.execution.testframework.sm.runner.SMTestProxy;
import com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView;
import com.intellij.execution.testframework.ui.TestResultsPanel;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -110,26 +106,4 @@ public class SMTRunnerConsoleView extends BaseTestsOutputConsoleView {
public SMTestRunnerResultsForm getResultsViewer() {
return myResultsViewer;
}
public void attachToProcess(final ProcessHandler processHandler) {
super.attachToProcess(processHandler);
if (processHandler == null) {
return;
}
processHandler.addProcessListener(new ProcessListener() {
@Override
public void startNotified(ProcessEvent event) {}
@Override
public void processTerminated(ProcessEvent event) {
myResultsViewer.onFinish();
}
@Override
public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {}
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {}
});
}
}
@@ -236,6 +236,11 @@ public class SMTestRunnerResultsForm extends TestResultsPanel implements TestFra
LvcsHelper.addLabel(this);
fireOnTestingFinished();
SMTestProxy root = getTestsRootNode();
if (root != null) {
selectAndNotify(root);
}
}
public void onTestsCountInSuite(final int count) {
@@ -264,14 +269,6 @@ public class SMTestRunnerResultsForm extends TestResultsPanel implements TestFra
//Do nothing
}
@Override
public void onFinish() {
SMTestProxy root = getTestsRootNode();
if (root != null) {
selectAndNotify(root);
}
}
/**
* Adds suite to tree
* Suite proxy should be initialized, proxy parent must be some suite (already added to tree)
@@ -0,0 +1,121 @@
/*
* Copyright 2000-2009 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.
*/
/*
* @author max
*/
package com.intellij.util.containers;
import com.google.common.collect.MapEvictionListener;
import com.google.common.collect.MapMaker;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
public class ConcurrentSLRUMap<K,V> {
protected final Map<K,V> myProtectedQueue;
protected final Map<K,V> myProbationalQueue;
private final AtomicInteger probationalHits = new AtomicInteger();
private final AtomicInteger protectedHits = new AtomicInteger();
private final AtomicInteger misses = new AtomicInteger();
public ConcurrentSLRUMap(final int protectedQueueSize, final int probationalQueueSize) {
myProtectedQueue = new MapMaker().concurrencyLevel(4).evictionListener(new MapEvictionListener<K, V>() {
@Override
public void onEviction(K key, V value) {
myProbationalQueue.put(key, value); // no size check since it is costly
}
}).initialCapacity(10).maximumSize(protectedQueueSize).makeMap();
myProbationalQueue = new MapMaker().concurrencyLevel(4).evictionListener(new MapEvictionListener<K, V>() {
@Override
public void onEviction(K key, V value) {
onDropFromCache(key, value); // no size check since it is costly
}
}).initialCapacity(10).maximumSize(probationalQueueSize).makeMap();
}
@Nullable
public V get(K key) {
V value = myProtectedQueue.get(key);
if (value != null) {
protectedHits.incrementAndGet();
return value;
}
value = myProbationalQueue.remove(key);
if (value != null) {
probationalHits.incrementAndGet();
myProtectedQueue.put(key, value);
return value;
}
misses.incrementAndGet();
return null;
}
public void put(K key, V value) {
V oldValue = myProtectedQueue.remove(key);
if (oldValue != null) {
onDropFromCache(key, oldValue);
}
oldValue = myProbationalQueue.put(key, value);
if (oldValue != null) {
onDropFromCache(key, oldValue);
}
}
protected void onDropFromCache(K key, V value) {}
public boolean remove(K key) {
V value = myProtectedQueue.remove(key);
if (value != null) {
onDropFromCache(key, value);
return true;
}
value = myProbationalQueue.remove(key);
if (value != null) {
onDropFromCache(key, value);
return true;
}
return false;
}
public Set<Map.Entry<K, V>> entrySet() {
Set<Map.Entry<K, V>> set = new HashSet<Map.Entry<K,V>>(myProtectedQueue.entrySet());
set.addAll(myProbationalQueue.entrySet());
return set;
}
public void clear() {
for (Map.Entry<K, V> entry : myProtectedQueue.entrySet()) {
onDropFromCache(entry.getKey(), entry.getValue());
}
myProtectedQueue.clear();
for (Map.Entry<K, V> entry : myProbationalQueue.entrySet()) {
onDropFromCache(entry.getKey(), entry.getValue());
}
myProbationalQueue.clear();
}
}
@@ -66,7 +66,7 @@ public class PersistentBTreeEnumerator<Data> extends PersistentEnumeratorBase<Da
public PersistentBTreeEnumerator(File file, KeyDescriptor<Data> dataDescriptor, int initialSize) throws IOException {
super(file, new MappedFileSimpleStorage(file, initialSize, 1024 * 1024), dataDescriptor, initialSize,
ourVersion, new RecordBufferHandler());
ourVersion, new RecordBufferHandler(), false);
myInlineKeysNoMapping = myDataDescriptor instanceof InlineKeyDescriptor && !wantKeyMapping();
myExternalKeysNoMapping = !(myDataDescriptor instanceof InlineKeyDescriptor) && !wantKeyMapping();
@@ -50,7 +50,7 @@ public class PersistentEnumerator<Data> extends PersistentEnumeratorBase<Data> {
public PersistentEnumerator(File file, KeyDescriptor<Data> dataDescriptor, int initialSize) throws IOException {
super(file, new MappedFileSimpleStorage(file, initialSize), dataDescriptor, initialSize, ourVersion,
new RecordBufferHandler());
new RecordBufferHandler(), true);
}
protected void setupEmptyFile() throws IOException {
@@ -60,6 +60,7 @@ abstract class PersistentEnumeratorBase<Data> implements Forceable, Closeable {
private RecordBufferHandler<PersistentEnumeratorBase> myRecordHandler;
private volatile boolean myDirtyStatusUpdateInProgress;
private Flushable myMarkCleanCallback;
private final boolean myDoCaching;
public static class Version {
private final int correctlyClosedMagic;
@@ -137,11 +138,13 @@ abstract class PersistentEnumeratorBase<Data> implements Forceable, Closeable {
}
public PersistentEnumeratorBase(File file, ISimpleStorage storage, KeyDescriptor<Data> dataDescriptor, int initialSize,
Version version, RecordBufferHandler<? extends PersistentEnumeratorBase> recordBufferHandler) throws IOException {
Version version, RecordBufferHandler<? extends PersistentEnumeratorBase> recordBufferHandler,
boolean doCaching) throws IOException {
myDataDescriptor = dataDescriptor;
myFile = file;
myVersion = version;
myRecordHandler = (RecordBufferHandler<PersistentEnumeratorBase>)recordBufferHandler;
myDoCaching = doCaching;
if (!file.exists()) {
FileUtil.delete(keystreamFile());
@@ -228,7 +231,7 @@ abstract class PersistentEnumeratorBase<Data> implements Forceable, Closeable {
}
private int doEnumerate(Data value, boolean onlyCheckForExisting, boolean saveNewValue) throws IOException {
if (!saveNewValue) {
if (myDoCaching && !saveNewValue) {
synchronized (ourEnumerationCache) {
final Integer cachedId = ourEnumerationCache.get(sharedKey(value, this));
if (cachedId != null) return cachedId.intValue();
@@ -249,7 +252,7 @@ abstract class PersistentEnumeratorBase<Data> implements Forceable, Closeable {
throw new RuntimeException(e);
}
if (id != NULL_ID) {
if (myDoCaching && id != NULL_ID) {
synchronized (ourEnumerationCache) {
ourEnumerationCache.put(new CacheKey(value, this), id);
}
@@ -15,14 +15,14 @@
*/
package com.intellij.util.io;
import com.intellij.util.containers.SLRUMap;
import com.intellij.util.containers.ConcurrentSLRUMap;
import java.io.File;
import java.io.IOException;
public class PersistentStringEnumerator extends PersistentEnumeratorDelegate<String>{
private final SLRUMap<Integer, String> myIdToStringCache;
private final SLRUMap<Integer, Integer> myHashcodeToIdCache;
private final ConcurrentSLRUMap<Integer, String> myIdToStringCache;
private final ConcurrentSLRUMap<Integer, Integer> myHashcodeToIdCache;
public PersistentStringEnumerator(final File file) throws IOException {
this(file, 1024 * 4);
@@ -39,8 +39,8 @@ public class PersistentStringEnumerator extends PersistentEnumeratorDelegate<Str
private PersistentStringEnumerator(final File file, final int initialSize, boolean cacheLastMappings) throws IOException {
super(file, new EnumeratorStringDescriptor(), initialSize);
if (cacheLastMappings) {
myIdToStringCache = new SLRUMap<Integer, String>(8192, 8192);
myHashcodeToIdCache = new SLRUMap<Integer, Integer>(8192, 8192);
myIdToStringCache = new ConcurrentSLRUMap<Integer, String>(8192, 8192);
myHashcodeToIdCache = new ConcurrentSLRUMap<Integer, Integer>(8192, 8192);
} else {
myIdToStringCache = null;
myHashcodeToIdCache = null;
@@ -49,16 +49,12 @@ public class PersistentStringEnumerator extends PersistentEnumeratorDelegate<Str
@Override
public int enumerate(String value) throws IOException {
int valueHashCode = -1;
if (myHashcodeToIdCache != null && value != null) {
Integer cachedId;
synchronized (myHashcodeToIdCache) {
cachedId = myHashcodeToIdCache.get(value.hashCode());
}
Integer cachedId = myHashcodeToIdCache.get(valueHashCode = value.hashCode());
if (cachedId != null) {
String s;
synchronized (myIdToStringCache) {
s = myIdToStringCache.get(cachedId.intValue());
}
String s = myIdToStringCache.get(cachedId.intValue());
if (s != null && value.equals(s)) return cachedId.intValue();
}
}
@@ -66,15 +62,11 @@ public class PersistentStringEnumerator extends PersistentEnumeratorDelegate<Str
int enumerate = super.enumerate(value);
if (myHashcodeToIdCache != null && value != null) {
synchronized (myHashcodeToIdCache) {
myHashcodeToIdCache.put(value.hashCode(), enumerate);
}
myHashcodeToIdCache.put(valueHashCode, enumerate);
}
if (myIdToStringCache != null) {
synchronized (myIdToStringCache) {
myIdToStringCache.put(enumerate, value);
}
myIdToStringCache.put(enumerate, value);
}
return enumerate;
}
@@ -82,10 +74,8 @@ public class PersistentStringEnumerator extends PersistentEnumeratorDelegate<Str
@Override
public String valueOf(int idx) throws IOException {
if (myIdToStringCache != null) {
synchronized (myIdToStringCache) {
String s = myIdToStringCache.get(idx);
if (s != null) return s;
}
String s = myIdToStringCache.get(idx);
if (s != null) return s;
}
return super.valueOf(idx);
}
@@ -95,15 +85,11 @@ public class PersistentStringEnumerator extends PersistentEnumeratorDelegate<Str
super.close();
if (myIdToStringCache != null) {
synchronized (myIdToStringCache) {
myIdToStringCache.clear();
}
myIdToStringCache.clear();
}
if (myHashcodeToIdCache != null) {
synchronized (myHashcodeToIdCache) {
myHashcodeToIdCache.clear();
}
myHashcodeToIdCache.clear();
}
}
}
@@ -101,4 +101,16 @@ public interface CheckinProjectPanel extends Refreshable {
String getCommitMessage();
String getCommitActionName();
/**
* @return <code>true</code> if commit message is checked for spelling errors; <code>false</code> otherwise
*/
boolean isCheckCommitMessageSpelling();
/**
* Allows to define whether commit message should be checked for spelling errors.
*
* @param checkSpelling <code>true</code> if commit message should be checked for spelling errors; <code>false</code> otherwise
*/
void setCheckCommitMessageSpelling(boolean checkSpelling);
}
@@ -0,0 +1,47 @@
package com.intellij.openapi.vcs.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ToggleAction;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.vcs.CheckinProjectPanel;
import com.intellij.openapi.vcs.ui.Refreshable;
import org.jetbrains.annotations.Nullable;
/**
* Allows to toggle <code>'check commit message spelling errors'</code> processing.
*
* @author Denis Zhdanov
* @since 8/22/11 3:27 PM
*/
public class CheckCommitMessageSpellingAction extends ToggleAction implements DumbAware {
public CheckCommitMessageSpellingAction() {
setEnabledInModalContext(true);
}
@Override
public boolean isSelected(AnActionEvent e) {
CheckinProjectPanel checkinPanel = getCheckinPanel(e);
return checkinPanel == null || checkinPanel.isCheckCommitMessageSpelling();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
CheckinProjectPanel checkinPanel = getCheckinPanel(e);
if (checkinPanel != null) {
checkinPanel.setCheckCommitMessageSpelling(state);
}
}
@Nullable
private static CheckinProjectPanel getCheckinPanel(@Nullable AnActionEvent e) {
if (e == null) {
return null;
}
Refreshable data = Refreshable.PANEL_KEY.getData(e.getDataContext());
if (data instanceof CheckinProjectPanel) {
return (CheckinProjectPanel)data;
}
return null;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -65,7 +65,6 @@ public class CommittedChangesPanel extends JPanel implements TypeSafeDataProvide
private final RepositoryLocation myLocation;
private int myMaxCount = 0;
private final MyFilterComponent myFilterComponent = new MyFilterComponent();
private final JLabel myErrorLabel = new JLabel();
private final List<Runnable> myShouldBeCalledOnDispose;
private volatile boolean myDisposed;
private volatile boolean myInLoad;
@@ -82,9 +81,6 @@ public class CommittedChangesPanel extends JPanel implements TypeSafeDataProvide
Disposer.register(this, myBrowser);
add(myBrowser, BorderLayout.CENTER);
myErrorLabel.setForeground(Color.red);
add(myErrorLabel, BorderLayout.SOUTH);
final VcsCommittedViewAuxiliary auxiliary = provider.createActions(myBrowser, location);
JPanel toolbarPanel = new JPanel();
@@ -272,10 +268,6 @@ public class CommittedChangesPanel extends JPanel implements TypeSafeDataProvide
myDisposed = true;
}
public void setErrorText(String text) {
myErrorLabel.setText(text);
}
private class MyFilterComponent extends FilterComponent implements ChangeListFilteringStrategy {
private final List<ChangeListener> myList;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -24,10 +24,12 @@ package com.intellij.openapi.vcs.changes.committed;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentProvider;
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.messages.MessageBus;
@@ -124,18 +126,9 @@ public class CommittedChangesViewManager implements ChangesViewContentProvider {
}
public void refreshErrorStatusChanged(@Nullable final VcsException lastError) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
if (myComponent != null && !myProject.isDisposed()) {
if (lastError != null) {
myComponent.setErrorText("Error refreshing changes: " + lastError.getMessage());
}
else {
myComponent.setErrorText("");
}
}
}
});
if (lastError != null) {
VcsBalloonProblemNotifier.showOverChangesView(myProject, lastError.getMessage(), MessageType.ERROR);
}
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -21,11 +21,13 @@ import com.intellij.openapi.actionSystem.ActionToolbar;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vcs.RepositoryLocation;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentProvider;
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.util.Consumer;
import com.intellij.util.messages.MessageBus;
@@ -45,7 +47,6 @@ public class IncomingChangesViewProvider implements ChangesViewContentProvider {
private final MessageBus myBus;
private CommittedChangesTreeBrowser myBrowser;
private MessageBusConnection myConnection;
private final JLabel myErrorLabel = new JLabel();
public IncomingChangesViewProvider(final Project project, final MessageBus bus) {
myProject = project;
@@ -65,8 +66,6 @@ public class IncomingChangesViewProvider implements ChangesViewContentProvider {
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(myBrowser, BorderLayout.CENTER);
contentPane.add(myErrorLabel, BorderLayout.SOUTH);
myErrorLabel.setForeground(Color.red);
return contentPane;
}
@@ -115,16 +114,9 @@ public class IncomingChangesViewProvider implements ChangesViewContentProvider {
}
public void refreshErrorStatusChanged(@Nullable final VcsException lastError) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
if (lastError != null) {
myErrorLabel.setText("Error refreshing changes: " + lastError.getMessage());
}
else {
myErrorLabel.setText("");
}
}
});
if (lastError != null) {
VcsBalloonProblemNotifier.showOverChangesView(myProject, lastError.getMessage(), MessageType.ERROR);
}
}
}
}
@@ -48,8 +48,6 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import java.util.*;
import java.util.List;
@@ -96,8 +94,6 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
private final PseudoMap<Object, Object> myAdditionalData;
private String myHelpId;
private final JCheckBox myCheckSpellingBox;
private static class MyUpdateButtonsRunnable implements Runnable {
private CommitChangeListDialog myDialog;
@@ -276,23 +272,6 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
}
}
myCheckSpellingBox = new JCheckBox(VcsBundle.message("checkbox.check.commit.message.spelling"));
myCheckSpellingBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
boolean checkSpelling = e.getStateChange() == ItemEvent.SELECTED;
if (configuration != null) {
configuration.CHECK_COMMIT_MESSAGE_SPELLING = checkSpelling;
}
myCommitMessageArea.setCheckSpelling(checkSpelling);
}
});
VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
if (configuration != null) {
myCheckSpellingBox.setSelected(configuration.CHECK_COMMIT_MESSAGE_SPELLING);
}
myActionName = VcsBundle.message("commit.dialog.title");
myAdditionalOptionsPanel = new JPanel();
@@ -629,6 +608,21 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
return name != null ? name : VcsBundle.message("commit.dialog.default.commit.operation.name");
}
@Override
public boolean isCheckCommitMessageSpelling() {
VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
return configuration == null || configuration.CHECK_COMMIT_MESSAGE_SPELLING;
}
@Override
public void setCheckCommitMessageSpelling(boolean checkSpelling) {
VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
if (configuration != null) {
configuration.CHECK_COMMIT_MESSAGE_SPELLING = checkSpelling;
}
myCommitMessageArea.setCheckSpelling(checkSpelling);
}
private boolean checkComment() {
if (VcsConfiguration.getInstance(myProject).FORCE_NON_EMPTY_COMMENT && (getCommitMessage().length() == 0)) {
int requestForCheckin = Messages.showYesNoDialog(VcsBundle.message("confirmation.text.check.in.with.empty.comment"),
@@ -824,10 +818,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
JPanel infoPanel = new JPanel(new BorderLayout());
myChangesInfoCalculator = new ChangeInfoCalculator();
myLegend = new CommitLegendPanel(myChangesInfoCalculator);
JPanel commonPanel = new JPanel(new BorderLayout());
commonPanel.add(myLegend.getComponent());
commonPanel.add(myCheckSpellingBox, BorderLayout.SOUTH);
infoPanel.add(commonPanel, BorderLayout.NORTH);
infoPanel.add(myLegend.getComponent(), BorderLayout.NORTH);
infoPanel.add(myAdditionalOptionsPanel, BorderLayout.CENTER);
rootPane.add(infoPanel, BorderLayout.EAST);
infoPanel.setBorder(IdeBorderFactory.createEmptyBorder(0, 10, 0, 0));
@@ -1,16 +0,0 @@
package com.intellij.cvsSupport2;
public aspect CvsSupportToUseOpenApiOnly {
/*
pointcut useOfIntellijApi() : call(* com.intellij..*.*(..)) || call (com.intellij..*.new(..));
pointcut useOfOpenApi() : call(* com.intellij.openapi.*.*.*(..)) || call (com.intellij.openapi..*.new(..));
pointcut useOfCvsSupportItself() : call(* com.intellij.cvsSupport2..*.*(..)) || call (com.intellij.cvsSupport2..*.new(..));
pointcut insideCvsSupport() : within(com.intellij.cvsSupport2..*);
declare warning : useOfIntellijApi() && !useOfOpenApi() && !useOfCvsSupportItself() && insideCvsSupport()
: "Cvs support plugin should use only OpenApi";
*/
}
@@ -25,6 +25,7 @@ import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.changes.CurrentContentRevision;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.openapi.vcs.impl.ContentRevisionCache;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.vcsUtil.VcsFileUtil;
import com.intellij.vcsUtil.VcsUtil;
@@ -154,15 +155,32 @@ public class GitContentRevision implements ContentRevision {
} else {
file = createPath(vcsRoot, path, isDeleted, canBeDeleted, unescapePath);
}
return createRevision(file, revisionNumber, project);
}
private static ContentRevision createRevision(@NotNull FilePath filePath, @Nullable VcsRevisionNumber revisionNumber, @NotNull Project project) {
if (revisionNumber != null && revisionNumber != VcsRevisionNumber.NULL) {
return createRevisionImpl(file, (GitRevisionNumber)revisionNumber, project, null);
return createRevisionImpl(filePath, (GitRevisionNumber)revisionNumber, project, null);
}
else {
return CurrentContentRevision.create(file);
return CurrentContentRevision.create(filePath);
}
}
public static ContentRevision createRevisionForTypeChange(@NotNull Project project, @NotNull VirtualFile vcsRoot,
@NotNull String path,
@Nullable VcsRevisionNumber revisionNumber, boolean unescapePath) throws VcsException {
final FilePath filePath;
if (revisionNumber == null) {
File file = new File(makeAbsolutePath(vcsRoot, path, unescapePath));
VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
filePath = virtualFile == null ? new FilePathImpl(file, false) : new FilePathImpl(virtualFile);
} else {
filePath = createPath(vcsRoot, path, false, false, unescapePath);
}
return createRevision(filePath, revisionNumber, project);
}
public static FilePath createPath(VirtualFile vcsRoot, String path, boolean isDeleted, boolean canBeDeleted, boolean unescapePath) throws VcsException {
final String absolutePath = makeAbsolutePath(vcsRoot, path, unescapePath);
FilePath file = isDeleted ? VcsUtil.getFilePathForDeletedFile(absolutePath, false) : VcsUtil.getFilePath(absolutePath, false);
@@ -171,7 +171,7 @@ public class GitChangeUtils {
s.nextLine();
continue;
}
if ("CADUMR".indexOf(s.peek()) == -1) {
if ("CADUMRT".indexOf(s.peek()) == -1) {
// exit if there is no next character
return;
}
@@ -205,6 +205,11 @@ public class GitChangeUtils {
before = GitContentRevision.createRevision(vcsRoot, tokens[1], parentRevision, project, true, true, true);
after = GitContentRevision.createRevision(vcsRoot, path, thisRevision, project, false, false, true);
break;
case 'T':
status = FileStatus.MODIFIED;
before = GitContentRevision.createRevision(vcsRoot, path, parentRevision, project, true, true, true);
after = GitContentRevision.createRevisionForTypeChange(project, vcsRoot, path, thisRevision, true);
break;
default:
throw new VcsException("Unknown file status: " + Arrays.asList(tokens));
}
@@ -232,6 +232,12 @@ class GitLogRecord {
after = GitContentRevision.createMultipleParentsRevision(project, filePathAfterRename, parentRevisions);
before = GitContentRevision.createRevision(vcsRoot, path, thisRevision, project, true, true, true);
break;
case 'T':
status = FileStatus.MODIFIED;
final FilePath filePath2 = GitContentRevision.createPath(vcsRoot, path, false, true, true);
before = GitContentRevision.createMultipleParentsRevision(project, filePath2, parentRevisions);
after = GitContentRevision.createRevision(vcsRoot, path, thisRevision, project, false, false, true);
break;
default:
throw new VcsException("Unknown file status: " + Arrays.asList(parts));
}
@@ -165,17 +165,19 @@ class GitNewChangesCollector extends GitChangesCollector {
reportModified(filepath, head);
} else if (yStatus == 'D') {
reportDeleted(filepath, head);
} else if (yStatus == 'T') {
reportTypeChanged(filepath, head);
} else {
throwYStatus(output, handler, line, xStatus, yStatus);
}
break;
case 'M':
if (yStatus == ' ' || yStatus == 'M') {
if (yStatus == ' ' || yStatus == 'M' || yStatus == 'T') {
reportModified(filepath, head);
} else if (yStatus == 'D') {
reportDeleted(filepath, head);
} else {
} else {
throwYStatus(output, handler, line, xStatus, yStatus);
}
break;
@@ -185,7 +187,7 @@ class GitNewChangesCollector extends GitChangesCollector {
// NB: no "break" here!
// we treat "Copy" as "Added", but we still have to read the old path not to break the format parsing.
case 'A':
if (yStatus == 'M' || yStatus == ' ') {
if (yStatus == 'M' || yStatus == ' ' || yStatus == 'T') {
reportAdded(filepath);
} else if (yStatus == 'D') {
// added + deleted => no change (from IDEA point of view).
@@ -197,7 +199,7 @@ class GitNewChangesCollector extends GitChangesCollector {
break;
case 'D':
if (yStatus == 'M' || yStatus == ' ') {
if (yStatus == 'M' || yStatus == ' ' || yStatus == 'T') {
reportDeleted(filepath, head);
} else if (yStatus == 'U') { // DU - unmerged, deleted by us
reportConflict(head, filepath);
@@ -211,7 +213,7 @@ class GitNewChangesCollector extends GitChangesCollector {
break;
case 'U':
if (yStatus == 'U' || yStatus == 'A' || yStatus == 'D') {
if (yStatus == 'U' || yStatus == 'A' || yStatus == 'D' || yStatus == 'T') {
// UU - unmerged, both modified; UD - unmerged, deleted by them; UA - umerged, added by them
reportConflict(head, filepath);
} else {
@@ -225,13 +227,23 @@ class GitNewChangesCollector extends GitChangesCollector {
if (yStatus == 'D') {
reportDeleted(filepath, head);
} else if (yStatus == ' ' || yStatus == 'M') {
} else if (yStatus == ' ' || yStatus == 'M' || yStatus == 'T') {
reportRename(head, filepath, oldFilename);
} else {
throwYStatus(output, handler, line, xStatus, yStatus);
}
break;
case 'T'://TODO
if (yStatus == ' ' || yStatus == 'M') {
reportTypeChanged(filepath, head);
} else if (yStatus == 'D') {
reportDeleted(filepath, head);
} else {
throwYStatus(output, handler, line, xStatus, yStatus);
}
break;
case '?':
throwGFE("Unexpected unversioned file flag.", handler, output, line, xStatus, yStatus);
break;
@@ -291,6 +303,12 @@ class GitNewChangesCollector extends GitChangesCollector {
reportChange(FileStatus.MODIFIED, before, after);
}
private void reportTypeChanged(String filepath, VcsRevisionNumber head) throws VcsException {
ContentRevision before = GitContentRevision.createRevision(myVcsRoot, filepath, head, myProject, false, true, false);
ContentRevision after = GitContentRevision.createRevisionForTypeChange(myProject, myVcsRoot, filepath, null, false);
reportChange(FileStatus.MODIFIED, before, after);
}
private void reportAdded(String filepath) throws VcsException {
ContentRevision before = null;
ContentRevision after = GitContentRevision.createRevision(myVcsRoot, filepath, null, myProject, false, false, false);
@@ -154,7 +154,7 @@ class GitOldChangesCollector extends GitChangesCollector {
return;
}
GitSimpleHandler handler = new GitSimpleHandler(myProject, myVcsRoot, GitCommand.DIFF);
handler.addParameters("--name-status", "--diff-filter=ADCMRUX", "-M", "HEAD");
handler.addParameters("--name-status", "--diff-filter=ADCMRUXT", "-M", "HEAD");
handler.setNoSSH(true);
handler.setSilent(true);
handler.setStdoutSuppressed(true);
@@ -163,7 +163,7 @@ class GitOldChangesCollector extends GitChangesCollector {
if (handler.isLargeCommandLine()) {
// if there are too much files, just get all changes for the project
handler = new GitSimpleHandler(myProject, myVcsRoot, GitCommand.DIFF);
handler.addParameters("--name-status", "--diff-filter=ADCMRUX", "-M", "HEAD");
handler.addParameters("--name-status", "--diff-filter=ADCMRUXT", "-M", "HEAD");
handler.setNoSSH(true);
handler.setSilent(true);
handler.setStdoutSuppressed(true);
@@ -178,4 +178,16 @@ public class GrLightField extends GrLightVariable implements GrField {
clearCaches();
return res;
}
@Override
public boolean isEquivalentTo(PsiElement another) {
if (super.isEquivalentTo(another)) return true;
if (another instanceof GrLightField) {
GrLightField otherField = (GrLightField)another;
return otherField.myContainingClass == myContainingClass && getName().equals(otherField.getName());
}
return false;
}
}