@Override
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.makeColumnsEqualWidth = false;
    layout.horizontalSpacing = 5;
    layout.verticalSpacing = 10;
    container.setLayout(layout);

    createScrollArea(container);
    createAvailableList(container).setLayoutData(new GridData(GridData.FILL_BOTH));
    createButtonArea(container);
    createImportList(container).setLayoutData(new GridData(GridData.FILL_BOTH));
    updateCount();

    // create container for buttons
    Composite optionComp =
        SWTFactory.createComposite(container, 1, 3, GridData.FILL_HORIZONTAL, 5, 0);
    createComputationsOption(optionComp);
    createFilterOptions(optionComp);

    addViewerListeners();
    initialize();
    addFilters();
    setControl(container);
    Dialog.applyDialogFont(container);
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(container, IHelpContextIds.PLUGIN_IMPORT_SECOND_PAGE);
  }
  private Composite createAvailableList(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container.setLayout(layout);
    container.setLayoutData(new GridData());

    Label label = new Label(container, SWT.NONE);
    label.setText(PDEUIMessages.ImportWizard_DetailedPage_availableList);

    Table table = new Table(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 200;
    gd.widthHint = 225;
    table.setLayoutData(gd);

    fAvailableListViewer = new TableViewer(table);
    fAvailableListViewer.setLabelProvider(new PluginImportLabelProvider());
    fAvailableListViewer.setContentProvider(new ContentProvider());
    fAvailableListViewer.setInput(PDECore.getDefault().getModelManager());
    fAvailableListViewer.setComparator(ListUtil.PLUGIN_COMPARATOR);

    return container;
  }
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 8;
    layout.numColumns = 1;

    layout.makeColumnsEqualWidth = false;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    container.setLayoutData(gd);
    Label libraryLabel = new Label(container, SWT.NULL);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    libraryLabel.setLayoutData(gd);
    libraryLabel.setText(PDEUIMessages.ManifestEditor_RuntimeLibraryDialog_label);

    libraryText = new Text(container, SWT.SINGLE | SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    libraryText.setLayoutData(gd);
    libraryText.setText(PDEUIMessages.ManifestEditor_RuntimeLibraryDialog_default);
    libraryText.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            updateStatus(validator.validate(libraryText.getText()));
          }
        });
    applyDialogFont(container);
    return container;
  }
  public Control createControl(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayout(new GridLayout(3, false));
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fButton = new Button(comp, SWT.CHECK);
    fButton.setText(PDEUIMessages.AdvancedPluginExportPage_signButton);
    GridData gd = new GridData();
    gd.horizontalSpan = 3;
    fButton.setLayoutData(gd);
    fButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            updateGroup(fButton.getSelection());
            fPage.pageChanged();
          }
        });

    fKeystoreLabel = createLabel(comp, PDEUIMessages.AdvancedPluginExportPage_keystore);
    fKeystoreText = createText(comp, 1);

    fBrowseButton = new Button(comp, SWT.PUSH);
    fBrowseButton.setText(PDEUIMessages.ExportWizard_browse);
    fBrowseButton.setLayoutData(new GridData());
    SWTUtil.setButtonDimensionHint(fBrowseButton);
    fBrowseButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(fPage.getShell(), SWT.OPEN);
            String path = fKeystoreText.getText();
            if (path.trim().length() == 0)
              path = PDEPlugin.getWorkspace().getRoot().getLocation().toString();
            dialog.setFileName(path);
            String res = dialog.open();
            if (res != null) {
              fKeystoreText.setText(res);
            }
          }
        });

    fKeypassLabel = createLabel(comp, PDEUIMessages.JARSigningTab_keypass);
    fKeypassText = createText(comp, 2);
    fKeypassText.setEchoChar('*');

    fAliasLabel = createLabel(comp, PDEUIMessages.AdvancedPluginExportPage_alias);
    fAliasText = createText(comp, 2);

    fPasswordLabel = createLabel(comp, PDEUIMessages.AdvancedPluginExportPage_password);
    fPasswordText = createText(comp, 2);
    fPasswordText.setEchoChar('*');

    Dialog.applyDialogFont(comp);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IHelpContextIds.ADVANCED_PLUGIN_EXPORT);
    return comp;
  }
  private Control createImplicitTabContents(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    container.setFont(parent.getFont());

    createImpLabel(container);
    createImpTable(container);
    createImpButtons(container);
    return container;
  }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
   */
  protected Control createContents(Composite parent) {
    Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0);
    link = new Link(comp, SWT.NONE);
    link.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
    link.setFont(comp.getFont());
    link.setText(PDEUIMessages.CompilersPreferencePage_configure_project_specific_settings);
    link.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            HashSet set = new HashSet();
            try {
              IJavaProject[] projects =
                  JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
              IProject project = null;
              for (int i = 0; i < projects.length; i++) {
                project = projects[i].getProject();
                try {
                  if (project.hasNature(PDE.PLUGIN_NATURE)
                      && fBlock.hasProjectSpecificSettings(project)) {
                    set.add(projects[i]);
                  }
                } catch (CoreException ce) {
                  // do nothing ignore the project
                }
              }
            } catch (JavaModelException jme) {
              // ignore
            }
            ProjectSelectionDialog psd = new ProjectSelectionDialog(getShell(), set);
            if (psd.open() == IDialogConstants.OK_ID) {
              HashMap data = new HashMap();
              data.put(NO_LINK, Boolean.TRUE);
              PreferencesUtil.createPropertyDialogOn(
                      getShell(),
                      ((IJavaProject) psd.getFirstResult()).getProject(),
                      "org.eclipse.pde.internal.ui.properties.compilersPropertyPage", //$NON-NLS-1$
                      new String[] {"org.eclipse.pde.internal.ui.properties.compilersPropertyPage"},
                      data)
                  .open(); //$NON-NLS-1$
            }
          }
        });
    fBlock =
        new PDECompilersConfigurationBlock(null, (IWorkbenchPreferenceContainer) getContainer());
    fBlock.createControl(comp);

    // Initialize with data map in case applyData was called before createContents
    applyData(fPageData);

    return comp;
  }
 private void createImpLabel(Composite container) {
   Label label = new Label(container, SWT.NONE);
   label.setText(PDEUIMessages.TargetImplicitPluginsTab_desc);
   label.setFont(container.getFont());
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalSpan = 2;
   label.setLayoutData(gd);
 }
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit)
   */
  protected void createClient(Section section, FormToolkit toolkit) {

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

    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.MULTI, 2, toolkit);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    createOptionalDependenciesButton(container);

    TablePart tablePart = getTablePart();
    fPluginTable = tablePart.getTableViewer();
    fPluginTable.setContentProvider(new ContentProvider());
    fPluginTable.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    fPluginTable.setComparator(
        new ViewerComparator() {
          public int compare(Viewer viewer, Object e1, Object e2) {
            IProductPlugin p1 = (IProductPlugin) e1;
            IProductPlugin p2 = (IProductPlugin) e2;
            return super.compare(viewer, p1.getId(), p2.getId());
          }
        });
    GridData data = (GridData) tablePart.getControl().getLayoutData();
    data.minimumWidth = 200;
    fPluginTable.setInput(getProduct());

    tablePart.setButtonEnabled(0, isEditable());
    tablePart.setButtonEnabled(1, isEditable());
    tablePart.setButtonEnabled(2, isEditable());

    // remove buttons will be updated on refresh

    tablePart.setButtonEnabled(5, isEditable());

    toolkit.paintBordersFor(container);
    section.setClient(container);

    section.setText(PDEUIMessages.Product_PluginSection_title);
    section.setDescription(PDEUIMessages.Product_PluginSection_desc);
    getModel().addModelChangedListener(this);
    createSectionToolbar(section, toolkit);
  }
Example #9
0
  protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = layout.marginHeight = 9;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 300;
    gd.heightHint = 300;
    container.setLayoutData(gd);

    fLoopViewer = new TreeViewer(container);
    fLoopViewer.setContentProvider(new ContentProvider());
    fLoopViewer.setLabelProvider(new LoopLabelProvider());
    Tree tree = fLoopViewer.getTree();
    gd = new GridData(GridData.FILL_BOTH);
    tree.setLayoutData(gd);
    fLoopViewer.setInput(PDEPlugin.getDefault());
    fLoopViewer.expandAll();
    getShell().setText(PDEUIMessages.LoopDialog_title);
    return container;
  }
 private void createImpTable(Composite container) {
   fElementViewer = new TableViewer(container, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
   GridData gd = new GridData(GridData.FILL_BOTH);
   gd.heightHint = 250;
   fElementViewer.getControl().setLayoutData(gd);
   fElementViewer.getControl().setFont(container.getFont());
   fElementViewer.setContentProvider(
       new DefaultTableProvider() {
         public Object[] getElements(Object inputElement) {
           ITargetDefinition target = getTargetDefinition();
           if (target != null) {
             NameVersionDescriptor[] bundles = target.getImplicitDependencies();
             if (bundles != null) {
               return bundles;
             }
           }
           return new NameVersionDescriptor[0];
         }
       });
   fElementViewer.setLabelProvider(new StyledBundleLabelProvider(false, false));
   fElementViewer.setInput(PDEPlugin.getDefault());
   fElementViewer.setComparator(
       new ViewerComparator() {
         public int compare(Viewer viewer, Object e1, Object e2) {
           NameVersionDescriptor bundle1 = (NameVersionDescriptor) e1;
           NameVersionDescriptor bundle2 = (NameVersionDescriptor) e2;
           return super.compare(viewer, bundle1.getId(), bundle2.getId());
         }
       });
   fElementViewer.addSelectionChangedListener(
       new ISelectionChangedListener() {
         public void selectionChanged(SelectionChangedEvent event) {
           updateImpButtons();
         }
       });
   fElementViewer
       .getTable()
       .addKeyListener(
           new KeyAdapter() {
             public void keyPressed(KeyEvent e) {
               if (e.character == SWT.DEL && e.stateMask == 0) {
                 handleRemove();
               }
             }
           });
 }
  private Composite createButtonArea(Composite parent) {
    ScrolledComposite comp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    GridLayout layout = new GridLayout();
    layout.marginWidth = layout.marginHeight = 0;
    comp.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    Composite container = new Composite(comp, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_VERTICAL);
    gd.verticalIndent = 15;
    container.setLayoutData(gd);

    Button button = new Button(container, SWT.PUSH);
    button.setText(PDEUIMessages.ImportWizard_DetailedPage_existing);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleExistingProjects();
          }
        });
    SWTUtil.setButtonDimensionHint(button);

    button = new Button(container, SWT.PUSH);
    button.setText(PDEUIMessages.ImportWizard_DetailedPage_existingUnshared);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleExistingUnshared();
          }
        });
    SWTUtil.setButtonDimensionHint(button);

    fAddButton = new Button(container, SWT.PUSH);
    fAddButton.setText(PDEUIMessages.ImportWizard_DetailedPage_add);
    fAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fAddButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleAdd();
          }
        });
    SWTUtil.setButtonDimensionHint(fAddButton);

    fAddAllButton = new Button(container, SWT.PUSH);
    fAddAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addAll);
    fAddAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fAddAllButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleAddAll();
          }
        });
    SWTUtil.setButtonDimensionHint(fAddAllButton);

    fRemoveButton = new Button(container, SWT.PUSH);
    fRemoveButton.setText(PDEUIMessages.ImportWizard_DetailedPage_remove);
    fRemoveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fRemoveButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleRemove();
          }
        });
    SWTUtil.setButtonDimensionHint(fRemoveButton);

    fRemoveAllButton = new Button(container, SWT.PUSH);
    fRemoveAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_removeAll);
    fRemoveAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fRemoveAllButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleRemoveAll();
          }
        });
    SWTUtil.setButtonDimensionHint(fRemoveAllButton);

    button = new Button(container, SWT.PUSH);
    button.setText(PDEUIMessages.ImportWizard_DetailedPage_swap);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleSwap();
          }
        });
    SWTUtil.setButtonDimensionHint(button);

    fAddRequiredButton = new Button(container, SWT.PUSH);
    fAddRequiredButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addRequired);
    fAddRequiredButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fAddRequiredButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleAddRequiredPlugins();
          }
        });
    SWTUtil.setButtonDimensionHint(fAddRequiredButton);

    fCountLabel = new Label(container, SWT.NONE);
    fCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    comp.setContent(container);
    comp.setMinHeight(250);
    comp.setExpandHorizontal(true);
    comp.setExpandVertical(true);
    return container;
  }
  private Control createArgumentsGroup(Composite parent) {
    Composite container = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH);

    SWTFactory.createWrapLabel(container, PDEUIMessages.JavaArgumentsTab_description, 1);

    Group programGroup =
        SWTFactory.createGroup(
            container,
            PDEUIMessages.JavaArgumentsTab_progamArgsGroup,
            1,
            1,
            GridData.FILL_HORIZONTAL);

    fProgramArgs =
        SWTFactory.createText(
            programGroup,
            SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL,
            1,
            200,
            60,
            GridData.FILL_BOTH);
    fProgramArgs.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition().setProgramArguments(fProgramArgs.getText().trim());
          }
        });

    Composite programButtons =
        SWTFactory.createComposite(programGroup, 1, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0);

    Button programVars =
        SWTFactory.createPushButton(
            programButtons,
            PDEUIMessages.JavaArgumentsTab_programVariables,
            null,
            GridData.HORIZONTAL_ALIGN_END);
    programVars.addSelectionListener(getVariablesListener(fProgramArgs));

    Group vmGroup = new Group(container, SWT.NONE);
    vmGroup.setLayout(new GridLayout(1, false));
    vmGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    vmGroup.setText(PDEUIMessages.JavaArgumentsTab_vmArgsGroup);
    vmGroup.setFont(container.getFont());

    fVMArgs =
        SWTFactory.createText(
            vmGroup,
            SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL,
            1,
            200,
            60,
            GridData.FILL_BOTH);
    fVMArgs.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition().setVMArguments(fVMArgs.getText().trim());
          }
        });

    Composite buttons =
        SWTFactory.createComposite(vmGroup, 2, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0);

    Button vmArgs =
        SWTFactory.createPushButton(
            buttons, PDEUIMessages.JavaArgumentsTab_addVMArgs, null, GridData.HORIZONTAL_ALIGN_END);
    vmArgs.addSelectionListener(getVMArgsListener(fVMArgs));

    Button vmVars =
        SWTFactory.createPushButton(
            buttons,
            PDEUIMessages.JavaArgumentsTab_vmVariables,
            null,
            GridData.HORIZONTAL_ALIGN_END);
    vmVars.addSelectionListener(getVariablesListener(fVMArgs));
    return container;
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {
    Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0);

    Composite nameComp = SWTFactory.createComposite(comp, 2, 1, GridData.FILL_HORIZONTAL, 0, 0);

    SWTFactory.createLabel(nameComp, PDEUIMessages.TargetDefinitionContentPage_4, 1);

    fNameText = SWTFactory.createSingleText(nameComp, 1);
    fNameText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            String name = fNameText.getText().trim();
            if (name.length() == 0) {
              setErrorMessage(PDEUIMessages.TargetDefinitionContentPage_7);
            } else {
              setErrorMessage(null);
              setMessage(PDEUIMessages.TargetDefinitionContentPage_2);
            }
            getTargetDefinition().setName(name);
            setPageComplete(isPageComplete());
          }
        });

    TabFolder tabs = new TabFolder(comp, SWT.NONE);
    tabs.setLayoutData(new GridData(GridData.FILL_BOTH));
    tabs.setFont(comp.getFont());

    fLocationTab = new TabItem(tabs, SWT.NONE);
    fLocationTab.setText(PDEUIMessages.LocationSection_0);

    Composite pluginTabContainer = SWTFactory.createComposite(tabs, 1, 1, GridData.FILL_BOTH);
    SWTFactory.createWrapLabel(
        pluginTabContainer, PDEUIMessages.TargetDefinitionContentPage_LocationDescription, 2, 400);
    fLocationTree = TargetLocationsGroup.createInDialog(pluginTabContainer);
    fLocationTab.setControl(pluginTabContainer);
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(pluginTabContainer, IHelpContextIds.EDIT_TARGET_WIZARD_LOCATIONS_TAB);

    TabItem contentTab = new TabItem(tabs, SWT.NONE);
    contentTab.setText(PDEUIMessages.TargetDefinitionContentPage_6);
    Composite contentTabContainer = SWTFactory.createComposite(tabs, 1, 1, GridData.FILL_BOTH);
    SWTFactory.createWrapLabel(contentTabContainer, PDEUIMessages.ContentSection_1, 2, 400);
    fContentTree = TargetContentsGroup.createInDialog(contentTabContainer);
    contentTab.setControl(contentTabContainer);
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(contentTabContainer, IHelpContextIds.EDIT_TARGET_WIZARD_CONTENT_TAB);

    TabItem envTab = new TabItem(tabs, SWT.NONE);
    envTab.setText(PDEUIMessages.TargetDefinitionEnvironmentPage_3);
    Composite envTabContainer = SWTFactory.createComposite(tabs, 1, 1, GridData.FILL_BOTH);
    createTargetEnvironmentGroup(envTabContainer);
    createJREGroup(envTabContainer);
    envTab.setControl(envTabContainer);
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(envTabContainer, IHelpContextIds.EDIT_TARGET_WIZARD_ENVIRONMENT_TAB);

    TabItem argsTab = new TabItem(tabs, SWT.NONE);
    argsTab.setText(PDEUIMessages.TargetDefinitionEnvironmentPage_4);
    argsTab.setControl(createArgumentsGroup(tabs));
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(argsTab.getControl(), IHelpContextIds.EDIT_TARGET_WIZARD_ARGUMENT_TAB);

    TabItem depTab = new TabItem(tabs, SWT.NONE);
    depTab.setText(PDEUIMessages.TargetDefinitionEnvironmentPage_5);
    depTab.setControl(createImplicitTabContents(tabs));
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(depTab.getControl(), IHelpContextIds.EDIT_TARGET_WIZARD_IMPLICIT_TAB);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IHelpContextIds.EDIT_TARGET_WIZARD);
    initializeListeners();
    targetChanged(getTargetDefinition());
    setControl(comp);
  }
  @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);
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    setControl(composite);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(PDEUIMessages.PluginWorkingSet_setName);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fWorkingSetName = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fWorkingSetName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fWorkingSetName.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            validatePage();
          }
        });
    fWorkingSetName.setFocus();

    label = new Label(composite, SWT.WRAP);
    label.setText(PDEUIMessages.PluginWorkingSet_setContent);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fTree = new CheckboxFilteredTree(composite, SWT.BORDER, new PatternFilter());
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 250;
    fTree.getViewer().getControl().setLayoutData(gd);
    final IStructuredContentProvider fTableContentProvider = new ContentProvider();
    fTree.getCheckboxTreeViewer().setContentProvider(fTableContentProvider);
    fTree.getCheckboxTreeViewer().setLabelProvider(new WorkingSetLabelProvider());
    fTree.getCheckboxTreeViewer().setUseHashlookup(true);
    fTree.getCheckboxTreeViewer().setInput(PDECore.getDefault());

    fTree
        .getCheckboxTreeViewer()
        .addCheckStateListener(
            new ICheckStateListener() {
              public void checkStateChanged(CheckStateChangedEvent event) {
                validatePage();
              }
            });

    // Add select / deselect all buttons for bug 46669
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    buttonComposite.setLayout(new GridLayout(2, true));
    buttonComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    Button selectAllButton = new Button(buttonComposite, SWT.PUSH);
    selectAllButton.setText(PDEUIMessages.PluginWorkingSet_selectAll_label);
    selectAllButton.setToolTipText(PDEUIMessages.PluginWorkingSet_selectAll_toolTip);
    selectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent selectionEvent) {
            fTree
                .getCheckboxTreeViewer()
                .setCheckedElements(
                    fTableContentProvider.getElements(fTree.getCheckboxTreeViewer().getInput()));
            validatePage();
          }
        });
    selectAllButton.setLayoutData(new GridData());
    SWTUtil.setButtonDimensionHint(selectAllButton);

    Button deselectAllButton = new Button(buttonComposite, SWT.PUSH);
    deselectAllButton.setText(PDEUIMessages.PluginWorkingSet_deselectAll_label);
    deselectAllButton.setToolTipText(PDEUIMessages.PluginWorkingSet_deselectAll_toolTip);
    deselectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent selectionEvent) {
            fTree.getCheckboxTreeViewer().setCheckedElements(new Object[0]);
            validatePage();
          }
        });
    deselectAllButton.setLayoutData(new GridData());
    SWTUtil.setButtonDimensionHint(deselectAllButton);
    setPageComplete(false);
    setMessage(PDEUIMessages.PluginWorkingSet_message);

    initialize();
    Dialog.applyDialogFont(composite);

    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(composite, IHelpContextIds.PLUGIN_WORKING_SET);
  }