JBoss Tools SVN: r10843 - trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2008-10-15 02:37:41 -0400 (Wed, 15 Oct 2008)
New Revision: 10843
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanConfigWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanModelLoadComposite.java
Log:
JBIDE-2897
change the class full path display way.
Add title/description to JavaBean wizard page
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanConfigWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanConfigWizardPage.java 2008-10-15 05:20:39 UTC (rev 10842)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanConfigWizardPage.java 2008-10-15 06:37:41 UTC (rev 10843)
@@ -54,6 +54,8 @@
super("beansearchwizardpage");
this.project = selection;
setPageComplete(true);
+ setTitle("JavaBean Class selection page");
+ setDescription("Select the JavaBean class");
}
public void activeNextWizardNode(IWizardNode node){
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanModelLoadComposite.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanModelLoadComposite.java 2008-10-15 05:20:39 UTC (rev 10842)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.javabean/src/org/jboss/tools/smooks/javabean/ui/JavaBeanModelLoadComposite.java 2008-10-15 06:37:41 UTC (rev 10843)
@@ -173,8 +173,8 @@
Class clazz = loader.loadClass(this.classText.getText());
rootJavaBean = JavaBeanModelFactory
.getJavaBeanModelWithLazyLoad(clazz);
- }catch(Exception e){
-
+ } catch (Exception e) {
+
}
}
// if (rootJavaBean != null)
@@ -203,8 +203,13 @@
Object result = results[0];
String packageFullName = JavaModelUtil
.getTypeContainerName((IType) result);
- classText.setText(packageFullName + "."
- + ((IType) result).getElementName());
+ if (packageFullName == null
+ || packageFullName.length() <= 0) {
+ classText.setText(((IType) result).getElementName());
+ } else {
+ classText.setText(packageFullName + "."
+ + ((IType) result).getElementName());
+ }
}
}
} catch (Exception e) {
@@ -213,6 +218,5 @@
}
}
-
}
16 years, 3 months
JBoss Tools SVN: r10842 - trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/editor/template.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-15 01:20:39 -0400 (Wed, 15 Oct 2008)
New Revision: 10842
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/editor/template/VpeTemplateManagerTest.java
Log:
fix vpe junit tests errors
Modified: trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/editor/template/VpeTemplateManagerTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/editor/template/VpeTemplateManagerTest.java 2008-10-15 05:17:07 UTC (rev 10841)
+++ trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/editor/template/VpeTemplateManagerTest.java 2008-10-15 05:20:39 UTC (rev 10842)
@@ -26,7 +26,7 @@
public void testGetAnyTemplates() {
List<VpeAnyData> templates = VpeTemplateManager.getInstance().getAnyTemplates();
- assertEquals(2, templates.size());
+ assertEquals(4, templates.size());
}
public void testReload() {
16 years, 3 months
JBoss Tools SVN: r10841 - in trunk: jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-15 01:17:07 -0400 (Wed, 15 Oct 2008)
New Revision: 10841
Modified:
trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java
Log:
fix junit tests errors in common.text.ext.test plug-in
Modified: trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-14 23:48:00 UTC (rev 10840)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/src/org/jboss/tools/common/text/ext/test/OpenOnsTest.java 2008-10-15 05:17:07 UTC (rev 10841)
@@ -16,8 +16,10 @@
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.DocumentProviderRegistry;
@@ -45,6 +47,7 @@
OPENON_TEST_PROJECT);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
JobUtils.waitForIdle();
+ IWorkbench workbench = PlatformUI.getWorkbench();
}
protected void tearDown() {
@@ -314,7 +317,9 @@
ISourceViewer viewer = jspMultyPageEditor.getSourceEditor().getTextViewer();
IRegion reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
- "org.jboss.tools.test.TestBean1", true, true, false, false);
+ "b1", true, true, false, false);
+ reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(reg.getOffset()+reg.getLength(),
+ "b1", true, true, false, false);
IHyperlink[] links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
assertNotNull(links);
assertTrue(links.length!=0);
@@ -323,12 +328,11 @@
links[0].open();
JobUtils.waitForIdle();
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ ITextSelection selection = (ITextSelection)viewer.getSelectionProvider().getSelection();
+ assertEquals("<jsp:useBean id=\"b1\" class=\"org.jboss.tools.test.TestBean1\">", selection.getText());
- String fileName = editor.getEditorInput().getName();
- assertTrue("TestBean1.java".equals(fileName));
-
- reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(reg.getOffset(),
- "b1", true, true, false, false);
+ reg = new FindReplaceDocumentAdapter(jspMultyPageEditor.getSourceEditor().getTextViewer().getDocument()).find(0,
+ "org.jboss.tools.test.TestBean1", true, true, false, false);
links = HyperlinkDetector.getInstance().detectHyperlinks(viewer, reg, false);
assertNotNull(links);
assertTrue(links.length!=0);
@@ -337,8 +341,8 @@
links[0].open();
JobUtils.waitForIdle();
editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- ITextSelection selection = (ITextSelection)viewer.getSelectionProvider().getSelection();
- assertEquals("<jsp:useBean id=\"b1\" class=\"org.jboss.tools.test.TestBean1\">", selection.getText());
+ String fileName = editor.getEditorInput().getName();
+ assertTrue("TestBean1.java".equals(fileName));
}
public static final String FORWARD_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/forwardHiperlinkTests.jsp";
@@ -379,7 +383,7 @@
assertTrue("forwardHiperlinkPage1Tests.jsp".equals(fileName));
}
- public static final String INCLUDE_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/includeHiperlinkTests.page.jsp";
+ public static final String INCLUDE_TEST_FILE = OPENON_TEST_PROJECT + "/WebContent/includeHiperlinkTests.jsp";
public void testJspIncludeOpenOn() throws CoreException, BadLocationException {
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java 2008-10-14 23:48:00 UTC (rev 10840)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java 2008-10-15 05:17:07 UTC (rev 10841)
@@ -79,7 +79,7 @@
}
- assertTrue("Content Assistant peturned no proposals", (result != null && result.length > 0));
+ assertTrue("Content Assistant returned no proposals", (result != null && result.length > 0));
boolean bPropoosalToApplyFound = false;
for (int i = 0; i < result.length; i++) {
16 years, 3 months
JBoss Tools SVN: r10840 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-14 19:48:00 -0400 (Tue, 14 Oct 2008)
New Revision: 10840
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamPerspectiveFactory.java
Log:
placeholder added for WTP Server View
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamPerspectiveFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamPerspectiveFactory.java 2008-10-14 19:27:44 UTC (rev 10839)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamPerspectiveFactory.java 2008-10-14 23:48:00 UTC (rev 10840)
@@ -34,7 +34,7 @@
bottom.addView(IPageLayout.ID_TASK_LIST);
bottom.addView(SEAM_COMPONENTS_NAVIGATOR);
bottom.addView(JBOSS_SERVERS_VIEW);
- //bottom.addView(WTP_SERVERS_VIEW); // We don't need this anymore since our server view now has synchro info.
+ bottom.addPlaceholder(WTP_SERVERS_VIEW);
IFolderLayout rightTop = layout.createFolder("right", IPageLayout.RIGHT, (float)0.8, editorArea); //$NON-NLS-1$
rightTop.addView("org.jboss.tools.common.model.ui.views.palette.PaletteView"); //$NON-NLS-1$
16 years, 3 months
JBoss Tools SVN: r10839 - trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-14 15:27:44 -0400 (Tue, 14 Oct 2008)
New Revision: 10839
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta
Log:
fix JUnit Test errors in common.model.test plugin
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta 2008-10-14 19:14:10 UTC (rev 10838)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/resources/meta/vpe.meta 2008-10-14 19:27:44 UTC (rev 10839)
@@ -572,7 +572,7 @@
</XActionItem>
<XActionItem kind="list" name="EditActions">
<XActionItem HandlerClassName="%SpecialWizard%" ICON="action.empty"
- PROPERTIES="support=org.jboss.tools.vpe.resref.VpeTaglibReferenceSupport"
+ PROPERTIES="support=org.jboss.tools.vpe.resref.core.VpeTaglibReferenceSupport"
displayName="Edit TLD Reference..." kind="action" name="EditItem">
<EntityData EntityName="VPETLDReferenceExt">
<AttributeData AttributeName="location"/>
16 years, 3 months
JBoss Tools SVN: r10838 - in trunk: common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test and 18 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-10-14 15:14:10 -0400 (Tue, 14 Oct 2008)
New Revision: 10838
Removed:
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java
trunk/common/tests/org.jboss.tools.common.test/META-INF/MANIFEST.MF
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/util/TestProjectProvider.java
trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.project
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/converter/OpenTagLib.java
trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/ELExprPartitionerTest.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide2437Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1759Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamEARTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamProjectPropertyValidatorTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamPropertyRefactoringTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1645Test.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/preferences/SeamSettingsPreferencesPageTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTestSetup.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/OpenSeamComponentDialogTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java
trunk/struts/tests/org.jboss.tools.struts.text.ext.test/src/org/jboss/tools/struts/text/tests/hyperlink/StrutsJbide1762Test.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java
trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
Log:
fix test project import/deletion
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -24,9 +24,6 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.rules.IToken;
@@ -37,7 +34,6 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
-import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.CSSTextScanner;
import org.jboss.tools.common.text.ext.util.RegionHolder;
@@ -282,10 +278,10 @@
for (int i = 0; list != null && i < list.getLength(); i++) {
IDOMNode element = (IDOMNode)list.item(i);
- String axis = JSPRootHyperlinkPartitioner.computeAxis(getDocument(), element.getStartOffset());
- axis = axis.toLowerCase();
+ //String axis = JSPRootHyperlinkPartitioner.computeAxis(getDocument(), element.getStartOffset());
+ //axis = axis.toLowerCase();
- if (axis.endsWith("/link")) {
+ if ("link".equals(element.getNodeName())) {
Node relAttr = element.getAttributes().getNamedItem("rel");
if (relAttr != null) {
String val = relAttr.getNodeValue().toLowerCase();
@@ -298,7 +294,7 @@
}
}
- if (axis.endsWith("/style")) {
+ if ("link".equals(element.getNodeName())) {
// String value = element.getNodeValue();
styleLinks.add(element);
}
Modified: trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -5,6 +5,8 @@
import java.net.URL;
import java.util.List;
+import junit.framework.TestCase;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -18,11 +20,9 @@
import org.eclipse.jdt.core.JavaCore;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.test.util.TestProjectProvider;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
import org.osgi.framework.Bundle;
-import junit.framework.TestCase;
-
/**
* Automatic test for JBIDE-1811.
* Checks that EclipseResourceUtil.getClassPath(IProject)
@@ -53,7 +53,7 @@
project1.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
project2.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
IJavaProject jp = JavaCore.create(project2);
IClasspathEntry[] es = jp.getRawClasspath();
@@ -70,7 +70,7 @@
jp.setRawClasspath(esn, new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
public void testGetClassPath() throws CoreException, IOException {
Modified: trunk/common/tests/org.jboss.tools.common.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/META-INF/MANIFEST.MF 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/common/tests/org.jboss.tools.common.test/META-INF/MANIFEST.MF 2008-10-14 19:14:10 UTC (rev 10838)
@@ -8,7 +8,8 @@
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.junit,
- org.jboss.tools.common
+ org.jboss.tools.common,
+ org.jboss.tools.tests;bundle-version="2.0.0"
Provide-Package: org.jboss.tools.common.test.util
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.common.reporting.test,
Modified: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/util/TestProjectProvider.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/util/TestProjectProvider.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/util/TestProjectProvider.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -10,30 +10,25 @@
******************************************************************************/
package org.jboss.tools.common.test.util;
-import java.io.File;
import java.io.IOException;
-import java.net.URL;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.jboss.tools.common.test.CommonAllTests;
import org.jboss.tools.common.util.FileUtil;
-import org.osgi.framework.Bundle;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
/**
* Test plugins may define test projects to be added
@@ -59,80 +54,36 @@
* @throws Exception
*/
public TestProjectProvider(String bundleName, String projectPath, String name, boolean makeCopy) throws CoreException {
- if(projectPath == null) {
- projectPath = "/projects/" + name;
- } else if(name == null) {
- name = projectPath.substring(projectPath.lastIndexOf('/')+1);
+ try {
+ if( null == projectPath ) {
+ project = ResourcesUtils.importProject(bundleName, "projects" + Path.SEPARATOR + name, null);
+ } else {
+ project = ResourcesUtils.importProject(bundleName, projectPath, null);
+ }
+ } catch (IOException e) {
+ throw new CoreException(new Status(Status.ERROR,bundleName,e.getMessage(),e));
+ } catch (InvocationTargetException e) {
+ throw new CoreException(new Status(Status.ERROR,bundleName,e.getMessage(),e));
+ } catch (InterruptedException e) {
+ throw new CoreException(new Status(Status.ERROR,bundleName,e.getMessage(),e));
}
- this.makeCopy = makeCopy;
- init(bundleName, projectPath, name);
}
public IProject getProject() {
return project;
}
- private void init(String bundleName, String projectPath, String name) throws CoreException {
- IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- if(p.exists()) {
- project = p;
- if(!p.isOpen()) {
- project.open(new NullProgressMonitor());
- System.out.println("open");
- }
- return;
- }
-
- Bundle bundle = Platform.getBundle(bundleName);
- URL url = null;
- try {
- url = FileLocator.resolve(bundle.getEntry(projectPath));
- } catch (IOException e) {
- String msg = "Cannot find project " + name + " in " + bundleName;
- IStatus status = new Status(IStatus.ERROR, CommonAllTests.PLUGIN_ID, msg, e);
- throw new CoreException(status);
- }
- String location = url.getFile();
- if(makeCopy) {
- IPath root = ResourcesPlugin.getWorkspace().getRoot().getLocation();
- File destination = new File(root.toFile(), name);
- FileUtil.copyDir(new File(location), destination, true);
- importExistingProject(p, destination.getAbsolutePath(), name);
- ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- } else {
- importExistingProject(p, location, name);
- }
- if(p.exists()) {
- project = p;
- }
- }
-
- static void importExistingProject(IProject project, String location, String name) throws CoreException {
- IPath path = new Path(location).append(".project");
- IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription(path);
- description.setName(name);
- try {
- project.create(description, new NullProgressMonitor());
- project.open(IResource.BACKGROUND_REFRESH, new NullProgressMonitor());
- ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- } catch (Exception e) {
- throw new RuntimeException("Cannot create project " + name + " from " + location, e);
- }
- }
-
public void dispose() throws CoreException {
if(project == null || !project.exists()) return;
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IPath loc = project.getLocation();
- project.close(new NullProgressMonitor());
- project.delete(false, true, new NullProgressMonitor());
- if(makeCopy) {
- FileUtil.remove(loc.toFile());
- }
- ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- }
- }, new NullProgressMonitor());
+ boolean oldAutoBuilding = true;
+ try {
+ oldAutoBuilding = ResourcesUtils.setBuildAutomatically(false);
+ JobUtils.waitForIdle();
+ project.delete(true, null);
+ JobUtils.waitForIdle();
+ } finally {
+ ResourcesUtils.setBuildAutomatically(oldAutoBuilding);
+ }
}
TestDescriptionFactory tests = null;
Modified: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.project
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.project 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/.project 2008-10-14 19:14:10 UTC (rev 10838)
@@ -15,11 +15,6 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.jboss.tools.common.verification.verifybuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
Deleted: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/forwardHiperlinkTests.page.jsp 2008-10-14 19:14:10 UTC (rev 10838)
@@ -1,2 +0,0 @@
-<jsp:forward page="forward/forwardHiperlinkPage2Tests.jsp"></jsp:forward>
-<jsp:forward page="forwardHiperlinkPage1Tests.jsp"></jsp:forward>
\ No newline at end of file
Deleted: trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp
===================================================================
--- trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/common/tests/org.jboss.tools.common.text.ext.test/projects/HiperlinksTestProject/WebContent/includeHiperlinkTests.page.jsp 2008-10-14 19:14:10 UTC (rev 10838)
@@ -1,2 +0,0 @@
-<jsp:forward page="include/includeHiperlinkPage2Tests.jsp"></jsp:forward>
-<jsp:forward page="includeHiperlinkPage1Tests.jsp"></jsp:forward>
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/converter/OpenTagLib.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/converter/OpenTagLib.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/converter/OpenTagLib.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -25,18 +25,19 @@
if(uri.length() == 0) return JSFUIMessages.URI_ISNOT_SPECIFIED;
XModelObject t = findTagLib(model, uri);
if(t == null) return NLS.bind(JSFUIMessages.CANNOT_FIND_TAG_LIBRARY, uri);
+ FindObjectHelper.findModelObject(t, FindObjectHelper.IN_EDITOR_ONLY);
if(tag != null) {
if(tag.length() == 0) return JSFUIMessages.TAG_ISNOT_SPECIFIED;
t = findTag(t, tag);
if(t == null) return NLS.bind(JSFUIMessages.CANNOT_FIND_TAG_IN_LIBRARY, tag, uri);
+ FindObjectHelper.findModelObject(t, FindObjectHelper.IN_EDITOR_ONLY);
}
- FindObjectHelper.findModelObject(t, FindObjectHelper.IN_EDITOR_ONLY);
if(attribute != null) {
if(attribute.length() == 0) return JSFUIMessages.ATTRIBUTE_ISNOT_SPECIFIED;
t = findAttribute(t, attribute);
if(t == null) return NLS.bind(JSFUIMessages.CANNOT_FIND_ATTRIBUTE_IN_TAG, attribute, tag);
+ FindObjectHelper.findModelObject(t, FindObjectHelper.IN_EDITOR_ONLY);
}
- FindObjectHelper.findModelObject(t, FindObjectHelper.IN_EDITOR_ONLY);
return null;
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/ELExprPartitionerTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/ELExprPartitionerTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jsf/tests/org.jboss.tools.jsf.text.ext.test/src/org/jboss/tools/jsf/text/ext/test/ELExprPartitionerTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -33,13 +33,11 @@
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.ui.internal.editor.EditorModelUtil;
-import org.jboss.tools.common.model.XJob;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.AxisUtil;
import org.jboss.tools.jsf.text.ext.hyperlink.JSPExprHyperlinkPartitioner;
-import org.jboss.tools.test.util.JUnitUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class ELExprPartitionerTest extends TestCase {
TestProjectProvider provider = null;
@@ -72,8 +70,9 @@
}
public void testELExprPartitioner() {
- try { EditorTestHelper.joinBackgroundActivities(); }
- catch (Exception e) {
+ try {
+ JobUtils.waitForIdle();
+ } catch (Exception e) {
assertNull("An exception caught: " + e.getMessage(), e);
}
assertTrue("Test project \"" + PROJECT_NAME + "\" is not loaded", (project != null));
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/ContentAssistantTestCase.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -18,7 +18,7 @@
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class ContentAssistantTestCase extends TestCase {
protected IProject project = null;
@@ -31,7 +31,7 @@
protected void openEditor(String fileName) {
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
@@ -61,7 +61,7 @@
// Delay for 3 seconds so that
// the Favorites view can be seen.
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();;
} catch (Exception e) {
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -6,7 +6,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
@@ -15,7 +14,7 @@
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class JsfJspJbide1704Test extends ContentAssistantTestCase {
TestProjectProvider provider = null;
@@ -52,7 +51,7 @@
public void testJsfJspJbide1704 () {
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
}
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -8,11 +8,10 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class JsfJspJbide1717Test extends ContentAssistantTestCase {
@@ -90,7 +89,7 @@
assertFalse("Content Assistant returned no proposals of type CustomCompletionProposal.",customCompletionProposals.isEmpty());
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide2437Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide2437Test.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide2437Test.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -14,7 +14,7 @@
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class JsfJspJbide2437Test extends ContentAssistantTestCase {
TestProjectProvider provider = null;
@@ -51,7 +51,7 @@
public void testJsfJspJbide2437 () {
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
}
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -6,11 +6,10 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.ui.PlatformUI;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class JstJspJbide1641Test extends ContentAssistantTestCase {
TestProjectProvider provider = null;
@@ -98,7 +97,7 @@
assertTrue("The proposal to apply not found.", bPropoosalToApplyFound);
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1759Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1759Test.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1759Test.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -9,11 +9,10 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class JstJspJbide1759Test extends ContentAssistantTestCase {
TestProjectProvider provider = null;
@@ -51,7 +50,7 @@
public void testJstJspJbide1641() {
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
}
@@ -107,7 +106,7 @@
assertFalse("Content Assistant returned no proposals of type CustomCompletionProposal.",customCompletionProposals.isEmpty());
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -6,10 +6,9 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.ui.PlatformUI;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class StrutsJspJbide1648Test extends ContentAssistantTestCase {
TestProjectProvider provider = null;
@@ -45,7 +44,7 @@
public void testStrutsJspJbide1648() {
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
}
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebContentAssistProviderTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -47,7 +47,6 @@
}
public void testJsfBeanPropertyList() {
- waitForJobs();
// seam beans list
List beanList = webPromptingProvider.getList(projectModel, WebPromptingProvider.JSF_BEAN_PROPERTIES, "facesManagedBean", new Properties());
assertTrue("Bean property list does not contain Managed bean property in XModel.", beanList.contains("property1"));
@@ -61,17 +60,8 @@
List bundlePropertyList = webPromptingProvider.getList(projectModel, WebPromptingProvider.JSF_BUNDLE_PROPERTIES, "org.jboss.seam.example.numberguess.test", null);
assertTrue("Bundle property list does not contain expected property in XModel.", bundlePropertyList.contains("bundleProperty1"));
}
-
- void waitForJobs() {
- try {
- XJob.waitForJob();
- } catch (InterruptedException e) {
- fail("Interrupted");
- }
- }
public void testTlds() {
- waitForJobs();
List tldList = webPromptingProvider.getList(projectModel, WebPromptingProvider.JSF_GET_TAGLIBS, "", null);
assertTrue("TLD list does not contain expected TLD in XModel.", tldList.contains("http://jboss.com/products/seam/taglib"));
}
@@ -81,7 +71,6 @@
project = provider.getProject();
project.refreshLocal(IResource.DEPTH_INFINITE, null);
project.build(IncrementalProjectBuilder.FULL_BUILD,null);
- waitForJobs();
XModelObject xmo = EclipseResourceUtil.getObjectByResource(project);
assertNotNull("Can't get XModel Object for test project.", xmo);
projectModel = xmo.getModel();
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -21,8 +21,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.jboss.tools.common.model.XJob;
-import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.seam.core.BeanType;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
@@ -52,7 +50,6 @@
import org.jboss.tools.seam.internal.core.scanner.lib.LibraryScanner;
import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.ResourcesUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
public class ScannerTest extends TestCase {
IProject project = null;
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamBigProjectTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -16,6 +16,8 @@
import java.util.List;
import java.util.Set;
+import junit.framework.TestCase;
+
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
@@ -28,11 +30,9 @@
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.test.util.JUnitUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
import org.osgi.framework.Bundle;
-import junit.framework.TestCase;
-
/**
* Test checks that loading Seam model does not depend as N*N on the number of components N.
* It works as follows:
@@ -58,7 +58,7 @@
File template = getTemplateFile();
SeamBigProjectGenerator g = new SeamBigProjectGenerator();
g.generate(folder, template);
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
//To ensure that the project is built.
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new NullProgressMonitor());
}
@@ -121,7 +121,7 @@
ISeamProject sp = getSeamProject();
SeamProject impl = (SeamProject)sp;
if(impl != null) impl.clearStorage();
- EditorTestHelper.joinJobs(1000, 10000, 500);
+ JobUtils.waitForIdle();
provider.dispose();
}
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamEARTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamEARTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamEARTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.seam.core.test;
-import java.lang.reflect.InvocationTargetException;
-
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
@@ -19,17 +17,11 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.refactoring.RenameSupport;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.test.util.JUnitUtils;
-import org.jboss.tools.test.util.WorkbenchUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
/**
* @author V.Kabanovich
@@ -58,14 +50,13 @@
projectWAR.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
projectEJB.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
private ISeamProject getSeamProject(IProject project) throws CoreException {
project.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
-
+ JobUtils.waitForIdle();
ISeamProject seamProject = null;
/*
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamProjectPropertyValidatorTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamProjectPropertyValidatorTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamProjectPropertyValidatorTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -15,8 +15,8 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
/**
@@ -59,8 +59,8 @@
pref.put(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE, "invalidConnectionName");
pref.flush();
- EditorTestHelper.joinBackgroundActivities();
- EditorTestHelper.runEventQueue(2000);
+ JobUtils.waitForIdle();
+ JobUtils.delay(2000);
}
}
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -16,7 +16,6 @@
import org.eclipse.core.resources.IFile;
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.NullProgressMonitor;
@@ -31,8 +30,9 @@
import org.jboss.tools.seam.internal.core.SeamProject;
import org.jboss.tools.seam.internal.core.validation.ISeamValidator;
import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
public class SeamValidatorsTest extends AbstractResourceMarkerTest {
@@ -57,18 +57,20 @@
project = setup.importProject();
}
this.project = project.getProject();
- this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
public void tearDown() throws Exception {
- if(project != null){
-// project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
- project.close(new NullProgressMonitor());
- project.delete(true, new NullProgressMonitor());
- project = null;
- EditorTestHelper.joinBackgroundActivities();
+ boolean autoBuild = ResourcesUtils.setBuildAutomatically(false);
+ try {
+ if(project != null){
+ JobUtils.waitForIdle();
+ project.delete(true, new NullProgressMonitor());
+ project = null;
+ JobUtils.waitForIdle();
+ }
+ } finally {
+ ResourcesUtils.setBuildAutomatically(autoBuild);
}
}
@@ -123,13 +125,6 @@
public void testJiraJbide1631() throws CoreException {
// Test for http://jira.jboss.com/jira/browse/JBIDE-1631
IFile jbide1631XHTMLFile = project.getFile("WebContent/JBIDE-1631.xhtml");
- IFile jbide1631XHTMLFileWithFoo = project.getFile("WebContent/JBIDE-1631.1");
- try{
- jbide1631XHTMLFile.setContents(jbide1631XHTMLFileWithFoo.getContents(), true, false, new NullProgressMonitor());
- }catch(Exception ex){
- JUnitUtils.fail("Error in changing 'JBIDE-1631.xhtml' content to " +
- "'JBIDE-1631.1'", ex);
- }
refreshProject(project);
assertMarkerIsCreated(jbide1631XHTMLFile, null, "\"foo1\" cannot be resolved", 16 );
assertMarkerIsCreated(jbide1631XHTMLFile, null, "\"foo2\" cannot be resolved", 16 );
@@ -848,10 +843,8 @@
}
private void refreshProject(IProject project){
- waitForJob();
+ JobUtils.delay(1000);
+ JobUtils.waitForIdle();
+ JobUtils.delay(500);
}
-
- public static void waitForJob() {
- EditorTestHelper.joinJobs(1000,10000,500);
- }
}
\ No newline at end of file
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SerializationTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -4,6 +4,8 @@
import java.util.Properties;
import java.util.Set;
+import junit.framework.TestCase;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -21,12 +23,10 @@
import org.jboss.tools.seam.internal.core.SeamXmlComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamXmlFactory;
import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
import org.w3c.dom.Element;
-import junit.framework.TestCase;
-
public class SerializationTest extends TestCase {
IProject project = null;
boolean makeCopy = true;
@@ -39,7 +39,7 @@
project = ResourcesUtils.importProject(
"org.jboss.tools.seam.core.test","/projects/TestScanner" , new NullProgressMonitor());
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
protected void tearDown() throws Exception {
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamPropertyRefactoringTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamPropertyRefactoringTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamPropertyRefactoringTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -52,9 +52,9 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
import org.jboss.tools.test.util.WorkbenchUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
/**
* @author Alexey Kazakov
@@ -110,7 +110,7 @@
private ISeamProject loadSeamProject(IProject project) throws CoreException {
ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
assertNotNull("Seam project for " + project.getName() + " is null", seamProject);
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
return seamProject;
}
@@ -296,7 +296,7 @@
JUnitUtils.fail("Exception during perform folder renaming: " + folderPath, e);
}
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
IPath path = new Path(folderPath);
String newFolderPath = path.removeLastSegments(1).append(newFolderName).toString();
@@ -370,7 +370,7 @@
} catch (InvocationTargetException e) {
JUnitUtils.fail("Rename failed", e);
}
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
private IFolder moveFolder(String folderPath, String destinationFolderPath) throws CoreException {
@@ -423,7 +423,7 @@
JUnitUtils.fail("Exception during perform folder moving: " + folderPath, e);
}
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
String newFolderPath = destination.getFullPath().append(resource.getName()).toString();
resource = ResourcesPlugin.getWorkspace().getRoot().findMember(newFolderPath);
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1645Test.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1645Test.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1645Test.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -6,12 +6,11 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.ui.PlatformUI;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.test.TestUtil;
import org.jboss.tools.jst.jsp.test.ca.ContentAssistantTestCase;
import org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class SeamELContentAssistJbide1645Test extends ContentAssistantTestCase {
TestProjectProvider provider = null;
@@ -83,7 +82,7 @@
}
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistJbide1676Test.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -26,7 +26,7 @@
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.test.TestUtil;
import org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class SeamELContentAssistJbide1676Test extends TestCase {
TestProjectProvider provider = null;
@@ -224,7 +224,7 @@
public void testSeamELContentAssistJbide1676() {
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
}
@@ -256,7 +256,7 @@
// Delay for 3 seconds so that
// the Favorites view can be seen.
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/ca/SeamELContentAssistTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -18,7 +18,6 @@
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
@@ -29,10 +28,8 @@
import org.jboss.tools.jst.jsp.test.ca.ContentAssistantTestCase;
import org.jboss.tools.seam.ui.text.java.SeamELProposalProcessor;
import org.jboss.tools.test.util.JUnitUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
-import sun.management.counter.Units;
-
public class SeamELContentAssistTest extends ContentAssistantTestCase {
TestProjectProvider provider = null;
boolean makeCopy = false;
@@ -78,7 +75,7 @@
}catch(Exception e){
JUnitUtils.fail("Error during changing 'TestComponentForVarAttributes.java' content to 'TestComponentForVarAttributes.1'", e);
}
- EditorTestHelper.joinJobs(1000,10000,500);
+ JobUtils.waitForIdle();
checkProposals("/WebContent/varAttributes.xhtml", 458, new String[]{"test.name"}, false);
checkProposals("/WebContent/varAttributes.xhtml", 640, new String[]{"item.name"}, false);
@@ -88,7 +85,7 @@
}catch(Exception e){
JUnitUtils.fail("Error during changing 'TestComponentForVarAttributes.java' content to 'TestComponentForVarAttributes.2'", e);
}
- EditorTestHelper.joinJobs(1000,10000,500);
+ JobUtils.waitForIdle();
}
private static final String[] VALID_SEAM_EL_PROPOSALS = new String[] {
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -31,8 +31,8 @@
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.AxisUtil;
import org.jboss.tools.seam.text.ext.hyperlink.SeamViewHyperlinkPartitioner;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
public class SeamViewHyperlinkPartitionerTest extends TestCase {
@@ -63,7 +63,7 @@
public void testSeamViewPartitioner() throws CoreException {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
assertTrue("Test project \"" + PROJECT_NAME + "\" is not loaded", (project != null));
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/preferences/SeamSettingsPreferencesPageTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/preferences/SeamSettingsPreferencesPageTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/preferences/SeamSettingsPreferencesPageTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -33,8 +33,8 @@
import org.jboss.tools.seam.ui.preferences.SeamPreferencesMessages;
import org.jboss.tools.seam.ui.preferences.SeamSettingsPreferencePage;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.WorkbenchUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
import org.osgi.framework.Bundle;
/**
@@ -58,7 +58,7 @@
assertNotNull(PROJECT_NAME + " project is not imported.", project);
this.project = project.getProject();
this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
public void testSettingsPage() throws Exception {
@@ -99,7 +99,7 @@
dialog.close();
}
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, false);
assertNotNull("Can't load seam project. It seems seam nature was not added to rpoject by seam settings page.", seamProject);
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -36,7 +36,6 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.WorkbenchException;
import org.eclipse.ui.navigator.CommonNavigator;
-import org.jboss.tools.jst.web.ui.WebDevelopmentPerspectiveFactory;
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamPackage;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -44,8 +43,8 @@
import org.jboss.tools.seam.ui.SeamPerspectiveFactory;
import org.jboss.tools.seam.ui.views.actions.SeamViewLayoutActionGroup.SeamContributionItem;
import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.WorkbenchUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
/**
*
@@ -73,7 +72,7 @@
assertTrue("Cannot find components.xml in test project", componentsFile != null && componentsFile.exists());
this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
public void testAddComponentInXmlFile() throws CoreException{
@@ -155,7 +154,7 @@
seamPackage = findSeamPackage(tree, "myPackage");
assertTrue("Expected package 'myPackage' was not found it tree",
seamPackage!=null);
- EditorTestHelper.runEventQueue(1000);
+ JobUtils.delay(1000);
component = findSeamComponent(seamPackage, "myPackage.myTextComponent");
assertTrue("Expected component 'myPackage.myTextComponent' not found " +
"after renaming",component!=null);
@@ -175,7 +174,7 @@
navigator.getCommonViewer().expandAll();
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
seamPackage = findSeamPackage(tree, "myNewPackage");
assertTrue("Expected package 'myNewPackage' was not found it tree after " +
@@ -191,7 +190,7 @@
CommonNavigator navigator = getSeamComponentsView();
navigator.getCommonViewer().expandAll();
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
Tree tree = navigator.getCommonViewer().getTree();
ISeamPackage seamPackage = findSeamPackage(tree, "myNewPackage");
@@ -538,7 +537,7 @@
System.out.println("Refresh project "+count);
try {
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (CoreException e) {
JUnitUtils.fail("Cannot build test Project", e);
break;
@@ -547,7 +546,7 @@
count++;
if(count > NUMBER_OF_REFRESHES) break;
}
- EditorTestHelper.runEventQueue(1000);
+ JobUtils.delay(1000);
}
}
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTestSetup.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTestSetup.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTestSetup.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -17,9 +17,9 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.jst.web.ui.WebDevelopmentPerspectiveFactory;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.test.util.WorkbenchUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
/**
* @author eskimo
@@ -45,16 +45,16 @@
WorkbenchUtils.getWorkbench().showPerspective(
WebDevelopmentPerspectiveFactory.PERSPECTIVE_ID,
WorkbenchUtils.getWorkbench().getActiveWorkbenchWindow());
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
project = ResourcesUtils.importProject(Platform.getBundle("org.jboss.tools.seam.ui.test"), "/projects/TestComponentView", new NullProgressMonitor());
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
/* (non-Javadoc)
* @see junit.extensions.TestSetup#tearDown()
*/
protected void tearDown() throws Exception {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();;
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
try {
project.delete(true,true, null);
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -52,7 +52,7 @@
import org.jboss.tools.seam.ui.wizard.SeamEntityWizard.SeamEntityCreateOperation;
import org.jboss.tools.seam.ui.wizard.SeamFormWizard.SeamFormCreateOperation;
import org.jboss.tools.test.util.JUnitUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
import org.osgi.service.prefs.BackingStoreException;
abstract public class AbstractSeamNewOperationTest extends AbstractSeamFacetTest {
@@ -86,11 +86,11 @@
protected void setUp() throws Exception {
super.setUp();
try {
- EditorTestHelper.joinBackgroundActivities(); }
- catch (Exception e) {
+ JobUtils.waitForIdle();
+ } catch (Exception e) {
JUnitUtils.fail(e.getMessage(), e);
}
- EditorTestHelper.runEventQueue(3000);
+ JobUtils.delay(3000);
}
abstract protected IProject getProject();
@@ -121,7 +121,7 @@
protected ISeamProject loadSeamProject(IProject project) throws CoreException {
ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
assertNotNull("Seam project for " + project.getName() + " is null", seamProject);
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
return seamProject;
}
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/OpenSeamComponentDialogTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/OpenSeamComponentDialogTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/OpenSeamComponentDialogTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -14,17 +14,15 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceDescription;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.seam.ui.wizard.OpenSeamComponentDialog;
import org.jboss.tools.seam.ui.wizard.OpenSeamComponentDialog.SeamComponentWrapper;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
import org.jboss.tools.test.util.ResourcesUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
/**
* @author Daniel Azarov
@@ -50,19 +48,19 @@
this.project = project.getProject();
this.project.build(IncrementalProjectBuilder.FULL_BUILD, null);
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
@Override
protected void tearDown() throws Exception {
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
if(project != null){
project.close(new NullProgressMonitor());
project.delete(true, new NullProgressMonitor());
project = null;
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
} finally {
ResourcesUtils.setBuildAutomatically(saveAutoBuild);
@@ -95,7 +93,7 @@
dialog.beginTest();
if(wait){
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}catch(Exception ex){
ex.printStackTrace();
}
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -23,8 +23,9 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.ui.wizard.IParameter;
import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.WorkbenchUtils;
public class Seam12EARNewOperationTest extends AbstractSeamNewOperationTest {
@@ -59,7 +60,7 @@
createSeamEarProject(SEAM_EAR_PROJECTNAME);
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
JUnitUtils.fail(e.getMessage(), e);
}
@@ -88,7 +89,7 @@
}
protected void tearDown() throws Exception {
- EditorTestHelper.closeAllEditors();
+ WorkbenchUtils.closeAllEditors();
super.tearDown();
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -24,8 +24,9 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.ui.wizard.IParameter;
import org.jboss.tools.test.util.JUnitUtils;
+import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.WorkbenchUtils;
public class Seam12WARNewOperationTest extends AbstractSeamNewOperationTest {
private static final String SEAM_WAR_PROJECTNAME = "seam_war";
@@ -53,7 +54,7 @@
createSeamWarProject(SEAM_WAR_PROJECTNAME);
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
JUnitUtils.fail(e.getMessage(), e);
}
@@ -74,7 +75,7 @@
protected void tearDown() throws Exception {
- EditorTestHelper.closeAllEditors();
+ WorkbenchUtils.closeAllEditors();
super.tearDown();
Modified: trunk/struts/tests/org.jboss.tools.struts.text.ext.test/src/org/jboss/tools/struts/text/tests/hyperlink/StrutsJbide1762Test.java
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.text.ext.test/src/org/jboss/tools/struts/text/tests/hyperlink/StrutsJbide1762Test.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/struts/tests/org.jboss.tools.struts.text.ext.test/src/org/jboss/tools/struts/text/tests/hyperlink/StrutsJbide1762Test.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -26,7 +26,7 @@
import org.jboss.tools.common.model.ui.texteditors.XMLTextEditorComponent;
import org.jboss.tools.common.test.util.TestProjectProvider;
import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
+import org.jboss.tools.test.util.JobUtils;
public class StrutsJbide1762Test extends TestCase {
TestProjectProvider provider = null;
@@ -61,7 +61,7 @@
public void testStrutsJbide1762 () {
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
}
@@ -93,7 +93,7 @@
// Delay for 3 seconds so that
// the Favorites view can be seen.
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
@@ -141,7 +141,7 @@
}
try {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
} catch (Exception e) {
e.printStackTrace();
assertTrue("Waiting for the jobs to complete has failed.", false);
Modified: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/ProjectImportTestSetup.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -19,7 +19,6 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
/**
* @author eskimo
@@ -55,9 +54,9 @@
public IProject[] importProjects() throws Exception {
IProject[] projects = new IProject[projectPaths.length];
for (int i = 0; i < projectPaths.length; i++) {
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
projects[i] = (IProject)ResourcesUtils.importProject(bundleName, projectPaths[i]);
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
}
return projects;
}
@@ -71,7 +70,7 @@
} catch (ResourceException e) {
JUnitUtils.fail(e.getMessage(), e);
}
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
return result;
}
Modified: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/test/util/WorkbenchUtils.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -100,4 +100,8 @@
}
return part;
}
+
+ public static void closeAllEditors() {
+ getWorkbenchActivePage().closeAllEditors(false);
+ }
}
\ No newline at end of file
Modified: trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2008-10-14 18:50:05 UTC (rev 10837)
+++ trunk/ws/tests/org.jboss.tools.ws.core.test/src/org/jboss/tools/ws/core/test/command/AbstractJBossWSCommandTest.java 2008-10-14 19:14:10 UTC (rev 10838)
@@ -60,7 +60,6 @@
import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
-import org.jboss.tools.test.util.xpl.EditorTestHelper;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
public abstract class AbstractJBossWSCommandTest extends TestCase {
@@ -110,15 +109,19 @@
createServer(JBOSS_RUNTIME_42, JBOSS_SERVER_42, JBOSS_AS_42_HOME, "default");
- try { EditorTestHelper.joinBackgroundActivities(); }
- catch (Exception e) { JUnitUtils.fail(e.getMessage(), e); }
- EditorTestHelper.runEventQueue(3000);
+ try {
+ JobUtils.waitForIdle();
+ } catch (Exception e) {
+ JUnitUtils.fail(e.getMessage(), e);
+ }
+
+ JobUtils.delay(3000);
}
public IProject createProject(String prjName) throws CoreException {
provider = new TestProjectProvider(BUNDLE,"/projects/"+prjName , prjName, true);
IProject prj = provider.getProject();
- EditorTestHelper.joinBackgroundActivities();
+ JobUtils.waitForIdle();
return prj;
}
16 years, 3 months
JBoss Tools SVN: r10837 - in trunk/jsf: tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2008-10-14 14:50:05 -0400 (Tue, 14 Oct 2008)
New Revision: 10837
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplateHelper.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxCreator.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml
Log:
Minor changes (a class renamed)
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxCreator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxCreator.java 2008-10-14 17:30:12 UTC (rev 10836)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxCreator.java 2008-10-14 18:50:05 UTC (rev 10837)
@@ -1,579 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.richfaces.template;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
-import org.jboss.tools.jsf.vpe.richfaces.template.util.AttributeMap;
-import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
-import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeCreationData;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;
-
-/**
- * @author yradtsevich
- *
- */
-public class RichFacesComboBoxCreator {
- private static final WeakHashMap<Node, Object> expandedComboBoxes = new WeakHashMap<Node, Object>();
- private static final String DISABLED_ATTR_NAME = "disabled"; //$NON-NLS-1$
- private static final String BUTTON_ICON_CLASSES_DISABLED =
- "rich-combobox-font-inactive rich-combobox-button-icon-disabled rich-combobox-button-inactive"; //$NON-NLS-1$
- private static final String BUTTON_ICON_CLASSES =
- "rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive"; //$NON-NLS-1$
- private static final String SECOND_DIV = "secondDiv"; //$NON-NLS-1$
- private static final String THIRD_DIV = "thirdDiv"; //$NON-NLS-1$
- private static final String THIRD_EMPTY_DIV = "thirdEmptyDiv"; //$NON-NLS-1$
- private static final String TEXT_FIELD = "textField"; //$NON-NLS-1$
- private static final String BUTTON_ICON = "buttonIcon"; //$NON-NLS-1$
-
- /** CSS_FILE_NAME. */
- private static final String CSS_FILE_NAME = "comboBox/comboBox.css"; //$NON-NLS-1$
-
- /** The Constant DEFAULT_LIST_WIDTH. */
- private static final String DEFAULT_LIST_WIDTH = "150px"; //$NON-NLS-1$
-
- /** IMAGE_NAME_DOWN. */
- private static final String IMAGE_NAME_DOWN = "/comboBox/down.gif"; //$NON-NLS-1$
-
- /** The Constant BUTTON_BACKGROUND. */
- private static final String BUTTON_BACKGROUND = "buttonBackground"; //$NON-NLS-1$
-
- /** The Constant STYLE_EXT. */
- private static final String STYLE_EXT = "richFacesComboBox"; //$NON-NLS-1$
-
- private static final int LIST_ITEM_HEIGHT_DEFAULT_VALUE = 18;
-
- /** The style clasess. */
- private final Map<String, String> styleClasess = new HashMap<String, String>();
-
- /** The source align. */
- // Commented because of not working alignment in RichFaces implementation
- // private String sourceAlign;
-
- /** The source button style. */
- private String sourceButtonStyle;
-
- /** The source default label. */
- private String sourceDefaultLabel = null;
-
- /** The source list height. */
- private String sourceListHeight;
-
- /** The source list width. */
- private String sourceListWidth;
-
- /** The source value. */
- private String sourceValue;
-
- /** The source width. */
- private String sourceWidth;
-
- /** The source style. */
- private String sourceStyle;
-
- /** The source input style. */
- private String sourceInputStyle;
-
- /** The source input class. */
- private String sourceInputClass;
-
- /** The source list style. */
- private String sourceListStyle;
-
- /** The source list class. */
- private String sourceListClass;
-
- /** The source item class. */
- private String sourceItemClass;
-
-
- /** Source button icon **/
- private String sourceButtonIcon;
-
- private String sourceButtonIconInactive;
-
- private String sourceButtonIconDisabled;
-
- private boolean disabled;
- private boolean expanded;
-
- private final VpePageContext pageContext;
- private final Node sourceNode;
- private final nsIDOMDocument visualDocument;
- private final VpeCreationData vpeCreationData;
-
- /**
- * The Constructor.
- */
- public RichFacesComboBoxCreator(final VpePageContext pageContext, final Node sourceNode,
- final nsIDOMDocument visualDocument) {
- this.pageContext = pageContext;
- this.sourceNode = sourceNode;
- this.visualDocument = visualDocument;
- initDefaultClasses();
- vpeCreationData = create();
- }
-
- /**
- * Calculate with for div.
- *
- * @param with the with
- * @param minus the minus
- *
- * @return the string
- */
- private static String calculateWithForDiv(final String with, final int minus) {
- try {
- Integer intValue = 0;
- if (with.endsWith("px")) { //$NON-NLS-1$
- intValue = Integer.parseInt(with.substring(0, with.length() - 2));
- } else {
- intValue = Integer.parseInt(with);
- }
- return String.valueOf((intValue - minus)) + "px"; //$NON-NLS-1$
- } catch (final NumberFormatException e) {
- return with;
- }
-
- }
- public VpeCreationData getVpeCreationData() {
- return vpeCreationData;
- }
-
- /**
- * Create.
- *
- * @param visualDocument the visual document
- * @param sourceNode the source node
- * @param pageContext the page context
- *
- * @return the vpe creation data
- */
- private VpeCreationData create() {
- ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME, STYLE_EXT);
-
- final Element source = (Element) sourceNode;
-
- prepareData(source);
- final nsIDOMElement rootDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- //Fix https://jira.jboss.org/jira/browse/JBIDE-2430 issue with resizement.
- rootDiv.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_WIDTH + Constants.COLON+sourceWidth);
- final nsIDOMElement comboBoxDiv = visualDocument.createElement(HTML.TAG_DIV);
- final nsIDOMElement secondDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- // Commented because of not working alignment in RichFaces implementation
- // comboBoxDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
- // secondDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
-
-
- //comboBoxDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("secondDiv")); //$NON-NLS-1$
- secondDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(SECOND_DIV));
- String secondDivSubStyle = "; position: {0}; z-index: {1} ;"; //$NON-NLS-1$
-
- if (expanded) {
- secondDivSubStyle = MessageFormat.format(secondDivSubStyle, "relative", "2"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- secondDivSubStyle = MessageFormat.format(secondDivSubStyle, "static", "0"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- comboBoxDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceListWidth
- + Constants.SEMICOLON + secondDivSubStyle);
- secondDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceListWidth
- + Constants.SEMICOLON + secondDivSubStyle + sourceStyle);
- final nsIDOMElement thirdDiv = visualDocument.createElement(HTML.TAG_DIV);
- thirdDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(THIRD_DIV));
- thirdDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceWidth
- + "; z-index: 1;"); //$NON-NLS-1$
- final nsIDOMElement textField = visualDocument.createElement(HTML.TAG_INPUT);
- textField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
-
- textField.setAttribute(HTML.ATTR_CLASS,
- styleClasess.get(TEXT_FIELD) + Constants.WHITE_SPACE + sourceInputClass);
- textField.setAttribute("autocomplete", "off"); //$NON-NLS-1$ //$NON-NLS-2$
- textField.setAttribute(HTML.ATTR_STYLE,
- HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + calculateWithForDiv(sourceWidth, 17)
- + Constants.SEMICOLON + sourceInputStyle);
- String value = null;
- if (ComponentUtil.isNotBlank(sourceDefaultLabel)) {
- value = sourceDefaultLabel;
- } else if (ComponentUtil.isNotBlank(sourceValue) && ComponentUtil.isBlank(sourceDefaultLabel)) {
- value = sourceValue;
- }
-
- if (value != null) {
- textField.setAttribute(RichFaces.ATTR_VALUE, value);
- }
- final nsIDOMElement buttonBackground = visualDocument.createElement(HTML.TAG_INPUT);
- buttonBackground.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
-
- if (disabled) {
- styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES_DISABLED);
- } else {
- styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES);
- }
-
- buttonBackground.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_BACKGROUND));
- buttonBackground.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
- buttonBackground.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
- if (sourceButtonStyle != null) {
- buttonBackground.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
- }
-
- final nsIDOMElement buttonIcon = visualDocument.createElement(HTML.TAG_INPUT);
- buttonIcon.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
- ;
- buttonIcon.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_ICON));
- buttonIcon.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
- buttonIcon.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
- if (sourceButtonStyle != null) {
- buttonIcon.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
- }
-
- String actualSourceButton;
- if (disabled) {
- actualSourceButton = sourceButtonIconDisabled;
- } else if (expanded) {
- actualSourceButton = sourceButtonIcon;
- } else {
- actualSourceButton = sourceButtonIconInactive;
- }
-
- if (ComponentUtil.isNotBlank(actualSourceButton) && (actualSourceButton != IMAGE_NAME_DOWN)) {
- String buttonIconPath = VpeStyleUtil.addFullPathToImgSrc(actualSourceButton, pageContext, true);
- buttonIconPath = buttonIconPath.replace('\\', '/');
- final String style = "background-image: url(" + buttonIconPath + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- buttonIcon.setAttribute(HTML.ATTR_STYLE, buttonIcon.getAttribute(HTML.ATTR_STYLE) + style);
- }
- final nsIDOMElement forthEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
- forthEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("forthEmptyDiv")); //$NON-NLS-1$
- forthEmptyDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
- + calculateWithForDiv(sourceWidth, 10));
- forthEmptyDiv.appendChild(visualDocument.createTextNode("Struts")); //$NON-NLS-1$
-
- rootDiv.appendChild(comboBoxDiv);
- comboBoxDiv.appendChild(secondDiv);
-
- secondDiv.appendChild(thirdDiv);
- if (expanded) {
- comboBoxDiv.appendChild(createToogleDiv());
- }
- thirdDiv.appendChild(textField);
- thirdDiv.appendChild(buttonBackground);
- thirdDiv.appendChild(buttonIcon);
- thirdDiv.appendChild(forthEmptyDiv);
-
- final VpeCreationData creationData = new VpeCreationData(rootDiv);
-
- return creationData;
- }
-
- /**
- * Creates the toogle div.
- *
- * @param visualDocument the visual document
- * @param pageContext the page context
- * @param source the source
- *
- * @return the ns IDOM node
- */
- private nsIDOMNode createToogleDiv() {
-
- final nsIDOMElement thirdEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE, sourceListStyle + Constants.SEMICOLON
- + " z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
- thirdEmptyDiv.setAttribute(HTML.ATTR_CLASS,
- styleClasess.get(THIRD_EMPTY_DIV) + " " + sourceListClass); //$NON-NLS-1$
- thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE,
- "z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
-
- final nsIDOMElement shadovDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- final nsIDOMElement positionDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- positionDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-position"); //$NON-NLS-1$
-
- final nsIDOMElement decorationDiv = visualDocument.createElement(HTML.TAG_DIV);
-
- decorationDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-decoration"); //$NON-NLS-1$
- // decorationDiv.setAttribute(HTML.ATTR_STYLE,
- // "height: 54px; width: 208px;");
-
- final nsIDOMElement scrollDiv = visualDocument.createElement(HTML.TAG_DIV);
- scrollDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-scroll"); //$NON-NLS-1$
- final List<Element> items = ComponentUtil.getSelectItems(sourceNode.getChildNodes());
- int defaultHeight = LIST_ITEM_HEIGHT_DEFAULT_VALUE;
-
- if((items!=null) && (items.size() > 1)){
- defaultHeight = ((items.size() - 1)* LIST_ITEM_HEIGHT_DEFAULT_VALUE);
- }
-
- final String listHeight = ComponentUtil.isNotBlank(sourceListHeight)
- ? sourceListHeight
- : String.valueOf(defaultHeight) + "px"; //$NON-NLS-1$
- scrollDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_MAX_HEIGHT
- + Constants.COLON + listHeight + Constants.SEMICOLON
- + HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
- + calculateWithForDiv(sourceListWidth, 2));
-
- final List<Element> selectItems = ComponentUtil.getSelectItems(sourceNode.getChildNodes());
-
- if (selectItems.size() > 0) {
- for (final Element e : selectItems) {
- scrollDiv.appendChild(createSelectItem(e));
- }
- }
-
- shadovDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow"); //$NON-NLS-1$
-
- final nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
- table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
- table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
- String width = Constants.EMPTY;
- try {
-
- int w = ComponentUtil.parseWidthHeightValue(sourceListWidth);
- w += 7;
- width = String.valueOf(w);
- } catch (final ParseException e) {
- width = "217"; //$NON-NLS-1$
- }
- table.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH
- + Constants.COLON + width + Constants.PIXEL
- + Constants.SEMICOLON + HTML.STYLE_PARAMETER_HEIGHT
- + Constants.COLON + "63px;"); //$NON-NLS-1$
-
- final nsIDOMElement tr1 = visualDocument.createElement(HTML.TAG_TR);
- final nsIDOMElement tr2 = visualDocument.createElement(HTML.TAG_TR);
-
- final nsIDOMElement tr1_td1 = visualDocument.createElement(HTML.TAG_TD);
- final nsIDOMElement tr1_td2 = visualDocument.createElement(HTML.TAG_TD);
-
- final nsIDOMElement tr2_td1 = visualDocument.createElement(HTML.TAG_TD);
- final nsIDOMElement tr2_td2 = visualDocument.createElement(HTML.TAG_TD);
-
- final nsIDOMElement tr1_td1_img = visualDocument.createElement(HTML.TAG_IMG);
- final nsIDOMElement tr1_td2_img = visualDocument.createElement(HTML.TAG_IMG);
-
- final nsIDOMElement tr2_td1_img = visualDocument.createElement(HTML.TAG_IMG);
- final nsIDOMElement tr2_td2_img = visualDocument.createElement(HTML.TAG_IMG);
-
- tr1_td1.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-tl"); //$NON-NLS-1$
- tr1_td2.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-tr"); //$NON-NLS-1$
-
- tr2_td1.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-bl"); //$NON-NLS-1$
- tr2_td2.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-br"); //$NON-NLS-1$
-
- setUpImg(tr1_td1_img, 10, 1, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
- setUpImg(tr1_td2_img, 1, 10, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
- setUpImg(tr2_td1_img, 1, 10, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
- setUpImg(tr2_td2_img, 10, 1, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
-
- thirdEmptyDiv.appendChild(shadovDiv);
- shadovDiv.appendChild(table);
- thirdEmptyDiv.appendChild(positionDiv);
- positionDiv.appendChild(decorationDiv);
- decorationDiv.appendChild(scrollDiv);
-
- table.appendChild(tr1);
- table.appendChild(tr2);
- tr1.appendChild(tr1_td1);
- tr1.appendChild(tr1_td2);
-
- tr2.appendChild(tr2_td1);
- tr2.appendChild(tr2_td2);
-
- tr1_td1.appendChild(tr1_td1_img);
- tr1_td1.appendChild(visualDocument.createElement(HTML.TAG_BR));
-
- tr1_td2.appendChild(tr1_td2_img);
- tr1_td2.appendChild(visualDocument.createElement(HTML.TAG_BR));
-
- tr2_td1.appendChild(tr2_td1_img);
- tr2_td1.appendChild(visualDocument.createElement(HTML.TAG_BR));
-
- tr2_td2.appendChild(tr2_td2_img);
- tr2_td2.appendChild(visualDocument.createElement(HTML.TAG_BR));
-
- return thirdEmptyDiv;
- }
-
- /**
- * Creates the select item.
- *
- * @param visualDocument the visual document
- * @param e the e
- *
- * @return the ns IDOM node
- */
- private nsIDOMNode createSelectItem(final Element e) {
- final nsIDOMElement item = visualDocument.createElement(HTML.TAG_SPAN);
-
- item.setAttribute(HTML.ATTR_CLASS, "rich-combobox-item " + sourceItemClass); //$NON-NLS-1$
- item.appendChild(visualDocument.createTextNode(ComponentUtil.getSelectItemValue(e)));
- return item;
- }
-
- /**
- * Inits the default classes.
- */
- private void initDefaultClasses() {
- styleClasess.put(SECOND_DIV, "rich-combobox-font rich-combobox"); //$NON-NLS-1$
- styleClasess.put(THIRD_DIV, "rich-combobox-font rich-combobox-shell"); //$NON-NLS-1$
- styleClasess.put(THIRD_EMPTY_DIV, "rich-combobox-list-cord"); //$NON-NLS-1$
- styleClasess.put(TEXT_FIELD, "rich-combobox-font-disabled rich-combobox-input-inactive"); //$NON-NLS-1$
- styleClasess.put(BUTTON_BACKGROUND,
- "rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"); //$NON-NLS-1$
- styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES);
- styleClasess.put("forthEmptyDiv", "rich-combobox-strut rich-combobox-font"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Prepare data.
- *
- * @param source the source
- */
- private void prepareData(final Element source) {
- final AttributeMap attributeMap = new AttributeMap(source);
-
- // Commented because of not working alignment in RichFaces implementation
- // if (attributeMap.isBlank(RichFaces.ATTR_ALIGN)) {
- // this.sourceAlign = DEFAULT_ALIGN;
- // } else {
- // this.sourceAlign = attributeMap.getString(RichFaces.ATTR_ALIGN);
- // }
-
- if (attributeMap.isBlank(RichFaces.ATTR_LIST_WIDTH)) {
- sourceListWidth = DEFAULT_LIST_WIDTH;
- } else {
- sourceListWidth = attributeMap.getString(RichFaces.ATTR_LIST_WIDTH);
- }
-
- sourceListHeight = attributeMap.getString(RichFaces.ATTR_LIST_HEIGHT);
-
- if (attributeMap.isBlank(RichFaces.ATTR_WIDTH)) {
- sourceWidth = DEFAULT_LIST_WIDTH;
- } else {
- sourceWidth = attributeMap.getString(RichFaces.ATTR_WIDTH);
-
- if(sourceListWidth == DEFAULT_LIST_WIDTH) {
- sourceListWidth = sourceWidth;
- }
- }
-
- if (ComponentUtil.isNotBlank(sourceWidth) && (sourceWidth != DEFAULT_LIST_WIDTH)) {
- if(!sourceWidth.endsWith(Constants.PIXEL)){
- try {
- final int intValue = Integer.parseInt(sourceWidth);
- sourceWidth = String.valueOf(intValue)+Constants.PIXEL;
- } catch (final NumberFormatException e) {
- sourceListWidth = DEFAULT_LIST_WIDTH;
- }
- }
- }
-
- sourceDefaultLabel = attributeMap.getString("defaultLabel"); //$NON-NLS-1$
- sourceValue = attributeMap.getString( RichFaces.ATTR_VALUE);
-
- sourceButtonStyle = attributeMap.getString("buttonStyle"); //$NON-NLS-1$
-
- final String sourceStyleClasess = attributeMap.getString(RichFaces.ATTR_STYLE_CLASS);
-
- if (ComponentUtil.isNotBlank(sourceStyleClasess)) {
- styleClasess.put(SECOND_DIV, styleClasess.get(SECOND_DIV) + " " + sourceStyleClasess); //$NON-NLS-1$
- }
-
- sourceStyle = attributeMap.getString(HTML.ATTR_STYLE);
- sourceInputStyle = attributeMap.getString("inputStyle"); //$NON-NLS-1$
- sourceInputClass = attributeMap.getString("inputClass"); //$NON-NLS-1$
- sourceListClass = attributeMap.getString("listClass"); //$NON-NLS-1$
- sourceListStyle = attributeMap.getString("listStyle"); //$NON-NLS-1$
- sourceItemClass = attributeMap.getString("itemClass"); //$NON-NLS-1$
-
- sourceButtonIcon = attributeMap.getString(BUTTON_ICON);
- sourceButtonIconInactive = attributeMap.getString("buttonIconInactive"); //$NON-NLS-1$
- sourceButtonIconDisabled = attributeMap.getString("buttonIconDisabled"); //$NON-NLS-1$
- disabled = isDisabled(attributeMap);
- expanded = isExpanded(source);
-
- if(ComponentUtil.isBlank(sourceButtonIcon)){
- sourceButtonIcon = IMAGE_NAME_DOWN;
- }
-
- }
-
- /**
- * Sets the up img.
- *
- * @param i *
- * @param width the width
- * @param height the height
- * @param img the img
- * @param j *
- * @param image the image
- * @param border the border
- * @param td1Img */
- protected static void setUpImg(final nsIDOMElement img, final int width, final int height,
- final int border, final String image) {
- ComponentUtil.setImg(img, image);
- img.setAttribute(HTML.ATTR_WIDTH, String.valueOf(width));
- img.setAttribute(HTML.ATTR_HEIGHT, String.valueOf(height));
- img.setAttribute(HTML.ATTR_BORDER, String.valueOf(border));
-
- }
-
- /**
- * Inverts <code>expanded</code> state of the ComboBox
- *
- * @param builder the builder
- * @param sourceNode the source node
- * @param toggleId the toggle id
- */
- public static void toggle(final VpeVisualDomBuilder builder, final Node sourceNode, final String toggleId) {
- AttributeMap attributes = new AttributeMap((Element)sourceNode);
- if (isDisabled(attributes) || isExpanded(sourceNode)) {
- expandedComboBoxes.remove(sourceNode);
- } else {
- expandedComboBoxes.put(sourceNode, null);
- }
- }
-
- public static void stopToggling(final Node sourceNode) {
- expandedComboBoxes.remove(sourceNode);
- }
-
- public static boolean isDisabled(final AttributeMap attributes) {
- return attributes.getBoolean(DISABLED_ATTR_NAME) == Boolean.TRUE;
- }
-
- private static boolean isExpanded(Node node) {
- return expandedComboBoxes.containsKey(node);
- }
-}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-10-14 17:30:12 UTC (rev 10836)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-10-14 18:50:05 UTC (rev 10837)
@@ -34,20 +34,20 @@
/**
* @see org.jboss.tools.vpe.editor.template.VpeToggableTemplate#toggle(org.jboss.tools.vpe.editor.VpeVisualDomBuilder, org.w3c.dom.Node, java.lang.String)
- * @see RichFacesComboBoxCreator#toggle(VpeVisualDomBuilder, Node, String)
+ * @see RichFacesComboBoxTemplateHelper#toggle(VpeVisualDomBuilder, Node, String)
*/
public void toggle(final VpeVisualDomBuilder builder, final Node sourceNode, final String toggleId) {
- RichFacesComboBoxCreator.toggle(builder, sourceNode, toggleId);
+ RichFacesComboBoxTemplateHelper.toggle(builder, sourceNode, toggleId);
}
/**
* @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
- * @see RichFacesComboBoxCreator
+ * @see RichFacesComboBoxTemplateHelper
*/
public VpeCreationData create(final VpePageContext pageContext, final Node sourceNode,
final nsIDOMDocument visualDocument) {
- final RichFacesComboBoxCreator creator =
- new RichFacesComboBoxCreator(pageContext, sourceNode, visualDocument);
+ final RichFacesComboBoxTemplateHelper creator =
+ new RichFacesComboBoxTemplateHelper(pageContext, sourceNode, visualDocument);
return creator.getVpeCreationData();
}
Copied: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplateHelper.java (from rev 10821, trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxCreator.java)
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplateHelper.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplateHelper.java 2008-10-14 18:50:05 UTC (rev 10837)
@@ -0,0 +1,579 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.AttributeMap;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;
+
+/**
+ * @author yradtsevich
+ *
+ */
+public class RichFacesComboBoxTemplateHelper {
+ private static final WeakHashMap<Node, Object> expandedComboBoxes = new WeakHashMap<Node, Object>();
+ private static final String DISABLED_ATTR_NAME = "disabled"; //$NON-NLS-1$
+ private static final String BUTTON_ICON_CLASSES_DISABLED =
+ "rich-combobox-font-inactive rich-combobox-button-icon-disabled rich-combobox-button-inactive"; //$NON-NLS-1$
+ private static final String BUTTON_ICON_CLASSES =
+ "rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive"; //$NON-NLS-1$
+ private static final String SECOND_DIV = "secondDiv"; //$NON-NLS-1$
+ private static final String THIRD_DIV = "thirdDiv"; //$NON-NLS-1$
+ private static final String THIRD_EMPTY_DIV = "thirdEmptyDiv"; //$NON-NLS-1$
+ private static final String TEXT_FIELD = "textField"; //$NON-NLS-1$
+ private static final String BUTTON_ICON = "buttonIcon"; //$NON-NLS-1$
+
+ /** CSS_FILE_NAME. */
+ private static final String CSS_FILE_NAME = "comboBox/comboBox.css"; //$NON-NLS-1$
+
+ /** The Constant DEFAULT_LIST_WIDTH. */
+ private static final String DEFAULT_LIST_WIDTH = "150px"; //$NON-NLS-1$
+
+ /** IMAGE_NAME_DOWN. */
+ private static final String IMAGE_NAME_DOWN = "/comboBox/down.gif"; //$NON-NLS-1$
+
+ /** The Constant BUTTON_BACKGROUND. */
+ private static final String BUTTON_BACKGROUND = "buttonBackground"; //$NON-NLS-1$
+
+ /** The Constant STYLE_EXT. */
+ private static final String STYLE_EXT = "richFacesComboBox"; //$NON-NLS-1$
+
+ private static final int LIST_ITEM_HEIGHT_DEFAULT_VALUE = 18;
+
+ /** The style clasess. */
+ private final Map<String, String> styleClasess = new HashMap<String, String>();
+
+ /** The source align. */
+ // Commented because of not working alignment in RichFaces implementation
+ // private String sourceAlign;
+
+ /** The source button style. */
+ private String sourceButtonStyle;
+
+ /** The source default label. */
+ private String sourceDefaultLabel = null;
+
+ /** The source list height. */
+ private String sourceListHeight;
+
+ /** The source list width. */
+ private String sourceListWidth;
+
+ /** The source value. */
+ private String sourceValue;
+
+ /** The source width. */
+ private String sourceWidth;
+
+ /** The source style. */
+ private String sourceStyle;
+
+ /** The source input style. */
+ private String sourceInputStyle;
+
+ /** The source input class. */
+ private String sourceInputClass;
+
+ /** The source list style. */
+ private String sourceListStyle;
+
+ /** The source list class. */
+ private String sourceListClass;
+
+ /** The source item class. */
+ private String sourceItemClass;
+
+
+ /** Source button icon **/
+ private String sourceButtonIcon;
+
+ private String sourceButtonIconInactive;
+
+ private String sourceButtonIconDisabled;
+
+ private boolean disabled;
+ private boolean expanded;
+
+ private final VpePageContext pageContext;
+ private final Node sourceNode;
+ private final nsIDOMDocument visualDocument;
+ private final VpeCreationData vpeCreationData;
+
+ /**
+ * The Constructor.
+ */
+ public RichFacesComboBoxTemplateHelper(final VpePageContext pageContext, final Node sourceNode,
+ final nsIDOMDocument visualDocument) {
+ this.pageContext = pageContext;
+ this.sourceNode = sourceNode;
+ this.visualDocument = visualDocument;
+ initDefaultClasses();
+ vpeCreationData = create();
+ }
+
+ /**
+ * Calculate with for div.
+ *
+ * @param with the with
+ * @param minus the minus
+ *
+ * @return the string
+ */
+ private static String calculateWithForDiv(final String with, final int minus) {
+ try {
+ Integer intValue = 0;
+ if (with.endsWith("px")) { //$NON-NLS-1$
+ intValue = Integer.parseInt(with.substring(0, with.length() - 2));
+ } else {
+ intValue = Integer.parseInt(with);
+ }
+ return String.valueOf((intValue - minus)) + "px"; //$NON-NLS-1$
+ } catch (final NumberFormatException e) {
+ return with;
+ }
+
+ }
+ public VpeCreationData getVpeCreationData() {
+ return vpeCreationData;
+ }
+
+ /**
+ * Create.
+ *
+ * @param visualDocument the visual document
+ * @param sourceNode the source node
+ * @param pageContext the page context
+ *
+ * @return the vpe creation data
+ */
+ private VpeCreationData create() {
+ ComponentUtil.setCSSLink(pageContext, CSS_FILE_NAME, STYLE_EXT);
+
+ final Element source = (Element) sourceNode;
+
+ prepareData(source);
+ final nsIDOMElement rootDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ //Fix https://jira.jboss.org/jira/browse/JBIDE-2430 issue with resizement.
+ rootDiv.setAttribute(HTML.ATTR_STYLE,
+ HTML.STYLE_PARAMETER_WIDTH + Constants.COLON+sourceWidth);
+ final nsIDOMElement comboBoxDiv = visualDocument.createElement(HTML.TAG_DIV);
+ final nsIDOMElement secondDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ // Commented because of not working alignment in RichFaces implementation
+ // comboBoxDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+ // secondDiv.setAttribute(HTML.ATTR_ALIGN, this.sourceAlign);
+
+
+ //comboBoxDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("secondDiv")); //$NON-NLS-1$
+ secondDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(SECOND_DIV));
+ String secondDivSubStyle = "; position: {0}; z-index: {1} ;"; //$NON-NLS-1$
+
+ if (expanded) {
+ secondDivSubStyle = MessageFormat.format(secondDivSubStyle, "relative", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ secondDivSubStyle = MessageFormat.format(secondDivSubStyle, "static", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ comboBoxDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceListWidth
+ + Constants.SEMICOLON + secondDivSubStyle);
+ secondDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceListWidth
+ + Constants.SEMICOLON + secondDivSubStyle + sourceStyle);
+ final nsIDOMElement thirdDiv = visualDocument.createElement(HTML.TAG_DIV);
+ thirdDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get(THIRD_DIV));
+ thirdDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + sourceWidth
+ + "; z-index: 1;"); //$NON-NLS-1$
+ final nsIDOMElement textField = visualDocument.createElement(HTML.TAG_INPUT);
+ textField.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+
+ textField.setAttribute(HTML.ATTR_CLASS,
+ styleClasess.get(TEXT_FIELD) + Constants.WHITE_SPACE + sourceInputClass);
+ textField.setAttribute("autocomplete", "off"); //$NON-NLS-1$ //$NON-NLS-2$
+ textField.setAttribute(HTML.ATTR_STYLE,
+ HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + calculateWithForDiv(sourceWidth, 17)
+ + Constants.SEMICOLON + sourceInputStyle);
+ String value = null;
+ if (ComponentUtil.isNotBlank(sourceDefaultLabel)) {
+ value = sourceDefaultLabel;
+ } else if (ComponentUtil.isNotBlank(sourceValue) && ComponentUtil.isBlank(sourceDefaultLabel)) {
+ value = sourceValue;
+ }
+
+ if (value != null) {
+ textField.setAttribute(RichFaces.ATTR_VALUE, value);
+ }
+ final nsIDOMElement buttonBackground = visualDocument.createElement(HTML.TAG_INPUT);
+ buttonBackground.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+
+ if (disabled) {
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES_DISABLED);
+ } else {
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES);
+ }
+
+ buttonBackground.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_BACKGROUND));
+ buttonBackground.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
+ buttonBackground.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ if (sourceButtonStyle != null) {
+ buttonBackground.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ }
+
+ final nsIDOMElement buttonIcon = visualDocument.createElement(HTML.TAG_INPUT);
+ buttonIcon.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TEXT_TYPE);
+ ;
+ buttonIcon.setAttribute(HTML.ATTR_CLASS, styleClasess.get(BUTTON_ICON));
+ buttonIcon.setAttribute(HTML.ATTR_READONLY, Constants.TRUE);
+ buttonIcon.setAttribute(RichFacesAbstractInplaceTemplate.VPE_USER_TOGGLE_ID_ATTR, String.valueOf(0));
+ if (sourceButtonStyle != null) {
+ buttonIcon.setAttribute(HTML.ATTR_STYLE, sourceButtonStyle);
+ }
+
+ String actualSourceButton;
+ if (disabled) {
+ actualSourceButton = sourceButtonIconDisabled;
+ } else if (expanded) {
+ actualSourceButton = sourceButtonIcon;
+ } else {
+ actualSourceButton = sourceButtonIconInactive;
+ }
+
+ if (ComponentUtil.isNotBlank(actualSourceButton) && (actualSourceButton != IMAGE_NAME_DOWN)) {
+ String buttonIconPath = VpeStyleUtil.addFullPathToImgSrc(actualSourceButton, pageContext, true);
+ buttonIconPath = buttonIconPath.replace('\\', '/');
+ final String style = "background-image: url(" + buttonIconPath + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ buttonIcon.setAttribute(HTML.ATTR_STYLE, buttonIcon.getAttribute(HTML.ATTR_STYLE) + style);
+ }
+ final nsIDOMElement forthEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
+ forthEmptyDiv.setAttribute(HTML.ATTR_CLASS, styleClasess.get("forthEmptyDiv")); //$NON-NLS-1$
+ forthEmptyDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
+ + calculateWithForDiv(sourceWidth, 10));
+ forthEmptyDiv.appendChild(visualDocument.createTextNode("Struts")); //$NON-NLS-1$
+
+ rootDiv.appendChild(comboBoxDiv);
+ comboBoxDiv.appendChild(secondDiv);
+
+ secondDiv.appendChild(thirdDiv);
+ if (expanded) {
+ comboBoxDiv.appendChild(createToogleDiv());
+ }
+ thirdDiv.appendChild(textField);
+ thirdDiv.appendChild(buttonBackground);
+ thirdDiv.appendChild(buttonIcon);
+ thirdDiv.appendChild(forthEmptyDiv);
+
+ final VpeCreationData creationData = new VpeCreationData(rootDiv);
+
+ return creationData;
+ }
+
+ /**
+ * Creates the toogle div.
+ *
+ * @param visualDocument the visual document
+ * @param pageContext the page context
+ * @param source the source
+ *
+ * @return the ns IDOM node
+ */
+ private nsIDOMNode createToogleDiv() {
+
+ final nsIDOMElement thirdEmptyDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE, sourceListStyle + Constants.SEMICOLON
+ + " z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
+ thirdEmptyDiv.setAttribute(HTML.ATTR_CLASS,
+ styleClasess.get(THIRD_EMPTY_DIV) + " " + sourceListClass); //$NON-NLS-1$
+ thirdEmptyDiv.setAttribute(HTML.ATTR_STYLE,
+ "z-index: 3; position: absolute; visibility: visible; top: 16px; left: 0px;"); //$NON-NLS-1$
+
+ final nsIDOMElement shadovDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ final nsIDOMElement positionDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ positionDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-position"); //$NON-NLS-1$
+
+ final nsIDOMElement decorationDiv = visualDocument.createElement(HTML.TAG_DIV);
+
+ decorationDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-decoration"); //$NON-NLS-1$
+ // decorationDiv.setAttribute(HTML.ATTR_STYLE,
+ // "height: 54px; width: 208px;");
+
+ final nsIDOMElement scrollDiv = visualDocument.createElement(HTML.TAG_DIV);
+ scrollDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-list-scroll"); //$NON-NLS-1$
+ final List<Element> items = ComponentUtil.getSelectItems(sourceNode.getChildNodes());
+ int defaultHeight = LIST_ITEM_HEIGHT_DEFAULT_VALUE;
+
+ if((items!=null) && (items.size() > 1)){
+ defaultHeight = ((items.size() - 1)* LIST_ITEM_HEIGHT_DEFAULT_VALUE);
+ }
+
+ final String listHeight = ComponentUtil.isNotBlank(sourceListHeight)
+ ? sourceListHeight
+ : String.valueOf(defaultHeight) + "px"; //$NON-NLS-1$
+ scrollDiv.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_MAX_HEIGHT
+ + Constants.COLON + listHeight + Constants.SEMICOLON
+ + HTML.STYLE_PARAMETER_WIDTH + Constants.COLON
+ + calculateWithForDiv(sourceListWidth, 2));
+
+ final List<Element> selectItems = ComponentUtil.getSelectItems(sourceNode.getChildNodes());
+
+ if (selectItems.size() > 0) {
+ for (final Element e : selectItems) {
+ scrollDiv.appendChild(createSelectItem(e));
+ }
+ }
+
+ shadovDiv.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow"); //$NON-NLS-1$
+
+ final nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
+ table.setAttribute(HTML.ATTR_CELLPADDING, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_CELLSPACING, "0"); //$NON-NLS-1$
+ table.setAttribute(HTML.ATTR_BORDER, "0"); //$NON-NLS-1$
+ String width = Constants.EMPTY;
+ try {
+
+ int w = ComponentUtil.parseWidthHeightValue(sourceListWidth);
+ w += 7;
+ width = String.valueOf(w);
+ } catch (final ParseException e) {
+ width = "217"; //$NON-NLS-1$
+ }
+ table.setAttribute(HTML.ATTR_STYLE, HTML.STYLE_PARAMETER_WIDTH
+ + Constants.COLON + width + Constants.PIXEL
+ + Constants.SEMICOLON + HTML.STYLE_PARAMETER_HEIGHT
+ + Constants.COLON + "63px;"); //$NON-NLS-1$
+
+ final nsIDOMElement tr1 = visualDocument.createElement(HTML.TAG_TR);
+ final nsIDOMElement tr2 = visualDocument.createElement(HTML.TAG_TR);
+
+ final nsIDOMElement tr1_td1 = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement tr1_td2 = visualDocument.createElement(HTML.TAG_TD);
+
+ final nsIDOMElement tr2_td1 = visualDocument.createElement(HTML.TAG_TD);
+ final nsIDOMElement tr2_td2 = visualDocument.createElement(HTML.TAG_TD);
+
+ final nsIDOMElement tr1_td1_img = visualDocument.createElement(HTML.TAG_IMG);
+ final nsIDOMElement tr1_td2_img = visualDocument.createElement(HTML.TAG_IMG);
+
+ final nsIDOMElement tr2_td1_img = visualDocument.createElement(HTML.TAG_IMG);
+ final nsIDOMElement tr2_td2_img = visualDocument.createElement(HTML.TAG_IMG);
+
+ tr1_td1.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-tl"); //$NON-NLS-1$
+ tr1_td2.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-tr"); //$NON-NLS-1$
+
+ tr2_td1.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-bl"); //$NON-NLS-1$
+ tr2_td2.setAttribute(HTML.ATTR_CLASS, "rich-combobox-shadow-br"); //$NON-NLS-1$
+
+ setUpImg(tr1_td1_img, 10, 1, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
+ setUpImg(tr1_td2_img, 1, 10, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
+ setUpImg(tr2_td1_img, 1, 10, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
+ setUpImg(tr2_td2_img, 10, 1, 0, "comboBox/spacer.gif"); //$NON-NLS-1$
+
+ thirdEmptyDiv.appendChild(shadovDiv);
+ shadovDiv.appendChild(table);
+ thirdEmptyDiv.appendChild(positionDiv);
+ positionDiv.appendChild(decorationDiv);
+ decorationDiv.appendChild(scrollDiv);
+
+ table.appendChild(tr1);
+ table.appendChild(tr2);
+ tr1.appendChild(tr1_td1);
+ tr1.appendChild(tr1_td2);
+
+ tr2.appendChild(tr2_td1);
+ tr2.appendChild(tr2_td2);
+
+ tr1_td1.appendChild(tr1_td1_img);
+ tr1_td1.appendChild(visualDocument.createElement(HTML.TAG_BR));
+
+ tr1_td2.appendChild(tr1_td2_img);
+ tr1_td2.appendChild(visualDocument.createElement(HTML.TAG_BR));
+
+ tr2_td1.appendChild(tr2_td1_img);
+ tr2_td1.appendChild(visualDocument.createElement(HTML.TAG_BR));
+
+ tr2_td2.appendChild(tr2_td2_img);
+ tr2_td2.appendChild(visualDocument.createElement(HTML.TAG_BR));
+
+ return thirdEmptyDiv;
+ }
+
+ /**
+ * Creates the select item.
+ *
+ * @param visualDocument the visual document
+ * @param e the e
+ *
+ * @return the ns IDOM node
+ */
+ private nsIDOMNode createSelectItem(final Element e) {
+ final nsIDOMElement item = visualDocument.createElement(HTML.TAG_SPAN);
+
+ item.setAttribute(HTML.ATTR_CLASS, "rich-combobox-item " + sourceItemClass); //$NON-NLS-1$
+ item.appendChild(visualDocument.createTextNode(ComponentUtil.getSelectItemValue(e)));
+ return item;
+ }
+
+ /**
+ * Inits the default classes.
+ */
+ private void initDefaultClasses() {
+ styleClasess.put(SECOND_DIV, "rich-combobox-font rich-combobox"); //$NON-NLS-1$
+ styleClasess.put(THIRD_DIV, "rich-combobox-font rich-combobox-shell"); //$NON-NLS-1$
+ styleClasess.put(THIRD_EMPTY_DIV, "rich-combobox-list-cord"); //$NON-NLS-1$
+ styleClasess.put(TEXT_FIELD, "rich-combobox-font-disabled rich-combobox-input-inactive"); //$NON-NLS-1$
+ styleClasess.put(BUTTON_BACKGROUND,
+ "rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"); //$NON-NLS-1$
+ styleClasess.put(BUTTON_ICON, BUTTON_ICON_CLASSES);
+ styleClasess.put("forthEmptyDiv", "rich-combobox-strut rich-combobox-font"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Prepare data.
+ *
+ * @param source the source
+ */
+ private void prepareData(final Element source) {
+ final AttributeMap attributeMap = new AttributeMap(source);
+
+ // Commented because of not working alignment in RichFaces implementation
+ // if (attributeMap.isBlank(RichFaces.ATTR_ALIGN)) {
+ // this.sourceAlign = DEFAULT_ALIGN;
+ // } else {
+ // this.sourceAlign = attributeMap.getString(RichFaces.ATTR_ALIGN);
+ // }
+
+ if (attributeMap.isBlank(RichFaces.ATTR_LIST_WIDTH)) {
+ sourceListWidth = DEFAULT_LIST_WIDTH;
+ } else {
+ sourceListWidth = attributeMap.getString(RichFaces.ATTR_LIST_WIDTH);
+ }
+
+ sourceListHeight = attributeMap.getString(RichFaces.ATTR_LIST_HEIGHT);
+
+ if (attributeMap.isBlank(RichFaces.ATTR_WIDTH)) {
+ sourceWidth = DEFAULT_LIST_WIDTH;
+ } else {
+ sourceWidth = attributeMap.getString(RichFaces.ATTR_WIDTH);
+
+ if(sourceListWidth == DEFAULT_LIST_WIDTH) {
+ sourceListWidth = sourceWidth;
+ }
+ }
+
+ if (ComponentUtil.isNotBlank(sourceWidth) && (sourceWidth != DEFAULT_LIST_WIDTH)) {
+ if(!sourceWidth.endsWith(Constants.PIXEL)){
+ try {
+ final int intValue = Integer.parseInt(sourceWidth);
+ sourceWidth = String.valueOf(intValue)+Constants.PIXEL;
+ } catch (final NumberFormatException e) {
+ sourceListWidth = DEFAULT_LIST_WIDTH;
+ }
+ }
+ }
+
+ sourceDefaultLabel = attributeMap.getString("defaultLabel"); //$NON-NLS-1$
+ sourceValue = attributeMap.getString( RichFaces.ATTR_VALUE);
+
+ sourceButtonStyle = attributeMap.getString("buttonStyle"); //$NON-NLS-1$
+
+ final String sourceStyleClasess = attributeMap.getString(RichFaces.ATTR_STYLE_CLASS);
+
+ if (ComponentUtil.isNotBlank(sourceStyleClasess)) {
+ styleClasess.put(SECOND_DIV, styleClasess.get(SECOND_DIV) + " " + sourceStyleClasess); //$NON-NLS-1$
+ }
+
+ sourceStyle = attributeMap.getString(HTML.ATTR_STYLE);
+ sourceInputStyle = attributeMap.getString("inputStyle"); //$NON-NLS-1$
+ sourceInputClass = attributeMap.getString("inputClass"); //$NON-NLS-1$
+ sourceListClass = attributeMap.getString("listClass"); //$NON-NLS-1$
+ sourceListStyle = attributeMap.getString("listStyle"); //$NON-NLS-1$
+ sourceItemClass = attributeMap.getString("itemClass"); //$NON-NLS-1$
+
+ sourceButtonIcon = attributeMap.getString(BUTTON_ICON);
+ sourceButtonIconInactive = attributeMap.getString("buttonIconInactive"); //$NON-NLS-1$
+ sourceButtonIconDisabled = attributeMap.getString("buttonIconDisabled"); //$NON-NLS-1$
+ disabled = isDisabled(attributeMap);
+ expanded = isExpanded(source);
+
+ if(ComponentUtil.isBlank(sourceButtonIcon)){
+ sourceButtonIcon = IMAGE_NAME_DOWN;
+ }
+
+ }
+
+ /**
+ * Sets the up img.
+ *
+ * @param i *
+ * @param width the width
+ * @param height the height
+ * @param img the img
+ * @param j *
+ * @param image the image
+ * @param border the border
+ * @param td1Img */
+ protected static void setUpImg(final nsIDOMElement img, final int width, final int height,
+ final int border, final String image) {
+ ComponentUtil.setImg(img, image);
+ img.setAttribute(HTML.ATTR_WIDTH, String.valueOf(width));
+ img.setAttribute(HTML.ATTR_HEIGHT, String.valueOf(height));
+ img.setAttribute(HTML.ATTR_BORDER, String.valueOf(border));
+
+ }
+
+ /**
+ * Inverts <code>expanded</code> state of the ComboBox
+ *
+ * @param builder the builder
+ * @param sourceNode the source node
+ * @param toggleId the toggle id
+ */
+ public static void toggle(final VpeVisualDomBuilder builder, final Node sourceNode, final String toggleId) {
+ AttributeMap attributes = new AttributeMap((Element)sourceNode);
+ if (isDisabled(attributes) || isExpanded(sourceNode)) {
+ expandedComboBoxes.remove(sourceNode);
+ } else {
+ expandedComboBoxes.put(sourceNode, null);
+ }
+ }
+
+ public static void stopToggling(final Node sourceNode) {
+ expandedComboBoxes.remove(sourceNode);
+ }
+
+ public static boolean isDisabled(final AttributeMap attributes) {
+ return attributes.getBoolean(DISABLED_ATTR_NAME) == Boolean.TRUE;
+ }
+
+ private static boolean isExpanded(Node node) {
+ return expandedComboBoxes.containsKey(node);
+ }
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplateHelper.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml 2008-10-14 17:30:12 UTC (rev 10836)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/comboBox.xhtml 2008-10-14 18:50:05 UTC (rev 10837)
@@ -11,7 +11,7 @@
<body>
<h1>comboBox</h1>
<rich:comboBox value="#{bean.cbString}" defaultLabel="Select Any Value"
- style="width:250px" id="comboBox">
+ style="width:250px" id="comboBox" listHeight="150px">
<f:selectItem itemValue="suggestion 1" />
<f:selectItem itemValue="suggestion 2" />
<f:selectItem itemValue="suggestion 3" />
16 years, 3 months
JBoss Tools SVN: r10836 - trunk/birt/docs/en/modules.
by jbosstools-commits@lists.jboss.org
Author: abogachuk
Date: 2008-10-14 13:30:12 -0400 (Tue, 14 Oct 2008)
New Revision: 10836
Modified:
trunk/birt/docs/en/modules/birt_designer.xml
Log:
Modified: trunk/birt/docs/en/modules/birt_designer.xml
===================================================================
--- trunk/birt/docs/en/modules/birt_designer.xml 2008-10-14 17:02:08 UTC (rev 10835)
+++ trunk/birt/docs/en/modules/birt_designer.xml 2008-10-14 17:30:12 UTC (rev 10836)
@@ -17,20 +17,34 @@
<section id="birt_designer_UI" xreflabel="birt_designer_UI">
<title>BIRT User Interface</title>
- <para>The central part of the user interface is the Layout Editor. It displays the whole process of building a report and contains the following tabs:</para>
+ <para>The central part of the user interface is the <property>Layout Editor</property>. It displays the whole process of building a report and contains the following tabs:</para>
<itemizedlist>
<listitem><para><emphasis role="bold">Layout</emphasis> - this is an area where you can edit your report design;</para></listitem>
<listitem><para><emphasis role="bold">Preview</emphasis> - runs your report created and shows the output;</para></listitem>
<listitem><para><emphasis role="bold">Script</emphasis> - on this page you can add JavaScript to your report to customize its behavior;</para></listitem>
<listitem><para><emphasis role="bold">XML Source</emphasis> - this is an area where you can view and modify the XML source of your report;</para></listitem>
- <listitem><para><emphasis role="bold">Master Page</emphasis> - use it to format page data.</para></listitem>
+ <listitem><para><emphasis role="bold">Master Page</emphasis> - use it to format page data.</para></listitem> </itemizedlist>
+ <para>The next part of user interface is different <property>Views</property> that can be arranged around the Layout Editor area the way you like:</para>
+ <itemizedlist>
+ <listitem><para><emphasis role="bold">Palette</emphasis> - BIRT View that shows the standard report items you can add to your report using drag and drop.</para></listitem>
+ <listitem><para><emphasis role="bold">Outline</emphasis> - BIRT View that shows the structure of your report as a tree view.</para></listitem>
+ <listitem><para><emphasis role="bold">Navigator</emphasis> - Standard Eclipse view that shows your projects, and the reports within your projects.</para></listitem>
+ <listitem><para><emphasis role="bold">Data Explorer</emphasis> - BIRT View that shows your data sources (connections), data sets (queries) and report parameters. You also use this view to add data set columns to your report layout.</para></listitem>
+ <listitem><para><emphasis role="bold">Property Editor</emphasis> - BIRT View that displays properties for many report items. It has tabs and groupings that organize properties into categories.</para></listitem>
+ <listitem><para><emphasis role="bold">Properties View</emphasis> - Standard Eclipse view that shows all properties for a report item as a simple list. This view is optional, and we will not use it in this tutorial.</para></listitem>
+ <listitem><para><emphasis role="bold">Library Explorer View</emphasis> - BIRT allows the reuse of report objects, such as tables, data sources and styles. Objects created for reuse are stored in a library file. The Library Explorer will display Libraries that exist in the resource folder. Developed libraries can be added to the resource folder by selecting File→Publish Library to Resource Folder or by right clicking in Library Explorer and selecting add. The resource folder location can be configured. </para></listitem>
+
+
+
+ </itemizedlist>
- </itemizedlist>
+
+
</section>
<section id="birt_designer_features">
16 years, 3 months
JBoss Tools SVN: r10835 - in trunk/seam/plugins: org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-10-14 13:02:08 -0400 (Tue, 14 Oct 2008)
New Revision: 10835
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2731 2.1 and 2.2 are done
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-14 16:53:33 UTC (rev 10834)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetAbstractInstallDelegate.java 2008-10-14 17:02:08 UTC (rev 10835)
@@ -13,6 +13,7 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
@@ -35,6 +36,8 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.datatools.connectivity.IConnectionProfile;
+import org.eclipse.datatools.connectivity.ProfileManager;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jst.common.project.facet.core.ClasspathHelper;
import org.eclipse.jst.j2ee.model.IModelProvider;
@@ -56,6 +59,7 @@
import org.eclipse.jst.javaee.web.WebResourceCollection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -67,6 +71,7 @@
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.project.facet.SeamProjectPreferences;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.osgi.service.prefs.BackingStoreException;
@@ -302,25 +307,30 @@
webLibFolder = new File(webContentFolder, WEB_LIBRARIES_RELATED_PATH);
srcFolder = isWarConfiguration(model) ? new File(srcRootFolder.getUnderlyingFolder().getLocation().toFile(), "model") : srcRootFolder.getUnderlyingFolder().getLocation().toFile(); //$NON-NLS-1$
Object runtimeName = model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME);
- final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName.toString());
+ if(runtimeName!=null) {
+ final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName.toString());
- seamHomePath = selectedRuntime.getHomeDir();
+ seamHomePath = selectedRuntime.getHomeDir();
- seamHomeFolder = new File(seamHomePath);
- seamLibFolder = new File(seamHomePath, SEAM_LIB_RELATED_PATH);
- seamGenResFolder = new File(seamHomePath, "seam-gen/resources"); //$NON-NLS-1$
+ seamHomeFolder = new File(seamHomePath);
+ seamLibFolder = new File(seamHomePath, SEAM_LIB_RELATED_PATH);
+ seamGenResFolder = new File(seamHomePath, "seam-gen/resources"); //$NON-NLS-1$
- seamGenHomeFolder = new File(seamHomePath, "seam-gen"); //$NON-NLS-1$
- seamGenViewSource = new File(seamGenHomeFolder, "view"); //$NON-NLS-1$
- dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml"); //$NON-NLS-1$
- componentsFile = new File(seamGenResFolder, "WEB-INF/components" + (isWarConfiguration(model) ? "-war" : "") + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ seamGenHomeFolder = new File(seamHomePath, "seam-gen"); //$NON-NLS-1$
+ seamGenViewSource = new File(seamGenHomeFolder, "view"); //$NON-NLS-1$
+ dataSourceDsFile = new File(seamGenResFolder, "datasource-ds.xml"); //$NON-NLS-1$
+ componentsFile = new File(seamGenResFolder, "WEB-INF/components" + (isWarConfiguration(model) ? "-war" : "") + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
- hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
- //final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs"); //$NON-NLS-1$
- persistenceFile = new File(seamGenResFolder, "META-INF/persistence-" + (isWarConfiguration(model) ? DEV_WAR_PROFILE : DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
+ hibernateConsoleLaunchFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.launch"); //$NON-NLS-1$
+ hibernateConsolePropsFile = new File(seamGenHomeFolder, "hibernatetools/hibernate-console.properties"); //$NON-NLS-1$
+ //final File hibernateConsolePref = new File(seamGenHomeFolder, "hibernatetools/.settings/org.hibernate.eclipse.console.prefs"); //$NON-NLS-1$
+ persistenceFile = new File(seamGenResFolder, "META-INF/persistence-" + (isWarConfiguration(model) ? DEV_WAR_PROFILE : DEV_EAR_PROFILE) + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
- copyFilesToWarProject(project, fv, model, monitor);
+ copyFilesToWarProject(project, fv, model, monitor);
+ } else {
+ // If seam runtime is null then just modify web.xml and add seam nature.
+ configureWebXml(project);
+ }
ClasspathHelper.addClasspathEntries(project, fv);
createSeamProjectPreferenes(project, model);
@@ -483,6 +493,7 @@
IProjectFacetVersion ejbVersion = facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.EJB_FACET);
IProjectFacetVersion webVersion = facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
IProjectFacetVersion earVersion = facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.ENTERPRISE_APPLICATION_FACET);
+ initDefaultModelValues(model, webVersion!=null);
if(ejbVersion!=null) {
doExecuteForEjb(project, fv, model, monitor);
} else if(webVersion!=null) {
@@ -492,6 +503,40 @@
}
}
+ private void initDefaultModelValues(IDataModel model, boolean warProject) {
+ if(model.getProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS)==null) {
+ model.setProperty(ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS, warProject?ISeamFacetDataModelProperties.DEPLOY_AS_WAR:ISeamFacetDataModelProperties.DEPLOY_AS_EAR);
+ }
+ if(model.getProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME)==null) {
+ model.setProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME, "org.domain." + model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME) + ".session"); //$NON-NLS-1$
+ }
+ if(model.getProperty(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME)==null) {
+ model.setProperty(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME, "org.domain." + model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME) + ".entity"); //$NON-NLS-1$
+ }
+ if(model.getProperty(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME)==null) {
+ model.setProperty(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME, "org.domain." + model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME) + ".test"); //$NON-NLS-1$
+ }
+ if(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME)==null) {
+ String runtimeName = SeamFacetInstallDataModelProvider.getSeamRuntimeDefaultValue(model);
+ if((runtimeName!=null && runtimeName.length()>0)) {
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, runtimeName);
+ }
+ }
+ if(model.getProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE)==null) {
+ String defaultDs = SeamProjectPreferences.getStringPreference(SeamProjectPreferences.SEAM_DEFAULT_CONNECTION_PROFILE);
+ IConnectionProfile[] profiles = ProfileManager.getInstance().getProfilesByCategory("org.eclipse.datatools.connectivity.db.category"); //$NON-NLS-1$
+ List<String> names = new ArrayList<String>();
+ for (IConnectionProfile connectionProfile : profiles) {
+ names.add(connectionProfile.getName());
+ }
+ if(names.contains(defaultDs)) {
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE, defaultDs);
+ } else if(names.size()>0) {
+ model.setProperty(ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE, names.get(0));
+ }
+ }
+ }
+
/**
*
*/
@@ -536,8 +581,12 @@
prefs.put(JBOSS_AS_DEPLOY_AS, model.getProperty(JBOSS_AS_DEPLOY_AS).toString());
prefs.put(SEAM_SETTINGS_VERSION, SEAM_SETTINGS_VERSION_1_1);
- prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
- prefs.put(SEAM_CONNECTION_PROFILE, model.getProperty(SEAM_CONNECTION_PROFILE).toString());
+ if(model.getProperty(SEAM_RUNTIME_NAME)!=null) {
+ prefs.put(SEAM_RUNTIME_NAME, model.getProperty(SEAM_RUNTIME_NAME).toString());
+ }
+ if(model.getProperty(SEAM_CONNECTION_PROFILE)!=null) {
+ prefs.put(SEAM_CONNECTION_PROFILE, model.getProperty(SEAM_CONNECTION_PROFILE).toString());
+ }
prefs.put(SESSION_BEAN_PACKAGE_NAME, model.getProperty(SESSION_BEAN_PACKAGE_NAME).toString());
prefs.put(ENTITY_BEAN_PACKAGE_NAME, model.getProperty(ENTITY_BEAN_PACKAGE_NAME).toString());
prefs.put(TEST_CASES_PACKAGE_NAME, model.getProperty(TEST_CASES_PACKAGE_NAME).toString());
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2008-10-14 16:53:33 UTC (rev 10834)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDataModelProvider.java 2008-10-14 17:02:08 UTC (rev 10835)
@@ -97,9 +97,11 @@
*/
public Object getDefaultProperty(String propertyName) {
if (JBOSS_AS_HOME.equals(propertyName)) {
- return "Jboss_AS_HOME"; //$NON-NLS-1$
+// return "Jboss_AS_HOME"; //$NON-NLS-1$
+ return null;
} else if (JBOSS_AS_DEPLOY_AS.equals(propertyName)) {
- return "Jboos_DEPLOY_AS"; //$NON-NLS-1$
+// return "Jboos_DEPLOY_AS"; //$NON-NLS-1$
+ return null;
} else if (propertyName.equals(FACET_ID)) {
return ISeamFacetDataModelProperties.SEAM_FACET_ID;
} else if (SEAM_TEST_PROJECT.equals(propertyName)) {
@@ -173,12 +175,9 @@
model.setProperty(ISeamFacetDataModelProperties.DB_DEFAULT_CATALOG_NAME, "");
model.setProperty(ISeamFacetDataModelProperties.DB_ALREADY_EXISTS, false);
model.setProperty(ISeamFacetDataModelProperties.RECREATE_TABLES_AND_DATA_ON_DEPLOY, false);
- if(model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)!=null) {
- model.setProperty(ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_NAME, "org.domain." + model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME) + ".session"); //$NON-NLS-1$
- model.setProperty(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME, "org.domain." + model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME) + ".entity"); //$NON-NLS-1$
- model.setProperty(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME, "org.domain." + model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME) + ".test"); //$NON-NLS-1$
- }
- // TODO
+// SESSION_BEAN_PACKAGE_NAME
+// ENTITY_BEAN_PACKAGE_NAME
+// TEST_CASES_PACKAGE_NAME
// jBossSeamHome
// jBossAsDeployAs
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2008-10-14 16:53:33 UTC (rev 10834)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2008-10-14 17:02:08 UTC (rev 10835)
@@ -52,7 +52,7 @@
.node(SeamCorePlugin.PLUGIN_ID);
node.put(SeamProjectPreferences.RUNTIME_CONFIG_FORMAT_VERSION, RUNTIME_CONFIG_FORMAT_VERSION);
- node.put(SeamProjectPreferences.SEAM_DEFAULT_CONNECTION_PROFILE, "DefaultDS"); //$NON-NLS-1$
+// node.put(SeamProjectPreferences.SEAM_DEFAULT_CONNECTION_PROFILE, "DefaultDS"); //$NON-NLS-1$
node.put(SeamProjectPreferences.JBOSS_AS_DEFAULT_DEPLOY_AS, "war"); //$NON-NLS-1$
node.put(SeamProjectPreferences.HIBERNATE_DEFAULT_DB_TYPE, "HSQL"); //$NON-NLS-1$
initializeDefault(node,getSeamGenBuildPath());
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java 2008-10-14 16:53:33 UTC (rev 10834)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java 2008-10-14 17:02:08 UTC (rev 10835)
@@ -86,7 +86,9 @@
* @see org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#setTags(java.lang.String[])
*/
public void setTags(String[] tags) {
- comboField.setTags(tags,getValueAsString());
+ if(comboField!=null) {
+ comboField.setTags(tags,getValueAsString());
+ }
}
/* (non-Javadoc)
16 years, 3 months
JBoss Tools SVN: r10834 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-10-14 12:53:33 -0400 (Tue, 14 Oct 2008)
New Revision: 10834
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ServerViewProvider.java
Log:
JBIDE-2893 NPE for fileset view provider
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ServerViewProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ServerViewProvider.java 2008-10-14 16:22:39 UTC (rev 10833)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/ServerViewProvider.java 2008-10-14 16:53:33 UTC (rev 10834)
@@ -33,6 +33,7 @@
private boolean enabled;
private int weight;
+ private boolean loadFailed = false;
public ServerViewProvider(IConfigurationElement element) {
this.element = element;
@@ -84,11 +85,12 @@
public JBossServerViewExtension getDelegate() {
try {
- if( extension == null ) {
+ if( extension == null && !loadFailed) {
extension = (JBossServerViewExtension)element.createExecutableExtension(PROVIDER_LABEL);
extension.setViewProvider(this);
}
} catch( CoreException ce ) {
+ loadFailed = true;
ce.printStackTrace();
}
return extension;
@@ -105,15 +107,15 @@
public void setEnabled(boolean enable) {
if( enable && !enabled ) {
enabled = true;
- getDelegate().enable();
+ if(getDelegate() != null ) getDelegate().enable();
} else if( !enable && enabled ) {
enabled = false;
- getDelegate().disable();
+ if(getDelegate() != null ) getDelegate().disable();
}
}
public boolean supports(IServer server) {
- return getDelegate().supports(server);
+ return getDelegate() == null ? false : getDelegate().supports(server);
}
public int getWeight() {
@@ -125,7 +127,8 @@
}
public void dispose() {
- getDelegate().dispose();
+ if( getDelegate() != null )
+ getDelegate().dispose();
if( icon != null && iconDescriptor != null )
icon.dispose();
16 years, 3 months