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
blob: 37e76a287adf0bd2f15e853e96a28cf641373128 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*******************************************************************************
 * 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.html.internal.validation;

import org.eclipse.core.resources.IFile;

/**
 * A version of IHelper not dependent on IWorkbenchHelper.
 * 
 * @author pavery
 */
public class HTMLValidationHelper {
	/**
	 */
	public HTMLValidationHelper() {
		super();
	}

	/**
	 * When an IValidator associates a target object with an IMessage, the
	 * WorkbenchReporter eventually resolves that target object with an
	 * IResource. Sometimes more than one target object resolves to the same
	 * IResource (usually the IProject, which is the default IResource when an
	 * IFile cannot be found). This method is called, by the
	 * WorkbenchReporter, so that the WorkbenchReporter can distinguish
	 * between the IMessages which are on the same IResource, but refer to
	 * different target objects. This is needed for the
	 * removeAllMessages(IValidator, Object) method, so that when one target
	 * object removes all of its messages, that it doesn't remove another
	 * target object's messages.
	 * 
	 * This method may return null only if object is null. Otherwise, an id
	 * which can uniquely identify a particular object must be returned. The
	 * id needs to be unique only within one particular IValidator.
	 */
	public String getTargetObjectName(Object object) {
		if (object == null)
			return null;
		if (object instanceof IFile)
			((IFile) object).getFullPath().toString();
		return object.toString();
	}

}

Back to the top