diff options
author | spingel | 2009-10-15 23:05:50 +0000 |
---|---|---|
committer | spingel | 2009-10-15 23:05:50 +0000 |
commit | 6b12595d404d74890c5fffdf12994459f781f1e3 (patch) | |
tree | 47b94498eb9789a20e9b66411f7b3659ccb51d70 | |
parent | e40216638ed9292c2d7339e5a47bd12495d512b5 (diff) | |
download | org.eclipse.mylyn.tasks-6b12595d404d74890c5fffdf12994459f781f1e3.tar.gz org.eclipse.mylyn.tasks-6b12595d404d74890c5fffdf12994459f781f1e3.tar.xz org.eclipse.mylyn.tasks-6b12595d404d74890c5fffdf12994459f781f1e3.zip |
REOPENED - bug 291991: allow sections to be nestedR_3_3_0_e_3_4R_3_3_0
https://bugs.eclipse.org/bugs/show_bug.cgi?id=291991
-rw-r--r-- | org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java index 6c813b7b3..819655e7f 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java @@ -782,10 +782,9 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe createParts(PATH_PEOPLE, bottomComposite, descriptors); bottomComposite.pack(true); - createSubParts(descriptors); } - private void createParts(String path, final Composite parent, Collection<TaskEditorPartDescriptor> descriptors) { + private void createParts(String path, final Composite parent, final Collection<TaskEditorPartDescriptor> descriptors) { for (Iterator<TaskEditorPartDescriptor> it = descriptors.iterator(); it.hasNext();) { final TaskEditorPartDescriptor descriptor = it.next(); if (path == null || path.equals(descriptor.getPath())) { @@ -798,7 +797,7 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe public void run() throws Exception { AbstractTaskEditorPart part = descriptor.createPart(); part.setPartId(descriptor.getId()); - initializePart(parent, part); + initializePart(parent, part, descriptors); } }); it.remove(); @@ -806,16 +805,15 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe } } - private void createSubParts(Collection<TaskEditorPartDescriptor> descriptors) { - for (Iterator<TaskEditorPartDescriptor> it = descriptors.iterator(); it.hasNext();) { - final TaskEditorPartDescriptor descriptor = it.next(); + private void createSubParts(final AbstractTaskEditorSection parentPart, + final Collection<TaskEditorPartDescriptor> descriptors) { + for (final TaskEditorPartDescriptor descriptor : descriptors) { int i; String path = descriptor.getPath(); if (path != null && (i = path.indexOf("/")) != -1) { //$NON-NLS-1$ String parentId = path.substring(0, i); final String subPath = path.substring(i + 1); - final AbstractTaskEditorPart parentPart = getPart(parentId); - if (parentPart instanceof AbstractTaskEditorSection) { + if (parentId.equals(parentPart.getPartId())) { SafeRunner.run(new ISafeRunnable() { public void handleException(Throwable e) { StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, @@ -825,11 +823,11 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe public void run() throws Exception { AbstractTaskEditorPart part = descriptor.createPart(); part.setPartId(descriptor.getId()); - initializePart(null, part); - ((AbstractTaskEditorSection) parentPart).addSubPart(subPath, part); + getManagedForm().addPart(part); + part.initialize(AbstractTaskEditorPage.this); + parentPart.addSubPart(subPath, part); } }); - it.remove(); } } } @@ -1225,9 +1223,13 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe } } - private void initializePart(Composite parent, AbstractTaskEditorPart part) { + private void initializePart(Composite parent, AbstractTaskEditorPart part, + Collection<TaskEditorPartDescriptor> descriptors) { getManagedForm().addPart(part); part.initialize(this); + if (part instanceof AbstractTaskEditorSection) { + createSubParts((AbstractTaskEditorSection) part, descriptors); + } if (parent != null) { part.createControl(parent, toolkit); if (part.getControl() != null) { |