Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 434269 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/text/javadoc/JavadocContentAccess2.java (-18 / +22 lines)
Lines 618-646 Link Here
618
		// XXX: should not do this by default (but we don't have settings for Javadoc, see https://bugs.eclipse.org/424283 )
618
		// XXX: should not do this by default (but we don't have settings for Javadoc, see https://bugs.eclipse.org/424283 )
619
		if (member instanceof IMethod) {
619
		if (member instanceof IMethod) {
620
			String name= member.getElementName();
620
			String name= member.getElementName();
621
			boolean isGetter= name.startsWith("get"); //$NON-NLS-1$
621
			boolean isGetter= name.startsWith("get") && name.length() > 3; //$NON-NLS-1$
622
			boolean isSetter= name.startsWith("set"); //$NON-NLS-1$
622
			boolean isBooleanGetter= name.startsWith("is") && name.length() > 2; //$NON-NLS-1$
623
			boolean isProperty= name.endsWith("Property"); //$NON-NLS-1$
623
			boolean isSetter= name.startsWith("set") && name.length() > 3; //$NON-NLS-1$
624
			if (isGetter || isSetter || isProperty) {
624
625
				String propertyName= null;
625
			if (isGetter || isBooleanGetter || isSetter) {
626
				if (isGetter || isSetter) {
626
				String propertyName= firstToLower(name.substring(isBooleanGetter ? 2 : 3));
627
					propertyName= firstToLower(name.substring(3));
627
				IType type= member.getDeclaringType();
628
				} else {
628
				IMethod method= type.getMethod(propertyName + "Property", new String[0]); //$NON-NLS-1$
629
					propertyName= name.substring(0, name.length() - 8);
629
630
				if (method.exists()) {
631
					String content= getHTMLContentFromSource(method);
632
					if (content != null) {
633
						if (isSetter) {
634
							content= Messages.format(JavaDocMessages.JavadocContentAccess2_setproperty_message, new Object[] { propertyName, content });
635
						} else {
636
							content= Messages.format(JavaDocMessages.JavadocContentAccess2_getproperty_message, new Object[] { propertyName, content });
637
						}
638
					}
639
					return content;
630
				}
640
				}
641
			} else if (name.endsWith("Property")) { //$NON-NLS-1$
642
				String propertyName= name.substring(0, name.length() - 8);
631
643
632
				IType type= member.getDeclaringType();
644
				IType type= member.getDeclaringType();
633
				IField field= type.getField(propertyName);
645
				IField field= type.getField(propertyName);
634
				if (field.exists()) {
646
				if (field.exists()) {
635
					String content= getHTMLContentFromSource(field);
647
					return getHTMLContentFromSource(field);
636
					if (content != null) {
637
						if (isGetter) {
638
							content= Messages.format(JavaDocMessages.JavadocContentAccess2_getproperty_message, new Object[] { propertyName, content });
639
						} else if (isSetter) {
640
							content= Messages.format(JavaDocMessages.JavadocContentAccess2_setproperty_message, new Object[] { propertyName, content });
641
						}
642
					}
643
					return content;
644
				}
648
				}
645
			}
649
			}
646
		}
650
		}

Return to bug 434269