Browse files

IDE-1235: fixed bug in AOP support that was introduced by adding the …

…profile support (beans are now always nested inside a component in the core beans model)
  • Loading branch information...
1 parent db96ec0 commit c7f9597c1711f1a3230c62c35b97e478b934a49f @cdupuis cdupuis committed Feb 15, 2012
View
9 ...mework/ide/eclipse/aop/core/internal/model/builder/AnnotationAspectDefinitionBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Spring IDE Developers
+ * Copyright (c) 2007, 2012 Spring IDE Developers
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -150,11 +150,12 @@ private void parseAnnotationAspects(IDOMDocument document, IBeansConfig beansCon
}
List<IAspectDefinition> aspectDefinitions = new ArrayList<IAspectDefinition>();
-
- for (IBean bean : beansConfig.getBeans()) {
+
+ // make sure to iterate into all the beans nested inside components etc.
+ for (IBean bean : BeansModelUtils.getBeans(beansConfig)) {
parseAnnotationAspectFromSingleBean(beansConfig, classLoaderSupport, aspectDefinitions, configuration, bean);
}
-
+
if (configuration.isProxyTargetClass()) {
for (IAspectDefinition def : aspectDefinitions) {
((BeanAspectDefinition) def).setProxyTargetClass(configuration.isProxyTargetClass());
View
12 ...ringframework/ide/eclipse/aop/ui/navigator/AopReferenceModelNavigatorContentProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 Spring IDE Developers
+ * Copyright (c) 2006, 2012 Spring IDE Developers
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,8 +40,8 @@
import org.springframework.ide.eclipse.aop.core.internal.model.builder.AopReferenceModelBuilderJob;
import org.springframework.ide.eclipse.aop.core.model.IAopModelChangedListener;
import org.springframework.ide.eclipse.aop.core.model.IAopReference;
-import org.springframework.ide.eclipse.aop.core.model.IAspectDefinition;
import org.springframework.ide.eclipse.aop.core.model.IAopReference.ADVICE_TYPE;
+import org.springframework.ide.eclipse.aop.core.model.IAspectDefinition;
import org.springframework.ide.eclipse.aop.core.util.AopReferenceModelUtils;
import org.springframework.ide.eclipse.aop.ui.navigator.model.AdviceDeclareParentAopSourceNode;
import org.springframework.ide.eclipse.aop.ui.navigator.model.BeanReferenceNode;
@@ -261,13 +261,7 @@ else if (parentElement instanceof ElementImpl) {
int endLine = document.getLineOfOffset(element.getEndOffset()) + 1;
String id = BeansEditorUtils.getAttribute(element, "id");
- nodes.addAll(getChildrenFromXmlLocation(resource, startLine, endLine, id, beansConfig.getBeans()));
-
- // add inner beans
- if (nodes.size() == 0) {
- nodes.addAll(getChildrenFromXmlLocation(resource, startLine, endLine, id, BeansModelUtils
- .getInnerBeans(beansConfig)));
- }
+ nodes.addAll(getChildrenFromXmlLocation(resource, startLine, endLine, id, BeansModelUtils.getBeans(beansConfig)));
return nodes.toArray();
}
View
20 ...s.core/src/org/springframework/ide/eclipse/beans/core/internal/model/BeansModelUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 Spring IDE Developers
+ * Copyright (c) 2005, 2012 Spring IDE Developers
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -269,7 +269,7 @@ public static String getBeanClassFromContext(IBean bean, IModelElement context)
monitor = new NullProgressMonitor();
}
- Set<IBean> beans = new LinkedHashSet<IBean>();
+ final Set<IBean> beans = new LinkedHashSet<IBean>();
if (element instanceof IBeansModel) {
Set<IBeansProject> projects = ((IBeansModel) element).getProjects();
monitor.beginTask("Locating bean definitions", projects.size());
@@ -278,13 +278,21 @@ public static String getBeanClassFromContext(IBean bean, IModelElement context)
monitor.subTask("Locating bean definitions in project '" + project.getElementName() + "'");
for (IBeansConfig config : project.getConfigs()) {
monitor.subTask("Locating bean defintions from file '" + config.getElementName() + "'");
- beans.addAll(config.getBeans());
+
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
- for (IBeansComponent component : config.getComponents()) {
- beans.addAll(component.getBeans());
- }
+
+ config.accept(new IModelElementVisitor() {
+
+ public boolean visit(IModelElement element, IProgressMonitor monitor) {
+ if (element instanceof IBean) {
+ beans.add((IBean) element);
+ }
+ return !monitor.isCanceled();
+ }
+ }, new NullProgressMonitor());
+
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}

0 comments on commit c7f9597

Please sign in to comment.