Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 129953
Collapse All | Expand All

(-)src-validation/org/eclipse/wst/xml/ui/internal/validation/ValidateAction.java (-14 / +4 lines)
Lines 14-24 Link Here
14
import java.io.InputStream;
14
import java.io.InputStream;
15
15
16
import org.eclipse.core.resources.IFile;
16
import org.eclipse.core.resources.IFile;
17
import org.eclipse.core.resources.IWorkspaceRunnable;
18
import org.eclipse.core.resources.ResourcesPlugin;
19
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.IPath;
18
import org.eclipse.core.runtime.IPath;
21
import org.eclipse.core.runtime.IProgressMonitor;
22
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
19
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
23
import org.eclipse.wst.xml.core.internal.validation.XMLValidationReport;
20
import org.eclipse.wst.xml.core.internal.validation.XMLValidationReport;
24
import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
21
import org.eclipse.wst.xml.core.internal.validation.core.ValidationMessage;
Lines 77-97 Link Here
77
    IPath path = file.getLocation();
74
    IPath path = file.getLocation();
78
    final String uri = createURIForFilePath(path.toString());
75
    final String uri = createURIForFilePath(path.toString());
79
76
80
    IWorkspaceRunnable op = new IWorkspaceRunnable() 
77
    try
81
    {
78
    {
82
      public void run(IProgressMonitor progressMonitor) throws CoreException 
79
        XMLValidator localValidator = XMLValidator.getInstance();
83
      {         
84
        XMLValidator validator = XMLValidator.getInstance();
85
80
86
        clearMarkers(file);
81
        clearMarkers(file);
87
        XMLValidationReport valreport = null;
82
        XMLValidationReport valreport = null;
88
        if (inputStream != null)
83
        if (inputStream != null)
89
        {
84
        {
90
          valreport = validator.validate(uri, inputStream);
85
          valreport = localValidator.validate(uri, inputStream);
91
        }
86
        }
92
        else
87
        else
93
        {
88
        {
94
          valreport = validator.validate(uri);
89
          valreport = localValidator.validate(uri);
95
        }
90
        }
96
        
91
        
97
        valoutcome.isValid = valreport.isValid();
92
        valoutcome.isValid = valreport.isValid();
Lines 107-119 Link Here
107
        createMarkers(file, valreport.getValidationMessages());
102
        createMarkers(file, valreport.getValidationMessages());
108
        
103
        
109
        file.setSessionProperty(ValidationMessage.ERROR_MESSAGE_MAP_QUALIFIED_NAME, valreport.getNestedMessages());
104
        file.setSessionProperty(ValidationMessage.ERROR_MESSAGE_MAP_QUALIFIED_NAME, valreport.getNestedMessages());
110
      }
111
    };    
112
105
113
    
106
    
114
    try
115
    {
116
      ResourcesPlugin.getWorkspace().run(op, null);
117
//      String internalErrorMessage = null;
107
//      String internalErrorMessage = null;
118
//      if (validator.getInternalError() != null)
108
//      if (validator.getInternalError() != null)
119
//      {
109
//      {
(-)src-validation/org/eclipse/wst/xml/ui/internal/validation/Validator.java (-2 / +21 lines)
Lines 19-24 Link Here
19
19
20
import org.eclipse.core.resources.IFile;
20
import org.eclipse.core.resources.IFile;
21
import org.eclipse.core.resources.IResource;
21
import org.eclipse.core.resources.IResource;
22
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.core.runtime.Status;
24
import org.eclipse.core.runtime.jobs.ISchedulingRule;
22
import org.eclipse.osgi.util.NLS;
25
import org.eclipse.osgi.util.NLS;
23
import org.eclipse.wst.validation.internal.core.Message;
26
import org.eclipse.wst.validation.internal.core.Message;
24
import org.eclipse.wst.validation.internal.core.ValidationException;
27
import org.eclipse.wst.validation.internal.core.ValidationException;
Lines 26-33 Link Here
26
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
29
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
27
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
30
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
28
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
31
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
29
import org.eclipse.wst.validation.internal.provisional.core.IValidator;
32
import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
30
import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
33
import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
34
import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
31
35
32
/**
36
/**
33
 * A validator to plug the XML validator into the validation framework.
37
 * A validator to plug the XML validator into the validation framework.
Lines 35-41 Link Here
35
 * @author Craig Salter, IBM
39
 * @author Craig Salter, IBM
36
 * @author Lawrence Mandel, IBM
40
 * @author Lawrence Mandel, IBM
37
 */
41
 */
38
public class Validator implements IValidator
42
public class Validator implements IValidatorJob
39
{
43
{
40
	class LocalizedMessage extends Message {
44
	class LocalizedMessage extends Message {
41
		private String _message = null;
45
		private String _message = null;
Lines 203-206 Link Here
203
  {
207
  {
204
	// Nothing to do.
208
	// Nothing to do.
205
  }
209
  }
210
211
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
212
	try {
213
		validate(helper, reporter);
214
	}
215
	catch (Exception e)
216
	{
217
		return new Status(IStatus.ERROR, XMLUIPlugin.ID, 0, "Exception encountered during XML validation", e);
218
	}
219
	return Status.OK_STATUS;
220
}
221
222
public ISchedulingRule getSchedulingRule(IValidationContext helper) {
223
	return null;
224
}
206
}
225
}

Return to bug 129953