Author: vrubezhny
Date: 2012-06-27 13:26:46 -0400 (Wed, 27 Jun 2012)
New Revision: 42250
Modified:
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/contentassist/AbstractContentAssistantTestCase.java
Log:
JBIDE-12261
org.jboss.tools.jsf.jsp.ca.test.CADefaultELStartingCharTest and
CAJsfPredictiveTagNameProposalsTest failures
Issue is fixed.
Modified:
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/contentassist/AbstractContentAssistantTestCase.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/contentassist/AbstractContentAssistantTestCase.java 2012-06-27
17:05:09 UTC (rev 42249)
+++
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/contentassist/AbstractContentAssistantTestCase.java 2012-06-27
17:26:46 UTC (rev 42250)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2011 Red Hat, Inc.
+ * Copyright (c) 2007-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,
@@ -18,11 +18,11 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
@@ -31,6 +31,7 @@
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.test.util.WorkbenchUtils;
+@SuppressWarnings("restriction")
public abstract class AbstractContentAssistantTestCase extends TestCase {
protected String fileName;
protected IProject project = null;
@@ -48,14 +49,22 @@
viewer = getTextViewer();
document = viewer.getDocument();
- SourceViewerConfiguration config = CATestUtil
- .getSourceViewerConfiguration(textEditor);
+// SourceViewerConfiguration config = CATestUtil
+// .getSourceViewerConfiguration(textEditor);
+ assertNotNull("Cannot get the Source Viewer for the editor for page \""
//$NON-NLS-1$
+ + fileName + "\"", viewer); //$NON-NLS-1$
contentAssistant = getContentAssistantInternal();
//(config == null ? null : config.getContentAssistant(viewer));
-
- assertTrue(
+
+ // Fix for JBIDE-12261: Since WTP 3.4 the Content Assistant is made to properly use
+ // autoinsertion property value, so this fact affected the collecting of the proposals
+ // in case of a single proposal is returned
+ if (contentAssistant instanceof ContentAssistant) {
+ ((ContentAssistant) contentAssistant).enableAutoInsert(false);
+ }
+ assertNotNull(
"Cannot get the Content Assistant instance for the editor for page \""
//$NON-NLS-1$
- + fileName + "\"", (contentAssistant != null)); //$NON-NLS-1$
+ + fileName + "\"", contentAssistant); //$NON-NLS-1$
}
@@ -195,7 +204,7 @@
replacementString = Utils.trimQuotes(replacementString);
if (replacementString.equalsIgnoreCase(proposalName)) return compareImages(image,
proposals[i]);
- } else {
+ } else {
if(proposals[i].getDisplayString().toLowerCase().equals(proposalName.toLowerCase()))
return compareImages(image, proposals[i]);
}
}
@@ -216,6 +225,9 @@
.getActivePage().closeEditor(editorPart, false);
editorPart = null;
}
+ viewer = null;
+ document = null;
+ contentAssistant = null;
}
/**
Show replies by date