JBoss Tools SVN: r43099 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test: tck/validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2012-08-17 14:42:55 -0400 (Fri, 17 Aug 2012)
New Revision: 43099
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTBeansXmlValidationTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/BeansXmlValidationTest.java
Log:
https://issues.jboss.org/browse/JBIDE-10611 As-you-type CDI validation
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2012-08-17 17:06:51 UTC (rev 43098)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2012-08-17 18:42:55 UTC (rev 43099)
@@ -55,6 +55,7 @@
import org.jboss.tools.cdi.core.test.tck.lookup.ResolutionByTypeTest;
import org.jboss.tools.cdi.core.test.tck.lookup.UnsatisfiedDependencyTest;
import org.jboss.tools.cdi.core.test.tck.validation.AYTAnnotationValidationTest;
+import org.jboss.tools.cdi.core.test.tck.validation.AYTBeansXmlValidationTest;
import org.jboss.tools.cdi.core.test.tck.validation.AYTDefenitionErrorsValidationTest;
import org.jboss.tools.cdi.core.test.tck.validation.AYTDeploymentProblemsValidationTests;
import org.jboss.tools.cdi.core.test.tck.validation.AYTSuppressWarningsTests;
@@ -138,7 +139,7 @@
// As-you-type validation tests
suite.addTestSuite(AYTDefenitionErrorsValidationTest.class);
suite.addTestSuite(AYTDeploymentProblemsValidationTests.class);
-// suite.addTestSuite(BeansXmlValidationTest.class);
+ suite.addTestSuite(AYTBeansXmlValidationTest.class);
suite.addTestSuite(AYTAnnotationValidationTest.class);
suite.addTestSuite(AYTSuppressWarningsTests.class);
@@ -162,7 +163,7 @@
suiteAll.addTestSuite(EnableCDISupportForJarTest.class);
suiteAll.addTestSuite(DependentProjectValidationTest.class);
suiteAll.addTest(new CDICoreTestSetup(suite));
-
+
suite = new TestSuite(BuilderOrderValidationTest.class.getName());
suite.addTestSuite(BuilderOrderValidationTest.class);
ProjectImportTestSetup testSetup = new ProjectImportTestSetup(suite,
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTBeansXmlValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTBeansXmlValidationTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTBeansXmlValidationTest.java 2012-08-17 18:42:55 UTC (rev 43099)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.core.test.tck.validation;
+
+import org.jboss.tools.tests.IAnnotationTest;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class AYTBeansXmlValidationTest extends BeansXmlValidationTest {
+
+ private CDIAnnotationTest annotationTest = new CDIAnnotationTest();
+
+ @Override
+ protected IAnnotationTest getAnnotationTest() {
+ return annotationTest;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AYTBeansXmlValidationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/BeansXmlValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/BeansXmlValidationTest.java 2012-08-17 17:06:51 UTC (rev 43098)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/BeansXmlValidationTest.java 2012-08-17 18:42:55 UTC (rev 43099)
@@ -14,7 +14,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
-import org.jboss.tools.tests.AbstractResourceMarkerTest;
/**
* @author Alexey Kazakov
@@ -30,9 +29,9 @@
public void testBeansXMLInBin() throws Exception {
IFile file = tckProject.getFile("JavaSource/META-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME, "cdi.test.alternative.Unxisting"), false, 6);
+ getAnnotationTest().assertAnnotationIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME, "cdi.test.alternative.Unxisting"), false, 6);
file = tckProject.getFile("WebContent/WEB-INF/classes/META-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME, "cdi.test.alternative.Unxisting"), 6);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME, "cdi.test.alternative.Unxisting"), 6);
}
/**
@@ -43,8 +42,8 @@
*/
public void testNoAlternativeClassWithSpecifiedName() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME, "org.jboss.jsr299.tck.tests.policy.broken.incorrect.name.NonExistingClass"), false, 7);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME, "org.jboss.jsr299.tck.tests.policy.broken.same.type.twice.Dog"), 19);
+ getAnnotationTest().assertAnnotationIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME, "org.jboss.jsr299.tck.tests.policy.broken.incorrect.name.NonExistingClass"), false, 7);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME, "org.jboss.jsr299.tck.tests.policy.broken.same.type.twice.Dog"), 19);
}
/**
@@ -54,8 +53,8 @@
*/
public void testIllegalAlternativeClassWithSpecifiedName() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_ALTERNATIVE_BEAN_CLASS, "org.jboss.jsr299.tck.tests.policy.broken.not.policy.Cat"), 4);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_ALTERNATIVE_BEAN_CLASS, "org.jboss.jsr299.tck.tests.policy.broken.same.type.twice.Dog"), 19);
+ getAnnotationTest().assertAnnotationIsCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_ALTERNATIVE_BEAN_CLASS, "org.jboss.jsr299.tck.tests.policy.broken.not.policy.Cat"), 4);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_ALTERNATIVE_BEAN_CLASS, "org.jboss.jsr299.tck.tests.policy.broken.same.type.twice.Dog"), 19);
}
/**
@@ -66,8 +65,8 @@
*/
public void testNoAlternativeAnnotationWithSpecifiedName() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_ANNOTATION_NAME, "org.jboss.jsr299.tck.tests.policy.broken.not.policy.stereotype.NotExistingStereotype"), 12);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_ANNOTATION_NAME, "org.jboss.jsr299.tck.tests.jbt.validation.beansxml.AlternativeStereotype"), 17);
+ getAnnotationTest().assertAnnotationIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_ANNOTATION_NAME, "org.jboss.jsr299.tck.tests.policy.broken.not.policy.stereotype.NotExistingStereotype"), 12);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_ALTERNATIVE_ANNOTATION_NAME, "org.jboss.jsr299.tck.tests.jbt.validation.beansxml.AlternativeStereotype"), 17);
}
/**
@@ -77,8 +76,8 @@
*/
public void testIllegalAlternativeAnnotationWithSpecifiedName() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_ALTERNATIVE_ANNOTATION, "org.jboss.jsr299.tck.tests.policy.broken.not.policy.stereotype.Mock"), 15);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_ALTERNATIVE_ANNOTATION, "org.jboss.jsr299.tck.tests.jbt.validation.beansxml.AlternativeStereotype"), 17);
+ getAnnotationTest().assertAnnotationIsCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_ALTERNATIVE_ANNOTATION, "org.jboss.jsr299.tck.tests.policy.broken.not.policy.stereotype.Mock"), 15);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_ALTERNATIVE_ANNOTATION, "org.jboss.jsr299.tck.tests.jbt.validation.beansxml.AlternativeStereotype"), 17);
}
/**
@@ -88,9 +87,9 @@
*/
public void testSameAlternativeClassListedTwice() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE, 20, 22, 26, 27);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE, 17);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE, 19);
+ getAnnotationTest().assertAnnotationIsCreated(file, CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE, 20, 22, 26, 27);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE, 17);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, CDIValidationMessages.DUPLICATE_ALTERNATIVE_TYPE, 19);
}
/**
@@ -100,8 +99,8 @@
*/
public void testNonExistantDecoratorClassInBeansXmlNotOK() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_DECORATOR_BEAN_CLASS_NAME, "com.acme.NonExistantDecoratorClass"), 34);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_DECORATOR_BEAN_CLASS_NAME, "org.jboss.jsr299.tck.tests.decorators.resolution.BarDecorator"), BAR_DECORATOR_LINE);
+ getAnnotationTest().assertAnnotationIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_DECORATOR_BEAN_CLASS_NAME, "com.acme.NonExistantDecoratorClass"), 34);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_DECORATOR_BEAN_CLASS_NAME, "org.jboss.jsr299.tck.tests.decorators.resolution.BarDecorator"), BAR_DECORATOR_LINE);
}
/**
@@ -111,8 +110,8 @@
*/
public void testEnabledDecoratorNotADecorator() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_DECORATOR_BEAN_CLASS, "org.jboss.jsr299.tck.tests.decorators.definition.broken.enabledDecoratorIsNotDecorator.TimestampLogger"), 37);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_DECORATOR_BEAN_CLASS, "org.jboss.jsr299.tck.tests.decorators.resolution.BarDecorator"), BAR_DECORATOR_LINE);
+ getAnnotationTest().assertAnnotationIsCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_DECORATOR_BEAN_CLASS, "org.jboss.jsr299.tck.tests.decorators.definition.broken.enabledDecoratorIsNotDecorator.TimestampLogger"), 37);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_DECORATOR_BEAN_CLASS, "org.jboss.jsr299.tck.tests.decorators.resolution.BarDecorator"), BAR_DECORATOR_LINE);
}
/**
@@ -122,8 +121,8 @@
*/
public void testDecoratorListedTwiceInBeansXmlNotOK() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, CDIValidationMessages.DUPLICATE_DECORATOR_CLASS, 39, 40);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, CDIValidationMessages.DUPLICATE_DECORATOR_CLASS, BAR_DECORATOR_LINE);
+ getAnnotationTest().assertAnnotationIsCreated(file, CDIValidationMessages.DUPLICATE_DECORATOR_CLASS, 39, 40);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, CDIValidationMessages.DUPLICATE_DECORATOR_CLASS, BAR_DECORATOR_LINE);
}
/**
@@ -133,8 +132,8 @@
*/
public void testNonExistantClassInBeansXmlNotOk() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_INTERCEPTOR_CLASS_NAME, "com.acme.Foo"), FOO_LINE);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_INTERCEPTOR_CLASS_NAME, "org.jboss.jsr299.tck.tests.jbt.validation.interceptors.CatInterceptor"), CAT_INTERCEPTOR_LINE);
+ getAnnotationTest().assertAnnotationIsCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_INTERCEPTOR_CLASS_NAME, "com.acme.Foo"), FOO_LINE);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, NLS.bind(CDIValidationMessages.UNKNOWN_INTERCEPTOR_CLASS_NAME, "org.jboss.jsr299.tck.tests.jbt.validation.interceptors.CatInterceptor"), CAT_INTERCEPTOR_LINE);
}
/**
@@ -144,8 +143,8 @@
*/
public void testNonInterceptorClassInBeansXmlNotOk() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_INTERCEPTOR_CLASS, "org.jboss.jsr299.tck.tests.interceptors.definition.broken.nonInterceptorClassInBeansXml.Foo"), NON_INTERCEPTOR_LINE);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_INTERCEPTOR_CLASS, "org.jboss.jsr299.tck.tests.jbt.validation.interceptors.CatInterceptor"), CAT_INTERCEPTOR_LINE);
+ getAnnotationTest().assertAnnotationIsCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_INTERCEPTOR_CLASS, "org.jboss.jsr299.tck.tests.interceptors.definition.broken.nonInterceptorClassInBeansXml.Foo"), NON_INTERCEPTOR_LINE);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, NLS.bind(CDIValidationMessages.ILLEGAL_INTERCEPTOR_CLASS, "org.jboss.jsr299.tck.tests.jbt.validation.interceptors.CatInterceptor"), CAT_INTERCEPTOR_LINE);
}
/**
@@ -155,7 +154,7 @@
*/
public void testSameInterceptorClassListedTwiceInBeansXmlNotOk() throws Exception {
IFile file = tckProject.getFile("WebContent/WEB-INF/beans.xml");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, CDIValidationMessages.DUPLICATE_INTERCEPTOR_CLASS, FORD_INTERCEPTOR_1_LINE, FORD_INTERCEPTOR_2_LINE);
- AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, CDIValidationMessages.DUPLICATE_INTERCEPTOR_CLASS, CAT_INTERCEPTOR_LINE);
+ getAnnotationTest().assertAnnotationIsCreated(file, CDIValidationMessages.DUPLICATE_INTERCEPTOR_CLASS, FORD_INTERCEPTOR_1_LINE, FORD_INTERCEPTOR_2_LINE);
+ getAnnotationTest().assertAnnotationIsNotCreated(file, CDIValidationMessages.DUPLICATE_INTERCEPTOR_CLASS, CAT_INTERCEPTOR_LINE);
}
}
\ No newline at end of file
12 years, 4 months
JBoss Tools SVN: r43098 - trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-08-17 13:06:51 -0400 (Fri, 17 Aug 2012)
New Revision: 43098
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
Log:
JBIDE-12436
False validation problem for elements annotated @SuppressWarnings
Issue is fixed
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-17 15:35:59 UTC (rev 43097)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-17 17:06:51 UTC (rev 43098)
@@ -224,7 +224,7 @@
}
public void finishReporting() {
- if (isCancelled() || messages.isEmpty() || getAnnotationModel() == null || fCompilationUnit == null)
+ if (isCancelled() || getAnnotationModel() == null || fCompilationUnit == null)
return;
IEditorInput editorInput= fEditor.getEditorInput();
12 years, 4 months
JBoss Tools SVN: r43097 - trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-08-17 11:35:59 -0400 (Fri, 17 Aug 2012)
New Revision: 43097
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
Log:
JBIDE-10611
As-you-type CDI validation
The annotations from the new Validator Problem Messages are merged with the existing annotations (the only new annotations are added as well as old annotations are removed while the existing ones are saved within the Document Annotation Model) instead of removing all the annotations by a region and creating the new ones from the Validator Problem Messages.
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-17 13:36:06 UTC (rev 43096)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-17 15:35:59 UTC (rev 43097)
@@ -12,8 +12,10 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -174,6 +176,8 @@
* This method removes from annotation model each annotation stored
* in JavaELProblemReporter.fAnnotations(Annotation, Position) that
* has position inside [start,end] region;
+ *
+ * @deprecated Don't use this method
*/
public void clearAnnotations(int start, int end) {
if (fAnnotations.isEmpty()) {
@@ -196,6 +200,8 @@
* in JavaELProblemReporter.fAnnotations(Annotation, Position) that
* or exists in fAlwaysRemoveAnnotations
* that indicates it should be removed without regard to its actual position.
+ *
+ * @deprecated Don't use this method
*/
public void clearAlwaysRemoveAnnotations() {
if (fAnnotations.isEmpty()) {
@@ -211,24 +217,6 @@
}
}
}
-
- /**
- * Adds annotation to the annotation model, and stores it in fAnnotations (when cleanAllAnnotations = true, that indicates that
- * the annotation should be removed without regard to the modified region, the annotation is stored in fAlwaysRemoveAnnotations as well).
- *
- * @param annotation
- * @param position
- * @param cleanAllAnnotations
- */
- public void addAnnotation(Annotation annotation, Position position, boolean cleanAllAnnotations) {
- if (isCancelled()) {
- return;
- }
- fAnnotations.add(annotation);
- if (cleanAllAnnotations)
- fAlwaysRemoveAnnotations.add(annotation);
- fAnnotationModel.addAnnotation(annotation, position);
- }
@Override
public void addMessage(IValidator origin, IMessage message) {
@@ -244,18 +232,84 @@
return;
String editorInputName = editorInput.getName();
+
+ Annotation[] annotations = fAnnotations.toArray(new Annotation[0]);
+ List<Annotation> annotationsToRemove = new ArrayList<Annotation>();
+ Set<ValidationMessage> existingValidationMessages = new HashSet<ValidationMessage>();
+
+ for (Annotation annotation : annotations) {
+ if (!(annotation instanceof TempJavaProblemAnnotation))
+ continue;
+
+ TempJavaProblemAnnotation jpAnnotation = (TempJavaProblemAnnotation)annotation;
+ Position position = getAnnotationModel().getPosition(jpAnnotation);
+
+ // Find a validation message for the annotation
+ boolean existing = false;
+ for (IMessage m : messages) {
+ if (!(m instanceof ValidationMessage))
+ continue;
+
+ ValidationMessage valMessage = (ValidationMessage)m;
+ if (position != null && position.getOffset() == valMessage.getOffset() && position.getLength() == valMessage.getLength()) {
+ String text = valMessage.getText();
+ text = text == null ? "" : text;
+ if (!text.equalsIgnoreCase(jpAnnotation.getText()))
+ continue;
+
+ Object type = valMessage.getAttribute(TempMarkerManager.MESSAGE_TYPE_ATTRIBUTE_NAME);
+ type = type == null ? "" : type;
+ Map jpAttributes = jpAnnotation.getAttributes();
+ if (jpAttributes == null)
+ continue;
+
+ if (!type.equals(jpAttributes.get(TempMarkerManager.MESSAGE_TYPE_ATTRIBUTE_NAME)))
+ continue;
+
+ // This is an annotation to keep (message is found for the annotation)
+ existingValidationMessages.add(valMessage);
+ existing = true;
+ break;
+ }
+ }
+
+ // This is an annotation to remove (no message found for the annotation)
+ if (!existing)
+ annotationsToRemove.add(annotation);
+ }
+
+ Map<Annotation, Position> annotationsToAdd = new HashMap<Annotation, Position>();
+ Set<Annotation> cleanAllAnnotationsToAdd = new HashSet<Annotation>();
for (IMessage message : messages) {
- if (!(message instanceof ValidationMessage))
+ if (!(message instanceof ValidationMessage) ||
+ existingValidationMessages.contains(message))
continue;
-
+
ValidationMessage valMessage = (ValidationMessage)message;
boolean cleanAllAnnotations = Boolean.TRUE.equals(message.getAttribute(TempMarkerManager.CLEAN_ALL_ANNOTATIONS_ATTRIBUTE));
Position position = new Position(valMessage.getOffset(), valMessage.getLength());
TempJavaProblem problem = new TempJavaProblem(valMessage, editorInputName);
TempJavaProblemAnnotation problemAnnotation = new TempJavaProblemAnnotation(problem, fCompilationUnit);
- addAnnotation(problemAnnotation, position, cleanAllAnnotations);
+ annotationsToAdd.put(problemAnnotation, position);
+ if (cleanAllAnnotations)
+ cleanAllAnnotationsToAdd.add(problemAnnotation);
}
+
+ getAnnotationModel(); // This is to update saved document annotation model
+ for (Annotation a : annotationsToRemove) {
+ fAnnotations.remove(a);
+ if (fAlwaysRemoveAnnotations.contains(a))
+ fAlwaysRemoveAnnotations.remove(a);
+ fAnnotationModel.removeAnnotation(a);
+ }
+ for (Annotation a : annotationsToAdd.keySet()) {
+ Position p = annotationsToAdd.get(a);
+ fAnnotations.add(a);
+ if (cleanAllAnnotationsToAdd.contains(a))
+ fAlwaysRemoveAnnotations.add(a);
+ fAnnotationModel.addAnnotation(a, p);
+ }
removeAllMessages();
}
}
@@ -434,7 +488,6 @@
protected void endProcessing() {
if (fValidatorManager == null || fReporter == null || fStartPartitionsToProcess == -1 || fEndPartitionsToProcess == -1)
return;
- fReporter.clearAnnotations(fStartPartitionsToProcess, fEndPartitionsToProcess);
if (fPartitionsToProcess != null && !fPartitionsToProcess.isEmpty()) {
fValidatorManager.validateString(
@@ -453,6 +506,7 @@
}),
fHelper, fReporter);
}
+
fReporter.finishReporting();
}
12 years, 4 months
JBoss Tools SVN: r43096 - trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite.
by jbosstools-commits@lists.jboss.org
Author: jpeterka
Date: 2012-08-17 09:36:06 -0400 (Fri, 17 Aug 2012)
New Revision: 43096
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JenkinsSuite.java
Log:
Another tests added into hb ui bot Jenkins tests suite
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JenkinsSuite.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JenkinsSuite.java 2012-08-17 12:28:47 UTC (rev 43095)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.bot.test/src/org/jboss/tools/hb/ui/bot/suite/JenkinsSuite.java 2012-08-17 13:36:06 UTC (rev 43096)
@@ -5,6 +5,8 @@
import org.jboss.tools.hb.ui.bot.test.mappingfile.EditMappingFileTest;
import org.jboss.tools.hb.ui.bot.test.perspective.PerspectiveTest;
import org.jboss.tools.hb.ui.bot.test.reveng.CreateRevengFileTest;
+import org.jboss.tools.hb.ui.bot.test.view.JPADetailViewTest;
+import org.jboss.tools.hb.ui.bot.test.view.PackageInfoTest;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -22,7 +24,9 @@
// EditConfigurationFileTest.class - Multipage editor must be fixed for Juno
CreateRevengFileTest.class,
CreateMappingFileTest.class,
- EditMappingFileTest.class
+ EditMappingFileTest.class,
+ JPADetailViewTest.class,
+ PackageInfoTest.class
})
public class JenkinsSuite {
12 years, 4 months
JBoss Tools SVN: r43095 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal: context and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-08-17 08:28:47 -0400 (Fri, 17 Aug 2012)
New Revision: 43095
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java
Log:
https://issues.jboss.org/browse/JBIDE-9535
Use user default schema/catalog
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java 2012-08-17 12:24:21 UTC (rev 43094)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java 2012-08-17 12:28:47 UTC (rev 43095)
@@ -12,6 +12,7 @@
package org.jboss.tools.hibernate.jpt.core.internal;
import java.util.List;
+import java.util.Properties;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.preferences.IScopeContext;
@@ -22,15 +23,21 @@
import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.internal.AbstractJpaProject;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.console.properties.HibernatePropertiesConstants;
+import org.hibernate.eclipse.nature.HibernateNature;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
import org.jboss.tools.hibernate.jpt.core.internal.context.Messages;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.BasicHibernateProperties;
import org.jboss.tools.hibernate.jpt.core.internal.validation.HibernateJpaValidationMessage;
import org.osgi.service.prefs.Preferences;
@@ -45,26 +52,80 @@
public HibernateJpaProject(JpaProject.Config config){
super(config);
}
+
+ public ConsoleConfiguration getDefaultConsoleConfiguration(){
+ HibernateNature nature = HibernateNature.getHibernateNature(getJavaProject());
+ if (nature != null){
+ return nature.getDefaultConsoleConfiguration();
+ }
+ return null;
+ }
public NamingStrategy getNamingStrategy(){
- String ccName = getDefaultConsoleConfigurationName();
- if (ccName != null || "".equals(ccName)){//$NON-NLS-1$
- ConsoleConfiguration cc = KnownConfigurations.getInstance().find(ccName);
- if (cc != null){
- if (cc.getConfiguration() != null){
- Configuration config = cc.getConfiguration();
- return config.getNamingStrategy();
- }
+ ConsoleConfiguration cc = getDefaultConsoleConfiguration();
+ if (cc != null){
+ if (cc.getConfiguration() != null){
+ Configuration config = cc.getConfiguration();
+ return config.getNamingStrategy();
}
}
return null;
}
+
+ public BasicHibernateProperties getBasicHibernateProperties(){
+ Persistence persistence = getRootContextNode().getPersistenceXml().getPersistence();
+ if (persistence.getPersistenceUnitsSize() > 0){
+ PersistenceUnit persistenceUnit = persistence.getPersistenceUnit(0);
+ if (persistenceUnit instanceof HibernatePersistenceUnit) {
+ return ((HibernatePersistenceUnit) persistenceUnit).getHibernatePersistenceUnitProperties();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getDefaultSchema() {
+ ConsoleConfiguration cc = getDefaultConsoleConfiguration();
+ if (cc != null){
+ Properties properties = cc.getPreferences().getProperties();
+ if (properties != null && properties.containsKey(Environment.DEFAULT_SCHEMA)){
+ return properties.getProperty(Environment.DEFAULT_SCHEMA);
+ }
+ }
+ String schema = null;
+ BasicHibernateProperties prop = getBasicHibernateProperties();
+ if (getUserOverrideDefaultSchema() != null){
+ schema = getUserOverrideDefaultSchema();
+ } else if (prop != null && prop.getSchemaDefault() != null){
+ schema = prop.getSchemaDefault();
+ }
+
+ return schema != null ? schema : super.getDefaultSchema();
+ }
+
+ @Override
+ public String getDefaultCatalog() {
+ String catalog = null;
+ BasicHibernateProperties prop = getBasicHibernateProperties();
+ ConsoleConfiguration cc = getDefaultConsoleConfiguration();
+ if (cc != null){
+ Properties properties = cc.getPreferences().getProperties();
+ if (properties != null && properties.containsKey(Environment.DEFAULT_CATALOG)){
+ return properties.getProperty(Environment.DEFAULT_CATALOG);
+ }
+ } else if (getUserOverrideDefaultCatalog() != null){
+ catalog = getUserOverrideDefaultCatalog();
+ } else if (prop != null && prop.getCatalogDefault() != null){
+ catalog = prop.getCatalogDefault();
+ }
+
+ return catalog != null ? catalog : super.getDefaultCatalog();
+ }
public String getDefaultConsoleConfigurationName(){
- IScopeContext scope = new ProjectScope(getProject());
- Preferences node = scope.getNode(HibernatePropertiesConstants.HIBERNATE_CONSOLE_NODE);
- if(node!=null) {
- return node.get(HibernatePropertiesConstants.DEFAULT_CONFIGURATION, getName() );
+ HibernateNature nature = HibernateNature.getHibernateNature(getJavaProject());
+ if (nature != null){
+ return nature.getDefaultConsoleConfigurationName();
}
return null;
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java 2012-08-17 12:24:21 UTC (rev 43094)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java 2012-08-17 12:28:47 UTC (rev 43095)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal.context;
-import java.io.File;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -113,7 +112,7 @@
}
// ******** Behavior *********
- public HibernatePersistenceUnitProperties getHibernatePersistenceUnitProperties() {
+ public BasicHibernateProperties getHibernatePersistenceUnitProperties() {
return this.hibernateProperties;
}
12 years, 4 months
JBoss Tools SVN: r43094 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console: properties and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-08-17 08:24:21 -0400 (Fri, 17 Aug 2012)
New Revision: 43094
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/properties/HibernatePropertyPage.java
Log:
https://issues.jboss.org/browse/JBIDE-12439
Rebuild Jpa Project on associated console configuration change(or enable/disable Hibernate support change)
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2012-08-17 12:12:55 UTC (rev 43093)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2012-08-17 12:24:21 UTC (rev 43094)
@@ -111,6 +111,8 @@
public static String HibernatePropertyPage_details;
public static String HibernatePropertyPage_enable_hibernate3_support;
+
+ public static String HibernatePropertyPage_Error_updating_JpaProject;
public static String HibernatePropertyPage_open_url;
public static String HibernatePropertyPage_unable_open_webbrowser_for_url;
public static String HibernatePropertyPage_use_naming_strategy;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2012-08-17 12:12:55 UTC (rev 43093)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2012-08-17 12:24:21 UTC (rev 43094)
@@ -104,6 +104,7 @@
HibernatePropertyPage_default_hibernate_console_config=Default Hibernate Console configuration:
HibernatePropertyPage_details=<a>Details ...</a>
HibernatePropertyPage_enable_hibernate3_support=Enable Hibernate support
+HibernatePropertyPage_Error_updating_JpaProject=Error updating JpaProject
HibernatePropertyPage_open_url=Open URL
HibernatePropertyPage_unable_open_webbrowser_for_url=Unable to open webbrowser for url:
HibernatePropertyPage_use_naming_strategy=Use NamingStrategy for validation.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/properties/HibernatePropertyPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/properties/HibernatePropertyPage.java 2012-08-17 12:12:55 UTC (rev 43093)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/properties/HibernatePropertyPage.java 2012-08-17 12:24:21 UTC (rev 43094)
@@ -45,6 +45,7 @@
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jpt.jpa.core.JpaFacet;
import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.JpaProject.Reference;
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -79,6 +80,8 @@
Control[] settings;
private Button enableHibernate;
+
+ private String initConsoleConfiguration;
private Combo selectedConfiguration;
@@ -88,7 +91,7 @@
private Label nsSeparator;
- private boolean initNamingStrategy;
+ private boolean initNamingStrategy, initEnableHibernate;
private static final String NONE = "<None>"; //$NON-NLS-1$
@@ -228,16 +231,13 @@
}
});
-
- settings = new Control[] { ownerLabel, selectedConfiguration, details};
- }
-
- private void addThirdSection(Composite parent) {
- Composite settingsPart = createDefaultComposite(parent,2);
+ Composite settingsPart2 = createDefaultComposite(parent,2);
- enableNamingStrategy = new Button(settingsPart, SWT.CHECK);
+ enableNamingStrategy = new Button(settingsPart2, SWT.CHECK);
enableNamingStrategy.setText(HibernateConsoleMessages.HibernatePropertyPage_use_naming_strategy);
enableNamingStrategy.setSelection(initNamingStrategy);
+
+ settings = new Control[] { ownerLabel, selectedConfiguration, details, enableNamingStrategy};
}
/**
@@ -255,7 +255,6 @@
addSeparator(composite);
addSecondSection(composite);
addSeparator(composite);
- addThirdSection(composite);
nsSeparator = addSeparator(composite);
addLogoSection(composite);
@@ -280,8 +279,9 @@
}
protected void performDefaults() {
- enableHibernate.setSelection(false);
- selectedConfiguration.select(0);
+ enableHibernate.setSelection(initEnableHibernate);
+ enableNamingStrategy.setSelection(initNamingStrategy);
+ selectedConfiguration.setText(initConsoleConfiguration);
}
private boolean isHibernateJpaProject(){
@@ -320,13 +320,15 @@
Preferences node = scope.getNode(HibernatePropertiesConstants.HIBERNATE_CONSOLE_NODE);
if(node!=null) {
- enableHibernate.setSelection(node.getBoolean(HibernatePropertiesConstants.HIBERNATE3_ENABLED, false) );
+ initEnableHibernate = node.getBoolean(HibernatePropertiesConstants.HIBERNATE3_ENABLED, false);
+ enableHibernate.setSelection(initEnableHibernate);
String cfg = node.get(HibernatePropertiesConstants.DEFAULT_CONFIGURATION, project.getName() );
ConsoleConfiguration configuration = KnownConfigurations.getInstance().find(cfg);
if(configuration==null) {
selectedConfiguration.select(0);
details.setEnabled(false);
} else {
+ initConsoleConfiguration = cfg;
selectedConfiguration.setText(cfg);
}
initNamingStrategy = node.getBoolean(HibernatePropertiesConstants.NAMING_STRATEGY_ENABLED, true);
@@ -334,6 +336,45 @@
}
}
+ protected void rebildProjectIfJpa() {
+ if (isHibernateJpaProject()){
+ final JpaProject.Reference reference = (Reference) getProject().getAdapter(Reference.class);
+
+ final IWorkspaceRunnable wr = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ reference.rebuild();
+ } catch (InterruptedException e) {
+ throw new CoreException(new Status(IStatus.CANCEL, HibernateConsolePlugin.ID, null, e));
+ }
+ getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor);
+ }
+ };
+
+ IRunnableWithProgress op = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ try {
+ IWorkspace ws = ResourcesPlugin.getWorkspace();
+ ws.run(wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, monitor);
+ }
+ catch(CoreException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ };
+
+ try{
+ new ProgressMonitorDialog(getShell()).run(true, false, op);
+ } catch (InvocationTargetException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.HibernatePropertyPage_Error_updating_JpaProject, e);
+ } catch (InterruptedException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.HibernatePropertyPage_Error_updating_JpaProject, e);
+ }
+ }
+ }
+
protected boolean saveNamigStrategyChanges(){
if (initNamingStrategy == enableNamingStrategy.getSelection()) return true;
IScopeContext scope = new ProjectScope(getProject());
@@ -344,59 +385,27 @@
node.putBoolean(HibernatePropertiesConstants.NAMING_STRATEGY_ENABLED, enableNamingStrategy.getSelection() );
try {
node.flush();
- final IWorkspaceRunnable wr = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor)
- throws CoreException {
- try {
- ((JpaProject.Reference) getProject().getAdapter(JpaProject.Reference.class)).rebuild();
- } catch (InterruptedException e) {
- throw new CoreException(new Status(IStatus.CANCEL, HibernateConsolePlugin.ID, null, e));
- }
- getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor);
- }
- };
-
- IRunnableWithProgress op = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- try {
- IWorkspace ws = ResourcesPlugin.getWorkspace();
- ws.run(wr, ws.getRoot(), IWorkspace.AVOID_UPDATE, monitor);
- }
- catch(CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
-
- try {
- new ProgressMonitorDialog(getShell()).run(true, false, op);
- }
- catch (InterruptedException e) {
- return false; !
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
- }
- catch (InvocationTargetException e) {
- final Throwable te = e.getTargetException();
- throw new RuntimeException(te);
- }
return true;
} catch (BackingStoreException e) {
HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.ProjectUtils_could_not_save_changes_to_preferences, e);
- return false;
}
- } else {
- return false;
}
+ return false;
+
}
public boolean performOk() {
ProjectUtils.toggleHibernateOnProject( getProject(), enableHibernate.getSelection(),
selectedConfiguration.getSelectionIndex() != 0 ? selectedConfiguration.getText() : ""); //$NON-NLS-1$
saveNamigStrategyChanges();
+ if (enableHibernate.getSelection() != initEnableHibernate
+ || initNamingStrategy != enableNamingStrategy.getSelection()
+ || isConsoleConfigurationChanged()){
+ rebildProjectIfJpa();
+ }
return true;
}
-
private void enableSettings(boolean selection) {
for (int i = 0; i < settings.length; i++) {
Control comp = settings[i];
@@ -406,5 +415,13 @@
details.setEnabled(selectedConfiguration.getSelectionIndex() != 0);
}
}
+
+ protected boolean isConsoleConfigurationChanged(){
+ if (initConsoleConfiguration == null ){
+ return selectedConfiguration.getSelectionIndex() == 0;
+ } else {
+ return !initConsoleConfiguration.equals(selectedConfiguration.getText());
+ }
+ }
}
\ No newline at end of file
12 years, 4 months
JBoss Tools SVN: r43093 - branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-08-17 08:12:55 -0400 (Fri, 17 Aug 2012)
New Revision: 43093
Modified:
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property/ProjectPropertyDialogCloseTask.java
Log:
Trying new condition
Modified: branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property/ProjectPropertyDialogCloseTask.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property/ProjectPropertyDialogCloseTask.java 2012-08-17 11:44:22 UTC (rev 43092)
+++ branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property/ProjectPropertyDialogCloseTask.java 2012-08-17 12:12:55 UTC (rev 43093)
@@ -1,10 +1,11 @@
package org.jboss.tools.portlet.ui.bot.task.dialog.property;
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
+
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
import org.jboss.tools.portlet.ui.bot.task.wait.WaitWhileTask;
import org.jboss.tools.ui.bot.ext.condition.NonSystemJobRunsCondition;
-import org.jboss.tools.ui.bot.ext.condition.ShellIsActiveCondition;
import org.jboss.tools.ui.bot.ext.condition.TaskDuration;
public class ProjectPropertyDialogCloseTask extends AbstractSWTTask {
@@ -13,7 +14,7 @@
public void perform() {
SWTBotShell activeShell = getBot().activeShell();
getBot().button("OK").click();
+ getBot().waitUntil(shellCloses(activeShell), TaskDuration.NORMAL.getTimeout());
performInnerTask(new WaitWhileTask(new NonSystemJobRunsCondition(), TaskDuration.LONG));
- performInnerTask(new WaitWhileTask(new ShellIsActiveCondition(activeShell), TaskDuration.NORMAL));
}
}
12 years, 4 months
JBoss Tools SVN: r43092 - branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-08-17 07:44:22 -0400 (Fri, 17 Aug 2012)
New Revision: 43092
Modified:
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property/ProjectPropertyDialogCloseTask.java
Log:
Changed order of conditions
Modified: branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property/ProjectPropertyDialogCloseTask.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property/ProjectPropertyDialogCloseTask.java 2012-08-17 11:17:05 UTC (rev 43091)
+++ branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/dialog/property/ProjectPropertyDialogCloseTask.java 2012-08-17 11:44:22 UTC (rev 43092)
@@ -13,7 +13,7 @@
public void perform() {
SWTBotShell activeShell = getBot().activeShell();
getBot().button("OK").click();
+ performInnerTask(new WaitWhileTask(new NonSystemJobRunsCondition(), TaskDuration.LONG));
performInnerTask(new WaitWhileTask(new ShellIsActiveCondition(activeShell), TaskDuration.NORMAL));
- performInnerTask(new WaitWhileTask(new NonSystemJobRunsCondition(), TaskDuration.LONG));
}
}
12 years, 4 months
JBoss Tools SVN: r43091 - branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-08-17 07:17:05 -0400 (Fri, 17 Aug 2012)
New Revision: 43091
Modified:
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardOpeningTask.java
Log:
Added code for activation of shell
Modified: branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardOpeningTask.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardOpeningTask.java 2012-08-17 11:14:44 UTC (rev 43090)
+++ branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/wizard/WizardOpeningTask.java 2012-08-17 11:17:05 UTC (rev 43091)
@@ -37,6 +37,7 @@
@Override
public void perform() {
+ activateWorkbenchShell();
log.info("Opening wizard");
log.info("All shells: ");
for (SWTBotShell shell : SWTBotFactory.getBot().shells()){
@@ -46,6 +47,19 @@
new SWTBotNewObjectWizard().open(name, getGroupPath());
}
+ private void activateWorkbenchShell(){
+ SWTBotShell[] shells = getBot().shells();
+ if (shells.length == 1){
+ log.info("Only one shell present, assuming it's workbench and activating");
+ shells[0].activate();
+ } else {
+ log.info("More than one shell present");
+ for (SWTBotShell shell : shells){
+ log.info(shell.getText());
+ }
+ }
+ }
+
private String[] getGroupPath() {
if (category == null){
return new String[0];
12 years, 4 months
JBoss Tools SVN: r43090 - branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective.
by jbosstools-commits@lists.jboss.org
Author: ljelinko
Date: 2012-08-17 07:14:44 -0400 (Fri, 17 Aug 2012)
New Revision: 43090
Modified:
branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective/OpenPerspectiveTask.java
Log:
Added code for activation of shell
Modified: branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective/OpenPerspectiveTask.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective/OpenPerspectiveTask.java 2012-08-17 10:26:57 UTC (rev 43089)
+++ branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective/OpenPerspectiveTask.java 2012-08-17 11:14:44 UTC (rev 43090)
@@ -29,22 +29,30 @@
@Override
public void perform() {
- log.info("Opening wizard");
+ activateWorkbenchShell();
+ log.info("Opening perspective");
log.info("All shells: ");
for (SWTBotShell shell : SWTBotFactory.getBot().shells()){
log.info(shell.getText() + ": " + shell);
log.info("Is active: " + shell.isActive());
}
getBot().waitUntil(widgetIsEnabled(getBot().menu("Window")), TaskDuration.NORMAL.getTimeout());
- log.info("Opening wizard");
- log.info("All shells: ");
- for (SWTBotShell shell : SWTBotFactory.getBot().shells()){
- log.info(shell.getText() + ": " + shell);
- log.info("Is active: " + shell.isActive());
- }
SWTBotFactory.getOpen().perspective(perspective);
}
+ public void activateWorkbenchShell(){
+ SWTBotShell[] shells = getBot().shells();
+ if (shells.length == 1){
+ log.info("Only one shell present, assuming it's workbench and activating");
+ shells[0].activate();
+ } else {
+ log.info("More than one shell present");
+ for (SWTBotShell shell : shells){
+ log.info(shell.getText());
+ }
+ }
+ }
+
@Override
public SWTBot getBot() {
return SWTBotFactory.getBot();
12 years, 4 months