Revision 333

tmp/org.txm.chartsengine.r.rcp/src/org/txm/rcp/chartsengine/r/preferences/RChartsEnginePreferencePage.java (revision 333)
86 86
		this.setPreferenceStore(new TXMPreferenceStore(RChartsEnginePreferences.PREFERENCE_NODE));
87 87
	}
88 88

  
89
//	@Override
90
//	public boolean performOk() {
91
//		try {
92
//			super.performOk();
93
//
94
//			
95
//			// Change the R Charts engine output format
96
//			ChartsEngine.getChartsEngine(RChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(RChartsEnginePreferences.OUTPUT_FORMAT));
97
//
98
//			
99
//			// Sets the new current charts SWT component provider according to the output format if the charts engine is the current one
100
//			if(ChartsEngine.getCurrent() instanceof RChartsEngine)	{
101
//				SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
102
//				
103
//				// Set the first charts engine supported export file format as default charts export file format
104
//				TXMPreferences.putString(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.RDEVICE, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
105
//				
106
//				// Refresh the User\Export preference page to update "Default charts export file format" combo box
107
//				PlatformUI.getWorkbench().getPreferenceManager().
108
//					find("org.txm.rcp.preferences.TextometriePreferencePage/" + UserPreferencePage.ID + "/" + ExportPreferencePage.ID).createPage(); //$NON-NLS-1$ //$NON-NLS-2$
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
//	}
89
	@Override
90
	public boolean performOk() {
91
		try {
92
			super.performOk();
93

  
94
			
95
			// Change the R Charts engine output format
96
			ChartsEngine.getChartsEngine(RChartsEngine.class).setOutputFormat(this.getPreferenceStore().getString(RChartsEnginePreferences.OUTPUT_FORMAT));
97

  
98
			
99
			// Sets the new current charts SWT component provider according to the output format if the charts engine is the current one
100
			if(ChartsEngine.getCurrent() instanceof RChartsEngine)	{
101
				SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
102
				
103
				// Set the first charts engine supported export file format as default charts export file format
104
				TXMPreferences.putString(ChartsEnginePreferences.PREFERENCES_NODE, ChartsEnginePreferences.RDEVICE, ChartsEngine.getCurrent().getSupportedOutputFileFormats().get(0));
105
				
106
				// Refresh the User\Export preference page to update "Default charts export file format" combo box
107
				PlatformUI.getWorkbench().getPreferenceManager().
108
					find("org.txm.rcp.preferences.TextometriePreferencePage/" + UserPreferencePage.ID + "/" + ExportPreferencePage.ID).createPage(); //$NON-NLS-1$ //$NON-NLS-2$
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
}

Also available in: Unified diff