mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -17,7 +17,6 @@ package com.intellij.psi.impl.file.impl;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
@@ -43,8 +42,6 @@ import java.io.IOException;
|
||||
|
||||
@SkipSlowTestLocally
|
||||
public class PsiEventsTest extends PsiTestCase {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.file.impl.PsiEventsTest");
|
||||
|
||||
private VirtualFile myPrjDir1;
|
||||
private VirtualFile myPrjDir2;
|
||||
private VirtualFile mySrcDir1;
|
||||
@@ -338,12 +335,9 @@ public class PsiEventsTest extends PsiTestCase {
|
||||
final EventsTestListener listener = new EventsTestListener();
|
||||
myPsiManager.addPsiTreeChangeListener(listener,getTestRootDisposable());
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new ThrowableComputable<Object, IOException>() {
|
||||
@Override
|
||||
public Object compute() throws IOException {
|
||||
ReadOnlyAttributeUtil.setReadOnlyAttribute(file, true);
|
||||
return null;
|
||||
}
|
||||
ApplicationManager.getApplication().runWriteAction((ThrowableComputable<Object, IOException>)() -> {
|
||||
ReadOnlyAttributeUtil.setReadOnlyAttribute(file, true);
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
@@ -358,12 +352,9 @@ public class PsiEventsTest extends PsiTestCase {
|
||||
}
|
||||
}.assertCompleted(listener.getEventsString());
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new ThrowableComputable<Object, IOException>() {
|
||||
@Override
|
||||
public Object compute() throws IOException {
|
||||
ReadOnlyAttributeUtil.setReadOnlyAttribute(file, false);
|
||||
return null;
|
||||
}
|
||||
ApplicationManager.getApplication().runWriteAction((ThrowableComputable<Object, IOException>)() -> {
|
||||
ReadOnlyAttributeUtil.setReadOnlyAttribute(file, false);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -583,10 +574,10 @@ public class PsiEventsTest extends PsiTestCase {
|
||||
rename(virtualFile, "b.xml");
|
||||
}
|
||||
|
||||
String newText;
|
||||
String original;
|
||||
String eventsFired = "";
|
||||
PsiTreeChangeListener listener;
|
||||
private String newText;
|
||||
private String original;
|
||||
private String eventsFired = "";
|
||||
private PsiTreeChangeListener listener;
|
||||
public void testBeforeAfterChildrenChange() throws Throwable {
|
||||
listener = new PsiTreeChangeListener() {
|
||||
@Override
|
||||
@@ -753,32 +744,32 @@ public class PsiEventsTest extends PsiTestCase {
|
||||
|
||||
@Override
|
||||
public void childAdded(@NotNull PsiTreeChangeEvent event) {
|
||||
checkCommitted(true, event);
|
||||
checkCommitted(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childRemoved(@NotNull PsiTreeChangeEvent event) {
|
||||
checkCommitted(true, event);
|
||||
checkCommitted(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childReplaced(@NotNull PsiTreeChangeEvent event) {
|
||||
checkCommitted(true, event);
|
||||
checkCommitted(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childrenChanged(@NotNull PsiTreeChangeEvent event) {
|
||||
checkCommitted(true, event);
|
||||
checkCommitted(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childMoved(@NotNull PsiTreeChangeEvent event) {
|
||||
checkCommitted(true, event);
|
||||
checkCommitted(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChanged(@NotNull PsiTreeChangeEvent event) {
|
||||
checkCommitted(true, event);
|
||||
checkCommitted(event);
|
||||
}
|
||||
}, getTestRootDisposable());
|
||||
|
||||
@@ -792,11 +783,11 @@ public class PsiEventsTest extends PsiTestCase {
|
||||
assertTrue(documentManager.isCommitted(document));
|
||||
}
|
||||
|
||||
private static void checkCommitted(boolean shouldBeCommitted, PsiTreeChangeEvent event) {
|
||||
private static void checkCommitted(PsiTreeChangeEvent event) {
|
||||
PsiFile file = event.getFile();
|
||||
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(file.getProject());
|
||||
Document document = documentManager.getDocument(file);
|
||||
assertEquals(shouldBeCommitted, documentManager.isCommitted(document));
|
||||
assertTrue(documentManager.isCommitted(document));
|
||||
}
|
||||
|
||||
public void testTreeChangePreprocessorThrowsException() throws Exception {
|
||||
|
||||
@@ -184,7 +184,7 @@ public abstract class EditorFactory {
|
||||
|
||||
/**
|
||||
* Registers a listener for receiving notifications when editor instances are created and released
|
||||
* and removes the listener when the <code>'parentDisposable'</code> gets disposed.
|
||||
* and removes the listener when the {@code parentDisposable} gets disposed.
|
||||
*
|
||||
* @param listener the listener instance.
|
||||
* @param parentDisposable the Disposable which triggers the removal of the listener
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.editor;
|
||||
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.Point;
|
||||
|
||||
@@ -25,7 +26,7 @@ import java.awt.Point;
|
||||
* will have the line number 10 in its logical position.
|
||||
* <p>
|
||||
* Logical position may store additional parameters that define its mapping to {@link VisualPosition}. Rationale is that
|
||||
* single logical <code>(line; column)</code> pair matches soft wrap-introduced virtual space, i.e. different visual positions
|
||||
* single logical {@code (line; column)} pair matches soft wrap-introduced virtual space, i.e. different visual positions
|
||||
* correspond to the same logical position. It's convenient to store exact visual location details within the logical
|
||||
* position in order to relief further {@code 'logical position' -> 'visual position'} mapping.
|
||||
* <p>
|
||||
@@ -68,7 +69,7 @@ public class LogicalPosition implements Comparable<LogicalPosition> {
|
||||
* to the current logical position.
|
||||
* <p>
|
||||
* Instead of directly using this value, EditorUtil.getSoftWrapCountAfterLineStart(Editor, LogicalPosition) method can be used,
|
||||
* it will work regardless of whether current <code>LogicalPosition</code> instance is {@link #visualPositionAware}.
|
||||
* it will work regardless of whether current {@code LogicalPosition} instance is {@link #visualPositionAware}.
|
||||
*
|
||||
* @see #visualPositionAware
|
||||
*/
|
||||
@@ -96,11 +97,11 @@ public class LogicalPosition implements Comparable<LogicalPosition> {
|
||||
public final int foldingColumnDiff;
|
||||
|
||||
/**
|
||||
* If <code>true</code>, this position is associated with succeeding character (in logical order), otherwise it's associated with
|
||||
* If {@code true}, this position is associated with succeeding character (in logical order), otherwise it's associated with
|
||||
* preceding character. This can make difference in bidirectional text, where logical positions which differ only in this flag's value
|
||||
* can have different visual positions.
|
||||
* <p>
|
||||
* This field has no impact on equality and comparison relationships between <code>LogicalPosition</code> instances.
|
||||
* This field has no impact on equality and comparison relationships between {@code LogicalPosition} instances.
|
||||
*/
|
||||
public final boolean leansForward;
|
||||
|
||||
@@ -183,7 +184,7 @@ public class LogicalPosition implements Comparable<LogicalPosition> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>LogicalPosition</code> instance with a given value of {@link #leansForward} flag.
|
||||
* Constructs a new {@code LogicalPosition} instance with a given value of {@link #leansForward} flag.
|
||||
*/
|
||||
public LogicalPosition leanForward(boolean value) {
|
||||
return new LogicalPosition(line, column, value);
|
||||
@@ -214,7 +215,8 @@ public class LogicalPosition implements Comparable<LogicalPosition> {
|
||||
+ (leansForward ? "; leans forward" : "");
|
||||
}
|
||||
|
||||
public int compareTo(LogicalPosition position) {
|
||||
@Override
|
||||
public int compareTo(@NotNull LogicalPosition position) {
|
||||
if (line != position.line) return line - position.line;
|
||||
if (column != position.column) return column - position.column;
|
||||
if (softWrapLinesBeforeCurrentLogicalLine != position.softWrapLinesBeforeCurrentLogicalLine) return softWrapLinesBeforeCurrentLogicalLine - position.softWrapLinesBeforeCurrentLogicalLine;
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* @see {@link com.intellij.openapi.editor.EditorFactory#addEditorFactoryListener(EditorFactoryListener, com.intellij.openapi.Disposable)}
|
||||
* see {@link com.intellij.openapi.editor.EditorFactory#addEditorFactoryListener(EditorFactoryListener, com.intellij.openapi.Disposable)}
|
||||
*/
|
||||
public interface EditorFactoryListener extends EventListener {
|
||||
/**
|
||||
|
||||
@@ -23,12 +23,7 @@ package com.intellij.openapi.fileEditor;
|
||||
* @author Vladimir Kondratyev
|
||||
*/
|
||||
public interface FileEditorState {
|
||||
FileEditorState INSTANCE = new FileEditorState() {
|
||||
@Override
|
||||
public boolean canBeMergedWith(FileEditorState otherState, FileEditorStateLevel level) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
FileEditorState INSTANCE = (__0, __1) -> true;
|
||||
|
||||
boolean canBeMergedWith(FileEditorState otherState, FileEditorStateLevel level);
|
||||
}
|
||||
|
||||
+1
@@ -92,6 +92,7 @@ public class PsiAwareTextEditorProvider extends TextEditorProvider {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected TextEditorState getStateImpl(final Project project, @NotNull final Editor editor, @NotNull final FileEditorStateLevel level) {
|
||||
final TextEditorState state = super.getStateImpl(project, editor, level);
|
||||
|
||||
@@ -203,17 +203,6 @@ abstract class MnemonicWrapper<T extends Component> implements Runnable, Propert
|
||||
return stroke;
|
||||
}
|
||||
|
||||
private static class MenuWrapper extends ButtonWrapper {
|
||||
private MenuWrapper(AbstractButton component) {
|
||||
super(component);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isDisabled() {
|
||||
return UISettings.getShadowInstance().DISABLE_MNEMONICS;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ButtonWrapper extends MnemonicWrapper<AbstractButton> {
|
||||
private KeyStroke myStrokePressed;
|
||||
private KeyStroke myStrokeReleased;
|
||||
|
||||
@@ -21,12 +21,14 @@ import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
public class JumpToLastEditAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
if (project == null) return;
|
||||
IdeDocumentHistory.getInstance(project).navigatePreviousChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent event){
|
||||
Presentation presentation = event.getPresentation();
|
||||
DataContext dataContext = event.getDataContext();
|
||||
|
||||
@@ -69,9 +69,9 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
private boolean mySkipChangeRequests;
|
||||
/**
|
||||
* Initial horizontal caret position during vertical navigation.
|
||||
* Similar to {@link #myDesiredX}, but represents logical caret position (<code>getLogicalPosition().column</code>) rather than visual.
|
||||
* Similar to {@link #myDesiredX}, but represents logical caret position ({@code getLogicalPosition().column}) rather than visual.
|
||||
*/
|
||||
private int myLastColumnNumber = 0;
|
||||
private int myLastColumnNumber;
|
||||
private int myDesiredSelectionStartColumn = -1;
|
||||
private int myDesiredSelectionEndColumn = -1;
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
private volatile VisualPosition myRangeMarkerStartPosition;
|
||||
private volatile VisualPosition myRangeMarkerEndPosition;
|
||||
private volatile boolean myRangeMarkerEndPositionIsLead;
|
||||
boolean myUnknownDirection;
|
||||
private boolean myUnknownDirection;
|
||||
|
||||
private int myDocumentUpdateCounter;
|
||||
|
||||
@@ -922,7 +922,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
* That's why we allow to specify that the direction is unknown and {@link #isUnknownDirection() expose this information}
|
||||
* later.
|
||||
* <p/>
|
||||
* <b>Note:</b> when this method is called with <code>'true'</code>, subsequent calls are guaranteed to return <code>'true'</code>
|
||||
* <b>Note:</b> when this method is called with {@code 'true'}, subsequent calls are guaranteed to return {@code true}
|
||||
* until selection is changed. 'Unknown direction' flag is automatically reset then.
|
||||
*
|
||||
*/
|
||||
@@ -1374,7 +1374,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Caret at " + (myDocumentUpdateCounter == myEditor.getCaretModel().myDocumentUpdateCounter ? myVisibleCaret : getOffset()) +
|
||||
(mySelectionMarker == null ? "" : (", selection marker: " + mySelectionMarker.toString()));
|
||||
(mySelectionMarker == null ? "" : ", selection marker: " + mySelectionMarker);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1424,7 +1424,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates information about target vertical range info - its <code>'y'</code> coordinate and height in pixels.
|
||||
* Encapsulates information about target vertical range info - its {@code 'y'} coordinate and height in pixels.
|
||||
*/
|
||||
private static class VerticalInfo {
|
||||
public final int y;
|
||||
@@ -1452,7 +1452,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
return myRangeMarkerEndPosition;
|
||||
}
|
||||
|
||||
void setRangeMarkerEndPosition(@NotNull VisualPosition endPosition) {
|
||||
private void setRangeMarkerEndPosition(@NotNull VisualPosition endPosition) {
|
||||
myRangeMarkerEndPosition = endPosition;
|
||||
}
|
||||
|
||||
@@ -1460,7 +1460,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
return myRangeMarkerEndPositionIsLead;
|
||||
}
|
||||
|
||||
void setRangeMarkerEndPositionIsLead(boolean endPositionIsLead) {
|
||||
private void setRangeMarkerEndPositionIsLead(boolean endPositionIsLead) {
|
||||
myRangeMarkerEndPositionIsLead = endPositionIsLead;
|
||||
}
|
||||
|
||||
@@ -1550,7 +1550,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
setIntervalStart(newOffset);
|
||||
setIntervalEnd(newOffset);
|
||||
}
|
||||
if (oldOffset >= e.getOffset() && oldOffset <= (e.getOffset() + e.getOldLength()) && e.getNewLength() == 0 &&
|
||||
if (oldOffset >= e.getOffset() && oldOffset <= e.getOffset() + e.getOldLength() && e.getNewLength() == 0 &&
|
||||
myEditor.getInlayModel().hasInlineElementAt(e.getOffset())) {
|
||||
myLeansTowardsLargerOffsets = true;
|
||||
}
|
||||
@@ -1634,7 +1634,7 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + (hasVirtualSelection() ? (" virtual selection: " + startVirtualOffset + "-" + endVirtualOffset) : "");
|
||||
return super.toString() + (hasVirtualSelection() ? " virtual selection: " + startVirtualOffset + "-" + endVirtualOffset : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-9
@@ -39,6 +39,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.*;
|
||||
|
||||
@@ -144,7 +145,7 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec
|
||||
|
||||
public static class RecentlyChangedFilesState {
|
||||
// don't make it private, see: IDEA-130363 Recently Edited Files list should survive restart
|
||||
public List<String> CHANGED_PATHS = new ArrayList<>();
|
||||
@SuppressWarnings("WeakerAccess") public List<String> CHANGED_PATHS = new ArrayList<>();
|
||||
|
||||
public void register(VirtualFile file) {
|
||||
final String path = file.getPath();
|
||||
@@ -439,12 +440,9 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec
|
||||
private void gotoPlaceInfo(@NotNull PlaceInfo info) { // TODO: Msk
|
||||
final boolean wasActive = myToolWindowManager.isEditorComponentActive();
|
||||
EditorWindow wnd = info.getWindow();
|
||||
final Pair<FileEditor[],FileEditorProvider[]> editorsWithProviders;
|
||||
if (wnd != null && wnd.isValid()) {
|
||||
editorsWithProviders = myEditorManager.openFileWithProviders(info.getFile(), wasActive, wnd);
|
||||
} else {
|
||||
editorsWithProviders = myEditorManager.openFileWithProviders(info.getFile(), wasActive, false);
|
||||
}
|
||||
final Pair<FileEditor[],FileEditorProvider[]> editorsWithProviders = wnd != null && wnd.isValid()
|
||||
? myEditorManager.openFileWithProviders(info.getFile(), wasActive, wnd)
|
||||
: myEditorManager.openFileWithProviders(info.getFile(), wasActive, false);
|
||||
|
||||
myEditorManager.setSelectedEditor(info.getFile(), info.getEditorTypeId());
|
||||
|
||||
@@ -504,11 +502,10 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec
|
||||
}
|
||||
|
||||
private static final class PlaceInfo {
|
||||
|
||||
private final VirtualFile myFile;
|
||||
private final FileEditorState myNavigationState;
|
||||
private final String myEditorTypeId;
|
||||
private final WeakReference<EditorWindow> myWindow;
|
||||
private final Reference<EditorWindow> myWindow;
|
||||
|
||||
PlaceInfo(@NotNull VirtualFile file,
|
||||
@NotNull FileEditorState navigationState,
|
||||
|
||||
+2
-1
@@ -207,6 +207,7 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware {
|
||||
editor.putUserData(TEXT_EDITOR_KEY, textEditor);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected TextEditorState getStateImpl(final Project project, @NotNull Editor editor, @NotNull FileEditorStateLevel level){
|
||||
TextEditorState state = new TextEditorState();
|
||||
CaretModel caretModel = editor.getCaretModel();
|
||||
@@ -310,7 +311,7 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware {
|
||||
protected class EditorWrapper extends UserDataHolderBase implements TextEditor {
|
||||
private final Editor myEditor;
|
||||
|
||||
public EditorWrapper(@NotNull Editor editor) {
|
||||
EditorWrapper(@NotNull Editor editor) {
|
||||
myEditor = editor;
|
||||
}
|
||||
|
||||
|
||||
+15
-16
@@ -28,16 +28,15 @@ import java.util.Arrays;
|
||||
* @author Vladimir Kondratyev
|
||||
*/
|
||||
public final class TextEditorState implements FileEditorState {
|
||||
CaretState[] CARETS;
|
||||
|
||||
public CaretState[] CARETS;
|
||||
|
||||
public int RELATIVE_CARET_POSITION; // distance from primary caret to the top of editor's viewable area in pixels
|
||||
int RELATIVE_CARET_POSITION; // distance from primary caret to the top of editor's viewable area in pixels
|
||||
|
||||
/**
|
||||
* State which describes how editor is folded.
|
||||
* This field can be <code>null</code>.
|
||||
* This field can be {@code null}.
|
||||
*/
|
||||
private CodeFoldingState myFoldingState;
|
||||
private CodeFoldingState myFoldingState;
|
||||
@Nullable private Producer<CodeFoldingState> myDelayedFoldInfoProducer;
|
||||
|
||||
private static final int MIN_CHANGE_DISTANCE = 4;
|
||||
@@ -54,12 +53,12 @@ public final class TextEditorState implements FileEditorState {
|
||||
*
|
||||
* @param producer delayed folding info producer
|
||||
*/
|
||||
public void setDelayedFoldState(@NotNull Producer<CodeFoldingState> producer) {
|
||||
void setDelayedFoldState(@NotNull Producer<CodeFoldingState> producer) {
|
||||
myDelayedFoldInfoProducer = producer;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public CodeFoldingState getFoldingState() {
|
||||
CodeFoldingState getFoldingState() {
|
||||
// Assuming single-thread access here.
|
||||
if (myFoldingState == null && myDelayedFoldInfoProducer != null) {
|
||||
myFoldingState = myDelayedFoldInfoProducer.produce();
|
||||
@@ -70,7 +69,7 @@ public final class TextEditorState implements FileEditorState {
|
||||
return myFoldingState;
|
||||
}
|
||||
|
||||
public void setFoldingState(@Nullable CodeFoldingState foldingState) {
|
||||
void setFoldingState(@Nullable CodeFoldingState foldingState) {
|
||||
myFoldingState = foldingState;
|
||||
myDelayedFoldInfoProducer = null;
|
||||
}
|
||||
@@ -117,14 +116,14 @@ public final class TextEditorState implements FileEditorState {
|
||||
return Arrays.toString(CARETS);
|
||||
}
|
||||
|
||||
public static class CaretState {
|
||||
public int LINE;
|
||||
public int COLUMN;
|
||||
public boolean LEAN_FORWARD;
|
||||
public int SELECTION_START_LINE;
|
||||
public int SELECTION_START_COLUMN;
|
||||
public int SELECTION_END_LINE;
|
||||
public int SELECTION_END_COLUMN;
|
||||
static class CaretState {
|
||||
int LINE;
|
||||
int COLUMN;
|
||||
boolean LEAN_FORWARD;
|
||||
int SELECTION_START_LINE;
|
||||
int SELECTION_START_COLUMN;
|
||||
int SELECTION_END_LINE;
|
||||
int SELECTION_END_COLUMN;
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof CaretState)) {
|
||||
|
||||
@@ -71,10 +71,10 @@ public class PersistentHashMap<Key, Value> extends PersistentEnumeratorDelegate<
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public static final String DATA_FILE_EXTENSION = ".values";
|
||||
static final String DATA_FILE_EXTENSION = ".values";
|
||||
private long myLiveAndGarbageKeysCounter; // first four bytes contain live keys count (updated via LIVE_KEY_MASK), last four bytes - number of dead keys
|
||||
private int myReadCompactionGarbageSize;
|
||||
private static final long LIVE_KEY_MASK = (1L << 32);
|
||||
private static final long LIVE_KEY_MASK = 1L << 32;
|
||||
private static final long USED_LONG_VALUE_MASK = 1L << 62;
|
||||
private static final int POSITIVE_VALUE_SHIFT = 1;
|
||||
private final int myParentValueRefOffset;
|
||||
@@ -114,7 +114,7 @@ public class PersistentHashMap<Key, Value> extends PersistentEnumeratorDelegate<
|
||||
private final SLRUCache<Key, BufferExposingByteArrayOutputStream> myAppendCache;
|
||||
|
||||
private boolean canUseIntAddressForNewRecord(long size) {
|
||||
return myCanReEnumerate ? size + POSITIVE_VALUE_SHIFT < Integer.MAX_VALUE: false;
|
||||
return myCanReEnumerate && size + POSITIVE_VALUE_SHIFT < Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
private final LowMemoryWatcher myAppendCacheFlusher = LowMemoryWatcher.register(new Runnable() {
|
||||
@@ -293,7 +293,7 @@ public class PersistentHashMap<Key, Value> extends PersistentEnumeratorDelegate<
|
||||
}
|
||||
}
|
||||
|
||||
public int getGarbageSize() {
|
||||
int getGarbageSize() {
|
||||
return (int)myLiveAndGarbageKeysCounter;
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ public class PersistentHashMap<Key, Value> extends PersistentEnumeratorDelegate<
|
||||
}
|
||||
|
||||
@TestOnly // public for tests
|
||||
public boolean makesSenseToCompact() {
|
||||
boolean makesSenseToCompact() {
|
||||
if (myIsReadOnly) return false;
|
||||
|
||||
final long fileSize = myValueStorage.getSize();
|
||||
@@ -320,7 +320,7 @@ public class PersistentHashMap<Key, Value> extends PersistentEnumeratorDelegate<
|
||||
|
||||
return deadKeys > liveKeys ||
|
||||
avgValueSize *deadKeys > benefitSize ||
|
||||
myReadCompactionGarbageSize > (fileSize / 2);
|
||||
myReadCompactionGarbageSize > fileSize / 2;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class EdtInvocationManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 'True' {@link EdtInvocationManager} implementation which works with real EDT.
|
||||
* The default {@link EdtInvocationManager} implementation which works with the EDT via SwingUtilities.
|
||||
*/
|
||||
private static class SwingEdtInvocationManager extends EdtInvocationManager {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user