progress monitor and canceling of search operations
diff --git a/plugins/org.eclipse.wst.sse.sieditor.search.test/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractSearchQueryOperationTest.java b/plugins/org.eclipse.wst.sse.sieditor.search.test/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractSearchQueryOperationTest.java
index 9229d94..252b9e5 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.search.test/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractSearchQueryOperationTest.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.search.test/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractSearchQueryOperationTest.java
@@ -5,6 +5,7 @@
 import junit.framework.Assert;
 
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.platform.discovery.runtime.api.ISearchParameters;
 import org.eclipse.platform.discovery.util.api.longop.LongOpCanceledException;
 import org.eclipse.wst.sse.sieditor.search.ui.tree.FileNode;
@@ -45,7 +46,7 @@
     public void testResultTreeByFiles() throws LongOpCanceledException, CoreException, IOException {
         Mockito.when(searchParameters.getGroupingHierarchy()).thenReturn(AbstractLocalDefinitionsSearchProvider.BY_FILES);
 
-        ITreeNode rootTreeNode = searchQueryOperation.run(null);
+        ITreeNode rootTreeNode = searchQueryOperation.run(Mockito.mock(IProgressMonitor.class));
 
         Object[] rootNodeChildren = rootTreeNode.getChildren();
         Assert.assertEquals(1, rootNodeChildren.length);
@@ -65,7 +66,7 @@
     @Test
     public void testResultTreeByNamespaces() throws LongOpCanceledException, CoreException {
         Mockito.when(searchParameters.getGroupingHierarchy()).thenReturn(AbstractLocalDefinitionsSearchProvider.BY_NAMESPACES);
-        ITreeNode rootTreeNode = searchQueryOperation.run(null);
+        ITreeNode rootTreeNode = searchQueryOperation.run(Mockito.mock(IProgressMonitor.class));
 
         Object[] rootNodeChildren = rootTreeNode.getChildren();
         Assert.assertEquals(1, rootNodeChildren.length);
@@ -75,7 +76,7 @@
     @Test
     public void testResultTreeFlat() throws LongOpCanceledException, CoreException {
         Mockito.when(searchParameters.getGroupingHierarchy()).thenReturn(AbstractLocalDefinitionsSearchProvider.FLAT_LIST);
-        ITreeNode rootTreeNode = searchQueryOperation.run(null);
+        ITreeNode rootTreeNode = searchQueryOperation.run(Mockito.mock(IProgressMonitor.class));
 
         Object[] rootNodeChildren = rootTreeNode.getChildren();
         Assert.assertEquals(1, rootNodeChildren.length);
diff --git a/plugins/org.eclipse.wst.sse.sieditor.search.test/src/org/eclipse/wst/sse/sieditor/search/provider/xsd/XsdSearchQueryOperationTest.java b/plugins/org.eclipse.wst.sse.sieditor.search.test/src/org/eclipse/wst/sse/sieditor/search/provider/xsd/XsdSearchQueryOperationTest.java
index f689a3f..6bad478 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.search.test/src/org/eclipse/wst/sse/sieditor/search/provider/xsd/XsdSearchQueryOperationTest.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.search.test/src/org/eclipse/wst/sse/sieditor/search/provider/xsd/XsdSearchQueryOperationTest.java
@@ -3,6 +3,7 @@
 import junit.framework.Assert;
 
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.platform.discovery.util.api.longop.LongOpCanceledException;
 import org.eclipse.wst.sse.sieditor.search.destinations.xsd.AllCategoriesDestination;
 import org.eclipse.wst.sse.sieditor.search.destinations.xsd.XsdComplexTypesDestination;
@@ -32,7 +33,7 @@
     @Test
     public void testSearchingOnlyComplexTypes() throws LongOpCanceledException, CoreException {
         Mockito.when(searchParameters.getSearchDestination()).thenReturn(new XsdComplexTypesDestination());
-        ITreeNode rootTreeNode = searchQueryOperation.run(null);
+        ITreeNode rootTreeNode = searchQueryOperation.run(Mockito.mock(IProgressMonitor.class));
 
         Object[] rootNodeChildren = rootTreeNode.getChildren();
         Assert.assertEquals(1, rootNodeChildren.length);
@@ -43,7 +44,7 @@
         Mockito.when(searchParameters.getKeywordString()).thenReturn("SimpleType1");
         Mockito.when(searchParameters.getSearchDestination()).thenReturn(new XsdSimpleTypesDestination());
 
-        ITreeNode rootTreeNode = searchQueryOperation.run(null);
+        ITreeNode rootTreeNode = searchQueryOperation.run(Mockito.mock(IProgressMonitor.class));
 
         Object[] rootNodeChildren = rootTreeNode.getChildren();
         Assert.assertEquals(2, rootNodeChildren.length);
@@ -54,7 +55,7 @@
         Mockito.when(searchParameters.getKeywordString()).thenReturn("Element1");
         Mockito.when(searchParameters.getSearchDestination()).thenReturn(new XsdElementDeclarationDestination());
 
-        ITreeNode rootTreeNode = searchQueryOperation.run(null);
+        ITreeNode rootTreeNode = searchQueryOperation.run(Mockito.mock(IProgressMonitor.class));
 
         Object[] rootNodeChildren = rootTreeNode.getChildren();
         Assert.assertEquals(1, rootNodeChildren.length);
diff --git a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/i18n/messages.properties b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/i18n/messages.properties
index 5e47d44..c99d70e 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/i18n/messages.properties
+++ b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/i18n/messages.properties
@@ -18,6 +18,6 @@
 SearchResultCustomUiCreator_NO_RESULTS_FOUND=No results found

 SearchResultTooltipProvider_Documentation=Documentation:

 SearchResultTooltipProvider_Name=Name:

-XsdComplexTypesDestination_Name=Complex Type

+XsdComplexTypesDestination_Name=Structure Type

 XsdElementDeclarationDestination_Name=Element Declaration

 XsdSimpleTypesDestination_Name=Simple Type

diff --git a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractDefinitionsSearchQuery.java b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractDefinitionsSearchQuery.java
index 71e4ea8..afbfd47 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractDefinitionsSearchQuery.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractDefinitionsSearchQuery.java
@@ -19,6 +19,7 @@
 import org.eclipse.platform.discovery.util.api.longop.ILongOperation;
 import org.eclipse.platform.discovery.util.api.longop.ILongOperationRunner;
 import org.eclipse.platform.discovery.util.api.longop.LongOpCanceledException;
+import org.eclipse.wst.sse.sieditor.search.ui.tree.RootTreeNode;
 import org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode;
 
 public abstract class AbstractDefinitionsSearchQuery extends SearchQuery {
@@ -33,7 +34,7 @@
         try {
             return lor.run(getQueryOperation());
         } catch (LongOpCanceledException e) {
-            throw new IllegalStateException("Operation does not support cancellation"); //$NON-NLS-1$
+            return new RootTreeNode();
         } catch (InvocationTargetException e) {
             throw new SearchFailedException(e.getCause());
         }
diff --git a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractSearchQueryOperation.java b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractSearchQueryOperation.java
index 3555c51..2f3a088 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractSearchQueryOperation.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/AbstractSearchQueryOperation.java
@@ -29,6 +29,7 @@
 import org.eclipse.platform.discovery.runtime.api.ISearchParameters;
 import org.eclipse.platform.discovery.util.api.longop.ILongOperation;
 import org.eclipse.platform.discovery.util.api.longop.LongOpCanceledException;
+import org.eclipse.wst.sse.sieditor.core.common.Logger;
 import org.eclipse.wst.sse.sieditor.model.api.IWsdlModelRoot;
 import org.eclipse.wst.sse.sieditor.model.impl.WSDLFactory;
 import org.eclipse.wst.sse.sieditor.search.ui.tree.FileNode;
@@ -39,6 +40,7 @@
 import org.eclipse.wst.wsdl.internal.util.WSDLResourceFactoryImpl;
 import org.eclipse.wst.wsdl.util.WSDLResourceImpl;
 
+@SuppressWarnings("restriction")
 public abstract class AbstractSearchQueryOperation implements ILongOperation<ITreeNode> {
 
     protected static final String XSD_FILE_EXTENSION = "xsd"; //$NON-NLS-1$
@@ -51,11 +53,39 @@
     }
 
     @Override
-    public ITreeNode run(IProgressMonitor monitor) throws LongOpCanceledException, CoreException {
+    public ITreeNode run(IProgressMonitor progressMonitor) throws LongOpCanceledException, CoreException {
         Set<IFile> files = getFilesFromWorkspace();
-        return getRootTreeNode(files);
+        progressMonitor.beginTask("", files.size());
+        return getRootTreeNode(files, progressMonitor);
     }
 
+    protected ITreeNode getRootTreeNode(Set<IFile> files, IProgressMonitor progressMonitor) {
+        RootTreeNode rootTreeNode = new RootTreeNode();
+
+        for (IFile file : files) {
+            if (progressMonitor.isCanceled()) {
+                progressMonitor.done();
+                return rootTreeNode;
+            }
+            progressMonitor.subTask("Searching in " + file.getName());
+            progressMonitor.worked(1);
+
+            FileNode fileNode = new FileNode(file, rootTreeNode, isXsdFileExtension(file.getFileExtension()));
+
+            analyzeFile(rootTreeNode, file, fileNode);
+
+            if (fileNode.hasChildren() && isByFilesHierarchy()) {
+                rootTreeNode.addChild(fileNode);
+            }
+        }
+
+        progressMonitor.done();
+
+        return rootTreeNode;
+    }
+
+    protected abstract void analyzeFile(RootTreeNode rootTreeNode, IFile file, FileNode fileNode);
+
     protected boolean isByNamespaceHierarchy() {
         return searchParams.getGroupingHierarchy().equals(AbstractLocalDefinitionsSearchProvider.BY_NAMESPACES);
     }
@@ -86,7 +116,7 @@
     private void traversFiles(Set<IFile> result, IResource resource) throws CoreException {
         if (resource instanceof IFile) {
             IFile file = (IFile) resource;
-            if (isFileThatMayHaveTheSearchedContenet(file)) {
+            if (isFileThatMayHaveTheSearchedContenet(file.getFileExtension())) {
                 result.add(file);
                 return;
             }
@@ -105,7 +135,7 @@
         }
     }
 
-    protected abstract boolean isFileThatMayHaveTheSearchedContenet(IFile file);
+    protected abstract boolean isFileThatMayHaveTheSearchedContenet(String fileExtension);
 
     protected boolean isXmlFileExtension(String fileExtension) {
         return checkForFileExtension(fileExtension, XML_FILE_EXTENSION);
@@ -123,8 +153,6 @@
         return fileExtension == null ? false : searchedFileExtension.equalsIgnoreCase(fileExtension);
     }
 
-    protected abstract ITreeNode getRootTreeNode(Set<IFile> files);
-
     protected IWsdlModelRoot getWsdlModelRootForFile(IFile file) {
         Map<String, Object> extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
         Object currentXmlResourceFactoryWithLowerCase = extensionToFactoryMap.get(XML_FILE_EXTENSION.toLowerCase());
@@ -142,11 +170,14 @@
 
             IWsdlModelRoot modelRoot = WSDLFactory.getInstance().createWSDLModelRoot(definition);
             return modelRoot;
+        } catch (Exception e) {
+            Logger.logWarning("Failed to read file", e); //$NON-NLS-1$
         } finally {
             extensionToFactoryMap.put(XML_FILE_EXTENSION.toLowerCase(), currentXmlResourceFactoryWithLowerCase);
             extensionToFactoryMap.put(XML_FILE_EXTENSION.toUpperCase(), currentXmlResourceFactoryWithUpperCase);
             extensionToFactoryMap.put(WSDL_FILE_EXTENSION.toUpperCase(), currentWsdlResourceFactoryWithUpperCase);
         }
+        return null;
     }
 
     protected URI createFileUri(IFile file) {
diff --git a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/wsdl/WsdlSearchQueryOperation.java b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/wsdl/WsdlSearchQueryOperation.java
index 1af0e8d..970db1b 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/wsdl/WsdlSearchQueryOperation.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/wsdl/WsdlSearchQueryOperation.java
@@ -11,7 +11,6 @@
 package org.eclipse.wst.sse.sieditor.search.provider.wsdl;
 
 import java.util.Collection;
-import java.util.Set;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.platform.discovery.runtime.api.ISearchParameters;
@@ -23,7 +22,6 @@
 import org.eclipse.wst.sse.sieditor.search.ui.tree.ITreeNodeWithCustomizableChildren;
 import org.eclipse.wst.sse.sieditor.search.ui.tree.NamespaceNode;
 import org.eclipse.wst.sse.sieditor.search.ui.tree.RootTreeNode;
-import org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode;
 import org.eclipse.wst.sse.sieditor.ui.v2.wsdl.controller.SIFormPageController;
 import org.eclipse.wst.sse.sieditor.ui.v2.wsdltree.nodes.ServiceInterfaceNode;
 
@@ -34,8 +32,7 @@
     }
 
     @Override
-    protected boolean isFileThatMayHaveTheSearchedContenet(IFile file) {
-        String fileExtension = file.getFileExtension();
+    protected boolean isFileThatMayHaveTheSearchedContenet(String fileExtension) {
         if (isWsdlFileExtension(fileExtension) || isXmlFileExtension(fileExtension)) {
             return true;
         }
@@ -43,26 +40,16 @@
     }
 
     @Override
-    protected ITreeNode getRootTreeNode(Set<IFile> files) {
-        RootTreeNode rootTreeNode = new RootTreeNode();
-        for (IFile file : files) {
-            FileNode fileNode = new FileNode(file, rootTreeNode, false);
-            IWsdlModelRoot wsdlModelRoot = getWsdlModelRootForFile(file);
+    protected void analyzeFile(RootTreeNode rootTreeNode, IFile file, FileNode fileNode) {
+        IWsdlModelRoot wsdlModelRoot = getWsdlModelRootForFile(file);
 
-            if (isByNamespaceHierarchy() || isByFilesHierarchy()) {
-                NamespaceNode namespaceNode = new NamespaceNode(wsdlModelRoot.getDescription(), fileNode);
-                addInterfacesToNamespaceNode(wsdlModelRoot, namespaceNode);
-                chooseParentForNamespaceNode(rootTreeNode, fileNode, namespaceNode);
-            } else {
-                addInterfacesToNamespaceNode(wsdlModelRoot, rootTreeNode);
-            }
-
-            if (fileNode.hasChildren() && isByFilesHierarchy()) {
-                rootTreeNode.addChild(fileNode);
-            }
+        if (isByNamespaceHierarchy() || isByFilesHierarchy()) {
+            NamespaceNode namespaceNode = new NamespaceNode(wsdlModelRoot.getDescription(), fileNode);
+            addInterfacesToNamespaceNode(wsdlModelRoot, namespaceNode);
+            chooseParentForNamespaceNode(rootTreeNode, fileNode, namespaceNode);
+        } else {
+            addInterfacesToNamespaceNode(wsdlModelRoot, rootTreeNode);
         }
-
-        return rootTreeNode;
     }
 
     private void addInterfacesToNamespaceNode(IWsdlModelRoot wsdlModelRoot, ITreeNodeWithCustomizableChildren parent) {
diff --git a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/xsd/XsdSearchQueryOperation.java b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/xsd/XsdSearchQueryOperation.java
index 0159d85..c470156 100644
--- a/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/xsd/XsdSearchQueryOperation.java
+++ b/plugins/org.eclipse.wst.sse.sieditor.search/src/org/eclipse/wst/sse/sieditor/search/provider/xsd/XsdSearchQueryOperation.java
@@ -13,7 +13,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Map;
-import java.util.Set;
 
 import org.eclipse.core.resources.IFile;
 import org.eclipse.emf.ecore.resource.Resource;
@@ -21,6 +20,7 @@
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
 import org.eclipse.platform.discovery.runtime.api.ISearchDestination;
 import org.eclipse.platform.discovery.runtime.api.ISearchParameters;
+import org.eclipse.wst.sse.sieditor.core.common.Logger;
 import org.eclipse.wst.sse.sieditor.model.api.IWsdlModelRoot;
 import org.eclipse.wst.sse.sieditor.model.api.IXSDModelRoot;
 import org.eclipse.wst.sse.sieditor.model.impl.XSDFactory;
@@ -41,7 +41,6 @@
 import org.eclipse.wst.sse.sieditor.ui.v2.dt.nodes.impl.SimpleTypeNode;
 import org.eclipse.wst.sse.sieditor.ui.v2.dt.nodes.impl.StructureTypeNode;
 import org.eclipse.wst.sse.sieditor.ui.v2.factory.TreeNodeMapper;
-import org.eclipse.wst.sse.sieditor.ui.v2.nodes.ITreeNode;
 import org.eclipse.xsd.XSDSchema;
 import org.eclipse.xsd.util.XSDResourceFactoryImpl;
 import org.eclipse.xsd.util.XSDResourceImpl;
@@ -53,8 +52,7 @@
     }
 
     @Override
-    protected boolean isFileThatMayHaveTheSearchedContenet(IFile file) {
-        String fileExtension = file.getFileExtension();
+    protected boolean isFileThatMayHaveTheSearchedContenet(String fileExtension) {
         if (isWsdlFileExtension(fileExtension) || isXsdFileExtension(fileExtension) || isXmlFileExtension(fileExtension)) {
             return true;
         }
@@ -62,30 +60,19 @@
     }
 
     @Override
-    protected ITreeNode getRootTreeNode(Set<IFile> files) {
-        RootTreeNode rootTreeNode = new RootTreeNode();
-        final TreeNodeMapper treeNodeMapper = new TreeNodeMapper();
-
-        for (IFile file : files) {
-            FileNode fileNode = new FileNode(file, rootTreeNode, isXsdFileExtension(file.getFileExtension()));
-
-            Collection<ISchema> schemas = getSchemasFromFile(file);
-            for (ISchema schema : schemas) {
-                if (isByNamespaceHierarchy() || isByFilesHierarchy()) {
-                    NamespaceNode namespaceNode = new NamespaceNode(schema, fileNode);
-                    addTypesToParentNode(schema, namespaceNode, treeNodeMapper);
-                    chooseParentForNamespaceNode(rootTreeNode, fileNode, namespaceNode);
-                } else {
-                    addTypesToParentNode(schema, rootTreeNode, treeNodeMapper);
-                }
-            }
-
-            if (fileNode.hasChildren() && isByFilesHierarchy()) {
-                rootTreeNode.addChild(fileNode);
+    protected void analyzeFile(RootTreeNode rootTreeNode, IFile file, FileNode fileNode) {
+        TreeNodeMapper treeNodeMapper = new TreeNodeMapper();
+        Collection<ISchema> schemas = getSchemasFromFile(file);
+        for (ISchema schema : schemas) {
+            if (isByNamespaceHierarchy() || isByFilesHierarchy()) {
+                NamespaceNode namespaceNode = new NamespaceNode(schema, fileNode);
+                addTypesToParentNode(schema, namespaceNode, treeNodeMapper);
+                chooseParentForNamespaceNode(rootTreeNode, fileNode, namespaceNode);
+            } else {
+                addTypesToParentNode(schema, rootTreeNode, treeNodeMapper);
             }
         }
 
-        return rootTreeNode;
     }
 
     private Collection<ISchema> getSchemasFromFile(IFile file) {
@@ -126,11 +113,14 @@
             XSDSchema schema = resource.getSchema();
             IXSDModelRoot modelRoot = XSDFactory.getInstance().createXSDModelRoot(schema);
             return modelRoot.getSchema();
+        } catch (Exception e) {
+            Logger.logWarning("Failed to read file", e); //$NON-NLS-1$
         } finally {
             extensionToFactoryMap.put(XML_FILE_EXTENSION.toLowerCase(), currentXmlResourceFactoryWithLowerCase);
             extensionToFactoryMap.put(XML_FILE_EXTENSION.toUpperCase(), currentXmlResourceFactoryWithUpperCase);
             extensionToFactoryMap.put(XSD_FILE_EXTENSION.toUpperCase(), currentXsdResourceFactoryWithUpperCase);
         }
+        return null;
     }
 
     private void addTypesToParentNode(ISchema schema, ITreeNodeWithCustomizableChildren parent, TreeNodeMapper treeNodeMapper) {
@@ -164,4 +154,5 @@
             }
         }
     }
+
 }
\ No newline at end of file