1 package git4idea
.rebase
;
3 import com
.intellij
.openapi
.project
.Project
;
4 import com
.intellij
.openapi
.ui
.DialogWrapper
;
5 import com
.intellij
.openapi
.util
.io
.FileUtil
;
6 import com
.intellij
.openapi
.vfs
.VirtualFile
;
7 import git4idea
.config
.GitConfigUtil
;
8 import git4idea
.i18n
.GitBundle
;
12 import java
.io
.IOException
;
15 * The dialog used for the unstructured information from git rebase.
17 public class GitRebaseUnstructuredEditor
extends DialogWrapper
{
19 * The text with information from the GIT
21 private JTextArea myTextArea
;
23 * The root panel of the dialog
25 private JPanel myPanel
;
27 * The label that contains the git root path
29 private JLabel myGitRootLabel
;
33 private final String encoding
;
35 * The file being edited
37 private final File myFile
;
42 * @param project the context project
43 * @param root the Git root
44 * @param path the path to edit
45 * @throws IOException if there is an IO problem
47 protected GitRebaseUnstructuredEditor(Project project
, VirtualFile root
, String path
) throws IOException
{
49 setTitle(GitBundle
.message("rebase.unstructured.editor.title"));
50 setOKButtonText(GitBundle
.message("rebase.unstructured.editor.button"));
51 myGitRootLabel
.setText(root
.getPresentableUrl());
52 encoding
= GitConfigUtil
.getCommitEncoding(project
, root
);
53 myFile
= new File(path
);
54 myTextArea
.setText(new String(FileUtil
.loadFileText(myFile
, encoding
)));
59 * Save content to the file
61 * @throws IOException if there is an IO problem
63 public void save() throws IOException
{
64 FileUtil
.writeToFile(myFile
, myTextArea
.getText().getBytes(encoding
));
70 protected JComponent
createCenterPanel() {
78 protected String
getDimensionServiceKey() {
79 return getClass().getName();