Author: dazarov
Date: 2012-06-28 15:16:02 -0400 (Thu, 28 Jun 2012)
New Revision: 42294
Added:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/BaseQuickFixProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/seam_conversation.png
trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamEntityWizBan.png
trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizBan.png
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JSPProblemMarkerResolutionTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
Log:
org.jboss.tools.jsf.ui.test.JSPProblemMarkerResolutionTest failure
https://issues.jboss.org/browse/JBIDE-12260
Added:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/BaseQuickFixProcessor.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/BaseQuickFixProcessor.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/BaseQuickFixProcessor.java 2012-06-28
19:16:02 UTC (rev 42294)
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * 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.common.text.xml.quickfix;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
+import org.eclipse.jdt.ui.text.java.IInvocationContext;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jdt.ui.text.java.IProblemLocation;
+import org.eclipse.jdt.ui.text.java.IQuickAssistProcessor;
+import org.eclipse.jdt.ui.text.java.IQuickFixProcessor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+public class BaseQuickFixProcessor implements IQuickFixProcessor, IQuickAssistProcessor
{
+
+ public boolean hasAssists(IInvocationContext context) throws CoreException {
+ return true;
+ }
+
+ public IJavaCompletionProposal[] getAssists(IInvocationContext context,
+ IProblemLocation[] locations) throws CoreException {
+
+ return getComplitions(locations);
+ }
+
+ public boolean hasCorrections(ICompilationUnit unit, int problemId) {
+ return true;
+ }
+
+ public IJavaCompletionProposal[] getCorrections(IInvocationContext context,
+ IProblemLocation[] locations) throws CoreException {
+
+ return getComplitions(locations);
+ }
+
+ private IJavaCompletionProposal[] getComplitions(IProblemLocation[] locations){
+ ArrayList<IJavaCompletionProposal> list = new
ArrayList<IJavaCompletionProposal>();
+
+ Annotation[] annotations = findAnnotations(locations);
+
+ String debugInfo = "Annotations: "; //$NON-NLS-1$
+
+ for(Annotation annotation : annotations){
+ debugInfo += annotation.getText()+" "; //$NON-NLS-1$
+ if(QuickFixManager.getInstance().hasProposals(annotation)){
+ List<IJavaCompletionProposal> proposals =
QuickFixManager.getInstance().getProposals(annotation);
+ list.addAll(proposals);
+ }
+ }
+
+ list.add(new BaseCompletionProposal(debugInfo));
+
+ return list.toArray(new IJavaCompletionProposal[]{});
+ }
+
+ private Annotation[] findAnnotations(IProblemLocation[] locations){
+ ArrayList<Annotation> annotationList = new ArrayList<Annotation>();
+
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if(window != null){
+ IWorkbenchPage page = window.getActivePage();
+ if(page != null){
+ IEditorPart editor = page.getActiveEditor();
+ if(editor instanceof JavaEditor){
+ ISourceViewer viwer = ((JavaEditor)editor).getViewer();
+ if(viwer != null){
+ IAnnotationModel aModel = viwer.getAnnotationModel();
+ Iterator iterator = aModel.getAnnotationIterator();
+ while(iterator.hasNext()){
+ Annotation annotation = (Annotation)iterator.next();
+ System.out.println("Annotation - "+annotation.getClass()+"
"+annotation.getClass()+" "+annotation.getType());
+ Position position = aModel.getPosition(annotation);
+ for(IProblemLocation location : locations){
+ if(isOverlap(position, location)){
+ annotationList.add(annotation);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return annotationList.toArray(new Annotation[]{});
+ }
+
+ private boolean isOverlap(Position position, IProblemLocation location){
+ return isInto(position.getOffset(), position.getLength(), location.getOffset(),
location.getLength()) ||
+ isInto(location.getOffset(), location.getLength(), position.getOffset(),
position.getLength());
+ }
+
+ private boolean isInto(int offset1, int length1, int offset2, int length2){
+
+ return (offset1 >= offset2 && offset1 <= (offset2+length2)) ||
((offset1+length2) >= offset2 && (offset1+length2) <= (offset2+length2));
+ }
+
+ class BaseCompletionProposal implements IJavaCompletionProposal{
+ String debugInfo;
+
+ public BaseCompletionProposal(String debugInfo){
+ this.debugInfo = debugInfo;
+ }
+
+ public void apply(IDocument document) {
+ }
+
+ public Point getSelection(IDocument document) {
+ return null;
+ }
+
+ public String getAdditionalProposalInfo() {
+ return "Additioonal Proposal Info"; //$NON-NLS-1$
+ }
+
+ public String getDisplayString() {
+ return "Base Completion Proposal "+debugInfo; //$NON-NLS-1$
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+ public IContextInformation getContextInformation() {
+ return null;
+ }
+
+ public int getRelevance() {
+ return 100;
+ }
+
+ }
+
+}
Property changes on:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/BaseQuickFixProcessor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java 2012-06-28
18:10:05 UTC (rev 42293)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/IQuickFixGenerator.java 2012-06-28
19:16:02 UTC (rev 42294)
@@ -12,7 +12,7 @@
import java.util.List;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jface.text.source.Annotation;
public interface IQuickFixGenerator {
@@ -33,5 +33,5 @@
* @param annotation the annotation
* @return list of proposals for the given annotation
*/
- public List<ICompletionProposal> getProposals(Annotation annotation);
+ public List<IJavaCompletionProposal> getProposals(Annotation annotation);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java 2012-06-28
18:10:05 UTC (rev 42293)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/MarkerAnnotationInfo.java 2012-06-28
19:16:02 UTC (rev 42294)
@@ -16,6 +16,7 @@
import java.util.Map;
import org.eclipse.core.resources.IMarker;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
@@ -83,7 +84,7 @@
if(isDirty() && QuickFixManager.getInstance().hasProposals(annotation)){
annotation.setAdditionalFixInfo(viewer.getDocument());
- List<ICompletionProposal> proposals =
QuickFixManager.getInstance().getProposals(annotation);
+ List<IJavaCompletionProposal> proposals =
QuickFixManager.getInstance().getProposals(annotation);
allProposals.addAll(proposals);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java 2012-06-28
18:10:05 UTC (rev 42293)
+++
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/quickfix/QuickFixManager.java 2012-06-28
19:16:02 UTC (rev 42294)
@@ -14,6 +14,7 @@
import java.util.HashMap;
import java.util.List;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.source.Annotation;
@@ -58,10 +59,10 @@
return false;
}
- public List<ICompletionProposal> getProposals(Annotation annotation){
- ArrayList<ICompletionProposal> proposals = new
ArrayList<ICompletionProposal>();
+ public List<IJavaCompletionProposal> getProposals(Annotation annotation){
+ ArrayList<IJavaCompletionProposal> proposals = new
ArrayList<IJavaCompletionProposal>();
for(IQuickFixGenerator generator : generators.values()){
- List<ICompletionProposal> pp = generator.getProposals(annotation);
+ List<IJavaCompletionProposal> pp = generator.getProposals(annotation);
proposals.addAll(pp);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java 2012-06-28
18:10:05 UTC (rev 42293)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityMarkerResolution.java 2012-06-28
19:16:02 UTC (rev 42294)
@@ -21,6 +21,7 @@
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jface.preference.IPreferenceNode;
import org.eclipse.jface.preference.IPreferencePage;
import org.eclipse.jface.preference.PreferenceManager;
@@ -42,7 +43,7 @@
* @author Daniel Azarov
*/
public class ConfigureProblemSeverityMarkerResolution implements
- IMarkerResolution2, ICompletionProposal {
+ IMarkerResolution2, IJavaCompletionProposal {
private static final int PREFERENCE_SIZE = 40;
private static final String DOTS = "...";
@@ -160,4 +161,9 @@
public IContextInformation getContextInformation() {
return null;
}
+
+ @Override
+ public int getRelevance() {
+ return 0;
+ }
}
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java 2012-06-28
18:10:05 UTC (rev 42293)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/ConfigureProblemSeverityResolutionGenerator.java 2012-06-28
19:16:02 UTC (rev 42294)
@@ -21,7 +21,7 @@
import org.eclipse.jdt.core.ILocalVariable;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator2;
@@ -139,8 +139,8 @@
}
@Override
- public List<ICompletionProposal> getProposals(Annotation annotation) {
- ArrayList<ICompletionProposal> proposals = new
ArrayList<ICompletionProposal>();
+ public List<IJavaCompletionProposal> getProposals(Annotation annotation) {
+ ArrayList<IJavaCompletionProposal> proposals = new
ArrayList<IJavaCompletionProposal>();
if(annotation instanceof TemporaryAnnotation){
String preferenceKey = getPreferenceKey((TemporaryAnnotation)annotation);
String preferencePageId = getPreferencePageId((TemporaryAnnotation)annotation);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JSPProblemMarkerResolutionTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JSPProblemMarkerResolutionTest.java 2012-06-28
18:10:05 UTC (rev 42293)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JSPProblemMarkerResolutionTest.java 2012-06-28
19:16:02 UTC (rev 42294)
@@ -1,8 +1,7 @@
package org.jboss.tools.jsf.ui.test;
-import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -10,16 +9,17 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.jst.jsp.ui.internal.validation.JSPContentSourceValidator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
@@ -28,6 +28,7 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.html.core.internal.validation.HTMLValidator;
import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
import org.eclipse.wst.validation.ValidationFramework;
import org.eclipse.wst.validation.ValidationResult;
@@ -37,8 +38,8 @@
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.jboss.tools.common.text.xml.quickfix.QuickFixManager;
-import org.jboss.tools.jsf.ui.JsfUiPlugin;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.web.ui.action.AddTLDMarkerResolution;
import org.jboss.tools.jst.web.ui.action.JSPProblemMarkerResolutionGenerator;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
@@ -69,6 +70,8 @@
project =
ResourcesPlugin.getWorkspace().getRoot().getProject("test_jsf_project");
isSuspendedValidationDefaultValue = ValidationFramework.getDefault().isSuspended();
ValidationFramework.getDefault().suspendAllValidation(false);
+ //project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ //project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
}
public void tearDown() throws Exception {
@@ -108,25 +111,26 @@
//
https://issues.jboss.org/browse/JBIDE-11596 compile failed in
org.jboss.tools.jsf.ui.test when run against Juno TP
// org.eclipse.wst.html.internal.validation.HTMLValidator was moved to
org.eclipse.wst.html.core.internal.validation.HTMLValidator
// We have to use reflection to be compilable in both Indigo and June.
-// org.eclipse.wst.html.internal.validation.HTMLValidator validator = new
org.eclipse.wst.html.internal.validation.HTMLValidator();
-// ValidationResult result = validator.validate(file, 0, new ValidationState(), new
NullProgressMonitor());
- Class validatorClass = null;
- try {
- validatorClass =
JsfUiPlugin.getDefault().getBundle().loadClass("org.eclipse.wst.html.internal.validation.HTMLValidator");
- } catch (ClassNotFoundException e) {
- try {
- validatorClass =
JsfUiPlugin.getDefault().getBundle().loadClass("org.eclipse.wst.html.core.internal.validation.HTMLValidator");
- } catch (ClassNotFoundException e1) {
- fail("Cannot load org.eclipse.wst.html.internal.validation.HTMLValidator
(Eclipse Indigo) nor org.eclipse.wst.html.core.internal.validation.HTMLValidator (Eclipse
Juno): ClassNotFoundException");
- }
- }
- Constructor constructor = validatorClass.getConstructor();
- Object validator = constructor.newInstance();
- Method validate = validatorClass.getMethod("validate", IResource.class,
int.class, ValidationState.class, IProgressMonitor.class);
- ValidationResult result = (ValidationResult)validate.invoke(validator, file, 0, new
ValidationState(), new NullProgressMonitor());
+// Class validatorClass = null;
+// try {
+// validatorClass =
JsfUiPlugin.getDefault().getBundle().loadClass("org.eclipse.wst.html.core.internal.validation.HTMLValidator");
+// } catch (ClassNotFoundException e) {
+// try {
+// validatorClass =
JsfUiPlugin.getDefault().getBundle().loadClass("org.eclipse.wst.html.internal.validation.HTMLValidator");
+// } catch (ClassNotFoundException e1) {
+// fail("Cannot load org.eclipse.wst.html.internal.validation.HTMLValidator
(Eclipse Indigo) nor org.eclipse.wst.html.core.internal.validation.HTMLValidator (Eclipse
Juno): ClassNotFoundException");
+// }
+// }
+// Constructor constructor = validatorClass.getConstructor();
+// Object validator = constructor.newInstance();
+// Method validate = validatorClass.getMethod("validate", IResource.class,
int.class, ValidationState.class, IProgressMonitor.class);
+// ValidationResult result = (ValidationResult)validate.invoke(validator, file, 0, new
ValidationState(), new NullProgressMonitor());
+ HTMLValidator validator = new HTMLValidator();
+ ValidationResult result = validator.validate(file, 0, new ValidationState(), new
NullProgressMonitor());
+
IReporter reporter = result.getReporter(new NullProgressMonitor());
- List messages = reporter.getMessages();
+ List<Object> messages = reporter.getMessages();
for(Object m : messages){
if(m instanceof Message){
Message message = (Message)m;
@@ -223,30 +227,26 @@
if(editor instanceof JSPMultiPageEditor){
JSPMultiPageEditor jspEditor = (JSPMultiPageEditor)editor;
- IAnnotationModel aModel =
jspEditor.getJspEditor().getTextViewer().getAnnotationModel();
+ SourceViewer viewer = jspEditor.getJspEditor().getTextViewer();
+
// change file
- IDocument document = jspEditor.getJspEditor().getTextViewer().getDocument();
+ IDocument document = viewer.getDocument();
IRegion region = document.getLineInformation(lineToDelete);
document.replace(region.getOffset(), region.getLength(), "");
// Find annotation
- TemporaryAnnotation problemAnnotation = waitForProblemAnnotationAppearance(
- aModel, MAX_SECONDS_TO_WAIT);
- assertNotNull("No ProblemAnnotation found for Marker Type: "
- + MARKER_TYPE, problemAnnotation);
+ TemporaryAnnotation problemAnnotation = waitForProblemAnnotationAppearance(viewer,
"Unknown tag (", MAX_SECONDS_TO_WAIT);
+ assertNotNull("No Unknown tag TemporaryAnnotation found",
problemAnnotation);
- if(problemAnnotation != null){
- problemAnnotation.setAdditionalFixInfo(document);
- // get all relevant quick fixes for this annotation
- if(QuickFixManager.getInstance().hasProposals(problemAnnotation)){
- List<ICompletionProposal> proposals =
QuickFixManager.getInstance().getProposals(problemAnnotation);
- assertNotSame("Quick fix not found", 0, proposals.size());
- }else{
- fail("Quick fix not found");
- }
+ problemAnnotation.setAdditionalFixInfo(document);
+ // get all relevant quick fixes for this annotation
+ if(QuickFixManager.getInstance().hasProposals(problemAnnotation)){
+ List<IJavaCompletionProposal> proposals =
QuickFixManager.getInstance().getProposals(problemAnnotation);
+ assertTrue("No quick fixes found", proposals.size() > 0);
+ assertEquals("Add tag library definition quick fix not found",
AddTLDMarkerResolution.class, proposals.get(0).getClass());
}else{
- fail("Annotation not found");
+ fail("No quick fixes found");
}
}else{
fail("Editor must be instance of JSPMultiPageEditor, was -
"+editor.getClass());
@@ -254,35 +254,38 @@
}
private TemporaryAnnotation waitForProblemAnnotationAppearance(
- final IAnnotationModel annotationModel, final int seconds) {
- final TemporaryAnnotation[] result = new TemporaryAnnotation[] { null };
+ final SourceViewer viewer, final String name, final int seconds) {
+ final TemporaryAnnotation[] result = new TemporaryAnnotation[]{null};
Display.getDefault().syncExec(new Runnable() {
public void run() {
int secondsLeft = seconds;
+ boolean isFirstPass = true;
while (secondsLeft-- > 0) {
- JobUtils.delay(1000);
+ if (!isFirstPass) {
+ JobUtils.delay(1000);
- // clean deffered events
- while (Display.getCurrent().readAndDispatch())
- ;
+ // clean deffered events
+ while (Display.getCurrent().readAndDispatch())
+ ;
+ } else {
+ secondsLeft++; // because the wait step was skipped
+ }
//boolean found = false;
+ IAnnotationModel annotationModel = viewer.getAnnotationModel();
Iterator it = annotationModel.getAnnotationIterator();
while (it.hasNext()) {
Object o = it.next();
- if (!(o instanceof TemporaryAnnotation))
- continue;
+ if (o instanceof TemporaryAnnotation){
+ if(((TemporaryAnnotation) o).getText().startsWith(name)){
+ result[0] = (TemporaryAnnotation) o;
+ }
+ }
- TemporaryAnnotation temporaryAnnotation = (TemporaryAnnotation) o;
- Position position = annotationModel
- .getPosition(temporaryAnnotation);
-
-
- result[0] = temporaryAnnotation;
- return;
}
+ isFirstPass = false;
}
}
});
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2012-06-28
18:10:05 UTC (rev 42293)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2012-06-28
19:16:02 UTC (rev 42294)
@@ -16,9 +16,9 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -26,7 +26,6 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.IMarkerResolution2;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.DocumentProviderRegistry;
import org.eclipse.ui.texteditor.IDocumentProvider;
@@ -43,7 +42,7 @@
* @author Daniel Azarov
*
*/
-public class AddTLDMarkerResolution implements IBaseMarkerResolution,
ICompletionProposal{
+public class AddTLDMarkerResolution implements IBaseMarkerResolution,
IJavaCompletionProposal{
private IFile file;
private Properties properties;
@@ -160,4 +159,9 @@
public IContextInformation getContextInformation() {
return null;
}
+
+ @Override
+ public int getRelevance() {
+ return 0;
+ }
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2012-06-28
18:10:05 UTC (rev 42293)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2012-06-28
19:16:02 UTC (rev 42294)
@@ -20,6 +20,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
@@ -87,7 +88,7 @@
return new IMarkerResolution[]{};
}
- private ICompletionProposal isOurCase(Annotation annotation){
+ private IJavaCompletionProposal isOurCase(Annotation annotation){
if(!(annotation instanceof TemporaryAnnotation)){
return null;
}
@@ -241,9 +242,9 @@
}
@Override
- public List<ICompletionProposal> getProposals(Annotation annotation) {
- ArrayList<ICompletionProposal> proposals = new
ArrayList<ICompletionProposal>();
- ICompletionProposal proposal = isOurCase(annotation);
+ public List<IJavaCompletionProposal> getProposals(Annotation annotation) {
+ ArrayList<IJavaCompletionProposal> proposals = new
ArrayList<IJavaCompletionProposal>();
+ IJavaCompletionProposal proposal = isOurCase(annotation);
if(proposal != null){
proposals.add(proposal);
}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/seam_conversation.png
===================================================================
(Binary files differ)
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/seam_conversation.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamEntityWizBan.png
===================================================================
(Binary files differ)
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamEntityWizBan.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizBan.png
===================================================================
(Binary files differ)
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui/resources/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizBan.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream