Update CDA Generate

Added filter by section feature
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/plugin.xml b/cda/plugins/org.eclipse.mdht.cda.xml.ui/plugin.xml
index 98b9310..43c0dba 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/plugin.xml
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/plugin.xml
@@ -64,7 +64,13 @@
 		<command
 			id="org.eclipse.mdht.cda.xml.ui.commands.generateCDADataFiltered"
 			name="GENERATECDADATAFILTERED"
-			defaultHandler="org.eclipse.mdht.cda.xml.ui.handlers.GenerateCDADataFilteredHandler">
+			defaultHandler="org.eclipse.mdht.cda.xml.ui.handlers.GenerateCDADataHandler">
+			<commandParameter id="org.eclipse.mdht.cda.xml.ui.splitbydocument"
+				name="org.eclipse.mdht.cda.xml.ui.splitbydocument" optional="false">
+			</commandParameter>
+			<commandParameter id="org.eclipse.mdht.cda.xml.ui.filter"
+				name="org.eclipse.mdht.cda.xml.ui.splitbydocument" optional="false">
+			</commandParameter>
 		</command>
 		<command id="org.eclipse.mdht.cda.xml.ui.commands.openUsingStylesSheet"
 			name="OPENWITHSTYLESHEET" defaultHandler="org.eclipse.mdht.cda.xml.ui.handlers.OpenUsingStyleSheet">
@@ -245,6 +251,10 @@
 							</iterate>
 						</with>
 					</visibleWhen>
+					<parameter name="org.eclipse.mdht.cda.xml.ui.splitbydocument"
+						value="CONSOLIDATED"></parameter>
+					<parameter name="org.eclipse.mdht.cda.xml.ui.filter"
+						value="TRUE">	</parameter>
 				</command>
 
 				<command commandId="org.eclipse.mdht.cda.xml.ui.commands.openCDAViewer"
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDABaseHandler.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDABaseHandler.java
index cf423f9..6f533f1 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDABaseHandler.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDABaseHandler.java
@@ -49,6 +49,7 @@
 import org.eclipse.emf.common.util.Diagnostic;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.util.Diagnostician;
 import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -2399,8 +2400,8 @@
 
 	}
 
-	protected static String sheetName(Section section) {
-		String name = section.eClass().getName();
+	protected static String sheetName(EClass sectionEClass) {
+		String name = sectionEClass.getName();
 		String[] prettyName = name.split(DIVIDER_PATTERN); // "(?=\\p{Upper})");
 		StringBuilder sb = new StringBuilder();
 		for (String str : prettyName) {
@@ -2410,10 +2411,10 @@
 				sb.append(str).append(" ");
 			}
 		}
-		if ("CONSOL".equalsIgnoreCase(section.eClass().getEPackage().getNsPrefix())) {
+		if ("CONSOL".equalsIgnoreCase(sectionEClass.getEPackage().getNsPrefix())) {
 			return sb.toString();
 		} else {
-			return section.eClass().getEPackage().getNsPrefix().toUpperCase() + " " + sb.toString();
+			return sectionEClass.getEPackage().getNsPrefix().toUpperCase() + " " + sb.toString();
 		}
 
 	}
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataFilteredHandler.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataFilteredHandler.java
index b7fd13f..236b06d 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataFilteredHandler.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataFilteredHandler.java
@@ -465,7 +465,7 @@
 								newSheet.flushRows();
 								// }
 
-								String sheetName = sheetName(section);
+								String sheetName = sheetName(section.eClass());
 								if (!sectionbyfile.containsKey(sheetName)) {
 									sectionbyfile.put(sheetName, new ArrayList<IFile>());
 								}
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java
index 2463f25..b574e60 100644
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java
+++ b/cda/plugins/org.eclipse.mdht.cda.xml.ui/src/org/eclipse/mdht/cda/xml/ui/handlers/GenerateCDADataHandler.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2017 seanmuir.
+ * Copyright (c) 2017, 2018 seanmuir.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     seanmuir - initial API and implementation
+ *     seanmuir - add filtering by sections
  *
  *******************************************************************************/
 package org.eclipse.mdht.cda.xml.ui.handlers;
@@ -18,10 +19,13 @@
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.lang.StringUtils;
@@ -47,12 +51,17 @@
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.TreeIterator;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
 import org.eclipse.jface.dialogs.ProgressMonitorDialog;
 import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
 import org.eclipse.mdht.cda.xml.ui.Activator;
 import org.eclipse.mdht.uml.cda.Author;
 import org.eclipse.mdht.uml.cda.ClinicalDocument;
@@ -67,9 +76,11 @@
 import org.eclipse.mdht.uml.cda.util.CDAUtil.Query;
 import org.eclipse.mdht.uml.cda.util.CDAUtil.ValidationHandler;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.openhealthtools.mdht.uml.cda.consol.ConsolPackage;
 import org.openhealthtools.mdht.uml.cda.consol.EncountersSectionEntriesOptional;
@@ -82,10 +93,13 @@
 
 	private static String SPLITBYDOCUMENT = "org.eclipse.mdht.cda.xml.ui.splitbydocument";
 
+	private static String FILTER = "org.eclipse.mdht.cda.xml.ui.filter";
+
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
 
 		final String splitOption = event.getParameter(SPLITBYDOCUMENT);
+		final String filterOption = event.getParameter(FILTER);
 
 		// Omit DOB from generated Spreadsheets
 		omitDOB = org.eclipse.mdht.uml.cda.ui.internal.Activator.getDefault().getPreferenceStore().getBoolean(
@@ -94,6 +108,88 @@
 		omitUnits = org.eclipse.mdht.uml.cda.ui.internal.Activator.getDefault().getPreferenceStore().getBoolean(
 			MDHTPreferences.OMIT_UNITS_STORE_VALUE);
 
+		final HashSet<EClass> theSections = new HashSet<EClass>();
+
+		final HashMap<EClass, HashSet<EClass>> theSectionCache = new HashMap<EClass, HashSet<EClass>>();
+
+		if (filterOption != null) {
+
+			IWorkbenchWindow window2 = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+
+			ILabelProvider lp = new ILabelProvider() {
+
+				@Override
+				public void addListener(ILabelProviderListener listener) {
+
+				}
+
+				@Override
+				public void dispose() {
+
+				}
+
+				@Override
+				public boolean isLabelProperty(Object element, String property) {
+
+					return false;
+				}
+
+				@Override
+				public void removeListener(ILabelProviderListener listener) {
+
+				}
+
+				@Override
+				public Image getImage(Object element) {
+
+					return null;
+				}
+
+				@Override
+				public String getText(Object element) {
+					EClass ec = (EClass) element;
+					String theElementName = ec.getName();
+
+					if (Character.isDigit(theElementName.charAt(theElementName.length() - 1))) {
+						theElementName = theElementName.substring(0, theElementName.length() - 1);
+					}
+
+					String[] nameArray = theElementName.split("(?=\\p{Upper})");
+					StringBuffer sb = new StringBuffer();
+					for (String seg : nameArray) {
+						sb.append(seg).append(" ");
+					}
+					sb.append("(s)");
+
+					return sb.toString();
+				}
+			};
+
+			ElementListSelectionDialog filterSelectionDialog = new ElementListSelectionDialog(window2.getShell(), lp);
+
+			filterSelectionDialog.setTitle("Select Section");
+
+			filterSelectionDialog.setMessage("Select a section(s):");
+
+			filterSelectionDialog.setMultipleSelection(true);
+
+			getFilterHash(theSectionCache);
+
+			filterSelectionDialog.setElements(theSectionCache.keySet().toArray());
+
+			;
+
+			if (filterSelectionDialog.open() != Window.OK) {
+				return null;
+			}
+			// return the selection
+
+			for (Object object : filterSelectionDialog.getResult()) {
+				theSections.add((EClass) object);
+			}
+
+		}
+
 		try {
 
 			boolean completed = true;
@@ -117,7 +213,7 @@
 									if (o instanceof IFolder) {
 										IFolder folder = (IFolder) o;
 										monitor.beginTask("Generate Spreadsheet", folder.members().length);
-										processFolder2(folder, monitor, splitOption);
+										processFolder2(folder, monitor, splitOption, theSections, theSectionCache);
 									}
 								}
 							} catch (IOException e) {
@@ -216,7 +312,7 @@
 
 	}
 
-	String getSheet(EClass document, Section section, String splitOption) {
+	String getSheet(EClass document, EClass sectionEClass, String splitOption) {
 		int documentIndex;
 
 		if (CONSOLIDATED.equals(splitOption)) {
@@ -228,9 +324,9 @@
 		if (!sheets.containsKey(documentIndex)) {
 			sheets.put(documentIndex, new HashMap<Integer, String>());
 		}
-		if (!sheets.get(documentIndex).containsKey(section.eClass().getClassifierID())) {
+		if (!sheets.get(documentIndex).containsKey(sectionEClass.getClassifierID())) {
 
-			String sheetName = sheetName(section);
+			String sheetName = sheetName(sectionEClass);
 			/*
 			 * get and create appears to not use the same length of string
 			 * So walk the collection and see if we have the previous version of section created first
@@ -239,8 +335,7 @@
 			 */
 			for (Integer akey : sheets.get(documentIndex).keySet()) {
 				if (sheetName.startsWith(sheets.get(documentIndex).get(akey))) {
-					sheets.get(documentIndex).put(
-						section.eClass().getClassifierID(), sheets.get(documentIndex).get(akey));
+					sheets.get(documentIndex).put(sectionEClass.getClassifierID(), sheets.get(documentIndex).get(akey));
 					return sheets.get(documentIndex).get(akey);
 				}
 			}
@@ -249,10 +344,10 @@
 
 			SXSSFSheet newSheet = wb.createSheet(sheetName);
 			newSheet.setRandomAccessWindowSize(50);
-			sheets.get(documentIndex).put(section.eClass().getClassifierID(), newSheet.getSheetName());
+			sheets.get(documentIndex).put(sectionEClass.getClassifierID(), newSheet.getSheetName());
 
 		}
-		return sheets.get(documentIndex).get(section.eClass().getClassifierID());
+		return sheets.get(documentIndex).get(sectionEClass.getClassifierID());
 
 	}
 
@@ -340,7 +435,8 @@
 		return false;
 	}
 
-	void processFolder2(IFolder folder, IProgressMonitor monitor, String splitOption) throws Exception {
+	void processFolder2(IFolder folder, IProgressMonitor monitor, String splitOption, HashSet<EClass> sectionFilter,
+			HashMap<EClass, HashSet<EClass>> theSectionCache) throws Exception {
 
 		/*
 		 * Set Ratio low as to prevent Zip Bomb Detection
@@ -459,7 +555,29 @@
 								query, encountersSheet, documentMetadata, patientRole, encounters, file.getName());
 
 							for (Section section : clinicalDocument.getSections()) {
-								String sheetIndex = getSheet(clinicalDocument.eClass(), section, splitOption);
+
+								EClass theSectionEClass = section.eClass();
+
+								if (!sectionFilter.isEmpty() && !sectionFilter.contains(section.eClass())) {
+
+									boolean found = false;
+									for (EClass sectionClass : sectionFilter) {
+										if (theSectionCache.get(sectionClass).contains(section.eClass())) {
+											theSectionEClass = sectionClass;
+											found = true;
+											break;
+										}
+									}
+									if (!found) {
+										continue;
+
+									}
+								}
+								// if (!sectionFilter.contains(section.eClass())) {
+								// continue;
+								// }
+
+								String sheetIndex = getSheet(clinicalDocument.eClass(), theSectionEClass, splitOption);
 								if (!(section instanceof EncountersSectionEntriesOptional)) {
 									SectionSwitch sectionSwitch = new SectionSwitch(
 										query, wb.getSheet(sheetIndex), documentMetadata, patientRole, serviceEvent,
@@ -493,7 +611,7 @@
 								query, encountersSheet, documentMetadata, patientRole, encounters, file.getName());
 
 							for (Section section : clinicalDocument.getSections()) {
-								String sheetIndex = getSheet(clinicalDocument.eClass(), section, splitOption);
+								String sheetIndex = getSheet(clinicalDocument.eClass(), section.eClass(), splitOption);
 								if (!(section instanceof org.openhealthtools.mdht.uml.cda.ccd.EncountersSection)) {
 									C32SectionSwitch sectionSwitch = new C32SectionSwitch(
 										query, wb.getSheet(sheetIndex), documentMetadata, patientRole, serviceEvent,
@@ -715,4 +833,80 @@
 		return count;
 	}
 
+	void getFilterHash(HashMap<EClass, HashSet<EClass>> theSections) {
+
+		TreeIterator<EObject> packageContents = ConsolPackage.eINSTANCE.eAllContents();
+
+		ArrayList<EClass> packageSections = new ArrayList<EClass>();
+
+		ArrayList<EClass> rootSections = new ArrayList<EClass>();
+
+		while (packageContents.hasNext()) {
+
+			EObject packageObject = packageContents.next();
+
+			if (packageObject instanceof EClass) {
+				EClass eClass = (EClass) packageObject;
+				boolean isSection = false;
+				for (EClass eClass2 : eClass.getEAllSuperTypes()) {
+					if ("Section".equals(eClass2.getName())) {
+						isSection = true;
+						break;
+					}
+				}
+
+				if (isSection) {
+					packageSections.add(eClass);
+				}
+
+			}
+
+		}
+
+		Set<EClass> sectionBaseClasses = new HashSet<EClass>();
+
+		for (EClass section : packageSections) {
+			for (EClass parentSection : section.getESuperTypes()) {
+				sectionBaseClasses.add(parentSection);
+			}
+		}
+
+		Comparator<? super EClass> compare = new Comparator<EClass>() {
+
+			@Override
+			public int compare(EClass o1, EClass o2) {
+				return o1.getName().compareTo(o2.getName());
+			}
+		};
+		Collections.sort(packageSections, compare);
+
+		for (EClass section : packageSections) {
+			if (!sectionBaseClasses.contains(section)) {
+
+				boolean isRealRoot = true;
+				for (EClass sectionAgain : packageSections) {
+					if (sectionAgain.getName().startsWith(section.getName()) &&
+							!sectionAgain.getName().equals(section.getName())) {
+						isRealRoot = false;
+					}
+				}
+				if (isRealRoot) {
+					rootSections.add(section);
+				}
+			}
+		}
+
+		for (EClass ec3 : rootSections) {
+			theSections.put(ec3, new HashSet<EClass>());
+			theSections.get(ec3).addAll(ec3.getEAllSuperTypes());
+			theSections.get(ec3).add(ec3);
+
+			for (EClass sectionAgain : packageSections) {
+				if (ec3.getName().startsWith(sectionAgain.getName()) && !ec3.getName().equals(sectionAgain.getName())) {
+					theSections.get(ec3).add(sectionAgain);
+				}
+			}
+		}
+	}
+
 }
diff --git a/cda/plugins/org.eclipse.mdht.cda.xml.ui/t.xml b/cda/plugins/org.eclipse.mdht.cda.xml.ui/t.xml
deleted file mode 100644
index 805ee04..0000000
--- a/cda/plugins/org.eclipse.mdht.cda.xml.ui/t.xml
+++ /dev/null
@@ -1,241 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-
-<!-- /******************************************************************************* 
-	* Copyright (c) 2010 Sean Muir * All rights reserved. This program and the 
-	accompanying materials * are made available under the terms of the Eclipse 
-	Public License v1.0 * which accompanies this distribution, and is available 
-	at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Sean Muir 
-	(JKM Software) - initial API and implementation * * $Id$ *******************************************************************************/ -->
-
-<plugin>
-
-	<extension point="org.eclipse.core.contenttype.contentTypes">
-		<content-type base-type="org.eclipse.core.runtime.xml"
-			describer="org.eclipse.mdht.cda.xml.CDAContentHandler"
-			file-extensions="xml" id="org.eclipse.mdht.cda" name="Clinical Document Architecture (CDA)"
-			priority="normal">
-		</content-type>
-	</extension>
-
-	<extension id="xml" name="CDA Validator"
-		point="org.eclipse.wst.validation.validatorV2">
-		<validator build="false" class="org.eclipse.mdht.cda.xml.Validator"
-			markerId="org.eclipse.mdht.cda.xml.validationMarker" manual="true">
-			<include>
-				<rules>
-					<contentType id="org.eclipse.mdht.cda"></contentType>
-					<fileext caseSensitive="false" ext="xml" />
-				</rules>
-			</include>
-		</validator>
-	</extension>
-
-	<extension id="org.eclipse.mdht.cda.xml.validationMarker"
-		name="CDA Validation" point="org.eclipse.core.resources.markers">
-		<super type="org.eclipse.wst.validation.problemmarker" />
-		<persistent value="false" />
-	</extension>
-
-	<extension point="org.eclipse.ui.commands">
-		<command id="org.eclipse.mdht.cda.xml.ui.commands.analyzeCDA"
-			name="ANALYZECDA" defaultHandler="org.eclipse.mdht.cda.xml.ui.handlers.AnalyzeCDAHandler">
-		</command>
-		<command id="org.eclipse.mdht.cda.xml.ui.commands.deidentifyCDA"
-			name="DEIDENTIFYCDA" defaultHandler="org.eclipse.mdht.cda.xml.ui.handlers.DeidentifyCDAHandler">
-		</command>
-		<command id="org.eclipse.mdht.cda.xml.ui.commands.generateCDAData"
-			name="GENERATECDADATA" defaultHandler="org.eclipse.mdht.cda.xml.ui.handlers.GenerateCDADataHandler">
-		</command>
-		<command
-			id="org.eclipse.mdht.cda.xml.ui.commands.generateCDADataFiltered"
-			name="GENERATECDADATA"
-			defaultHandler="org.eclipse.mdht.cda.xml.ui.handlers.GenerateCDADataFilteredHandler">
-			<commandParameter id="org.eclipse.mdht.cda.xml.ui.sectionParameter"
-				name="org.eclipse.mdht.cda.xml.ui.sectionParameter" optional="false">
-			</commandParameter>
-		</command>
-		<command id="org.eclipse.mdht.cda.xml.ui.commands.openUsingStylesSheet"
-			name="GENERATECDADATA" defaultHandler="org.eclipse.mdht.cda.xml.ui.handlers.OpenUsingStyleSheet">
-		</command>
-		<command id="org.eclipse.mdht.cda.xml.ui.commands.openCDAViewer"
-			name="GENERATECDADATA" defaultHandler="org.eclipse.mdht.cda.xml.ui.handlers.OpenCDAViewer">
-		</command>
-
-	</extension>
-
-	<extension point="org.eclipse.ui.views">
-		<category name="CDA Analysis" id="cdaanalysis">
-		</category>
-		<view name="Entries" icon="icons/analyzer/analysis.ico" category="cdaanalysis"
-			class="org.eclipse.mdht.cda.xml.ui.views.EntriesView" id="org.eclipse.mdht.cda.xml.ui.views.entriesview">
-		</view>
-		<view name="Narrative" icon="icons/analyzer/analysis.ico"
-			category="cdaanalysis" class="org.eclipse.mdht.cda.xml.ui.views.NarrativeView"
-			id="org.eclipse.mdht.cda.xml.ui.views.narrativeview">
-		</view>
-		<view name="Issues" icon="icons/analyzer/analysis.ico" category="cdaanalysis"
-			class="org.eclipse.mdht.cda.xml.ui.views.ValidationsView" id="org.eclipse.mdht.cda.xml.ui.views.validationsview">
-		</view>
-		<view name="Contents" icon="icons/analyzer/analysis.ico"
-			category="cdaanalysis" class="org.eclipse.mdht.cda.xml.ui.views.RawView"
-			id="org.eclipse.mdht.cda.xml.ui.views.rawview">
-		</view>
-		<view name="Document Metrics Details" icon="icons/analyzer/analysis.ico"
-			category="cdaanalysis" class="org.eclipse.mdht.cda.xml.ui.views.MetricsView"
-			id="org.eclipse.mdht.cda.xml.ui.views.metricsview">
-		</view>
-	</extension>
-
-	<extension point="org.eclipse.ui.editors">
-		<editor class="org.eclipse.mdht.cda.xml.ui.editors.CDAAnalyzer"
-			contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
-			extensions="xml" icon="icons/analyzer/editor_area.gif"
-			id="org.eclipse.mdht.cda.xml.ui.editors.CDAAnalyzer" name="CDA Analyzer">
-		</editor>
-
-		<editor class="org.eclipse.mdht.cda.xml.ui.editors.CDAAnalyzer2"
-			contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
-			extensions="xml" icon="icons/analyzer/metharg_obj.gif"
-			id="org.eclipse.mdht.cda.xml.ui.editors.CDAAnalyzer2" name="CDA Metrics">
-		</editor>
-
-		<editor class="org.eclipse.mdht.cda.xml.ui.editors.CDAXSL"
-			contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
-			extensions="xml" icon="icons/analyzer/internal_browser.gif" id="org.eclipse.mdht.cda.xml.ui.editors.CDAXSL"
-			name="CDA XSL">
-		</editor>
-
-	</extension>
-
-	<extension point="org.eclipse.ui.menus">
-		<menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
-			<menu label="CDA Utilities">
-				<command commandId="org.eclipse.mdht.cda.xml.ui.commands.analyzeCDA"
-					label="Analyze CDA Document(s)" id="org.eclipse.mdht.cda.xml.ui.menu.analyzeCDA"
-					mnemonic="A">
-					<visibleWhen>
-						<with variable="selection">
-							<iterate>
-								<adapt type="org.eclipse.core.resources.IFolder" />
-							</iterate>
-						</with>
-					</visibleWhen>
-				</command>
-
-
-				<command commandId="org.eclipse.mdht.cda.xml.ui.commands.deidentifyCDA"
-					label="Deidentify CDA Document(s)" id="org.eclipse.mdht.cda.xml.ui.menu.deidentifyCDA"
-					mnemonic="D">
-					<visibleWhen>
-						<with variable="selection">
-							<iterate ifEmpty="false" operator="or">
-								<or>
-									<and>
-										<instanceof value="org.eclipse.core.resources.IFolder" />
-									</and>
-									<and>
-										<instanceof value="org.eclipse.core.resources.IFile" />
-									</and>
-								</or>
-							</iterate>
-						</with>
-					</visibleWhen>
-				</command>
-
-
-				<command commandId="org.eclipse.mdht.cda.xml.ui.commands.openUsingStylesSheet"
-					label="Open CDA Document" id="org.eclipse.mdht.cda.xml.ui.menu.openCDA"
-					mnemonic="O">
-					<visibleWhen>
-						<with variable="selection">
-							<iterate ifEmpty="false" operator="or">
-								<or>
-									<and>
-										<instanceof value="org.eclipse.core.resources.IFile" />
-									</and>
-								</or>
-							</iterate>
-						</with>
-					</visibleWhen>
-				</command>
-
-				<!-- Need to add the ability to enable just when consol2 is available -->
-				<command commandId="org.eclipse.mdht.cda.xml.ui.commands.generateCDAData"
-					label="Generate CDA Analysis Report" id="org.eclipse.mdht.cda.xml.ui.menu.generateCDAData"
-					mnemonic="G">
-					<visibleWhen>
-						<with variable="selection">
-							<iterate ifEmpty="false" operator="and">
-								<and>
-									<and>
-										<instanceof value="org.eclipse.core.resources.IFolder" />
-									</and>
-								</and>
-							</iterate>
-						</with>
-					</visibleWhen>
-				</command>
-
-				<command
-					commandId="org.eclipse.mdht.cda.xml.ui.commands.generateCDADataFiltered"
-					label="Generate CDA Filtered Allergies Report"
-					id="org.eclipse.mdht.cda.xml.ui.menu.generateCDADataFiltered.allergies"
-					mnemonic="A">
-					<visibleWhen>
-						<with variable="selection">
-							<iterate ifEmpty="false" operator="and">
-								<and>
-									<and>
-										<instanceof value="org.eclipse.core.resources.IFolder" />
-									</and>
-								</and>
-							</iterate>
-						</with>
-					</visibleWhen>
-					<parameter name="org.eclipse.mdht.cda.xml.ui.sectionParameter"
-						value="Allergies">
-					</parameter>
-				</command>
-				<command
-					commandId="org.eclipse.mdht.cda.xml.ui.commands.generateCDADataFiltered"
-					id="org.eclipse.mdht.cda.xml.ui.menu.generateCDADataFiltered.medications"
-					label="Generate CDA Filtered Medications Report" mnemonic="A">
-					<visibleWhen>
-						<with variable="selection">
-							<iterate ifEmpty="false" operator="and">
-								<and>
-									<and>
-										<instanceof value="org.eclipse.core.resources.IFolder">
-										</instanceof>
-									</and>
-								</and>
-							</iterate>
-						</with>
-					</visibleWhen>
-					<parameter name="org.eclipse.mdht.cda.xml.ui.sectionParameter"
-						value="Medications">
-					</parameter>
-
-				</command>
-
-				<command commandId="org.eclipse.mdht.cda.xml.ui.commands.openCDAViewer"
-					label="Open CDA Viewer" id="org.eclipse.mdht.cda.xml.ui.menu.openCDAViewer"
-					mnemonic="O">
-					<visibleWhen>
-						<with variable="selection">
-							<iterate ifEmpty="false" operator="or">
-								<or>
-									<and>
-										<instanceof value="org.eclipse.core.resources.IResource" />
-									</and>
-								</or>
-							</iterate>
-						</with>
-					</visibleWhen>
-				</command>
-
-			</menu>
-		</menuContribution>
-	</extension>
-</plugin>