diff options
author | cbateman | 2009-01-27 23:35:54 +0000 |
---|---|---|
committer | cbateman | 2009-01-27 23:35:54 +0000 |
commit | ec60fe6b761922741e360e68f2cf6d87b758f36a (patch) | |
tree | 79a19c8bfec31409350c58a3a150abf8e44834d1 | |
parent | e36b956869569f096c03e2595d233e578284dd4f (diff) | |
download | webtools.jsf-ec60fe6b761922741e360e68f2cf6d87b758f36a.tar.gz webtools.jsf-ec60fe6b761922741e360e68f2cf6d87b758f36a.tar.xz webtools.jsf-ec60fe6b761922741e360e68f2cf6d87b758f36a.zip |
Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=234709.
3 files changed, 51 insertions, 24 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java index 2f6181642..f8e7f1e6a 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java +++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/symbols/DefaultBeanSymbolSourceProvider.java @@ -131,14 +131,17 @@ public class DefaultBeanSymbolSourceProvider { final String name = bean.getManagedBeanName().getTextContent(); final String detailedDescription = createAdditionalProposalInfo(bean); - IBeanInstanceSymbol symbol = SymbolFactory.eINSTANCE.createIBeanInstanceSymbol(); + final IBeanInstanceSymbol symbol = SymbolFactory.eINSTANCE.createIBeanInstanceSymbol(); symbol.setName(name); + if (detailedDescription.length() > 0) symbol.setDetailedDescription(detailedDescription); symbol.setRuntimeSource(ERuntimeSource.MANAGED_BEAN_SYMBOL_LITERAL); try { IJavaProject javaProject = JavaCore.create(iProject); - IType type = javaProject.findType(bean.getManagedBeanClass().getTextContent()); + final String typeName = bean.getManagedBeanClass() != null? + bean.getManagedBeanClass().getTextContent() : ""; + final IType type = javaProject.findType(typeName); // don't bother setting a type descriptor if we // can't find a type @@ -164,20 +167,37 @@ public class DefaultBeanSymbolSourceProvider private String createAdditionalProposalInfo(ManagedBeanType beanType) { - StringBuffer additionalInfo = new StringBuffer("<p><b>"); //$NON-NLS-1$ - additionalInfo.append(Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Name")); //$NON-NLS-1$ - additionalInfo.append(" </b>"); //$NON-NLS-1$ - additionalInfo.append(beanType.getManagedBeanName().getTextContent()); - additionalInfo.append("</p><p><b>"); //$NON-NLS-1$ - additionalInfo.append(Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Type")); //$NON-NLS-1$ - additionalInfo.append(" </b>"); //$NON-NLS-1$ - additionalInfo.append(beanType.getManagedBeanClass().getTextContent()); - additionalInfo.append("</p><p><b>"); //$NON-NLS-1$ - additionalInfo.append(Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Scope")); //$NON-NLS-1$ - additionalInfo.append(" </b>"); //$NON-NLS-1$ - additionalInfo.append(beanType.getManagedBeanScope().getTextContent()); - additionalInfo.append("</p>"); //$NON-NLS-1$ + final String beanName = beanType.getManagedBeanName() != null ? + beanType.getManagedBeanName().getTextContent() : null; + + StringBuffer additionalInfo = new StringBuffer(); //$NON-NLS-1$ + if (beanName != null) + { + additionalInfo.append("<p><b>"+Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Name")); //$NON-NLS-1$ + additionalInfo.append(" </b>"); //$NON-NLS-1$ + additionalInfo.append(beanName); + additionalInfo.append("</p>"); //$NON-NLS-1$ + } + + final String beanClass = beanType.getManagedBeanClass() != null ? + beanType.getManagedBeanClass().getTextContent() : null; + if (beanClass != null) + { + additionalInfo.append("<p><b>"+Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Type")); //$NON-NLS-1$ + additionalInfo.append(" </b>"); //$NON-NLS-1$ + additionalInfo.append(beanClass); + additionalInfo.append("</p>"); //$NON-NLS-1$ + } + final String beanScope = beanType.getManagedBeanScope() != null ? + beanType.getManagedBeanScope().getTextContent() : null; + if (beanScope != null) + { + additionalInfo.append("<p><b>"+Messages.getString("DefaultBeanSymbolSourceProvider.AdditionalInformation.Scope")); //$NON-NLS-1$ + additionalInfo.append(" </b>"); //$NON-NLS-1$ + additionalInfo.append(beanScope); + additionalInfo.append("</p>"); //$NON-NLS-1$ + } StringBuffer descBuffer = new StringBuffer(); for (final Iterator it = beanType.getDescription().iterator(); it.hasNext();) diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig/facesconfig/org/eclipse/jst/jsf/facesconfig/edit/provider/ManagedBeanTypeItemProvider.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig/facesconfig/org/eclipse/jst/jsf/facesconfig/edit/provider/ManagedBeanTypeItemProvider.java index 6c9c09910..fe751e98c 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig/facesconfig/org/eclipse/jst/jsf/facesconfig/edit/provider/ManagedBeanTypeItemProvider.java +++ b/jsf/plugins/org.eclipse.jst.jsf.facesconfig/facesconfig/org/eclipse/jst/jsf/facesconfig/edit/provider/ManagedBeanTypeItemProvider.java @@ -226,9 +226,10 @@ public class ManagedBeanTypeItemProvider public String getText(Object object) { String label = null; if (((ManagedBeanType) object).getManagedBeanName() != null) + { label = ((ManagedBeanType) object).getManagedBeanName() .getTextContent(); - + } if (label == null || label.length() == 0) { if (((ManagedBeanType) object).getManagedBeanClass() != null) label = ((ManagedBeanType) object).getManagedBeanClass() diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/actions/JSFAddActionGroup.java b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/actions/JSFAddActionGroup.java index bd2ed892f..52883b8b3 100644 --- a/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/actions/JSFAddActionGroup.java +++ b/jsf/plugins/org.eclipse.jst.pagedesigner.jsf.ui/src/org/eclipse/jst/pagedesigner/jsf/ui/actions/JSFAddActionGroup.java @@ -176,7 +176,10 @@ public class JSFAddActionGroup { ValidatorType validator = (ValidatorType) it.next(); ValidatorIdType validatorId = validator.getValidatorId(); if (validatorId != null) - result[i++] = validatorId.getTextContent().trim(); + { + result[i++] = validatorId.getTextContent() != null ? + validatorId.getTextContent().trim() : ""; + } } } return result; @@ -196,15 +199,18 @@ public class JSFAddActionGroup { if (appConfigMgr != null) { final List list = appConfigMgr.getConverters(); - result = new String[list.size()]; + result = new String[list.size()]; int i = 0; - for (final Iterator it = list.iterator(); it.hasNext();) + for (final Iterator it = list.iterator(); it.hasNext();) { - ConverterType converter = (ConverterType) it.next(); - ConverterIdType converterId = converter.getConverterId(); - if (converterId != null) - result[i++] = converterId.getTextContent().trim(); - } + ConverterType converter = (ConverterType) it.next(); + ConverterIdType converterId = converter.getConverterId(); + if (converterId != null) + { + result[i++] = converterId.getTextContent() != null ? + converterId.getTextContent().trim() : ""; + } + } } return result; } |