Révision 332

tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/preferences/JFCChartsEnginePreferencePage.java (revision 332)
87 87
		this.setPreferenceStore(new TXMPreferenceStore(JFCChartsEnginePreferences.PREFERENCE_NODE));
88 88
	}
89 89

  
90
//	@Override
91
//	public boolean performOk() {
92
//		try {
93
//			super.performOk();
94
//			
95
//			// Change the JFC Charts engine output format
96
//			ChartsEngine.getChartsEngine(JFCChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(JFCChartsEnginePreferences.OUTPUT_FORMAT));
97
//				
98
//			// Sets the new current charts SWT component provider according to the output format if the charts engine is the current one
99
//			if(ChartsEngine.getCurrent() instanceof JFCChartsEngine)	{
100
//				SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
101
//	
102
//				// Set the first charts engine supported export file format as default charts export file format
103
//				TXMPreferences.putString(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.RDEVICE, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
104
//					
105
//				// Refresh the User\Export preference page to update "Default charts export file format" combo box
106
//				PlatformUI.getWorkbench().getPreferenceManager().
107
//						find("org.txm.rcp.preferences.TextometriePreferencePage/" + UserPreferencePage.ID + "/" + ExportPreferencePage.ID).createPage(); //$NON-NLS-1$ //$NON-NLS-2$
108
//			
109
//			}
110
//
111
//			
112
//			
113
//		} catch (Exception e) {
114
//			System.err.println(org.txm.rcp.Messages.FAILED_TO_SAVE_PREFERENCES + e);
115
//		}
116
//		return true;
117
//	}
90
	@Override
91
	public boolean performOk() {
92
		try {
93
			super.performOk();
94
			
95
			// Change the JFC Charts engine output format
96
			ChartsEngine.getChartsEngine(JFCChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(JFCChartsEnginePreferences.OUTPUT_FORMAT));
97
				
98
			// Sets the new current charts SWT component provider according to the output format if the charts engine is the current one
99
			if(ChartsEngine.getCurrent() instanceof JFCChartsEngine)	{
100
				SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
101
	
102
				// Set the first charts engine supported export file format as default charts export file format
103
				TXMPreferences.putString(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.RDEVICE, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
104
					
105
				// Refresh the User\Export preference page to update "Default charts export file format" combo box
106
				PlatformUI.getWorkbench().getPreferenceManager().
107
						find("org.txm.rcp.preferences.TextometriePreferencePage/" + UserPreferencePage.ID + "/" + ExportPreferencePage.ID).createPage(); //$NON-NLS-1$ //$NON-NLS-2$
108
			
109
			}
110

  
111
			
112
			
113
		} catch (Exception e) {
114
			System.err.println(org.txm.rcp.Messages.FAILED_TO_SAVE_PREFERENCES + e);
115
		}
116
		return true;
117
	}
118 118
}

Formats disponibles : Unified diff