Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 46484 Details for
Bug 149605
Refactor Jira query wizard UI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
refactored query ui
Clipboard-attachment (text/plain), 57.75 KB, created by
Eugene Kuleshov
on 2006-07-18 22:16:22 EDT
(
hide
)
Description:
refactored query ui
Filename:
MIME Type:
Creator:
Eugene Kuleshov
Created:
2006-07-18 22:16:22 EDT
Size:
57.75 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.jira >Index: src/org/eclipse/mylar/internal/jira/ui/wizards/FilterSummaryPage.java >=================================================================== >RCS file: /home/technology/org.eclipse.mylar/org.eclipse.mylar.jira/src/org/eclipse/mylar/internal/jira/ui/wizards/FilterSummaryPage.java,v >retrieving revision 1.4 >diff -u -r1.4 FilterSummaryPage.java >--- src/org/eclipse/mylar/internal/jira/ui/wizards/FilterSummaryPage.java 14 Jul 2006 02:20:30 -0000 1.4 >+++ src/org/eclipse/mylar/internal/jira/ui/wizards/FilterSummaryPage.java 19 Jul 2006 02:17:58 -0000 >@@ -14,6 +14,7 @@ > import java.util.ArrayList; > import java.util.Iterator; > import java.util.List; >+import org.eclipse.jface.viewers.ComboViewer; > > import org.eclipse.jface.viewers.IColorProvider; > import org.eclipse.jface.viewers.ILabelProvider; >@@ -26,7 +27,6 @@ > import org.eclipse.jface.viewers.SelectionChangedEvent; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.viewers.Viewer; >-import org.eclipse.jface.wizard.IWizardPage; > import org.eclipse.jface.wizard.WizardPage; > import org.eclipse.mylar.internal.jira.JiraCustomQuery; > import org.eclipse.mylar.internal.jira.JiraServerFacade; >@@ -43,6 +43,7 @@ > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.FillLayout; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; >@@ -51,12 +52,25 @@ > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Text; > import org.tigris.jira.core.model.Component; >+import org.tigris.jira.core.model.IssueType; >+import org.tigris.jira.core.model.Priority; > import org.tigris.jira.core.model.Project; >+import org.tigris.jira.core.model.Resolution; >+import org.tigris.jira.core.model.Status; > import org.tigris.jira.core.model.Version; > import org.tigris.jira.core.model.filter.ComponentFilter; > import org.tigris.jira.core.model.filter.ContentFilter; >+import org.tigris.jira.core.model.filter.CurrentUserFilter; > import org.tigris.jira.core.model.filter.FilterDefinition; >+import org.tigris.jira.core.model.filter.IssueTypeFilter; >+import org.tigris.jira.core.model.filter.NobodyFilter; >+import org.tigris.jira.core.model.filter.PriorityFilter; > import org.tigris.jira.core.model.filter.ProjectFilter; >+import org.tigris.jira.core.model.filter.ResolutionFilter; >+import org.tigris.jira.core.model.filter.SpecificUserFilter; >+import org.tigris.jira.core.model.filter.StatusFilter; >+import org.tigris.jira.core.model.filter.UserFilter; >+import org.tigris.jira.core.model.filter.UserInGroupFilter; > import org.tigris.jira.core.model.filter.VersionFilter; > import org.tigris.jira.core.service.JiraServer; > >@@ -82,21 +96,66 @@ > > final Placeholder NO_COMPONENT = new Placeholder("No Component"); > >+ // attributes >+ >+ final Placeholder ANY_ISSUE_TYPE = new Placeholder("Any"); >+ >+ final Placeholder ANY_RESOLUTION = new Placeholder("Any"); >+ >+ final Placeholder UNRESOLVED = new Placeholder("Unresolved"); >+ >+ final Placeholder UNASSIGNED = new Placeholder("Unassigned"); >+ >+ final Placeholder ANY_REPORTER = new Placeholder("Any"); >+ >+ final Placeholder NO_REPORTER = new Placeholder("No Reporter"); >+ >+ final Placeholder CURRENT_USER_REPORTER = new Placeholder("Current User"); >+ >+ final Placeholder SPECIFIC_USER_REPORTER = new Placeholder("Specified User"); >+ >+ final Placeholder SPECIFIC_GROUP_REPORTER = new Placeholder("Specified Group"); >+ >+ final Placeholder ANY_ASSIGNEE = new Placeholder("Any"); >+ >+ final Placeholder CURRENT_USER_ASSIGNEE = new Placeholder("Current User"); >+ >+ final Placeholder SPECIFIC_USER_ASSIGNEE = new Placeholder("Specified User"); >+ >+ final Placeholder SPECIFIC_GROUP_ASSIGNEE = new Placeholder("Specified Group"); >+ >+ final Placeholder ANY_STATUS = new Placeholder("Any"); >+ >+ final Placeholder ANY_PRIORITY = new Placeholder("Any"); >+ >+ > private final JiraServer server; > >+ private Text name; >+ > private ListViewer project; > > private ListViewer reportedIn; > >- private ListViewer components; >+ private ListViewer listViewer; > > private ListViewer fixFor; >+ >+ private ListViewer issueType; >+ >+ private ListViewer status; >+ >+ private ListViewer resolution; >+ >+ private ListViewer priority; >+ >+ private ComboViewer assigneeType; > >- private final FilterDefinition workingCopy; >+ private Text assignee; > >- private Text name; >+ private ComboViewer reporterType; > >- private Text description; >+ private Text reporter; > > private Text queryString; > >@@ -110,10 +169,12 @@ > > private final boolean isNew; > >- private IssueAttributesPage issueAttributesPage; >- > private final TaskRepository repository; > >+ private final FilterDefinition workingCopy; >+ >+ >+ > /** > * @param pageName > * @param title >@@ -132,7 +193,7 @@ > > public void createControl(Composite parent) { > Composite c = new Composite(parent, SWT.NONE); >- c.setLayout(new GridLayout(5, false)); >+ c.setLayout(new GridLayout(3, false)); > > Label lblName = new Label(c, SWT.NONE); > final GridData gridData = new GridData(); >@@ -140,7 +201,7 @@ > lblName.setText("Name:"); > > name = new Text(c, SWT.BORDER); >- name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 4, 1)); >+ name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); > name.addModifyListener(new ModifyListener() { > > public void modifyText(ModifyEvent e) { >@@ -149,35 +210,16 @@ > > }); > >- if (!isNew) { >- name.setEnabled(false); >- } >- >- Label lblDescription = new Label(c, SWT.NONE); >- lblDescription.setText("Description:"); >- lblDescription.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); >- >- description = new Text(c, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); >- GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false, 4, 1); >- gd.heightHint = 40; >- description.setLayoutData(gd); >- description.addFocusListener(new FocusAdapter() { >- >- public void focusLost(FocusEvent e) { >- validatePage(); >- } >- >- }); >+ SashForm sashForm = new SashForm(c, SWT.VERTICAL); >+ sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 3, 1)); > > { >- SashForm cc = new SashForm(c, SWT.HORIZONTAL); >- cc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 5, 1)); >+ SashForm cc = new SashForm(sashForm, SWT.HORIZONTAL); > > { > Composite comp = new Composite(cc, SWT.NONE); > GridLayout gridLayout = new GridLayout(1, false); > gridLayout.marginWidth = 0; >- gridLayout.marginHeight = 0; > comp.setLayout(gridLayout); > > Label label = new Label(comp, SWT.NONE); >@@ -189,7 +231,6 @@ > Composite comp = new Composite(cc, SWT.NONE); > GridLayout gridLayout = new GridLayout(1, false); > gridLayout.marginWidth = 0; >- gridLayout.marginHeight = 0; > comp.setLayout(gridLayout); > > new Label(comp, SWT.NONE).setText("Fix For:"); >@@ -200,7 +241,6 @@ > Composite comp = new Composite(cc, SWT.NONE); > GridLayout gridLayout = new GridLayout(1, false); > gridLayout.marginWidth = 0; >- gridLayout.marginHeight = 0; > comp.setLayout(gridLayout); > > new Label(comp, SWT.NONE).setText("In Components:"); >@@ -211,21 +251,222 @@ > Composite comp = new Composite(cc, SWT.NONE); > GridLayout gridLayout = new GridLayout(1, false); > gridLayout.marginWidth = 0; >- gridLayout.marginHeight = 0; > comp.setLayout(gridLayout); > > Label label = new Label(comp, SWT.NONE); > label.setText("Reported In:"); > createReportedInViewer(comp); > } >- // cc.setWeights(new int[] {1,1,1,1}); >+ cc.setWeights(new int[] {1,1,1,1}); >+ } >+ >+ { >+ SashForm cc = new SashForm(sashForm, SWT.NONE); >+ >+ ISelectionChangedListener selectionChangeListener = new ISelectionChangedListener() { >+ public void selectionChanged(SelectionChangedEvent event) { >+ validatePage(); >+ } >+ }; >+ >+ { >+ Composite comp = new Composite(cc, SWT.NONE); >+ GridLayout gridLayout = new GridLayout(); >+ gridLayout.marginWidth = 0; >+ comp.setLayout(gridLayout); >+ >+ Label typeLabel = new Label(comp, SWT.NONE); >+ typeLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); >+ typeLabel.setText("Type:"); >+ >+ issueType = new ListViewer(comp, SWT.BORDER); >+ issueType.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ issueType.setContentProvider(new IStructuredContentProvider() { >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ >+ public void dispose() { >+ } >+ >+ public Object[] getElements(Object inputElement) { >+ JiraServer server = (JiraServer) inputElement; >+ Object[] elements = new Object[server.getIssueTypes().length + 1]; >+ elements[0] = ANY_ISSUE_TYPE; >+ System.arraycopy(server.getIssueTypes(), 0, elements, 1, server.getIssueTypes().length); >+ >+ return elements; >+ } >+ }); >+ >+ issueType.setLabelProvider(new LabelProvider() { >+ >+ public String getText(Object element) { >+ if (element instanceof Placeholder) { >+ return ((Placeholder) element).getText(); >+ } >+ >+ return ((IssueType) element).getName(); >+ } >+ >+ }); >+ >+ issueType.addSelectionChangedListener(selectionChangeListener); >+ >+ issueType.setInput(server); >+ } >+ >+ { >+ Composite comp = new Composite(cc, SWT.NONE); >+ GridLayout gridLayout = new GridLayout(); >+ gridLayout.marginWidth = 0; >+ comp.setLayout(gridLayout); >+ >+ Label statusLabel = new Label(comp, SWT.NONE); >+ statusLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); >+ statusLabel.setText("Status:"); >+ >+ status = new ListViewer(comp, SWT.BORDER); >+ status.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ status.setContentProvider(new IStructuredContentProvider() { >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ >+ public void dispose() { >+ } >+ >+ public Object[] getElements(Object inputElement) { >+ JiraServer server = (JiraServer) inputElement; >+ Object[] elements = new Object[server.getStatuses().length + 1]; >+ elements[0] = ANY_STATUS; >+ System.arraycopy(server.getStatuses(), 0, elements, 1, server.getStatuses().length); >+ >+ return elements; >+ } >+ }); >+ >+ status.setLabelProvider(new LabelProvider() { >+ >+ public String getText(Object element) { >+ if (element instanceof Placeholder) { >+ return ((Placeholder) element).getText(); >+ } >+ >+ return ((Status) element).getName(); >+ } >+ >+ }); >+ >+ status.addSelectionChangedListener(selectionChangeListener); >+ status.setInput(server); >+ } >+ >+ { >+ Composite comp = new Composite(cc, SWT.NONE); >+ GridLayout gridLayout = new GridLayout(); >+ gridLayout.marginWidth = 0; >+ comp.setLayout(gridLayout); >+ >+ Label resolutionLabel = new Label(comp, SWT.NONE); >+ resolutionLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); >+ resolutionLabel.setText("Resolution:"); >+ >+ resolution = new ListViewer(comp, SWT.BORDER); >+ resolution.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ resolution.setContentProvider(new IStructuredContentProvider() { >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ >+ public void dispose() { >+ } >+ >+ public Object[] getElements(Object inputElement) { >+ JiraServer server = (JiraServer) inputElement; >+ Object[] elements = new Object[server.getResolutions().length + 2]; >+ elements[0] = ANY_RESOLUTION; >+ elements[1] = UNRESOLVED; >+ System.arraycopy(server.getResolutions(), 0, elements, 2, server.getResolutions().length); >+ >+ return elements; >+ } >+ }); >+ >+ resolution.setLabelProvider(new LabelProvider() { >+ >+ public String getText(Object element) { >+ if (element instanceof Placeholder) { >+ return ((Placeholder) element).getText(); >+ } >+ >+ return ((Resolution) element).getName(); >+ } >+ >+ }); >+ >+ resolution.addSelectionChangedListener(selectionChangeListener); >+ resolution.setInput(server); >+ } >+ >+ { >+ Composite comp = new Composite(cc, SWT.NONE); >+ GridLayout gridLayout = new GridLayout(); >+ gridLayout.marginWidth = 0; >+ comp.setLayout(gridLayout); >+ >+ Label priorityLabel = new Label(comp, SWT.NONE); >+ priorityLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); >+ priorityLabel.setText("Priority:"); >+ >+ priority = new ListViewer(comp, SWT.BORDER); >+ priority.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); >+ >+ priority.setContentProvider(new IStructuredContentProvider() { >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ >+ public void dispose() { >+ } >+ >+ public Object[] getElements(Object inputElement) { >+ JiraServer server = (JiraServer) inputElement; >+ Object[] elements = new Object[server.getPriorities().length + 1]; >+ elements[0] = ANY_PRIORITY; >+ System.arraycopy(server.getPriorities(), 0, elements, 1, server.getPriorities().length); >+ >+ return elements; >+ } >+ }); >+ >+ priority.setLabelProvider(new LabelProvider() { >+ >+ public String getText(Object element) { >+ if (element instanceof Placeholder) { >+ return ((Placeholder) element).getText(); >+ } >+ >+ return ((Priority) element).getName(); >+ } >+ >+ }); >+ priority.addSelectionChangedListener(selectionChangeListener); >+ priority.setInput(server); >+ } >+ >+ cc.setWeights(new int[] {1, 1, 1, 1 }); > } >+ sashForm.setWeights(new int[] {1, 1 }); > > Label lblQuery = new Label(c, SWT.NONE); > lblQuery.setLayoutData(new GridData()); > lblQuery.setText("Query:"); > queryString = new Text(c, SWT.BORDER); >- queryString.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 4, 1)); >+ queryString.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); > // TODO put content assist here and a label describing what is available > > queryString.addFocusListener(new FocusAdapter() { >@@ -238,51 +479,141 @@ > > Label lblFields = new Label(c, SWT.NONE); > lblFields.setText("Fields:"); >- lblFields.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); >+ lblFields.setLayoutData(new GridData()); > >- searchSummary = new Button(c, SWT.CHECK); >- searchSummary.setLayoutData(new GridData()); >- searchSummary.setText("Summary"); >- searchSummary.addSelectionListener(new SelectionAdapter() { >+ { >+ SelectionAdapter selectionAdapter = new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ validatePage(); >+ } >+ }; > >- public void widgetSelected(SelectionEvent e) { >- validatePage(); >- } >+ Composite comp = new Composite(c, SWT.NONE); >+ comp.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); >+ comp.setLayout(new FillLayout()); >+ >+ searchSummary = new Button(comp, SWT.CHECK); >+ searchSummary.setText("Summary"); >+ searchSummary.addSelectionListener(selectionAdapter); >+ >+ searchDescription = new Button(comp, SWT.CHECK); >+ searchDescription.setText("Description"); >+ searchDescription.addSelectionListener(selectionAdapter); >+ >+ searchComments = new Button(comp, SWT.CHECK); >+ searchComments.setText("Comments"); >+ searchComments.addSelectionListener(selectionAdapter); >+ >+ searchEnvironment = new Button(comp, SWT.CHECK); >+ searchEnvironment.setText("Environment"); >+ searchEnvironment.addSelectionListener(selectionAdapter); >+ } >+ >+ { >+ Label reportedByLabel = new Label(c, SWT.NONE); >+ reportedByLabel.setText("Reported By:"); > >- }); >+ reporterType = new ComboViewer(c, SWT.BORDER | SWT.READ_ONLY); >+ GridData gridData_1 = new GridData(SWT.FILL, SWT.CENTER, false, false); >+ gridData_1.widthHint = 133; >+ reporterType.getControl().setLayoutData(gridData_1); >+ >+ reporterType.setContentProvider(new IStructuredContentProvider() { >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ >+ public void dispose() { >+ } >+ >+ public Object[] getElements(Object inputElement) { >+ return new Object[] { ANY_REPORTER, NO_REPORTER, CURRENT_USER_REPORTER, SPECIFIC_USER_REPORTER, >+ SPECIFIC_GROUP_REPORTER }; >+ } >+ >+ }); >+ >+ reporterType.setLabelProvider(new LabelProvider() { >+ public String getText(Object element) { >+ return ((Placeholder) element).getText(); >+ } >+ }); >+ >+ reporterType.setInput(server); >+ >+ reporter = new Text(c, SWT.BORDER); >+ reporter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); >+ reporter.setEnabled(false); >+ >+ reporter.addModifyListener(new ModifyListener() { > >- searchDescription = new Button(c, SWT.CHECK); >- searchDescription.setLayoutData(new GridData()); >- searchDescription.setText("Description"); >- searchDescription.addSelectionListener(new SelectionAdapter() { >+ public void modifyText(ModifyEvent e) { >+ validatePage(); >+ } > >- public void widgetSelected(SelectionEvent e) { >- validatePage(); >- } >+ }); >+ } > >- }); >+ { >+ Label assignedToLabel = new Label(c, SWT.NONE); >+ assignedToLabel.setText("Assigned To:"); >+ >+ assigneeType = new ComboViewer(c, SWT.BORDER | SWT.READ_ONLY); >+ GridData gridData_2 = new GridData(SWT.FILL, SWT.CENTER, false, false); >+ gridData_2.widthHint = 133; >+ assigneeType.getCombo().setLayoutData(gridData_2); >+ >+ assigneeType.setContentProvider(new IStructuredContentProvider() { > >- searchComments = new Button(c, SWT.CHECK); >- searchComments.setLayoutData(new GridData()); >- searchComments.setText("Comments"); >- searchComments.addSelectionListener(new SelectionAdapter() { >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } > >- public void widgetSelected(SelectionEvent e) { >- validatePage(); >- } >+ public void dispose() { >+ } > >- }); >+ public Object[] getElements(Object inputElement) { >+ return new Object[] { ANY_ASSIGNEE, UNASSIGNED, CURRENT_USER_ASSIGNEE, SPECIFIC_USER_ASSIGNEE, >+ SPECIFIC_GROUP_ASSIGNEE }; >+ } > >- searchEnvironment = new Button(c, SWT.CHECK); >- searchEnvironment.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); >- searchEnvironment.setText("Environment"); >- searchEnvironment.addSelectionListener(new SelectionAdapter() { >+ }); > >- public void widgetSelected(SelectionEvent e) { >- validatePage(); >- } >+ assigneeType.setLabelProvider(new LabelProvider() { > >- }); >+ public String getText(Object element) { >+ return ((Placeholder) element).getText(); >+ } >+ >+ }); >+ >+ assigneeType.addSelectionChangedListener(new ISelectionChangedListener() { >+ >+ public void selectionChanged(SelectionChangedEvent event) { >+ Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement(); >+ if (SPECIFIC_USER_ASSIGNEE.equals(selection) || SPECIFIC_GROUP_ASSIGNEE.equals(selection)) { >+ assignee.setEnabled(true); >+ } else { >+ assignee.setEnabled(false); >+ assignee.setText(""); //$NON-NLS-1$ >+ } >+ validatePage(); >+ } >+ >+ }); >+ >+ assigneeType.setInput(server); >+ >+ assignee = new Text(c, SWT.BORDER); >+ assignee.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); >+ assignee.setEnabled(false); >+ assignee.addModifyListener(new ModifyListener() { >+ >+ public void modifyText(ModifyEvent e) { >+ validatePage(); >+ } >+ >+ }); >+ } > > // Need to turn off validation here > if (isNew) { >@@ -294,20 +625,11 @@ > setControl(c); > } > >- public IWizardPage getNextPage() { >- if (issueAttributesPage == null) { >- issueAttributesPage = new IssueAttributesPage(repository, workingCopy, isNew); >- issueAttributesPage.setWizard(getWizard()); >- } >- >- return issueAttributesPage; >- } >- > private void createReportedInViewer(Composite c) { > reportedIn = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 200; >- gridData.widthHint = 80; >+ gridData.heightHint = 60; >+ gridData.widthHint = 90; > reportedIn.getControl().setLayoutData(gridData); > > reportedIn.setContentProvider(new IStructuredContentProvider() { >@@ -347,13 +669,13 @@ > } > > private void createComponentsViewer(Composite c) { >- components = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); >+ listViewer = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 200; >- gridData.widthHint = 80; >- components.getControl().setLayoutData(gridData); >+ gridData.heightHint = 60; >+ gridData.widthHint = 90; >+ listViewer.getControl().setLayoutData(gridData); > >- components.setContentProvider(new IStructuredContentProvider() { >+ listViewer.setContentProvider(new IStructuredContentProvider() { > private Project project; > > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >@@ -377,15 +699,15 @@ > } > > }); >- components.setLabelProvider(new ComponentLabelProvider()); >- components.setInput(null); >+ listViewer.setLabelProvider(new ComponentLabelProvider()); >+ listViewer.setInput(null); > } > > private void createFixForViewer(Composite c) { > fixFor = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 200; >- gridData.widthHint = 80; >+ gridData.heightHint = 60; >+ gridData.widthHint = 90; > fixFor.getControl().setLayoutData(gridData); > > fixFor.setContentProvider(new IStructuredContentProvider() { >@@ -427,8 +749,8 @@ > private void createProjectsViewer(Composite c) { > project = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 200; >- gridData.widthHint = 120; >+ gridData.heightHint = 60; >+ gridData.widthHint = 90; > project.getControl().setLayoutData(gridData); > > project.setContentProvider(new IStructuredContentProvider() { >@@ -481,7 +803,7 @@ > > void updateCurrentProject(Project project) { > this.fixFor.setInput(project); >- this.components.setInput(project); >+ this.listViewer.setInput(project); > this.reportedIn.setInput(project); > > } >@@ -501,6 +823,14 @@ > project.setSelection(new StructuredSelection(new Placeholder("All Projects"))); > searchSummary.setSelection(true); > searchDescription.setSelection(true); >+ >+ issueType.setSelection(new StructuredSelection(ANY_ISSUE_TYPE)); >+ reporterType.setSelection(new StructuredSelection(ANY_REPORTER)); >+ assigneeType.setSelection(new StructuredSelection(ANY_ASSIGNEE)); >+ status.setSelection(new StructuredSelection(ANY_STATUS)); >+ resolution.setSelection(new StructuredSelection(ANY_RESOLUTION)); >+ priority.setSelection(new StructuredSelection(ANY_PRIORITY)); >+ > } > > private void loadFromWorkingCopy() { >@@ -509,7 +839,6 @@ > } > > if (workingCopy.getDescription() != null) { >- description.setText(workingCopy.getDescription()); > } > > if (workingCopy.getProjectFilter() != null) { >@@ -563,18 +892,78 @@ > > if (workingCopy.getComponentFilter() != null) { > if (workingCopy.getComponentFilter().hasNoComponent()) { >- components.setSelection(new StructuredSelection(NO_COMPONENT)); >+ listViewer.setSelection(new StructuredSelection(NO_COMPONENT)); > } else { >- components.setSelection(new StructuredSelection(workingCopy.getComponentFilter().getComponents())); >+ listViewer.setSelection(new StructuredSelection(workingCopy.getComponentFilter().getComponents())); > } > } else { >- components.setSelection(new StructuredSelection(ANY_COMPONENT)); >+ listViewer.setSelection(new StructuredSelection(ANY_COMPONENT)); >+ } >+ >+ // attributes >+ >+ if (workingCopy.getIssueTypeFilter() != null) { >+ issueType.setSelection(new StructuredSelection(workingCopy.getIssueTypeFilter().getIsueTypes())); >+ } else { >+ issueType.setSelection(new StructuredSelection(ANY_ISSUE_TYPE)); >+ } >+ >+ if (workingCopy.getReportedByFilter() != null) { >+ UserFilter reportedByFilter = workingCopy.getReportedByFilter(); >+ if (reportedByFilter instanceof NobodyFilter) { >+ reporterType.setSelection(new StructuredSelection(NO_REPORTER)); >+ } else if (reportedByFilter instanceof CurrentUserFilter) { >+ reporterType.setSelection(new StructuredSelection(CURRENT_USER_REPORTER)); >+ } else if (reportedByFilter instanceof SpecificUserFilter) { >+ reporterType.setSelection(new StructuredSelection(SPECIFIC_USER_REPORTER)); >+ reporter.setText(((SpecificUserFilter) reportedByFilter).getUser()); >+ } else if (reportedByFilter instanceof UserInGroupFilter) { >+ reporterType.setSelection(new StructuredSelection(SPECIFIC_GROUP_REPORTER)); >+ reporter.setText(((UserInGroupFilter) reportedByFilter).getGroup()); >+ } >+ } else { >+ reporterType.setSelection(new StructuredSelection(ANY_REPORTER)); >+ } >+ >+ if (workingCopy.getAssignedToFilter() != null) { >+ UserFilter assignedToFilter = workingCopy.getAssignedToFilter(); >+ if (assignedToFilter instanceof NobodyFilter) { >+ assigneeType.setSelection(new StructuredSelection(UNASSIGNED)); >+ } else if (assignedToFilter instanceof CurrentUserFilter) { >+ assigneeType.setSelection(new StructuredSelection(CURRENT_USER_ASSIGNEE)); >+ } else if (assignedToFilter instanceof SpecificUserFilter) { >+ assigneeType.setSelection(new StructuredSelection(SPECIFIC_USER_ASSIGNEE)); >+ assignee.setText(((SpecificUserFilter) assignedToFilter).getUser()); >+ } else if (assignedToFilter instanceof UserInGroupFilter) { >+ assigneeType.setSelection(new StructuredSelection(SPECIFIC_GROUP_ASSIGNEE)); >+ assignee.setText(((UserInGroupFilter) assignedToFilter).getGroup()); >+ } >+ } else { >+ assigneeType.setSelection(new StructuredSelection(ANY_ASSIGNEE)); >+ } >+ >+ if (workingCopy.getStatusFilter() != null) { >+ status.setSelection(new StructuredSelection(workingCopy.getStatusFilter().getStatuses())); >+ } else { >+ status.setSelection(new StructuredSelection(ANY_STATUS)); >+ } >+ >+ if (workingCopy.getResolutionFilter() != null) { >+ resolution.setSelection(new StructuredSelection(workingCopy.getResolutionFilter().getResolutions())); >+ } else { >+ resolution.setSelection(new StructuredSelection(ANY_RESOLUTION)); > } >+ >+ if (workingCopy.getPriorityFilter() != null) { >+ priority.setSelection(new StructuredSelection(workingCopy.getPriorityFilter().getPriorities())); >+ } else { >+ priority.setSelection(new StructuredSelection(ANY_PRIORITY)); >+ } >+ > } > > /* default */void applyChanges() { > workingCopy.setName(this.name.getText()); >- workingCopy.setDescription(this.description.getText()); > if (this.queryString.getText().length() > 0 || this.searchSummary.getSelection() > || this.searchDescription.getSelection() || this.searchEnvironment.getSelection() > || this.searchComments.getSelection()) { >@@ -674,7 +1063,7 @@ > } > } > >- IStructuredSelection componentsSelection = (IStructuredSelection) components.getSelection(); >+ IStructuredSelection componentsSelection = (IStructuredSelection) listViewer.getSelection(); > if (componentsSelection.isEmpty()) { > workingCopy.setComponentFilter(null); > } else { >@@ -705,6 +1094,147 @@ > workingCopy.setComponentFilter(null); > } > } >+ >+ // attributes >+ >+ // TODO support standard and subtask issue types >+ IStructuredSelection issueTypeSelection = (IStructuredSelection) issueType.getSelection(); >+ if (issueTypeSelection.isEmpty()) { >+ workingCopy.setIssueTypeFilter(null); >+ } else { >+ boolean isAnyIssueTypeSelected = false; >+ >+ List<IssueType> selectedIssueTypes = new ArrayList<IssueType>(); >+ >+ for (Iterator i = issueTypeSelection.iterator(); i.hasNext();) { >+ Object selection = i.next(); >+ if (ANY_ISSUE_TYPE.equals(selection)) { >+ isAnyIssueTypeSelected = true; >+ } else if (selection instanceof IssueType) { >+ selectedIssueTypes.add((IssueType) selection); >+ } >+ } >+ >+ if (isAnyIssueTypeSelected) { >+ workingCopy.setIssueTypeFilter(null); >+ } else { >+ workingCopy.setIssueTypeFilter( >+ new IssueTypeFilter(selectedIssueTypes.toArray(new IssueType[selectedIssueTypes.size()]))); >+ } >+ } >+ >+ IStructuredSelection reporterSelection = (IStructuredSelection) reporterType.getSelection(); >+ if (reporterSelection.isEmpty()) { >+ workingCopy.setReportedByFilter(null); >+ } else { >+ if (ANY_REPORTER.equals(reporterSelection.getFirstElement())) { >+ workingCopy.setReportedByFilter(null); >+ } else if (NO_REPORTER.equals(reporterSelection.getFirstElement())) { >+ workingCopy.setReportedByFilter(new NobodyFilter()); >+ } else if (CURRENT_USER_REPORTER.equals(reporterSelection.getFirstElement())) { >+ workingCopy.setReportedByFilter(new CurrentUserFilter()); >+ } else if (SPECIFIC_GROUP_REPORTER.equals(reporterSelection.getFirstElement())) { >+ workingCopy.setReportedByFilter(new UserInGroupFilter(reporter.getText())); >+ } else if (SPECIFIC_USER_REPORTER.equals(reporterSelection.getFirstElement())) { >+ workingCopy.setReportedByFilter(new SpecificUserFilter(reporter.getText())); >+ } else { >+ workingCopy.setReportedByFilter(null); >+ } >+ } >+ >+ IStructuredSelection assigneeSelection = (IStructuredSelection) assigneeType.getSelection(); >+ if (assigneeSelection.isEmpty()) { >+ workingCopy.setAssignedToFilter(null); >+ } else { >+ if (ANY_REPORTER.equals(assigneeSelection.getFirstElement())) { >+ workingCopy.setAssignedToFilter(null); >+ } else if (UNASSIGNED.equals(assigneeSelection.getFirstElement())) { >+ workingCopy.setAssignedToFilter(new NobodyFilter()); >+ } else if (CURRENT_USER_REPORTER.equals(assigneeSelection.getFirstElement())) { >+ workingCopy.setAssignedToFilter(new CurrentUserFilter()); >+ } else if (SPECIFIC_GROUP_REPORTER.equals(assigneeSelection.getFirstElement())) { >+ workingCopy.setAssignedToFilter(new UserInGroupFilter(assignee.getText())); >+ } else if (SPECIFIC_USER_REPORTER.equals(assigneeSelection.getFirstElement())) { >+ workingCopy.setAssignedToFilter(new SpecificUserFilter(assignee.getText())); >+ } else { >+ workingCopy.setAssignedToFilter(null); >+ } >+ } >+ >+ IStructuredSelection statusSelection = (IStructuredSelection) status.getSelection(); >+ if (statusSelection.isEmpty()) { >+ workingCopy.setStatusFilter(null); >+ } else { >+ boolean isAnyStatusSelected = false; >+ >+ List<Status> selectedStatuses = new ArrayList<Status>(); >+ >+ for (Iterator i = statusSelection.iterator(); i.hasNext();) { >+ Object selection = i.next(); >+ if (ANY_STATUS.equals(selection)) { >+ isAnyStatusSelected = true; >+ } else if (selection instanceof Status) { >+ selectedStatuses.add((Status) selection); >+ } >+ } >+ >+ if (isAnyStatusSelected) { >+ workingCopy.setStatusFilter(null); >+ } else { >+ workingCopy.setStatusFilter( >+ new StatusFilter(selectedStatuses.toArray(new Status[selectedStatuses.size()]))); >+ } >+ } >+ >+ IStructuredSelection resolutionSelection = (IStructuredSelection) resolution.getSelection(); >+ if (resolutionSelection.isEmpty()) { >+ workingCopy.setResolutionFilter(null); >+ } else { >+ boolean isAnyResolutionSelected = false; >+ >+ List<Resolution> selectedResolutions = new ArrayList<Resolution>(); >+ >+ for (Iterator i = resolutionSelection.iterator(); i.hasNext();) { >+ Object selection = i.next(); >+ if (ANY_RESOLUTION.equals(selection)) { >+ isAnyResolutionSelected = true; >+ } else if (selection instanceof Resolution) { >+ selectedResolutions.add((Resolution) selection); >+ } >+ } >+ >+ if (isAnyResolutionSelected) { >+ workingCopy.setResolutionFilter(null); >+ } else { >+ workingCopy.setResolutionFilter( >+ new ResolutionFilter(selectedResolutions.toArray(new Resolution[selectedResolutions.size()]))); >+ } >+ } >+ >+ IStructuredSelection prioritySelection = (IStructuredSelection) priority.getSelection(); >+ if (prioritySelection.isEmpty()) { >+ workingCopy.setPriorityFilter(null); >+ } else { >+ boolean isAnyPrioritiesSelected = false; >+ >+ List<Priority> selectedPriorities = new ArrayList<Priority>(); >+ >+ for (Iterator i = prioritySelection.iterator(); i.hasNext();) { >+ Object selection = i.next(); >+ if (ANY_PRIORITY.equals(selection)) { >+ isAnyPrioritiesSelected = true; >+ } else if (selection instanceof Priority) { >+ selectedPriorities.add((Priority) selection); >+ } >+ } >+ >+ if (isAnyPrioritiesSelected) { >+ workingCopy.setPriorityFilter(null); >+ } else { >+ workingCopy.setPriorityFilter( >+ new PriorityFilter(selectedPriorities.toArray(new Priority[selectedPriorities.size()]))); >+ } >+ } > } > > final class ComponentLabelProvider implements ILabelProvider { >@@ -876,7 +1406,6 @@ > > public AbstractRepositoryQuery getQuery() { > this.applyChanges(); >- issueAttributesPage.applyChanges(); > if (isNew) { > server.addLocalFilter(workingCopy); > } >Index: src/org/eclipse/mylar/internal/jira/ui/wizards/IssueAttributesPage.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/jira/ui/wizards/IssueAttributesPage.java >diff -N src/org/eclipse/mylar/internal/jira/ui/wizards/IssueAttributesPage.java >--- src/org/eclipse/mylar/internal/jira/ui/wizards/IssueAttributesPage.java 13 Jul 2006 16:04:18 -0000 1.3 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,716 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2006 - 2006 Mylar eclipse.org project 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: >- * Brock Janiczak - initial API and implementation >- *******************************************************************************/ >- >-package org.eclipse.mylar.internal.jira.ui.wizards; >- >-import java.util.ArrayList; >-import java.util.Iterator; >-import java.util.List; >- >-import org.eclipse.jface.viewers.ComboViewer; >-import org.eclipse.jface.viewers.ISelectionChangedListener; >-import org.eclipse.jface.viewers.IStructuredContentProvider; >-import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.jface.viewers.LabelProvider; >-import org.eclipse.jface.viewers.ListViewer; >-import org.eclipse.jface.viewers.SelectionChangedEvent; >-import org.eclipse.jface.viewers.StructuredSelection; >-import org.eclipse.jface.viewers.Viewer; >-import org.eclipse.jface.wizard.WizardPage; >-import org.eclipse.mylar.internal.jira.JiraServerFacade; >-import org.eclipse.mylar.tasks.core.TaskRepository; >-import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.ModifyEvent; >-import org.eclipse.swt.events.ModifyListener; >-import org.eclipse.swt.layout.GridData; >-import org.eclipse.swt.layout.GridLayout; >-import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Label; >-import org.eclipse.swt.widgets.Text; >-import org.tigris.jira.core.model.IssueType; >-import org.tigris.jira.core.model.Priority; >-import org.tigris.jira.core.model.Resolution; >-import org.tigris.jira.core.model.Status; >-import org.tigris.jira.core.model.filter.CurrentUserFilter; >-import org.tigris.jira.core.model.filter.FilterDefinition; >-import org.tigris.jira.core.model.filter.IssueTypeFilter; >-import org.tigris.jira.core.model.filter.NobodyFilter; >-import org.tigris.jira.core.model.filter.PriorityFilter; >-import org.tigris.jira.core.model.filter.ResolutionFilter; >-import org.tigris.jira.core.model.filter.SpecificUserFilter; >-import org.tigris.jira.core.model.filter.StatusFilter; >-import org.tigris.jira.core.model.filter.UserFilter; >-import org.tigris.jira.core.model.filter.UserInGroupFilter; >-import org.tigris.jira.core.service.JiraServer; >- >-/** >- * @author Brock Janiczak >- * @author Eugene Kuleshov (layout and other improvements) >- */ >-public class IssueAttributesPage extends WizardPage { >- final Placeholder ANY_ISSUE_TYPE = new Placeholder("Any"); >- >- final Placeholder ANY_RESOLUTION = new Placeholder("Any"); >- >- final Placeholder UNRESOLVED = new Placeholder("Unresolved"); >- >- final Placeholder UNASSIGNED = new Placeholder("Unassigned"); >- >- final Placeholder ANY_REPORTER = new Placeholder("Any"); >- >- final Placeholder NO_REPORTER = new Placeholder("No Reporter"); >- >- final Placeholder CURRENT_USER_REPORTER = new Placeholder("Current User"); >- >- final Placeholder SPECIFIC_USER_REPORTER = new Placeholder("Specified User"); >- >- final Placeholder SPECIFIC_GROUP_REPORTER = new Placeholder("Specified Group"); >- >- final Placeholder ANY_ASSIGNEE = new Placeholder("Any"); >- >- final Placeholder CURRENT_USER_ASSIGNEE = new Placeholder("Current User"); >- >- final Placeholder SPECIFIC_USER_ASSIGNEE = new Placeholder("Specified User"); >- >- final Placeholder SPECIFIC_GROUP_ASSIGNEE = new Placeholder("Specified Group"); >- >- final Placeholder ANY_STATUS = new Placeholder("Any"); >- >- final Placeholder ANY_PRIORITY = new Placeholder("Any"); >- >-// private final TaskRepository repository; >- >- private final JiraServer jiraServer; >- >- private final FilterDefinition workingCopy; >- >- private final boolean isNew; >- >- private ListViewer issueType; >- >- private ComboViewer reporterType; >- >- private ComboViewer assigneeType; >- >- private ListViewer status; >- >- private ListViewer resolution; >- >- private ListViewer priority; >- >- Text assignee; >- >- Text reporter; >- >- /** >- * @param repository >- * @param pageName >- * @param title >- * @param titleImage >- * @param server >- */ >- protected IssueAttributesPage(TaskRepository repository, FilterDefinition workingCopy, boolean isNew) { >- super("issueAttributes", "Issue Attributes", null); >- this.jiraServer = JiraServerFacade.getDefault().getJiraServer(repository); >- this.workingCopy = workingCopy; >- this.isNew = isNew; >- >- setPageComplete(false); >- } >- >- /* >- * (non-Javadoc) >- * >- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) >- */ >- public void createControl(Composite parent) { >- GridData gd; >- >- Composite cc = new Composite(parent, SWT.NONE); >- cc.setLayout(new GridLayout(1, false)); >- >- { >- Composite c = new Composite(cc, SWT.NONE); >- final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); >- gridData.widthHint = 515; >- c.setLayoutData(gridData); >- c.setLayout(new GridLayout(3, false)); >- >- Label lblReportedBy = new Label(c, SWT.NONE); >- lblReportedBy.setText("Reported By:"); >- lblReportedBy.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); >- >- reporterType = new ComboViewer(c, SWT.BORDER | SWT.READ_ONLY); >- final GridData gridData_1 = new GridData(SWT.FILL, SWT.FILL, false, false); >- gridData_1.widthHint = 133; >- reporterType.getControl().setLayoutData(gridData_1); >- >- reporterType.setContentProvider(new IStructuredContentProvider() { >- >- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >- } >- >- public void dispose() { >- } >- >- public Object[] getElements(Object inputElement) { >- return new Object[] { ANY_REPORTER, NO_REPORTER, CURRENT_USER_REPORTER, SPECIFIC_USER_REPORTER, >- SPECIFIC_GROUP_REPORTER }; >- } >- >- }); >- >- reporterType.setLabelProvider(new LabelProvider() { >- >- public String getText(Object element) { >- return ((Placeholder) element).getText(); >- } >- >- }); >- >- reporterType.setInput(jiraServer); >- >- reporter = new Text(c, SWT.BORDER); >- reporter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); >- reporter.setEnabled(false); >- >- reporter.addModifyListener(new ModifyListener() { >- >- public void modifyText(ModifyEvent e) { >- validatePage(); >- } >- >- }); >- >- Label lblAssignedTo = new Label(c, SWT.NONE); >- lblAssignedTo.setText("Assigned To:"); >- lblAssignedTo.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); >- >- assigneeType = new ComboViewer(c, SWT.BORDER | SWT.READ_ONLY); >- final GridData gridData_2 = new GridData(SWT.FILL, SWT.FILL, false, false); >- gridData_2.widthHint = 118; >- assigneeType.getControl().setLayoutData(gridData_2); >- >- assigneeType.setContentProvider(new IStructuredContentProvider() { >- >- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >- } >- >- public void dispose() { >- } >- >- public Object[] getElements(Object inputElement) { >- return new Object[] { ANY_ASSIGNEE, UNASSIGNED, CURRENT_USER_ASSIGNEE, SPECIFIC_USER_ASSIGNEE, >- SPECIFIC_GROUP_ASSIGNEE }; >- } >- >- }); >- >- assigneeType.setLabelProvider(new LabelProvider() { >- >- public String getText(Object element) { >- return ((Placeholder) element).getText(); >- } >- >- }); >- >- assigneeType.setInput(jiraServer); >- assigneeType.addSelectionChangedListener(new ISelectionChangedListener() { >- >- public void selectionChanged(SelectionChangedEvent event) { >- Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement(); >- if (SPECIFIC_USER_ASSIGNEE.equals(selection) || SPECIFIC_GROUP_ASSIGNEE.equals(selection)) { >- assignee.setEnabled(true); >- } else { >- assignee.setEnabled(false); >- assignee.setText(""); //$NON-NLS-1$ >- } >- validatePage(); >- } >- >- }); >- >- reporterType.addSelectionChangedListener(new ISelectionChangedListener() { >- >- public void selectionChanged(SelectionChangedEvent event) { >- Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement(); >- if (SPECIFIC_USER_REPORTER.equals(selection) || SPECIFIC_GROUP_REPORTER.equals(selection)) { >- reporter.setEnabled(true); >- } else { >- reporter.setEnabled(false); >- } >- } >- >- }); >- >- assignee = new Text(c, SWT.BORDER); >- assignee.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); >- assignee.setEnabled(false); >- >- assignee.addModifyListener(new ModifyListener() { >- >- public void modifyText(ModifyEvent e) { >- validatePage(); >- } >- >- }); >- >- } >- >- { >- Composite c = new Composite(cc, SWT.NONE); >- final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 149; >- c.setLayoutData(gridData); >- c.setLayout(new GridLayout(4, false)); >- >- Label lblIssueType = new Label(c, SWT.NONE); >- lblIssueType.setText("Type:"); >- >- Label lblStatus = new Label(c, SWT.NONE); >- lblStatus.setText("Status:"); >- >- Label lblResolution = new Label(c, SWT.NONE); >- lblResolution.setText("Resolution:"); >- >- Label lblPriority = new Label(c, SWT.NONE); >- lblPriority.setText("Priority:"); >- >- issueType = new ListViewer(c, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); >- gd = new GridData(SWT.FILL, SWT.FILL, true, true); >- gd.heightHint = 40; >- issueType.getControl().setLayoutData(gd); >- >- issueType.setContentProvider(new IStructuredContentProvider() { >- >- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >- } >- >- public void dispose() { >- } >- >- public Object[] getElements(Object inputElement) { >- JiraServer server = (JiraServer) inputElement; >- Object[] elements = new Object[server.getIssueTypes().length + 1]; >- elements[0] = ANY_ISSUE_TYPE; >- System.arraycopy(server.getIssueTypes(), 0, elements, 1, server.getIssueTypes().length); >- >- return elements; >- } >- }); >- >- issueType.setLabelProvider(new LabelProvider() { >- >- public String getText(Object element) { >- if (element instanceof Placeholder) { >- return ((Placeholder) element).getText(); >- } >- >- return ((IssueType) element).getName(); >- } >- >- }); >- >- issueType.addSelectionChangedListener(new ISelectionChangedListener() { >- >- public void selectionChanged(SelectionChangedEvent event) { >- validatePage(); >- } >- >- }); >- issueType.setInput(jiraServer); >- >- status = new ListViewer(c, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); >- gd = new GridData(SWT.FILL, SWT.FILL, true, true); >- gd.heightHint = 40; >- status.getControl().setLayoutData(gd); >- >- status.setContentProvider(new IStructuredContentProvider() { >- >- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >- } >- >- public void dispose() { >- } >- >- public Object[] getElements(Object inputElement) { >- JiraServer server = (JiraServer) inputElement; >- Object[] elements = new Object[server.getStatuses().length + 1]; >- elements[0] = ANY_STATUS; >- System.arraycopy(server.getStatuses(), 0, elements, 1, server.getStatuses().length); >- >- return elements; >- } >- }); >- >- status.setLabelProvider(new LabelProvider() { >- >- public String getText(Object element) { >- if (element instanceof Placeholder) { >- return ((Placeholder) element).getText(); >- } >- >- return ((Status) element).getName(); >- } >- >- }); >- >- status.addSelectionChangedListener(new ISelectionChangedListener() { >- >- public void selectionChanged(SelectionChangedEvent event) { >- validatePage(); >- } >- >- }); >- status.setInput(jiraServer); >- >- resolution = new ListViewer(c, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); >- gd = new GridData(SWT.FILL, SWT.FILL, true, true); >- gd.heightHint = 40; >- resolution.getControl().setLayoutData(gd); >- resolution.setContentProvider(new IStructuredContentProvider() { >- >- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >- } >- >- public void dispose() { >- } >- >- public Object[] getElements(Object inputElement) { >- JiraServer server = (JiraServer) inputElement; >- Object[] elements = new Object[server.getResolutions().length + 2]; >- elements[0] = ANY_RESOLUTION; >- elements[1] = UNRESOLVED; >- System.arraycopy(server.getResolutions(), 0, elements, 2, server.getResolutions().length); >- >- return elements; >- } >- }); >- >- resolution.setLabelProvider(new LabelProvider() { >- >- public String getText(Object element) { >- if (element instanceof Placeholder) { >- return ((Placeholder) element).getText(); >- } >- >- return ((Resolution) element).getName(); >- } >- >- }); >- >- resolution.addSelectionChangedListener(new ISelectionChangedListener() { >- >- public void selectionChanged(SelectionChangedEvent event) { >- validatePage(); >- } >- >- }); >- resolution.setInput(jiraServer); >- >- priority = new ListViewer(c, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); >- gd = new GridData(SWT.FILL, SWT.FILL, true, true); >- gd.heightHint = 40; >- priority.getControl().setLayoutData(gd); >- >- priority.setContentProvider(new IStructuredContentProvider() { >- >- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >- } >- >- public void dispose() { >- } >- >- public Object[] getElements(Object inputElement) { >- JiraServer server = (JiraServer) inputElement; >- Object[] elements = new Object[server.getPriorities().length + 1]; >- elements[0] = ANY_PRIORITY; >- System.arraycopy(server.getPriorities(), 0, elements, 1, server.getPriorities().length); >- >- return elements; >- } >- }); >- >- priority.setLabelProvider(new LabelProvider() { >- >- public String getText(Object element) { >- if (element instanceof Placeholder) { >- return ((Placeholder) element).getText(); >- } >- >- return ((Priority) element).getName(); >- } >- >- }); >- priority.addSelectionChangedListener(new ISelectionChangedListener() { >- >- public void selectionChanged(SelectionChangedEvent event) { >- validatePage(); >- } >- >- }); >- priority.setInput(jiraServer); >- } >- >- if (isNew) { >- loadFromDefaults(); >- } else { >- loadFromWorkingCopy(); >- } >- >- setControl(cc); >- } >- >- void validatePage() { >- >- } >- >- /* default */void applyChanges() { >- if(issueType==null) { >- return; >- } >- >- // TODO support standard and subtask issue types >- IStructuredSelection issueTypeSelection = (IStructuredSelection) issueType.getSelection(); >- if (issueTypeSelection.isEmpty()) { >- workingCopy.setIssueTypeFilter(null); >- } else { >- boolean isAnyIssueTypeSelected = false; >- >- List<IssueType> selectedIssueTypes = new ArrayList<IssueType>(); >- >- for (Iterator i = issueTypeSelection.iterator(); i.hasNext();) { >- Object selection = i.next(); >- if (ANY_ISSUE_TYPE.equals(selection)) { >- isAnyIssueTypeSelected = true; >- } else if (selection instanceof IssueType) { >- selectedIssueTypes.add((IssueType) selection); >- } >- } >- >- if (isAnyIssueTypeSelected) { >- workingCopy.setIssueTypeFilter(null); >- } else { >- workingCopy.setIssueTypeFilter( >- new IssueTypeFilter(selectedIssueTypes.toArray(new IssueType[selectedIssueTypes.size()]))); >- } >- } >- >- IStructuredSelection reporterSelection = (IStructuredSelection) reporterType.getSelection(); >- if (reporterSelection.isEmpty()) { >- workingCopy.setReportedByFilter(null); >- } else { >- if (ANY_REPORTER.equals(reporterSelection.getFirstElement())) { >- workingCopy.setReportedByFilter(null); >- } else if (NO_REPORTER.equals(reporterSelection.getFirstElement())) { >- workingCopy.setReportedByFilter(new NobodyFilter()); >- } else if (CURRENT_USER_REPORTER.equals(reporterSelection.getFirstElement())) { >- workingCopy.setReportedByFilter(new CurrentUserFilter()); >- } else if (SPECIFIC_GROUP_REPORTER.equals(reporterSelection.getFirstElement())) { >- workingCopy.setReportedByFilter(new UserInGroupFilter(reporter.getText())); >- } else if (SPECIFIC_USER_REPORTER.equals(reporterSelection.getFirstElement())) { >- workingCopy.setReportedByFilter(new SpecificUserFilter(reporter.getText())); >- } else { >- workingCopy.setReportedByFilter(null); >- } >- } >- >- IStructuredSelection assigneeSelection = (IStructuredSelection) assigneeType.getSelection(); >- if (assigneeSelection.isEmpty()) { >- workingCopy.setAssignedToFilter(null); >- } else { >- if (ANY_REPORTER.equals(assigneeSelection.getFirstElement())) { >- workingCopy.setAssignedToFilter(null); >- } else if (UNASSIGNED.equals(assigneeSelection.getFirstElement())) { >- workingCopy.setAssignedToFilter(new NobodyFilter()); >- } else if (CURRENT_USER_REPORTER.equals(assigneeSelection.getFirstElement())) { >- workingCopy.setAssignedToFilter(new CurrentUserFilter()); >- } else if (SPECIFIC_GROUP_REPORTER.equals(assigneeSelection.getFirstElement())) { >- workingCopy.setAssignedToFilter(new UserInGroupFilter(assignee.getText())); >- } else if (SPECIFIC_USER_REPORTER.equals(assigneeSelection.getFirstElement())) { >- workingCopy.setAssignedToFilter(new SpecificUserFilter(assignee.getText())); >- } else { >- workingCopy.setAssignedToFilter(null); >- } >- } >- >- IStructuredSelection statusSelection = (IStructuredSelection) status.getSelection(); >- if (statusSelection.isEmpty()) { >- workingCopy.setStatusFilter(null); >- } else { >- boolean isAnyStatusSelected = false; >- >- List<Status> selectedStatuses = new ArrayList<Status>(); >- >- for (Iterator i = statusSelection.iterator(); i.hasNext();) { >- Object selection = i.next(); >- if (ANY_STATUS.equals(selection)) { >- isAnyStatusSelected = true; >- } else if (selection instanceof Status) { >- selectedStatuses.add((Status) selection); >- } >- } >- >- if (isAnyStatusSelected) { >- workingCopy.setStatusFilter(null); >- } else { >- workingCopy.setStatusFilter( >- new StatusFilter(selectedStatuses.toArray(new Status[selectedStatuses.size()]))); >- } >- } >- >- IStructuredSelection resolutionSelection = (IStructuredSelection) resolution.getSelection(); >- if (resolutionSelection.isEmpty()) { >- workingCopy.setResolutionFilter(null); >- } else { >- boolean isAnyResolutionSelected = false; >- >- List<Resolution> selectedResolutions = new ArrayList<Resolution>(); >- >- for (Iterator i = resolutionSelection.iterator(); i.hasNext();) { >- Object selection = i.next(); >- if (ANY_RESOLUTION.equals(selection)) { >- isAnyResolutionSelected = true; >- } else if (selection instanceof Resolution) { >- selectedResolutions.add((Resolution) selection); >- } >- } >- >- if (isAnyResolutionSelected) { >- workingCopy.setResolutionFilter(null); >- } else { >- workingCopy.setResolutionFilter( >- new ResolutionFilter(selectedResolutions.toArray(new Resolution[selectedResolutions.size()]))); >- } >- } >- >- IStructuredSelection prioritySelection = (IStructuredSelection) priority.getSelection(); >- if (prioritySelection.isEmpty()) { >- workingCopy.setPriorityFilter(null); >- } else { >- boolean isAnyPrioritiesSelected = false; >- >- List<Priority> selectedPriorities = new ArrayList<Priority>(); >- >- for (Iterator i = prioritySelection.iterator(); i.hasNext();) { >- Object selection = i.next(); >- if (ANY_PRIORITY.equals(selection)) { >- isAnyPrioritiesSelected = true; >- } else if (selection instanceof Priority) { >- selectedPriorities.add((Priority) selection); >- } >- } >- >- if (isAnyPrioritiesSelected) { >- workingCopy.setPriorityFilter(null); >- } else { >- workingCopy.setPriorityFilter( >- new PriorityFilter(selectedPriorities.toArray(new Priority[selectedPriorities.size()]))); >- } >- } >- } >- >- private void loadFromDefaults() { >- issueType.setSelection(new StructuredSelection(ANY_ISSUE_TYPE)); >- reporterType.setSelection(new StructuredSelection(ANY_REPORTER)); >- assigneeType.setSelection(new StructuredSelection(ANY_ASSIGNEE)); >- status.setSelection(new StructuredSelection(ANY_STATUS)); >- resolution.setSelection(new StructuredSelection(ANY_RESOLUTION)); >- priority.setSelection(new StructuredSelection(ANY_PRIORITY)); >- } >- >- private void loadFromWorkingCopy() { >- if (workingCopy.getIssueTypeFilter() != null) { >- issueType.setSelection(new StructuredSelection(workingCopy.getIssueTypeFilter().getIsueTypes())); >- } else { >- issueType.setSelection(new StructuredSelection(ANY_ISSUE_TYPE)); >- } >- >- if (workingCopy.getReportedByFilter() != null) { >- UserFilter reportedByFilter = workingCopy.getReportedByFilter(); >- if (reportedByFilter instanceof NobodyFilter) { >- reporterType.setSelection(new StructuredSelection(NO_REPORTER)); >- } else if (reportedByFilter instanceof CurrentUserFilter) { >- reporterType.setSelection(new StructuredSelection(CURRENT_USER_REPORTER)); >- } else if (reportedByFilter instanceof SpecificUserFilter) { >- reporterType.setSelection(new StructuredSelection(SPECIFIC_USER_REPORTER)); >- reporter.setText(((SpecificUserFilter) reportedByFilter).getUser()); >- } else if (reportedByFilter instanceof UserInGroupFilter) { >- reporterType.setSelection(new StructuredSelection(SPECIFIC_GROUP_REPORTER)); >- reporter.setText(((UserInGroupFilter) reportedByFilter).getGroup()); >- } >- } else { >- reporterType.setSelection(new StructuredSelection(ANY_REPORTER)); >- } >- >- if (workingCopy.getAssignedToFilter() != null) { >- UserFilter assignedToFilter = workingCopy.getAssignedToFilter(); >- if (assignedToFilter instanceof NobodyFilter) { >- assigneeType.setSelection(new StructuredSelection(UNASSIGNED)); >- } else if (assignedToFilter instanceof CurrentUserFilter) { >- assigneeType.setSelection(new StructuredSelection(CURRENT_USER_ASSIGNEE)); >- } else if (assignedToFilter instanceof SpecificUserFilter) { >- assigneeType.setSelection(new StructuredSelection(SPECIFIC_USER_ASSIGNEE)); >- assignee.setText(((SpecificUserFilter) assignedToFilter).getUser()); >- } else if (assignedToFilter instanceof UserInGroupFilter) { >- assigneeType.setSelection(new StructuredSelection(SPECIFIC_GROUP_ASSIGNEE)); >- assignee.setText(((UserInGroupFilter) assignedToFilter).getGroup()); >- } >- } else { >- assigneeType.setSelection(new StructuredSelection(ANY_ASSIGNEE)); >- } >- >- if (workingCopy.getStatusFilter() != null) { >- status.setSelection(new StructuredSelection(workingCopy.getStatusFilter().getStatuses())); >- } else { >- status.setSelection(new StructuredSelection(ANY_STATUS)); >- } >- >- if (workingCopy.getResolutionFilter() != null) { >- resolution.setSelection(new StructuredSelection(workingCopy.getResolutionFilter().getResolutions())); >- } else { >- resolution.setSelection(new StructuredSelection(ANY_RESOLUTION)); >- } >- >- if (workingCopy.getPriorityFilter() != null) { >- priority.setSelection(new StructuredSelection(workingCopy.getPriorityFilter().getPriorities())); >- } else { >- priority.setSelection(new StructuredSelection(ANY_PRIORITY)); >- } >- } >- >- private final class Placeholder { >- private final String text; >- >- public Placeholder(String text) { >- this.text = text; >- } >- >- /* >- * (non-Javadoc) >- * >- * @see java.lang.Object#equals(java.lang.Object) >- */ >- public boolean equals(Object obj) { >- if (obj == null) >- return false; >- if (!(obj instanceof Placeholder)) >- return false; >- >- Placeholder that = (Placeholder) obj; >- return this.text.equals(that.text); >- } >- >- public String getText() { >- return this.text; >- } >- } >-}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 149605
:
46484
|
46485
|
46489
|
46493
|
46913