Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/ValidateXMLFileActionDelegate.java')
-rw-r--r--bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/ValidateXMLFileActionDelegate.java95
1 files changed, 0 insertions, 95 deletions
diff --git a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/ValidateXMLFileActionDelegate.java b/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/ValidateXMLFileActionDelegate.java
deleted file mode 100644
index 4bd2d9514b..0000000000
--- a/bundles/org.eclipse.wst.xml.ui/src-validation/org/eclipse/wst/xml/ui/internal/validation/ValidateXMLFileActionDelegate.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.ui.internal.validation;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IActionDelegate;
-
-/**
- * A delegate to invoke XML validation from the context menu's Validate XML option.
- *
- * @author Craig Saler, IBM
- * @author Lawrence Mandel, IBM
- */
-public class ValidateXMLFileActionDelegate implements IActionDelegate
-{
- protected ISelection selection;
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action)
- {
- IFile fileResource = null;
- try
- {
- // CS.. for now the following line tests to ensure the user has xerces jars installed
- // so that we can perform some 'fail fast' behaviour
- //
- Class theClass = Class.forName("org.apache.xerces.xni.parser.XMLParserConfiguration", true, this.getClass().getClassLoader()); //$NON-NLS-1$
- if (theClass == null)
- {
- throw(new Exception("Missing Xerces jars in plugin's 'jars' folder")); //$NON-NLS-1$
- }
-
- if (!selection.isEmpty() && selection instanceof IStructuredSelection)
- {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Object element = structuredSelection.getFirstElement();
-
- if (element instanceof IFile)
- {
- fileResource = (IFile) element;
- }
- else
- {
- return;
- }
- }
-
- if (fileResource != null)
- {
- //IProject project = fileResource.getProject();
- //URIResolver resolver = (URIResolver) project.getAdapter(URIResolver.class);
- // if (resolver == null)
- // resolver = new ProjectResolver(project);
- //resolver.setFileBaseLocation(fileResource.getLocation().toString());
- //return resolver;
- ValidateAction validateAction = new ValidateAction(fileResource, true);
- validateAction.setValidator(new Validator());
- validateAction.run();
- }
- }
- catch (Exception e)
- {
- // CS... here's where we need to pop up a dialog to tell the user that xerces is not available
- //
- String xercesLine1 = XMLValidationUIMessages.ValidateXMLFileActionDelegate_2;
- String xercesLine2 = XMLValidationUIMessages.ValidateXMLFileActionDelegate_3;
- String xercesLine3 = XMLValidationUIMessages.ValidateXMLFileActionDelegate_4;
- MessageDialog.openError(Display.getDefault().getActiveShell(), XMLValidationUIMessages.ValidateXMLFileActionDelegate_5, xercesLine1 + xercesLine2 + xercesLine3);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection)
- {
- this.selection = selection;
- }
-} \ No newline at end of file

Back to the top