default implementation of createDefaultSettings

This commit is contained in:
Vladimir Krivosheev
2017-11-30 16:47:49 +01:00
parent d2c2fa7664
commit 8f6f039ada
8 changed files with 16 additions and 141 deletions
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vcs;
@@ -36,7 +22,11 @@ import java.util.List;
*/
public interface CommittedChangesProvider<T extends CommittedChangeList, U extends ChangeBrowserSettings> extends VcsProviderMarker {
@NotNull
U createDefaultSettings();
default U createDefaultSettings() {
//noinspection unchecked
return (U)new ChangeBrowserSettings();
}
ChangesBrowserSettingsEditor<U> createFilterUI(final boolean showDateFilter);
@Nullable
@@ -1,19 +1,4 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vcs.changes.actions;
import com.intellij.openapi.actionSystem.AnAction;
@@ -1,19 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vcs.changes.committed;
import com.intellij.openapi.actionSystem.AnAction;
@@ -46,7 +31,7 @@ import java.util.List;
*/
public class CompositeCommittedChangesProvider implements CommittedChangesProvider<CommittedChangeList, CompositeCommittedChangesProvider.CompositeChangeBrowserSettings> {
private final Project myProject;
private List<AbstractVcs> myBaseVcss = new ArrayList<>();
private List<AbstractVcs> myBaseVcss;
public CompositeCommittedChangesProvider(final Project project, final AbstractVcs... baseVcss) {
myProject = project;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vcs.changes.committed;
import com.intellij.openapi.util.Pair;
@@ -28,7 +14,6 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.vcs.MockContentRevision;
import com.intellij.util.AsynchConsumer;
import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.DataInput;
@@ -43,12 +28,6 @@ public class MockCommittedChangesProvider implements CachingCommittedChangesProv
private final List<CommittedChangeListImpl> myChangeLists = new ArrayList<>();
private int myRefreshCount = 0;
@NotNull
@Override
public ChangeBrowserSettings createDefaultSettings() {
return new ChangeBrowserSettings();
}
@Override
public ChangesBrowserSettingsEditor createFilterUI(final boolean showDateFilter) {
return null;
@@ -125,8 +104,8 @@ public class MockCommittedChangesProvider implements CachingCommittedChangesProv
return list;
}
private CommittedChangeListImpl createList(final String name, final String author, final String comment,
final long date, final long number, final Change... changes) {
private static CommittedChangeListImpl createList(final String name, final String author, final String comment,
final long date, final long number, final Change... changes) {
final Collection<Change> changeList = new ArrayList<>();
Collections.addAll(changeList, changes);
return new CommittedChangeListImpl(name, comment, author, number, new Date(date), changeList);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.cvsSupport2.changeBrowser;
import com.intellij.CvsBundle;
@@ -38,7 +24,6 @@ import com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.AsynchConsumer;
import com.intellij.util.Consumer;
import gnu.trove.TObjectLongHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -63,11 +48,6 @@ public class CvsCommittedChangesProvider implements CachingCommittedChangesProvi
myProject = project;
}
@NotNull
public ChangeBrowserSettings createDefaultSettings() {
return new ChangeBrowserSettings();
}
public ChangesBrowserSettingsEditor<ChangeBrowserSettings> createFilterUI(final boolean showDateFilter) {
return new CvsVersionFilterComponent(showDateFilter);
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package git4idea.changes;
import com.intellij.openapi.diagnostic.Logger;
@@ -63,11 +49,6 @@ public class GitCommittedChangeListProvider implements CommittedChangesProvider<
myProject = project;
}
@NotNull
public ChangeBrowserSettings createDefaultSettings() {
return new ChangeBrowserSettings();
}
public ChangesBrowserSettingsEditor<ChangeBrowserSettings> createFilterUI(boolean showDateFilter) {
return new GitVersionFilterComponent(showDateFilter);
}
@@ -57,11 +57,6 @@ public class HgCommittedChangesProvider implements CommittedChangesProvider<Comm
myVcs = vcs;
}
@NotNull
public ChangeBrowserSettings createDefaultSettings() {
return new ChangeBrowserSettings();
}
public ChangesBrowserSettingsEditor<ChangeBrowserSettings> createFilterUI(boolean showDateFilter) {
return new HgVersionFilterComponent(showDateFilter);
}
@@ -84,7 +79,7 @@ public class HgCommittedChangesProvider implements CommittedChangesProvider<Comm
public void loadCommittedChanges(ChangeBrowserSettings changeBrowserSettings,
RepositoryLocation repositoryLocation,
int maxCount,
final AsynchConsumer<CommittedChangeList> consumer) throws VcsException {
final AsynchConsumer<CommittedChangeList> consumer) {
try {
List<CommittedChangeList> results = getCommittedChanges(changeBrowserSettings, repositoryLocation, maxCount);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.svn.history;
@@ -92,12 +78,6 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
}, project.getDisposed()));
}
@Override
@NotNull
public ChangeBrowserSettings createDefaultSettings() {
return new ChangeBrowserSettings();
}
@Override
@NotNull
public ChangesBrowserSettingsEditor<ChangeBrowserSettings> createFilterUI(boolean showDateFilter) {