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 308326 | Differences between
and this patch

Collapse All | Expand All

(-)vf2/org/eclipse/wst/validation/Validator.java (-1 / +33 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2007, 2008 IBM Corporation and others.
2
 * Copyright (c) 2007, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-22 Link Here
13
import java.lang.reflect.InvocationTargetException;
13
import java.lang.reflect.InvocationTargetException;
14
import java.util.ArrayList;
14
import java.util.ArrayList;
15
import java.util.HashMap;
15
import java.util.HashMap;
16
import java.util.HashSet;
16
import java.util.Iterator;
17
import java.util.Iterator;
17
import java.util.LinkedList;
18
import java.util.LinkedList;
18
import java.util.List;
19
import java.util.List;
19
import java.util.Map;
20
import java.util.Map;
21
import java.util.Set;
20
import java.util.concurrent.atomic.AtomicBoolean;
22
import java.util.concurrent.atomic.AtomicBoolean;
21
23
22
import org.eclipse.core.resources.IMarker;
24
import org.eclipse.core.resources.IMarker;
Lines 748-753 Link Here
748
		IValidator v = asIValidator();
750
		IValidator v = asIValidator();
749
		if (v == null)return null;
751
		if (v == null)return null;
750
		
752
		
753
		//TODO Workaround for the EAR validator, we still need a more general fix for this.
754
		if (shouldSkipValidator(resource, operation))return null;
755
		
751
		try {
756
		try {
752
			IProject project = resource.getProject();
757
			IProject project = resource.getProject();
753
			SummaryReporter reporter = new SummaryReporter(project, monitor);
758
			SummaryReporter reporter = new SummaryReporter(project, monitor);
Lines 783-788 Link Here
783
		return vr;
788
		return vr;
784
	}
789
	}
785
	
790
	
791
	private static final String EAR_VALIDATOR_ID = "org.eclipse.jst.j2ee.internal.validation.UIEarValidator"; //$NON-NLS-1$
792
	private static final String TEST_FIX_STATE_ID = "TestFixStateID"; //$NON-NLS-1$
793
794
		@SuppressWarnings("unchecked")
795
		
796
		//TODO A temporary workaround for the problem of manual validations calling V1 validators too often
797
		private boolean shouldSkipValidator(IResource resource, ValOperation operation) {
798
799
			if (EAR_VALIDATOR_ID.equals(getId())) {
800
				ValidationState validationState = operation.getState();
801
				Object testFixState = validationState.get(TEST_FIX_STATE_ID);
802
				Set<String> projectsNameSet = null;
803
				String projectName = resource.getProject().getName();
804
805
				if (testFixState == null) {
806
					projectsNameSet = new HashSet<String>();
807
					validationState.put(TEST_FIX_STATE_ID, projectsNameSet);
808
				} else {
809
					projectsNameSet = (Set<String>) testFixState;
810
				}
811
812
				if (projectsNameSet.contains(projectName))return true;
813
				else projectsNameSet.add(projectName);
814
			}
815
			return false;
816
		}
817
786
	/*
818
	/*
787
	 * GRK - Because I didn't want to try to make a true copy of the V1 validator, (because I didn't
819
	 * GRK - Because I didn't want to try to make a true copy of the V1 validator, (because I didn't
788
	 * want to copy the vmd object), I came up with this approach to only copy the fields that
820
	 * want to copy the vmd object), I came up with this approach to only copy the fields that

Return to bug 308326