This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch 
refactoring/UIMA-6373-Format-UIMA-Core-Java-SDK-codebase
in repository https://gitbox.apache.org/repos/asf/uima-uimaj.git

commit 585a8fe6cea1d1f7d0a496896333f376c8a40625
Author: Richard Eckart de Castilho <[email protected]>
AuthorDate: Thu Feb 10 15:18:08 2022 +0100

    [UIMA-6373] Format UIMA Core Java SDK codebase
    
    - Auto-format
---
 .../uima/caseditor/ide/CasEditorIdePlugin.java     | 172 +++++++--------
 .../ide/CasEditorIdePreferenceConstants.java       |  11 +-
 .../ide/CasEditorIdePreferenceInitializer.java     |  20 +-
 .../caseditor/ide/CasEditorIdePreferencePage.java  |   7 +-
 .../caseditor/ide/CasEditorPerspectiveFactory.java |  32 ++-
 .../caseditor/ide/CasEditorPreferencePage.java     |   8 +-
 .../caseditor/ide/DefaultCasDocumentProvider.java  |  74 +++----
 .../org/apache/uima/caseditor/ide/NlpProject.java  |   4 +-
 .../ide/TypeSystemLocationPropertyPage.java        |  92 ++++----
 .../caseditor/ide/WorkspaceResourceDialog.java     | 100 ++++-----
 .../TypeSystemSearchStrategyFactory.java           |   4 +-
 .../ide/wizards/ContainerElementFilter.java        |   2 +-
 .../wizards/DocumentImportStructureProvider.java   |   3 +-
 .../ide/wizards/ImportDocumentWizard.java          |  60 +++---
 .../ide/wizards/ImportDocumentWizardPage.java      | 236 ++++++++++-----------
 .../uima/caseditor/ide/wizards/OverwriteQuery.java |  28 ++-
 16 files changed, 415 insertions(+), 438 deletions(-)

diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java
index 8e8d40e..d5ad178 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePlugin.java
@@ -47,7 +47,7 @@ public class CasEditorIdePlugin extends AbstractUIPlugin {
    */
   private static CasEditorIdePlugin sPlugin;
 
-       /**
+  /**
    * The constructor.
    */
   public CasEditorIdePlugin() {
@@ -57,101 +57,104 @@ public class CasEditorIdePlugin extends AbstractUIPlugin {
   /**
    * This method is called upon plug-in activation
    *
-   * @param context -
-   * @throws Exception -
+   * @param context
+   *          -
+   * @throws Exception
+   *           -
    */
   @Override
   public void start(BundleContext context) throws Exception {
-           super.start(context);
-           
-           // Backward compatibility: Migrate old Cas Editor Projects
-           
-           // Scan for all Nlp nature projects
-           IProject projects[] = 
ResourcesPlugin.getWorkspace().getRoot().getProjects();
-           
-           for (IProject project : projects) {
-             // if nlp nature project
-             
-             if (project.isOpen() && 
project.hasNature("org.apache.uima.caseditor.NLPProject")) {
-               
-               // if ts property is not set ... 
-               String typeSystemLocation;
-               try {
-                 typeSystemLocation = project.getPersistentProperty(new 
QualifiedName("", 
-                                 
TypeSystemLocationPropertyPage.TYPE_SYSTEM_PROPERTY));
-               } catch (CoreException e) {
-                 typeSystemLocation = null;
-               }
-               
-               if (typeSystemLocation == null) {
-                 // 1. Read dotCorpus
-                 IFile dotCorpusFile = project.getFile(".corpus");
-                 
-                 
-                 if (dotCorpusFile.exists()) {
-                   
-                   InputStream dotCorpusIn = null;
-                   
-                   try {
-                     dotCorpusIn = dotCorpusFile.getContents();
-                   }
-                   catch (CoreException e) {
-                     log(e);
-                   }
-                   
-                   IFile typeSystemFile = null;
-                   if (dotCorpusIn != null) {
-                     try {
-                       DotCorpus dotCorpus = 
DotCorpusSerializer.parseDotCorpus(dotCorpusIn);
-                       
-                       if (dotCorpus.getTypeSystemFileName() != null) {
-                        typeSystemFile = 
project.getFile(dotCorpus.getTypeSystemFileName());
-                    }
-                     }
-                     finally {
-                       try {
-                         dotCorpusIn.close();
-                       }
-                       catch (IOException e) {
-                         log(e);
-                       }
-                     }
-                   }
-                   
-                   if (typeSystemFile != null && typeSystemFile.exists()) {
-                     // 2. Set type system file accordingly
-                     
TypeSystemLocationPropertyPage.setTypeSystemLocation(project, 
typeSystemFile.getFullPath().toString());
-                     
-                     // 3. Try to copy dotCorpus file to type system location
-                     try {
-                       
dotCorpusFile.copy(project.getFile(typeSystemFile.getParent().getProjectRelativePath()
 + "/" 
-                               + ".style-" + 
typeSystemFile.getName()).getFullPath(), true, null);
-                       CasEditorPlugin.getDefault().setShowMigrationDialog();
-                     } catch (CoreException e) {
-                       log(e);
-                     }
-                   }
-                 }
-               }
-             }
-           }
-         }
+    super.start(context);
+
+    // Backward compatibility: Migrate old Cas Editor Projects
+
+    // Scan for all Nlp nature projects
+    IProject projects[] = 
ResourcesPlugin.getWorkspace().getRoot().getProjects();
+
+    for (IProject project : projects) {
+      // if nlp nature project
+
+      if (project.isOpen() && 
project.hasNature("org.apache.uima.caseditor.NLPProject")) {
+
+        // if ts property is not set ...
+        String typeSystemLocation;
+        try {
+          typeSystemLocation = project.getPersistentProperty(
+                  new QualifiedName("", 
TypeSystemLocationPropertyPage.TYPE_SYSTEM_PROPERTY));
+        } catch (CoreException e) {
+          typeSystemLocation = null;
+        }
+
+        if (typeSystemLocation == null) {
+          // 1. Read dotCorpus
+          IFile dotCorpusFile = project.getFile(".corpus");
+
+          if (dotCorpusFile.exists()) {
+
+            InputStream dotCorpusIn = null;
+
+            try {
+              dotCorpusIn = dotCorpusFile.getContents();
+            } catch (CoreException e) {
+              log(e);
+            }
+
+            IFile typeSystemFile = null;
+            if (dotCorpusIn != null) {
+              try {
+                DotCorpus dotCorpus = 
DotCorpusSerializer.parseDotCorpus(dotCorpusIn);
+
+                if (dotCorpus.getTypeSystemFileName() != null) {
+                  typeSystemFile = 
project.getFile(dotCorpus.getTypeSystemFileName());
+                }
+              } finally {
+                try {
+                  dotCorpusIn.close();
+                } catch (IOException e) {
+                  log(e);
+                }
+              }
+            }
+
+            if (typeSystemFile != null && typeSystemFile.exists()) {
+              // 2. Set type system file accordingly
+              TypeSystemLocationPropertyPage.setTypeSystemLocation(project,
+                      typeSystemFile.getFullPath().toString());
+
+              // 3. Try to copy dotCorpus file to type system location
+              try {
+                dotCorpusFile.copy(
+                        
project.getFile(typeSystemFile.getParent().getProjectRelativePath() + "/"
+                                + ".style-" + 
typeSystemFile.getName()).getFullPath(),
+                        true, null);
+                CasEditorPlugin.getDefault().setShowMigrationDialog();
+              } catch (CoreException e) {
+                log(e);
+              }
+            }
+          }
+        }
+      }
+    }
+  }
 
   /**
    * This method is called when the plug-in is stopped.
    *
-   * @param context -
-   * @throws Exception -
+   * @param context
+   *          -
+   * @throws Exception
+   *           -
    */
   @Override
   public void stop(BundleContext context) throws Exception {
     super.stop(context);
 
     sPlugin = null;
-         /**
-          * Resource bundle.
-          */
-         ResourceBundle mResourceBundle = null;
+    /**
+     * Resource bundle.
+     */
+    ResourceBundle mResourceBundle = null;
   }
 
   /**
@@ -166,7 +169,8 @@ public class CasEditorIdePlugin extends AbstractUIPlugin {
   /**
    * Log the throwable.
    *
-   * @param t -
+   * @param t
+   *          -
    */
   public static void log(Throwable t) {
     getDefault().getLog().log(new Status(IStatus.ERROR, ID, IStatus.OK, 
t.getMessage(), t));
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferenceConstants.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferenceConstants.java
index 18278d9..2a3ffce 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferenceConstants.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferenceConstants.java
@@ -22,12 +22,11 @@ package org.apache.uima.caseditor.ide;
 public class CasEditorIdePreferenceConstants {
 
   public static final String STRING_DELIMITER = ";";
-  
-  public static final String CAS_IMPORT_WIZARD_LAST_USED_LANG =
-          "CAS_IMPORT_WIZARD_LAST_USED_LANG";
-  
+
+  public static final String CAS_IMPORT_WIZARD_LAST_USED_LANG = 
"CAS_IMPORT_WIZARD_LAST_USED_LANG";
+
   public static final String CAS_IMPORT_WIZARD_LAST_USED_ENCODINGS = 
"CAS_IMPORT_WIZARD_ENCODINGS";
-  
+
   public static final String CAS_EDITOR_REMEMBER_TYPESYSTEM = 
"CAS_EDITOR_REMEMBER_TYPESYSTEM";
-  
+
 }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferenceInitializer.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferenceInitializer.java
index dbfa745..875b302 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferenceInitializer.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferenceInitializer.java
@@ -27,16 +27,16 @@ import org.eclipse.jface.preference.IPreferenceStore;
 
 public class CasEditorIdePreferenceInitializer extends 
AbstractPreferenceInitializer {
 
-       @Override
+  @Override
   public void initializeDefaultPreferences() {
-               IPreferenceStore store = 
CasEditorIdePlugin.getDefault().getPreferenceStore();
-               
store.setDefault(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_LANG,
-                       CAS.DEFAULT_LANGUAGE_NAME);
-               
-               
store.setDefault(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_ENCODINGS,
-                       Charset.defaultCharset().displayName());
-               
+    IPreferenceStore store = 
CasEditorIdePlugin.getDefault().getPreferenceStore();
+    
store.setDefault(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_LANG,
+            CAS.DEFAULT_LANGUAGE_NAME);
+
+    
store.setDefault(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_ENCODINGS,
+            Charset.defaultCharset().displayName());
+
     
store.setDefault(CasEditorIdePreferenceConstants.CAS_EDITOR_REMEMBER_TYPESYSTEM,
 true);
-               
-       }
+
+  }
 }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferencePage.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferencePage.java
index 6e0807e..2df1fd8 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferencePage.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorIdePreferencePage.java
@@ -37,10 +37,11 @@ public class CasEditorIdePreferencePage extends 
FieldEditorPreferencePage
 
   @Override
   protected void createFieldEditors() {
-   
+
     // should the editor use the last selected type system to open the cas?
-    BooleanFieldEditor mEditorRememberTypesystem = new 
BooleanFieldEditor(CasEditorIdePreferenceConstants.CAS_EDITOR_REMEMBER_TYPESYSTEM,
-        "Use the previously selected type system to open a CAS", 
getFieldEditorParent());
+    BooleanFieldEditor mEditorRememberTypesystem = new BooleanFieldEditor(
+            CasEditorIdePreferenceConstants.CAS_EDITOR_REMEMBER_TYPESYSTEM,
+            "Use the previously selected type system to open a CAS", 
getFieldEditorParent());
     addField(mEditorRememberTypesystem);
   }
 
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorPerspectiveFactory.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorPerspectiveFactory.java
index acf7045..ec33646 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorPerspectiveFactory.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorPerspectiveFactory.java
@@ -19,7 +19,6 @@
 
 package org.apache.uima.caseditor.ide;
 
-
 import org.apache.uima.caseditor.editor.editview.EditView;
 import org.apache.uima.caseditor.editor.fsview.FeatureStructureBrowserView;
 import org.apache.uima.caseditor.editor.styleview.AnnotationStyleView;
@@ -28,17 +27,15 @@ import org.eclipse.ui.IPageLayout;
 import org.eclipse.ui.IPerspectiveFactory;
 
 /**
- * This <code>PerspectiveFactory</code> generates the initial layout
- * for the NLP perspective.
+ * This <code>PerspectiveFactory</code> generates the initial layout for the 
NLP perspective.
  */
 public class CasEditorPerspectiveFactory implements IPerspectiveFactory {
-  
+
   /**
-   * ID of the perspective factory. Use this ID for example in the plugin.xml
-   * file.
+   * ID of the perspective factory. Use this ID for example in the plugin.xml 
file.
    *
-   * Note: This id should also be changed, but that will break existing
-   * perspectives, and might confuse users.
+   * Note: This id should also be changed, but that will break existing 
perspectives, and might
+   * confuse users.
    */
   public static String ID = "org.apache.uima.caseditor.perspective.NLP";
 
@@ -58,7 +55,6 @@ public class CasEditorPerspectiveFactory implements 
IPerspectiveFactory {
     layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
     layout.addShowViewShortcut(AnnotationStyleView.ID);
 
-    
     // add "open perspective"
     layout.addPerspectiveShortcut(CasEditorPerspectiveFactory.ID);
   }
@@ -67,29 +63,27 @@ public class CasEditorPerspectiveFactory implements 
IPerspectiveFactory {
     String editorArea = layout.getEditorArea();
 
     // left views
-    IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT,
-            0.19f, editorArea);
+    IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.19f, 
editorArea);
     left.addView("org.eclipse.ui.navigator.ProjectExplorer");
 
     // right views
-    IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT,
-            0.70f, editorArea);
+    IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT, 
0.70f, editorArea);
 
     right.addView(IPageLayout.ID_OUTLINE);
     right.addView(FeatureStructureBrowserView.ID);
-    
-    IFolderLayout rightBottomCorner  = 
layout.createFolder("rightBottomCorner", IPageLayout.BOTTOM,
+
+    IFolderLayout rightBottomCorner = layout.createFolder("rightBottomCorner", 
IPageLayout.BOTTOM,
             0.75f, "right");
     rightBottomCorner.addView(AnnotationStyleView.ID);
 
     // bottom views
-    IFolderLayout rightBottom = layout.createFolder("rightBottom",
-            IPageLayout.BOTTOM, 0.75f, editorArea);
+    IFolderLayout rightBottom = layout.createFolder("rightBottom", 
IPageLayout.BOTTOM, 0.75f,
+            editorArea);
 
     rightBottom.addView(EditView.ID);
 
-    IFolderLayout leftBottom = layout.createFolder("leftBottom",
-            IPageLayout.RIGHT, 0.5f, EditView.ID);
+    IFolderLayout leftBottom = layout.createFolder("leftBottom", 
IPageLayout.RIGHT, 0.5f,
+            EditView.ID);
 
     leftBottom.addView(EditView.ID_2);
   }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorPreferencePage.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorPreferencePage.java
index 8053fbc..bef2a06 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorPreferencePage.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/CasEditorPreferencePage.java
@@ -24,21 +24,21 @@ import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
 public class CasEditorPreferencePage extends FieldEditorPreferencePage
-  implements IWorkbenchPreferencePage {
+        implements IWorkbenchPreferencePage {
 
   public CasEditorPreferencePage() {
     // TODO uncomment, if you really want to use this page
     // setPreferenceStore(CasEditorPlugin.getDefault().getPreferenceStore());
     setDescription("General Cas Editor Preferences.");
   }
-  
+
   @Override
   public void init(IWorkbench arg0) {
-    
+
   }
 
   @Override
   protected void createFieldEditors() {
-    
+
   }
 }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/DefaultCasDocumentProvider.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/DefaultCasDocumentProvider.java
index 7c98225..ecab50f 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/DefaultCasDocumentProvider.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/DefaultCasDocumentProvider.java
@@ -70,8 +70,8 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.part.FileEditorInput;
 
-public class DefaultCasDocumentProvider extends
-        org.apache.uima.caseditor.editor.CasDocumentProvider {
+public class DefaultCasDocumentProvider
+        extends org.apache.uima.caseditor.editor.CasDocumentProvider {
 
   /**
    * Listens for resource events: If the input file for the editor is removed 
the editor will be
@@ -100,7 +100,7 @@ public class DefaultCasDocumentProvider extends
                 if (delta.getKind() == IResourceDelta.REMOVED) {
                   handleElementDeleted(fileInput);
                 } else if (delta.getKind() == IResourceDelta.CHANGED) {
-                  
+
                   if (isFileChangeTrackingEnabled)
                     handleElementChanged(fileInput);
                 }
@@ -168,13 +168,13 @@ public class DefaultCasDocumentProvider extends
   private Map<String, String> documentToTypeSystemMap = new HashMap<>();
 
   /**
-   * This map stores temporarily the type system that should be used to open 
the next document.
-   * This functionality is separated from documentToTypeSystemMap since the 
preference for using 
-   * the previously selected type system can be deactivated. The inlined file 
choose, for example, 
-   * uses this field to remember the chosen type system.
+   * This map stores temporarily the type system that should be used to open 
the next document. This
+   * functionality is separated from documentToTypeSystemMap since the 
preference for using the
+   * previously selected type system can be deactivated. The inlined file 
choose, for example, uses
+   * this field to remember the chosen type system.
    */
   private Map<String, String> typeSystemForNextDocumentOnly = new HashMap<>();
-  
+
   private Map<String, IPreferenceStore> sessionPreferenceStores = new 
HashMap<>();
 
   /**
@@ -182,7 +182,7 @@ public class DefaultCasDocumentProvider extends
    * while the editor is open.
    */
   private Map<String, PreferenceStore> typeSystemPreferences = new HashMap<>();
-  
+
   private boolean isFileChangeTrackingEnabled = true;
 
   // UIMA-2245 Remove this method together with the migration code below one 
day
@@ -226,20 +226,19 @@ public class DefaultCasDocumentProvider extends
       // set by the editor for this specific CAS.
       // apply that type system only if the setting is active in the 
preferences
       String typeSystemFileString = null;
-      
+
       String document = casFile.getFullPath().toPortableString();
-      if(typeSystemForNextDocumentOnly.get(document) != null) {
+      if (typeSystemForNextDocumentOnly.get(document) != null) {
         // the type system was already set internally. Use this one and forget 
the information.
         typeSystemFileString = typeSystemForNextDocumentOnly.get(document);
         typeSystemForNextDocumentOnly.put(document, null);
       }
-      
+
       IPreferenceStore prefStore = 
CasEditorIdePlugin.getDefault().getPreferenceStore();
       boolean useLastTypesystem = prefStore
               
.getBoolean(CasEditorIdePreferenceConstants.CAS_EDITOR_REMEMBER_TYPESYSTEM);
       if (typeSystemFileString == null && useLastTypesystem) {
-        typeSystemFileString = documentToTypeSystemMap
-                .get(document);
+        typeSystemFileString = documentToTypeSystemMap.get(document);
       }
       if (typeSystemFileString != null)
         typeSystemFile = ResourcesPlugin.getWorkspace().getRoot()
@@ -278,15 +277,11 @@ public class DefaultCasDocumentProvider extends
         // colors could change completely when the a type is
         // added or removed to the type system
 
-        IFile prefFile = ResourcesPlugin
-                .getWorkspace()
-                .getRoot()
-                .getFile(
-                        new 
Path(getPreferenceFileForTypeSystem(typeSystemFile.getFullPath()
-                                .toPortableString())));
+        IFile prefFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new 
Path(
+                
getPreferenceFileForTypeSystem(typeSystemFile.getFullPath().toPortableString())));
 
-        PreferenceStore tsPrefStore = 
typeSystemPreferences.get(prefFile.getFullPath()
-                .toPortableString());
+        PreferenceStore tsPrefStore = typeSystemPreferences
+                .get(prefFile.getFullPath().toPortableString());
 
         // If lookup for store failed ...
         if (tsPrefStore == null) {
@@ -304,12 +299,8 @@ public class DefaultCasDocumentProvider extends
             // If there is DotCorpus style file and not yet a preference store 
file
             // the settings from the DotCorpus style file should be written 
into a preference store
             // file.
-            IFile styleFile = ResourcesPlugin
-                    .getWorkspace()
-                    .getRoot()
-                    .getFile(
-                            new 
Path(getStyleFileForTypeSystem(typeSystemFile.getFullPath()
-                                    .toPortableString())));
+            IFile styleFile = 
ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(
+                    
getStyleFileForTypeSystem(typeSystemFile.getFullPath().toPortableString())));
 
             if (styleFile.exists()) {
               InputStream styleFileIn = null;
@@ -372,8 +363,7 @@ public class DefaultCasDocumentProvider extends
           typeSystemPreferences.put(prefFile.getFullPath().toPortableString(), 
tsPrefStore);
         }
 
-        documentToTypeSystemMap.put(document, typeSystemFile
-                .getFullPath().toPortableString());
+        documentToTypeSystemMap.put(document, 
typeSystemFile.getFullPath().toPortableString());
 
         IPreferenceStore store = 
sessionPreferenceStores.get(getTypesystemId(element));
 
@@ -382,12 +372,13 @@ public class DefaultCasDocumentProvider extends
           sessionPreferenceStores.put(getTypesystemId(element), newStore);
           newStore.addPropertyChangeListener(new 
SaveSessionPreferencesTrigger(element));
 
-          String sessionPreferenceString = 
typeSystemFile.getPersistentProperty(new QualifiedName(
-                  "", CAS_EDITOR_SESSION_PROPERTIES));
+          String sessionPreferenceString = typeSystemFile
+                  .getPersistentProperty(new QualifiedName("", 
CAS_EDITOR_SESSION_PROPERTIES));
 
           if (sessionPreferenceString != null) {
             try {
-              newStore.load(new 
ByteArrayInputStream(sessionPreferenceString.getBytes(StandardCharsets.UTF_8)));
+              newStore.load(new ByteArrayInputStream(
+                      
sessionPreferenceString.getBytes(StandardCharsets.UTF_8)));
             } catch (IOException e) {
               CasEditorPlugin.log(e);
             }
@@ -400,7 +391,8 @@ public class DefaultCasDocumentProvider extends
 
         CAS cas = DocumentUimaImpl.getVirginCAS(typeSystemFile);
 
-        ICasDocument   doc = new DocumentUimaImpl(cas, casFile, 
typeSystemFile.getFullPath().makeRelative().toString());
+        ICasDocument doc = new DocumentUimaImpl(cas, casFile,
+                typeSystemFile.getFullPath().makeRelative().toString());
 
         elementErrorStatus.remove(element);
 
@@ -442,13 +434,12 @@ public class DefaultCasDocumentProvider extends
         documentImpl.serialize(outStream);
 
         InputStream stream = new ByteArrayInputStream(outStream.toByteArray());
-        
+
         isFileChangeTrackingEnabled = false;
-        
+
         try {
           file.setContents(stream, true, false, null);
-        }
-        finally {
+        } finally {
           isFileChangeTrackingEnabled = true;
         }
       }
@@ -522,8 +513,7 @@ public class DefaultCasDocumentProvider extends
   void setTypeSystemForNextDocumentOnly(String document, String typeSystem) {
     typeSystemForNextDocumentOnly.put(document, typeSystem);
   }
-  
-  
+
   @Override
   public Composite createTypeSystemSelectorForm(final ICasEditor editor, 
Composite parent,
           IStatus status) {
@@ -546,8 +536,8 @@ public class DefaultCasDocumentProvider extends
       public void widgetSelected(SelectionEvent e) {
 
         // Open a dialog to let the user choose a type system
-        IResource resource = 
WorkspaceResourceDialog.getWorkspaceResourceElement(Display
-                .getCurrent().getActiveShell(), 
ResourcesPlugin.getWorkspace().getRoot(),
+        IResource resource = 
WorkspaceResourceDialog.getWorkspaceResourceElement(
+                Display.getCurrent().getActiveShell(), 
ResourcesPlugin.getWorkspace().getRoot(),
                 "Select a Type System", "Please select a Type System:");
 
         if (resource != null) {
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/NlpProject.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/NlpProject.java
index ff932eb..ca6b0e1 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/NlpProject.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/NlpProject.java
@@ -26,11 +26,11 @@ import org.eclipse.core.runtime.CoreException;
 public final class NlpProject implements IProjectNature {
 
   private IProject project;
-  
+
   @Override
   public void configure() throws CoreException {
   }
-  
+
   @Override
   public void deconfigure() throws CoreException {
   }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/TypeSystemLocationPropertyPage.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/TypeSystemLocationPropertyPage.java
index 0bbe14d..b6ce30c 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/TypeSystemLocationPropertyPage.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/TypeSystemLocationPropertyPage.java
@@ -45,8 +45,7 @@ import org.eclipse.ui.model.WorkbenchContentProvider;
 import org.eclipse.ui.model.WorkbenchLabelProvider;
 
 /**
- * Type System Property Page to set the default type system location
- * of a project.
+ * Type System Property Page to set the default type system location of a 
project.
  */
 public class TypeSystemLocationPropertyPage extends PropertyPage {
 
@@ -56,25 +55,23 @@ public class TypeSystemLocationPropertyPage extends 
PropertyPage {
 
   private Text typeSystemText;
 
-  
   IProject getProject() {
     return (IProject) getElement().getAdapter(IProject.class);
   }
-  
+
   String getDefaultTypeSystemLocation() {
-    
+
     IProject project = getProject();
-    
+
     if (project != null) {
-        return 
project.getFile(DEFAULT_TYPE_SYSTEM_PATH).getFullPath().toString();
-    }
-    else {
-        return "";
+      return 
project.getFile(DEFAULT_TYPE_SYSTEM_PATH).getFullPath().toString();
+    } else {
+      return "";
     }
   }
-  
+
   @Override
-protected Control createContents(Composite parent) {
+  protected Control createContents(Composite parent) {
     Composite composite = new Composite(parent, SWT.NONE);
     GridLayout layout = new GridLayout();
     layout.numColumns = 2;
@@ -92,38 +89,39 @@ protected Control createContents(Composite parent) {
     gd.grabExcessHorizontalSpace = true;
     instructions.setLayoutData(gd);
 
-    typeSystemText = new Text(composite,SWT.BORDER);
+    typeSystemText = new Text(composite, SWT.BORDER);
     gd = new GridData(GridData.FILL_HORIZONTAL);
     typeSystemText.setLayoutData(gd);
 
     typeSystemText.addModifyListener(new ModifyListener() {
-      
+
       @Override
-    public void modifyText(ModifyEvent event) {
+      public void modifyText(ModifyEvent event) {
         updateApplyButton();
       }
     });
-    
+
     try {
-      String typeSystemPath = ((IResource) 
getElement()).getPersistentProperty(new QualifiedName("",
-              TYPE_SYSTEM_PROPERTY));
-      typeSystemText.setText((typeSystemPath != null) ? typeSystemPath : 
getDefaultTypeSystemLocation());
+      String typeSystemPath = ((IResource) getElement())
+              .getPersistentProperty(new QualifiedName("", 
TYPE_SYSTEM_PROPERTY));
+      typeSystemText
+              .setText((typeSystemPath != null) ? typeSystemPath : 
getDefaultTypeSystemLocation());
     } catch (CoreException e) {
       typeSystemText.setText(DEFAULT_TYPE_SYSTEM_PATH);
     }
-    
+
     Button browseButton = new Button(composite, SWT.PUSH);
     browseButton.setText("Browse ...");
     browseButton.addSelectionListener(new SelectionAdapter() {
       @Override
-    public void widgetSelected(SelectionEvent e) {
+      public void widgetSelected(SelectionEvent e) {
         ElementTreeSelectionDialog dialog = new 
ElementTreeSelectionDialog(getShell(),
                 new WorkbenchLabelProvider(), new WorkbenchContentProvider());
         dialog.setTitle("Select descriptor");
         dialog.setMessage("Select descriptor");
         dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
-        dialog.setInitialSelection(ResourcesPlugin.getWorkspace().getRoot().
-                findMember(typeSystemText.getText()));
+        dialog.setInitialSelection(
+                
ResourcesPlugin.getWorkspace().getRoot().findMember(typeSystemText.getText()));
         if (dialog.open() == IDialogConstants.OK_ID) {
           IResource resource = (IResource) dialog.getFirstResult();
           if (resource != null) {
@@ -133,24 +131,24 @@ protected Control createContents(Composite parent) {
         }
       }
     });
-    
+
     return composite;
   }
 
   @Override
-protected void performDefaults() {
+  protected void performDefaults() {
     typeSystemText.setText(getDefaultTypeSystemLocation());
   }
-  
+
   @Override
-public boolean performOk() {
-    
+  public boolean performOk() {
+
     // have check, so performOk is only done when ts file is a valid file 
string
-    
+
     // store the value in the owner text field
     try {
-      ((IResource) getElement()).setPersistentProperty(
-              new QualifiedName("", TYPE_SYSTEM_PROPERTY), 
typeSystemText.getText());
+      ((IResource) getElement()).setPersistentProperty(new QualifiedName("", 
TYPE_SYSTEM_PROPERTY),
+              typeSystemText.getText());
     } catch (CoreException e) {
       return false;
     }
@@ -160,29 +158,32 @@ public boolean performOk() {
   /**
    * Retrieves the type system or null if its not set.
    * 
-   * @param project -
+   * @param project
+   *          -
    * @return the type system location or null if its not set
    */
   public static IFile getTypeSystemLocation(IProject project) {
-    
+
     IFile defaultTypeSystemFile = project.getFile(DEFAULT_TYPE_SYSTEM_PATH);
-    
+
     String typeSystemLocation;
     try {
-      typeSystemLocation = project.getPersistentProperty(new QualifiedName("", 
TYPE_SYSTEM_PROPERTY));
+      typeSystemLocation = project
+              .getPersistentProperty(new QualifiedName("", 
TYPE_SYSTEM_PROPERTY));
     } catch (CoreException e) {
       typeSystemLocation = null;
     }
-    
+
     IFile typeSystemFile = null;
-    
+
     // Type system location is null when it was never set it anyway,
     if (typeSystemLocation != null) {
-      
+
       if (typeSystemLocation.length() > 0) {
-          IResource potentialTypeSystemResource = 
ResourcesPlugin.getWorkspace().getRoot().findMember(typeSystemLocation);
-          if (potentialTypeSystemResource instanceof IFile) {
-            typeSystemFile = (IFile) potentialTypeSystemResource;
+        IResource potentialTypeSystemResource = 
ResourcesPlugin.getWorkspace().getRoot()
+                .findMember(typeSystemLocation);
+        if (potentialTypeSystemResource instanceof IFile) {
+          typeSystemFile = (IFile) potentialTypeSystemResource;
         }
       }
       // Empty string means user does not want a type system to be set
@@ -190,18 +191,19 @@ public boolean performOk() {
         return null;
       }
     }
-    
+
     if (typeSystemFile == null) {
       typeSystemFile = defaultTypeSystemFile;
     }
-    
+
     return typeSystemFile;
   }
 
   public static void setTypeSystemLocation(IProject project, String 
typeSystemLocation) {
-    
+
     try {
-      project.setPersistentProperty(new QualifiedName("", 
TYPE_SYSTEM_PROPERTY), typeSystemLocation);
+      project.setPersistentProperty(new QualifiedName("", 
TYPE_SYSTEM_PROPERTY),
+              typeSystemLocation);
     } catch (CoreException e) {
       CasEditorPlugin.log(e);
     }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/WorkspaceResourceDialog.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/WorkspaceResourceDialog.java
index bce5621..68ded5b 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/WorkspaceResourceDialog.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/WorkspaceResourceDialog.java
@@ -33,57 +33,57 @@ import org.eclipse.ui.views.navigator.ResourceSorter;
  * 
  *
  */
-public class WorkspaceResourceDialog 
-{
-    public static IResource getWorkspaceResourceElement (Shell shell, 
IResource root,
-                                    String dialogTitle, String dialogMessage) 
-    {
-        IResource resource = null;
-        
-        ElementTreeSelectionDialog dialog = new 
ElementTreeSelectionDialog(shell, 
-                new WorkbenchLabelProvider(), new WorkbenchContentProvider());
-        dialog.setTitle(dialogTitle); 
-        dialog.setMessage(dialogMessage); 
-        dialog.setInput(root); 
-        dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
-        int buttonId = dialog.open();
-        if (buttonId == IDialogConstants.OK_ID) {
-            resource = (IResource) dialog.getFirstResult();
-            if (!resource.isAccessible()) {
-                return null;
-            }
-            if (resource instanceof IContainer) {
-            }
-            String arg = resource.getFullPath().toString();
-            // String fileLoc = 
VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc",
 arg); //$NON-NLS-1$
-            // Trace.trace("resource.getFullPath().toString():" + arg);
-            // Trace.trace(fileLoc);
-            // selectedElement = resource.getLocation().toOSString();
-        }
-        return resource;
-    }
+public class WorkspaceResourceDialog {
+  public static IResource getWorkspaceResourceElement(Shell shell, IResource 
root,
+          String dialogTitle, String dialogMessage) {
+    IResource resource = null;
 
+    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(shell,
+            new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+    dialog.setTitle(dialogTitle);
+    dialog.setMessage(dialogMessage);
+    dialog.setInput(root);
+    dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
+    int buttonId = dialog.open();
+    if (buttonId == IDialogConstants.OK_ID) {
+      resource = (IResource) dialog.getFirstResult();
+      if (!resource.isAccessible()) {
+        return null;
+      }
+      if (resource instanceof IContainer) {
+      }
+      String arg = resource.getFullPath().toString();
+      // String fileLoc =
+      // 
VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc",
+      // arg); //$NON-NLS-1$
+      // Trace.trace("resource.getFullPath().toString():" + arg);
+      // Trace.trace(fileLoc);
+      // selectedElement = resource.getLocation().toOSString();
+    }
+    return resource;
+  }
 
-    public static IResource getWorkspaceResourceElement (Shell shell) 
-    {
-        IResource resource = null;
-        ElementTreeSelectionDialog dialog = new 
ElementTreeSelectionDialog(shell, 
-                new WorkbenchLabelProvider(), new WorkbenchContentProvider());
-        dialog.setTitle("Select Cpe descriptor"); 
-        dialog.setMessage("Select Cpe Xml descriptor file"); 
-        dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); 
-        dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
-        int buttonId = dialog.open();
-        if (buttonId == IDialogConstants.OK_ID) {
-            resource = (IResource) dialog.getFirstResult();
-            if (!resource.isAccessible()) {
-                return null;
-            }
-            String arg = resource.getFullPath().toString();
-            // String fileLoc = 
VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc",
 arg); //$NON-NLS-1$
-            // Trace.trace(fileLoc);
-            // selectedElement = resource.getLocation().toOSString();
-        }
-        return resource;
+  public static IResource getWorkspaceResourceElement(Shell shell) {
+    IResource resource = null;
+    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(shell,
+            new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+    dialog.setTitle("Select Cpe descriptor");
+    dialog.setMessage("Select Cpe Xml descriptor file");
+    dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+    dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
+    int buttonId = dialog.open();
+    if (buttonId == IDialogConstants.OK_ID) {
+      resource = (IResource) dialog.getFirstResult();
+      if (!resource.isAccessible()) {
+        return null;
+      }
+      String arg = resource.getFullPath().toString();
+      // String fileLoc =
+      // 
VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc",
+      // arg); //$NON-NLS-1$
+      // Trace.trace(fileLoc);
+      // selectedElement = resource.getLocation().toOSString();
     }
+    return resource;
+  }
 }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/searchstrategy/TypeSystemSearchStrategyFactory.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/searchstrategy/TypeSystemSearchStrategyFactory.java
index 120affc..a903a5a 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/searchstrategy/TypeSystemSearchStrategyFactory.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/searchstrategy/TypeSystemSearchStrategyFactory.java
@@ -37,8 +37,8 @@ public class TypeSystemSearchStrategyFactory {
 
   private TypeSystemSearchStrategyFactory() {
 
-    IConfigurationElement[] config = 
Platform.getExtensionRegistry().getConfigurationElementsFor(
-            SEARCH_STRATEGY_EXTENSION);
+    IConfigurationElement[] config = Platform.getExtensionRegistry()
+            .getConfigurationElementsFor(SEARCH_STRATEGY_EXTENSION);
 
     for (IConfigurationElement element : config) {
 
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ContainerElementFilter.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ContainerElementFilter.java
index 5d6fa9a..d690aa8 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ContainerElementFilter.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ContainerElementFilter.java
@@ -32,7 +32,7 @@ public class ContainerElementFilter extends ViewerFilter {
 
     if (element instanceof IAdaptable) {
       IResource resourceElement = (IResource) ((IAdaptable) 
element).getAdapter(IResource.class);
-      
+
       if (resourceElement != null)
         element = resourceElement;
     }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/DocumentImportStructureProvider.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/DocumentImportStructureProvider.java
index 0de6f7d..84c71e2 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/DocumentImportStructureProvider.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/DocumentImportStructureProvider.java
@@ -153,8 +153,7 @@ final class DocumentImportStructureProvider implements 
IImportStructureProvider
     } else if (fileName.endsWith(".txt")) {
       try {
         String text = new String(Files.readAllBytes(fileToImport.toPath()), 
importEncoding);
-        return getDocument(fileToImport.getAbsolutePath(), text, language,
-                casFormat);
+        return getDocument(fileToImport.getAbsolutePath(), text, language, 
casFormat);
       } catch (IOException e) {
         return null;
       }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ImportDocumentWizard.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ImportDocumentWizard.java
index acb20db..6fab9f3 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ImportDocumentWizard.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ImportDocumentWizard.java
@@ -41,7 +41,7 @@ import org.eclipse.ui.wizards.datatransfer.ImportOperation;
  * is supported.
  */
 public final class ImportDocumentWizard extends Wizard implements 
IImportWizard {
-  
+
   private ImportDocumentWizardPage mMainPage;
 
   private IStructuredSelection mCurrentResourceSelection;
@@ -64,49 +64,47 @@ public final class ImportDocumentWizard extends Wizard 
implements IImportWizard
 
   @Override
   public boolean performFinish() {
-    
+
     String usedEncoding = mMainPage.getTextEncoding();
-    
+
     IPreferenceStore store = 
CasEditorIdePlugin.getDefault().getPreferenceStore();
-    
-    String lastUsedEncodingsString = store.getString(
-            
CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_ENCODINGS);
-    
-    List<String> lastUsedEncodings = new 
ArrayList<>(Arrays.asList(lastUsedEncodingsString.split(
-        CasEditorIdePreferenceConstants.STRING_DELIMITER)));
-    
+
+    String lastUsedEncodingsString = store
+            
.getString(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_ENCODINGS);
+
+    List<String> lastUsedEncodings = new ArrayList<>(Arrays.asList(
+            
lastUsedEncodingsString.split(CasEditorIdePreferenceConstants.STRING_DELIMITER)));
+
     int usedEncodingIndex = lastUsedEncodings.indexOf(usedEncoding);
-    
+
     if (usedEncodingIndex != -1) {
       lastUsedEncodings.remove(usedEncodingIndex);
     }
-    
+
     lastUsedEncodings.add(0, usedEncoding);
-    
+
     int maxUserItemCount = 10;
-    
+
     if (lastUsedEncodings.size() > maxUserItemCount) {
       lastUsedEncodings = lastUsedEncodings.subList(0, maxUserItemCount - 1);
     }
-    
+
     StringBuilder updatedLastUsedEncodingsString = new StringBuilder();
-    
+
     for (String encoding : lastUsedEncodings) {
       updatedLastUsedEncodingsString.append(encoding);
-      updatedLastUsedEncodingsString.append(
-              CasEditorIdePreferenceConstants.STRING_DELIMITER);
+      
updatedLastUsedEncodingsString.append(CasEditorIdePreferenceConstants.STRING_DELIMITER);
     }
-    
+
     
store.setValue(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_ENCODINGS,
             updatedLastUsedEncodingsString.toString());
-    
-    IImportStructureProvider importProvider = new 
DocumentImportStructureProvider(mMainPage.getLanguage(),
-               mMainPage.getTextEncoding(), mMainPage.getCasFormat());
-    
+
+    IImportStructureProvider importProvider = new 
DocumentImportStructureProvider(
+            mMainPage.getLanguage(), mMainPage.getTextEncoding(), 
mMainPage.getCasFormat());
+
     // BUG: We cannot pass null here for the overwrite query
-    ImportOperation operation =
-            new ImportOperation(mMainPage.getImportDestinationPath(), 
importProvider, new OverwriteQuery(getShell()),
-            mMainPage.getFilesToImport());
+    ImportOperation operation = new 
ImportOperation(mMainPage.getImportDestinationPath(),
+            importProvider, new OverwriteQuery(getShell()), 
mMainPage.getFilesToImport());
 
     operation.setContext(getShell());
 
@@ -116,18 +114,18 @@ public final class ImportDocumentWizard extends Wizard 
implements IImportWizard
       getContainer().run(true, true, operation);
     } catch (InvocationTargetException e) {
       CasEditorPlugin.log(e);
-      
+
       String message = "Unkown error during import, see the log file for 
details";
-      
+
       Throwable cause = e.getCause();
       if (cause != null) {
-        
+
         String causeMessage = cause.getMessage();
-        
+
         if (causeMessage != null)
           message = causeMessage;
       }
-      
+
       MessageDialog.openError(getContainer().getShell(), "Import failed", 
message);
 
       return false;
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ImportDocumentWizardPage.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ImportDocumentWizardPage.java
index 4a3ec06..687fa07 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ImportDocumentWizardPage.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/ImportDocumentWizardPage.java
@@ -76,10 +76,10 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
 final class ImportDocumentWizardPage extends WizardPage {
 
   private static final Set<String> defaultEncodings;
-  
+
   static {
     Set<String> encodings = new HashSet<>();
-    
+
     encodings.add("US-ASCII");
     encodings.add("ISO-8859-1");
     encodings.add("UTF-8");
@@ -87,66 +87,62 @@ final class ImportDocumentWizardPage extends WizardPage {
     encodings.add("UTF-16LE");
     encodings.add("UTF-16");
     encodings.add(Charset.defaultCharset().displayName());
-    
+
     defaultEncodings = Collections.unmodifiableSet(encodings);
   }
-  
+
   private IPath importDestinationPath;
 
   private String importEncoding;
-  
+
   private String language;
-  
+
   private SerialFormat documentFormat;
-  
+
   private TableViewer fileTable;
 
   private IContainer containerElement;
 
   protected ImportDocumentWizardPage(String pageName,
-      IStructuredSelection currentResourceSelection) {
+          IStructuredSelection currentResourceSelection) {
     super(pageName);
 
     setTitle("Import Text Files");
 
     // TODO: Pre select the selected foler ..
-//    if (!currentResourceSelection.isEmpty()) {
-//      if (currentResourceSelection.getFirstElement() instanceof 
CorpusElement) {
-//        containerElement = (IContainer) 
currentResourceSelection.getFirstElement();
-//        importDestinationPath = containerElement.getFullPath();
-//      }
-//    }
-    
+    // if (!currentResourceSelection.isEmpty()) {
+    // if (currentResourceSelection.getFirstElement() instanceof 
CorpusElement) {
+    // containerElement = (IContainer) 
currentResourceSelection.getFirstElement();
+    // importDestinationPath = containerElement.getFullPath();
+    // }
+    // }
+
     setPageComplete(false);
   }
 
   private void updatePageState() {
-         
-       boolean isEncodingSupported = false;
-       
-       try {
-               isEncodingSupported = Charset.isSupported(importEncoding);
-       }
-       catch (IllegalCharsetNameException e) {
-               // Name of the Charset is incorrect, that means
-               // 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);
+
+    boolean isEncodingSupported = false;
+
+    try {
+      isEncodingSupported = Charset.isSupported(importEncoding);
+    } catch (IllegalCharsetNameException e) {
+      // Name of the Charset is incorrect, that means
+      // 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);
   }
 
   @Override
@@ -159,8 +155,8 @@ final class ImportDocumentWizardPage extends WizardPage {
     GridDataFactory.fillDefaults().grab(true, true).span(2, 
4).applyTo(fileTable.getControl());
 
     Button addButton = new Button(composite, SWT.PUSH);
-    addButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
-            | GridData.VERTICAL_ALIGN_BEGINNING));
+    addButton.setLayoutData(
+            new GridData(GridData.HORIZONTAL_ALIGN_FILL | 
GridData.VERTICAL_ALIGN_BEGINNING));
     addButton.setText("Add");
     addButton.addSelectionListener(new SelectionListener() {
 
@@ -178,8 +174,8 @@ final class ImportDocumentWizardPage extends WizardPage {
         // open a file dialog
         FileDialog fd = new FileDialog(Display.getCurrent().getActiveShell(), 
SWT.MULTI);
         fd.setText("Choose text files");
-        fd.setFilterExtensions(new String[] { "*.txt;*.rtf", "*.*"});
-        fd.setFilterNames(new String[] {"Text Files", "All Files (*)"});
+        fd.setFilterExtensions(new String[] { "*.txt;*.rtf", "*.*" });
+        fd.setFilterNames(new String[] { "Text Files", "All Files (*)" });
         if (fd.open() != null) {
           for (String fileItem : fd.getFileNames()) {
             fileTable.add(new File(fd.getFilterPath() + File.separator + 
fileItem));
@@ -191,8 +187,8 @@ final class ImportDocumentWizardPage extends WizardPage {
     });
 
     Button removeButton = new Button(composite, SWT.PUSH);
-    removeButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
-            | GridData.VERTICAL_ALIGN_BEGINNING));
+    removeButton.setLayoutData(
+            new GridData(GridData.HORIZONTAL_ALIGN_FILL | 
GridData.VERTICAL_ALIGN_BEGINNING));
     removeButton.setText("Remove");
     removeButton.addSelectionListener(new SelectionListener() {
 
@@ -224,8 +220,8 @@ final class ImportDocumentWizardPage extends WizardPage {
     });
 
     Button selectAllButton = new Button(composite, SWT.PUSH);
-    selectAllButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
-            | GridData.VERTICAL_ALIGN_BEGINNING));
+    selectAllButton.setLayoutData(
+            new GridData(GridData.HORIZONTAL_ALIGN_FILL | 
GridData.VERTICAL_ALIGN_BEGINNING));
     selectAllButton.setText("Select All");
     selectAllButton.addSelectionListener(new SelectionListener() {
 
@@ -245,8 +241,8 @@ final class ImportDocumentWizardPage extends WizardPage {
     });
 
     Button deselectAllButton = new Button(composite, SWT.PUSH);
-    deselectAllButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
-            | GridData.VERTICAL_ALIGN_BEGINNING));
+    deselectAllButton.setLayoutData(
+            new GridData(GridData.HORIZONTAL_ALIGN_FILL | 
GridData.VERTICAL_ALIGN_BEGINNING));
     deselectAllButton.setText("Deselect All");
     deselectAllButton.addSelectionListener(new SelectionListener() {
 
@@ -265,7 +261,7 @@ final class ImportDocumentWizardPage extends WizardPage {
       }
     });
 
-    // Into Corpus folder 
+    // Into Corpus folder
     Label intoFolderLabel = new Label(composite, SWT.NONE);
     intoFolderLabel.setText("Into folder:");
 
@@ -277,8 +273,8 @@ final class ImportDocumentWizardPage extends WizardPage {
     }
 
     Button browseForFolder = new Button(composite, SWT.NONE);
-    browseForFolder.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
-            | GridData.VERTICAL_ALIGN_BEGINNING));
+    browseForFolder.setLayoutData(
+            new GridData(GridData.HORIZONTAL_ALIGN_FILL | 
GridData.VERTICAL_ALIGN_BEGINNING));
     browseForFolder.setText("Browse");
     browseForFolder.addSelectionListener(new SelectionListener() {
 
@@ -295,8 +291,9 @@ final class ImportDocumentWizardPage extends WizardPage {
       public void widgetSelected(SelectionEvent e) {
 
         final ElementTreeSelectionDialog folderSelectionDialog = new 
ElementTreeSelectionDialog(
-                getShell(), new DecoratingLabelProvider(new 
WorkbenchLabelProvider(), PlatformUI
-                        
.getWorkbench().getDecoratorManager().getLabelDecorator()),
+                getShell(),
+                new DecoratingLabelProvider(new WorkbenchLabelProvider(),
+                        
PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()),
                 new BaseWorkbenchContentProvider());
 
         folderSelectionDialog.addFilter(new ContainerElementFilter());
@@ -315,20 +312,21 @@ final class ImportDocumentWizardPage extends WizardPage {
           public IStatus validate(Object[] selection) {
 
             if (selection.length == 1) {
-              
+
               Object selectedElement = selection[0];
-              
+
               if (selectedElement instanceof IAdaptable) {
                 Object resourceElement = ((IAdaptable) 
selectedElement).getAdapter(IResource.class);
                 if (resourceElement != null)
                   selectedElement = resourceElement;
               }
-              
+
               if (selectedElement instanceof IContainer)
                 return new Status(IStatus.OK, CasEditorPlugin.ID, 0, "", null);
             }
 
-            return new Status(IStatus.ERROR, CasEditorPlugin.ID, 0, "Please 
select a folder!", null);
+            return new Status(IStatus.ERROR, CasEditorPlugin.ID, 0, "Please 
select a folder!",
+                    null);
           }
         });
 
@@ -339,19 +337,17 @@ final class ImportDocumentWizardPage extends WizardPage {
         if (results != null && results.length > 0) {
           // validator makes sure that an IContainer or an IAdaptable
           // element which can provide an IContainer is selected
-          
+
           if (results[0] instanceof IContainer) {
             containerElement = (IContainer) results[0];
-          }
-          else if (results[0] instanceof IAdaptable) {
+          } else if (results[0] instanceof IAdaptable) {
             IAdaptable adaptableElement = (IAdaptable) results[0];
-            
+
             containerElement = (IContainer) 
adaptableElement.getAdapter(IResource.class);
-          }
-          else {
+          } else {
             throw new IllegalStateException("Unexpected selection!");
           }
-          
+
           importDestinationPath = containerElement.getFullPath();
 
           corpusText.setText(importDestinationPath.toString());
@@ -369,81 +365,79 @@ final class ImportDocumentWizardPage extends WizardPage {
     GridData importOptionsGridData = new GridData(GridData.FILL, 
GridData.CENTER, true, false);
     importOptionsGridData.horizontalSpan = 3;
     importOptions.setLayoutData(importOptionsGridData);
-    
+
     Label languageLabel = new Label(importOptions, SWT.NONE);
     languageLabel.setText("Language:");
-    
+
     final IPreferenceStore store = 
CasEditorIdePlugin.getDefault().getPreferenceStore();
-    
+
     final Text languageText = new Text(importOptions, SWT.BORDER);
     languageText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-    language = store.getString(
-            CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_LANG);
+    language = 
store.getString(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_LANG);
     languageText.setText(language);
     languageText.addModifyListener(new ModifyListener() {
-      
+
       @Override
       public void modifyText(ModifyEvent e) {
         language = languageText.getText();
         
store.setValue(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_LANG,
 language);
       }
     });
-    
+
     // Text file encoding
     Label encodingLabel = new Label(importOptions, SWT.NONE);
     encodingLabel.setText("Text Encoding:");
-    
+
     // combo box ...
     final Combo encodingCombo = new Combo(importOptions, SWT.NONE);
     encodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
 
-
     Set<String> charsets = new HashSet<>(defaultEncodings);
-    
-    String lastUsedEncodingsString = 
-            
store.getString(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_ENCODINGS);
-    
-    String lastUsedEncodings[] = 
lastUsedEncodingsString.split(CasEditorIdePreferenceConstants.STRING_DELIMITER);
+
+    String lastUsedEncodingsString = store
+            
.getString(CasEditorIdePreferenceConstants.CAS_IMPORT_WIZARD_LAST_USED_ENCODINGS);
+
+    String lastUsedEncodings[] = lastUsedEncodingsString
+            .split(CasEditorIdePreferenceConstants.STRING_DELIMITER);
     charsets.addAll(Arrays.asList(lastUsedEncodings));
 
     if (lastUsedEncodings.length > 0) {
       importEncoding = lastUsedEncodings[0];
-    }
-    else {
+    } else {
       importEncoding = Charset.defaultCharset().displayName();
     }
-    
+
     encodingCombo.setItems(charsets.toArray(new String[charsets.size()]));
     encodingCombo.setText(importEncoding);
     encodingCombo.addSelectionListener(new SelectionListener() {
-               
-               @Override
+
+      @Override
       public void widgetSelected(SelectionEvent e) {
-                       importEncoding = encodingCombo.getText();
-                       updatePageState();
-               }
-               
-               @Override
+        importEncoding = encodingCombo.getText();
+        updatePageState();
+      }
+
+      @Override
       public void widgetDefaultSelected(SelectionEvent e) {
-               }
-       });
-    
+      }
+    });
+
     encodingCombo.addKeyListener(new KeyListener() {
-               
-               @Override
+
+      @Override
       public void keyReleased(KeyEvent e) {
-                       importEncoding = encodingCombo.getText();
-                       updatePageState();
-               }
-               
-               @Override
+        importEncoding = encodingCombo.getText();
+        updatePageState();
+      }
+
+      @Override
       public void keyPressed(KeyEvent e) {
-               }
-       });
-    
+      }
+    });
+
     Label casFormatLabel = new Label(importOptions, SWT.NONE);
     casFormatLabel.setText("Cas Format:");
-  
+
     final Combo casFormatCombo = new Combo(importOptions, SWT.READ_ONLY);
     casFormatCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
     SerialFormat[] values = SerialFormat.values();
@@ -454,21 +448,21 @@ final class ImportDocumentWizardPage extends WizardPage {
     casFormatCombo.setItems(stringValues);
     documentFormat = SerialFormat.XMI;
     casFormatCombo.select(0);
-    
+
     casFormatCombo.addSelectionListener(new SelectionListener() {
-               
-               @Override
+
+      @Override
       public void widgetSelected(SelectionEvent e) {
-                       documentFormat = 
SerialFormat.valueOf(casFormatCombo.getText());
-               }
-               
-               @Override
+        documentFormat = SerialFormat.valueOf(casFormatCombo.getText());
+      }
+
+      @Override
       public void widgetDefaultSelected(SelectionEvent e) {
-               }
-       });
-    
+      }
+    });
+
     updatePageState();
-    
+
     setControl(composite);
   }
 
@@ -491,16 +485,16 @@ final class ImportDocumentWizardPage extends WizardPage {
 
     return files;
   }
-  
+
   String getTextEncoding() {
-         return importEncoding;
+    return importEncoding;
   }
-  
+
   String getLanguage() {
     return language;
   }
-  
+
   SerialFormat getCasFormat() {
-         return documentFormat;
+    return documentFormat;
   }
 }
diff --git 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/OverwriteQuery.java
 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/OverwriteQuery.java
index c7e0c81..f019e6d 100644
--- 
a/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/OverwriteQuery.java
+++ 
b/uimaj-ep-cas-editor-ide/src/main/java/org/apache/uima/caseditor/ide/wizards/OverwriteQuery.java
@@ -26,43 +26,39 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.dialogs.IOverwriteQuery;
 
 /**
- * Overwrite Query to ask user how to deal with fields that need
- * to be overwritten.
+ * Overwrite Query to ask user how to deal with fields that need to be 
overwritten.
  */
 class OverwriteQuery implements IOverwriteQuery {
 
   private final Shell shell;
 
   private String result = CANCEL;
-  
+
   OverwriteQuery(Shell shell) {
     this.shell = shell;
   }
-  
+
   @Override
   public String queryOverwrite(final String pathString) {
 
     if (ALL.equals(result)) {
       return ALL;
     }
-    
-    final String[] options = {
-            IDialogConstants.YES_LABEL,
-            IDialogConstants.YES_TO_ALL_LABEL,
-            IDialogConstants.NO_LABEL,
-            IDialogConstants.CANCEL_LABEL 
-            };
-    
+
+    final String[] options = { IDialogConstants.YES_LABEL, 
IDialogConstants.YES_TO_ALL_LABEL,
+        IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
+
     // Must executed synchronously, otherwise the result is not available
     // when the return statement is executed
     Display.getDefault().syncExec(new Runnable() {
       @Override
       public void run() {
-        MessageDialog dialog = new MessageDialog(shell, "CAS target file 
already exists" , null,
-                "The CAS target file already exists: \n" + pathString + 
-                "\n\nPlease choose an action.", MessageDialog.QUESTION, 
options, 0);
+        MessageDialog dialog = new MessageDialog(shell, "CAS target file 
already exists", null,
+                "The CAS target file already exists: \n" + pathString
+                        + "\n\nPlease choose an action.",
+                MessageDialog.QUESTION, options, 0);
         dialog.open();
-        
+
         String codes[] = { YES, ALL, NO, CANCEL };
         result = codes[dialog.getReturnCode()];
       }

Reply via email to