Révision 1989
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java (revision 1989) | ||
---|---|---|
26 | 26 |
import org.eclipse.swt.widgets.Widget; |
27 | 27 |
import org.eclipse.ui.PlatformUI; |
28 | 28 |
import org.txm.chartsengine.core.ChartsEngine; |
29 |
import org.txm.chartsengine.core.ChartsEnginesManager; |
|
29 | 30 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
30 | 31 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
31 | 32 |
import org.txm.chartsengine.rcp.messages.ChartsUIMessages; |
... | ... | |
173 | 174 |
// Add the first charts engine that supports the input format |
174 | 175 |
ChartsEngine chartsEngine = null; |
175 | 176 |
for(int j = 0; j < formats.length; j++) { |
176 |
chartsEngine = ChartsEngine.getChartsEngine(formats[j]); |
|
177 |
chartsEngine = ChartsEnginesManager.getInstance().getChartsEngine(formats[j]);
|
|
177 | 178 |
if(chartsEngine != null) { |
178 | 179 |
break; |
179 | 180 |
} |
... | ... | |
208 | 209 |
*/ |
209 | 210 |
public static void setCurrrentComponentsProvider(ChartsEngine chartsEngine) { |
210 | 211 |
for(int i = 0; i < SWTChartsComponentsProvider.chartsComponentsProviders.size(); i++) { |
211 |
if(SWTChartsComponentsProvider.chartsComponentsProviders.get(i).getEditorSupportedInputFormats().contains(chartsEngine.getOutputFormat())) {
|
|
212 |
if(SWTChartsComponentsProvider.chartsComponentsProviders.get(i).canCreateView(chartsEngine)) {
|
|
212 | 213 |
// Set new charts engine |
213 | 214 |
SWTChartsComponentsProvider.chartsComponentsProviders.get(i).setChartsEngine(chartsEngine); |
214 | 215 |
|
... | ... | |
221 | 222 |
|
222 | 223 |
|
223 | 224 |
/** |
224 |
* Gets an SWT charts components provider according to the specified charts engine output format and provider supported input format.
|
|
225 |
* Gets the first SWT charts components provider that supports the specified charts engine output format as input format.
|
|
225 | 226 |
* |
226 | 227 |
* @param chartsEngine |
227 | 228 |
* @return the first components provider that manages the format of the specified charts engine |
... | ... | |
231 | 232 |
SWTChartsComponentsProvider chartsComponentsProvider = null; |
232 | 233 |
|
233 | 234 |
for(int i = 0; i < SWTChartsComponentsProvider.chartsComponentsProviders.size(); i++) { |
234 |
if(SWTChartsComponentsProvider.chartsComponentsProviders.get(i).getEditorSupportedInputFormats().contains(chartsEngine.getOutputFormat())) {
|
|
235 |
if(SWTChartsComponentsProvider.chartsComponentsProviders.get(i).canCreateView(chartsEngine)) {
|
|
235 | 236 |
|
236 | 237 |
chartsComponentsProvider = SWTChartsComponentsProvider.chartsComponentsProviders.get(i); |
237 | 238 |
break; |
... | ... | |
263 | 264 |
} |
264 | 265 |
|
265 | 266 |
/** |
267 |
* Checks if the components provider can create a composite to render a chart generated by the specified charts engine using its current output format. |
|
268 |
* |
|
269 |
* @param chartsEngine |
|
270 |
* @return |
|
271 |
*/ |
|
272 |
protected boolean canCreateView(ChartsEngine chartsEngine) { |
|
273 |
return this.getEditorSupportedInputFormats().contains(chartsEngine.getOutputFormat()); |
|
274 |
} |
|
275 |
|
|
276 |
|
|
277 |
/** |
|
266 | 278 |
* Set the current charts engine. |
267 | 279 |
* @param chartsEngine the chartsEngine to set |
268 | 280 |
*/ |
Formats disponibles : Unified diff