1 package com
.intellij
.openapi
.vcs
.changes
.conflicts
;
3 import com
.intellij
.openapi
.options
.ShowSettingsUtil
;
4 import com
.intellij
.openapi
.project
.Project
;
5 import com
.intellij
.openapi
.ui
.DialogWrapper
;
6 import com
.intellij
.openapi
.vcs
.VcsBundle
;
7 import com
.intellij
.openapi
.vcs
.changes
.ChangeList
;
8 import com
.intellij
.openapi
.vcs
.changes
.ChangeListManager
;
9 import com
.intellij
.openapi
.vcs
.changes
.ChangeListManagerImpl
;
10 import com
.intellij
.openapi
.vcs
.readOnlyHandler
.FileListRenderer
;
11 import com
.intellij
.openapi
.vfs
.VirtualFile
;
12 import com
.intellij
.ui
.CollectionListModel
;
15 import java
.awt
.event
.ActionEvent
;
16 import java
.util
.List
;
19 * @author Dmitry Avdeev
21 public class ChangelistConflictDialog
extends DialogWrapper
{
23 private JPanel myPanel
;
25 private JRadioButton myShelveChangesRadioButton
;
26 private JRadioButton myMoveChangesToActiveRadioButton
;
27 private JRadioButton mySwitchToChangelistRadioButton
;
28 private JRadioButton myIgnoreRadioButton
;
29 private JList myFileList
;
31 private final Project myProject
;
33 public ChangelistConflictDialog(Project project
, List
<ChangeList
> changeLists
, List
<VirtualFile
> conflicts
) {
37 setTitle("Resolve Changelist Conflict");
39 myFileList
.setCellRenderer(new FileListRenderer());
40 myFileList
.setModel(new CollectionListModel(conflicts
));
42 ChangeListManagerImpl manager
= ChangeListManagerImpl
.getInstanceImpl(myProject
);
43 ChangelistConflictResolution resolution
= manager
.getConflictTracker().getOptions().LAST_RESOLUTION
;
45 if (changeLists
.size() > 1) {
46 mySwitchToChangelistRadioButton
.setEnabled(false);
47 if (resolution
== ChangelistConflictResolution
.SWITCH
) {
48 resolution
= ChangelistConflictResolution
.IGNORE
;
51 mySwitchToChangelistRadioButton
.setText(VcsBundle
.message("switch.to.changelist", changeLists
.iterator().next().getName()));
52 myMoveChangesToActiveRadioButton
.setText(VcsBundle
.message("move.to.changelist", manager
.getDefaultChangeList().getName()));
57 myShelveChangesRadioButton
.setSelected(true);
60 myMoveChangesToActiveRadioButton
.setSelected(true);
63 mySwitchToChangelistRadioButton
.setSelected(true) ;
66 myIgnoreRadioButton
.setSelected(true);
73 protected JComponent
createCenterPanel() {
77 public ChangelistConflictResolution
getResolution() {
78 if (myShelveChangesRadioButton
.isSelected())
79 return ChangelistConflictResolution
.SHELVE
;
80 if (myMoveChangesToActiveRadioButton
.isSelected())
81 return ChangelistConflictResolution
.MOVE
;
82 if (mySwitchToChangelistRadioButton
.isSelected())
83 return ChangelistConflictResolution
.SWITCH
;
84 return ChangelistConflictResolution
.IGNORE
;
88 protected Action
[] createLeftSideActions() {
89 return new Action
[] { new AbstractAction("&Configure...") {
90 public void actionPerformed(ActionEvent e
) {
91 ChangeListManagerImpl manager
= (ChangeListManagerImpl
)ChangeListManager
.getInstance(myProject
);
92 ShowSettingsUtil
.getInstance().editConfigurable(myPanel
, new ChangelistConflictConfigurable(manager
));