+
+ Composite rootContainer = new Composite(compLayout, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ rootContainer.setLayout(layout);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ rootContainer.setLayoutData(gd);
+
+ Group paramsGrp = new Group(rootContainer, SWT.NONE);
+ gd = new GridData();
+ gd.horizontalAlignment = SWT.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.minimumHeight = 50;
+ paramsGrp.setLayoutData(gd);
+ layout = new GridLayout(2, false);
+ layout.verticalSpacing = 10;
+ layout.marginTop = 10;
+ paramsGrp.setLayout(layout);
+
+ Label ifTypeLbl = new Label(paramsGrp, SWT.NONE);
+ ifTypeLbl.setText("Interface Type");
+
+ ifTypesCmb = new Combo(paramsGrp, SWT.NULL);
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = SWT.FILL;
+ ifTypesCmb.setLayoutData(gd);
+ ifTypesCmb.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ ifType = ifTypesCmb.getText();
+ }
+ });
+
+ RemoteResource resource = Activator.getDefault().getResourceManager()
+ .getCurrentResourceInSelection();
+
+ // Set the interface types in combo box.
+ Map<String, String> ifTypes = Utility.getResourceInterfaces();
+ this.ifTypes = new HashMap<String, String>();
+ String key;
+ for (Map.Entry<String, String> entry : ifTypes.entrySet()) {
+ key = entry.getValue() + " (" + entry.getKey() + ")";
+ this.ifTypes.put(key, entry.getKey());
+ ifTypesCmb.add(key);
+ }
+
+ // Select the default value to be shown in the interface types combo.
+ Vector<String> ifTypesSupportedByResource = resource
+ .getRemoteResourceRef().getResourceInterfaces();
+ if (null != ifTypesSupportedByResource) {
+ int index = -1;
+ if (ifTypesSupportedByResource
+ .contains(Constants.BASELINE_INTERFACE)
+ && ifTypes.containsKey(Constants.BASELINE_INTERFACE)) {
+ // Baseline interface is given preference to be shown in the if
+ // types combo.
+ String value = ifTypes.get(Constants.BASELINE_INTERFACE);
+ index = ifTypesCmb.indexOf(value + " ("
+ + Constants.BASELINE_INTERFACE + ")");
+ if (index != -1)
+ ifTypesCmb.select(index);
+ }
+ if (index == -1) {
+ // Baseline interface is not selected so selecting some other
+ // interface supported by the resource.
+ Iterator<String> itr = ifTypesSupportedByResource.iterator();
+ while (itr.hasNext() && index == -1) {
+ key = itr.next();
+ if (ifTypes.containsKey(key)) {
+ String value = ifTypes.get(key);
+ index = ifTypesCmb.indexOf(value + " (" + key + ")");
+ if (index != -1) {
+ ifTypesCmb.select(index);
+ break;
+ }
+ }
+ }
+ if (index == -1 && !ifTypesSupportedByResource.isEmpty()) {
+ // Resource has custom interfaces.
+ ifTypesCmb.setText(ifTypesSupportedByResource.get(0));
+ }
+ }
+ }
+
+ Composite container = new Composite(rootContainer, SWT.NONE);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ container.setLayoutData(gd);
+ layout = new GridLayout(1, false);