diff options
author | fbecker | 2010-02-11 19:48:11 +0000 |
---|---|---|
committer | fbecker | 2010-02-11 19:48:11 +0000 |
commit | 4c9c38c2c0985f853044a87cddc7e44ed8962eb0 (patch) | |
tree | 4035e347ffa98ca909a6215f2cb0374a921dbede | |
parent | 1a3adf8d7cce10e3db191ec37a2d7a04967444bd (diff) | |
download | org.eclipse.mylyn.tasks-4c9c38c2c0985f853044a87cddc7e44ed8962eb0.tar.gz org.eclipse.mylyn.tasks-4c9c38c2c0985f853044a87cddc7e44ed8962eb0.tar.xz org.eclipse.mylyn.tasks-4c9c38c2c0985f853044a87cddc7e44ed8962eb0.zip |
ASSIGNED - bug 297437: Support for patch review through Mylyn for Bugzilla
https://bugs.eclipse.org/bugs/show_bug.cgi?id=297437
3 files changed, 77 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskAttachmentPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskAttachmentPage.java index 9aa73c0a0..2f42c1865 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskAttachmentPage.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskAttachmentPage.java @@ -72,7 +72,7 @@ public class BugzillaTaskAttachmentPage extends TaskAttachmentPage { BugzillaAttribute.PRODUCT.getKey()); TaskAttribute componentAttribute = getModel().getAttribute().getTaskData().getRoot().getMappedAttribute( BugzillaAttribute.COMPONENT.getKey()); - Control[] children = parent.getChildren(); + Control[] children = getScrolledBodyComposite().getChildren(); Composite pageComposite = (Composite) children[children.length - 1]; Composite flagComposite = null; for (BugzillaFlag bugzillaFlag : flags) { @@ -152,7 +152,10 @@ public class BugzillaTaskAttachmentPage extends TaskAttachmentPage { }); } } + Label dummy = new Label(pageComposite, SWT.NONE); + dummy.setText(""); //$NON-NLS-1$ } + updateSize4ScrolledComposite(); } private Composite createFlagSection(Composite container) { @@ -168,6 +171,7 @@ public class BugzillaTaskAttachmentPage extends TaskAttachmentPage { flagExpandComposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { + updateSize4ScrolledComposite(); getControl().getShell().pack(); } }); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/ScrollableWizardPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/ScrollableWizardPage.java new file mode 100644 index 000000000..9afaa7c23 --- /dev/null +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/ScrollableWizardPage.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2010 Frank Becker and others. + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Frank Becker - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.internal.tasks.ui.wizards; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; + +public abstract class ScrollableWizardPage extends WizardPage { + + private ScrolledComposite scrolledComposite; + + private Composite scrolledBodyComposite; + + public ScrollableWizardPage(String pageName) { + super(pageName); + } + + public void createControl(Composite parent) { + createScrolledComposite(parent); + updateSize4ScrolledComposite(); + } + + protected void updateSize4ScrolledComposite() { + scrolledComposite.setMinSize(scrolledBodyComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)); + } + + protected void createScrolledComposite(Composite parent) { + scrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL /*| SWT.BORDER*/) { + @Override + public Point computeSize(int hint, int hint2, boolean changed) { + return new Point(64, 64); + } + }; + scrolledComposite.setExpandHorizontal(true); + scrolledComposite.setExpandVertical(true); + scrolledBodyComposite = new Composite(scrolledComposite, SWT.NONE); + scrolledBodyComposite.setLayout(new GridLayout()); + scrolledComposite.setContent(scrolledBodyComposite); + setControl(scrolledComposite); + Dialog.applyDialogFont(scrolledBodyComposite); + } + + public Composite getScrolledBodyComposite() { + return scrolledBodyComposite; + } + +} diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java index c39c562de..9c316ef49 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java @@ -13,7 +13,6 @@ package org.eclipse.mylyn.tasks.ui.wizards; import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.wizard.WizardPage; import org.eclipse.mylyn.context.core.ContextCore; import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport; @@ -21,6 +20,7 @@ import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource; import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor; import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions; import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages; +import org.eclipse.mylyn.internal.tasks.ui.wizards.ScrollableWizardPage; import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper; import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel; import org.eclipse.mylyn.tasks.ui.TasksUiImages; @@ -52,7 +52,7 @@ import org.eclipse.ui.handlers.IHandlerService; * @author Steffen Pingel * @since 3.0 */ -public class TaskAttachmentPage extends WizardPage { +public class TaskAttachmentPage extends ScrollableWizardPage { private Button attachContextButton; @@ -92,8 +92,10 @@ public class TaskAttachmentPage extends WizardPage { setNeedsDescription(true); } + @Override public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); + super.createControl(parent); + Composite composite = new Composite(getScrolledBodyComposite(), SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 3; composite.setLayout(gridLayout); @@ -155,7 +157,10 @@ public class TaskAttachmentPage extends WizardPage { }; }; commentEditor.createControl(composite, null); - commentEditor.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); + GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); + gd.heightHint = 120; + gd.widthHint = 400; + commentEditor.getControl().setLayoutData(gd); IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class); if (handlerService != null) { @@ -259,6 +264,8 @@ public class TaskAttachmentPage extends WizardPage { } Dialog.applyDialogFont(composite); + composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + updateSize4ScrolledComposite(); } private void validate() { |