/** * Creates the button layout. This displays options and buttons at the bottom of the editor to * allow actions to be performed on the bug. */ @Override protected void createActionsLayout(Composite formComposite) { Section section = getManagedForm().getToolkit().createSection(formComposite, ExpandableComposite.TITLE_BAR); section.setText(getSectionLabel(SECTION_NAME.ACTIONS_SECTION)); section.setExpanded(true); section.setLayout(new GridLayout()); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, true).applyTo(section); Composite buttonComposite = getManagedForm().getToolkit().createComposite(section); buttonComposite.setLayout(new GridLayout(4, false)); buttonComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); section.setClient(buttonComposite); addToCategory = getManagedForm().getToolkit().createButton(buttonComposite, "Add to Category", SWT.CHECK); categoryChooser = new CCombo(buttonComposite, SWT.FLAT | SWT.READ_ONLY); categoryChooser.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); categoryChooser.setLayoutData(GridDataFactory.swtDefaults().hint(150, SWT.DEFAULT).create()); getManagedForm().getToolkit().adapt(categoryChooser, true, true); categoryChooser.setFont(TEXT_FONT); ITaskList taskList = TasksUiInternal.getTaskList(); List<AbstractTaskCategory> categories = new ArrayList<AbstractTaskCategory>(taskList.getCategories()); Collections.sort( categories, new Comparator<AbstractTaskContainer>() { public int compare(AbstractTaskContainer c1, AbstractTaskContainer c2) { if (c1.equals(TasksUiPlugin.getTaskList().getDefaultCategory())) { return -1; } else if (c2.equals(TasksUiPlugin.getTaskList().getDefaultCategory())) { return 1; } else { return c1.getSummary().compareToIgnoreCase(c2.getSummary()); } } }); for (IRepositoryElement category : categories) { categoryChooser.add(category.getSummary()); } categoryChooser.select(0); categoryChooser.setEnabled(false); categoryChooser.setData(categories); addToCategory.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { categoryChooser.setEnabled(addToCategory.getSelection()); } }); GridDataFactory.fillDefaults() .hint(DEFAULT_FIELD_WIDTH, SWT.DEFAULT) .span(3, SWT.DEFAULT) .applyTo(categoryChooser); addActionButtons(buttonComposite); getManagedForm().getToolkit().paintBordersFor(buttonComposite); }