@Override
 public void refresh() {
   fLastTab = fTabFolder.getSelectionIndex();
   IArgumentsInfo launcherArguments = getLauncherArguments();
   fProgramArgs.setValue(
       launcherArguments.getProgramArguments(fLastTab, fLastArch[fLastTab]), true);
   fVMArgs.setValue(launcherArguments.getVMArguments(fLastTab, fLastArch[fLastTab]), true);
   updateArgumentPreview(launcherArguments);
   super.refresh();
 }
 private void createTabs() {
   for (int i = 0; i < TAB_LABELS.length; i++) {
     CTabItem item = new CTabItem(fTabFolder, SWT.NULL);
     item.setText(TAB_LABELS[i]);
     item.setImage(
         PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_OPERATING_SYSTEM_OBJ));
   }
   fLastTab = 0;
   fTabFolder.setSelection(fLastTab);
 }
  @Override
  protected void createClient(Section section, FormToolkit toolkit) {

    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    GridData data = new GridData(GridData.FILL_BOTH);
    section.setLayoutData(data);

    section.setText(PDEUIMessages.ArgumentsSection_title);
    section.setDescription(PDEUIMessages.ArgumentsSection_desc);

    Composite client = toolkit.createComposite(section);
    client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 1));
    client.setLayoutData(new GridData(GridData.FILL_BOTH));

    fTabFolder = new CTabFolder(client, SWT.FLAT | SWT.TOP);
    toolkit.adapt(fTabFolder, true, true);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    fTabFolder.setLayoutData(gd);
    gd.heightHint = 2;
    toolkit.getColors().initializeSectionToolBarColors();
    Color selectedColor = toolkit.getColors().getColor(IFormColors.TB_BG);
    fTabFolder.setSelectionBackground(
        new Color[] {selectedColor, toolkit.getColors().getBackground()}, new int[] {100}, true);

    fTabFolder.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (fProgramArgs.isDirty()) fProgramArgs.commit();
            if (fVMArgs.isDirty()) fVMArgs.commit();
            refresh();
            fArchCombo.select(fLastArch[fLastTab]);
          }
        });
    createTabs();

    Composite archParent = toolkit.createComposite(client);
    archParent.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2));
    archParent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    toolkit.createLabel(archParent, PDEUIMessages.ArgumentsSection_architecture);
    fArchCombo = new ComboViewerPart();
    fArchCombo.createControl(archParent, toolkit, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
    fArchCombo.getControl().setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
    fArchCombo.setItems(TAB_ARCHLABELS);
    Control archComboControl = fArchCombo.getControl();
    if (archComboControl instanceof Combo) ((Combo) archComboControl).select(fLastArch[fLastTab]);
    else ((CCombo) archComboControl).select(fLastArch[fLastTab]);
    fArchCombo.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent event) {
            if (fProgramArgs.isDirty()) fProgramArgs.commit();
            if (fVMArgs.isDirty()) fVMArgs.commit();
            // remember the change in combo for currently selected platform
            Control fArchComboControl = fArchCombo.getControl();
            if (fArchComboControl instanceof Combo)
              fLastArch[fLastTab] = ((Combo) fArchComboControl).getSelectionIndex();
            else fLastArch[fLastTab] = ((CCombo) fArchComboControl).getSelectionIndex();

            refresh();
          }
        });

    IActionBars actionBars = getPage().getPDEEditor().getEditorSite().getActionBars();

    fProgramArgs =
        new FormEntry(
            client, toolkit, PDEUIMessages.ArgumentsSection_program, SWT.MULTI | SWT.WRAP);
    fProgramArgs.getText().setLayoutData(new GridData(GridData.FILL_BOTH));
    fProgramArgs.setFormEntryListener(
        new FormEntryAdapter(this, actionBars) {
          @Override
          public void textValueChanged(FormEntry entry) {
            IArgumentsInfo info = getLauncherArguments();
            info.setProgramArguments(entry.getValue().trim(), fLastTab, fLastArch[fLastTab]);
            updateArgumentPreview(info);
          }
        });
    fProgramArgs.setEditable(isEditable());

    fVMArgs =
        new FormEntry(client, toolkit, PDEUIMessages.ArgumentsSection_vm, SWT.MULTI | SWT.WRAP);
    fVMArgs.getText().setLayoutData(new GridData(GridData.FILL_BOTH));
    fVMArgs.setFormEntryListener(
        new FormEntryAdapter(this, actionBars) {
          @Override
          public void textValueChanged(FormEntry entry) {
            IArgumentsInfo info = getLauncherArguments();
            info.setVMArguments(entry.getValue().trim(), fLastTab, fLastArch[fLastTab]);
            updateArgumentPreview(info);
          }
        });
    fVMArgs.setEditable(isEditable());

    fPreviewArgs =
        new FormEntry(
            client, toolkit, PDEUIMessages.ArgumentsSection_preview, SWT.MULTI | SWT.WRAP);
    fPreviewArgs.getText().setLayoutData(new GridData(GridData.FILL_BOTH));
    fPreviewArgs.setEditable(false);

    toolkit.paintBordersFor(client);
    section.setClient(client);
    // Register to be notified when the model changes
    getModel().addModelChangedListener(this);
  }