/** * Creates the file sets area. * * @param fileSetsContainer the container to add the file sets area to */ private Control createFileSetsArea(Composite fileSetsContainer) throws CheckstylePluginException { Control[] controls = fileSetsContainer.getChildren(); for (int i = 0; i < controls.length; i++) { controls[i].dispose(); } if (mProjectConfig.isUseSimpleConfig()) { mFileSetsEditor = new SimpleFileSetsEditor(this); } else { mFileSetsEditor = new ComplexFileSetsEditor(this); } mFileSetsEditor.setFileSets(mProjectConfig.getFileSets()); Control editor = mFileSetsEditor.createContents(mFileSetsContainer); fileSetsContainer.setLayout(new FormLayout()); FormData fd = new FormData(); fd.left = new FormAttachment(0); fd.top = new FormAttachment(0); fd.right = new FormAttachment(100); fd.bottom = new FormAttachment(100); editor.setLayoutData(fd); return fileSetsContainer; }
/** {@inheritDoc} */ public Control createContents(Composite parent) { Composite container = null; try { this.mPageController = new PageController(); // suppress default- & apply-buttons noDefaultAndApplyButton(); mMainTab = new TabFolder(parent, SWT.TOP); mMainTab.setLayoutData(new GridData(GridData.FILL_BOTH)); mMainTab.addSelectionListener(mPageController); // create the main container container = new Composite(mMainTab, SWT.NULL); container.setLayout(new FormLayout()); container.setLayoutData(new GridData(GridData.FILL_BOTH)); // create the checkbox to enable/diable the simple configuration this.mChkSimpleConfig = new Button(container, SWT.CHECK); this.mChkSimpleConfig.setText(Messages.CheckstylePropertyPage_btnUseSimpleConfig); this.mChkSimpleConfig.addSelectionListener(this.mPageController); this.mChkSimpleConfig.setSelection(mProjectConfig.isUseSimpleConfig()); FormData fd = new FormData(); // fd.left = new FormAttachment(this.mChkEnable, 0, SWT.RIGHT); fd.top = new FormAttachment(0, 3); fd.right = new FormAttachment(100, -3); this.mChkSimpleConfig.setLayoutData(fd); // create the checkbox to enabel/disable checkstyle this.mChkEnable = new Button(container, SWT.CHECK); this.mChkEnable.setText(Messages.CheckstylePropertyPage_btnActivateCheckstyle); this.mChkEnable.addSelectionListener(this.mPageController); this.mChkEnable.setSelection(mCheckstyleInitiallyActivated); fd = new FormData(); fd.left = new FormAttachment(0, 3); fd.top = new FormAttachment(0, 3); fd.right = new FormAttachment(this.mChkSimpleConfig, 3, SWT.LEFT); this.mChkEnable.setLayoutData(fd); // create the checkbox for formatter synching this.mChkSyncFormatter = new Button(container, SWT.CHECK); this.mChkSyncFormatter.setText(Messages.CheckstylePropertyPage_btnSyncFormatter); this.mChkSyncFormatter.addSelectionListener(this.mPageController); this.mChkSyncFormatter.setSelection(mProjectConfig.isSyncFormatter()); fd = new FormData(); fd.left = new FormAttachment(0, 3); fd.top = new FormAttachment(this.mChkEnable, 3, SWT.BOTTOM); this.mChkSyncFormatter.setLayoutData(fd); // create the configuration area mFileSetsContainer = new Composite(container, SWT.NULL); Control configArea = createFileSetsArea(mFileSetsContainer); fd = new FormData(); fd.left = new FormAttachment(0, 3); fd.top = new FormAttachment(this.mChkSyncFormatter, 6, SWT.BOTTOM); fd.right = new FormAttachment(100, -3); fd.bottom = new FormAttachment(45); configArea.setLayoutData(fd); // create the filter area Control filterArea = createFilterArea(container); fd = new FormData(); fd.left = new FormAttachment(0, 3); fd.top = new FormAttachment(configArea, 3, SWT.BOTTOM); fd.right = new FormAttachment(100, -3); fd.bottom = new FormAttachment(100, -3); fd.width = 500; filterArea.setLayoutData(fd); // create the local configurations area Control localConfigArea = createLocalConfigArea(mMainTab); TabItem mainItem = new TabItem(mMainTab, SWT.NULL); mainItem.setControl(container); mainItem.setText(Messages.CheckstylePropertyPage_tabMain); TabItem localItem = new TabItem(mMainTab, SWT.NULL); localItem.setControl(localConfigArea); localItem.setText(Messages.CheckstylePropertyPage_tabCheckConfigs); } catch (CheckstylePluginException e) { CheckstyleUIPlugin.errorDialog(getShell(), Messages.errorOpeningPropertiesPage, e, true); } return container; }