Révision 1778
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swt/SVGComposite.java (revision 1778) | ||
---|---|---|
2 | 2 |
import java.io.File; |
3 | 3 |
import java.net.MalformedURLException; |
4 | 4 |
|
5 |
import javax.swing.SwingUtilities; |
|
6 |
|
|
5 | 7 |
import org.eclipse.swt.widgets.Composite; |
6 | 8 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
7 | 9 |
import org.txm.chartsengine.rcp.swt.SwingChartComposite; |
... | ... | |
51 | 53 |
* Loads a SVG document from the specified file. |
52 | 54 |
* @param file the file to load |
53 | 55 |
*/ |
54 |
public void loadSVGDocument(File file) { |
|
56 |
public void loadSVGDocument(final File file) {
|
|
55 | 57 |
if(file == null) { |
56 | 58 |
Log.severe("SVG File doesn't exist."); |
57 | 59 |
return; |
58 | 60 |
} |
59 | 61 |
this.file = file; |
60 | 62 |
Log.fine(TXMCoreMessages.bind("Loading SVG document from file: {0}...", file.getAbsolutePath())); |
61 |
try { |
|
63 |
|
|
62 | 64 |
if (ValidateXml.test(file)) { |
63 |
this.getPanel().loadSVGDocument(file.toURL().toExternalForm()); |
|
65 |
SwingUtilities.invokeLater(new Runnable() { |
|
66 |
|
|
67 |
@Override |
|
68 |
public void run() { |
|
69 |
|
|
70 |
try { |
|
71 |
|
|
72 |
// TODO Auto-generated method stub |
|
73 |
getPanel().loadSVGDocument(file.toURL().toExternalForm()); |
|
74 |
} |
|
75 |
catch (Exception e) { |
|
76 |
Log.severe("Can't load SVG document from file: " + file + e); |
|
77 |
Log.printStackTrace(e); |
|
78 |
} |
|
79 |
|
|
80 |
} |
|
81 |
}); |
|
82 |
|
|
83 |
//this.getPanel().loadSVGDocument(file.toURL().toExternalForm()); |
|
64 | 84 |
} |
65 | 85 |
else { |
66 | 86 |
Log.severe(TXMCoreMessages.bind("** Malformed SVG file: {0}.", file)); |
67 | 87 |
this.getPanel().resetView(); |
68 | 88 |
} |
69 |
} |
|
70 |
catch(Exception e) { |
|
71 |
Log.severe("Can't load SVG document from file: " + file + e); |
|
72 |
Log.printStackTrace(e); |
|
73 |
} |
|
89 |
|
|
74 | 90 |
} |
75 | 91 |
|
76 | 92 |
|
Formats disponibles : Unified diff