[vcs-log] remove ugly MainVcsLogUiPropertiesListener

This commit is contained in:
Julia Beliaeva
2018-05-09 19:31:33 +03:00
parent 0cbffa8f2a
commit dcfd3f6707
2 changed files with 43 additions and 115 deletions
@@ -256,68 +256,4 @@ public abstract class VcsLogUiPropertiesImpl implements PersistentStateComponent
public boolean REGEX = false;
public boolean MATCH_CASE = false;
}
public abstract static class MainVcsLogUiPropertiesListener implements PropertiesChangeListener {
public abstract void onShowDetailsChanged();
public abstract void onShowLongEdgesChanged();
public abstract void onBekChanged();
public abstract void onShowRootNamesChanged();
public abstract void onCompactReferencesViewChanged();
public abstract void onShowTagNamesChanged();
public abstract void onTextFilterSettingsChanged();
public abstract void onHighlighterChanged();
public abstract void onColumnWidthChanged(int column);
public abstract void onColumnOrderChanged();
public abstract void onShowChangesFromParentsChanged();
@Override
public <T> void onPropertyChanged(@NotNull VcsLogUiProperties.VcsLogUiProperty<T> property) {
if (CommonUiProperties.SHOW_DETAILS.equals(property)) {
onShowDetailsChanged();
}
else if (SHOW_LONG_EDGES.equals(property)) {
onShowLongEdgesChanged();
}
else if (CommonUiProperties.SHOW_ROOT_NAMES.equals(property)) {
onShowRootNamesChanged();
}
else if (COMPACT_REFERENCES_VIEW.equals(property)) {
onCompactReferencesViewChanged();
}
else if (SHOW_TAG_NAMES.equals(property)) {
onShowTagNamesChanged();
}
else if (BEK_SORT_TYPE.equals(property)) {
onBekChanged();
}
else if (TEXT_FILTER_REGEX.equals(property) || TEXT_FILTER_MATCH_CASE.equals(property)) {
onTextFilterSettingsChanged();
}
else if (CommonUiProperties.COLUMN_ORDER.equals(property)) {
onColumnOrderChanged();
}
else if (property instanceof VcsLogHighlighterProperty) {
onHighlighterChanged();
}
else if (property instanceof CommonUiProperties.TableColumnProperty) {
onColumnWidthChanged(((CommonUiProperties.TableColumnProperty)property).getColumn());
}
else if (SHOW_CHANGES_FROM_PARENTS.equals(property)) {
onShowChangesFromParentsChanged();
}
else {
throw new UnsupportedOperationException("Property " + property + " does not exist");
}
}
}
}
@@ -14,7 +14,7 @@ import com.intellij.vcs.log.graph.actions.GraphAnswer;
import com.intellij.vcs.log.impl.CommonUiProperties;
import com.intellij.vcs.log.impl.MainVcsLogUiProperties;
import com.intellij.vcs.log.impl.MainVcsLogUiProperties.VcsLogHighlighterProperty;
import com.intellij.vcs.log.impl.VcsLogUiPropertiesImpl;
import com.intellij.vcs.log.impl.VcsLogUiProperties;
import com.intellij.vcs.log.ui.frame.MainFrame;
import com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory;
import com.intellij.vcs.log.ui.table.GraphTableModel;
@@ -28,7 +28,7 @@ import java.awt.*;
public class VcsLogUiImpl extends AbstractVcsLogUi {
@NotNull private final MainVcsLogUiProperties myUiProperties;
@NotNull private final MainFrame myMainFrame;
@NotNull private final VcsLogUiPropertiesImpl.MainVcsLogUiPropertiesListener myPropertiesListener;
@NotNull private final MyVcsLogUiPropertiesListener myPropertiesListener;
public VcsLogUiImpl(@NotNull String id,
@NotNull VcsLogData logData,
@@ -149,59 +149,51 @@ public class VcsLogUiImpl extends AbstractVcsLogUi {
super.dispose();
}
private class MyVcsLogUiPropertiesListener extends VcsLogUiPropertiesImpl.MainVcsLogUiPropertiesListener {
@Override
public void onShowDetailsChanged() {
myMainFrame.showDetails(myUiProperties.get(CommonUiProperties.SHOW_DETAILS));
}
private class MyVcsLogUiPropertiesListener implements VcsLogUiProperties.PropertiesChangeListener {
@Override
public void onShowLongEdgesChanged() {
myVisiblePack.getVisibleGraph().getActionController().setLongEdgesHidden(!myUiProperties.get(MainVcsLogUiProperties.SHOW_LONG_EDGES));
public <T> void onPropertyChanged(@NotNull VcsLogUiProperties.VcsLogUiProperty<T> property) {
if (CommonUiProperties.SHOW_DETAILS.equals(property)) {
myMainFrame.showDetails(myUiProperties.get(CommonUiProperties.SHOW_DETAILS));
}
else if (MainVcsLogUiProperties.SHOW_LONG_EDGES.equals(property)) {
onShowLongEdgesChanged();
}
else if (CommonUiProperties.SHOW_ROOT_NAMES.equals(property)) {
myMainFrame.getGraphTable().rootColumnUpdated();
}
else if (MainVcsLogUiProperties.COMPACT_REFERENCES_VIEW.equals(property)) {
myMainFrame.getGraphTable().setCompactReferencesView(myUiProperties.get(MainVcsLogUiProperties.COMPACT_REFERENCES_VIEW));
}
else if (MainVcsLogUiProperties.SHOW_TAG_NAMES.equals(property)) {
myMainFrame.getGraphTable().setShowTagNames(myUiProperties.get(MainVcsLogUiProperties.SHOW_TAG_NAMES));
}
else if (MainVcsLogUiProperties.BEK_SORT_TYPE.equals(property)) {
myRefresher.onSortTypeChange(myUiProperties.get(MainVcsLogUiProperties.BEK_SORT_TYPE));
}
else if (MainVcsLogUiProperties.TEXT_FILTER_REGEX.equals(property) ||
MainVcsLogUiProperties.TEXT_FILTER_MATCH_CASE.equals(property)) {
applyFiltersAndUpdateUi(myMainFrame.getFilterUi().getFilters());
}
else if (CommonUiProperties.COLUMN_ORDER.equals(property)) {
myMainFrame.getGraphTable().onColumnOrderSettingChanged();
}
else if (property instanceof VcsLogHighlighterProperty) {
myMainFrame.getGraphTable().repaint();
}
else if (property instanceof CommonUiProperties.TableColumnProperty) {
myMainFrame.getGraphTable().forceReLayout(((CommonUiProperties.TableColumnProperty)property).getColumn());
}
else if (MainVcsLogUiProperties.SHOW_CHANGES_FROM_PARENTS.equals(property)) {
}
else {
throw new UnsupportedOperationException("Property " + property + " does not exist");
}
}
@Override
public void onBekChanged() {
myRefresher.onSortTypeChange(myUiProperties.get(MainVcsLogUiProperties.BEK_SORT_TYPE));
}
@Override
public void onShowRootNamesChanged() {
myMainFrame.getGraphTable().rootColumnUpdated();
}
@Override
public void onHighlighterChanged() {
myMainFrame.getGraphTable().repaint();
}
@Override
public void onCompactReferencesViewChanged() {
myMainFrame.getGraphTable().setCompactReferencesView(myUiProperties.get(MainVcsLogUiProperties.COMPACT_REFERENCES_VIEW));
}
@Override
public void onShowTagNamesChanged() {
myMainFrame.getGraphTable().setShowTagNames(myUiProperties.get(MainVcsLogUiProperties.SHOW_TAG_NAMES));
}
@Override
public void onColumnWidthChanged(int column) {
myMainFrame.getGraphTable().forceReLayout(column);
}
@Override
public void onColumnOrderChanged() {
myMainFrame.getGraphTable().onColumnOrderSettingChanged();
}
@Override
public void onShowChangesFromParentsChanged() {
}
@Override
public void onTextFilterSettingsChanged() {
applyFiltersAndUpdateUi(myMainFrame.getFilterUi().getFilters());
private void onShowLongEdgesChanged() {
myVisiblePack.getVisibleGraph().getActionController()
.setLongEdgesHidden(!myUiProperties.get(MainVcsLogUiProperties.SHOW_LONG_EDGES));
}
}
}