Lines 51-56
Link Here
|
51 |
import java.util.List; |
51 |
import java.util.List; |
52 |
import java.util.logging.Level; |
52 |
import java.util.logging.Level; |
53 |
import java.util.logging.Logger; |
53 |
import java.util.logging.Logger; |
|
|
54 |
import javax.swing.Action; |
54 |
import javax.swing.Icon; |
55 |
import javax.swing.Icon; |
55 |
import javax.swing.JLabel; |
56 |
import javax.swing.JLabel; |
56 |
import javax.swing.JPanel; |
57 |
import javax.swing.JPanel; |
Lines 73-81
Link Here
|
73 |
import org.openide.DialogDisplayer; |
74 |
import org.openide.DialogDisplayer; |
74 |
import org.openide.LifecycleManager; |
75 |
import org.openide.LifecycleManager; |
75 |
import org.openide.NotifyDescriptor; |
76 |
import org.openide.NotifyDescriptor; |
|
|
77 |
import org.openide.awt.Actions; |
76 |
import org.openide.awt.Mnemonics; |
78 |
import org.openide.awt.Mnemonics; |
77 |
import org.openide.awt.NotificationDisplayer; |
79 |
import org.openide.awt.NotificationDisplayer; |
78 |
import org.openide.filesystems.FileChooserBuilder; |
80 |
import org.openide.filesystems.FileChooserBuilder; |
|
|
81 |
import org.openide.filesystems.FileStateInvalidException; |
82 |
import org.openide.filesystems.FileUtil; |
79 |
import org.openide.modules.Places; |
83 |
import org.openide.modules.Places; |
80 |
import org.openide.util.Exceptions; |
84 |
import org.openide.util.Exceptions; |
81 |
import org.openide.util.ImageUtilities; |
85 |
import org.openide.util.ImageUtilities; |
Lines 197-214
Link Here
|
197 |
LOGGER.fine("Export canceled."); //NOI18N |
201 |
LOGGER.fine("Export canceled."); //NOI18N |
198 |
return; |
202 |
return; |
199 |
} |
203 |
} |
|
|
204 |
|
205 |
Action save = Actions.forID("Window", "org.netbeans.core.windows.actions.SaveWindowsAction"); // NOI18N |
206 |
if (save != null) { |
207 |
save.actionPerformed(new ActionEvent(optionsChooserPanel, 0, "")); |
208 |
} |
209 |
|
200 |
final String targetPath = optionsChooserPanel.getSelectedFilePath(); |
210 |
final String targetPath = optionsChooserPanel.getSelectedFilePath(); |
201 |
RequestProcessor RP = new RequestProcessor("OptionsChooserPanel Export", 1); // NOI18N |
211 |
RequestProcessor RP = new RequestProcessor("OptionsChooserPanel Export", 1); // NOI18N |
202 |
Runnable runnable = new Runnable() { |
212 |
Runnable runnable = new Runnable() { |
203 |
@Override |
213 |
@Override |
204 |
public void run() { |
214 |
public void run() { |
205 |
optionsChooserPanel.getOptionsExportModel().doExport(new File(targetPath)); |
215 |
optionsChooserPanel.getOptionsExportModel().doExport(new File(targetPath)); |
206 |
NotificationDisplayer.getDefault().notify( |
216 |
NotificationDisplayer.getDefault().notify( |
207 |
NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.export.status.text"), //NOI18N |
217 |
NbBundle.getMessage(OptionsChooserPanel.class, "OptionsChooserPanel.export.status.text"), //NOI18N |
208 |
OPTIONS_ICON, Bundle.Export_Notification_DetailsText(targetPath), null); |
218 |
OPTIONS_ICON, Bundle.Export_Notification_DetailsText(targetPath), null); |
209 |
LOGGER.fine("Export finished."); //NOI18N |
219 |
LOGGER.fine("Export finished."); //NOI18N |
210 |
} |
220 |
} |
211 |
}; |
221 |
}; |
212 |
exportTask = RP.create(runnable); |
222 |
exportTask = RP.create(runnable); |
213 |
|
223 |
|
214 |
final ProgressHandle ph = ProgressHandleFactory.createHandle(Bundle.ProgressHandle_Export_DisplayName(), exportTask); |
224 |
final ProgressHandle ph = ProgressHandleFactory.createHandle(Bundle.ProgressHandle_Export_DisplayName(), exportTask); |
Lines 224-229
Link Here
|
224 |
} |
234 |
} |
225 |
} |
235 |
} |
226 |
|
236 |
|
|
|
237 |
@NbBundle.Messages({ |
238 |
"OPT_RestartAfterImport=false" |
239 |
}) |
227 |
/** Shows panel for import of options. */ |
240 |
/** Shows panel for import of options. */ |
228 |
public static void showImportDialog() { |
241 |
public static void showImportDialog() { |
229 |
LOGGER.fine("showImportDialog"); //NOI18N |
242 |
LOGGER.fine("showImportDialog"); //NOI18N |
Lines 244-254
Link Here
|
244 |
null); |
257 |
null); |
245 |
dd.createNotificationLineSupport(); |
258 |
dd.createNotificationLineSupport(); |
246 |
dd.setValid(false); |
259 |
dd.setValid(false); |
|
|
260 |
boolean ok; |
261 |
final boolean willRestart = "true".equals(Bundle.OPT_RestartAfterImport()); // NOI18N |
247 |
final ImportConfirmationPanel confirmationPanel = new ImportConfirmationPanel(); |
262 |
final ImportConfirmationPanel confirmationPanel = new ImportConfirmationPanel(); |
248 |
dd.setButtonListener(new ActionListener() { |
263 |
dd.setButtonListener(new ActionListener() { |
249 |
|
264 |
@Override |
250 |
public void actionPerformed(ActionEvent e) { |
265 |
public void actionPerformed(ActionEvent e) { |
251 |
if (e.getSource() == DialogDescriptor.OK_OPTION) { |
266 |
if (willRestart && e.getSource() == DialogDescriptor.OK_OPTION) { |
252 |
// show confirmation dialog when user click OK |
267 |
// show confirmation dialog when user click OK |
253 |
confirmationPanel.showConfirmation(); |
268 |
confirmationPanel.showConfirmation(); |
254 |
} |
269 |
} |
Lines 256-267
Link Here
|
256 |
}); |
271 |
}); |
257 |
optionsChooserPanel.setDialogDescriptor(dd); |
272 |
optionsChooserPanel.setDialogDescriptor(dd); |
258 |
DialogDisplayer.getDefault().createDialog(dd).setVisible(true); |
273 |
DialogDisplayer.getDefault().createDialog(dd).setVisible(true); |
259 |
|
274 |
ok = DialogDescriptor.OK_OPTION.equals(dd.getValue()); |
260 |
if (DialogDescriptor.OK_OPTION.equals(dd.getValue())) { |
275 |
if (willRestart) { |
261 |
if (!confirmationPanel.confirmed()) { |
276 |
if (!confirmationPanel.confirmed()) { |
262 |
LOGGER.fine("Import canceled."); //NOI18N |
277 |
LOGGER.fine("Import canceled."); //NOI18N |
263 |
return; |
278 |
ok = false; |
264 |
} |
279 |
} |
|
|
280 |
} |
281 |
|
282 |
if (ok) { |
265 |
// do import |
283 |
// do import |
266 |
File targetUserdir = Places.getUserDirectory(); |
284 |
File targetUserdir = Places.getUserDirectory(); |
267 |
try { |
285 |
try { |
Lines 274-282
Link Here
|
274 |
return; |
292 |
return; |
275 |
} |
293 |
} |
276 |
LOGGER.fine("Import finished."); //NOI18N |
294 |
LOGGER.fine("Import finished."); //NOI18N |
277 |
// restart IDE |
295 |
if (willRestart) { // NOI18N |
278 |
LifecycleManager.getDefault().markForRestart(); |
296 |
// restart IDE |
279 |
LifecycleManager.getDefault().exit(); |
297 |
LifecycleManager.getDefault().markForRestart(); |
|
|
298 |
LifecycleManager.getDefault().exit(); |
299 |
} |
300 |
try { |
301 |
FileUtil.getConfigRoot().getFileSystem().refresh(true); |
302 |
} catch (FileStateInvalidException ex) { |
303 |
Exceptions.printStackTrace(ex); |
304 |
} |
305 |
Action reload = Actions.forID("Window", "org.netbeans.core.windows.actions.ReloadWindowsAction"); |
306 |
if (reload != null) { |
307 |
reload.actionPerformed(new ActionEvent(optionsChooserPanel, 0, "")); |
308 |
} |
280 |
} |
309 |
} |
281 |
} |
310 |
} |
282 |
|
311 |
|