|
Lines 23-28
Link Here
|
| 23 |
import org.eclipse.mylar.bugzilla.core.Attribute; |
23 |
import org.eclipse.mylar.bugzilla.core.Attribute; |
| 24 |
import org.eclipse.mylar.bugzilla.core.BugReport; |
24 |
import org.eclipse.mylar.bugzilla.core.BugReport; |
| 25 |
import org.eclipse.mylar.internal.bugzilla.core.NewBugModel; |
25 |
import org.eclipse.mylar.internal.bugzilla.core.NewBugModel; |
|
|
26 |
import org.eclipse.mylar.internal.bugzilla.core.internal.BugReportElement; |
| 26 |
import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor; |
27 |
import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor; |
| 27 |
import org.eclipse.mylar.internal.core.util.MylarStatusHandler; |
28 |
import org.eclipse.mylar.internal.core.util.MylarStatusHandler; |
| 28 |
import org.eclipse.swt.SWT; |
29 |
import org.eclipse.swt.SWT; |
|
Lines 49-55
Link Here
|
| 49 |
* @author Mik Kersten (hardening of initial prototype) |
50 |
* @author Mik Kersten (hardening of initial prototype) |
| 50 |
*/ |
51 |
*/ |
| 51 |
public abstract class AbstractBugzillaWizardPage extends WizardPage implements Listener { |
52 |
public abstract class AbstractBugzillaWizardPage extends WizardPage implements Listener { |
| 52 |
|
53 |
|
|
|
54 |
private static final String KEY_OP_SYS = "op_sys"; |
| 55 |
|
| 53 |
/** The instance of the workbench */ |
56 |
/** The instance of the workbench */ |
| 54 |
protected IWorkbench workbench; |
57 |
protected IWorkbench workbench; |
| 55 |
|
58 |
|
|
Lines 253-259
Link Here
|
| 253 |
* The event which occurred |
256 |
* The event which occurred |
| 254 |
*/ |
257 |
*/ |
| 255 |
public void handleEvent(Event e) { |
258 |
public void handleEvent(Event e) { |
| 256 |
boolean pageComplete = isPageComplete(); |
259 |
boolean pageComplete = isPageComplete(); |
| 257 |
|
260 |
|
| 258 |
// Initialize a variable with the no error status |
261 |
// Initialize a variable with the no error status |
| 259 |
Status status = new Status(IStatus.OK, "not_used", 0, "", null); |
262 |
Status status = new Status(IStatus.OK, "not_used", 0, "", null); |
|
Lines 292-298
Link Here
|
| 292 |
wizard.attributeCompleted = false; |
295 |
wizard.attributeCompleted = false; |
| 293 |
return false; |
296 |
return false; |
| 294 |
} |
297 |
} |
| 295 |
//saveDataToModel(); |
298 |
// saveDataToModel(); |
| 296 |
wizard.attributeCompleted = true; |
299 |
wizard.attributeCompleted = true; |
| 297 |
return true; |
300 |
return true; |
| 298 |
} |
301 |
} |
|
Lines 307-313
Link Here
|
| 307 |
|
310 |
|
| 308 |
nbm.setDescription(descriptionText.getText()); |
311 |
nbm.setDescription(descriptionText.getText()); |
| 309 |
nbm.setSummary(summaryText.getText()); |
312 |
nbm.setSummary(summaryText.getText()); |
| 310 |
|
313 |
|
| 311 |
// go through each of the attributes and sync their values with the |
314 |
// go through each of the attributes and sync their values with the |
| 312 |
// combo boxes |
315 |
// combo boxes |
| 313 |
for (Iterator<Attribute> it = nbm.getAttributes().iterator(); it.hasNext();) { |
316 |
for (Iterator<Attribute> it = nbm.getAttributes().iterator(); it.hasNext();) { |
|
Lines 318-325
Link Here
|
| 318 |
try { |
321 |
try { |
| 319 |
if (values == null) |
322 |
if (values == null) |
| 320 |
values = new HashMap<String, String>(); |
323 |
values = new HashMap<String, String>(); |
| 321 |
if (key.equals(BugReport.ATTRIBUTE_OS)) { |
324 |
if (key.equals(BugReport.ATTRIBUTE_OS)) { |
| 322 |
String os = oSCombo.getItem(oSCombo.getSelectionIndex()); |
325 |
String os = oSCombo.getItem(oSCombo.getSelectionIndex()); |
| 323 |
attribute.setValue(os); |
326 |
attribute.setValue(os); |
| 324 |
} else if (key.equals(BugReport.ATTRIBUTE_VERSION)) { |
327 |
} else if (key.equals(BugReport.ATTRIBUTE_VERSION)) { |
| 325 |
String version = versionCombo.getItem(versionCombo.getSelectionIndex()); |
328 |
String version = versionCombo.getItem(versionCombo.getSelectionIndex()); |
|
Lines 354-360
Link Here
|
| 354 |
MylarStatusHandler.fail(e, "could not set attribute: " + attribute, false); |
357 |
MylarStatusHandler.fail(e, "could not set attribute: " + attribute, false); |
| 355 |
} |
358 |
} |
| 356 |
} |
359 |
} |
| 357 |
//wizard.attributeCompleted = true; |
360 |
// wizard.attributeCompleted = true; |
| 358 |
} |
361 |
} |
| 359 |
|
362 |
|
| 360 |
@Override |
363 |
@Override |
|
Lines 371-377
Link Here
|
| 371 |
// whether the priority exists or not |
374 |
// whether the priority exists or not |
| 372 |
boolean priExist = false; |
375 |
boolean priExist = false; |
| 373 |
boolean mileExist = false; |
376 |
boolean mileExist = false; |
| 374 |
|
377 |
|
| 375 |
String url = null; |
378 |
String url = null; |
| 376 |
|
379 |
|
| 377 |
// get the model for the new bug |
380 |
// get the model for the new bug |
|
Lines 409-415
Link Here
|
| 409 |
// Add the product to the composite |
412 |
// Add the product to the composite |
| 410 |
newLayout(attributesComposite, 1, "Product", PROPERTY); |
413 |
newLayout(attributesComposite, 1, "Product", PROPERTY); |
| 411 |
newLayout(attributesComposite, 1, nbm.getProduct(), VALUE); |
414 |
newLayout(attributesComposite, 1, nbm.getProduct(), VALUE); |
| 412 |
|
415 |
|
| 413 |
// Populate Attributes |
416 |
// Populate Attributes |
| 414 |
for (Iterator<Attribute> it = nbm.getAttributes().iterator(); it.hasNext();) { |
417 |
for (Iterator<Attribute> it = nbm.getAttributes().iterator(); it.hasNext();) { |
| 415 |
Attribute attribute = it.next(); |
418 |
Attribute attribute = it.next(); |
|
Lines 433-439
Link Here
|
| 433 |
data.horizontalIndent = HORZ_INDENT; |
436 |
data.horizontalIndent = HORZ_INDENT; |
| 434 |
data.widthHint = 150; |
437 |
data.widthHint = 150; |
| 435 |
// create and populate the combo fields for the attributes |
438 |
// create and populate the combo fields for the attributes |
| 436 |
if (key.equals("op_sys")) { |
439 |
if (key.equals(KEY_OP_SYS)) { |
| 437 |
newLayout(attributesComposite, 1, name, PROPERTY); |
440 |
newLayout(attributesComposite, 1, name, PROPERTY); |
| 438 |
oSCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL | SWT.READ_ONLY); |
441 |
oSCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL | SWT.READ_ONLY); |
| 439 |
|
442 |
|
|
Lines 498-504
Link Here
|
| 498 |
index = 0; |
501 |
index = 0; |
| 499 |
platformCombo.select(index); |
502 |
platformCombo.select(index); |
| 500 |
platformCombo.addListener(SWT.Modify, this); |
503 |
platformCombo.addListener(SWT.Modify, this); |
| 501 |
} else if (key.equals(BugReport.KEY_MILESTONE)) { |
504 |
} else if (key.equals(BugReport.KEY_MILESTONE)) { |
| 502 |
newLayout(attributesComposite, 1, name, PROPERTY); |
505 |
newLayout(attributesComposite, 1, name, PROPERTY); |
| 503 |
milestoneCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL |
506 |
milestoneCombo = new Combo(attributesComposite, SWT.NO_BACKGROUND | SWT.MULTI | SWT.V_SCROLL |
| 504 |
| SWT.READ_ONLY); |
507 |
| SWT.READ_ONLY); |
|
Lines 559-581
Link Here
|
| 559 |
newLayout(attributesComposite, 1, "", PROPERTY); |
562 |
newLayout(attributesComposite, 1, "", PROPERTY); |
| 560 |
} |
563 |
} |
| 561 |
|
564 |
|
| 562 |
Composite textComposite = new Composite(attributesComposite, SWT.NONE); |
565 |
Composite textComposite = new Composite(attributesComposite, SWT.NONE); |
| 563 |
textComposite.setLayout(new GridLayout(3, false)); |
566 |
textComposite.setLayout(new GridLayout(3, false)); |
| 564 |
GridData textCompositeGD = new GridData(); |
567 |
GridData textCompositeGD = new GridData(); |
| 565 |
textCompositeGD.horizontalSpan = 4; |
568 |
textCompositeGD.horizontalSpan = 4; |
| 566 |
textCompositeGD.grabExcessHorizontalSpace = true; |
569 |
textCompositeGD.grabExcessHorizontalSpace = true; |
| 567 |
textComposite.setLayoutData(textCompositeGD); |
570 |
textComposite.setLayoutData(textCompositeGD); |
| 568 |
|
571 |
|
| 569 |
GridData summaryTextData; |
572 |
GridData summaryTextData; |
| 570 |
|
573 |
|
| 571 |
if (url != null) { |
574 |
if (url != null) { |
| 572 |
// add the assigned to text field |
575 |
// add the assigned to text field |
| 573 |
newLayout(textComposite, 1, BugReport.ATTRIBUTE_URL, PROPERTY); |
576 |
newLayout(textComposite, 1, BugReport.ATTRIBUTE_URL, PROPERTY); |
| 574 |
urlText = new Text(textComposite, SWT.BORDER | SWT.SINGLE | SWT.WRAP); |
577 |
urlText = new Text(textComposite, SWT.BORDER | SWT.SINGLE | SWT.WRAP); |
| 575 |
summaryTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); |
578 |
summaryTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); |
| 576 |
|
579 |
|
| 577 |
summaryTextData.horizontalSpan = 2; |
580 |
summaryTextData.horizontalSpan = 2; |
| 578 |
// summaryTextData.widthHint = 200; |
581 |
// summaryTextData.widthHint = 200; |
| 579 |
urlText.setLayoutData(summaryTextData); |
582 |
urlText.setLayoutData(summaryTextData); |
| 580 |
urlText.setText(url); |
583 |
urlText.setText(url); |
| 581 |
urlText.addListener(SWT.FocusOut, this); |
584 |
urlText.addListener(SWT.FocusOut, this); |
|
Lines 583-589
Link Here
|
| 583 |
|
586 |
|
| 584 |
newLayout(textComposite, 1, "Assigned To", PROPERTY); |
587 |
newLayout(textComposite, 1, "Assigned To", PROPERTY); |
| 585 |
Label l = new Label(textComposite, SWT.NONE); |
588 |
Label l = new Label(textComposite, SWT.NONE); |
| 586 |
// l.setText(" "); |
589 |
// l.setText(" "); |
| 587 |
l.setText("(if email is incorrect submit will not proceed)"); |
590 |
l.setText("(if email is incorrect submit will not proceed)"); |
| 588 |
summaryTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); |
591 |
summaryTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); |
| 589 |
summaryTextData.horizontalSpan = 1; |
592 |
summaryTextData.horizontalSpan = 1; |
|
Lines 595-601
Link Here
|
| 595 |
summaryTextData.widthHint = 200; |
598 |
summaryTextData.widthHint = 200; |
| 596 |
assignedToText.setLayoutData(summaryTextData); |
599 |
assignedToText.setLayoutData(summaryTextData); |
| 597 |
assignedToText.setText(""); |
600 |
assignedToText.setText(""); |
| 598 |
|
|
|
| 599 |
|
601 |
|
| 600 |
// add the summary text field |
602 |
// add the summary text field |
| 601 |
newLayout(textComposite, 1, "Summary", PROPERTY); |
603 |
newLayout(textComposite, 1, "Summary", PROPERTY); |
|
Lines 667-673
Link Here
|
| 667 |
// */ |
669 |
// */ |
| 668 |
// public boolean offlineSelected() { |
670 |
// public boolean offlineSelected() { |
| 669 |
// return (offlineButton == null) ? false : offlineButton.getSelection(); |
671 |
// return (offlineButton == null) ? false : offlineButton.getSelection(); |
| 670 |
// } |
672 |
// } |
| 671 |
|
673 |
|
| 672 |
/* |
674 |
/* |
| 673 |
* The following are Bugzilla's: OS's All AIX Windows 95 Windows 98 Windows |
675 |
* The following are Bugzilla's: OS's All AIX Windows 95 Windows 98 Windows |
|
Lines 714-721
Link Here
|
| 714 |
|
716 |
|
| 715 |
// Get OS Lookup Map |
717 |
// Get OS Lookup Map |
| 716 |
// Check that the result is in Values, if it is not, set it to other |
718 |
// Check that the result is in Values, if it is not, set it to other |
| 717 |
Attribute opSysAttribute = newBugModel.getAttribute(BugReport.ATTRIBUTE_OS); |
719 |
Attribute opSysAttribute = newBugModel.getAttribute(BugReportElement.OP_SYS.toString()); |
| 718 |
Attribute platformAttribute = newBugModel.getAttribute(BugReport.ATTRIBUTE_PLATFORM); |
720 |
Attribute platformAttribute = newBugModel.getAttribute(BugReportElement.REP_PLATFORM.toString()); |
| 719 |
|
721 |
|
| 720 |
String OS = Platform.getOS(); |
722 |
String OS = Platform.getOS(); |
| 721 |
String platform = Platform.getOSArch(); |
723 |
String platform = Platform.getOSArch(); |
|
Lines 723-729
Link Here
|
| 723 |
String bugzillaOS = null; // Bugzilla String for OS |
725 |
String bugzillaOS = null; // Bugzilla String for OS |
| 724 |
String bugzillaPlatform = null; // Bugzilla String for Platform |
726 |
String bugzillaPlatform = null; // Bugzilla String for Platform |
| 725 |
|
727 |
|
| 726 |
if (java2buzillaOSMap != null && java2buzillaOSMap.containsKey(OS) && opSysAttribute != null && opSysAttribute.getOptionValues() != null) { |
728 |
if (java2buzillaOSMap != null && java2buzillaOSMap.containsKey(OS) && opSysAttribute != null |
|
|
729 |
&& opSysAttribute.getOptionValues() != null) { |
| 727 |
bugzillaOS = java2buzillaOSMap.get(OS); |
730 |
bugzillaOS = java2buzillaOSMap.get(OS); |
| 728 |
if (opSysAttribute != null && !opSysAttribute.getOptionValues().values().contains(bugzillaOS)) { |
731 |
if (opSysAttribute != null && !opSysAttribute.getOptionValues().values().contains(bugzillaOS)) { |
| 729 |
// If the OS we found is not in the list of available |
732 |
// If the OS we found is not in the list of available |
|
Lines 739-746
Link Here
|
| 739 |
|
742 |
|
| 740 |
if (platform != null && java2buzillaPlatformMap.containsKey(platform)) { |
743 |
if (platform != null && java2buzillaPlatformMap.containsKey(platform)) { |
| 741 |
bugzillaPlatform = java2buzillaPlatformMap.get(platform); |
744 |
bugzillaPlatform = java2buzillaPlatformMap.get(platform); |
| 742 |
|
745 |
|
| 743 |
if (platformAttribute != null && !platformAttribute.getOptionValues().values().contains(bugzillaPlatform)) { |
746 |
if (platformAttribute != null |
|
|
747 |
&& !platformAttribute.getOptionValues().values().contains(bugzillaPlatform)) { |
| 744 |
// If the platform we found is not int the list of available |
748 |
// If the platform we found is not int the list of available |
| 745 |
// optinos, set the |
749 |
// optinos, set the |
| 746 |
// Bugzilla Platform to null, and juse use "other" |
750 |
// Bugzilla Platform to null, and juse use "other" |
|
Lines 757-764
Link Here
|
| 757 |
opSysAttribute.setValue(bugzillaOS); |
761 |
opSysAttribute.setValue(bugzillaOS); |
| 758 |
if (bugzillaPlatform != null && platformAttribute != null) |
762 |
if (bugzillaPlatform != null && platformAttribute != null) |
| 759 |
platformAttribute.setValue(bugzillaPlatform); |
763 |
platformAttribute.setValue(bugzillaPlatform); |
|
|
764 |
|
| 760 |
} catch (Exception e) { |
765 |
} catch (Exception e) { |
| 761 |
MylarStatusHandler.fail(e, "could not set platform options", false); |
766 |
MylarStatusHandler.fail(e, "could not set platform options", false); |
| 762 |
} |
767 |
} |
| 763 |
} |
768 |
} |
| 764 |
|
769 |
|