Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-09-01 22:08:03 -0400
committerspingel2010-09-01 22:08:03 -0400
commita7d2528b266ad6295051bd8107ebeaf26453af5d (patch)
tree2562f5c118756e06ec00a6b62fc72f60d094b7ee
parent3a0429389854d4f0f18d1f6de684f5419af03df2 (diff)
downloadorg.eclipse.mylyn.tasks-a7d2528b266ad6295051bd8107ebeaf26453af5d.tar.gz
org.eclipse.mylyn.tasks-a7d2528b266ad6295051bd8107ebeaf26453af5d.tar.xz
org.eclipse.mylyn.tasks-a7d2528b266ad6295051bd8107ebeaf26453af5d.zip
ASSIGNED - bug 315921: [patch] fix attachment details nits
https://bugs.eclipse.org/bugs/show_bug.cgi?id=315921
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaAttachmentUpdateAction.java22
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java12
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizardPage.java235
4 files changed, 149 insertions, 122 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java
index 83a3f61c9..b8da4a020 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java
@@ -33,6 +33,8 @@ public class BugzillaUiPlugin extends AbstractUIPlugin {
public static final String ID_PLUGIN = "org.eclipse.mylyn.bugzilla.ui"; //$NON-NLS-1$
+ public static final String ATTACHMENT_WIZARD_SETTINGS_SECTION = "BugzillaAttachmentWizard."; //$NON-NLS-1$
+
public static final String SEARCH_PAGE_ID = BugzillaUiPlugin.ID_PLUGIN + ".search.bugzillaSearchPage"; //$NON-NLS-1$
public static final String SEARCH_PAGE_CONTEXT = BugzillaUiPlugin.ID_PLUGIN + ".bugzillaSearchContext"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaAttachmentUpdateAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaAttachmentUpdateAction.java
index a9fdbb26c..64d4147ad 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaAttachmentUpdateAction.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaAttachmentUpdateAction.java
@@ -14,9 +14,11 @@ package org.eclipse.mylyn.internal.bugzilla.ui.action;
import java.util.List;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
+import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPage;
import org.eclipse.mylyn.internal.bugzilla.ui.editor.FlagAttributeEditor;
import org.eclipse.mylyn.internal.bugzilla.ui.wizard.BugzillaAttachmentWizard;
@@ -52,6 +54,7 @@ import org.eclipse.ui.forms.editor.IFormPage;
* @author Frank Becker
*/
@SuppressWarnings("restriction")
+// XXX 3.5 rename to BuzillaAttachmentDetailsAction
public class BugzillaAttachmentUpdateAction extends BaseSelectionListenerAction implements IViewActionDelegate {
private ISelection currentSelection;
@@ -108,6 +111,7 @@ public class BugzillaAttachmentUpdateAction extends BaseSelectionListenerAction
ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(nTask, editTaskData);
TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(
attachment.getTaskAttribute().getTaskData().getRepositoryUrl());
+ final String repositoryLabel = repository.getRepositoryLabel();
final TaskDataModel model = new TaskDataModel(repository, nTask, workingCopy);
AttributeEditorFactory factory = new AttributeEditorFactory(model, repository,
bugzillaTaskEditorPage.getEditorSite()) {
@@ -130,8 +134,22 @@ public class BugzillaAttachmentUpdateAction extends BaseSelectionListenerAction
target.setValue(target0.getValue());
final BugzillaAttachmentWizard attachmentWizard = new BugzillaAttachmentWizard(shell, factory, target,
- taskEditor, attachment);
- final NewAttachmentWizardDialog dialog = new NewAttachmentWizardDialog(shell, attachmentWizard, false);
+ taskEditor, attachment, repository.getRepositoryLabel());
+ final NewAttachmentWizardDialog dialog = new NewAttachmentWizardDialog(shell, attachmentWizard, false) {
+
+ @Override
+ protected IDialogSettings getDialogBoundsSettings() {
+ IDialogSettings settings = BugzillaUiPlugin.getDefault().getDialogSettings();
+ IDialogSettings section = settings.getSection(BugzillaUiPlugin.ATTACHMENT_WIZARD_SETTINGS_SECTION
+ + repositoryLabel);
+ if (section == null) {
+ section = settings.addNewSection(BugzillaUiPlugin.ATTACHMENT_WIZARD_SETTINGS_SECTION
+ + repositoryLabel);
+ }
+ return section;
+ }
+
+ };
model.addModelListener(new TaskDataModelListener() {
@Override
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java
index 98e753261..3d2b5b2de 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java
@@ -27,6 +27,9 @@ import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.swt.widgets.Shell;
+/**
+ * @author Frank Becker
+ */
public class BugzillaAttachmentWizard extends Wizard {
private final AttributeEditorFactory factory;
@@ -43,14 +46,17 @@ public class BugzillaAttachmentWizard extends Wizard {
private final ITaskAttachment attachment;
+ private final String repositoryLabel;
+
public BugzillaAttachmentWizard(Shell parentShell, AttributeEditorFactory factory,
- TaskAttribute attachmentAttribute, TaskEditor taskEditor, ITaskAttachment attachment) {
+ TaskAttribute attachmentAttribute, TaskEditor taskEditor, ITaskAttachment attachment, String repositoryLabel) {
super();
this.factory = factory;
this.attachmentAttribute = attachmentAttribute;
this.parentShell = parentShell;
this.taskEditor = taskEditor;
this.attachment = attachment;
+ this.repositoryLabel = repositoryLabel;
setNeedsProgressMonitor(true);
setWindowTitle(Messages.BugzillaAttachmentWizard_Attachment_Details_Dialog_Title);
}
@@ -127,8 +133,8 @@ public class BugzillaAttachmentWizard extends Wizard {
@Override
public void addPages() {
- attachmentWizardPage = new BugzillaAttachmentWizardPage(parentShell, factory, attachmentAttribute,
- attachment.getTask().getTaskId());
+ attachmentWizardPage = new BugzillaAttachmentWizardPage(parentShell, factory, attachment.getTask().getTaskId(),
+ attachmentAttribute, repositoryLabel);
addPage(attachmentWizardPage);
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizardPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizardPage.java
index 2709ab3aa..e5e96e58e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizardPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizardPage.java
@@ -1,12 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2010 Tasktop Technologies and others.
+ * 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:
- * Tasktop Technologies - initial API and implementation
+ * Frank Becker - initial API and implementation
+ * Tasktop Technologies - improvements
*******************************************************************************/
package org.eclipse.mylyn.internal.bugzilla.ui.wizard;
@@ -27,9 +28,6 @@ import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -41,12 +39,17 @@ import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
+/**
+ * @author Frank Becker
+ * @author Steffen Pingel
+ */
public class BugzillaAttachmentWizardPage extends WizardPage {
+
private static final String PAGE_NAME = "AttachmentDetailPage"; //$NON-NLS-1$
private static final String DIALOG_SETTING_RUN_IN_BACKGROUND = "run-in-background"; //$NON-NLS-1$
- private static final String DIALOG_SETTINGS_SECTION_BUGZILLA_ATTACHMENTS_WIZARD = "bugzilla-attachments-wizard"; //$NON-NLS-1$
+ private static final String DIALOG_SETTING_ADVANCED_EXPANDED = "advanced-expanded"; //$NON-NLS-1$
private final AttributeEditorFactory factory;
@@ -66,23 +69,28 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
private AbstractAttributeEditor commentEditor;
- private ExpandableComposite flagExpandComposite;
+ private ExpandableComposite advancedExpandComposite;
private Button runInBackgroundButton;
- private ScrolledComposite scrolledComposite;
+ private int currentColumn = 1;
+
+ private final int columnCount = 4;
+
+ private final String repositoryLabel;
- private Composite scrolledBodyComposite;
+ private boolean advancesExpanded;
- public BugzillaAttachmentWizardPage(Shell parentShell, AttributeEditorFactory factory,
- TaskAttribute attachmentAttribute, String taskID) {
+ public BugzillaAttachmentWizardPage(Shell parentShell, AttributeEditorFactory factory, String taskID,
+ TaskAttribute attachmentAttribute, String repositoryLabel) {
super(PAGE_NAME);
setTitle(Messages.BugzillaAttachmentWizardPage_Titel);
+ this.repositoryLabel = repositoryLabel;
+ this.attachmentAttribute = attachmentAttribute;
setDescription(MessageFormat.format(Messages.BugzillaAttachmentWizardPage_Description,
- attachmentAttribute.getValue(), taskID));
+ attachmentAttribute.getValue(), taskID, repositoryLabel));
setImageDescriptor(createImageDescriptor());
this.factory = factory;
- this.attachmentAttribute = attachmentAttribute;
}
private static ImageDescriptor createImageDescriptor() {
@@ -104,70 +112,44 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
public void createControl(Composite parent) {
toolkit = new FormToolkit(parent.getDisplay());
-
- Composite pageArea = new Composite(parent, SWT.NONE);
+ final Composite pageArea = new Composite(parent, SWT.NONE);
pageArea.setBackground(parent.getBackground());
pageArea.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- pageArea.setLayout(new GridLayout(1, false));
-
- SashForm bottomForm = new SashForm(pageArea, SWT.NONE);
- bottomForm.setOrientation(SWT.VERTICAL);
- GridLayout bottomLayout = new GridLayout();
- bottomLayout.numColumns = 1;
- bottomForm.setLayout(bottomLayout);
- GridData bottomLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
- bottomLayoutData.heightHint = 119;
- bottomLayoutData.widthHint = 200;
- bottomForm.setLayoutData(bottomLayoutData);
- int currentColumn = 1;
- int columnCount = 4;
-
- scrolledComposite = new ScrolledComposite(bottomForm, SWT.H_SCROLL | SWT.V_SCROLL) {
- @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.setBackground(pageArea.getBackground());
- scrolledBodyComposite.setForeground(scrolledBodyComposite.getDisplay()
- .getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- GridLayout layout = new GridLayout(4, false);
- scrolledBodyComposite.setLayout(layout);
- scrolledComposite.setContent(scrolledBodyComposite);
-
- Composite commentArea = new Composite(bottomForm, SWT.NONE);
- commentArea.setBackground(pageArea.getBackground());
- commentArea.setForeground(commentArea.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- layout = new GridLayout(4, false);
- commentArea.setLayout(layout);
-
- createAttributeEditors(currentColumn, columnCount, scrolledBodyComposite);
- createCommentEditor(currentColumn, columnCount, commentArea);
- createFlagSection(scrolledBodyComposite);
- createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_URL), currentColumn,
- columnCount, scrolledBodyComposite);
- GridDataFactory.fillDefaults().grab(true, false).hint(200, SWT.DEFAULT).span(4, SWT.DEFAULT).applyTo(
- scrolledBodyComposite);
+ pageArea.setLayout(new GridLayout(columnCount, false));
+
+ createAttributeEditors(pageArea);
+ createAdvancedSection(pageArea);
+
+ createCommentEditor(pageArea);
+
+ // border for comment area
+ toolkit.paintBordersFor(pageArea);
runInBackgroundButton = new Button(pageArea, SWT.CHECK);
+ GridDataFactory.fillDefaults().indent(0, 10).span(4, 1).applyTo(runInBackgroundButton);
runInBackgroundButton.setText(Messages.BugzillaAttachmentWizardPage_RunInBackground);
+
+ setControl(pageArea);
+ Dialog.applyDialogFont(pageArea);
IDialogSettings settings = BugzillaUiPlugin.getDefault().getDialogSettings();
- IDialogSettings attachmentsSettings = settings.getSection(DIALOG_SETTINGS_SECTION_BUGZILLA_ATTACHMENTS_WIZARD);
+ IDialogSettings attachmentsSettings = settings.getSection(BugzillaUiPlugin.ATTACHMENT_WIZARD_SETTINGS_SECTION
+ + repositoryLabel);
+ advancesExpanded = false;
if (attachmentsSettings != null) {
runInBackgroundButton.setSelection(attachmentsSettings.getBoolean(DIALOG_SETTING_RUN_IN_BACKGROUND));
+ try {
+ advancesExpanded = attachmentsSettings.getBoolean(DIALOG_SETTING_ADVANCED_EXPANDED);
+ } catch (Exception e) {
+ // ignore
+ }
+
+ }
+ if (advancedExpandComposite != null) {
+ advancedExpandComposite.setExpanded(advancesExpanded);
}
- setControl(pageArea);
- Dialog.applyDialogFont(pageArea);
- bottomForm.setWeights(new int[] { 75, 25 });
- scrolledComposite.setMinSize(scrolledBodyComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
}
- private void createAttributeEditor(TaskAttribute attribute, int currentColumn, int columnCount,
- Composite attributeArea) {
+ private void createAttributeEditor(TaskAttribute attribute, Composite attributeArea) {
String type = attribute.getMetaData().getType();
if (type != null) {
AbstractAttributeEditor editor = factory.createEditor(type, attribute);
@@ -177,7 +159,8 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
} else {
editor.setReadOnly(false);
}
- if (editor.hasLabel() && !TaskAttribute.ATTACHMENT_IS_PATCH.equals(attribute.getId())) {
+ if (editor.hasLabel()
+ && (!TaskAttribute.ATTACHMENT_IS_PATCH.equals(attribute.getId()) && !TaskAttribute.ATTACHMENT_IS_DEPRECATED.equals(attribute.getId()))) {
editor.createLabelControl(attributeArea, toolkit);
Label label = editor.getLabelControl();
label.setBackground(attributeArea.getBackground());
@@ -185,8 +168,10 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
String labelString = editor.getLabel();
if (labelString != null && !labelString.equals("")) { //$NON-NLS-1$
- GridData gd = GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).hint(LABEL_WIDTH,
- SWT.DEFAULT).create();
+ GridData gd = GridDataFactory.fillDefaults()
+ .align(SWT.RIGHT, SWT.CENTER)
+ .hint(LABEL_WIDTH, SWT.DEFAULT)
+ .create();
if (currentColumn > 1) {
gd.horizontalIndent = COLUMN_GAP;
gd.widthHint = LABEL_WIDTH + COLUMN_GAP;
@@ -196,15 +181,25 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
}
}
editor.createControl(attributeArea, toolkit);
+
+ // avoid borders for read-only fields
+ editor.getControl().setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
+
GridData gd = new GridData(SWT.FILL, SWT.CENTER, false, false);
if (BugzillaAttribute.CTYPE.getKey().equals(attribute.getId())) {
- gd.horizontalSpan = 2;
- gd.widthHint = LABEL_WIDTH * 2;
- } else if (TaskAttribute.ATTACHMENT_IS_PATCH.equals(attribute.getId())) {
gd.horizontalSpan = 1;
- } else if (type.equals(TaskAttribute.TYPE_BOOLEAN) || type.equals(TaskAttribute.TYPE_SHORT_TEXT)
- || type.equals(TaskAttribute.TYPE_URL)) {
+ gd.widthHint = LABEL_WIDTH;
+ gd.grabExcessHorizontalSpace = true;
+ } else if (TaskAttribute.ATTACHMENT_IS_PATCH.equals(attribute.getId())
+ || TaskAttribute.ATTACHMENT_IS_DEPRECATED.equals(attribute.getId())) {
+ gd.horizontalSpan = 1;
+ } else if (TaskAttribute.ATTACHMENT_CONTENT_TYPE.equals(attribute.getId())) {
+ gd.horizontalSpan = 2;
+ } else if (type.equals(TaskAttribute.TYPE_BOOLEAN) || type.equals(TaskAttribute.TYPE_SHORT_TEXT)) {
gd.horizontalSpan = 3;
+ } else if (type.equals(TaskAttribute.TYPE_URL)) {
+ gd.horizontalSpan = 3;
+ gd.grabExcessHorizontalSpace = true;
} else {
gd.horizontalSpan = 1;
}
@@ -216,22 +211,20 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
}
}
- private void createAttributeEditors(int currentColumn, int columnCount, Composite attributeArea) {
+ private void createAttributeEditors(Composite attributeArea) {
createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_DESCRIPTION),
- currentColumn, columnCount, attributeArea);
- createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_FILENAME), currentColumn,
- columnCount, attributeArea);
- createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_SIZE), currentColumn,
- columnCount, attributeArea);
+ attributeArea);
+ createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_FILENAME), attributeArea);
+ createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_SIZE), attributeArea);
createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_CONTENT_TYPE),
- currentColumn, columnCount, attributeArea);
- createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_PATCH), currentColumn,
- columnCount, attributeArea);
+ attributeArea);
+ createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_PATCH), attributeArea);
createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED),
- currentColumn, columnCount, attributeArea);
+ attributeArea);
+ createAttributeEditor(attachmentAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_URL), attributeArea);
}
- private void createCommentEditor(int currentColumn, int columnCount, Composite attributeArea) {
+ private void createCommentEditor(Composite attributeArea) {
TaskAttribute commentAttribute = attachmentAttribute.getAttribute("comment"); //$NON-NLS-1$
if (commentAttribute == null) {
return;
@@ -242,17 +235,15 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
String labelString = commentEditor.getLabel();
if (commentEditor.hasLabel()) {
commentEditor.createLabelControl(attributeArea, toolkit);
- if (!labelString.equals("")) { //$NON-NLS-1$
+ if (commentEditor.getLabelControl() != null) {
Label label = commentEditor.getLabelControl();
label.setBackground(attributeArea.getBackground());
label.setForeground(attributeArea.getForeground());
- GridData gd = GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.TOP).hint(LABEL_WIDTH,
- SWT.DEFAULT).create();
- if (currentColumn > 1) {
- gd.horizontalIndent = COLUMN_GAP;
- gd.widthHint = LABEL_WIDTH + COLUMN_GAP;
- }
- label.setLayoutData(gd);
+ GridDataFactory.fillDefaults()
+ .indent(0, 10)
+ .align(SWT.RIGHT, SWT.TOP)
+ .hint(LABEL_WIDTH, SWT.DEFAULT)
+ .applyTo(label);
}
}
commentEditor.createControl(attributeArea, toolkit);
@@ -260,16 +251,14 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = MULTI_ROW_HEIGHT;
gd.widthHint = MULTI_COLUMN_WIDTH;
- gd.horizontalSpan = 3;
+ gd.horizontalSpan = (commentEditor.getLabelControl() != null) ? 3 : 4;
+ gd.verticalIndent = 10;
commentEditor.getControl().setLayoutData(gd);
commentEditor.getControl().setForeground(attributeArea.getForeground());
-
- toolkit.paintBordersFor(attributeArea);
}
-
}
- private void createFlagSection(final Composite container) {
+ private void createAdvancedSection(final Composite container) {
boolean flagFound = false;
for (TaskAttribute attribute : attachmentAttribute.getAttributes().values()) {
if (!attribute.getId().startsWith("task.common.kind.flag")) { //$NON-NLS-1$
@@ -281,26 +270,29 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
if (!flagFound) {
return;
}
- flagExpandComposite = toolkit.createExpandableComposite(container, ExpandableComposite.COMPACT
+ advancedExpandComposite = toolkit.createExpandableComposite(container, ExpandableComposite.COMPACT
| ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- flagExpandComposite.setFont(container.getFont());
- flagExpandComposite.setBackground(container.getBackground());
- flagExpandComposite.setText(Messages.BugzillaAttachmentWizardPage_Advanced);
- flagExpandComposite.setLayout(new GridLayout(4, false));
- GridDataFactory.fillDefaults().indent(0, 5).grab(true, false).span(4, SWT.DEFAULT).applyTo(flagExpandComposite);
-
- flagExpandComposite.addExpansionListener(new ExpansionAdapter() {
+ advancedExpandComposite.setFont(container.getFont());
+ advancedExpandComposite.setBackground(container.getBackground());
+ advancedExpandComposite.setText(Messages.BugzillaAttachmentWizardPage_Advanced);
+ advancedExpandComposite.setLayout(new GridLayout(4, false));
+ GridDataFactory.fillDefaults()
+ .indent(-6, 0)
+ .grab(true, false)
+ .span(4, SWT.DEFAULT)
+ .applyTo(advancedExpandComposite);
+
+ advancedExpandComposite.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
- scrolledComposite.setMinSize(scrolledBodyComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
- getControl().getShell().pack();
+ container.layout();
}
});
- Composite flagBodyComposite = new Composite(flagExpandComposite, SWT.NONE);
- GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(2).applyTo(flagBodyComposite);
- flagBodyComposite.setBackground(container.getBackground());
- createFlagEditors(2, flagBodyComposite);
- flagExpandComposite.setClient(flagBodyComposite);
+ Composite advancedBodyComposite = new Composite(advancedExpandComposite, SWT.NONE);
+ GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(2).applyTo(advancedBodyComposite);
+ advancedBodyComposite.setBackground(container.getBackground());
+ createFlagEditors(2, advancedBodyComposite);
+ advancedExpandComposite.setClient(advancedBodyComposite);
}
private void createFlagEditors(int columnCount, Composite flagBodyComposite) {
@@ -320,8 +312,10 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
label.setBackground(flagBodyComposite.getBackground());
label.setForeground(flagBodyComposite.getForeground());
- GridData gd = GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).hint(
- LABEL_WIDTH - (4 * COLUMN_GAP), SWT.DEFAULT).create();
+ GridData gd = GridDataFactory.fillDefaults()
+ .align(SWT.RIGHT, SWT.CENTER)
+ .hint(LABEL_WIDTH - (4 * COLUMN_GAP), SWT.DEFAULT)
+ .create();
if (currentFlagColumn > 1) {
gd.horizontalIndent = COLUMN_GAP;
gd.widthHint = LABEL_WIDTH + COLUMN_GAP;
@@ -346,11 +340,18 @@ public class BugzillaAttachmentWizardPage extends WizardPage {
@Override
public void dispose() {
IDialogSettings settings = BugzillaUiPlugin.getDefault().getDialogSettings();
- IDialogSettings attachmentsSettings = settings.getSection(DIALOG_SETTINGS_SECTION_BUGZILLA_ATTACHMENTS_WIZARD);
+ IDialogSettings attachmentsSettings = settings.getSection(BugzillaUiPlugin.ATTACHMENT_WIZARD_SETTINGS_SECTION
+ + repositoryLabel);
if (attachmentsSettings == null) {
- attachmentsSettings = settings.addNewSection(DIALOG_SETTINGS_SECTION_BUGZILLA_ATTACHMENTS_WIZARD);
+ attachmentsSettings = settings.addNewSection(BugzillaUiPlugin.ATTACHMENT_WIZARD_SETTINGS_SECTION
+ + repositoryLabel);
}
attachmentsSettings.put(DIALOG_SETTING_RUN_IN_BACKGROUND, runInBackgroundButton.getSelection());
+ if (advancedExpandComposite != null) {
+ attachmentsSettings.put(DIALOG_SETTING_ADVANCED_EXPANDED, advancedExpandComposite.isExpanded());
+ } else {
+ attachmentsSettings.put(DIALOG_SETTING_ADVANCED_EXPANDED, advancesExpanded);
+ }
super.dispose();
}

Back to the top