diff --git a/platform/platform-resources-en/src/messages/VcsBundle.properties b/platform/platform-resources-en/src/messages/VcsBundle.properties index db74d4ad899e..7e41623eb76b 100644 --- a/platform/platform-resources-en/src/messages/VcsBundle.properties +++ b/platform/platform-resources-en/src/messages/VcsBundle.properties @@ -533,7 +533,6 @@ vcs.shelf.action.restore.text=Restore vcs.shelf.action.restore.description=Makes selected already unshelved changelist(s) available for unshelve again vcs.shelf.move.text=Move shelves to the new location vcs.shelf.store.base.content=Shelve base revisions of files under distributed version control systems -vcs.shelf.current.file.changes.on.shelf.notification=Show notification in the editor when changes to current file are present on the shelf delete.all.already.unshelved=Delete All Already Unshelved delete.all.already.unshelved.confirmation=Do you want to delete all already unshelved changelists?\nThis operation cannot be undone. highlight.annotation.before.not.selected.text=Show before... diff --git a/platform/platform-resources/src/componentSets/VCS.xml b/platform/platform-resources/src/componentSets/VCS.xml index b0c48c58e7e4..c1b2a504f1f1 100644 --- a/platform/platform-resources/src/componentSets/VCS.xml +++ b/platform/platform-resources/src/componentSets/VCS.xml @@ -102,7 +102,4 @@ com.intellij.openapi.vcs.contentAnnotation.ContentAnnotationCache com.intellij.openapi.vcs.contentAnnotation.ContentAnnotationCacheImpl - - - diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java index af253b198743..e95f479af3dc 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsConfiguration.java @@ -68,7 +68,6 @@ public final class VcsConfiguration implements PersistentStateComponent implements DumbAware { - private static final Key KEY = Key.create("file.changes.present.on.shelf.notification.panel"); - final Project myProject; - - public ShelvedChangesNotificationProvider(Project project) { - myProject = project; - myProject.getMessageBus().connect(project).subscribe(ShelveChangesManager.SHELF_TOPIC, new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - EditorNotifications.getInstance(myProject).updateAllNotifications(); - } - }); - } - - @NotNull - @Override - public Key getKey() { - return KEY; - } - - @Nullable - @Override - public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) { - if (!VcsConfiguration.getInstance(myProject).SHOW_CURRENT_FILE_CHANGES_ON_SHELF) { - return null; - } - final String path = file.getPath(); - final List foundChangeLists = ShelveChangesManager.getInstance(myProject).getShelvedChangeLists() - .stream().filter(l -> findChange(path, l).isPresent()).collect(Collectors.toList()); - if (foundChangeLists.isEmpty()) { - return null; - } - final EditorNotificationPanel notificationPanel = new EditorNotificationPanel(); - final int size = foundChangeLists.size(); - notificationPanel.setText("Changes to this file are present in " + size + " shelved change list" + (size > 1 ? "s" : "")); - final int nameLength = size == 1 ? 50 : size == 2 ? 35 : 20; - foundChangeLists.stream().limit(3).forEach( - l -> notificationPanel.createActionLabel("Show '" + StringUtil.shortenTextWithEllipsis(l.toString(), nameLength, 0, true) + '\'', - () -> findChange(path, l).ifPresent( - c -> ShelvedChangesViewManager.getInstance(myProject).showChangeInView(c)))); - return notificationPanel; - } - - private Optional findChange(String path, ShelvedChangeList shelvedChangeList) { - return shelvedChangeList.getChanges(myProject).stream().filter(c -> path.endsWith(c.getBeforePath())).findAny(); - } -} diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java index 97a2e9f886c5..09dbb91fa770 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java @@ -236,7 +236,7 @@ public class ShelvedChangesViewManager implements ProjectComponent { state.applyTo(myTree); if (myPostUpdateRunnable != null) { myPostUpdateRunnable.run(); - } + } } myPostUpdateRunnable = null; } @@ -302,11 +302,11 @@ public class ShelvedChangesViewManager implements ProjectComponent { private static class ChangelistComparator implements Comparator { private final static ChangelistComparator ourInstance = new ChangelistComparator(); - + public static ChangelistComparator getInstance() { return ourInstance; } - + @Override public int compare(ShelvedChangeList o1, ShelvedChangeList o2) { return o2.DATE.compareTo(o1.DATE); @@ -320,18 +320,10 @@ public class ShelvedChangesViewManager implements ProjectComponent { } } - public void showChangeInView(final ShelvedChange change) { - showTargetInView(change); - } - public void activateView(final ShelvedChangeList list) { - showTargetInView(list); - } - - private void showTargetInView(Object target) { Runnable runnable = () -> { - if (target != null) { - TreeUtil.selectNode(myTree, TreeUtil.findNodeWithObject(myRoot, target)); + if (list != null) { + TreeUtil.selectNode(myTree, TreeUtil.findNodeWithObject(myRoot, list)); } myContentManager.setSelectedContent(myContent); ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID); @@ -442,7 +434,7 @@ public class ShelvedChangesViewManager implements ProjectComponent { if (node.getUserObject() instanceof ShelvedChangeList) { final ShelvedChangeList list = (ShelvedChangeList)node.getUserObject(); if (((! recycled) && (! list.isRecycled())) || - (recycled && list.isRecycled())) { + (recycled && list.isRecycled())) { changeLists.add(list); } } @@ -549,7 +541,7 @@ public class ShelvedChangesViewManager implements ProjectComponent { int count = node.getChildCount(); String numFilesText = spaceAndThinSpace() + count + " " + StringUtil.pluralize("file", count) + ","; append(numFilesText, SimpleTextAttributes.GRAYED_ATTRIBUTES); - + String date = DateFormatUtil.formatPrettyDateTime(changeListData.DATE); append(" " + date, SimpleTextAttributes.GRAYED_ATTRIBUTES); } @@ -797,7 +789,7 @@ public class ShelvedChangesViewManager implements ProjectComponent { if (myCurrentShelvedElement != null) { if (keepBinarySelection(selectedBinaryChanges, myCurrentShelvedElement.getBinaryFile()) || keepShelvedSelection(selectedChanges, myCurrentShelvedElement.getShelvedChange())) { - dropCachesIfNeededAndUpdate(myCurrentShelvedElement); + dropCachesIfNeededAndUpdate(myCurrentShelvedElement); return; } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/ShelfProjectConfigurationPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/ShelfProjectConfigurationPanel.java index e67156973701..7d619238498c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/ShelfProjectConfigurationPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/configurable/ShelfProjectConfigurationPanel.java @@ -18,7 +18,6 @@ package com.intellij.openapi.vcs.configurable; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.VcsBundle; import com.intellij.openapi.vcs.VcsConfiguration; -import com.intellij.ui.EditorNotifications; import com.intellij.ui.JBColor; import com.intellij.ui.components.JBCheckBox; import com.intellij.ui.components.JBLabel; @@ -46,7 +45,6 @@ public class ShelfProjectConfigurationPanel extends JPanel { @NotNull private static final String DEFAULT_LOCATION_HINT = "Default location is "; @NotNull private final VcsConfiguration myVcsConfiguration; @NotNull private final Project myProject; - @NotNull private final JBCheckBox myShowCurrentFileChangesNotification; @NotNull private final JBCheckBox myBaseRevisionTexts; @NotNull private final JLabel myInfoLabel; @@ -54,7 +52,6 @@ public class ShelfProjectConfigurationPanel extends JPanel { super(new BorderLayout()); myProject = project; myVcsConfiguration = VcsConfiguration.getInstance(project); - myShowCurrentFileChangesNotification = new JBCheckBox(VcsBundle.message("vcs.shelf.current.file.changes.on.shelf.notification")); myBaseRevisionTexts = new JBCheckBox(VcsBundle.message("vcs.shelf.store.base.content")); myInfoLabel = new JLabel(); myInfoLabel.setBorder(null); @@ -73,8 +70,6 @@ public class ShelfProjectConfigurationPanel extends JPanel { JPanel contentPanel = new JPanel(new GridBagLayout()); final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 1, 1, NORTHWEST, NONE, JBUI.insets(3), 0, 0); - contentPanel.add(myShowCurrentFileChangesNotification, gb); - gb.gridy++; contentPanel.add(createStoreBaseRevisionOption(), gb); JPanel shelfConfigurablePanel = new JPanel(new BorderLayout(DEFAULT_HGAP, DEFAULT_VGAP)); @@ -123,20 +118,14 @@ public class ShelfProjectConfigurationPanel extends JPanel { } public void restoreFromSettings() { - myShowCurrentFileChangesNotification.setSelected(myVcsConfiguration.SHOW_CURRENT_FILE_CHANGES_ON_SHELF); myBaseRevisionTexts.setSelected(myVcsConfiguration.INCLUDE_TEXT_INTO_SHELF); } public boolean isModified() { - return myVcsConfiguration.SHOW_CURRENT_FILE_CHANGES_ON_SHELF != myShowCurrentFileChangesNotification.isSelected() || - myVcsConfiguration.INCLUDE_TEXT_INTO_SHELF != myBaseRevisionTexts.isSelected(); + return myVcsConfiguration.INCLUDE_TEXT_INTO_SHELF != myBaseRevisionTexts.isSelected(); } public void apply() { - if (myVcsConfiguration.SHOW_CURRENT_FILE_CHANGES_ON_SHELF != myShowCurrentFileChangesNotification.isSelected()) { - EditorNotifications.getInstance(myProject).updateAllNotifications(); - } - myVcsConfiguration.SHOW_CURRENT_FILE_CHANGES_ON_SHELF = myShowCurrentFileChangesNotification.isSelected(); myVcsConfiguration.INCLUDE_TEXT_INTO_SHELF = myBaseRevisionTexts.isSelected(); } }