You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2010/05/18 14:33:43 UTC

svn commit: r945620 - in /uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards: ImportDocumentWizard.java ImportDocumentWizardPage.java

Author: joern
Date: Tue May 18 12:33:43 2010
New Revision: 945620

URL: http://svn.apache.org/viewvc?rev=945620&view=rev
Log:
UIMA-1782 Invalid encoding is now displayed in the page error status

Modified:
    uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java
    uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java

Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java?rev=945620&r1=945619&r2=945620&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizard.java Tue May 18 12:33:43 2010
@@ -42,7 +42,9 @@ public final class ImportDocumentWizard 
   public void init(IWorkbench workbench, IStructuredSelection selection) {
     mCurrentResourceSelection = selection; // if corpus set as import corpus
 
-    setWindowTitle("Import Documents");
+    // Did not find a way to retrieve the "Import" string
+    // from an eclipse message file
+    setWindowTitle("Import");
   }
 
   @Override

Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java?rev=945620&r1=945619&r2=945620&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/ui/wizards/ImportDocumentWizardPage.java Tue May 18 12:33:43 2010
@@ -80,7 +80,7 @@ final class ImportDocumentWizardPage ext
       IStructuredSelection currentResourceSelection) {
     super(pageName);
 
-    setMessage("Please select the documents to import.");
+    setTitle("Import Text Files");
 
     if (!currentResourceSelection.isEmpty()) {
       if (currentResourceSelection.getFirstElement() instanceof CorpusElement) {
@@ -92,7 +92,7 @@ final class ImportDocumentWizardPage ext
     setPageComplete(false);
   }
 
-  private void computePageComplete() {
+  private void updatePageState() {
 	  
 	boolean isEncodingSupported = false;
 	
@@ -104,6 +104,18 @@ final class ImportDocumentWizardPage ext
 		// it cannot exist
 		
 	}
+	
+	String errorMessage = null;
+	if (!isEncodingSupported)
+		errorMessage ="Invalid text import encoding!";
+	
+	// error message is always displayed instead of status message
+	// if both are set
+	setErrorMessage(errorMessage);
+	setMessage("Please select the documents to import.");
+	
+	
+	
     setPageComplete(importDestinationPath != null && 
     		fileTable.getTable().getItemCount() > 0
     		&& isEncodingSupported);
@@ -142,7 +154,7 @@ final class ImportDocumentWizardPage ext
             fileTable.add(new File(fd.getFilterPath() + File.separator + fileItem));
           }
 
-          computePageComplete();
+          updatePageState();
         }
       }
     });
@@ -174,7 +186,7 @@ final class ImportDocumentWizardPage ext
 
         fileTable.remove(selectedElements);
 
-        computePageComplete();
+        updatePageState();
       }
     });
 
@@ -283,7 +295,7 @@ final class ImportDocumentWizardPage ext
 
           corpusText.setText(importDestinationPath.toString());
 
-          computePageComplete();
+          updatePageState();
         }
       }
     });
@@ -322,7 +334,7 @@ final class ImportDocumentWizardPage ext
 		
 		public void widgetSelected(SelectionEvent e) {
 			importEncoding = encodingCombo.getText();
-			computePageComplete();
+			updatePageState();
 		}
 		
 		public void widgetDefaultSelected(SelectionEvent e) {
@@ -333,7 +345,7 @@ final class ImportDocumentWizardPage ext
 		
 		public void keyReleased(KeyEvent e) {
 			importEncoding = encodingCombo.getText();
-			computePageComplete();
+			updatePageState();
 		}
 		
 		public void keyPressed(KeyEvent e) {
@@ -359,8 +371,7 @@ final class ImportDocumentWizardPage ext
 		}
 	});
     
-    
-    computePageComplete();
+    updatePageState();
     
     setControl(composite);
   }