Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation')
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateAction.java150
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateSchemaActionDelegate.java75
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/Validator.java172
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDMessageInfoHelper.java71
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidator.java66
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidatorManager.java173
6 files changed, 0 insertions, 707 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateAction.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateAction.java
deleted file mode 100644
index f6f85a1ad2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateAction.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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.xsd.ui.internal.validation;
-
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
-
-
-
-/**
- * This class manages the 'UI' related details of validation. Here's a quick
- * overview of the details :
- * - manages Marker creation based on the results of the validation
- * - (optionally) displays dialog to summarize the results of validation
- *
- * @author Lawrence Mandel, IBM
- * @author Keith Chong, IBM
- */
-public class ValidateAction extends org.eclipse.wst.xml.ui.internal.validation.core.ValidateAction
-{
- // Property file strings.
- private static final String _UI_DIALOG_XML_SCHEMA_INVALID_TEXT = "_UI_DIALOG_XML_SCHEMA_INVALID_TEXT";
- private static final String _UI_DIALOG_XML_SCHEMA_INVALID_TITLE = "_UI_DIALOG_XML_SCHEMA_INVALID_TITLE";
- private static final String _UI_DIALOG_XML_SCHEMA_VALID_TITLE = "_UI_DIALOG_XML_SCHEMA_VALID_TITLE";
- private static final String _UI_DIALOG_XML_SCHEMA_VALID_TEXT = "_UI_DIALOG_XML_SCHEMA_VALID_TEXT";
- private static final String _UI_DIALOG_XML_SCHEMA_VALID_WITH_WARNINGS = "_UI_DIALOG_XML_SCHEMA_VALID_WITH_WARNINGS";
-
- private InputStream inputStream;
-
- /**
- * Constructor.
- *
- * @param file The file to validate.
- * @param showDialog Whether or not to show a dialog when validation is complete.
- */
- public ValidateAction(IFile file, boolean showDialog)
- {
- super(file, showDialog);
- }
-
- /*
- * Store additional information in the message parameters
- * param[0] = the column number of the error
- * param[1] = the 'squiggle selection strategy' for which DOM part to squiggle
- * param[2] = the name or value of what is to be squiggled
- */
- protected void addInfoToMessage (ValidationMessage validationMessage, IMessage message)
- {
- if (inputStream != null)
- {
- XSDMessageInfoHelper messageInfoHelper = new XSDMessageInfoHelper();
- String[] messageInfo = messageInfoHelper.createMessageInfo(validationMessage.getMessage(), validationMessage.getKey());
-
- message.setAttribute(COLUMN_NUMBER_ATTRIBUTE, new Integer(validationMessage.getColumnNumber()));
- message.setAttribute(SQUIGGLE_SELECTION_STRATEGY_ATTRIBUTE, messageInfo[0]);
- message.setAttribute(SQUIGGLE_NAME_OR_VALUE_ATTRIBUTE, messageInfo[1]);
- }
- }
-
- protected void validate(final IFile file)
- {
- final ValidationOutcome valoutcome = new ValidationOutcome();
- IPath path = file.getLocation();
- final String uri = createURIForFilePath(path.toString());
-
- IWorkspaceRunnable op = new IWorkspaceRunnable()
- {
-
- public void run(IProgressMonitor progressMonitor) throws CoreException
- {
- clearMarkers(file);
- XSDValidator validator = XSDValidator.getInstance();
- ValidationReport valreport = validator.validate(uri, inputStream);
- valoutcome.isValid = valreport.isValid();
- if(valreport.getValidationMessages().length == 0)
- {
- valoutcome.hasMessages = false;
- }
- else
- {
- valoutcome.hasMessages = true;
- }
- createMarkers(file, valreport.getValidationMessages());
-
- file.setSessionProperty(ValidationMessage.ERROR_MESSAGE_MAP_QUALIFIED_NAME, valreport.getNestedMessages());
- }
- };
-
- try
- {
- ResourcesPlugin.getWorkspace().run(op, null);
- String internalErrorMessage = null;
-
- if (showDialog)
- {
- if (!valoutcome.isValid)
- {
- String message = XSDValidatorManager.getString(_UI_DIALOG_XML_SCHEMA_INVALID_TEXT);
- String title = XSDValidatorManager.getString(_UI_DIALOG_XML_SCHEMA_INVALID_TITLE);
- if (internalErrorMessage != null)
- {
- message = message + "\n" + internalErrorMessage;
- }
- openErrorDialog(title, message);
- }
- else if (valoutcome.isValid && valoutcome.hasMessages)
- {
- String message = XSDValidatorManager.getString(_UI_DIALOG_XML_SCHEMA_VALID_WITH_WARNINGS);
- String title = XSDValidatorManager.getString(_UI_DIALOG_XML_SCHEMA_VALID_TITLE);
- openWarningDialog(title, message);
- }
- else
- {
- String message = XSDValidatorManager.getString(_UI_DIALOG_XML_SCHEMA_VALID_TEXT);
- String title = XSDValidatorManager.getString(_UI_DIALOG_XML_SCHEMA_VALID_TITLE);
- //String message = validator.isGrammarEncountered() ?
- // XSDValidatorManager.getString("_UI_THE_XML_FILE_IS_VALID") :
- // XSDValidatorManager.getString("_UI_THE_XML_FILE_IS_WELL_FORMED") +
- // XSDValidatorManager.getString("_UI_NO_GRAMMAR_WARNING");
- openValidDialog(title, message);
- }
- }
- }
-
- catch (CoreException e)
- {
- }
- }
- public void setInputStream(InputStream inputStream)
- { this.inputStream = inputStream;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateSchemaActionDelegate.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateSchemaActionDelegate.java
deleted file mode 100644
index 5dce0fe03d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/ValidateSchemaActionDelegate.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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.xsd.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;
-
-/**
- * Validate schema - from popup
- */
-public class ValidateSchemaActionDelegate
- implements IActionDelegate
-{
- protected ISelection selection;
-
- public void run(IAction action)
- {
- 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());
- if (theClass == null)
- {
- throw(new Exception("Missing Xerces jars in plugin's 'jars' folder"));
- }
-
- IFile fileResource = null;
- if (!selection.isEmpty() && selection instanceof IStructuredSelection)
- {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Object element = structuredSelection.getFirstElement();
-
- if (element instanceof IFile)
- {
- fileResource = (IFile) element;
- }
- else
- {
- return;
- }
- }
- 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 = "Required files xercesImpl.jar and xmlParserAPIs.jar cannot be found.\n\n";
- String xercesLine2 = "Download Xerces 2.6.2 and place xercesImpl.jar and xmlParserAPIs.jar in a folder entitled jars in the org.eclipse.wst.xml.validation plugin.\n\n";
- String xercesLine3 = "For more information see www.eclipse.org/webtools/wst/components/xml/xercesInfo.xml.";
- MessageDialog.openError(Display.getDefault().getActiveShell(), "Missing Xerces", xercesLine1 + xercesLine2 + xercesLine3);
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection)
- {
- this.selection = selection;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/Validator.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/Validator.java
deleted file mode 100644
index b14ec14c70..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/Validator.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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.xsd.ui.internal.validation;
-
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.operations.IRuleGroup;
-import org.eclipse.wst.validation.internal.operations.ValidatorManager;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-
-
-public class Validator implements IValidator
-{
- private final String GET_FILE = "getFile";
- public final String GET_PROJECT_FILES = "getAllFiles";
-
- public void validate(IFile file)
- {
- ValidateAction validateAction = new ValidateAction(file, false);
- validateAction.setValidator(this);
- validateAction.run();
- }
- /**
- * This is the method which performs the validation on the MOF model.
- * <br><br>
- * <code>helper</code> and <code>reporter</code> may not be null. <code>changedFiles</code> may be null, if a full
- * build is desired.
- * <br><br>
- * <code>helper</code> returns the ifile for the given information in the IFileDelta array
- * <br><br>
- * <code>reporter</code> is an instance of an IReporter interface, which is used for interaction with the user.
- * <br><br>
- * <code>changedFiles</code> is an array of file names which have changed since the last validation.
- * If <code>changedFiles</code> is null, or if it is an empty array, then a full build
- * is performed. Otherwise, validation on just the files listed in the Vector is performed.
- */
- public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
- String[] changedFiles = helper.getURIs();
- if (changedFiles != null && changedFiles.length > 0)
- {
- for (int i = 0; i < changedFiles.length; i++)
- {
- String fileName = changedFiles[i];
- if (fileName != null)
- {
- Object []parms = {fileName};
-
- IFile file = (IFile) helper.loadModel(GET_FILE, parms);
- if (file != null && shouldValidate(file))
- {
- //the helper might not have the file stored in it. could have an InputStream
- if (helper.loadModel("inputStream") instanceof InputStream)
- {
- validate(file, (InputStream)helper.loadModel("inputStream"), reporter); //do we need the fileName? what is int ruleGroup?
- }
- else
- {
- //if (((Helper)helper).isInJavaBuildPath(file) &&
- // !((AWorkbenchHelper)helper).isInJavaSourcePath(file))
- //{
- // continue;
- //}
- validateIfNeeded(file, helper, reporter);
- }
- }
- }
- }
- }
- else
- {
- Object []parms = {this.getClass().getName()};
- Collection files = (Collection) helper.loadModel(GET_PROJECT_FILES, parms);
- Iterator iter = files.iterator();
- while (iter.hasNext())
- {
- IFile file = (IFile) iter.next();
- if(shouldValidate(file))
- {
- validateIfNeeded(file, helper, reporter);
- }
- }
- }
- }
-
-
- private void validate(IFile file, InputStream inputStream, IReporter reporter)
- {
- ValidateAction validateAction = new ValidateAction(file, false);
- validateAction.setValidator(this);
- if (inputStream != null)
- {
- validateAction.setInputStream(inputStream);
- validateAction.setReporter(reporter);
- }
- validateAction.run();
- }
-
- protected void validateIfNeeded(IFile file, IValidationContext helper, IReporter reporter)
- {
- ValidatorManager mgr = ValidatorManager.getManager();
-
- Integer ruleGroupInt = (Integer)helper.loadModel(IRuleGroup.PASS_LEVEL, null); // pass in a "null" so that loadModel doesn't attempt to cast the result into a RefObject
- int ruleGroup = (ruleGroupInt == null) ? IRuleGroup.PASS_FULL : ruleGroupInt.intValue();
-
- Object stream = helper.loadModel("inputStream");
- if (stream instanceof InputStream)
- {
- validate(file, (InputStream)stream, reporter);
- }
- else
- {
- validate(file, null, reporter);
- }
- }
-
- /**
- * Unpacks the fileModelPair and returns an IFile object.
- */
- //protected IFile getFile(Object object)
- //{
- // IFile result = null;
- // if (object instanceof List)
- // {
- // List fileModelPair = (List)object;
- // if (fileModelPair.size()>0)
- // {
- // Object file = fileModelPair.get(0);
- // if (file instanceof IFile)
- // {
- /// result = (IFile)file;
- // }
- // }
- // }
- // return result;
- // }
-
- /* (non-Javadoc)
- * @see org.eclipse.wtp.validation.core.IValidator#cleanup(org.eclipse.wtp.validation.core.IReporter)
- */
- public void cleanup(IReporter reporter)
- {
- }
-
- boolean shouldValidate(IFile file) {
- IResource resource = file;
- do {
- if (resource.isDerived() || resource.isTeamPrivateMember() || !resource.isAccessible() || resource.getName().charAt(0) == '.') {
- return false;
- }
- resource = resource.getParent();
- }
- while ((resource.getType() & IResource.PROJECT) == 0 && (resource.getType() & IResource.ROOT) == 0);
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDMessageInfoHelper.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDMessageInfoHelper.java
deleted file mode 100644
index 3c7307a6c6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDMessageInfoHelper.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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.xsd.ui.internal.validation;
-
-
-/**
- * @author Mark Hutchinson
- *
- * The XSDMessageInfoHelper creates a string with the
- */
-public class XSDMessageInfoHelper
-{
- public XSDMessageInfoHelper()
- { super();
- }
-
- public String[] createMessageInfo(String errorMessage, String errorKey)
- {
- //Now map the error key to what we would want to underline:
- String nameOrValue = "";
- String selectionStrategy = "";
- if (errorKey.equals("s4s-elt-invalid-content.1") || errorKey.equals("s4s-elt-must-match.1") || errorKey.equals("s4s-att-must-appear") || errorKey.equals("s4s-elt-invalid-content.2"))
- { selectionStrategy = "START_TAG";
- }
- else if (errorKey.equals("s4s-att-not-allowed"))
- { selectionStrategy = "ATTRIBUTE_NAME";
- nameOrValue = getFirstStringBetweenSingleQuotes(errorMessage);
- }
- else if (errorKey.equals("s4s-att-invalid-value"))
- { selectionStrategy = "ATTRIBUTE_VALUE";
- nameOrValue = getFirstStringBetweenSingleQuotes(errorMessage);
- }
- else if (errorKey.equals("s4s-elt-character"))
- { selectionStrategy = "TEXT";
- }
- else if (errorKey.equals("src-resolve.4.2") || errorKey.equals("src-resolve"))
- { selectionStrategy = "VALUE_OF_ATTRIBUTE_WITH_GIVEN_VALUE";
- nameOrValue = getFirstStringBetweenSingleQuotes(errorMessage);
- }
- String messageInfo[] = new String[2];
- messageInfo[0] = selectionStrategy;
- messageInfo[1] = nameOrValue;
- return messageInfo;
- }
-
- /*
- * Mark Hutchinson
- *
- * This method is used to get the value between the first pair of single quotes
- * It is used to extract information from the error Message (for example
- * an attribute name)
- */
- private String getFirstStringBetweenSingleQuotes(String s)
- {
- int first = s.indexOf("'");
- int second = s.indexOf("'", first + 1);
- String betweenQuotes = null;
- if (first != -1 && second != -1)
- { betweenQuotes = s.substring(first + 1, second);
- }
- return betweenQuotes;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidator.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidator.java
deleted file mode 100644
index 899f21d75d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidator.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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.xsd.ui.internal.validation;
-
-import java.io.InputStream;
-
-import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
-import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
-
-
-/**
- * An XSD validator specific to Eclipse. This validator will wrap the internal
- * XSD validator an provide automatic URI resolver support.
- * Using this class is equivalent to using the internal XSD validator and registering
- * the URI resolver.
- */
-public class XSDValidator
-{
- private static XSDValidator instance = null;
- private org.eclipse.wst.xsd.core.internal.validation.XSDValidator validator = null;
-
- /**
- * Return the one and only instance of the XSD validator. The validator
- * can be reused and cannot be customized so there should only be one instance of it.
- *
- * @return The one and only instance of the XSD validator.
- */
- public static XSDValidator getInstance()
- {
- if(instance == null)
- {
- instance = new XSDValidator();
- }
- return instance;
- }
- /**
- * Constructor. Create the XSD validator and set the URI resolver.
- */
- protected XSDValidator()
- {
- validator = new org.eclipse.wst.xsd.core.internal.validation.XSDValidator();
- validator.setURIResolver(URIResolverPlugin.createResolver());
- }
- /**
- * Validate the file at the given URI.
- *
- * @param uri The URI of the file to validate.
- */
- /*public ValidationReport validate(String uri)
- {
- return validator.validate(uri);
- }*/
- public ValidationReport validate(String uri, InputStream inputStream)
- {
- return validator.validate(uri, inputStream);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidatorManager.java b/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidatorManager.java
deleted file mode 100644
index d19ad1c59b..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-validation/org/eclipse/wst/xsd/ui/internal/validation/XSDValidatorManager.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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.xsd.ui.internal.validation;
-
-import java.io.IOException;
-import java.net.URL;
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.xsd.core.internal.XSDCorePlugin;
-
-public class XSDValidatorManager extends AbstractUIPlugin
-{
- protected static XSDValidatorManager plugin;
-
- public XSDValidatorManager(IPluginDescriptor descriptor)
- {
- super(descriptor);
- plugin = this;
-
- }
-
- /**
- * Copy the w3c XMLSchema.dtd and datatypes.dtd into the plugin metadata directory
- * for validation purposes
- */
- public void startup()
- {
- //ModelManagerPlugin plugin = (ModelManagerPlugin) Platform.getPlugin(ModelManagerPlugin.ID);
- //modelManager = plugin.getModelManager();
- }
-
- //private static ModelManager modelManager;
- //public static ModelManager getModelManager()
- //{
- // return modelManager;
- //}
-
- /**
- * Get the Install URL
- */
- public static URL getInstallURL()
- {
- return XSDCorePlugin.getDefault().getDescriptor().getInstallURL();
- }
-
- /**
- * Return the plugin physical directory location
- */
- public static IPath getPluginLocation()
- {
- try
- {
- IPath installPath = new Path(getInstallURL().toExternalForm()).removeTrailingSeparator();
- String installStr = Platform.asLocalURL(new URL(installPath.toString())).getFile();
- return new Path(installStr);
- }
- catch (IOException e)
- {
-
- }
- return null;
- }
-
- /**
- * Get the metadata directory for this plugin
- */
- //public static String getMetaDataDirectory()
- //{
- // return getPlugin().getStateLocation().toOSString();
- //}
-
- /**
- * Get the one xmlschema package.
- */
-// public XMLSchemaPackage getXMLSchemaPackage()
-// {
-// return xmlschemaPackage;
-// }
-
-// /**
-// * Get the one xmlschema factory.
-// */
-// public XMLSchemaFactory getXMLSchemaFactory()
-// {
-// return (XMLSchemaFactory)xmlschemaPackage.getEFactoryInstance();
-// }
-
- /**
- * Get the singleton instance.
- */
- public static XSDValidatorManager getInstance()
- {
- return plugin;
- }
-
-
- //public static Image getXSDImage(String iconName)
- //{
- // return getPlugin().getImage(iconName);
- //}
-
- /**
- * Get resource string
- */
- public static String getString(String key)
- {
- return XSDCorePlugin.getDefault().getDescriptor().getResourceBundle().getString(key);
- }
-
- /**
- * Get resource string
- */
- public static String getString(String key, String arg0)
- {
- return MessageFormat.format(getString(key), new Object [] { arg0 });
- }
-
- /**
- * Get resource string
- */
- public static String getString(String key, String arg0, String arg1)
- {
- return MessageFormat.format(getString(key), new Object [] { arg0, arg1 });
- }
- public IWorkspace getWorkspace()
- {
- return ResourcesPlugin.getWorkspace();
- }
-
- //public static Shell getShell()
- //{
- // return getPlugin().getWorkbench().getActiveWorkbenchWindow().getShell();
- //}
-
- /**
- * Get the xml schema default namespace prefix
- */
- //public String getXMLSchemaPrefix()
- //{
- // return getPreferenceStore().getString(CONST_XSD_DEFAULT_PREFIX_TEXT);
- //}
-
- /**
- * Get the xml schema language qualification
- */
- //public boolean isQualifyXMLSchemaLanguage()
- //{
- // return getPreferenceStore().getBoolean(CONST_XSD_LANGUAGE_QUALIFY);
- //}
-
-
-
- public static final String CONST_XSD_DEFAULT_PREFIX_TEXT = "org.eclipse.wst.xmlschema.xsdDefaultPrefixText";
- public static final String CONST_XSD_LANGUAGE_QUALIFY = "org.eclipse.wst.xmlschema.xsdQualify";
-
-
-}

Back to the top