/** * Builds the SWT controls for the three areas of a compare/merge viewer. * * <p>Calls the hooks <code>createControls</code> and <code>createToolItems</code> to let * subclasses build the specific content areas and to add items to an enclosing toolbar. * * <p>This method must only be called in the constructor of subclasses. * * @param parent the parent control * @return the new control */ protected final Control buildControl(Composite parent) { fComposite = new Composite(parent, fStyles | SWT.LEFT_TO_RIGHT) { // we // force // a // specific // direction public boolean setFocus() { return ContentMergeViewer.this.handleSetFocus(); } }; fComposite.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle()); hookControl(fComposite); // hook help & dispose listener fComposite.setLayout(new ContentMergeViewerLayout()); int style = SWT.SHADOW_OUT; fAncestorLabel = new CLabel(fComposite, style | Window.getDefaultOrientation()); fLeftLabel = new CLabel(fComposite, style | Window.getDefaultOrientation()); new Resizer(fLeftLabel, VERTICAL); fDirectionLabel = new CLabel(fComposite, style); fDirectionLabel.setAlignment(SWT.CENTER); new Resizer(fDirectionLabel, HORIZONTAL | VERTICAL); fRightLabel = new CLabel(fComposite, style | Window.getDefaultOrientation()); new Resizer(fRightLabel, VERTICAL); if (fCenter == null || fCenter.isDisposed()) fCenter = createCenterControl(fComposite); createControls(fComposite); fHandlerService = CompareHandlerService.createFor( getCompareConfiguration().getContainer(), fComposite.getShell()); initializeToolbars(parent); return fComposite; }
@Override protected Control createCustomArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); buttons = new Button[3]; for (int i = 0; i < 3; i++) { buttons[i] = new Button(composite, SWT.RADIO); buttons[i].addSelectionListener(selectionListener); buttons[i].setText( NLS.bind( TeamUIMessages.SelectAncestorDialog_option, theResources[i].getFullPath().toPortableString())); buttons[i].setFont(parent.getFont()); // set initial state buttons[i].setSelection(i == 0); } pickAncestor(0); return composite; }