Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 249588 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportWizard.java (-121 / +108 lines)
Lines 46-52 Link Here
46
 * 
46
 * 
47
 * @author  Bianca Xue Jiang
47
 * @author  Bianca Xue Jiang
48
 * @author  Paul E. Slauenwhite
48
 * @author  Paul E. Slauenwhite
49
 * @version October 31, 2008
49
 * @version November 4, 2008
50
 * @since   March 18, 2005
50
 * @since   March 18, 2005
51
 */
51
 */
52
public class DatapoolImportWizard extends Wizard implements IImportWizard {
52
public class DatapoolImportWizard extends Wizard implements IImportWizard {
Lines 110-237 Link Here
110
	 */
110
	 */
111
	public boolean performFinish() {
111
	public boolean performFinish() {
112
112
113
        IRunnableWithProgress operation = new WorkspaceModifyOperation() {
113
		IRunnableWithProgress operation = new WorkspaceModifyOperation() {
114
            
114
115
        	public void execute(IProgressMonitor monitor) throws InvocationTargetException {
115
			public void execute(IProgressMonitor monitor) throws InvocationTargetException {
116
116
117
    			monitor.beginTask(UiPluginResourceBundle.DatapoolImportWizard_progressMonitor, 4);
117
				monitor.beginTask(UiPluginResourceBundle.DatapoolImportWizard_progressMonitor, 4);
118
118
119
    			try {
119
				//Resolve the selected datapool:
120
120
				IDatapool datapool = datapoolImportPageTwo.getSelectedDatapool();
121
    				IDatapool datapool = datapoolImportPageTwo.getSelectedDatapool();
121
				boolean isEncrypted = datapoolImportPageTwo.isSelectedDatapoolEncrypted();
122
    				
122
				String password = datapoolImportPageTwo.getEncryptedDatapoolPassword();
123
    				monitor.worked(1);
123
124
124
				try {
125
    				if(datapool == null){
125
126
    					
126
					monitor.worked(1);
127
    					//Assumption:  The file name will include the file extension (see org.eclipse.tptp.platform.common.ui.wizard.LocationPage.getFileName()).
127
128
    					String datapoolFileName = locationPage.getFileName();
128
					if(datapool != null){
129
    					
129
130
    					datapool = ((DPLDatapool)(DatapoolUtil.createNewDatapool(datapoolFileName.substring(0, datapoolFileName.indexOf('.')), null)));
130
						if(isEncrypted){
131
    					
131
							DatapoolEncryptManager.decryptDatapool(datapool, password);
132
    					Resource datapoolResource = EMFUtil.getResourceFactory(locationPage.getFileExtension()).createResource(URI.createPlatformResourceURI(locationPage.getContainerFullPath().append(datapoolFileName).toOSString(), false));
132
						}
133
    					datapoolResource.getContents().add(datapool);
133
134
    				}
134
						//Empty the datapool if it contains only an empty default cell:
135
    				
135
						if(CSVImportExportUtil.getInstance().isDefaultEmptyDatapool(datapool)){
136
    				//If the existing datapool only contains only an empty default cell, empty the datapool:
136
137
    				else if(CSVImportExportUtil.getInstance().isDefaultEmptyDatapool(datapool)){
137
							datapool.removeVariable(0);
138
    					
138
							datapool.removeEquivalenceClass(0);
139
    					datapool.removeVariable(0);
139
						}
140
    					datapool.removeEquivalenceClass(0);
140
					}    				
141
    				}
141
					else {
142
    				
142
143
    				String key = datapoolImportPageTwo.getEncryptedDatapoolPasswordText().getText();
143
						//Assumption:  The file name will include the file extension (see org.eclipse.tptp.platform.common.ui.wizard.LocationPage.getFileName()).
144
    				
144
						String datapoolFileName = locationPage.getFileName();
145
    				if(datapoolImportPageTwo.isEncrypted()){
145
146
    					if(!DatapoolEncryptManager.isKeyCorrect(datapool, key)){
146
						//Create a new datapool:
147
    						datapoolImportPageTwo.setMessage(UiPluginResourceBundle.DatapoolExportWizard_wrongpass,3);
147
						datapool = ((DPLDatapool)(DatapoolUtil.createNewDatapool(datapoolFileName.substring(0, datapoolFileName.indexOf('.')), null)));
148
    						datapoolImportPageTwo.getEncryptedDatapoolPasswordText().setText("");
148
149
    						datapoolImportPageTwo.getEncryptedDatapoolPasswordText().setFocus();
149
						//Create the resource and add the datapool:
150
    						throw new Exception("Password is not correct!");
150
						EMFUtil.getResourceFactory(locationPage.getFileExtension()).createResource(URI.createPlatformResourceURI(locationPage.getContainerFullPath().append(datapoolFileName).toOSString(), false)).getContents().add(datapool);
151
    					}
151
					}
152
    				}
152
153
    				
153
					monitor.worked(1);
154
    				if( DatapoolEncryptManager.isDatapoolEncrypted(datapool))
154
155
    				{
155
					if(datapool.getVariableCount() == 0){
156
    					DatapoolEncryptManager.decryptDatapool(datapool, key);
156
157
    				}
157
						//Import the CSV file to the datapool:
158
    				
158
						CSVImportExportUtil.getInstance().importCSV(datapool, 
159
    				monitor.worked(1);
159
								datapoolImportPage.getCSVFileName(), 
160
    				
160
								datapoolImportPage.firstRowContainsVariableNameType(),
161
    				if(datapool.getVariableCount() == 0){
161
								datapoolImportPage.firstColumnContainsEquivalenceClassName(),
162
    					
162
								datapoolImportPage.getImportEncoding());
163
    					CSVImportExportUtil.getInstance().importCSV(datapool, 
163
					}
164
    																datapoolImportPage.getCSVFileName(), 
164
					else{
165
    																datapoolImportPage.firstRowContainsVariableNameType(),
165
166
    																datapoolImportPage.firstColumnContainsEquivalenceClassName(),
166
						//Append the CSV file to the datapool:
167
    																datapoolImportPage.getImportEncoding());
167
						CSVImportExportUtil.getInstance().appendFromCSV(datapool, 
168
    				}
168
								datapoolImportPage.getCSVFileName(), 
169
    				else{
169
								datapoolImportPage.firstRowContainsVariableNameType(),
170
    					
170
								datapoolImportPage.firstColumnContainsEquivalenceClassName(),
171
    					CSVImportExportUtil.getInstance().appendFromCSV(datapool, 
171
								datapoolImportPage.getImportEncoding());
172
    																	datapoolImportPage.getCSVFileName(), 
172
					}
173
    																	datapoolImportPage.firstRowContainsVariableNameType(),
173
174
    																	datapoolImportPage.firstColumnContainsEquivalenceClassName(),
174
					monitor.worked(1);
175
    																	datapoolImportPage.getImportEncoding());
175
176
    				}
176
					Resource datapoolResource = ((EObject)(datapool)).eResource();
177
177
178
    				monitor.worked(1);
178
					//Save (or serialize) the datapool resource to the workspace:
179
    				
179
					EMFUtil.save(datapoolResource);
180
    				if( DatapoolEncryptManager.isDatapoolEncrypted(datapool))
180
181
    				{
181
					//Attempt to open the editor:
182
    					DatapoolEncryptManager.encryptDatapool(datapool, key);
182
					TestUIUtilities.openEditor(datapoolResource, TestUIExtension.DATAPOOL_EDITOR_PART_ID);
183
    				}
183
184
    				
184
					monitor.worked(1);
185
    				Resource datapoolResource = ((EObject)(datapool)).eResource();
185
				}
186
    				
186
				catch(Exception e){
187
    				//Save (or serialize) the datapool resource to the workspace:
187
188
    				EMFUtil.save(datapoolResource);
188
					UiPlugin.logError(e);			
189
    				    				
189
190
    				//Attempt to open the editor:
190
					new ErrorDialog(getShell(), 
191
    				TestUIUtilities.openEditor(datapoolResource, TestUIExtension.DATAPOOL_EDITOR_PART_ID);
191
							UiPluginResourceBundle.WIZ_DATAPOOL_CSV_ERRDLG_TITLE,
192
    				
192
							UiPluginResourceBundle._ERROR_WIZ_DATAPOOL_CSV_ERRDLG_IMPFILE,
193
    				monitor.worked(1);
193
							new Status(IStatus.ERROR,
194
    			}
194
									UiPlugin.PLUGIN_ID,
195
    			catch(Exception e){
195
									IStatus.OK,
196
    				
196
									e.toString(),
197
    				UiPlugin.logError(e);			
197
									e),
198
    				
198
									IStatus.ERROR).open();
199
    				new ErrorDialog(getShell(), 
199
				}
200
    								UiPluginResourceBundle.WIZ_DATAPOOL_CSV_ERRDLG_TITLE,
200
				finally{
201
    								UiPluginResourceBundle._ERROR_WIZ_DATAPOOL_CSV_ERRDLG_IMPFILE,
201
202
    								new Status(IStatus.ERROR,
202
					//Encrypted the datapool if decrypted: 
203
    										UiPlugin.PLUGIN_ID,
203
					if(isEncrypted){		
204
    										IStatus.OK,
204
						DatapoolEncryptManager.encryptDatapool(datapool, password);
205
    										e.toString(),
205
					}
206
    										e),
206
207
    								IStatus.ERROR).open();
207
					monitor.done();		
208
    			}
209
    			finally{
210
                    monitor.done();		
211
    			}
212
    		}
213
        };
214
        
215
        try {
216
        	String key = datapoolImportPageTwo.getEncryptedDatapoolPasswordText().getText();
217
        	IDatapool datapool = datapoolImportPageTwo.getSelectedDatapool();
218
			if(datapoolImportPageTwo.isEncrypted()){
219
				if(!DatapoolEncryptManager.isKeyCorrect(datapool, key)){
220
					datapoolImportPageTwo.setMessage(UiPluginResourceBundle.DatapoolExportWizard_wrongpass,3);
221
					datapoolImportPageTwo.getEncryptedDatapoolPasswordText().setText("");
222
					datapoolImportPageTwo.getEncryptedDatapoolPasswordText().setFocus();
223
					return false;
224
				}
208
				}
225
			}
209
			}
226
            getContainer().run(false, false, operation);
210
		};
227
        } 
211
228
        catch (InvocationTargetException e) {
212
		try {        	
229
        	UiPlugin.logError(e);
213
			getContainer().run(false, false, operation);
230
        } 
214
		} 
231
        catch (InterruptedException e) {
215
		catch (InvocationTargetException e) {
232
            //Ignore since the operation cannot be cancelled.
216
			UiPlugin.logError(e);
233
        }
217
		} 
234
        
218
		catch (InterruptedException e) {
219
			//Ignore since the operation cannot be canceled.
220
		}
221
235
		return true;
222
		return true;
236
	}
223
	}
237
}
224
}
(-)src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolExportWizard.java (-58 / +62 lines)
Lines 19-28 Link Here
19
import org.eclipse.core.runtime.Path;
19
import org.eclipse.core.runtime.Path;
20
import org.eclipse.hyades.edit.datapool.IDatapool;
20
import org.eclipse.hyades.edit.datapool.IDatapool;
21
import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager;
21
import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager;
22
import org.eclipse.hyades.test.ui.TestUI;
22
import org.eclipse.hyades.test.ui.TestUIImages;
23
import org.eclipse.hyades.test.ui.TestUIImages;
23
import org.eclipse.hyades.test.ui.UiPlugin;
24
import org.eclipse.hyades.test.ui.UiPlugin;
24
import org.eclipse.hyades.test.ui.datapool.internal.util.CSVImportExportUtil;
25
import org.eclipse.hyades.test.ui.datapool.internal.util.CSVImportExportUtil;
25
import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle;
26
import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle;
27
import org.eclipse.hyades.test.ui.util.TestUIUtil;
26
import org.eclipse.jface.dialogs.IDialogConstants;
28
import org.eclipse.jface.dialogs.IDialogConstants;
27
import org.eclipse.jface.dialogs.MessageDialog;
29
import org.eclipse.jface.dialogs.MessageDialog;
28
import org.eclipse.jface.viewers.IStructuredSelection;
30
import org.eclipse.jface.viewers.IStructuredSelection;
Lines 38-44 Link Here
38
40
39
 * @author  Peter Sun
41
 * @author  Peter Sun
40
 * @author  Paul E. Slauenwhite
42
 * @author  Paul E. Slauenwhite
41
 * @version October 31, 2008
43
 * @version November 4, 2008
42
 * @since   February 1, 2005
44
 * @since   February 1, 2005
43
 */
45
 */
44
public class DatapoolExportWizard extends Wizard implements IExportWizard {
46
public class DatapoolExportWizard extends Wizard implements IExportWizard {
Lines 49-54 Link Here
49
	public DatapoolExportWizard()
51
	public DatapoolExportWizard()
50
	{
52
	{
51
		super();
53
		super();
54
		
52
		setDefaultPageImageDescriptor(TestUIImages.INSTANCE.getImageDescriptor(TestUIImages.IMG_WIZBAN_EXPORT_DATAPOOL));
55
		setDefaultPageImageDescriptor(TestUIImages.INSTANCE.getImageDescriptor(TestUIImages.IMG_WIZBAN_EXPORT_DATAPOOL));
53
	}
56
	}
54
	
57
	
Lines 68-74 Link Here
68
		super.createPageControls(pageContainer);		
71
		super.createPageControls(pageContainer);		
69
	}
72
	}
70
73
71
	
72
	public void addPages()
74
	public void addPages()
73
	{
75
	{
74
		csvFileLocationPage = new DatapoolExportCSVFileLocationPage("csvFileSelection");
76
		csvFileLocationPage = new DatapoolExportCSVFileLocationPage("csvFileSelection");
Lines 90-155 Link Here
90
	/* (non-Javadoc)
92
	/* (non-Javadoc)
91
	 * @see org.eclipse.jface.wizard.IWizard#performFinish()
93
	 * @see org.eclipse.jface.wizard.IWizard#performFinish()
92
	 */	
94
	 */	
93
	public boolean performFinish() 
95
	public boolean performFinish() {
94
	{
96
97
		//Resolve the selected datapool:
98
		//Assumption: The datapool is not null.
95
		IDatapool datapool = datapoolSelectionPage.getSelectedDatapool();
99
		IDatapool datapool = datapoolSelectionPage.getSelectedDatapool();
96
		String key = datapoolSelectionPage.getEncryptedDatapoolPasswordText().getText();
100
		boolean isEncrypted = datapoolSelectionPage.isSelectedDatapoolEncrypted();
97
		
101
		String password = datapoolSelectionPage.getEncryptedDatapoolPassword();
98
		if(datapoolSelectionPage.isEncrypted()){
102
99
			if(!DatapoolEncryptManager.isKeyCorrect(datapool, key)){
103
		try {
100
				datapoolSelectionPage.setMessage(UiPluginResourceBundle.DatapoolExportWizard_wrongpass,3);
104
101
				datapoolSelectionPage.getEncryptedDatapoolPasswordText().setText("");
105
			//Decrypt the datapool if encrypted: 
102
				datapoolSelectionPage.getEncryptedDatapoolPasswordText().setFocus();
106
			if(isEncrypted){		
103
				return false;
107
				DatapoolEncryptManager.decryptDatapool(datapool, password);
104
			}
108
			}
105
		}
106
		
107
		//decrypt datapool before export it into csv file 
108
		if( DatapoolEncryptManager.isDatapoolEncrypted(datapool))
109
		{
110
			DatapoolEncryptManager.decryptDatapool(datapool, key);
111
		}
112
		String csvFileName = csvFileLocationPage.getCSVFileName();
113
		if(!csvFileName.endsWith(".csv") && !csvFileName.endsWith(".CSV"))
114
			csvFileName = csvFileName + ".csv";
115
109
116
		File file = new File(csvFileName);
110
			//Resolve the CSV file:
117
		
111
			String csvFileName = TestUIUtil.validateExtension(csvFileLocationPage.getCSVFileName().trim(), TestUI.CSV_FILE_EXTENSION);
118
		if (file.exists())
112
119
		{
113
			if (new File(csvFileName).exists()){
120
			String message = NLS.bind(UiPluginResourceBundle.WIZ_EXP_DATAPOOL_MSG_EXISTS, csvFileName);
114
121
			MessageDialog overwriteDialog = new MessageDialog(getShell(),
115
				MessageDialog overwriteDialog = new MessageDialog(getShell(),
122
															  UiPluginResourceBundle.WIZ_EXP_DATAPOOL_TTL, 
116
						UiPluginResourceBundle.WIZ_EXP_DATAPOOL_TTL, 
123
															  null,
117
						null,
124
															  message, 
118
						NLS.bind(UiPluginResourceBundle.WIZ_EXP_DATAPOOL_MSG_EXISTS, csvFileName), 
125
															  MessageDialog.WARNING, 
119
						MessageDialog.WARNING, 
126
															  new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 
120
						new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 
127
															  0);
121
						0);
128
			
122
129
			// user selected - "don't replace", return false
123
				//Return if cannot replace existing CSV file:
130
			if (overwriteDialog.open() != 0)
124
				if (overwriteDialog.open() != IDialogConstants.OK_ID){
131
				return false;
125
					return false;
126
				}
127
			}
128
129
			//Export the datapool to the CSV file:
130
			boolean isDatapoolExported = CSVImportExportUtil.getInstance().exportCSV(datapool, csvFileName, 
131
					csvFileLocationPage.getExportVariables(), 
132
					csvFileLocationPage.getExportEquivalenceClassNames(), 
133
					csvFileLocationPage.getExportTags(), 
134
					csvFileLocationPage.getExportEncoding());
135
136
			//Refresh the CSV file if exported to the workspace:
137
			IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(csvFileName));
138
139
			for (int counter = 0; counter < files.length; counter++) {
140
141
				try {
142
					files[counter].refreshLocal(0, null);
143
				} 
144
				catch (CoreException e) {
145
					UiPlugin.logError(e);
146
				}
147
			}
148
149
			return isDatapoolExported;
132
		}
150
		}
133
		
151
		finally{
134
		boolean exportVariables = csvFileLocationPage.getExportVariables();
152
135
		boolean exportEqClsNames = csvFileLocationPage.getExportEquivalenceClassNames();
153
			//Encrypted the datapool if decrypted: 
136
		boolean exportTags = csvFileLocationPage.getExportTags();
154
			if(isEncrypted){		
137
		String exportEncoding = csvFileLocationPage.getExportEncoding();
155
				DatapoolEncryptManager.encryptDatapool(datapool, password);
138
		boolean close = CSVImportExportUtil.getInstance().exportCSV(datapool, csvFileName, exportVariables, exportEqClsNames, exportTags, exportEncoding);
156
			}
139
        IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(csvFileName));
140
        for (int i = 0; i < files.length; i++) {
141
            try {
142
                files[i].refreshLocal(0, null);
143
            } catch (CoreException e) {
144
                UiPlugin.logError(e);
145
            }
146
        }
147
        
148
        //encrypted datapool again after finish export it  
149
        if( DatapoolEncryptManager.isDatapoolEncrypted(datapool))
150
		{
151
			DatapoolEncryptManager.encryptDatapool(datapool, key);
152
		}
157
		}
153
        return close;
154
	}
158
	}
155
}
159
}
(-)src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolSelectionPage.java (-35 / +39 lines)
Lines 38-44 Link Here
38
 * 
38
 * 
39
 * 
39
 * 
40
 * @author  Paul E. Slauenwhite
40
 * @author  Paul E. Slauenwhite
41
 * @version October 31, 2008
41
 * @version November 4, 2008
42
 * @since   October 31, 2008
42
 * @since   October 31, 2008
43
 */
43
 */
44
public class DatapoolSelectionPage extends WizardPage {
44
public class DatapoolSelectionPage extends WizardPage {
Lines 48-54 Link Here
48
	private Text encryptedDatapoolPasswordText = null;	
48
	private Text encryptedDatapoolPasswordText = null;	
49
	private IStructuredSelection selection = null;
49
	private IStructuredSelection selection = null;
50
	private IDatapool selectedDatapool = null;
50
	private IDatapool selectedDatapool = null;
51
	private boolean isEncrypted = false;
51
	private boolean isSelectedDatapoolEncrypted = false;
52
52
53
	public DatapoolSelectionPage(String name){
53
	public DatapoolSelectionPage(String name){
54
		this(name, null);
54
		this(name, null);
Lines 80-86 Link Here
80
				super.setSelection();
80
				super.setSelection();
81
				
81
				
82
				selectedDatapool = null;
82
				selectedDatapool = null;
83
				isEncrypted = false;
83
				isSelectedDatapoolEncrypted = false;
84
				
84
				
85
				IProxyNode[] selectedProxyNodes = datapoolSelectionViewer.getSelectedProxyNodes();
85
				IProxyNode[] selectedProxyNodes = datapoolSelectionViewer.getSelectedProxyNodes();
86
86
Lines 93-104 Link Here
93
						selectedDatapool = ((IDatapool)(eObject));
93
						selectedDatapool = ((IDatapool)(eObject));
94
94
95
						//Determine if the selected datapool is encrypted:
95
						//Determine if the selected datapool is encrypted:
96
						isEncrypted = DatapoolEncryptManager.isDatapoolEncrypted(selectedDatapool);
96
						isSelectedDatapoolEncrypted = DatapoolEncryptManager.isDatapoolEncrypted(selectedDatapool);
97
97
98
						//Show or hide the encrypted datapool password group:
98
						if((isSelectedDatapoolEncrypted) && (!encryptedDatapoolPasswordGroup.isVisible())){
99
						encryptedDatapoolPasswordGroup.setVisible(isEncrypted);						
100
101
						if(isEncrypted){
102
						
99
						
103
							//Set the title of the encrypted datapool password group:
100
							//Set the title of the encrypted datapool password group:
104
							encryptedDatapoolPasswordGroup.setText(NLS.bind(UiPluginResourceBundle.DatapoolExportWizard_password, selectedDatapool.getName()));
101
							encryptedDatapoolPasswordGroup.setText(NLS.bind(UiPluginResourceBundle.DatapoolExportWizard_password, selectedDatapool.getName()));
Lines 107-112 Link Here
107
							encryptedDatapoolPasswordText.setText("");
104
							encryptedDatapoolPasswordText.setText("");
108
							encryptedDatapoolPasswordText.setFocus();				
105
							encryptedDatapoolPasswordText.setFocus();				
109
						}
106
						}
107
						
108
						//Show or hide the encrypted datapool password group:
109
						encryptedDatapoolPasswordGroup.setVisible(isSelectedDatapoolEncrypted);						
110
					}
110
					}
111
				}
111
				}
112
				
112
				
Lines 127-145 Link Here
127
		encryptedDatapoolPasswordText.addModifyListener(new ModifyListener(){
127
		encryptedDatapoolPasswordText.addModifyListener(new ModifyListener(){
128
			
128
			
129
			public void modifyText(ModifyEvent e){
129
			public void modifyText(ModifyEvent e){
130
130
				setPageComplete(validatePage());
131
				if(encryptedDatapoolPasswordText.getText().trim().length() > 0){
132
133
					setErrorMessage(null);
134
135
					setPageComplete(true);
136
				}
137
				else {
138
139
					setErrorMessage(NLS.bind(UiPluginResourceBundle.DatapoolExportWizard_encrypted, selectedDatapool.getName()));
140
141
					setPageComplete(false);
142
				}
143
			}
131
			}
144
		});
132
		});
145
133
Lines 153-191 Link Here
153
	public IDatapool getSelectedDatapool(){
141
	public IDatapool getSelectedDatapool(){
154
		return selectedDatapool;
142
		return selectedDatapool;
155
	}
143
	}
156
157
	public Text getEncryptedDatapoolPasswordText(){
158
		return encryptedDatapoolPasswordText;
159
	}
160
	
144
	
161
	public boolean isEncrypted(){
145
	public boolean isSelectedDatapoolEncrypted(){
162
		return isEncrypted;
146
		return isSelectedDatapoolEncrypted;
163
	}	
147
	}	
164
148
149
	public String getEncryptedDatapoolPassword(){
150
		return (encryptedDatapoolPasswordText.getText().trim());
151
	}
152
165
	protected boolean validatePage() {
153
	protected boolean validatePage() {
166
		
154
		
167
		//Note: The error message is not initially reset to reduce flicker when setting the same error message.		
155
		//Note: The error message is not initially reset to reduce flicker when setting the same error message.		
168
		boolean isValid = false;
156
		boolean isValid = false;
169
		
157
170
		//Validate the selected datapool:
158
		//Validate the selected datapool:
171
		if(selectedDatapool != null){
159
		if(selectedDatapool != null){
172
160
173
			//Validate the selected encrypted datapool and its password:
161
			//Validate the selected encrypted datapool and its password:
174
			if((isEncrypted) && (encryptedDatapoolPasswordText.getText().trim().length() == 0)){
162
			if(isSelectedDatapoolEncrypted){
163
164
				String password = getEncryptedDatapoolPassword();
175
165
176
				setErrorMessage(NLS.bind(UiPluginResourceBundle.DatapoolExportWizard_encrypted, selectedDatapool.getName()));
166
				if(password.length() == 0){
167
168
					setErrorMessage(NLS.bind(UiPluginResourceBundle.DatapoolExportWizard_encrypted, selectedDatapool.getName()));
169
170
					//Set focus to the encrypted datapool password:				
171
					encryptedDatapoolPasswordText.setFocus();
172
				}
173
				else if(!DatapoolEncryptManager.isKeyCorrect(selectedDatapool, password)){
177
174
178
				//Set focus to the encrypted datapool password:				
175
					setErrorMessage(UiPluginResourceBundle.DatapoolExportWizard_wrongpass);
179
				encryptedDatapoolPasswordText.setFocus();				
176
177
					//Set focus to the encrypted datapool password:				
178
					encryptedDatapoolPasswordText.setFocus();
179
				}
180
				else{					
181
					isValid = true;
182
				}
180
			}
183
			}
181
			else{
184
			else{
182
183
				isValid = true;
185
				isValid = true;
184
185
				setErrorMessage(null);
186
			}
186
			}
187
		}
187
		}
188
188
189
		if(isValid){
190
			setErrorMessage(null);			
191
		}
192
189
		return isValid;
193
		return isValid;
190
	}	
194
	}	
191
}
195
}

Return to bug 249588