mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] stop keeping sort type in two separate booleans
This commit is contained in:
@@ -98,8 +98,7 @@ public class VcsLogDataHolder implements Disposable, VcsLogDataProvider {
|
||||
myContainingBranchesGetter = new ContainingBranchesGetter(this, this);
|
||||
|
||||
myFilterer = new VcsLogFiltererImpl(myProject, myLogProviders, myHashMap, myTopCommitsDetailsCache, myDetailsGetter,
|
||||
uiProperties.isBek() ? (uiProperties.isLinearBek() ? PermanentGraph.SortType.LinearBek : PermanentGraph.SortType.Bek) : PermanentGraph.SortType.Normal,
|
||||
visiblePackConsumer);
|
||||
PermanentGraph.SortType.values()[uiProperties.getBekSortType()], visiblePackConsumer);
|
||||
|
||||
myDataPackUpdateHandler = new Consumer<DataPack>() {
|
||||
@Override
|
||||
@@ -108,15 +107,16 @@ public class VcsLogDataHolder implements Disposable, VcsLogDataProvider {
|
||||
}
|
||||
};
|
||||
|
||||
myRefresher = new VcsLogRefresherImpl(myProject, myHashMap, myLogProviders, myUserRegistry, myTopCommitsDetailsCache,
|
||||
myDataPackUpdateHandler, new Consumer<Exception>() {
|
||||
@Override
|
||||
public void consume(Exception e) {
|
||||
if (!(e instanceof ProcessCanceledException)) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
}, mySettings.getRecentCommitsCount());
|
||||
myRefresher =
|
||||
new VcsLogRefresherImpl(myProject, myHashMap, myLogProviders, myUserRegistry, myTopCommitsDetailsCache, myDataPackUpdateHandler,
|
||||
new Consumer<Exception>() {
|
||||
@Override
|
||||
public void consume(Exception e) {
|
||||
if (!(e instanceof ProcessCanceledException)) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
}, mySettings.getRecentCommitsCount());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -45,8 +45,7 @@ public class VcsLogUiProperties implements PersistentStateComponent<VcsLogUiProp
|
||||
public static class State {
|
||||
public boolean SHOW_DETAILS = true;
|
||||
public boolean LONG_EDGES_VISIBLE = false;
|
||||
public boolean BEK_SORT = false;
|
||||
public boolean LINEAR_BEK_SORT = false;
|
||||
public int BEK_SORT_TYPE = 0;
|
||||
public boolean SHOW_ROOT_NAMES = false;
|
||||
public Deque<UserGroup> RECENTLY_FILTERED_USER_GROUPS = new ArrayDeque<UserGroup>();
|
||||
public Deque<UserGroup> RECENTLY_FILTERED_BRANCH_GROUPS = new ArrayDeque<UserGroup>();
|
||||
@@ -123,20 +122,12 @@ public class VcsLogUiProperties implements PersistentStateComponent<VcsLogUiProp
|
||||
myState.LONG_EDGES_VISIBLE = visible;
|
||||
}
|
||||
|
||||
public boolean isBek() {
|
||||
return myState.BEK_SORT;
|
||||
public int getBekSortType() {
|
||||
return myState.BEK_SORT_TYPE;
|
||||
}
|
||||
|
||||
public void setBek(boolean isBek) {
|
||||
myState.BEK_SORT = isBek;
|
||||
}
|
||||
|
||||
public boolean isLinearBek() {
|
||||
return myState.LINEAR_BEK_SORT;
|
||||
}
|
||||
|
||||
public void setLinearBek(boolean isBek) {
|
||||
myState.LINEAR_BEK_SORT = isBek;
|
||||
public void setBek(int bekSortType) {
|
||||
myState.BEK_SORT_TYPE = bekSortType;
|
||||
}
|
||||
|
||||
public boolean isShowRootNames() {
|
||||
|
||||
@@ -175,22 +175,13 @@ public class VcsLogUiImpl implements VcsLogUi, Disposable {
|
||||
myUiProperties.setLongEdgesVisibility(visibility);
|
||||
}
|
||||
|
||||
public void setBek(boolean bek) {
|
||||
myUiProperties.setBek(bek);
|
||||
myFilterer.onSortTypeChange(bek ? PermanentGraph.SortType.Bek : PermanentGraph.SortType.Normal);
|
||||
public void setBek(PermanentGraph.SortType bekType) {
|
||||
myUiProperties.setBek(bekType.ordinal());
|
||||
myFilterer.onSortTypeChange(bekType);
|
||||
}
|
||||
|
||||
public boolean isBek() {
|
||||
return myUiProperties.isBek();
|
||||
}
|
||||
|
||||
public void setLinearBek(boolean bek) {
|
||||
myUiProperties.setLinearBek(bek);
|
||||
myFilterer.onSortTypeChange(bek ? PermanentGraph.SortType.LinearBek : PermanentGraph.SortType.Bek);
|
||||
}
|
||||
|
||||
public boolean isLinearBek() {
|
||||
return myUiProperties.isLinearBek();
|
||||
public PermanentGraph.SortType getBekType() {
|
||||
return PermanentGraph.SortType.values()[myUiProperties.getBekSortType()];
|
||||
}
|
||||
|
||||
public void setShowRootNames(boolean isShowRootNames) {
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.vcs.log.*;
|
||||
import com.intellij.vcs.log.data.VcsLogDataHolder;
|
||||
import com.intellij.vcs.log.data.VcsLogUiProperties;
|
||||
import com.intellij.vcs.log.data.VisiblePack;
|
||||
import com.intellij.vcs.log.graph.PermanentGraph;
|
||||
import com.intellij.vcs.log.graph.impl.facade.bek.BekSorter;
|
||||
import com.intellij.vcs.log.ui.VcsLogUiImpl;
|
||||
import com.intellij.vcs.log.ui.filter.VcsLogClassicFilterUi;
|
||||
@@ -336,12 +337,12 @@ public class MainFrame extends JPanel implements TypeSafeDataProvider {
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return myUI.isBek();
|
||||
return !myUI.getBekType().equals(PermanentGraph.SortType.Normal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
myUI.setBek(state);
|
||||
myUI.setBek(state ? PermanentGraph.SortType.Bek : PermanentGraph.SortType.Normal);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -359,19 +360,19 @@ public class MainFrame extends JPanel implements TypeSafeDataProvider {
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
return myUI.isLinearBek();
|
||||
return myUI.getBekType().equals(PermanentGraph.SortType.LinearBek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
myUI.setLinearBek(state);
|
||||
myUI.setBek(state ? PermanentGraph.SortType.LinearBek : PermanentGraph.SortType.Bek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
super.update(e);
|
||||
e.getPresentation().setVisible(BekSorter.isLinearBekEnabled());
|
||||
e.getPresentation().setEnabled(areGraphActionsEnabled() && myUI.isBek());
|
||||
e.getPresentation().setEnabled(areGraphActionsEnabled() && myUI.getBekType() != PermanentGraph.SortType.Normal);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user