mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: diamondify
This commit is contained in:
committed by
Aleksey Pivovarov
parent
244526328a
commit
258e6d6274
@@ -46,10 +46,10 @@ public class DirDiffSettings {
|
||||
public boolean showInFrame = true; // in dialog otherwise
|
||||
|
||||
//Usually used to set additional compare settings
|
||||
private final List<AnAction> extraToolbarActions = new ArrayList<AnAction>();
|
||||
private final List<AnAction> extraToolbarActions = new ArrayList<>();
|
||||
|
||||
//Non-standard diff tools can store additional data here to use it while building data model
|
||||
public final HashMap<Object, Object> customSettings = new HashMap<Object, Object>();
|
||||
public final HashMap<Object, Object> customSettings = new HashMap<>();
|
||||
|
||||
private String filter = "";
|
||||
private Pattern filterPattern = PatternUtil.fromMask("*");
|
||||
|
||||
@@ -88,7 +88,7 @@ public class DiffManagerImpl extends DiffManagerEx {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<DiffTool> getDiffTools() {
|
||||
List<DiffTool> result = new ArrayList<DiffTool>();
|
||||
List<DiffTool> result = new ArrayList<>();
|
||||
Collections.addAll(result, DiffTool.EP_NAME.getExtensions());
|
||||
result.add(SimpleDiffTool.INSTANCE);
|
||||
result.add(UnifiedDiffTool.INSTANCE);
|
||||
@@ -100,7 +100,7 @@ public class DiffManagerImpl extends DiffManagerEx {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<MergeTool> getMergeTools() {
|
||||
List<MergeTool> result = new ArrayList<MergeTool>();
|
||||
List<MergeTool> result = new ArrayList<>();
|
||||
Collections.addAll(result, MergeTool.EP_NAME.getExtensions());
|
||||
result.add(TextMergeTool.INSTANCE);
|
||||
result.add(BinaryMergeTool.INSTANCE);
|
||||
|
||||
@@ -213,7 +213,7 @@ public class DiffRequestFactoryImpl extends DiffRequestFactory {
|
||||
DocumentContent outputContent = myContentFactory.create(project, outputDocument, fileType);
|
||||
CharSequence originalContent = outputDocument.getImmutableCharSequence();
|
||||
|
||||
List<DocumentContent> contents = new ArrayList<DocumentContent>(3);
|
||||
List<DocumentContent> contents = new ArrayList<>(3);
|
||||
for (String text : textContents) {
|
||||
contents.add(myContentFactory.create(text, fileType));
|
||||
}
|
||||
@@ -258,7 +258,7 @@ public class DiffRequestFactoryImpl extends DiffRequestFactory {
|
||||
DocumentContent outputContent = myContentFactory.create(project, outputDocument);
|
||||
CharSequence originalContent = outputDocument.getImmutableCharSequence();
|
||||
|
||||
List<DocumentContent> contents = new ArrayList<DocumentContent>(3);
|
||||
List<DocumentContent> contents = new ArrayList<>(3);
|
||||
for (byte[] bytes : byteContents) {
|
||||
contents.add(FileAwareDocumentContent.create(project, bytes, output));
|
||||
}
|
||||
@@ -282,7 +282,7 @@ public class DiffRequestFactoryImpl extends DiffRequestFactory {
|
||||
if (outputContent == null) throw new InvalidDiffRequestException("Can't process file: " + output);
|
||||
byte[] originalContent = output.contentsToByteArray();
|
||||
|
||||
List<DiffContent> contents = new ArrayList<DiffContent>(3);
|
||||
List<DiffContent> contents = new ArrayList<>(3);
|
||||
for (byte[] bytes : byteContents) {
|
||||
contents.add(myContentFactory.createFromBytes(project, output, bytes));
|
||||
}
|
||||
@@ -332,7 +332,7 @@ public class DiffRequestFactoryImpl extends DiffRequestFactory {
|
||||
@Nullable String title,
|
||||
@NotNull List<String> contentTitles,
|
||||
@Nullable Consumer<MergeResult> applyCallback) throws InvalidDiffRequestException {
|
||||
List<byte[]> byteContents = new ArrayList<byte[]>(3);
|
||||
List<byte[]> byteContents = new ArrayList<>(3);
|
||||
for (VirtualFile file : fileContents) {
|
||||
try {
|
||||
byteContents.add(file.contentsToByteArray());
|
||||
@@ -361,8 +361,8 @@ public class DiffRequestFactoryImpl extends DiffRequestFactory {
|
||||
if (outputContent == null) throw new InvalidDiffRequestException("Can't process file: " + output.getPresentableUrl());
|
||||
byte[] originalContent = output.contentsToByteArray();
|
||||
|
||||
List<DiffContent> contents = new ArrayList<DiffContent>(3);
|
||||
List<byte[]> byteContents = new ArrayList<byte[]>(3);
|
||||
List<DiffContent> contents = new ArrayList<>(3);
|
||||
List<byte[]> byteContents = new ArrayList<>(3);
|
||||
for (VirtualFile file : fileContents) {
|
||||
FileContent content = myContentFactory.createFile(project, file);
|
||||
if (content == null) throw new InvalidDiffRequestException("Can't process file: " + file.getPresentableUrl());
|
||||
|
||||
@@ -26,7 +26,7 @@ public abstract class BufferedLineIterator implements Iterator<Pair<Integer, Cha
|
||||
@NotNull private final List<Pair<Integer, CharSequence>> myBuffer;
|
||||
|
||||
public BufferedLineIterator() {
|
||||
myBuffer = new LinkedList<Pair<Integer, CharSequence>>();
|
||||
myBuffer = new LinkedList<>();
|
||||
}
|
||||
|
||||
public abstract boolean hasNextBlock();
|
||||
|
||||
@@ -151,7 +151,7 @@ public class SetEditorSettingsAction extends ActionGroup implements DumbAware {
|
||||
@NotNull
|
||||
@Override
|
||||
public AnAction[] getChildren(@Nullable AnActionEvent e) {
|
||||
List<AnAction> result = new ArrayList<AnAction>();
|
||||
List<AnAction> result = new ArrayList<>();
|
||||
ContainerUtil.addAll(result, myActions);
|
||||
result.add(Separator.getInstance());
|
||||
result.add(ActionManager.getInstance().getAction(IdeActions.GROUP_DIFF_EDITOR_GUTTER_POPUP));
|
||||
|
||||
@@ -109,7 +109,7 @@ public abstract class ApplicationStarterBase extends ApplicationStarterEx {
|
||||
|
||||
@NotNull
|
||||
public static List<VirtualFile> findFiles(@NotNull List<String> filePaths, @Nullable String currentDirectory) throws Exception {
|
||||
List<VirtualFile> files = new ArrayList<VirtualFile>();
|
||||
List<VirtualFile> files = new ArrayList<>();
|
||||
|
||||
for (String path : filePaths) {
|
||||
VirtualFile virtualFile = findFile(path, currentDirectory);
|
||||
|
||||
@@ -136,7 +136,7 @@ public class ByChar {
|
||||
@NotNull CharSequence text1,
|
||||
@NotNull CharSequence text2,
|
||||
@NotNull FairDiffIterable changes) {
|
||||
final List<Range> ranges = new ArrayList<Range>();
|
||||
final List<Range> ranges = new ArrayList<>();
|
||||
|
||||
for (Range ch : changes.iterateChanges()) {
|
||||
int startOffset1;
|
||||
|
||||
@@ -293,7 +293,7 @@ public class ByLine {
|
||||
private static List<LineFragment> convertIntoFragments(@NotNull List<Line> lines1,
|
||||
@NotNull List<Line> lines2,
|
||||
@NotNull FairDiffIterable changes) {
|
||||
List<LineFragment> fragments = new ArrayList<LineFragment>();
|
||||
List<LineFragment> fragments = new ArrayList<>();
|
||||
for (Range ch : changes.iterateChanges()) {
|
||||
IntPair offsets1 = getOffsets(lines1, ch.start1, ch.end1);
|
||||
IntPair offsets2 = getOffsets(lines2, ch.start2, ch.end2);
|
||||
@@ -354,7 +354,7 @@ public class ByLine {
|
||||
|
||||
@NotNull
|
||||
private static Pair<List<Line>, TIntArrayList> getBigLines(@NotNull List<Line> lines, int threshold) {
|
||||
List<Line> bigLines = new ArrayList<Line>(lines.size());
|
||||
List<Line> bigLines = new ArrayList<>(lines.size());
|
||||
TIntArrayList indexes = new TIntArrayList(lines.size());
|
||||
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
@@ -372,7 +372,7 @@ public class ByLine {
|
||||
@NotNull List<Line> lines2,
|
||||
@NotNull FairDiffIterable iterable,
|
||||
@NotNull ProgressIndicator indicator) {
|
||||
List<Range> changes = new ArrayList<Range>();
|
||||
List<Range> changes = new ArrayList<>();
|
||||
|
||||
for (Range ch : iterable.iterateChanges()) {
|
||||
Range expanded = TrimUtil.expand(lines1, lines2, ch.start1, ch.start2, ch.end1, ch.end2);
|
||||
@@ -388,7 +388,7 @@ public class ByLine {
|
||||
|
||||
@NotNull
|
||||
private static List<Line> getLines(@NotNull CharSequence text, @NotNull ComparisonPolicy policy) {
|
||||
List<Line> lines = new ArrayList<Line>();
|
||||
List<Line> lines = new ArrayList<>();
|
||||
|
||||
int offset = 0;
|
||||
while (true) {
|
||||
@@ -417,7 +417,7 @@ public class ByLine {
|
||||
|
||||
@NotNull
|
||||
private static List<Line> convertToIgnoreWhitespace(@NotNull List<Line> original) {
|
||||
List<Line> result = new ArrayList<Line>(original.size());
|
||||
List<Line> result = new ArrayList<>(original.size());
|
||||
|
||||
for (Line line : original) {
|
||||
result.add(Line.createIgnore(line.getOriginalText(), line.getOffset1()));
|
||||
|
||||
@@ -128,7 +128,7 @@ public class ByWord {
|
||||
|
||||
List<WordBlock> wordBlocks = new LineFragmentSplitter(text1, text2, words1, words2, wordChanges, indicator).run();
|
||||
|
||||
List<LineBlock> lineBlocks = new ArrayList<LineBlock>(wordBlocks.size());
|
||||
List<LineBlock> lineBlocks = new ArrayList<>(wordBlocks.size());
|
||||
for (WordBlock block : wordBlocks) {
|
||||
Range offsets = block.offsets;
|
||||
Range words = block.words;
|
||||
@@ -485,8 +485,8 @@ public class ByWord {
|
||||
|
||||
@NotNull
|
||||
private static Couple<List<Range>> splitIterable2Side(@NotNull FairDiffIterable changes, int offset) {
|
||||
final List<Range> ranges1 = new ArrayList<Range>();
|
||||
final List<Range> ranges2 = new ArrayList<Range>();
|
||||
final List<Range> ranges1 = new ArrayList<>();
|
||||
final List<Range> ranges2 = new ArrayList<>();
|
||||
for (Range ch : changes.iterateUnchanged()) {
|
||||
if (ch.end2 <= offset) {
|
||||
ranges1.add(new Range(ch.start1, ch.end1, ch.start2, ch.end2));
|
||||
@@ -524,7 +524,7 @@ public class ByWord {
|
||||
myText2 = text2;
|
||||
myIndicator = indicator;
|
||||
|
||||
myChanges = new ArrayList<Range>();
|
||||
myChanges = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -564,7 +564,7 @@ public class ByWord {
|
||||
myText3 = text3;
|
||||
myIndicator = indicator;
|
||||
|
||||
myChanges = new ArrayList<MergeRange>();
|
||||
myChanges = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -607,7 +607,7 @@ public class ByWord {
|
||||
myText2 = text2;
|
||||
myIndicator = indicator;
|
||||
|
||||
myChanges = new ArrayList<Range>();
|
||||
myChanges = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -644,7 +644,7 @@ public class ByWord {
|
||||
myText3 = text3;
|
||||
myIndicator = indicator;
|
||||
|
||||
myChanges = new ArrayList<MergeRange>();
|
||||
myChanges = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -678,7 +678,7 @@ public class ByWord {
|
||||
myText2 = text2;
|
||||
myIndicator = indicator;
|
||||
|
||||
myChanges = new ArrayList<Range>();
|
||||
myChanges = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -733,7 +733,7 @@ public class ByWord {
|
||||
myText3 = text3;
|
||||
myIndicator = indicator;
|
||||
|
||||
myChanges = new ArrayList<MergeRange>();
|
||||
myChanges = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -823,7 +823,7 @@ public class ByWord {
|
||||
|
||||
@NotNull
|
||||
public static List<InlineChunk> getInlineChunks(@NotNull final CharSequence text) {
|
||||
final List<InlineChunk> chunks = new ArrayList<InlineChunk>();
|
||||
final List<InlineChunk> chunks = new ArrayList<>();
|
||||
|
||||
final int len = text.length();
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ abstract class ChunkOptimizer<T> {
|
||||
myIterable = iterable;
|
||||
myIndicator = indicator;
|
||||
|
||||
myRanges = new ArrayList<Range>();
|
||||
myRanges = new ArrayList<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ComparisonManagerImpl extends ComparisonManager {
|
||||
@NotNull ProgressIndicator indicator) throws DiffTooBigException {
|
||||
List<LineFragment> lineFragments = compareLines(text1, text2, policy, indicator);
|
||||
|
||||
List<LineFragment> fineFragments = new ArrayList<LineFragment>(lineFragments.size());
|
||||
List<LineFragment> fineFragments = new ArrayList<>(lineFragments.size());
|
||||
int tooBigChunksCount = 0;
|
||||
|
||||
for (LineFragment fragment : lineFragments) {
|
||||
@@ -209,7 +209,7 @@ public class ComparisonManagerImpl extends ComparisonManager {
|
||||
public List<LineFragment> squash(@NotNull List<LineFragment> oldFragments) {
|
||||
if (oldFragments.isEmpty()) return oldFragments;
|
||||
|
||||
final List<LineFragment> newFragments = new ArrayList<LineFragment>();
|
||||
final List<LineFragment> newFragments = new ArrayList<>();
|
||||
processAdjoining(oldFragments, new Consumer<List<LineFragment>>() {
|
||||
@Override
|
||||
public void consume(List<LineFragment> fragments) {
|
||||
@@ -228,7 +228,7 @@ public class ComparisonManagerImpl extends ComparisonManager {
|
||||
if (!squash && !trim) return oldFragments;
|
||||
if (oldFragments.isEmpty()) return oldFragments;
|
||||
|
||||
final List<LineFragment> newFragments = new ArrayList<LineFragment>();
|
||||
final List<LineFragment> newFragments = new ArrayList<>();
|
||||
processAdjoining(oldFragments, new Consumer<List<LineFragment>>() {
|
||||
@Override
|
||||
public void consume(List<LineFragment> fragments) {
|
||||
@@ -300,7 +300,7 @@ public class ComparisonManagerImpl extends ComparisonManager {
|
||||
LineFragment firstFragment = oldFragments.get(0);
|
||||
LineFragment lastFragment = oldFragments.get(oldFragments.size() - 1);
|
||||
|
||||
List<DiffFragment> newInnerFragments = new ArrayList<DiffFragment>();
|
||||
List<DiffFragment> newInnerFragments = new ArrayList<>();
|
||||
for (LineFragment fragment : oldFragments) {
|
||||
for (DiffFragment innerFragment : extractInnerFragments(fragment)) {
|
||||
int shift1 = fragment.getStartOffset1() - firstFragment.getStartOffset1();
|
||||
|
||||
@@ -35,8 +35,8 @@ public class ComparisonMergeUtil {
|
||||
|
||||
FairMergeBuilder builder = new FairMergeBuilder();
|
||||
|
||||
PeekIterator<Range> unchanged1 = new PeekIterator<Range>(fragments1.unchanged());
|
||||
PeekIterator<Range> unchanged2 = new PeekIterator<Range>(fragments2.unchanged());
|
||||
PeekIterator<Range> unchanged1 = new PeekIterator<>(fragments1.unchanged());
|
||||
PeekIterator<Range> unchanged2 = new PeekIterator<>(fragments2.unchanged());
|
||||
|
||||
while (!unchanged1.atEnd() || !unchanged2.atEnd()) {
|
||||
indicator.checkCanceled();
|
||||
@@ -69,7 +69,7 @@ public class ComparisonMergeUtil {
|
||||
}
|
||||
|
||||
private static class FairMergeBuilder {
|
||||
@NotNull private final ArrayList<MergeRange> myResult = new ArrayList<MergeRange>();
|
||||
@NotNull private final ArrayList<MergeRange> myResult = new ArrayList<>();
|
||||
|
||||
@NotNull private final EqualPair[] myPairs = new EqualPair[2]; // LEFT, RIGHT
|
||||
@NotNull private final int[] myProcessed = new int[]{0, 0, 0}; // LEFT, RIGHT, BASE
|
||||
|
||||
@@ -38,7 +38,7 @@ class LineFragmentSplitter {
|
||||
@NotNull private final FairDiffIterable myIterable;
|
||||
@NotNull private final ProgressIndicator myIndicator;
|
||||
|
||||
@NotNull private final List<WordBlock> myResult = new ArrayList<WordBlock>();
|
||||
@NotNull private final List<WordBlock> myResult = new ArrayList<>();
|
||||
|
||||
public LineFragmentSplitter(@NotNull CharSequence text1,
|
||||
@NotNull CharSequence text2,
|
||||
|
||||
@@ -143,7 +143,7 @@ public class DiffIterableUtil {
|
||||
|
||||
@NotNull
|
||||
public static List<DiffFragment> convertIntoFragments(@NotNull DiffIterable changes) {
|
||||
final List<DiffFragment> fragments = new ArrayList<DiffFragment>();
|
||||
final List<DiffFragment> fragments = new ArrayList<>();
|
||||
for (Range ch : changes.iterateChanges()) {
|
||||
fragments.add(new DiffFragmentImpl(ch.start1, ch.end1, ch.start2, ch.end2));
|
||||
}
|
||||
@@ -368,8 +368,8 @@ public class DiffIterableUtil {
|
||||
Range range = pair.first;
|
||||
boolean equals = pair.second;
|
||||
|
||||
List<T> data1 = new ArrayList<T>();
|
||||
List<T> data2 = new ArrayList<T>();
|
||||
List<T> data1 = new ArrayList<>();
|
||||
List<T> data2 = new ArrayList<>();
|
||||
|
||||
for (int i = range.start1; i < range.end1; i++) {
|
||||
data1.add(objects1.get(i));
|
||||
@@ -378,7 +378,7 @@ public class DiffIterableUtil {
|
||||
data2.add(objects2.get(i));
|
||||
}
|
||||
|
||||
result.add(new LineRangeData<T>(data1, data2, equals));
|
||||
result.add(new LineRangeData<>(data1, data2, equals));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class CacheDiffRequestProcessor<T> extends DiffRequestProcessor
|
||||
private static final Logger LOG = Logger.getInstance(CacheDiffRequestProcessor.class);
|
||||
|
||||
@NotNull private final SoftHardCacheMap<T, DiffRequest> myRequestCache =
|
||||
new SoftHardCacheMap<T, DiffRequest>(5, 5);
|
||||
new SoftHardCacheMap<>(5, 5);
|
||||
|
||||
@NotNull private final DiffTaskQueue myQueue = new DiffTaskQueue();
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ public abstract class DiffRequestProcessor implements Disposable {
|
||||
mySettings = DiffSettingsHolder.getInstance().getSettings(myContext.getUserData(DiffUserDataKeys.PLACE));
|
||||
|
||||
myAvailableTools = DiffManagerEx.getInstance().getDiffTools();
|
||||
myToolOrder = new ArrayList<DiffTool>(getToolOrderFromSettings(myAvailableTools));
|
||||
myToolOrder = new ArrayList<>(getToolOrderFromSettings(myAvailableTools));
|
||||
|
||||
// UI
|
||||
|
||||
@@ -187,7 +187,7 @@ public abstract class DiffRequestProcessor implements Disposable {
|
||||
|
||||
@NotNull
|
||||
private List<FrameDiffTool> filterFittedTools(@NotNull List<DiffTool> tools) {
|
||||
List<FrameDiffTool> result = new ArrayList<FrameDiffTool>();
|
||||
List<FrameDiffTool> result = new ArrayList<>();
|
||||
for (DiffTool tool : tools) {
|
||||
try {
|
||||
if (tool instanceof FrameDiffTool && tool.canShow(myContext, myActiveRequest)) {
|
||||
@@ -349,7 +349,7 @@ public abstract class DiffRequestProcessor implements Disposable {
|
||||
|
||||
@NotNull
|
||||
protected List<DiffTool> getToolOrderFromSettings(@NotNull List<DiffTool> availableTools) {
|
||||
List<DiffTool> result = new ArrayList<DiffTool>();
|
||||
List<DiffTool> result = new ArrayList<>();
|
||||
List<String> savedOrder = getSettings().getDiffToolsOrder();
|
||||
|
||||
for (final String clazz : savedOrder) {
|
||||
@@ -370,7 +370,7 @@ public abstract class DiffRequestProcessor implements Disposable {
|
||||
}
|
||||
|
||||
protected void updateToolOrderSettings(@NotNull List<DiffTool> toolOrder) {
|
||||
List<String> savedOrder = new ArrayList<String>();
|
||||
List<String> savedOrder = new ArrayList<>();
|
||||
for (DiffTool tool : toolOrder) {
|
||||
savedOrder.add(tool.getClass().getCanonicalName());
|
||||
}
|
||||
@@ -405,7 +405,7 @@ public abstract class DiffRequestProcessor implements Disposable {
|
||||
protected DefaultActionGroup collectToolbarActions(@Nullable List<AnAction> viewerActions) {
|
||||
DefaultActionGroup group = new DefaultActionGroup();
|
||||
|
||||
List<AnAction> navigationActions = new ArrayList<AnAction>();
|
||||
List<AnAction> navigationActions = new ArrayList<>();
|
||||
navigationActions.addAll(getNavigationActions());
|
||||
navigationActions.add(myOpenInEditorAction);
|
||||
navigationActions.add(new MyChangeDiffToolAction());
|
||||
@@ -432,7 +432,7 @@ public abstract class DiffRequestProcessor implements Disposable {
|
||||
protected DefaultActionGroup collectPopupActions(@Nullable List<AnAction> viewerActions) {
|
||||
DefaultActionGroup group = new DefaultActionGroup();
|
||||
|
||||
List<AnAction> selectToolActions = new ArrayList<AnAction>();
|
||||
List<AnAction> selectToolActions = new ArrayList<>();
|
||||
for (DiffTool tool : getAvailableFittedTools()) {
|
||||
if (tool == myState.getActiveTool()) continue;
|
||||
selectToolActions.add(new DiffToolToggleAction(tool));
|
||||
@@ -1172,7 +1172,7 @@ public abstract class DiffRequestProcessor implements Disposable {
|
||||
FrameDiffTool.ToolbarComponents toolbarComponents1 = myViewer.init();
|
||||
FrameDiffTool.ToolbarComponents toolbarComponents2 = myWrapperViewer.init();
|
||||
|
||||
List<AnAction> toolbarActions = new ArrayList<AnAction>();
|
||||
List<AnAction> toolbarActions = new ArrayList<>();
|
||||
if (toolbarComponents1.toolbarActions != null) toolbarActions.addAll(toolbarComponents1.toolbarActions);
|
||||
if (toolbarComponents2.toolbarActions != null) {
|
||||
if (!toolbarActions.isEmpty() && !toolbarComponents2.toolbarActions.isEmpty()) toolbarActions.add(Separator.getInstance());
|
||||
@@ -1180,7 +1180,7 @@ public abstract class DiffRequestProcessor implements Disposable {
|
||||
}
|
||||
buildToolbar(toolbarActions);
|
||||
|
||||
List<AnAction> popupActions = new ArrayList<AnAction>();
|
||||
List<AnAction> popupActions = new ArrayList<>();
|
||||
if (toolbarComponents1.popupActions != null) popupActions.addAll(toolbarComponents1.popupActions);
|
||||
if (toolbarComponents2.popupActions != null) {
|
||||
if (!popupActions.isEmpty() && !toolbarComponents2.popupActions.isEmpty()) popupActions.add(Separator.getInstance());
|
||||
|
||||
@@ -43,7 +43,7 @@ public class DiffSettingsHolder implements PersistentStateComponent<DiffSettings
|
||||
}
|
||||
|
||||
private static class PlaceSettings {
|
||||
@NotNull public List<String> DIFF_TOOLS_ORDER = new ArrayList<String>();
|
||||
@NotNull public List<String> DIFF_TOOLS_ORDER = new ArrayList<>();
|
||||
public boolean SYNC_BINARY_EDITOR_SETTINGS = true;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class DiffSettingsHolder implements PersistentStateComponent<DiffSettings
|
||||
|
||||
public static class State {
|
||||
@MapAnnotation(surroundWithTag = false, surroundKeyWithTag = false, surroundValueWithTag = false)
|
||||
public Map<String, PlaceSettings> PLACES_MAP = new HashMap<String, PlaceSettings>();
|
||||
public Map<String, PlaceSettings> PLACES_MAP = new HashMap<>();
|
||||
public SharedSettings SHARED_SETTINGS = new SharedSettings();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class TextMergeChange extends ThreesideDiffChangeBase {
|
||||
@NotNull private final TextMergeViewer myMergeViewer;
|
||||
@NotNull private final TextMergeViewer.MyThreesideViewer myViewer;
|
||||
|
||||
@NotNull private final List<MyGutterOperation> myOperations = new ArrayList<MyGutterOperation>();
|
||||
@NotNull private final List<MyGutterOperation> myOperations = new ArrayList<>();
|
||||
|
||||
@NotNull private final MergeLineFragment myFragment;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
@NotNull private final MyInnerDiffWorker myInnerDiffWorker;
|
||||
|
||||
// all changes - both applied and unapplied ones
|
||||
@NotNull private final List<TextMergeChange> myAllMergeChanges = new ArrayList<TextMergeChange>();
|
||||
@NotNull private final List<TextMergeChange> myAllMergeChanges = new ArrayList<>();
|
||||
|
||||
private boolean myInitialRediffStarted;
|
||||
private boolean myInitialRediffFinished;
|
||||
@@ -189,7 +189,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
@Nullable private MergeCommandAction myCurrentMergeCommand;
|
||||
private int myBulkChangeUpdateDepth;
|
||||
|
||||
private final Set<TextMergeChange> myChangesToUpdate = new HashSet<TextMergeChange>();
|
||||
private final Set<TextMergeChange> myChangesToUpdate = new HashSet<>();
|
||||
|
||||
public MyThreesideViewer(@NotNull DiffContext context, @NotNull ContentDiffRequest request) {
|
||||
super(context, request);
|
||||
@@ -221,7 +221,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(new MyHighlightPolicySettingAction());
|
||||
group.add(new MyToggleAutoScrollAction());
|
||||
@@ -243,7 +243,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<AnAction> createEditorPopupActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(new ApplySelectedChangesAction(Side.LEFT, false));
|
||||
group.add(new ApplySelectedChangesAction(Side.RIGHT, false));
|
||||
@@ -262,7 +262,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
@Nullable
|
||||
@Override
|
||||
protected List<AnAction> createPopupActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(Separator.getInstance());
|
||||
group.add(new MyToggleAutoScrollAction());
|
||||
@@ -557,7 +557,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
private void performRediff(@NotNull final List<TextMergeChange> scheduled,
|
||||
@NotNull final List<InnerChunkData> data,
|
||||
@NotNull final ProgressIndicator indicator) {
|
||||
final List<List<MergeWordFragment>> result = new ArrayList<List<MergeWordFragment>>(data.size());
|
||||
final List<List<MergeWordFragment>> result = new ArrayList<>(data.size());
|
||||
for (InnerChunkData chunkData : data) {
|
||||
result.add(DiffUtil.compareThreesideInner(chunkData.text, ComparisonPolicy.DEFAULT, indicator));
|
||||
}
|
||||
@@ -821,7 +821,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
if (myUndoManager == null) return;
|
||||
|
||||
List<TextMergeChange> affectedChanges = getAffectedChanges();
|
||||
final List<TextMergeChange.State> states = new ArrayList<TextMergeChange.State>(affectedChanges.size());
|
||||
final List<TextMergeChange.State> states = new ArrayList<>(affectedChanges.size());
|
||||
for (TextMergeChange change : affectedChanges) {
|
||||
states.add(change.storeState());
|
||||
}
|
||||
@@ -990,7 +990,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
private List<TextMergeChange> collectAffectedChanges(@Nullable List<TextMergeChange> directChanges) {
|
||||
if (directChanges == null || directChanges.isEmpty()) return null;
|
||||
|
||||
List<TextMergeChange> result = new ArrayList<TextMergeChange>(directChanges.size());
|
||||
List<TextMergeChange> result = new ArrayList<>(directChanges.size());
|
||||
|
||||
int directIndex = 0;
|
||||
int otherIndex = 0;
|
||||
@@ -1132,7 +1132,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
final BitSet lines = DiffUtil.getSelectedLines(getEditor(side));
|
||||
List<TextMergeChange> changes = getChanges();
|
||||
|
||||
List<TextMergeChange> affectedChanges = new ArrayList<TextMergeChange>();
|
||||
List<TextMergeChange> affectedChanges = new ArrayList<>();
|
||||
for (TextMergeChange change : changes) {
|
||||
if (!isEnabled(change)) continue;
|
||||
int line1 = change.getStartLine(side);
|
||||
@@ -1422,7 +1422,7 @@ public class TextMergeViewer implements MergeTool.MergeViewer {
|
||||
|
||||
public MyUndoableAction(@NotNull TextMergeViewer viewer, @NotNull List<TextMergeChange.State> states, boolean undo) {
|
||||
super(viewer.getViewer().getEditor().getDocument());
|
||||
myViewerRef = new WeakReference<TextMergeViewer>(viewer);
|
||||
myViewerRef = new WeakReference<>(viewer);
|
||||
|
||||
myStates = states;
|
||||
myUndo = undo;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class DiffSettingsPanel {
|
||||
setPaintLabels(true);
|
||||
|
||||
//noinspection UseOfObsoleteCollectionType
|
||||
Dictionary<Integer, JLabel> sliderLabels = new Hashtable<Integer, JLabel>();
|
||||
Dictionary<Integer, JLabel> sliderLabels = new Hashtable<>();
|
||||
for (int i = 0; i < TextDiffSettingsHolder.CONTEXT_RANGE_MODES.length; i++) {
|
||||
sliderLabels.put(i, new JLabel(TextDiffSettingsHolder.CONTEXT_RANGE_MODE_LABELS[i]));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class OnesideBinaryDiffViewer extends OnesideDiffViewer<BinaryEditorHolde
|
||||
|
||||
@Override
|
||||
protected List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
group.add(myTransferableStateSupport.createToggleAction());
|
||||
group.addAll(super.createToolbarActions());
|
||||
return group;
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class ThreesideBinaryDiffViewer extends ThreesideDiffViewer<BinaryEditorH
|
||||
|
||||
@Override
|
||||
protected List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
group.add(myTransferableStateSupport.createToggleAction());
|
||||
group.addAll(super.createToolbarActions());
|
||||
return group;
|
||||
|
||||
@@ -86,7 +86,7 @@ public class TwosideBinaryDiffViewer extends TwosideDiffViewer<BinaryEditorHolde
|
||||
|
||||
@Override
|
||||
protected List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(new MyAcceptSideAction(Side.LEFT));
|
||||
group.add(new MyAcceptSideAction(Side.RIGHT));
|
||||
|
||||
+5
-5
@@ -61,8 +61,8 @@ public class ExternalDiffTool {
|
||||
@NotNull final DiffDialogHints hints) {
|
||||
try {
|
||||
//noinspection unchecked
|
||||
final Ref<List<DiffRequest>> requestsRef = new Ref<List<DiffRequest>>();
|
||||
final Ref<Throwable> exceptionRef = new Ref<Throwable>();
|
||||
final Ref<List<DiffRequest>> requestsRef = new Ref<>();
|
||||
final Ref<Throwable> exceptionRef = new Ref<>();
|
||||
ProgressManager.getInstance().run(new Task.Modal(project, "Loading Requests", true) {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
@@ -77,7 +77,7 @@ public class ExternalDiffTool {
|
||||
|
||||
if (!exceptionRef.isNull()) throw exceptionRef.get();
|
||||
|
||||
List<DiffRequest> showInBuiltin = new ArrayList<DiffRequest>();
|
||||
List<DiffRequest> showInBuiltin = new ArrayList<>();
|
||||
for (DiffRequest request : requestsRef.get()) {
|
||||
if (canShow(request)) {
|
||||
showRequest(project, request);
|
||||
@@ -103,10 +103,10 @@ public class ExternalDiffTool {
|
||||
private static List<DiffRequest> collectRequests(@Nullable Project project,
|
||||
@NotNull final DiffRequestChain chain,
|
||||
@NotNull ProgressIndicator indicator) {
|
||||
List<DiffRequest> requests = new ArrayList<DiffRequest>();
|
||||
List<DiffRequest> requests = new ArrayList<>();
|
||||
|
||||
UserDataHolderBase context = new UserDataHolderBase();
|
||||
List<String> errorRequests = new ArrayList<String>();
|
||||
List<String> errorRequests = new ArrayList<>();
|
||||
|
||||
// TODO: show all changes on explicit selection
|
||||
List<? extends DiffRequestProducer> producers = Collections.singletonList(chain.getRequests().get(chain.getIndex()));
|
||||
|
||||
+5
-5
@@ -182,14 +182,14 @@ public class ExternalDiffToolUtil {
|
||||
assert contents.size() == 2 || contents.size() == 3;
|
||||
assert titles.size() == contents.size();
|
||||
|
||||
List<InputFile> files = new ArrayList<InputFile>();
|
||||
List<InputFile> files = new ArrayList<>();
|
||||
for (int i = 0; i < contents.size(); i++) {
|
||||
files.add(createFile(contents.get(i), titles.get(i), windowTitle));
|
||||
}
|
||||
|
||||
CommandLineTokenizer parameterTokenizer = new CommandLineTokenizer(settings.getDiffParameters(), true);
|
||||
|
||||
List<String> args = new ArrayList<String>();
|
||||
List<String> args = new ArrayList<>();
|
||||
while (parameterTokenizer.hasMoreTokens()) {
|
||||
String arg = parameterTokenizer.nextToken();
|
||||
if ("%1".equals(arg)) {
|
||||
@@ -224,7 +224,7 @@ public class ExternalDiffToolUtil {
|
||||
throws IOException, ExecutionException {
|
||||
boolean success = false;
|
||||
OutputFile outputFile = null;
|
||||
List<InputFile> inputFiles = new ArrayList<InputFile>();
|
||||
List<InputFile> inputFiles = new ArrayList<>();
|
||||
try {
|
||||
DiffContent outputContent = request.getOutputContent();
|
||||
List<? extends DiffContent> contents = request.getContents();
|
||||
@@ -242,7 +242,7 @@ public class ExternalDiffToolUtil {
|
||||
|
||||
CommandLineTokenizer parameterTokenizer = new CommandLineTokenizer(settings.getMergeParameters(), true);
|
||||
|
||||
List<String> args = new ArrayList<String>();
|
||||
List<String> args = new ArrayList<>();
|
||||
while (parameterTokenizer.hasMoreTokens()) {
|
||||
String arg = parameterTokenizer.nextToken();
|
||||
if ("%1".equals(arg)) {
|
||||
@@ -269,7 +269,7 @@ public class ExternalDiffToolUtil {
|
||||
final Process process = commandLine.createProcess();
|
||||
|
||||
if (settings.isMergeTrustExitCode()) {
|
||||
final Ref<Boolean> resultRef = new Ref<Boolean>();
|
||||
final Ref<Boolean> resultRef = new Ref<>();
|
||||
|
||||
ProgressManager.getInstance().run(new Task.Modal(project, "Waiting for external tool", true) {
|
||||
@Override
|
||||
|
||||
@@ -147,11 +147,11 @@ public class LineNumberConvertor {
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
@NotNull private final TreeMap<Integer, Integer> myFragments1 = new TreeMap<Integer, Integer>();
|
||||
@NotNull private final TreeMap<Integer, Integer> myFragments2 = new TreeMap<Integer, Integer>();
|
||||
@NotNull private final TreeMap<Integer, Integer> myFragments1 = new TreeMap<>();
|
||||
@NotNull private final TreeMap<Integer, Integer> myFragments2 = new TreeMap<>();
|
||||
|
||||
@NotNull private final TreeMap<Integer, Integer> myInvertedFragments1 = new TreeMap<Integer, Integer>();
|
||||
@NotNull private final TreeMap<Integer, Integer> myInvertedFragments2 = new TreeMap<Integer, Integer>();
|
||||
@NotNull private final TreeMap<Integer, Integer> myInvertedFragments1 = new TreeMap<>();
|
||||
@NotNull private final TreeMap<Integer, Integer> myInvertedFragments2 = new TreeMap<>();
|
||||
|
||||
public void put1(int start, int newStart, int length) {
|
||||
myFragments1.put(start, newStart);
|
||||
@@ -219,7 +219,7 @@ public class LineNumberConvertor {
|
||||
*
|
||||
*/
|
||||
private class Corrector {
|
||||
private final List<CorrectedChange> myChanges = new SmartList<CorrectedChange>();
|
||||
private final List<CorrectedChange> myChanges = new SmartList<>();
|
||||
|
||||
@SuppressWarnings("UnnecessaryLocalVariable")
|
||||
public void handleOnesideChange(int startLine, int endLine, int shift, @NotNull Side masterSide) {
|
||||
|
||||
@@ -45,8 +45,8 @@ public class UnifiedDiffChange {
|
||||
|
||||
@NotNull private final LineFragment myLineFragment;
|
||||
|
||||
@NotNull private final List<RangeHighlighter> myHighlighters = new ArrayList<RangeHighlighter>();
|
||||
@NotNull private final List<MyGutterOperation> myOperations = new ArrayList<MyGutterOperation>();
|
||||
@NotNull private final List<RangeHighlighter> myHighlighters = new ArrayList<>();
|
||||
@NotNull private final List<MyGutterOperation> myOperations = new ArrayList<>();
|
||||
|
||||
public UnifiedDiffChange(@NotNull UnifiedDiffViewer viewer, @NotNull ChangedBlock block) {
|
||||
myViewer = viewer;
|
||||
|
||||
@@ -186,7 +186,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase {
|
||||
@Override
|
||||
@CalledInAwt
|
||||
public List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
// TODO: allow to choose myMasterSide
|
||||
group.add(new MyIgnorePolicySettingAction());
|
||||
@@ -205,7 +205,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase {
|
||||
@Override
|
||||
@CalledInAwt
|
||||
public List<AnAction> createPopupActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(Separator.getInstance());
|
||||
group.add(new MyIgnorePolicySettingAction().getPopupGroup());
|
||||
@@ -222,7 +222,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase {
|
||||
|
||||
@NotNull
|
||||
protected List<AnAction> createEditorPopupActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
if (isEditable(Side.RIGHT, false)) {
|
||||
group.add(new ReplaceSelectedChangesAction(Side.LEFT, false));
|
||||
@@ -420,12 +420,12 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase {
|
||||
if (data.getRangeHighlighter() != null) data.getRangeHighlighter().apply(myProject, myDocument);
|
||||
|
||||
|
||||
ArrayList<UnifiedDiffChange> diffChanges = new ArrayList<UnifiedDiffChange>(blocks.size());
|
||||
ArrayList<UnifiedDiffChange> diffChanges = new ArrayList<>(blocks.size());
|
||||
for (ChangedBlock block : blocks) {
|
||||
diffChanges.add(new UnifiedDiffChange(UnifiedDiffViewer.this, block));
|
||||
}
|
||||
|
||||
List<RangeMarker> guarderRangeBlocks = new ArrayList<RangeMarker>();
|
||||
List<RangeMarker> guarderRangeBlocks = new ArrayList<>();
|
||||
if (!myEditor.isViewer()) {
|
||||
for (ChangedBlock block : blocks) {
|
||||
LineRange range = myMasterSide.select(block.getRange2(), block.getRange1());
|
||||
@@ -947,7 +947,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase {
|
||||
final BitSet lines = DiffUtil.getSelectedLines(myEditor);
|
||||
List<UnifiedDiffChange> changes = myChangedBlockData.getDiffChanges();
|
||||
|
||||
List<UnifiedDiffChange> affectedChanges = new ArrayList<UnifiedDiffChange>();
|
||||
List<UnifiedDiffChange> affectedChanges = new ArrayList<>();
|
||||
for (int i = changes.size() - 1; i >= 0; i--) {
|
||||
UnifiedDiffChange change = changes.get(i);
|
||||
int line1 = change.getLine1();
|
||||
@@ -1136,7 +1136,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase {
|
||||
|
||||
CharSequence text = myDocument.getImmutableCharSequence().subSequence(offset1, offset2);
|
||||
|
||||
Pair<Integer, CharSequence> pair = new Pair<Integer, CharSequence>(myLine, text);
|
||||
Pair<Integer, CharSequence> pair = new Pair<>(myLine, text);
|
||||
myLine++;
|
||||
|
||||
return pair;
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ class UnifiedEditorHighlighter implements EditorHighlighter {
|
||||
@NotNull List<HighlightRange> ranges,
|
||||
int textLength) {
|
||||
myDocument = document;
|
||||
myPieces = new ArrayList<Element>();
|
||||
myPieces = new ArrayList<>();
|
||||
init(highlighter1.createIterator(0), highlighter2.createIterator(0), ranges, textLength);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
class UnifiedEditorRangeHighlighter {
|
||||
public static final Logger LOG = UnifiedDiffViewer.LOG;
|
||||
|
||||
@NotNull private final List<Element> myPieces = new ArrayList<Element>();
|
||||
@NotNull private final List<Element> myPieces = new ArrayList<>();
|
||||
|
||||
public UnifiedEditorRangeHighlighter(@Nullable Project project, @NotNull Document document) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
|
||||
+3
-3
@@ -33,10 +33,10 @@ class UnifiedFragmentBuilder {
|
||||
@NotNull private final Side myMasterSide;
|
||||
|
||||
@NotNull private final StringBuilder myBuilder = new StringBuilder();
|
||||
@NotNull private final List<ChangedBlock> myBlocks = new ArrayList<ChangedBlock>();
|
||||
@NotNull private final List<HighlightRange> myRanges = new ArrayList<HighlightRange>();
|
||||
@NotNull private final List<ChangedBlock> myBlocks = new ArrayList<>();
|
||||
@NotNull private final List<HighlightRange> myRanges = new ArrayList<>();
|
||||
@NotNull private final LineNumberConvertor.Builder myConvertor = new LineNumberConvertor.Builder();
|
||||
@NotNull private final List<LineRange> myChangedLines = new ArrayList<LineRange>();
|
||||
@NotNull private final List<LineRange> myChangedLines = new ArrayList<>();
|
||||
|
||||
public UnifiedFragmentBuilder(@NotNull List<LineFragment> fragments,
|
||||
@NotNull Document document1,
|
||||
|
||||
@@ -41,8 +41,8 @@ public class SimpleDiffChange {
|
||||
@NotNull private final LineFragment myFragment;
|
||||
@Nullable private final List<DiffFragment> myInnerFragments;
|
||||
|
||||
@NotNull private final List<RangeHighlighter> myHighlighters = new ArrayList<RangeHighlighter>();
|
||||
@NotNull private final List<MyGutterOperation> myOperations = new ArrayList<MyGutterOperation>();
|
||||
@NotNull private final List<RangeHighlighter> myHighlighters = new ArrayList<>();
|
||||
@NotNull private final List<MyGutterOperation> myOperations = new ArrayList<>();
|
||||
|
||||
private boolean myIsValid = true;
|
||||
private int[] myLineStartShifts = new int[2];
|
||||
|
||||
@@ -67,8 +67,8 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
@NotNull private final PrevNextDifferenceIterable myPrevNextDifferenceIterable;
|
||||
@NotNull private final StatusPanel myStatusPanel;
|
||||
|
||||
@NotNull private final List<SimpleDiffChange> myDiffChanges = new ArrayList<SimpleDiffChange>();
|
||||
@NotNull private final List<SimpleDiffChange> myInvalidDiffChanges = new ArrayList<SimpleDiffChange>();
|
||||
@NotNull private final List<SimpleDiffChange> myDiffChanges = new ArrayList<>();
|
||||
@NotNull private final List<SimpleDiffChange> myInvalidDiffChanges = new ArrayList<>();
|
||||
private boolean myIsContentsEqual;
|
||||
|
||||
@NotNull private final MyFoldingModel myFoldingModel;
|
||||
@@ -109,7 +109,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(new MyIgnorePolicySettingAction());
|
||||
group.add(new MyHighlightPolicySettingAction());
|
||||
@@ -127,7 +127,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<AnAction> createPopupActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(Separator.getInstance());
|
||||
group.add(new MyIgnorePolicySettingAction().getPopupGroup());
|
||||
@@ -146,7 +146,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<AnAction> createEditorPopupActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(new ReplaceSelectedChangesAction(Side.LEFT, false));
|
||||
group.add(new AppendSelectedChangesAction(Side.LEFT, false));
|
||||
@@ -325,7 +325,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
LineRange lineRange = DiffUtil.getAffectedLineRange(e);
|
||||
int shift = DiffUtil.countLinesShift(e);
|
||||
|
||||
List<SimpleDiffChange> invalid = new ArrayList<SimpleDiffChange>();
|
||||
List<SimpleDiffChange> invalid = new ArrayList<>();
|
||||
for (SimpleDiffChange change : myDiffChanges) {
|
||||
if (change.processChange(lineRange.start, lineRange.end, shift, side)) {
|
||||
invalid.add(change);
|
||||
@@ -427,7 +427,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
private List<SimpleDiffChange> getSelectedChanges(@NotNull Side side) {
|
||||
final BitSet lines = DiffUtil.getSelectedLines(getEditor(side));
|
||||
|
||||
List<SimpleDiffChange> affectedChanges = new ArrayList<SimpleDiffChange>();
|
||||
List<SimpleDiffChange> affectedChanges = new ArrayList<>();
|
||||
for (int i = myDiffChanges.size() - 1; i >= 0; i--) {
|
||||
SimpleDiffChange change = myDiffChanges.get(i);
|
||||
int line1 = change.getStartLine(side);
|
||||
@@ -738,7 +738,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer {
|
||||
|
||||
CharSequence text = myDocument.getImmutableCharSequence().subSequence(offset1, offset2);
|
||||
|
||||
Pair<Integer, CharSequence> pair = new Pair<Integer, CharSequence>(myLine, text);
|
||||
Pair<Integer, CharSequence> pair = new Pair<>(myLine, text);
|
||||
myLine++;
|
||||
|
||||
return pair;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class SimpleOnesideDiffViewer extends OnesideTextDiffViewer {
|
||||
|
||||
@NotNull private final MyInitialScrollHelper myInitialScrollHelper = new MyInitialScrollHelper();
|
||||
|
||||
@NotNull private final List<RangeHighlighter> myHighlighters = new ArrayList<RangeHighlighter>();
|
||||
@NotNull private final List<RangeHighlighter> myHighlighters = new ArrayList<>();
|
||||
|
||||
public SimpleOnesideDiffViewer(@NotNull DiffContext context, @NotNull DiffRequest request) {
|
||||
super(context, (ContentDiffRequest)request);
|
||||
@@ -72,7 +72,7 @@ public class SimpleOnesideDiffViewer extends OnesideTextDiffViewer {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(new MyIgnorePolicySettingAction());
|
||||
group.add(new MyHighlightPolicySettingAction());
|
||||
@@ -88,7 +88,7 @@ public class SimpleOnesideDiffViewer extends OnesideTextDiffViewer {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<AnAction> createPopupActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(Separator.getInstance());
|
||||
group.add(new MyIgnorePolicySettingAction().getPopupGroup());
|
||||
@@ -251,7 +251,7 @@ public class SimpleOnesideDiffViewer extends OnesideTextDiffViewer {
|
||||
|
||||
CharSequence text = myDocument.getImmutableCharSequence().subSequence(offset1, offset2);
|
||||
|
||||
Pair<Integer, CharSequence> pair = new Pair<Integer, CharSequence>(myLine, text);
|
||||
Pair<Integer, CharSequence> pair = new Pair<>(myLine, text);
|
||||
myLine++;
|
||||
|
||||
return pair;
|
||||
|
||||
+6
-6
@@ -55,8 +55,8 @@ import java.util.List;
|
||||
public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewerEx {
|
||||
public static final Logger LOG = Logger.getInstance(SimpleThreesideDiffViewer.class);
|
||||
|
||||
@NotNull private final List<SimpleThreesideDiffChange> myDiffChanges = new ArrayList<SimpleThreesideDiffChange>();
|
||||
@NotNull private final List<SimpleThreesideDiffChange> myInvalidDiffChanges = new ArrayList<SimpleThreesideDiffChange>();
|
||||
@NotNull private final List<SimpleThreesideDiffChange> myDiffChanges = new ArrayList<>();
|
||||
@NotNull private final List<SimpleThreesideDiffChange> myInvalidDiffChanges = new ArrayList<>();
|
||||
|
||||
public SimpleThreesideDiffViewer(@NotNull DiffContext context, @NotNull DiffRequest request) {
|
||||
super(context, (ContentDiffRequest)request);
|
||||
@@ -65,7 +65,7 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewerEx {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(new MyIgnorePolicySettingAction());
|
||||
group.add(new MyHighlightPolicySettingAction());
|
||||
@@ -88,7 +88,7 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewerEx {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<AnAction> createPopupActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
|
||||
group.add(Separator.getInstance());
|
||||
group.add(new MyIgnorePolicySettingAction().getPopupGroup());
|
||||
@@ -143,7 +143,7 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewerEx {
|
||||
comparisonPolicy, indicator);
|
||||
|
||||
if (getHighlightPolicy().isFineFragments()) {
|
||||
List<MergeLineFragment> fineLineFragments = new ArrayList<MergeLineFragment>(lineFragments.size());
|
||||
List<MergeLineFragment> fineLineFragments = new ArrayList<>(lineFragments.size());
|
||||
|
||||
for (final MergeLineFragment fragment : lineFragments) {
|
||||
CharSequence[] chunks = ApplicationManager.getApplication().runReadAction(new Computable<CharSequence[]>() {
|
||||
@@ -251,7 +251,7 @@ public class SimpleThreesideDiffViewer extends ThreesideTextDiffViewerEx {
|
||||
LineRange lineRange = DiffUtil.getAffectedLineRange(e);
|
||||
int shift = DiffUtil.countLinesShift(e);
|
||||
|
||||
List<SimpleThreesideDiffChange> invalid = new ArrayList<SimpleThreesideDiffChange>();
|
||||
List<SimpleThreesideDiffChange> invalid = new ArrayList<>();
|
||||
for (SimpleThreesideDiffChange change : myDiffChanges) {
|
||||
if (change.processChange(lineRange.start, lineRange.end, shift, side)) {
|
||||
invalid.add(change);
|
||||
|
||||
@@ -36,8 +36,8 @@ import java.util.List;
|
||||
public abstract class ThreesideDiffChangeBase {
|
||||
@NotNull private final ConflictType myType;
|
||||
|
||||
@NotNull protected final List<RangeHighlighter> myHighlighters = new ArrayList<RangeHighlighter>();
|
||||
@NotNull protected final List<RangeHighlighter> myInnerHighlighters = new ArrayList<RangeHighlighter>();
|
||||
@NotNull protected final List<RangeHighlighter> myHighlighters = new ArrayList<>();
|
||||
@NotNull protected final List<RangeHighlighter> myInnerHighlighters = new ArrayList<>();
|
||||
|
||||
public ThreesideDiffChangeBase(@NotNull MergeLineFragment fragment,
|
||||
@NotNull List<? extends EditorEx> editors,
|
||||
|
||||
@@ -64,7 +64,7 @@ public class FoldingModelSupport {
|
||||
protected final int myCount;
|
||||
@NotNull protected final EditorEx[] myEditors;
|
||||
|
||||
@NotNull protected final List<FoldedBlock[]> myFoldings = new ArrayList<FoldedBlock[]>();
|
||||
@NotNull protected final List<FoldedBlock[]> myFoldings = new ArrayList<>();
|
||||
|
||||
private boolean myDuringSynchronize;
|
||||
private final boolean[] myShouldUpdateLineNumbers;
|
||||
@@ -155,7 +155,7 @@ public class FoldingModelSupport {
|
||||
}
|
||||
|
||||
private void addRange(int[] starts, int[] ends) {
|
||||
List<FoldedBlock> result = new ArrayList<FoldedBlock>(3);
|
||||
List<FoldedBlock> result = new ArrayList<>(3);
|
||||
int[] rangeStarts = new int[myCount];
|
||||
int[] rangeEnds = new int[myCount];
|
||||
|
||||
@@ -350,7 +350,7 @@ public class FoldingModelSupport {
|
||||
|
||||
private class MyFoldingListener implements FoldingListener {
|
||||
private final int myIndex;
|
||||
@NotNull Set<FoldRegion> myModifiedRegions = new HashSet<FoldRegion>();
|
||||
@NotNull Set<FoldRegion> myModifiedRegions = new HashSet<>();
|
||||
|
||||
public MyFoldingListener(int index) {
|
||||
myIndex = index;
|
||||
@@ -514,7 +514,7 @@ public class FoldingModelSupport {
|
||||
@NotNull
|
||||
private List<FoldedRangeState> getFoldedRanges(int index, @NotNull Settings settings) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
List<FoldedRangeState> ranges = new ArrayList<FoldedRangeState>();
|
||||
List<FoldedRangeState> ranges = new ArrayList<>();
|
||||
DocumentEx document = myEditors[index].getDocument();
|
||||
|
||||
for (FoldedBlock[] blocks : myFoldings) {
|
||||
@@ -622,7 +622,7 @@ public class FoldingModelSupport {
|
||||
protected class FoldedBlock {
|
||||
@NotNull private final FoldRegion[] myRegions;
|
||||
@NotNull private final int[] myLines;
|
||||
@NotNull private final List<RangeHighlighter> myHighlighters = new ArrayList<RangeHighlighter>(myCount);
|
||||
@NotNull private final List<RangeHighlighter> myHighlighters = new ArrayList<>(myCount);
|
||||
|
||||
public FoldedBlock(@NotNull FoldRegion[] regions) {
|
||||
assert regions.length == myCount;
|
||||
|
||||
@@ -25,8 +25,8 @@ public class SoftHardCacheMap<K, V> {
|
||||
@NotNull private final SoftValueHashMap<K, V> mySoftLinkMap;
|
||||
|
||||
public SoftHardCacheMap(final int protectedQueueSize, final int probationalQueueSize) {
|
||||
mySLRUMap = new SLRUMap<K, V>(protectedQueueSize, probationalQueueSize);
|
||||
mySoftLinkMap = new SoftValueHashMap<K, V>();
|
||||
mySLRUMap = new SLRUMap<>(protectedQueueSize, probationalQueueSize);
|
||||
mySoftLinkMap = new SoftValueHashMap<>();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -35,8 +35,8 @@ public abstract class DiffPanelBase extends JPanel implements DataProvider {
|
||||
@NotNull private final DataProvider myDataProvider;
|
||||
@NotNull protected final DiffContext myContext;
|
||||
|
||||
@NotNull private final List<JComponent> myPersistentNotifications = new ArrayList<JComponent>();
|
||||
@NotNull private final List<JComponent> myNotifications = new ArrayList<JComponent>();
|
||||
@NotNull private final List<JComponent> myPersistentNotifications = new ArrayList<>();
|
||||
@NotNull private final List<JComponent> myNotifications = new ArrayList<>();
|
||||
|
||||
@NotNull protected final JPanel myContentPanel;
|
||||
@NotNull protected final Wrapper myNotificationsPanel;
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.List;
|
||||
public abstract class DiffViewerBase implements DiffViewer, DataProvider {
|
||||
protected static final Logger LOG = Logger.getInstance(DiffViewerBase.class);
|
||||
|
||||
@NotNull private final List<DiffViewerListener> myListeners = new SmartList<DiffViewerListener>();
|
||||
@NotNull private final List<DiffViewerListener> myListeners = new SmartList<>();
|
||||
|
||||
@Nullable protected final Project myProject;
|
||||
@NotNull protected final DiffContext myContext;
|
||||
@@ -209,13 +209,13 @@ public abstract class DiffViewerBase implements DiffViewer, DataProvider {
|
||||
}
|
||||
|
||||
protected List<AnAction> createToolbarActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
ContainerUtil.addAll(group, ((ActionGroup)ActionManager.getInstance().getAction(IdeActions.DIFF_VIEWER_TOOLBAR)).getChildren(null));
|
||||
return group;
|
||||
}
|
||||
|
||||
protected List<AnAction> createPopupActions() {
|
||||
List<AnAction> group = new ArrayList<AnAction>();
|
||||
List<AnAction> group = new ArrayList<>();
|
||||
ContainerUtil.addAll(group, ((ActionGroup)ActionManager.getInstance().getAction(IdeActions.DIFF_VIEWER_POPUP)).getChildren(null));
|
||||
return group;
|
||||
}
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ public abstract class ListenerDiffViewerBase extends DiffViewerBase {
|
||||
|
||||
@Nullable
|
||||
protected VirtualFileListener createFileListener(@NotNull ContentDiffRequest request) {
|
||||
final List<VirtualFile> files = new ArrayList<VirtualFile>(0);
|
||||
final List<VirtualFile> files = new ArrayList<>(0);
|
||||
for (DiffContent content : request.getContents()) {
|
||||
if (content instanceof FileContent && !(content instanceof DocumentContent)) {
|
||||
files.add(((FileContent)content).getFile());
|
||||
@@ -131,7 +131,7 @@ public abstract class ListenerDiffViewerBase extends DiffViewerBase {
|
||||
|
||||
@NotNull
|
||||
private Set<Document> getDocuments() {
|
||||
Set<Document> documents = new HashSet<Document>();
|
||||
Set<Document> documents = new HashSet<>();
|
||||
for (DiffContent content : myRequest.getContents()) {
|
||||
if (content instanceof DocumentContent) {
|
||||
documents.add(((DocumentContent)content).getDocument());
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ public class TextDiffSettingsHolder implements PersistentStateComponent<TextDiff
|
||||
|
||||
@NotNull
|
||||
public static Map<String, PlaceSettings> getDefaultPlaceSettings() {
|
||||
Map<String, PlaceSettings> map = new TreeMap<String, PlaceSettings>();
|
||||
Map<String, PlaceSettings> map = new TreeMap<>();
|
||||
|
||||
PlaceSettings changes = new PlaceSettings();
|
||||
changes.EXPAND_BY_DEFAULT = false;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class TextDiffViewerUtil {
|
||||
|
||||
@NotNull
|
||||
public static List<AnAction> createEditorPopupActions() {
|
||||
List<AnAction> result = new ArrayList<AnAction>();
|
||||
List<AnAction> result = new ArrayList<>();
|
||||
result.add(ActionManager.getInstance().getAction("CompareClipboardWithSelection"));
|
||||
|
||||
result.add(Separator.getInstance());
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ThreesideContentPanel extends JPanel {
|
||||
EditorHolder baseHolder = ThreeSide.BASE.select(holders);
|
||||
myBaseEditor = baseHolder instanceof TextEditorHolder ? ((TextEditorHolder)baseHolder).getEditor() : null;
|
||||
|
||||
ArrayList<JComponent> components = new ArrayList<JComponent>(3);
|
||||
ArrayList<JComponent> components = new ArrayList<>(3);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
components.add(new HolderPanel(holders.get(i), titleComponents.get(i)));
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class ThreesideDiffViewer<T extends EditorHolder> extends Listen
|
||||
protected List<T> createEditorHolders(@NotNull EditorHolderFactory<T> factory) {
|
||||
List<DiffContent> contents = myRequest.getContents();
|
||||
|
||||
List<T> holders = new ArrayList<T>(3);
|
||||
List<T> holders = new ArrayList<>(3);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
DiffContent content = contents.get(i);
|
||||
holders.add(factory.create(content, myContext));
|
||||
|
||||
@@ -94,7 +94,7 @@ public abstract class TwosideDiffViewer<T extends EditorHolder> extends Listener
|
||||
protected List<T> createEditorHolders(@NotNull EditorHolderFactory<T> factory) {
|
||||
List<DiffContent> contents = myRequest.getContents();
|
||||
|
||||
List<T> holders = new ArrayList<T>(2);
|
||||
List<T> holders = new ArrayList<>(2);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
DiffContent content = contents.get(i);
|
||||
holders.add(factory.create(content, myContext));
|
||||
|
||||
@@ -95,7 +95,7 @@ public class DiffDividerDrawUtil {
|
||||
public static List<DividerPolygon> createVisiblePolygons(@NotNull Editor editor1,
|
||||
@NotNull Editor editor2,
|
||||
@NotNull DividerPaintable paintable) {
|
||||
final List<DividerPolygon> polygons = new ArrayList<DividerPolygon>();
|
||||
final List<DividerPolygon> polygons = new ArrayList<>();
|
||||
|
||||
final Transformation[] transformations = new Transformation[]{getTransformation(editor1), getTransformation(editor2)};
|
||||
|
||||
@@ -125,7 +125,7 @@ public class DiffDividerDrawUtil {
|
||||
public static List<DividerSeparator> createVisibleSeparators(@NotNull Editor editor1,
|
||||
@NotNull Editor editor2,
|
||||
@NotNull DividerSeparatorPaintable paintable) {
|
||||
final List<DividerSeparator> separators = new ArrayList<DividerSeparator>();
|
||||
final List<DividerSeparator> separators = new ArrayList<>();
|
||||
|
||||
final Transformation[] transformations = new Transformation[]{getTransformation(editor1), getTransformation(editor2)};
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ public class DiffUtil {
|
||||
return Collections.nCopies(titles.size(), null);
|
||||
}
|
||||
|
||||
List<JComponent> components = new ArrayList<JComponent>(titles.size());
|
||||
List<JComponent> components = new ArrayList<>(titles.size());
|
||||
for (int i = 0; i < contents.size(); i++) {
|
||||
JComponent title = createTitle(StringUtil.notNullize(titles.get(i)));
|
||||
title = createTitleWithNotifications(title, contents.get(i));
|
||||
@@ -387,7 +387,7 @@ public class DiffUtil {
|
||||
boolean equalCharsets = TextDiffViewerUtil.areEqualCharsets(contents);
|
||||
boolean equalSeparators = TextDiffViewerUtil.areEqualLineSeparators(contents);
|
||||
|
||||
List<JComponent> result = new ArrayList<JComponent>(contents.size());
|
||||
List<JComponent> result = new ArrayList<>(contents.size());
|
||||
|
||||
if (equalCharsets && equalSeparators && !ContainerUtil.exists(titles, Condition.NOT_NULL)) {
|
||||
return Collections.nCopies(titles.size(), null);
|
||||
@@ -408,7 +408,7 @@ public class DiffUtil {
|
||||
List<JComponent> notifications = getCustomNotifications(content);
|
||||
if (notifications.isEmpty()) return title;
|
||||
|
||||
List<JComponent> components = new ArrayList<JComponent>();
|
||||
List<JComponent> components = new ArrayList<>();
|
||||
if (title != null) components.add(title);
|
||||
components.addAll(notifications);
|
||||
return createStackedComponents(components, TITLE_GAP);
|
||||
@@ -500,7 +500,7 @@ public class DiffUtil {
|
||||
@NotNull
|
||||
public static List<JComponent> createSyncHeightComponents(@NotNull final List<JComponent> components) {
|
||||
if (!ContainerUtil.exists(components, Condition.NOT_NULL)) return components;
|
||||
List<JComponent> result = new ArrayList<JComponent>();
|
||||
List<JComponent> result = new ArrayList<>();
|
||||
for (int i = 0; i < components.size(); i++) {
|
||||
result.add(new SyncHeightComponent(components, i));
|
||||
}
|
||||
@@ -783,7 +783,7 @@ public class DiffUtil {
|
||||
startLine, endLine, document.getLineCount()));
|
||||
}
|
||||
|
||||
List<String> result = new ArrayList<String>();
|
||||
List<String> result = new ArrayList<>();
|
||||
for (int i = startLine; i < endLine; i++) {
|
||||
int start = document.getLineStartOffset(i);
|
||||
int end = document.getLineEndOffset(i);
|
||||
@@ -1180,7 +1180,7 @@ public class DiffUtil {
|
||||
public static <T extends DiffTool> List<T> filterSuppressedTools(@NotNull List<T> tools) {
|
||||
if (tools.size() < 2) return tools;
|
||||
|
||||
final List<Class<? extends DiffTool>> suppressedTools = new ArrayList<Class<? extends DiffTool>>();
|
||||
final List<Class<? extends DiffTool>> suppressedTools = new ArrayList<>();
|
||||
for (T tool : tools) {
|
||||
try {
|
||||
if (tool instanceof SuppressiveDiffTool) suppressedTools.addAll(((SuppressiveDiffTool)tool).getSuppressedTools());
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TextDiffTypeFactory {
|
||||
new TextDiffTypeImpl(DiffColors.DIFF_CONFLICT, DiffBundle.message("diff.type.conflict.name"));
|
||||
|
||||
private static final TextDiffTypeFactory ourInstance = new TextDiffTypeFactory();
|
||||
private final List<TextDiffTypeImpl> myTypes = new ArrayList<TextDiffTypeImpl>();
|
||||
private final List<TextDiffTypeImpl> myTypes = new ArrayList<>();
|
||||
|
||||
private TextDiffTypeFactory() {
|
||||
ContainerUtil.addAll(myTypes, INSERTED, DELETED, MODIFIED, CONFLICT);
|
||||
|
||||
@@ -69,7 +69,7 @@ public class DTree {
|
||||
public Collection<DTree> getChildren() {
|
||||
init();
|
||||
if (myChildrenList == null) {
|
||||
myChildrenList = new SortedList<DTree>(COMPARATOR);
|
||||
myChildrenList = new SortedList<>(COMPARATOR);
|
||||
myChildrenList.addAll(myChildren.values());
|
||||
}
|
||||
return myChildrenList;
|
||||
@@ -114,7 +114,7 @@ public class DTree {
|
||||
|
||||
private void init() {
|
||||
if (myChildren == null) {
|
||||
myChildren = new HashMap<String, DTree>();
|
||||
myChildren = new HashMap<>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -539,7 +539,7 @@ public class DirDiffPanel implements Disposable, DataProvider {
|
||||
private OpenFileDescriptor[] getOpenFileDescriptorsArray() {
|
||||
Project project = myModel.getProject();
|
||||
List<DirDiffElementImpl> elements = myModel.getSelectedElements();
|
||||
List<OpenFileDescriptor> descriptors = new ArrayList<OpenFileDescriptor>();
|
||||
List<OpenFileDescriptor> descriptors = new ArrayList<>();
|
||||
for (DirDiffElementImpl element : elements) {
|
||||
DiffElement source = element.getSource();
|
||||
DiffElement target = element.getTarget();
|
||||
|
||||
@@ -73,11 +73,11 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
private DiffElement mySrc;
|
||||
private DiffElement myTrg;
|
||||
private DTree myTree;
|
||||
private final List<DirDiffElementImpl> myElements = new ArrayList<DirDiffElementImpl>();
|
||||
private final List<DirDiffElementImpl> myElements = new ArrayList<>();
|
||||
private final AtomicBoolean myUpdating = new AtomicBoolean(false);
|
||||
private JBTable myTable;
|
||||
public String DECORATOR = "DIFF_TABLE_DECORATOR";
|
||||
public final AtomicReference<String> text = new AtomicReference<String>(prepareText(""));
|
||||
public final AtomicReference<String> text = new AtomicReference<>(prepareText(""));
|
||||
private Updater myUpdater;
|
||||
private List<DirDiffModelListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
private TableSelectionConfig mySelectionConfig;
|
||||
@@ -282,7 +282,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
myTree.setTarget(myTrg);
|
||||
myTree.update(mySettings);
|
||||
|
||||
ArrayList<DirDiffElementImpl> elements = new ArrayList<DirDiffElementImpl>();
|
||||
ArrayList<DirDiffElementImpl> elements = new ArrayList<>();
|
||||
fillElements(myTree, elements);
|
||||
myElements.clear();
|
||||
myElements.addAll(elements);
|
||||
@@ -333,7 +333,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
public void run() {
|
||||
if (myDisposed) return;
|
||||
myTree.updateVisibility(mySettings);
|
||||
final ArrayList<DirDiffElementImpl> elements = new ArrayList<DirDiffElementImpl>();
|
||||
final ArrayList<DirDiffElementImpl> elements = new ArrayList<>();
|
||||
fillElements(myTree, elements);
|
||||
final Runnable uiThread = new Runnable() {
|
||||
public void run() {
|
||||
@@ -512,7 +512,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
|
||||
public List<DirDiffElementImpl> getSelectedElements() {
|
||||
final int[] rows = myTable.getSelectedRows();
|
||||
final ArrayList<DirDiffElementImpl> elements = new ArrayList<DirDiffElementImpl>();
|
||||
final ArrayList<DirDiffElementImpl> elements = new ArrayList<>();
|
||||
for (int row : rows) {
|
||||
final DirDiffElementImpl element = getElementAt(row);
|
||||
if (element == null || element.isSeparator()) continue;
|
||||
@@ -604,8 +604,8 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
final String path = element.getParentNode().getPath();
|
||||
|
||||
if (source instanceof BackgroundOperatingDiffElement) {
|
||||
final Ref<String> errorMessage = new Ref<String>();
|
||||
final Ref<DiffElement> diff = new Ref<DiffElement>();
|
||||
final Ref<String> errorMessage = new Ref<>();
|
||||
final Ref<DiffElement> diff = new Ref<>();
|
||||
Runnable onFinish = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -662,8 +662,8 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
final String path = element.getParentNode().getPath();
|
||||
|
||||
if (target instanceof BackgroundOperatingDiffElement) {
|
||||
final Ref<String> errorMessage = new Ref<String>();
|
||||
final Ref<DiffElement> diff = new Ref<DiffElement>();
|
||||
final Ref<String> errorMessage = new Ref<>();
|
||||
final Ref<DiffElement> diff = new Ref<>();
|
||||
Runnable onFinish = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -744,7 +744,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
final DiffElement target = element.getTarget();
|
||||
LOG.assertTrue(source == null || target == null);
|
||||
if (source instanceof BackgroundOperatingDiffElement || target instanceof BackgroundOperatingDiffElement) {
|
||||
final Ref<String> errorMessage = new Ref<String>();
|
||||
final Ref<String> errorMessage = new Ref<>();
|
||||
Runnable onFinish = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -805,7 +805,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode
|
||||
}
|
||||
|
||||
public void synchronizeAll() {
|
||||
List<DirDiffElementImpl> elements = new ArrayList<DirDiffElementImpl>(myElements);
|
||||
List<DirDiffElementImpl> elements = new ArrayList<>(myElements);
|
||||
if (!checkCanDelete(elements)) {
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class ChangeCompareModeGroup extends ComboBoxAction implements ShortcutPr
|
||||
public ChangeCompareModeGroup(DirDiffTableModel model) {
|
||||
mySettings = model.getSettings();
|
||||
getTemplatePresentation().setText(mySettings.compareMode.getPresentableName(mySettings));
|
||||
final ArrayList<ChangeCompareModeAction> actions = new ArrayList<ChangeCompareModeAction>();
|
||||
final ArrayList<ChangeCompareModeAction> actions = new ArrayList<>();
|
||||
if (model.getSettings().showCompareModes) {
|
||||
for (DirDiffSettings.CompareMode mode : DirDiffSettings.CompareMode.values()) {
|
||||
actions.add(new ChangeCompareModeAction(model, mode));
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ public class DirDiffToolbarActions extends ActionGroup {
|
||||
|
||||
public DirDiffToolbarActions(DirDiffTableModel model, JComponent panel) {
|
||||
super("Directory Diff Actions", false);
|
||||
final List<AnAction> actions = new ArrayList<AnAction>(Arrays.asList(
|
||||
final List<AnAction> actions = new ArrayList<>(Arrays.asList(
|
||||
new RefreshDirDiffAction(model),
|
||||
Separator.getInstance(),
|
||||
new EnableLeft(model),
|
||||
|
||||
Reference in New Issue
Block a user