mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[log] Expose the VcsLogFilterUi to the API, let set filter value
+ Since VcsLogFilterUi gets into API, remove getFilters from VcsLogUi, substituting it with getFilterUi().
This commit is contained in:
@@ -27,6 +27,7 @@ public interface VcsLogBranchFilter extends VcsLogFilter {
|
||||
@NotNull
|
||||
Collection<String> getBranchNames();
|
||||
|
||||
// TODO remove from the API
|
||||
@NotNull
|
||||
Collection<Integer> getMatchingHeads();
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.intellij.vcs.log;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Graphical UI for filtering commits in the log.
|
||||
*/
|
||||
public interface VcsLogFilterUi {
|
||||
|
||||
/**
|
||||
* Returns the filters currently active, i.e. switched on by user.
|
||||
*/
|
||||
@NotNull
|
||||
VcsLogFilterCollection getFilters();
|
||||
|
||||
/**
|
||||
* Sets the given filter to the given value and updates the log view. <br/>
|
||||
* <b>Note:</b> only VcsLogBranchFilter is currently supported.
|
||||
*/
|
||||
void setFilter(@NotNull VcsLogFilter filter);
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public interface VcsLogUi {
|
||||
|
||||
@NotNull
|
||||
VcsLogFilterCollection getFilters();
|
||||
VcsLogFilterUi getFilterUi();
|
||||
|
||||
@NotNull
|
||||
VcsLogDataPack getDataPack();
|
||||
|
||||
@@ -300,7 +300,6 @@ public class VcsLogUiImpl implements VcsLogUi, Disposable {
|
||||
applyFiltersAndUpdateUi(myDataPack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public VcsLogFilterCollection getFilters() {
|
||||
return myMainFrame.getFilterUi().getFilters();
|
||||
@@ -337,6 +336,12 @@ public class VcsLogUiImpl implements VcsLogUi, Disposable {
|
||||
return myLog;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VcsLogFilterUi getFilterUi() {
|
||||
return myMainFrame.getFilterUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public DataPack getDataPack() {
|
||||
|
||||
+3
-3
@@ -69,7 +69,7 @@ abstract class MultipleValueFilterPopupComponent<Filter extends VcsLogFilter> ex
|
||||
return group;
|
||||
}
|
||||
|
||||
private void apply(@Nullable Collection<String> values, String text, String tooltip) {
|
||||
void apply(@Nullable Collection<String> values, @NotNull String text, @NotNull String tooltip) {
|
||||
mySelectedValues = values;
|
||||
applyFilters();
|
||||
setValue(text, tooltip);
|
||||
@@ -79,7 +79,7 @@ abstract class MultipleValueFilterPopupComponent<Filter extends VcsLogFilter> ex
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String displayableText(@NotNull Collection<String> values) {
|
||||
static String displayableText(@NotNull Collection<String> values) {
|
||||
if (values.size() == 1) {
|
||||
return values.iterator().next();
|
||||
}
|
||||
@@ -87,7 +87,7 @@ abstract class MultipleValueFilterPopupComponent<Filter extends VcsLogFilter> ex
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String tooltip(@NotNull Collection<String> values) {
|
||||
static String tooltip(@NotNull Collection<String> values) {
|
||||
return StringUtil.join(values, ", ");
|
||||
}
|
||||
|
||||
|
||||
+15
-5
@@ -24,8 +24,7 @@ import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.ui.SearchTextField;
|
||||
import com.intellij.ui.SearchTextFieldWithStoredHistory;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.vcs.log.VcsLogFilterCollection;
|
||||
import com.intellij.vcs.log.VcsLogTextFilter;
|
||||
import com.intellij.vcs.log.*;
|
||||
import com.intellij.vcs.log.data.DataPack;
|
||||
import com.intellij.vcs.log.data.VcsLogDataHolder;
|
||||
import com.intellij.vcs.log.data.VcsLogUiProperties;
|
||||
@@ -36,6 +35,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -76,12 +76,14 @@ public class VcsLogClassicFilterUi implements VcsLogFilterUi {
|
||||
myActionGroup.add(new FilterActionComponent(myStructureFilterComponent));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDataPack(@NotNull DataPack dataPack) {
|
||||
myBranchFilterComponent.updateRefsModel(dataPack.getRefsModel());
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Returns filter components which will be added to the Log toolbar.
|
||||
*/
|
||||
@NotNull
|
||||
public ActionGroup getFilterActionComponents() {
|
||||
return myActionGroup;
|
||||
}
|
||||
@@ -94,11 +96,19 @@ public class VcsLogClassicFilterUi implements VcsLogFilterUi {
|
||||
myDateFilterComponent.getFilter(), textFilter, myStructureFilterComponent.getFilter());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilter(@NotNull VcsLogFilter filter) {
|
||||
if (filter instanceof VcsLogBranchFilter) {
|
||||
Collection<String> values = ((VcsLogBranchFilter)filter).getBranchNames();
|
||||
myBranchFilterComponent.apply(values, MultipleValueFilterPopupComponent.displayableText(values),
|
||||
MultipleValueFilterPopupComponent.tooltip(values));
|
||||
}
|
||||
}
|
||||
|
||||
void applyFilters() {
|
||||
myUi.applyFiltersAndUpdateUi();
|
||||
}
|
||||
|
||||
|
||||
private static class TextFilterComponent extends DumbAwareAction implements CustomComponentAction {
|
||||
|
||||
private final SearchTextField mySearchField;
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.intellij.vcs.log.ui.filter;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.vcs.log.VcsLogFilterCollection;
|
||||
import com.intellij.vcs.log.data.DataPack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Graphical UI for filtering commits in the log.
|
||||
*
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
public interface VcsLogFilterUi {
|
||||
|
||||
/**
|
||||
* Returns filter components which will be added to the Log toolbar.
|
||||
*/
|
||||
ActionGroup getFilterActionComponents();
|
||||
|
||||
/**
|
||||
* Returns the filters currently active, i.e. switched on by user.
|
||||
*/
|
||||
@NotNull
|
||||
VcsLogFilterCollection getFilters();
|
||||
|
||||
/**
|
||||
* Informs components that the actual DataPack has been updated (e.g. due to a log refresh). <br/>
|
||||
* Components may want to update their fields and/or rebuild.
|
||||
* @param dataPack new data pack.
|
||||
*/
|
||||
void updateDataPack(@NotNull DataPack dataPack);
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import com.intellij.vcs.log.data.VcsLogDataHolder;
|
||||
import com.intellij.vcs.log.data.VcsLogUiProperties;
|
||||
import com.intellij.vcs.log.ui.VcsLogUiImpl;
|
||||
import com.intellij.vcs.log.ui.filter.VcsLogClassicFilterUi;
|
||||
import com.intellij.vcs.log.ui.filter.VcsLogFilterUi;
|
||||
import com.intellij.vcs.log.VcsLogFilterUi;
|
||||
import com.intellij.vcs.log.ui.tables.GraphTableModel;
|
||||
import icons.VcsLogIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -44,7 +44,7 @@ public class MainFrame extends JPanel implements TypeSafeDataProvider {
|
||||
@NotNull private final Project myProject;
|
||||
@NotNull private final VcsLogUiProperties myUiProperties;
|
||||
@NotNull private final VcsLog myLog;
|
||||
@NotNull private final VcsLogFilterUi myFilterUi;
|
||||
@NotNull private final VcsLogClassicFilterUi myFilterUi;
|
||||
|
||||
@NotNull private final JBLoadingPanel myChangesLoadingPane;
|
||||
@NotNull private final VcsLogGraphTable myGraphTable;
|
||||
|
||||
Reference in New Issue
Block a user