mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -23,7 +23,7 @@ import java.util.Comparator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* An iterator you must to {@link #dispose()} after use
|
||||
* An iterator you must {@link #dispose()} after use
|
||||
*/
|
||||
public interface MarkupIterator<T> extends PeekableIterator<T> {
|
||||
void dispose();
|
||||
@@ -35,7 +35,7 @@ public interface MarkupIterator<T> extends PeekableIterator<T> {
|
||||
|
||||
@Override
|
||||
public Object peek() {
|
||||
return null;
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,12 +22,11 @@ import com.intellij.openapi.editor.ex.DocumentEx;
|
||||
import com.intellij.openapi.editor.ex.RangeMarkerEx;
|
||||
import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class RangeMarkerImpl extends UserDataHolderBase implements RangeMarkerEx, MutableInterval {
|
||||
public class RangeMarkerImpl extends UserDataHolderBase implements RangeMarkerEx {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.RangeMarkerImpl");
|
||||
|
||||
private final DocumentEx myDocument;
|
||||
@@ -36,7 +35,7 @@ public class RangeMarkerImpl extends UserDataHolderBase implements RangeMarkerEx
|
||||
private final long myId;
|
||||
private static final StripedIDGenerator counter = new StripedIDGenerator();
|
||||
|
||||
protected RangeMarkerImpl(@NotNull DocumentEx document, int start, int end, boolean register) {
|
||||
RangeMarkerImpl(@NotNull DocumentEx document, int start, int end, boolean register) {
|
||||
this(document, start, end, register, false, false);
|
||||
}
|
||||
private RangeMarkerImpl(@NotNull DocumentEx document, int start, int end, boolean register, boolean greedyToLeft, boolean greedyToRight) {
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@ package com.intellij.openapi.editor.impl;
|
||||
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.ex.DocumentEx;
|
||||
import com.intellij.openapi.editor.ex.RangeHighlighterEx;
|
||||
import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
|
||||
import com.intellij.openapi.editor.markup.HighlighterTargetArea;
|
||||
import com.intellij.openapi.editor.markup.MarkupModel;
|
||||
@@ -31,7 +30,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* Implementation of the markup element for the editor and document.
|
||||
* @author max
|
||||
*/
|
||||
class PersistentRangeHighlighterImpl extends RangeHighlighterImpl implements RangeHighlighterEx {
|
||||
class PersistentRangeHighlighterImpl extends RangeHighlighterImpl {
|
||||
private int myLine; // for PersistentRangeHighlighterImpl only
|
||||
static PersistentRangeHighlighterImpl create(@NotNull MarkupModel model,
|
||||
int offset,
|
||||
|
||||
+4
-4
@@ -40,9 +40,9 @@ public class EditorFilteringMarkupModelEx implements MarkupModelEx {
|
||||
@NotNull private final EditorImpl myEditor;
|
||||
@NotNull private final MarkupModelEx myDelegate;
|
||||
|
||||
private final Condition<RangeHighlighter> IS_AVAILABLE = highlighter -> isAvailable(highlighter);
|
||||
private final Condition<RangeHighlighter> IS_AVAILABLE = this::isAvailable;
|
||||
|
||||
public EditorFilteringMarkupModelEx(@NotNull EditorImpl editor, @NotNull MarkupModelEx delegate) {
|
||||
EditorFilteringMarkupModelEx(@NotNull EditorImpl editor, @NotNull MarkupModelEx delegate) {
|
||||
myEditor = editor;
|
||||
myDelegate = delegate;
|
||||
}
|
||||
@@ -94,9 +94,9 @@ public class EditorFilteringMarkupModelEx implements MarkupModelEx {
|
||||
|
||||
private class MyFilteringIterator extends FilteringIterator<RangeHighlighterEx, RangeHighlighterEx>
|
||||
implements MarkupIterator<RangeHighlighterEx> {
|
||||
private MarkupIterator<RangeHighlighterEx> myDelegate;
|
||||
private final MarkupIterator<RangeHighlighterEx> myDelegate;
|
||||
|
||||
public MyFilteringIterator(@NotNull MarkupIterator<RangeHighlighterEx> delegate) {
|
||||
MyFilteringIterator(@NotNull MarkupIterator<RangeHighlighterEx> delegate) {
|
||||
super(delegate, IS_AVAILABLE);
|
||||
myDelegate = delegate;
|
||||
}
|
||||
|
||||
@@ -32,13 +32,13 @@ import java.util.Set;
|
||||
*/
|
||||
public interface UsageView extends Disposable {
|
||||
/**
|
||||
* Returns {@link com.intellij.usages.UsageTarget} to look usages for
|
||||
* Returns {@link UsageTarget} to look usages for
|
||||
*/
|
||||
DataKey<UsageTarget[]> USAGE_TARGETS_KEY = DataKey.create("usageTarget");
|
||||
@Deprecated String USAGE_TARGETS = USAGE_TARGETS_KEY.getName();
|
||||
|
||||
/**
|
||||
* Returns {@link com.intellij.usages.Usage} which are selected in usage view
|
||||
* Returns {@link Usage} which are selected in usage view
|
||||
*/
|
||||
DataKey<Usage[]> USAGES_KEY = DataKey.create("usages");
|
||||
@Deprecated String USAGES = USAGES_KEY.getName();
|
||||
|
||||
@@ -34,12 +34,6 @@ public class FilteringIterator<Dom, E extends Dom> implements PeekableIterator<E
|
||||
private boolean myCurrentIsValid;
|
||||
private Dom myCurrent;
|
||||
private Boolean myCurrentPassedFilter;
|
||||
public static final Condition NOT_NULL = new Condition() {
|
||||
@Override
|
||||
public boolean value(Object t) {
|
||||
return t != null;
|
||||
}
|
||||
};
|
||||
|
||||
public FilteringIterator(@NotNull Iterator<Dom> delegate, @NotNull Condition<? super Dom> condition) {
|
||||
myDelegate = delegate;
|
||||
@@ -76,7 +70,7 @@ public class FilteringIterator<Dom, E extends Dom> implements PeekableIterator<E
|
||||
private boolean isCurrentPassesFilter() {
|
||||
if (myCurrentPassedFilter != null) return myCurrentPassedFilter.booleanValue();
|
||||
boolean passed = myCondition.value(myCurrent);
|
||||
myCurrentPassedFilter = Boolean.valueOf(passed);
|
||||
myCurrentPassedFilter = passed;
|
||||
return passed;
|
||||
}
|
||||
|
||||
@@ -98,13 +92,14 @@ public class FilteringIterator<Dom, E extends Dom> implements PeekableIterator<E
|
||||
myDelegate.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E peek() {
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
return (E)myCurrent;
|
||||
}
|
||||
|
||||
public static <T> Iterator<T> skipNulls(Iterator<T> iterator) {
|
||||
return create(iterator, NOT_NULL);
|
||||
return create(iterator, Conditions.<T>notNull());
|
||||
}
|
||||
|
||||
public static <Dom, T extends Dom> Iterator<T> create(Iterator<Dom> iterator, Condition<? super Dom> condition) {
|
||||
|
||||
@@ -16,14 +16,19 @@
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* An iterator with additional ability to {@link #peek()} the current element without moving the cursor.
|
||||
* Upon creation, {@link #peek()} returns the first element, after {@link #hasNext()} returns false might throw {@link NoSuchElementException}.
|
||||
*/
|
||||
public interface PeekableIterator<T> extends Iterator<T> {
|
||||
T peek();
|
||||
T peek() throws NoSuchElementException;
|
||||
|
||||
PeekableIterator EMPTY = new PeekableIterator() {
|
||||
@Override
|
||||
public Object peek() {
|
||||
return null;
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user