JBoss Tools SVN: r21553 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-04-20 10:06:33 -0400 (Tue, 20 Apr 2010)
New Revision: 21553
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizardSelectTagLibrariesPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5946 taglib page has been added to wizard
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizardSelectTagLibrariesPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizardSelectTagLibrariesPage.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizardSelectTagLibrariesPage.java 2010-04-20 14:06:33 UTC (rev 21553)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.ui.wizard.newfile;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.common.model.ui.wizards.standard.DefaultStandardStep;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class NewXHTMLWizardSelectTagLibrariesPage extends DefaultStandardStep {
+
+ public NewXHTMLWizardSelectTagLibrariesPage(SpecialWizardSupport support,
+ int id) {
+ super(support, id);
+ }
+ @Override
+ public void setWizard(IWizard wizard) {
+ super.setWizard(wizard);
+// this.wizard = (DefaultStandardWizard)wizard;
+ }
+ @Override
+ public void validate() {
+ setPageComplete(true);
+ }
+}
14 years, 8 months
JBoss Tools SVN: r21552 - in trunk: jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-04-20 10:04:37 -0400 (Tue, 20 Apr 2010)
New Revision: 21552
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5946 taglib page has been added to wizard
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java 2010-04-20 13:39:34 UTC (rev 21551)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/standard/DefaultStandardStep.java 2010-04-20 14:04:37 UTC (rev 21552)
@@ -14,7 +14,6 @@
import java.util.Properties;
import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.common.meta.action.XAttributeData;
@@ -52,9 +51,9 @@
attributes = null;
}
- public void setWizard(IWizard wizard) {
+ public void setWizard(DefaultStandardWizard wizard) {
super.setWizard(wizard);
- this.wizard = (DefaultStandardWizard)wizard;
+ this.wizard = wizard;
}
public void createControl(Composite parent) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java 2010-04-20 13:39:34 UTC (rev 21551)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/newfile/NewXHTMLWizard.java 2010-04-20 14:04:37 UTC (rev 21552)
@@ -12,6 +12,7 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.OutputStreamWriter;
import org.eclipse.core.resources.IFile;
@@ -22,6 +23,7 @@
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
@@ -31,8 +33,15 @@
import org.eclipse.wst.html.ui.internal.wizard.NewHTMLWizard;
import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
import org.eclipse.wst.sse.core.utils.StringUtils;
+import org.jboss.tools.common.meta.action.XEntityData;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.wizard.newfile.NewXHTMLFileWizard;
+import org.jboss.tools.common.model.ui.wizards.standard.DefaultStandardStep;
import org.jboss.tools.jsf.ui.JsfUIMessages;
import org.jboss.tools.jsf.ui.JsfUiPlugin;
+import org.jboss.tools.jst.web.model.handlers.CreateJSPFileSupport;
/**
* @author mareshkau
@@ -45,6 +54,8 @@
private WizardNewFileCreationPage fNewFilePage;
private NewXHTMLTemplatesWizardPage fNewFileTemplatesPage;
+ private NewXHTMLFileWizard newXHTMLFileWizard;
+ private NewXHTMLWizardSelectTagLibrariesPage newXHTMLWizardSelectTagLibrariesPage;
@@ -58,11 +69,15 @@
this.fNewFileTemplatesPage = new NewXHTMLTemplatesWizardPage();
addPage(this.fNewFileTemplatesPage);
+ this.newXHTMLWizardSelectTagLibrariesPage = getURISelectionPage();
+ addPage(this.newXHTMLWizardSelectTagLibrariesPage);
}
@Override
public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) {
super.init(aWorkbench, aSelection);
setWindowTitle(JsfUIMessages.UI_WIZARD_XHTML_NEW_TITLE);
+ setNewXHTMLFileWizard(new NewXHTMLFileWizard());
+ getNewXHTMLFileWizard().init(aWorkbench, aSelection);
}
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#addPage(org.eclipse.jface.wizard.IWizardPage)
@@ -73,6 +88,17 @@
super.addPage(page);
}
}
+ private NewXHTMLWizardSelectTagLibrariesPage getURISelectionPage() {
+ SpecialWizardSupport support = getNewXHTMLFileWizard().getFileContext().getSupport();
+ NewXHTMLWizardSelectTagLibrariesPage step = new NewXHTMLWizardSelectTagLibrariesPage(support, 1);
+ try {
+ support.action(SpecialWizardSupport.NEXT);
+ } catch (XModelException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+ step.setWizard(this);
+ return step;
+ }
@Override
public boolean performFinish() {
boolean performedOK = false;
@@ -94,6 +120,11 @@
if (file != null) {
// put template contents into file
String templateString = fNewFileTemplatesPage.getTemplateString();
+ try {
+ templateString=((CreateJSPFileSupport)getNewXHTMLFileWizard().getFileContext().getSupport()).addTaglibs(templateString);
+ } catch (IOException ex) {
+ JsfUiPlugin.getDefault().logWarning("Problems with adding taglibs",ex); //$NON-NLS-1$
+ }
if (templateString != null) {
templateString = applyLineDelimiter(file, templateString);
// determine the encoding for the new file
@@ -152,4 +183,18 @@
});
}
}
+ /**
+ * @return the newXHTMLFileWizard
+ */
+ private NewXHTMLFileWizard getNewXHTMLFileWizard() {
+ return newXHTMLFileWizard;
+ }
+ /**
+ * @param newXHTMLFileWizard the newXHTMLFileWizard to set
+ */
+ private void setNewXHTMLFileWizard(NewXHTMLFileWizard newXHTMLFileWizard) {
+ this.newXHTMLFileWizard = newXHTMLFileWizard;
+ }
+
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java 2010-04-20 13:39:34 UTC (rev 21551)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/model/handlers/CreateJSPFileSupport.java 2010-04-20 14:04:37 UTC (rev 21552)
@@ -201,6 +201,13 @@
String[] selected = toArray(ts);
return taglibs.modifyBody(body, selected);
}
+ /**
+ * Added by Maksim Areshkau, method accessor for tmodifyBody()
+ * @param content
+ */
+ public String addTaglibs(String content) throws IOException{
+ return modifyBody(content);
+ }
String[] toArray(String s) {
if(s == null || s.length() == 0) return new String[0];
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java 2010-04-20 13:39:34 UTC (rev 21551)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/NewXHTMLPageWizardTest.java 2010-04-20 14:04:37 UTC (rev 21552)
@@ -46,6 +46,7 @@
this.bot.textWithLabel("File name:").setText("test"); //$NON-NLS-1$ //$NON-NLS-2$
this.bot.button(WidgetVariables.NEXT_BUTTON).click();
this.bot.checkBox("Use XHTML Template").click(); //$NON-NLS-1$
+ this.bot.button(WidgetVariables.NEXT_BUTTON).click();
this.bot.button(WidgetVariables.FINISH_BUTTON).click();
assertEquals("Active Editor Title should be" ,"test.xhtml", this.bot.activeEditor().getTitle()); //$NON-NLS-1$ //$NON-NLS-2$
}
14 years, 8 months
JBoss Tools SVN: r21551 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-04-20 09:39:34 -0400 (Tue, 20 Apr 2010)
New Revision: 21551
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6141
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java 2010-04-16 22:21:00 UTC (rev 21550)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java 2010-04-20 13:39:34 UTC (rev 21551)
@@ -49,6 +49,7 @@
import org.hibernate.console.ImageConstants;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.actions.AddConfigurationAction;
import org.hibernate.eclipse.console.utils.EclipseImages;
import org.hibernate.tool.hbm2x.HibernateConfigurationExporter;
@@ -142,14 +143,17 @@
HibernateConsolePlugin.getDefault().showError(getShell(), HibernateConsoleMessages.NewConfigurationWizard_error, realException);
return false;
}
-
- if (connectionInfoPage.isCreateConsoleConfigurationEnabled()) {
- try {
+
+ try {
+ if (connectionInfoPage.isCreateConsoleConfigurationEnabled()) {
confPage.performFinish();
- } catch (CoreException ce) {
- HibernateConsolePlugin.getDefault().showError(getShell(), HibernateConsoleMessages.AddConfigurationAction_problem_add_console_config, ce);
- }
- }
+ } else {
+ AddConfigurationAction.deleteTemporaryLaunchConfigurations();
+ }
+ } catch (CoreException ce) {
+ HibernateConsolePlugin.getDefault().showError(getShell(), HibernateConsoleMessages.AddConfigurationAction_problem_add_console_config, ce);
+ }
+
return true;
}
14 years, 8 months
JBoss Tools SVN: r21550 - branches/modular_build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-16 18:21:00 -0400 (Fri, 16 Apr 2010)
New Revision: 21550
Modified:
branches/modular_build/build.xml
branches/modular_build/genpom.xml
Log:
add TODO markers
Modified: branches/modular_build/build.xml
===================================================================
--- branches/modular_build/build.xml 2010-04-16 22:08:53 UTC (rev 21549)
+++ branches/modular_build/build.xml 2010-04-16 22:21:00 UTC (rev 21550)
@@ -83,7 +83,7 @@
">
<sequential>
<ant antfile="genpom.xml" target="run">
- <property name="COMPONENT" value="@{COMPONENT}"/>
+ <property name="COMPONENT" value="@{COMPONENT}" />
</ant>
</sequential>
</for>
@@ -113,6 +113,12 @@
</for>
</target>
+ <!-- TODO: generate site.xml files for components: gensite.xml script called by build.xml -->
+ <!-- TODO: zip up update site zips for each component; publish to download.jboss.org as part of deploy task -->
+ <target name="zip.sites">
+
+ </target>
+
<target name="deploy">
<!-- TODO enable publishing to download.jboss.org or porkchop.jboss.com
<get usetimestamp="true"
Modified: branches/modular_build/genpom.xml
===================================================================
--- branches/modular_build/genpom.xml 2010-04-16 22:08:53 UTC (rev 21549)
+++ branches/modular_build/genpom.xml 2010-04-16 22:21:00 UTC (rev 21550)
@@ -186,6 +186,7 @@
<packaging>${artifactType}</packaging>
</project>
</echo>
+ <!-- TODO: if generating module pom for a given platform, add in platform-specific stuff (see xulrunner) -->
<var name="artifactId" unset="true" />
<var name="artifactVersion" unset="true" />
<var name="artifactType" unset="true" />
14 years, 9 months
JBoss Tools SVN: r21549 - branches/modular_build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-16 18:08:53 -0400 (Fri, 16 Apr 2010)
New Revision: 21549
Modified:
branches/modular_build/genpom.xml
Log:
mark TODO - should be able to pull a value from the features rather than falling back to 0.0.0 in site.xml
Modified: branches/modular_build/genpom.xml
===================================================================
--- branches/modular_build/genpom.xml 2010-04-16 22:08:06 UTC (rev 21548)
+++ branches/modular_build/genpom.xml 2010-04-16 22:08:53 UTC (rev 21549)
@@ -144,7 +144,7 @@
<property name="dir" value="@{dir}" />
</antcallback>
<if>
- <!-- cannot calculate id and version for an update site so just set them to defaults -->
+ <!-- TODO: calculate id and version for an update site so just set them to defaults -->
<equals arg1="${artifactType}" arg2="eclipse-update-site" />
<then>
<var name="artifactId" unset="true" />
14 years, 9 months
JBoss Tools SVN: r21548 - branches/modular_build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-16 18:08:06 -0400 (Fri, 16 Apr 2010)
New Revision: 21548
Modified:
branches/modular_build/build.xml
Log:
fix per-component call to genpom.xml
Modified: branches/modular_build/build.xml
===================================================================
--- branches/modular_build/build.xml 2010-04-16 20:14:31 UTC (rev 21547)
+++ branches/modular_build/build.xml 2010-04-16 22:08:06 UTC (rev 21548)
@@ -83,8 +83,7 @@
">
<sequential>
<ant antfile="genpom.xml" target="run">
- <property name="WORKINGDIR" value="${WORKINGDIR}/@{COMPONENT}" />
- <property name="pathToParentPom" value="../" />
+ <property name="COMPONENT" value="@{COMPONENT}"/>
</ant>
</sequential>
</for>
@@ -108,7 +107,7 @@
<env key="MAVEN_OPTS" value="-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m" />
<!-- more debug output with <env key="MAVEN_OPTS" value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"/> -->
<!-- <arg line="-o -Dmaven.test.skip" /> -->
- <arg line="${MAVEN_FLAGS} -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository -fae clean install" />
+ <arg line="${MAVEN_FLAGS} -Dmaven.repo.local=${COMMON_TOOLS}/m2-repository -B -fae clean install" />
</exec>
</sequential>
</for>
14 years, 9 months
JBoss Tools SVN: r21547 - trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-04-16 16:14:31 -0400 (Fri, 16 Apr 2010)
New Revision: 21547
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added tests for disposer method validation.
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-16 20:00:59 UTC (rev 21546)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-16 20:14:31 UTC (rev 21547)
@@ -213,6 +213,16 @@
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/methodOnSessionBean/AppleTree.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, 31);
}
+
+ /**
+ * 3.3.7. Disposer method resolution
+ * TODO
+ *
+ * @throws Exception
+ */
+ public void testUnresolvedDisposalMethod() throws Exception {
+ //TODO
+ }
/**
* 3.9.1. Declaring an initializer method
14 years, 9 months
JBoss Tools SVN: r21546 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-04-16 16:00:59 -0400 (Fri, 16 Apr 2010)
New Revision: 21546
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ISessionBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/SessionBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added tests for disposer method validation.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2010-04-16 18:45:21 UTC (rev 21545)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2010-04-16 20:00:59 UTC (rev 21546)
@@ -43,6 +43,7 @@
public String STATEFUL_ANNOTATION_TYPE_NAME = "javax.ejb.Stateful";
public String STATELESS_ANNOTATION_TYPE_NAME = "javax.ejb.Stateless";
+ public String LOCAL_ANNOTATION_TYPE_NAME = "javax.ejb.Local";
public String RESOURCE_ANNOTATION_TYPE_NAME = "javax.annotation.Resource";
public String WEB_SERVICE_REF_ANNOTATION_TYPE_NAME = "javax.xml.ws.WebServiceRef";
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ISessionBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ISessionBean.java 2010-04-16 18:45:21 UTC (rev 21545)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ISessionBean.java 2010-04-16 20:00:59 UTC (rev 21546)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
-import org.eclipse.jdt.core.IAnnotation;
/**
* Represents a session bean.
@@ -31,5 +30,12 @@
*
* @return @Statefull annotaion declaration.
*/
- IAnnotation getStatefulDeclaration();
+ IAnnotationDeclaration getStatefulDeclaration();
+
+ /**
+ * Returns @Stateless annotaion declaration.
+ *
+ * @return @Stateless annotaion declaration.
+ */
+ IAnnotationDeclaration getStatelessDeclaration();
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/SessionBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/SessionBean.java 2010-04-16 18:45:21 UTC (rev 21545)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/SessionBean.java 2010-04-16 20:00:59 UTC (rev 21546)
@@ -1,17 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
-import org.eclipse.jdt.core.IAnnotation;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.ISessionBean;
public class SessionBean extends ClassBean implements ISessionBean {
- public IAnnotation getStatefulDeclaration() {
- AnnotationDeclaration stateful = getDefinition().getStatefulAnnotation();
- return stateful != null ? stateful.getDeclaration() : null;
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.ISessionBean#getStatefulDeclaration()
+ */
+ public IAnnotationDeclaration getStatefulDeclaration() {
+ return getDefinition().getStatefulAnnotation();
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.ISessionBean#getStatelessDeclaration()
+ */
+ public IAnnotationDeclaration getStatelessDeclaration() {
+ return getDefinition().getStatelessAnnotation();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.ISessionBean#isStateful()
+ */
public boolean isStateful() {
return getDefinition().getStatefulAnnotation() != null;
}
-
-}
+}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2010-04-16 18:45:21 UTC (rev 21545)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java 2010-04-16 20:00:59 UTC (rev 21546)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2009 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,
@@ -94,5 +94,4 @@
public AnnotationDeclaration getStatelessAnnotation() {
return annotationsByType.get(CDIConstants.STATELESS_ANNOTATION_TYPE_NAME);
}
-
-}
+}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-04-16 18:45:21 UTC (rev 21545)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-04-16 20:00:59 UTC (rev 21546)
@@ -26,7 +26,10 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.wst.validation.internal.core.ValidationException;
@@ -51,11 +54,13 @@
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.cdi.core.IScope;
import org.jboss.tools.cdi.core.IScopeDeclaration;
+import org.jboss.tools.cdi.core.ISessionBean;
import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.core.IStereotypeDeclaration;
import org.jboss.tools.cdi.core.IStereotyped;
import org.jboss.tools.cdi.core.ITypeDeclaration;
import org.jboss.tools.cdi.core.preferences.CDIPreferences;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.jst.web.kb.KbProjectFactory;
@@ -359,9 +364,61 @@
addError(CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, CDIPreferences.DISPOSER_ANNOTATED_INJECT, declaration, bean.getResource());
}
}
+
+ /*
+ * 3.3.6. Declaring a disposer method
+ * - a non-static method of a session bean class has a parameter annotated @Disposes, and the method is not a business method of the session bean
+ */
+ validateSessionBeanMethod(bean, disposer, disposerDeclarations, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, CDIPreferences.ILLEGAL_DISPOSER_IN_SESSION_BEAN);
}
}
+ /**
+ * If the method is not a static method and is not a business method of the session bean and is observer or disposer then mark it as incorrect.
+ *
+ * @param bean
+ * @param method
+ * @param annotatedParams
+ * @param errorKey
+ */
+ private void validateSessionBeanMethod(IClassBean bean, IBeanMethod method, Set<IAnnotationDeclaration> annotatedParams, String errorMessageKey, String preferencesKey) {
+ if(bean instanceof ISessionBean) {
+ if(annotatedParams!=null) {
+ try {
+ if(!Flags.isStatic(method.getMethod().getFlags())) {
+ ISessionBean sessionBean = (ISessionBean)bean;
+ Set<IParametedType> types = sessionBean.getLegalTypes();
+ boolean businessMethod = false;
+ for (IParametedType type : types) {
+ IType sourceType = type.getType();
+ IAnnotation annotation = sourceType.getAnnotation(CDIConstants.LOCAL_ANNOTATION_TYPE_NAME);
+ if(annotation==null) {
+ annotation = sourceType.getAnnotation("Local"); //$NON-NLS-N1
+ if(annotation!=null && CDIConstants.LOCAL_ANNOTATION_TYPE_NAME.equals(EclipseJavaUtil.resolveType(sourceType, "Local"))) { //$NON-NLS-N1
+ IMethod[] methods = sourceType.getMethods();
+ for (IMethod iMethod : methods) {
+ if(method.getMethod().isSimilar(iMethod)) {
+ businessMethod = true;
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+ if(!businessMethod) {
+ for (IAnnotationDeclaration declaration : annotatedParams) {
+ addError(errorMessageKey, preferencesKey, declaration, bean.getResource());
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
+ }
+ }
+
private static final String[] RESOURCE_ANNOTATIONS = {CDIConstants.RESOURCE_ANNOTATION_TYPE_NAME, CDIConstants.WEB_SERVICE_REF_ANNOTATION_TYPE_NAME, CDIConstants.EJB_ANNOTATION_TYPE_NAME, CDIConstants.PERSISTENCE_CONTEXT_ANNOTATION_TYPE_NAME, CDIConstants.PERSISTENCE_UNIT_ANNOTATION_TYPE_NAME};
private void validateProducer(IProducer producer) {
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-04-16 18:45:21 UTC (rev 21545)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-04-16 20:00:59 UTC (rev 21546)
@@ -83,7 +83,7 @@
// {CDIPreferences.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalProducerMethodInSessionBean_label},
{CDIPreferences.MULTIPLE_DISPOSING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposingParameters_label},
{CDIPreferences.DISPOSER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerAnnotatedInject_label},
-// {CDIPreferences.ILLEGAL_DISPOSER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalDisposerInSessionBean_label},
+ {CDIPreferences.ILLEGAL_DISPOSER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalDisposerInSessionBean_label},
// {CDIPreferences.NO_PRODUCER_MATCHING_DISPOSER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_noProducerMatchingDisposer_label},
// {CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposersForProducer_label},
// {CDIPreferences.ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalProducerFieldInSessionBean_label},
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-16 18:45:21 UTC (rev 21545)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-16 20:00:59 UTC (rev 21546)
@@ -204,6 +204,17 @@
}
/**
+ * 3.3.6. Declaring a disposer method
+ * - a non-static method of a session bean class has a parameter annotated @Disposes, and the method is not a business method of the session bean
+ *
+ * @throws Exception
+ */
+ public void testDisposalMethodNotBusinessOrStatic() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/methodOnSessionBean/AppleTree.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, 31);
+ }
+
+ /**
* 3.9.1. Declaring an initializer method
* - an initializer method has a parameter annotated @Disposes
*
14 years, 9 months
JBoss Tools SVN: r21545 - in trunk/cdi: plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-04-16 14:45:21 -0400 (Fri, 16 Apr 2010)
New Revision: 21545
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Added tests for disposer method validation.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-04-16 18:22:54 UTC (rev 21544)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-04-16 18:45:21 UTC (rev 21545)
@@ -305,41 +305,38 @@
private void validateDisposers(IClassBean bean) {
Set<IBeanMethod> disposers = bean.getDisposers();
- for (IBeanMethod dssposer : disposers) {
- List<IParameter> params = dssposer.getParameters();
+ for (IBeanMethod disposer : disposers) {
+ List<IParameter> params = disposer.getParameters();
/*
* 3.3.6. Declaring a disposer method
* - method has more than one parameter annotated @Disposes
*/
- Set<IAnnotationDeclaration> declarations = new HashSet<IAnnotationDeclaration>();
+ Set<IAnnotationDeclaration> disposerDeclarations = new HashSet<IAnnotationDeclaration>();
for (IParameter param : params) {
IAnnotationDeclaration declaration = param.getAnnotation(CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
if(declaration!=null) {
- declarations.add(declaration);
+ disposerDeclarations.add(declaration);
}
}
- if(declarations.size()>1) {
- for (IAnnotationDeclaration declaration : declarations) {
+ if(disposerDeclarations.size()>1) {
+ for (IAnnotationDeclaration declaration : disposerDeclarations) {
addError(CDIValidationMessages.MULTIPLE_DISPOSING_PARAMETERS, CDIPreferences.MULTIPLE_DISPOSING_PARAMETERS, declaration, bean.getResource());
}
}
/*
* 3.3.6. Declaring a disposer method
- * - a disposer method is annotated @Observes.
+ * - a disposer method has a parameter annotated @Observes.
*
* 10.4.2. Declaring an observer method
- * - a observer method is annotated @Disposes.
+ * - a observer method has a parameter annotated @Disposes.
*/
- declarations = new HashSet<IAnnotationDeclaration>();
+ Set<IAnnotationDeclaration> declarations = new HashSet<IAnnotationDeclaration>();
boolean observesExists = false;
+ declarations.addAll(disposerDeclarations);
for (IParameter param : params) {
- IAnnotationDeclaration declaration = param.getAnnotation(CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
+ IAnnotationDeclaration declaration = param.getAnnotation(CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
if(declaration!=null) {
declarations.add(declaration);
- }
- declaration = param.getAnnotation(CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
- if(declaration!=null) {
- declarations.add(declaration);
observesExists = true;
}
}
@@ -348,6 +345,20 @@
addError(CDIValidationMessages.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferences.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, declaration, bean.getResource());
}
}
+ /*
+ * 3.3.6. Declaring a disposer method
+ * - a disposer method is annotated @Inject.
+ *
+ * 3.9.1. Declaring an initializer method
+ * - an initializer method has a parameter annotated @Disposes
+ */
+ IAnnotationDeclaration injectDeclaration = disposer.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+ if(injectDeclaration!=null) {
+ addError(CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, CDIPreferences.DISPOSER_ANNOTATED_INJECT, injectDeclaration, bean.getResource());
+ for (IAnnotationDeclaration declaration : disposerDeclarations) {
+ addError(CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, CDIPreferences.DISPOSER_ANNOTATED_INJECT, declaration, bean.getResource());
+ }
+ }
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-04-16 18:22:54 UTC (rev 21544)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2010-04-16 18:45:21 UTC (rev 21545)
@@ -82,7 +82,7 @@
{CDIPreferences.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerParameterIllegallyAnnotated_label},
// {CDIPreferences.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalProducerMethodInSessionBean_label},
{CDIPreferences.MULTIPLE_DISPOSING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposingParameters_label},
-// {CDIPreferences.DISPOSER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerAnnotatedInject_label},
+ {CDIPreferences.DISPOSER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerAnnotatedInject_label},
// {CDIPreferences.ILLEGAL_DISPOSER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalDisposerInSessionBean_label},
// {CDIPreferences.NO_PRODUCER_MATCHING_DISPOSER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_noProducerMatchingDisposer_label},
// {CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposersForProducer_label},
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-16 18:22:54 UTC (rev 21544)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-16 18:45:21 UTC (rev 21545)
@@ -193,6 +193,28 @@
}
/**
+ * 3.3.6. Declaring a disposer method
+ * - a disposer method is annotated @Inject.
+ *
+ * @throws Exception
+ */
+ public void testInitializerUnallowed() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/initializerUnallowed/SpiderProducer_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 32, 33);
+ }
+
+ /**
+ * 3.9.1. Declaring an initializer method
+ * - an initializer method has a parameter annotated @Disposes
+ *
+ * @throws Exception
+ */
+ public void testInitializerMethodHasParameterAnnotatedDisposes() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/initializer/broken/parameterAnnotatedDisposes/Capercaillie_Broken.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 25, 26);
+ }
+
+ /**
* 3.3.2. Declaring a producer method
* - a producer method has a parameter annotated @Disposes
*
14 years, 9 months
JBoss Tools SVN: r21544 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2010-04-16 14:22:54 -0400 (Fri, 16 Apr 2010)
New Revision: 21544
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java
Log:
JBIDE-6192: NullPointerException occures while calculating EL text hover
issue is fixed for the Java String EL Hovers
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java 2010-04-16 16:40:29 UTC (rev 21543)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/JavaStringELInfoHover.java 2010-04-16 18:22:54 UTC (rev 21544)
@@ -248,7 +248,9 @@
ELResolver[] resolvers = context.getElResolvers();
for (int i = 0; resolvers != null && i < resolvers.length; i++) {
- ELResolution resolution = resolvers[i].resolve(context, ie, region.getOffset() + region.getLength());
+ ELResolution resolution = resolvers[i] == null ? null : resolvers[i].resolve(context, ie, region.getOffset() + region.getLength());
+ if (resolution == null)
+ continue;
ELSegment segment = resolution.getLastSegment();
if(segment instanceof JavaMemberELSegmentImpl) {
14 years, 9 months