This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 125825
Collapse All | Expand All

(-)versioncontrol/mercurial/src/org/netbeans/modules/mercurial/HgModuleConfig.java (-1 / +19 lines)
Lines 68-73 Link Here
68
    public static final String PROP_RUN_VERSION             = "runVersion";                                 // NOI18N
68
    public static final String PROP_RUN_VERSION             = "runVersion";                                 // NOI18N
69
    public static final String KEY_EXECUTABLE_BINARY        = "hgExecBinary";                              // NOI18N
69
    public static final String KEY_EXECUTABLE_BINARY        = "hgExecBinary";                              // NOI18N
70
    public static final String KEY_EXPORT_FILENAME          = "hgExportFilename";                          // NOI18N
70
    public static final String KEY_EXPORT_FILENAME          = "hgExportFilename";                          // NOI18N
71
    public static final String KEY_EXPORT_FOLDER            = "hgExportFolder";                          // NOI18N
72
    public static final String KEY_IMPORT_FOLDER            = "hgImportFolder";                          // NOI18N
71
    public static final String KEY_ANNOTATION_FORMAT        = "annotationFormat";                           // NOI18N
73
    public static final String KEY_ANNOTATION_FORMAT        = "annotationFormat";                           // NOI18N
72
    public static final String SAVE_PASSWORD                = "savePassword";                               // NOI18N
74
    public static final String SAVE_PASSWORD                = "savePassword";                               // NOI18N
73
    public static final String KEY_BACKUP_ON_REVERTMODS = "backupOnRevert";                               // NOI18N
75
    public static final String KEY_BACKUP_ON_REVERTMODS = "backupOnRevert";                               // NOI18N
Lines 83-89 Link Here
83
    
85
    
84
    public static final String TEXT_ANNOTATIONS_FORMAT_DEFAULT = "{DEFAULT}";                               // NOI18N           
86
    public static final String TEXT_ANNOTATIONS_FORMAT_DEFAULT = "{DEFAULT}";                               // NOI18N           
85
87
86
    private static final String DEFAULT_EXPORT_FILENAME = "/tmp/%b_%r_%h";                                  // NOI18N
88
    private static final String DEFAULT_EXPORT_FILENAME = "%b_%r_%h";                                  // NOI18N
87
    private static final HgModuleConfig INSTANCE = new HgModuleConfig();    
89
    private static final HgModuleConfig INSTANCE = new HgModuleConfig();    
88
    
90
    
89
    private static String userName;
91
    private static String userName;
Lines 151-156 Link Here
151
        getPreferences().put(KEY_EXECUTABLE_BINARY, path);
153
        getPreferences().put(KEY_EXECUTABLE_BINARY, path);
152
    }
154
    }
153
155
156
    public String getExportFolder() {
157
        return (String) getPreferences().get(KEY_EXPORT_FOLDER, System.getProperty("user.home")); // NOI18N
158
    }
159
    
160
    public void setExportFolder(String path) {
161
        getPreferences().put(KEY_EXPORT_FOLDER, path);
162
    }
163
164
    public String getImportFolder() {
165
        return (String) getPreferences().get(KEY_IMPORT_FOLDER, System.getProperty("user.home")); // NOI18N
166
    }
167
    
168
    public void setImportFolder(String path) {
169
        getPreferences().put(KEY_IMPORT_FOLDER, path);
170
    }
171
154
    public String getExportFilename() {
172
    public String getExportFilename() {
155
        String str = (String) getPreferences().get(KEY_EXPORT_FILENAME, ""); // NOI18N
173
        String str = (String) getPreferences().get(KEY_EXPORT_FILENAME, ""); // NOI18N
156
        if (str.trim().length() == 0) str = DEFAULT_EXPORT_FILENAME;
174
        if (str.trim().length() == 0) str = DEFAULT_EXPORT_FILENAME;
(-)versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffAction.java (+3 lines)
Lines 50-55 Link Here
50
import org.netbeans.modules.mercurial.HgException;
50
import org.netbeans.modules.mercurial.HgException;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.HgModuleConfig;
53
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
55
import org.netbeans.modules.mercurial.util.HgCommand;
56
import org.netbeans.modules.mercurial.util.HgCommand;
Lines 102-107 Link Here
102
        }
103
        }
103
        final String revStr = ed.getSelectionRevision();
104
        final String revStr = ed.getSelectionRevision();
104
        final String outputFileName = ed.getOutputFileName();
105
        final String outputFileName = ed.getOutputFileName();
106
        File outputFile = new File(outputFileName);
107
        HgModuleConfig.getDefault().setExportFolder(outputFile.getParent());
105
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root.getAbsolutePath());
108
        RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root.getAbsolutePath());
106
        HgProgressSupport support = new HgProgressSupport() {
109
        HgProgressSupport support = new HgProgressSupport() {
107
            public void perform() {
110
            public void perform() {
(-)versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ExportDiffPanel.java (-1 / +5 lines)
Lines 174-180 Link Here
174
    }
174
    }
175
175
176
    private void getDefaultOutputFile() {
176
    private void getDefaultOutputFile() {
177
        outputFileTextField.setText(HgModuleConfig.getDefault().getExportFilename());
177
        String folderName = HgModuleConfig.getDefault().getExportFolder();
178
        String fileName = HgModuleConfig.getDefault().getExportFilename();
179
        File file = new File(folderName, fileName);
180
        outputFileTextField.setText(file.getAbsolutePath());
178
    }
181
    }
179
182
180
    private void refreshRevisions() {
183
    private void refreshRevisions() {
Lines 219-224 Link Here
219
            fileChooser.removeChoosableFileFilter(fileFilter);
222
            fileChooser.removeChoosableFileFilter(fileFilter);
220
223
221
        }
224
        }
225
        fileChooser.setCurrentDirectory(new File(HgModuleConfig.getDefault().getExportFolder()));
222
        fileChooser.showDialog(this, NbBundle.getMessage(ExportDiffPanel.class, "OK_Button"));                                            // NO I18N
226
        fileChooser.showDialog(this, NbBundle.getMessage(ExportDiffPanel.class, "OK_Button"));                                            // NO I18N
223
        File f = fileChooser.getSelectedFile();
227
        File f = fileChooser.getSelectedFile();
224
        if (f != null) {
228
        if (f != null) {
(-)versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/diff/ImportDiffAction.java (+4 lines)
Lines 50-55 Link Here
50
import org.netbeans.modules.mercurial.HgException;
50
import org.netbeans.modules.mercurial.HgException;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
51
import org.netbeans.modules.mercurial.HgProgressSupport;
52
import org.netbeans.modules.mercurial.Mercurial;
52
import org.netbeans.modules.mercurial.Mercurial;
53
import org.netbeans.modules.mercurial.HgModuleConfig;
53
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgUtils;
54
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
55
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
55
import org.netbeans.modules.mercurial.util.HgCommand;
56
import org.netbeans.modules.mercurial.util.HgCommand;
Lines 108-116 Link Here
108
            fileChooser.removeChoosableFileFilter(fileFilter);
109
            fileChooser.removeChoosableFileFilter(fileFilter);
109
110
110
        }
111
        }
112
       fileChooser.setCurrentDirectory(new File(HgModuleConfig.getDefault().getImportFolder()));
113
111
        if (fileChooser.showDialog(null, NbBundle.getMessage(ImportDiffAction.class, "OK_Button")) == JFileChooser.APPROVE_OPTION) { // NO I18N
114
        if (fileChooser.showDialog(null, NbBundle.getMessage(ImportDiffAction.class, "OK_Button")) == JFileChooser.APPROVE_OPTION) { // NO I18N
112
            final File patchFile = fileChooser.getSelectedFile();
115
            final File patchFile = fileChooser.getSelectedFile();
113
116
117
            HgModuleConfig.getDefault().setImportFolder(patchFile.getParent());
114
            if (patchFile != null) {
118
            if (patchFile != null) {
115
                RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root.getAbsolutePath());
119
                RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root.getAbsolutePath());
116
                HgProgressSupport support = new HgProgressSupport() {
120
                HgProgressSupport support = new HgProgressSupport() {

Return to bug 125825