Révision 3771
TXM/trunk/bundles/org.txm.chartsengine.graphstream.rcp/src/org/txm/chartsengine/graphstream/rcp/editor/GSEditor.java (revision 3771) | ||
---|---|---|
22 | 22 |
import org.graphstream.stream.file.FileSourceDOT; |
23 | 23 |
import org.graphstream.stream.file.FileSourceFactory; |
24 | 24 |
import org.graphstream.stream.file.FileSourceGML; |
25 |
import org.graphstream.stream.file.FileSourceGraphML; |
|
25 | 26 |
import org.graphstream.stream.file.FileSourceParser; |
26 | 27 |
import org.txm.chartsengine.graphstream.rcp.swt.GSComposite; |
28 |
import org.txm.utils.logger.Log; |
|
27 | 29 |
|
28 | 30 |
public class GSEditor extends EditorPart { |
29 | 31 |
|
... | ... | |
81 | 83 |
} |
82 | 84 |
|
83 | 85 |
Graph g = new DefaultGraph("g"); //$NON-NLS-1$ |
84 |
// FileSource fs = null; |
|
85 |
// if (path.endsWith(".dot")) { |
|
86 |
// fs = new FileSourceDOT(); |
|
87 |
// fs.addSink(g); |
|
88 |
// try { |
|
89 |
// fs.readAll(path); |
|
90 |
// } catch (IOException e1) { |
|
91 |
// e1.printStackTrace(); |
|
92 |
// return; |
|
93 |
// } finally { |
|
94 |
// fs.removeSink(g); |
|
95 |
// } |
|
96 |
// } else if (path.endsWith(".gml")) { |
|
97 |
// fs = new FileSourceGML(); |
|
98 |
// } else if (path.endsWith(".gexf")) { |
|
99 |
// |
|
100 |
// } else if (path.endsWith(".graphml")) { |
|
101 |
// |
|
102 |
// } |
|
103 | 86 |
|
104 | 87 |
try { |
105 | 88 |
FileSource fs = FileSourceFactory.sourceFor(path); |
89 |
if (path.endsWith(".graphml")) fs = new FileSourceGraphML(); |
|
90 |
|
|
106 | 91 |
if (fs != null) { |
107 | 92 |
fs.addSink(g); |
108 | 93 |
try { |
109 | 94 |
fs.readAll(path); |
110 | 95 |
main.loadChart(g); |
111 | 96 |
main.redraw(); |
112 |
} catch (IOException e1) {
|
|
97 |
} catch (Throwable e1) {
|
|
113 | 98 |
e1.printStackTrace(); |
114 | 99 |
return; |
115 | 100 |
} finally { |
116 | 101 |
fs.removeSink(g); |
117 | 102 |
} |
118 |
} |
|
103 |
} else { |
|
104 |
Log.warning("File format not supported: "+path); |
|
105 |
} |
|
119 | 106 |
} catch (IOException e1) { |
120 | 107 |
// TODO Auto-generated catch block |
121 | 108 |
e1.printStackTrace(); |
... | ... | |
125 | 112 |
@Override |
126 | 113 |
public void widgetDefaultSelected(SelectionEvent e) { } |
127 | 114 |
}); |
115 |
|
|
128 | 116 |
main = new GSComposite(null, parent); |
129 | 117 |
main.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
130 | 118 |
} |
Formats disponibles : Unified diff