diff options
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java')
-rw-r--r-- | org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java | 665 |
1 files changed, 343 insertions, 322 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java index 0b40d8171..17d696423 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java @@ -75,6 +75,10 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter; +import org.eclipse.ui.forms.events.ExpansionAdapter; +import org.eclipse.ui.forms.events.ExpansionEvent; +import org.eclipse.ui.forms.widgets.ExpandableComposite; +import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.progress.IProgressService; import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; @@ -258,6 +262,10 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L private RepositoryConfiguration repositoryConfiguration; + private final FormToolkit toolkit; + + private ExpandableComposite advancedExpandComposite; + private final SelectionAdapter updateActionSelectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -300,44 +308,19 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L public BugzillaSearchPage(TaskRepository repository) { super(Messages.BugzillaSearchPage_Bugzilla_Query, repository); - // setTitle(TITLE); - // setDescription(DESCRIPTION); - // setImageDescriptor(TaskListImages.BANNER_REPOSITORY); - // setPageComplete(false); -// try { -// repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(repository, false); -// } catch (final CoreException e) { -// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { -// public void run() { -// MessageDialog.openError(Display.getDefault().getActiveShell(), "Bugzilla Search Page", -// "Unable to get configuration. Ensure proper repository configuration in " -// + TasksUiPlugin.LABEL_VIEW_REPOSITORIES + ".\n\n"); -// } -// }); -// } + + toolkit = new FormToolkit(Display.getCurrent()); } public BugzillaSearchPage(TaskRepository repository, IRepositoryQuery origQuery) { super(Messages.BugzillaSearchPage_Bugzilla_Query, repository, origQuery); originalQuery = origQuery; setDescription(Messages.BugzillaSearchPage_Select_the_Bugzilla_query_parameters); - // setTitle(TITLE); - // setDescription(DESCRIPTION); - // setPageComplete(false); -// try { -// repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(repository, false); -// } catch (final CoreException e) { -// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { -// public void run() { -// MessageDialog.openError(Display.getDefault().getActiveShell(), "Bugzilla Search Page", -// "Unable to get configuration. Ensure proper repository configuration in " -// + TasksUiPlugin.LABEL_VIEW_REPOSITORIES + ".\n\n"); -// } -// }); -// } + toolkit = new FormToolkit(Display.getCurrent()); } public void createControl(Composite parent) { + initializeDialogUnits(parent); readConfiguration(); Composite control = new Composite(parent, SWT.NONE); @@ -345,86 +328,125 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L layout.marginHeight = 0; control.setLayout(layout); control.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL)); - -// if (scontainer == null) { - // Not presenting in search pane so want query title -// super.createControl(control); -// Label lblName = new Label(control, SWT.NONE); -// final GridData gridData = new GridData(); -// lblName.setLayoutData(gridData); -// lblName.setText("Query Title:"); -// -// title = new Text(control, SWT.BORDER); -// title.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); -// title.addModifyListener(new ModifyListener() { -// public void modifyText(ModifyEvent e) { -// setPageComplete(isPageComplete()); -// } -// }); -// } - - // else { - // // if (repository == null) { - // // search pane so add repository selection - // createRepositoryGroup(control); - // } createOptionsGroup(control); - createSearchGroup(control); - - // createSaveQuery(control); - // createMaxHits(control); - // input = new SavedQueryFile(BugzillaPlugin.getDefault().getStateLocation().toString(), "/queries"); - // createUpdate(control); - // if (originalQuery != null) { - // try { - // updateDefaults(originalQuery.getQueryUrl(), String.valueOf(originalQuery.getMaxHits())); - // } catch (UnsupportedEncodingException e) { - // // ignore - // } - // } + createButtons(control); Dialog.applyDialogFont(control); setControl(control); PlatformUI.getWorkbench().getHelpSystem().setHelp(control, BugzillaUiPlugin.SEARCH_PAGE_CONTEXT); restoreBounds(); } - protected void createOptionsGroup(Composite control) { - GridLayout sashFormLayout = new GridLayout(); - sashFormLayout.numColumns = 4; - sashFormLayout.marginHeight = 5; - sashFormLayout.marginWidth = 5; - sashFormLayout.horizontalSpacing = 5; + private void createButtons(Composite control) { + Composite buttonComposite = new Composite(control, SWT.NONE); + buttonComposite.setLayout(new GridLayout(2, false)); + GridData g = new GridData(GridData.FILL_HORIZONTAL); + g.widthHint = 500; + g.heightHint = 200; + Button clearButton = new Button(buttonComposite, SWT.PUSH); + clearButton.setText(Messages.BugzillaSearchPage_ClearFields); + clearButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); + clearButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + product.deselectAll(); + component.deselectAll(); + version.deselectAll(); + target.deselectAll(); + status.deselectAll(); + resolution.deselectAll(); + severity.deselectAll(); + priority.deselectAll(); + hardware.deselectAll(); + os.deselectAll(); + summaryOperation.deselectAll(); + commentOperation.deselectAll(); + emailOperation.deselectAll(); + + for (Button emailButton : emailButtons) { + emailButton.setSelection(false); + } + summaryPattern.setText(""); //$NON-NLS-1$ + commentPattern.setText(""); //$NON-NLS-1$ + emailPattern.setText(""); //$NON-NLS-1$ + emailOperation2.deselectAll(); + for (Button element : emailButtons2) { + element.setSelection(false); + } + emailPattern2.setText(""); //$NON-NLS-1$ + keywords.setText(""); //$NON-NLS-1$ + keywordsOperation.deselectAll(); + daysText.setText(""); //$NON-NLS-1$ + } + }); - final Composite composite = new Composite(control, SWT.NONE); - composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - final GridLayout gridLayout = new GridLayout(); - gridLayout.marginBottom = 8; - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - gridLayout.numColumns = 4; - composite.setLayout(gridLayout); + Button updateButton = new Button(buttonComposite, SWT.PUSH); + updateButton.setText(Messages.BugzillaSearchPage_Update_Attributes_from_Repository); + updateButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); + updateButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (getTaskRepository() != null) { + updateConfiguration(true); + } else { + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + IBugzillaConstants.TITLE_MESSAGE_DIALOG, + Messages.BugzillaSearchPage_No_repository_available); + } + } + }); + + buttonComposite.setLayoutData(g); + Dialog.applyDialogFont(buttonComposite); - if (!inSearchContainer()) { - final Label queryTitleLabel = new Label(composite, SWT.NONE); - queryTitleLabel.setText(Messages.BugzillaSearchPage_Query_Title); + } - queryTitle = new Text(composite, SWT.BORDER); - queryTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); - if (originalQuery != null) { - queryTitle.setText(originalQuery.getSummary()); + private void createOptionsGroup(Composite control) { + Composite basicComposite = new Composite(control, SWT.NONE); + basicComposite.setLayout(new GridLayout(4, false)); + GridData g = new GridData(GridData.FILL_HORIZONTAL); + g.widthHint = 500; + g.heightHint = 200; + basicComposite.setLayoutData(g); + Dialog.applyDialogFont(basicComposite); + + advancedExpandComposite = toolkit.createExpandableComposite(control, ExpandableComposite.COMPACT + | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR); + advancedExpandComposite.setFont(control.getFont()); + advancedExpandComposite.setBackground(null); + advancedExpandComposite.setText(Messages.BugzillaSearchPage_Advanced); + advancedExpandComposite.setLayout(new GridLayout(3, false)); + g = new GridData(GridData.FILL_HORIZONTAL); + g.horizontalSpan = 3; + advancedExpandComposite.setLayoutData(g); + advancedExpandComposite.addExpansionListener(new ExpansionAdapter() { + @Override + public void expansionStateChanged(ExpansionEvent e) { + getControl().getShell().pack(); } - queryTitle.addModifyListener(new ModifyListenerImplementation()); - queryTitle.setFocus(); - } + }); + Composite advancedComposite = new Composite(advancedExpandComposite, SWT.NULL); + advancedComposite.setLayout(new GridLayout(4, false)); + g = new GridData(GridData.FILL_HORIZONTAL); + g.widthHint = 500; + g.heightHint = 200; + + advancedComposite.setLayoutData(g); + Dialog.applyDialogFont(advancedComposite); + advancedExpandComposite.setClient(advancedComposite); + + createBasicComposite(basicComposite); + createAdvancedComposite(advancedComposite); + createSearchGroup(advancedComposite); + } + + private void createBasicComposite(Composite basicComposite) { // Info text - Label labelSummary = new Label(composite, SWT.LEFT); + Label labelSummary = new Label(basicComposite, SWT.LEFT); labelSummary.setText(Messages.BugzillaSearchPage_Summary); -// labelSummary.setLayoutData(new GridData(LABEL_WIDTH, SWT.DEFAULT)); - //labelSummary.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); // Pattern combo - summaryPattern = new Combo(composite, SWT.SINGLE | SWT.BORDER); + summaryPattern = new Combo(basicComposite, SWT.SINGLE | SWT.BORDER); summaryPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); summaryPattern.addModifyListener(new ModifyListenerImplementation()); summaryPattern.addSelectionListener(new SelectionAdapter() { @@ -434,39 +456,17 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L } }); - summaryOperation = new Combo(composite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); + summaryOperation = new Combo(basicComposite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); summaryOperation.setItems(patternOperationText); summaryOperation.setText(patternOperationText[0]); summaryOperation.select(0); - - // Info text - Label labelComment = new Label(composite, SWT.LEFT); - labelComment.setText(Messages.BugzillaSearchPage_Comment); - //labelComment.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - // Comment pattern combo - commentPattern = new Combo(composite, SWT.SINGLE | SWT.BORDER); - commentPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); - commentPattern.addModifyListener(new ModifyListenerImplementation()); - commentPattern.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleWidgetSelected(commentPattern, commentOperation, previousCommentPatterns); - } - }); - - commentOperation = new Combo(composite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); - commentOperation.setItems(patternOperationText); - commentOperation.setText(patternOperationText[0]); - commentOperation.select(0); - - Label labelEmail = new Label(composite, SWT.LEFT); + Label labelEmail = new Label(basicComposite, SWT.LEFT); labelEmail.setText(Messages.BugzillaSearchPage_Email); //labelEmail.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); // pattern combo - emailPattern = new Combo(composite, SWT.SINGLE | SWT.BORDER); - emailPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + emailPattern = new Combo(basicComposite, SWT.SINGLE | SWT.BORDER); + emailPattern.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); emailPattern.addModifyListener(new ModifyListenerImplementation()); emailPattern.addSelectionListener(new SelectionAdapter() { @Override @@ -484,8 +484,15 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L adapter.setLabelProvider(proposalLabelProvider); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); - Composite emailComposite = new Composite(composite, SWT.NONE); - emailComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + // operation combo + emailOperation = new Combo(basicComposite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); + emailOperation.setItems(emailOperationText); + emailOperation.setText(emailOperationText[0]); + emailOperation.select(0); + + new Label(basicComposite, SWT.NONE); + Composite emailComposite = new Composite(basicComposite, SWT.NONE); + emailComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 2, 1)); GridLayout emailLayout = new GridLayout(); emailLayout.marginWidth = 0; emailLayout.marginHeight = 0; @@ -509,22 +516,144 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L button4.setText(Messages.BugzillaSearchPage_qacontact); emailButtons = new Button[] { button0, button1, button2, button3, button4 }; + new Label(basicComposite, SWT.NONE); + GridLayout sashFormLayout = new GridLayout(); + sashFormLayout.numColumns = 4; + sashFormLayout.marginHeight = 5; + sashFormLayout.marginWidth = 5; + sashFormLayout.horizontalSpacing = 5; - // operation combo - emailOperation = new Combo(composite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); - emailOperation.setItems(emailOperationText); - emailOperation.setText(emailOperationText[0]); - emailOperation.select(0); + SashForm sashForm = new SashForm(basicComposite, SWT.VERTICAL); + sashForm.setLayout(sashFormLayout); + final GridData gd_sashForm = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); + gd_sashForm.widthHint = 400; + gd_sashForm.heightHint = 100; + sashForm.setLayoutData(gd_sashForm); + + GridLayout topLayout = new GridLayout(); + topLayout.numColumns = 4; + SashForm topForm = new SashForm(sashForm, SWT.NONE); + GridData topLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1); + topLayoutData.widthHint = 00; + topLayoutData.heightHint = 100; + topForm.setLayoutData(topLayoutData); + topForm.setLayout(topLayout); + + GridLayout productLayout = new GridLayout(); + productLayout.marginWidth = 0; + productLayout.marginHeight = 0; + productLayout.horizontalSpacing = 0; + Composite productComposite = new Composite(topForm, SWT.NONE); + productComposite.setLayout(productLayout); + + Label productLabel = new Label(productComposite, SWT.LEFT); + productLabel.setText(Messages.BugzillaSearchPage_Product); + productLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + GridData productLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + productLayoutData.heightHint = HEIGHT_ATTRIBUTE_COMBO; + product = new List(productComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); + product.setLayoutData(productLayoutData); + product.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (product.getSelectionIndex() != -1) { + String[] selectedProducts = product.getSelection(); + updateAttributesFromConfiguration(selectedProducts); + } else { + updateAttributesFromConfiguration(null); + } + if (restoring) { + restoring = false; + restoreWidgetValues(); + } + setPageComplete(isPageComplete()); + } + }); + + GridLayout componentLayout = new GridLayout(); + componentLayout.marginWidth = 0; + componentLayout.marginHeight = 0; + componentLayout.horizontalSpacing = 0; + Composite componentComposite = new Composite(topForm, SWT.NONE); + componentComposite.setLayout(componentLayout); + + Label componentLabel = new Label(componentComposite, SWT.LEFT); + componentLabel.setText(Messages.BugzillaSearchPage_Component); + componentLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + component = new List(componentComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); + GridData componentLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + componentLayoutData.heightHint = HEIGHT_ATTRIBUTE_COMBO; + component.setLayoutData(componentLayoutData); + component.addSelectionListener(updateActionSelectionAdapter); + + Composite statusComposite = new Composite(topForm, SWT.NONE); + GridLayout statusLayout = new GridLayout(); + statusLayout.marginWidth = 0; + statusLayout.horizontalSpacing = 0; + statusLayout.marginHeight = 0; + statusComposite.setLayout(statusLayout); + + Label statusLabel = new Label(statusComposite, SWT.LEFT); + statusLabel.setText(Messages.BugzillaSearchPage_Status); + statusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + status = new List(statusComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); + final GridData gd_status = new GridData(SWT.FILL, SWT.FILL, true, true); + gd_status.heightHint = HEIGHT_ATTRIBUTE_COMBO; + status.setLayoutData(gd_status); + status.addSelectionListener(updateActionSelectionAdapter); + + Composite priorityComposite = new Composite(topForm, SWT.NONE); + GridLayout priorityLayout = new GridLayout(); + priorityLayout.marginWidth = 0; + priorityLayout.marginHeight = 0; + priorityLayout.horizontalSpacing = 0; + priorityComposite.setLayout(priorityLayout); + + Label priorityLabel = new Label(priorityComposite, SWT.LEFT); + priorityLabel.setText(Messages.BugzillaSearchPage_PROORITY); + priorityLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + priority = new List(priorityComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); + final GridData gd_priority = new GridData(SWT.FILL, SWT.FILL, true, true); + gd_priority.heightHint = HEIGHT_ATTRIBUTE_COMBO; + priority.setLayoutData(gd_priority); + priority.addSelectionListener(updateActionSelectionAdapter); + + } + + private void createAdvancedComposite(Composite advancedComposite) { + + // Info text + Label labelComment = new Label(advancedComposite, SWT.LEFT); + labelComment.setText(Messages.BugzillaSearchPage_Comment); + //labelComment.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); + + // Comment pattern combo + commentPattern = new Combo(advancedComposite, SWT.SINGLE | SWT.BORDER); + commentPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); + commentPattern.addModifyListener(new ModifyListenerImplementation()); + commentPattern.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + handleWidgetSelected(commentPattern, commentOperation, previousCommentPatterns); + } + }); - // Email2 + commentOperation = new Combo(advancedComposite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); + commentOperation.setItems(patternOperationText); + commentOperation.setText(patternOperationText[0]); + commentOperation.select(0); - Label labelEmail2 = new Label(composite, SWT.LEFT); + Label labelEmail2 = new Label(advancedComposite, SWT.LEFT); labelEmail2.setText(Messages.BugzillaSearchPage_Email_2); //labelEmail.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); // pattern combo - emailPattern2 = new Combo(composite, SWT.SINGLE | SWT.BORDER); - emailPattern2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + emailPattern2 = new Combo(advancedComposite, SWT.SINGLE | SWT.BORDER); + emailPattern2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); emailPattern2.addModifyListener(new ModifyListenerImplementation()); emailPattern2.addSelectionListener(new SelectionAdapter() { @Override @@ -532,14 +661,25 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L handleWidgetSelected(emailPattern2, emailOperation2, previousEmailPatterns2); } }); + IContentProposalProvider proposalProvider = TasksUi.getUiFactory().createPersonContentProposalProvider( + getTaskRepository()); + ILabelProvider proposalLabelProvider = TasksUi.getUiFactory().createPersonContentProposalLabelProvider( + getTaskRepository()); ContentAssistCommandAdapter adapter2 = new ContentAssistCommandAdapter(emailPattern2, new ComboContentAdapter(), proposalProvider, ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, new char[0], true); - adapter.setLabelProvider(proposalLabelProvider); + adapter2.setLabelProvider(proposalLabelProvider); adapter2.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); - Composite emailComposite2 = new Composite(composite, SWT.NONE); - emailComposite2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + // operation combo + emailOperation2 = new Combo(advancedComposite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); + emailOperation2.setItems(emailOperationText); + emailOperation2.setText(emailOperationText[0]); + emailOperation2.select(0); + + new Label(advancedComposite, SWT.NONE); + Composite emailComposite2 = new Composite(advancedComposite, SWT.NONE); + emailComposite2.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 2, 1)); GridLayout emailLayout2 = new GridLayout(); emailLayout2.marginWidth = 0; emailLayout2.marginHeight = 0; @@ -563,21 +703,11 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L e2button4.setText(Messages.BugzillaSearchPage_qacontact); emailButtons2 = new Button[] { e2button0, e2button1, e2button2, e2button3, e2button4 }; + new Label(advancedComposite, SWT.NONE); + Label keywordsLabel = new Label(advancedComposite, SWT.NONE); + keywordsLabel.setText(Messages.BugzillaSearchPage_Keywords); - // operation combo - emailOperation2 = new Combo(composite, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER); - emailOperation2.setItems(emailOperationText); - emailOperation2.setText(emailOperationText[0]); - emailOperation2.select(0); - - ///// - - Label labelKeywords = new Label(composite, SWT.NONE); - labelKeywords.setText(Messages.BugzillaSearchPage_Keywords); -// labelKeywords.setLayoutData(new GridData(LABEL_WIDTH, SWT.DEFAULT)); - //labelKeywords.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Composite keywordsComposite = new Composite(composite, SWT.NONE); + Composite keywordsComposite = new Composite(advancedComposite, SWT.NONE); keywordsComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1)); GridLayout keywordsLayout = new GridLayout(); keywordsLayout.marginWidth = 0; @@ -616,70 +746,51 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L }); keywordsSelectButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); keywordsSelectButton.setText(Messages.BugzillaSearchPage_Select_); - SashForm sashForm = new SashForm(control, SWT.VERTICAL); - sashForm.setLayout(sashFormLayout); - final GridData gd_sashForm = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_sashForm.widthHint = 500; - sashForm.setLayoutData(gd_sashForm); - GridLayout topLayout = new GridLayout(); - topLayout.numColumns = 4; - SashForm topForm = new SashForm(sashForm, SWT.NONE); - GridData topLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1); - topLayoutData.widthHint = 500; - topForm.setLayoutData(topLayoutData); - topForm.setLayout(topLayout); + SashForm bottomForm = new SashForm(advancedComposite, SWT.NONE); + GridLayout bottomLayout = new GridLayout(); + bottomLayout.numColumns = 6; + bottomForm.setLayout(bottomLayout); + GridData bottomLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); + bottomLayoutData.heightHint = 119; + bottomLayoutData.widthHint = 400; + bottomForm.setLayoutData(bottomLayoutData); - GridLayout productLayout = new GridLayout(); - productLayout.marginWidth = 0; - productLayout.marginHeight = 0; - productLayout.horizontalSpacing = 0; - Composite productComposite = new Composite(topForm, SWT.NONE); - productComposite.setLayout(productLayout); + Composite severityComposite = new Composite(bottomForm, SWT.NONE); + GridLayout severityLayout = new GridLayout(); + severityLayout.marginWidth = 0; + severityLayout.marginHeight = 0; + severityLayout.horizontalSpacing = 0; + severityComposite.setLayout(severityLayout); - Label productLabel = new Label(productComposite, SWT.LEFT); - productLabel.setText(Messages.BugzillaSearchPage_Product); - productLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + Label severityLabel = new Label(severityComposite, SWT.LEFT); + severityLabel.setText(Messages.BugzillaSearchPage_Severity); + severityLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - GridData productLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true); - productLayoutData.heightHint = HEIGHT_ATTRIBUTE_COMBO; - product = new List(productComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - product.setLayoutData(productLayoutData); - product.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (product.getSelectionIndex() != -1) { - String[] selectedProducts = product.getSelection(); - updateAttributesFromConfiguration(selectedProducts); - } else { - updateAttributesFromConfiguration(null); - } - if (restoring) { - restoring = false; - restoreWidgetValues(); - } - setPageComplete(isPageComplete()); - } - }); + severity = new List(severityComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); + final GridData gd_severity = new GridData(SWT.FILL, SWT.FILL, true, true); + gd_severity.heightHint = HEIGHT_ATTRIBUTE_COMBO; + severity.setLayoutData(gd_severity); + severity.addSelectionListener(updateActionSelectionAdapter); - GridLayout componentLayout = new GridLayout(); - componentLayout.marginWidth = 0; - componentLayout.marginHeight = 0; - componentLayout.horizontalSpacing = 0; - Composite componentComposite = new Composite(topForm, SWT.NONE); - componentComposite.setLayout(componentLayout); + Composite resolutionComposite = new Composite(bottomForm, SWT.NONE); + GridLayout resolutionLayout = new GridLayout(); + resolutionLayout.marginWidth = 0; + resolutionLayout.marginHeight = 0; + resolutionLayout.horizontalSpacing = 0; + resolutionComposite.setLayout(resolutionLayout); - Label componentLabel = new Label(componentComposite, SWT.LEFT); - componentLabel.setText(Messages.BugzillaSearchPage_Component); - componentLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + Label resolutionLabel = new Label(resolutionComposite, SWT.LEFT); + resolutionLabel.setText(Messages.BugzillaSearchPage_Resolution); + resolutionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - component = new List(componentComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - GridData componentLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true); - componentLayoutData.heightHint = HEIGHT_ATTRIBUTE_COMBO; - component.setLayoutData(componentLayoutData); - component.addSelectionListener(updateActionSelectionAdapter); + resolution = new List(resolutionComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); + final GridData gd_resolution = new GridData(SWT.FILL, SWT.FILL, true, true); + gd_resolution.heightHint = HEIGHT_ATTRIBUTE_COMBO; + resolution.setLayoutData(gd_resolution); + resolution.addSelectionListener(updateActionSelectionAdapter); - Composite versionComposite = new Composite(topForm, SWT.NONE); + Composite versionComposite = new Composite(bottomForm, SWT.NONE); GridLayout versionLayout = new GridLayout(); versionLayout.marginWidth = 0; versionLayout.marginHeight = 0; @@ -696,7 +807,7 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L version.setLayoutData(versionLayoutData); version.addSelectionListener(updateActionSelectionAdapter); - Composite milestoneComposite = new Composite(topForm, SWT.NONE); + Composite milestoneComposite = new Composite(bottomForm, SWT.NONE); GridLayout milestoneLayout = new GridLayout(); milestoneLayout.marginWidth = 0; milestoneLayout.marginHeight = 0; @@ -713,90 +824,8 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L target.setLayoutData(targetLayoutData); target.addSelectionListener(updateActionSelectionAdapter); - SashForm bottomForm = new SashForm(sashForm, SWT.NONE); - GridLayout bottomLayout = new GridLayout(); - bottomLayout.numColumns = 6; - bottomForm.setLayout(bottomLayout); - GridData bottomLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); - bottomLayoutData.heightHint = 119; - bottomLayoutData.widthHint = 400; - bottomForm.setLayoutData(bottomLayoutData); - - Composite statusComposite = new Composite(bottomForm, SWT.NONE); - GridLayout statusLayout = new GridLayout(); - statusLayout.marginTop = 7; - statusLayout.marginWidth = 0; - statusLayout.horizontalSpacing = 0; - statusLayout.marginHeight = 0; - statusComposite.setLayout(statusLayout); - - Label statusLabel = new Label(statusComposite, SWT.LEFT); - statusLabel.setText(Messages.BugzillaSearchPage_Status); - statusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - status = new List(statusComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_status = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_status.heightHint = 60; - status.setLayoutData(gd_status); - status.addSelectionListener(updateActionSelectionAdapter); - - Composite resolutionComposite = new Composite(bottomForm, SWT.NONE); - GridLayout resolutionLayout = new GridLayout(); - resolutionLayout.marginTop = 7; - resolutionLayout.marginWidth = 0; - resolutionLayout.marginHeight = 0; - resolutionLayout.horizontalSpacing = 0; - resolutionComposite.setLayout(resolutionLayout); - - Label resolutionLabel = new Label(resolutionComposite, SWT.LEFT); - resolutionLabel.setText(Messages.BugzillaSearchPage_Resolution); - resolutionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - resolution = new List(resolutionComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_resolution = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_resolution.heightHint = 60; - resolution.setLayoutData(gd_resolution); - resolution.addSelectionListener(updateActionSelectionAdapter); - - Composite priorityComposite = new Composite(bottomForm, SWT.NONE); - GridLayout priorityLayout = new GridLayout(); - priorityLayout.marginTop = 7; - priorityLayout.marginWidth = 0; - priorityLayout.marginHeight = 0; - priorityLayout.horizontalSpacing = 0; - priorityComposite.setLayout(priorityLayout); - - Label priorityLabel = new Label(priorityComposite, SWT.LEFT); - priorityLabel.setText(Messages.BugzillaSearchPage_PROORITY); - priorityLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - priority = new List(priorityComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_priority = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_priority.heightHint = 60; - priority.setLayoutData(gd_priority); - priority.addSelectionListener(updateActionSelectionAdapter); - - Composite severityComposite = new Composite(bottomForm, SWT.NONE); - GridLayout severityLayout = new GridLayout(); - severityLayout.marginTop = 7; - severityLayout.marginWidth = 0; - severityLayout.marginHeight = 0; - severityLayout.horizontalSpacing = 0; - severityComposite.setLayout(severityLayout); - - Label severityLabel = new Label(severityComposite, SWT.LEFT); - severityLabel.setText(Messages.BugzillaSearchPage_Severity); - severityLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - severity = new List(severityComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); - final GridData gd_severity = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_severity.heightHint = 60; - severity.setLayoutData(gd_severity); - severity.addSelectionListener(updateActionSelectionAdapter); - Composite hardwareComposite = new Composite(bottomForm, SWT.NONE); GridLayout hardwareLayout = new GridLayout(); - hardwareLayout.marginTop = 7; hardwareLayout.marginWidth = 0; hardwareLayout.marginHeight = 0; hardwareLayout.horizontalSpacing = 0; @@ -808,13 +837,12 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L hardware = new List(hardwareComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); final GridData gd_hardware = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_hardware.heightHint = 60; + gd_hardware.heightHint = HEIGHT_ATTRIBUTE_COMBO; hardware.setLayoutData(gd_hardware); hardware.addSelectionListener(updateActionSelectionAdapter); Composite osComposite = new Composite(bottomForm, SWT.NONE); GridLayout osLayout = new GridLayout(); - osLayout.marginTop = 7; osLayout.marginWidth = 0; osLayout.marginHeight = 0; osLayout.horizontalSpacing = 0; @@ -826,20 +854,22 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L os = new List(osComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); final GridData gd_os = new GridData(SWT.FILL, SWT.FILL, true, true); - gd_os.heightHint = 60; + gd_os.heightHint = HEIGHT_ATTRIBUTE_COMBO; os.setLayoutData(gd_os); os.addSelectionListener(updateActionSelectionAdapter); - bottomForm.setWeights(new int[] { 88, 90, 50, 77, 88, 85 }); + } private void createSearchGroup(Composite control) { Composite composite = new Composite(control, SWT.NONE); - composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); + gd.horizontalSpan = 4; + composite.setLayoutData(gd); GridLayout gridLayout = new GridLayout(); gridLayout.marginTop = 7; gridLayout.marginHeight = 0; gridLayout.marginWidth = 0; - gridLayout.numColumns = 2; + gridLayout.numColumns = 3; composite.setLayout(gridLayout); Label changedInTheLabel = new Label(composite, SWT.LEFT); @@ -848,7 +878,7 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L Composite updateComposite = new Composite(composite, SWT.NONE); updateComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - GridLayout updateLayout = new GridLayout(3, false); + GridLayout updateLayout = new GridLayout(2, false); updateLayout.marginWidth = 0; updateLayout.horizontalSpacing = 0; updateLayout.marginHeight = 0; @@ -862,33 +892,6 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L Label label = new Label(updateComposite, SWT.LEFT); label.setText(Messages.BugzillaSearchPage_days); - Button updateButton = new Button(updateComposite, SWT.PUSH); - updateButton.setText(Messages.BugzillaSearchPage_Update_Attributes_from_Repository); - updateButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false)); - updateButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (getTaskRepository() != null) { -// try { - - updateConfiguration(true); - -// } catch (final CoreException e1) { -// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { -// public void run() { -// MessageDialog.openError(Display.getDefault().getActiveShell(), "Bugzilla Search Page", -// "Unable to get configuration. Ensure proper repository configuration in " -// + TasksUiPlugin.LABEL_VIEW_REPOSITORIES + ".\n\n"); -// } -// }); -// } - } else { - MessageDialog.openInformation(Display.getCurrent().getActiveShell(), - IBugzillaConstants.TITLE_MESSAGE_DIALOG, - Messages.BugzillaSearchPage_No_repository_available); - } - } - }); } /** @@ -1767,6 +1770,16 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L keywords.setText(settings.get(STORE_KEYWORDS_ID + repoId)); keywordsOperation.select(settings.getInt(STORE_KEYWORDSMATCH_ID + repoId)); } + + if ((commentPattern.getText() != null && !commentPattern.getText().equals("")) || // //$NON-NLS-1$ + (emailPattern2.getText() != null && !emailPattern2.getText().equals("")) || // //$NON-NLS-1$ + (keywords.getText() != null && !keywords.getText().equals("")) || // //$NON-NLS-1$ + severity.getSelection().length > 0 || resolution.getSelection().length > 0 + || version.getSelection().length > 0 || target.getSelection().length > 0 + || hardware.getSelection().length > 0 || os.getSelection().length > 0) { + advancedExpandComposite.setExpanded(true); + } + } catch (IllegalArgumentException e) { //ignore } @@ -1922,8 +1935,6 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L shell.setEnabled(true); } return; -// this.setPageComplete(this.isPageComplete()); -// this.setControlsEnabled(true); } else { StatusHandler.log(new Status(IStatus.ERROR, BugzillaUiPlugin.ID_PLUGIN, cause.getMessage(), cause)); @@ -1992,4 +2003,14 @@ public class BugzillaSearchPage extends AbstractRepositoryQueryPage implements L } } + @Override + public void dispose() { + if (toolkit != null) { + if (toolkit.getColors() != null) { + toolkit.dispose(); + } + } + super.dispose(); + } + } |