Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 114810 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylar/bugzilla/ui/wizard/AbstractWizardDataPage.java (+129 lines)
Lines 16-21 Link Here
16
import java.util.Set;
16
import java.util.Set;
17
17
18
import org.eclipse.core.runtime.IStatus;
18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.core.runtime.Platform;
19
import org.eclipse.core.runtime.Status;
20
import org.eclipse.core.runtime.Status;
20
import org.eclipse.jface.wizard.IWizardPage;
21
import org.eclipse.jface.wizard.IWizardPage;
21
import org.eclipse.jface.wizard.WizardPage;
22
import org.eclipse.jface.wizard.WizardPage;
Lines 359-364 Link Here
359
	protected void setControl(Control c) {
360
	protected void setControl(Control c) {
360
	    super.setControl(c);
361
	    super.setControl(c);
361
	}
362
	}
363
362
	
364
	
363
	/*
365
	/*
364
	 * (non-Javadoc)
366
	 * (non-Javadoc)
Lines 374-379 Link Here
374
		// get the model for the new bug
376
		// get the model for the new bug
375
		AbstractBugWizard wizard = (AbstractBugWizard) getWizard();
377
		AbstractBugWizard wizard = (AbstractBugWizard) getWizard();
376
		NewBugModel nbm = wizard.model;
378
		NewBugModel nbm = wizard.model;
379
		
380
		// Set the current platform and OS on the model
381
		setPlatformOptions(nbm);
377
382
378
		// Attributes Composite- this holds all the combo fields and text
383
		// Attributes Composite- this holds all the combo fields and text
379
		// fields
384
		// fields
Lines 647-650 Link Here
647
	public boolean offlineSelected() {
652
	public boolean offlineSelected() {
648
		return (offlineButton == null) ? false : offlineButton.getSelection();
653
		return (offlineButton == null) ? false : offlineButton.getSelection();
649
	}
654
	}
655
	
656
	
657
	/* The following are Bugzilla's OS's
658
	  	All
659
		AIX
660
		Windows 95
661
		Windows 98
662
		Windows CE
663
		Windows Mobile 2003
664
		Windows Mobile 2005
665
		Windows ME
666
		Windows 2000
667
		Windows NT
668
		Windows XP
669
		Windows 2003 Server
670
		Windows All
671
		MacOS X
672
		Linux
673
		Linux-GTK
674
		Linux-Motif
675
		HP-UX
676
		Neutrino
677
		QNX-Photon
678
		Solaris
679
		Solaris-GTK
680
		Solaris-Motif
681
		SymbianOS-Series 80
682
		Unix All
683
		other
684
	// The following are the platforsm in Bugzilla
685
		All
686
		Macintosh
687
		PC
688
		Power
689
		PC
690
		Sun
691
		Other
692
		
693
	// The following are Java's Archictures
694
	[PA_RISC, ppc, sparc, x86, x86_64, ia64, ia64_32]
695
	
696
	// The following are Java's OS's
697
	 [aix, hpux, linux, macosx, qnx, solaris, win32]
698
	*/
699
	
700
	
701
702
	
703
	
704
	/**
705
	 * Sets the OS and Platform for the new bug
706
	 * @param newBugModel The bug to set the options for
707
	 */
708
	private void setPlatformOptions( NewBugModel newBugModel ) {
709
		
710
		// A Map from Java's OS and Platform to Buzilla's 
711
		Map<String,String> java2buzillaOSMap = new HashMap<String, String>();
712
		Map<String,String> java2buzillaPlatformMap = new HashMap<String, String>();
713
		
714
		java2buzillaPlatformMap.put("x86", "PC");
715
		java2buzillaPlatformMap.put("x86_64","PC");
716
		java2buzillaPlatformMap.put("ia64", "PC");
717
		java2buzillaPlatformMap.put("ia64_32", "PC");
718
		java2buzillaPlatformMap.put("sparc","Sun");
719
		java2buzillaPlatformMap.put("ppc", "Power");
720
		
721
		java2buzillaOSMap.put("aix", "AIX");
722
		java2buzillaOSMap.put("hpux", "HP-UX");
723
		java2buzillaOSMap.put("linux", "Linux");
724
		java2buzillaOSMap.put("macosx", "MacOS X");
725
		java2buzillaOSMap.put("qnx", "QNX-Photon");
726
		java2buzillaOSMap.put("solaris", "Solaris");
727
		java2buzillaOSMap.put("win32", "Windows All");
728
		
729
		
730
		// Get OS
731
		// Lookup Map
732
		// Check that the result is in Values, if it is not, set it to other
733
		
734
		Attribute opSysAttribute = newBugModel.getAttribute("OS");
735
		Attribute platformAttribute = newBugModel.getAttribute("Platform");
736
		
737
		String OS = Platform.getOS();
738
		String platform = Platform.getOSArch();
739
		
740
		String bugzillaOS = null;			// Bugzilla String for OS
741
		String bugzillaPlatform = null;		// Bugzilla String for Platform
742
		
743
		if ( java2buzillaOSMap.containsKey(OS) ) {
744
			bugzillaOS = java2buzillaOSMap.get(OS);
745
			if ( !opSysAttribute.getOptionValues().values().contains(bugzillaOS)) {
746
				// If the OS we found is not in the list of available options, set bugzillaOS
747
				// to null, and just use "other"
748
				bugzillaOS = null;
749
			}
750
		}
751
		else {
752
			// If we have a strangeOS, then just set buzillaOS to null, and use "other"
753
			bugzillaOS = null;
754
		}
755
		
756
		
757
		if ( java2buzillaPlatformMap.containsKey(platform)) {
758
			bugzillaPlatform = java2buzillaPlatformMap.get( platform );
759
			if ( !platformAttribute.getOptionValues().values().contains(bugzillaPlatform)) {
760
				// If the platform we found is not int the list of available optinos, set the
761
				// Bugzilla Platform to null, and juse use "other"
762
				bugzillaPlatform = null;
763
			}
764
		}
765
		else {
766
			// If we have a strange platform, then just set bugzillaPatforrm to null, and use "other"
767
			bugzillaPlatform = null;
768
		}
769
		
770
		// Set the OS and the Platform in the model
771
		if ( bugzillaOS != null )
772
			opSysAttribute.setValue(bugzillaOS);
773
		
774
		if ( bugzillaPlatform != null )
775
			platformAttribute.setValue(bugzillaPlatform);
776
	}
777
	
778
	
650
}
779
}

Return to bug 114810