|
1 /* |
|
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * Export wizard |
|
17 * |
|
18 */ |
|
19 package com.nokia.traceviewer.engine.preferences.wizard; |
|
20 |
|
21 import java.io.File; |
|
22 |
|
23 import org.eclipse.jface.viewers.IStructuredSelection; |
|
24 import org.eclipse.jface.wizard.Wizard; |
|
25 import org.eclipse.ui.IExportWizard; |
|
26 import org.eclipse.ui.IWorkbench; |
|
27 |
|
28 import com.nokia.traceviewer.engine.TraceViewerGlobals; |
|
29 import com.nokia.traceviewer.engine.preferences.XMLColorConfigurationExporter; |
|
30 import com.nokia.traceviewer.engine.preferences.XMLFilterConfigurationExporter; |
|
31 import com.nokia.traceviewer.engine.preferences.XMLLineCountConfigurationExporter; |
|
32 import com.nokia.traceviewer.engine.preferences.XMLTriggerConfigurationExporter; |
|
33 import com.nokia.traceviewer.engine.preferences.XMLVariableTracingConfigurationExporter; |
|
34 |
|
35 /** |
|
36 * Wizard for exporting TraceViewer configurations to a file |
|
37 */ |
|
38 public class ExportWizard extends Wizard implements IExportWizard { |
|
39 |
|
40 /** |
|
41 * Export page |
|
42 */ |
|
43 private ExportPage exportPage; |
|
44 |
|
45 /* |
|
46 * (non-Javadoc) |
|
47 * |
|
48 * @see org.eclipse.jface.wizard.Wizard#performFinish() |
|
49 */ |
|
50 @Override |
|
51 public boolean performFinish() { |
|
52 boolean success = false; |
|
53 File file = exportPage.getFile(); |
|
54 if (file != null) { |
|
55 String fn = file.getAbsolutePath(); |
|
56 |
|
57 // Export Filter rules to XML file |
|
58 XMLFilterConfigurationExporter filterExporter = new XMLFilterConfigurationExporter( |
|
59 TraceViewerGlobals.getTraceViewer() |
|
60 .getDataProcessorAccess().getFilterProcessor() |
|
61 .getRoot(), fn, false); |
|
62 filterExporter.export(); |
|
63 |
|
64 // Export Color rules to XML file |
|
65 XMLColorConfigurationExporter colorExporter = new XMLColorConfigurationExporter( |
|
66 TraceViewerGlobals.getTraceViewer() |
|
67 .getDataProcessorAccess().getColorer().getRoot(), |
|
68 fn, false); |
|
69 colorExporter.export(); |
|
70 |
|
71 // Export LineCount rules to XML file |
|
72 XMLLineCountConfigurationExporter countExporter = new XMLLineCountConfigurationExporter( |
|
73 TraceViewerGlobals.getTraceViewer() |
|
74 .getDataProcessorAccess().getLineCountProcessor() |
|
75 .getRoot(), fn, false); |
|
76 countExporter.export(); |
|
77 |
|
78 // Export Variable Tracing rules to XML file |
|
79 XMLVariableTracingConfigurationExporter var = new XMLVariableTracingConfigurationExporter( |
|
80 TraceViewerGlobals.getTraceViewer() |
|
81 .getDataProcessorAccess() |
|
82 .getVariableTracingProcessor().getRoot(), fn, false); |
|
83 var.export(); |
|
84 |
|
85 // Export Trigger rules to XML file |
|
86 XMLTriggerConfigurationExporter triggerExporter = new XMLTriggerConfigurationExporter( |
|
87 TraceViewerGlobals.getTraceViewer() |
|
88 .getDataProcessorAccess().getTriggerProcessor() |
|
89 .getRoot(), fn, false); |
|
90 triggerExporter.export(); |
|
91 |
|
92 // Inform about export succesful |
|
93 String exported = Messages.getString("ExportWizard.Emsg"); //$NON-NLS-1$ |
|
94 TraceViewerGlobals.getTraceViewer().getDialogs() |
|
95 .showInformationMessage(exported); |
|
96 success = true; |
|
97 } |
|
98 |
|
99 return success; |
|
100 } |
|
101 |
|
102 /* |
|
103 * (non-Javadoc) |
|
104 * |
|
105 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, |
|
106 * org.eclipse.jface.viewers.IStructuredSelection) |
|
107 */ |
|
108 public void init(IWorkbench workbench, IStructuredSelection selection) { |
|
109 setWindowTitle(Messages.getString("ExportWizard.ExportTitle")); //$NON-NLS-1$ |
|
110 exportPage = new ExportPage(); |
|
111 addPage(exportPage); |
|
112 } |
|
113 |
|
114 } |