file history: "Show Details" action
authorDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Tue, 20 Dec 2011 13:07:23 +0000 (17:07 +0400)
committerDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Tue, 20 Dec 2011 13:10:38 +0000 (17:10 +0400)
platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java
platform/vcs-impl/src/com/intellij/openapi/vcs/history/FileHistoryPanelImpl.java

index 0030810d4fb54317ec31df5323f84b9f3548e62c..9cdb8544f8c5f17c12c9aac1abb4aec4c4a78583 100644 (file)
@@ -89,6 +89,7 @@ public final class VcsConfiguration implements PersistentStateComponent<Element>
   public boolean INCLUDE_TEXT_INTO_SHELF = false;
   public boolean CREATE_PATCH_EXPAND_DETAILS_DEFAULT = true;
   public Boolean SHOW_PATCH_IN_EXPLORER = null;
+  public boolean SHOW_FILE_HISTORY_DETAILS = true;
 
   public enum StandardOption {
     ADD(VcsBundle.message("vcs.command.name.add")),
index 0cfcf6df3b906756f3b5f436756fb5e73eb59cbb..3dd441f5850917d28b67df5d2135447649414fef 100644 (file)
@@ -169,6 +169,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
       return DateFormatUtil.formatPrettyDateTime(Clock.getTime());
     }
   };
+  private final Splitter myDetailsSplitter = new Splitter(false, 0.5f);
 
   public void scheduleRefresh() {
     ApplicationManager.getApplication().invokeLater(new Runnable() {
@@ -671,8 +672,7 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
       }
     });
 
-    final Splitter detailsSplitter = new Splitter(false, 0.5f);
-    JPanel commentGroup = new JPanel(new BorderLayout(4, 4));
+    JPanel commentGroup = new JPanel(new BorderLayout());
     final JLabel commentLabel = new JLabel(COMMIT_MESSAGE_TITLE + ":") {
       @Override
       public Dimension getPreferredSize() {
@@ -684,16 +684,27 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
     pane.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.LEFT | (myAdditionalDetails == null ? 0 : SideBorder.BOTTOM)));
 
     commentGroup.add(pane, BorderLayout.CENTER);
-    detailsSplitter.setFirstComponent(commentGroup);
-    detailsSplitter.setSecondComponent(myAdditionalDetails);
+    myDetailsSplitter.setFirstComponent(commentGroup);
+    myDetailsSplitter.setSecondComponent(myAdditionalDetails);
 
-    myDualView.setViewBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.BOTTOM));
 
     mySplitter.setFirstComponent(myDualView);
-    mySplitter.setSecondComponent(detailsSplitter);
+    setupDetails();
     return mySplitter;
   }
 
+  private void setupDetails() {
+    boolean showDetails = getConfiguration().SHOW_FILE_HISTORY_DETAILS;
+    if (showDetails) {
+      myDualView.setViewBorder(IdeBorderFactory.createBorder(SideBorder.LEFT | SideBorder.BOTTOM));
+    }
+    else {
+      myDualView.setViewBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
+    }
+    
+    mySplitter.setSecondComponent(showDetails ? myDetailsSplitter : null);
+  }
+
   private void chooseView() {
     if (showTree()) {
       myDualView.switchToTheTreeMode();
@@ -773,6 +784,18 @@ public class FileHistoryPanelImpl extends PanelWithActionsAndCloseButton {
       }
     }
     result.add(new RefreshFileHistoryAction());
+    result.add(new ToggleAction("Show Details", "Display details panel", IconLoader.getIcon("/actions/showSource.png")) {
+      @Override
+      public boolean isSelected(AnActionEvent e) {
+        return getConfiguration().SHOW_FILE_HISTORY_DETAILS;
+      }
+
+      @Override
+      public void setSelected(AnActionEvent e, boolean state) {
+        getConfiguration().SHOW_FILE_HISTORY_DETAILS = state;
+        setupDetails();
+      }
+    });
 
     if (!popup && supportsTree()) {
       result.add(new MyShowAsTreeAction());