@Override public void createControl(Composite parent) { Composite composite = ControlFactory.createComposite(parent, 1); setControl(composite); MakeUIPlugin.getDefault() .getWorkbench() .getHelpSystem() .setHelp(getControl(), IMakeHelpContextIds.MAKE_BUILDER_SETTINGS); if (fBuildInfo == null) { ControlFactory.createEmptySpace(composite); ControlFactory.createLabel( composite, MakeUIPlugin.getResourceString( "SettingsBlock.label.missingBuilderInformation")); //$NON-NLS-1$ return; } createBuildCmdControls(composite); createSettingControls(composite); createWorkBenchBuildControls(composite); if (getContainer().getProject() != null) { createBuilderWorkingDirControls(composite); } }
/* (non-Javadoc) * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() */ @Override protected void createFieldEditors() { Group group = ControlFactory.createGroup(getFieldEditorParent(), "Open disassembly options", 1); Composite spacer = ControlFactory.createComposite(group, 1); FieldEditor edit = new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_DISASM_OPEN_NO_SOURCE_INFO, "Source information is not available", spacer); edit.fillIntoGrid(spacer, 2); addField(edit); edit = new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_DISASM_OPEN_SOURCE_NOT_FOUND, "Source file not found", spacer); edit.fillIntoGrid(spacer, 2); addField(edit); group = ControlFactory.createGroup(getFieldEditorParent(), "Display settings", 1); spacer = ControlFactory.createComposite(group, 1); edit = new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_DISASM_SHOW_INSTRUCTIONS, "Show instructions", spacer); edit.fillIntoGrid(spacer, 2); addField(edit); edit = new BooleanFieldEditor( ICDebugPreferenceConstants.PREF_DISASM_SHOW_SOURCE, "Show source", spacer); edit.fillIntoGrid(spacer, 2); addField(edit); }
private Control createConfigurationBlock(Composite parent) { Composite composite = ControlFactory.createComposite(parent, 1); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Button checkboxFormat = addCheckBox( composite, PreferencesMessages.SaveActionsPreferencePage_formatSourceCode, FORMAT_SOURCE_CODE, 0); Composite group = createRadioContainer(composite); fRadioFormatAllLines = addRadioButton( group, PreferencesMessages.SaveActionsPreferencePage_formatAllLines, null, 0); fRadioFormatEditedLines = addRadioButton( group, PreferencesMessages.SaveActionsPreferencePage_formatEditedLines, REMOVE_TRAILING_WHITESPACE_LIMIT_TO_EDITED_LINES, 0); createDependency(checkboxFormat, FORMAT_SOURCE_CODE, fRadioFormatAllLines); createDependency(checkboxFormat, FORMAT_SOURCE_CODE, fRadioFormatEditedLines); ControlFactory.createEmptySpace(composite, 1); Button checkboxTrailingWhitespace = addCheckBox( composite, PreferencesMessages.SaveActionsPreferencePage_removeTrailingWhitespace, REMOVE_TRAILING_WHITESPACE, 0); group = createRadioContainer(composite); fRadioTrailingWhitespaceAllLines = addRadioButton(group, PreferencesMessages.SaveActionsPreferencePage_inAllLines, null, 0); fRadioTrailingWhitespaceEditedLines = addRadioButton( group, PreferencesMessages.SaveActionsPreferencePage_inEditedLines, REMOVE_TRAILING_WHITESPACE_LIMIT_TO_EDITED_LINES, 0); createDependency( checkboxTrailingWhitespace, REMOVE_TRAILING_WHITESPACE, fRadioTrailingWhitespaceAllLines); createDependency( checkboxTrailingWhitespace, REMOVE_TRAILING_WHITESPACE, fRadioTrailingWhitespaceEditedLines); ControlFactory.createEmptySpace(composite, 1); addCheckBox( composite, PreferencesMessages.SaveActionsPreferencePage_ensureNewline, ENSURE_NEWLINE_AT_EOF, 0); return composite; }
private Composite createRadioContainer(Composite parent) { Composite composite = ControlFactory.createComposite(parent, 1); GridLayout layout = (GridLayout) composite.getLayout(); layout.marginHeight = 0; layout.marginWidth = 0; return composite; }
protected void createSettingControls(Composite parent) { Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_SETTING_GROUP), 1); stopOnErrorButton = new Button(group, SWT.CHECK); stopOnErrorButton.setText(MakeUIPlugin.getResourceString(MAKE_SETTING_STOP_ERROR)); if (fBuildInfo.isStopOnError()) { stopOnErrorButton.setSelection(true); } stopOnErrorButton.setEnabled(fBuildInfo.isDefaultBuildCmd()); }
/* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ @Override public void createControl(Composite parent) { Composite page = ControlFactory.createComposite(parent, 1); // ((GridData) page.getLayoutData()).grabExcessVerticalSpace = true; // ((GridData) page.getLayoutData()).verticalAlignment = GridData.FILL; // Add the profile UI contribution. Group profileGroup = ControlFactory.createGroup( page, MakeUIPlugin.getResourceString("ScannerConfigOptionsDialog.profile.group.label"), 3); //$NON-NLS-1$ GridData gd = (GridData) profileGroup.getLayoutData(); gd.grabExcessHorizontalSpace = true; // PixelConverter converter = new PixelConverter(profileGroup); // gd.heightHint = converter.convertVerticalDLUsToPixels(DEFAULT_HEIGHT); ((GridLayout) profileGroup.getLayout()).makeColumnsEqualWidth = false; // Add bop enabled checkbox bopEnabledButton = ControlFactory.createCheckBox(profileGroup, B_ENABLE); // bopEnabledButton.setFont(parent.getFont()); ((GridData) bopEnabledButton.getLayoutData()).horizontalSpan = 3; ((GridData) bopEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true; bopEnabledButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleModifyOpenFileText(); } }); // load label Label loadLabel = ControlFactory.createLabel(profileGroup, L_OPEN); ((GridData) loadLabel.getLayoutData()).horizontalSpan = 2; // load button bopLoadButton = ControlFactory.createPushButton(profileGroup, B_LOAD); ((GridData) bopLoadButton.getLayoutData()).minimumWidth = 120; bopLoadButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { handleBOPLoadFileButtonSelected(); } }); if (getContainer().getProject() == null) { // project properties bopLoadButton.setVisible(false); } // text field bopOpenFileText = ControlFactory.createTextField(profileGroup, SWT.SINGLE | SWT.BORDER); bopOpenFileText.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { handleModifyOpenFileText(); } }); bopLoadButton.setEnabled(loadButtonInitialEnabled && handleModifyOpenFileText()); // browse button Button browseButton = ControlFactory.createPushButton(profileGroup, B_BROWSE); ((GridData) browseButton.getLayoutData()).minimumWidth = 120; browseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { handleBOPBrowseButtonSelected(); } private void handleBOPBrowseButtonSelected() { FileDialog dialog = new FileDialog(getShell(), SWT.NONE); dialog.setText(F_OPEN); String fileName = getBopOpenFileText(); IPath filterPath; if (fileName.length() == 0 && getContainer().getProject() != null) { filterPath = getContainer().getProject().getLocation(); } else { IPath filePath = new Path(fileName); filterPath = filePath.removeLastSegments(1).makeAbsolute(); } dialog.setFilterPath(filterPath.toOSString()); String res = dialog.open(); if (res == null) { return; } setBopOpenFileText(res); } }); // variable button addVariablesButton(profileGroup, bopOpenFileText); setControl(page); // set the shell variable; must be after setControl // lock.acquire(); synchronized (lock) { shell = getShell(); instance = this; } // lock.release(); initializeValues(); }
protected void contentForCDT(Composite composite) { GridData gd; if (showsConfig()) { // Add a config selection area Group configGroup = ControlFactory.createGroup(composite, EMPTY_STR, 1); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.grabExcessHorizontalSpace = true; gd.widthHint = 150; configGroup.setLayoutData(gd); configGroup.setLayout(new GridLayout(3, false)); Label configLabel = new Label(configGroup, SWT.NONE); configLabel.setText(Messages.AbstractPage_6); configLabel.setLayoutData(new GridData(GridData.BEGINNING)); configSelector = new Combo(configGroup, SWT.READ_ONLY | SWT.DROP_DOWN); configSelector.addListener( SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { handleConfigSelection(); } }); gd = new GridData(GridData.FILL_BOTH); configSelector.setLayoutData(gd); if (!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG)) { manageButton = new Button(configGroup, SWT.PUSH); manageButton.setText(Messages.AbstractPage_12); gd = new GridData(GridData.END); gd.minimumWidth = 150; manageButton.setLayoutData(gd); manageButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IProject[] obs = new IProject[] {getProject()}; IConfigManager cm = ManageConfigSelector.getManager(obs); if (cm != null && cm.manage(obs, false)) { cfgDescs = null; populateConfigurations(); } } }); } else { // dummy object to avoid breaking layout new Label(configGroup, SWT.NONE).setLayoutData(new GridData(GridData.END)); } errPane = new Composite(configGroup, SWT.NONE); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; errPane.setLayoutData(gd); GridLayout gl = new GridLayout(2, false); gl.marginHeight = 0; gl.marginWidth = 0; gl.verticalSpacing = 0; gl.horizontalSpacing = 0; errPane.setLayout(gl); errIcon = new Label(errPane, SWT.LEFT); errIcon.setLayoutData(new GridData(GridData.BEGINNING)); errIcon.setImage(IMG_WARN); errMessage = new Text(errPane, SWT.LEFT | SWT.READ_ONLY); errMessage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (isForFolder() || isForFile()) { excludeFromBuildCheck = new Button(configGroup, SWT.CHECK); excludeFromBuildCheck.setText(Messages.AbstractPage_7); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; excludeFromBuildCheck.setLayoutData(gd); excludeFromBuildCheck.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ICResourceDescription rcDescription = getResDesc(); rcDescription.setExcluded(excludeFromBuildCheck.getSelection()); if (currentTab instanceof AbstractCPropertyTab) { ((AbstractCPropertyTab) currentTab).updateData(rcDescription); } } }); } } // Update the contents of the configuration widget populateConfigurations(); if (excludeFromBuildCheck != null) { excludeFromBuildCheck.setSelection(getResDesc().isExcluded()); } // Create the Specific objects for each page createWidgets(composite); }
protected void createBuilderWorkingDirControls(Composite parent) { Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_GROUP), 1); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.makeColumnsEqualWidth = false; group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = ControlFactory.createLabel(group, MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_LABEL)); ((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING; ((GridData) (label.getLayoutData())).grabExcessHorizontalSpace = false; buildLocation = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER); ((GridData) (buildLocation.getLayoutData())).horizontalAlignment = GridData.FILL; ((GridData) (buildLocation.getLayoutData())).grabExcessHorizontalSpace = true; buildLocation.addListener( SWT.Modify, new Listener() { public void handleEvent(Event e) { getContainer().updateContainer(); } }); Composite buttons = ControlFactory.createComposite(group, 4); layout = new GridLayout(4, false); layout.marginHeight = layout.marginWidth = 0; buttons.setLayout(layout); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; buttons.setLayoutData(gd); Label emptyLabel = ControlFactory.createLabel(buttons, ""); // $NON-NLS-1$ emptyLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Button browseWorkspace = new Button(buttons, SWT.NONE); browseWorkspace.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE_WORKSPACE)); browseWorkspace.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ContainerSelectionDialog dialog = new ContainerSelectionDialog( getShell(), getContainer().getProject(), true, MakeUIPlugin.getResourceString( "SettingsBlock.title.selectLocationToBuildFrom")); //$NON-NLS-1$ if (dialog.open() == Window.OK) { Object[] selection = dialog.getResult(); if (selection.length > 0) { buildLocation.setText(((IPath) selection[0]).toOSString()); } } } }); Button browseFilesystem = new Button(buttons, SWT.NONE); browseFilesystem.setText(MakeUIPlugin.getResourceString(MAKE_BUILD_DIR_BROWSE_FILESYSTEM)); browseFilesystem.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE); dialog.setText( MakeUIPlugin.getResourceString( "SettingsBlock.title.selectLocationToBuildFrom")); //$NON-NLS-1$ dialog.setFilterPath(getContainer().getProject().toString()); String directory = dialog.open(); if (directory != null) { if (directory.trim().length() > 0) { buildLocation.setText(directory); } } } }); buildLocation.setText( fBuildInfo.getBuildAttribute(IMakeCommonBuildInfo.BUILD_LOCATION, "")); // $NON-NLS-1$ locationVariablesButton = addVariablesButton(buttons, buildLocation); }
protected void createWorkBenchBuildControls(Composite parent) { SelectionAdapter selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { targetAuto.setEnabled(autoButton.getSelection()); autoVariableButton.setEnabled(autoButton.getSelection()); targetIncr.setEnabled(incrButton.getSelection()); incrVariableButton.setEnabled(incrButton.getSelection()); targetClean.setEnabled(cleanButton.getSelection()); cleanVariableButton.setEnabled(cleanButton.getSelection()); getContainer().updateContainer(); } }; Group group = ControlFactory.createGroup( parent, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_GROUP), 1); GridLayout layout = new GridLayout(); layout.numColumns = 3; layout.makeColumnsEqualWidth = false; group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = new Label(group, SWT.NONE); label.setText(MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_TYPE)); label = new Label(group, SWT.NONE); label.setText(MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_TARGET)); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 2; label.setLayoutData(gd); autoButton = ControlFactory.createCheckBox( group, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_AUTO)); autoButton.addSelectionListener(selectionAdapter); autoButton.setSelection(fBuildInfo.isAutoBuildEnable()); targetAuto = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER); targetAuto.setText( fBuildInfo.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_AUTO, "")); // $NON-NLS-1$ ((GridData) (targetAuto.getLayoutData())).horizontalAlignment = GridData.FILL; ((GridData) (targetAuto.getLayoutData())).grabExcessHorizontalSpace = true; addControlAccessibleListener( targetAuto, MakeUIPlugin.getResourceString(MAKE_BUILD_AUTO_TARGET)); autoVariableButton = addVariablesButton(group, targetAuto); String noteTitle = MakeUIPlugin.getResourceString("SettingsBlock.makeWorkbench.note"); // $NON-NLS-1$ String noteMessage = MakeUIPlugin.getResourceString( "SettingsBlock.makeWorkbench.autobuildMessage"); //$NON-NLS-1$ Composite noteControl = createNoteComposite(JFaceResources.getDialogFont(), group, noteTitle, noteMessage); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan = 3; noteControl.setLayoutData(gd); incrButton = ControlFactory.createCheckBox( group, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_INCR)); incrButton.addSelectionListener(selectionAdapter); incrButton.setSelection(fBuildInfo.isIncrementalBuildEnabled()); targetIncr = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER); targetIncr.setText( fBuildInfo.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_INCREMENTAL, "")); // $NON-NLS-1$ ((GridData) (targetIncr.getLayoutData())).horizontalAlignment = GridData.FILL; ((GridData) (targetIncr.getLayoutData())).grabExcessHorizontalSpace = true; addControlAccessibleListener( targetIncr, MakeUIPlugin.getResourceString(MAKE_BUILD_INCREMENTAL_TARGET)); incrVariableButton = addVariablesButton(group, targetIncr); cleanButton = ControlFactory.createCheckBox( group, MakeUIPlugin.getResourceString(MAKE_WORKBENCH_BUILD_CLEAN)); cleanButton.addSelectionListener(selectionAdapter); cleanButton.setSelection(fBuildInfo.isCleanBuildEnabled()); targetClean = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER); targetClean.setText( fBuildInfo.getBuildAttribute(IMakeBuilderInfo.BUILD_TARGET_CLEAN, "")); // $NON-NLS-1$ ((GridData) (targetClean.getLayoutData())).horizontalAlignment = GridData.FILL; ((GridData) (targetClean.getLayoutData())).grabExcessHorizontalSpace = true; addControlAccessibleListener( targetClean, MakeUIPlugin.getResourceString(MAKE_BUILD_CLEAN_TARGET)); cleanVariableButton = addVariablesButton(group, targetClean); selectionAdapter.widgetSelected(null); }
protected void createBuildCmdControls(Composite parent) { Group group = ControlFactory.createGroup(parent, MakeUIPlugin.getResourceString(MAKE_CMD_GROUP), 1); GridLayout layout = new GridLayout(); layout.numColumns = 3; layout.makeColumnsEqualWidth = false; group.setLayout(layout); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); defButton = ControlFactory.createCheckBox(group, MakeUIPlugin.getResourceString(MAKE_CMD_USE_DEFAULT)); defButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (defButton.getSelection() == true) { buildCommand.setEnabled(false); argumentVariablesButton.setEnabled(false); stopOnErrorButton.setEnabled(true); getContainer().updateContainer(); } else { buildCommand.setEnabled(true); argumentVariablesButton.setEnabled(true); stopOnErrorButton.setEnabled(false); getContainer().updateContainer(); } } }); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; defButton.setLayoutData(gd); Label label = ControlFactory.createLabel(group, MakeUIPlugin.getResourceString(MAKE_CMD_LABEL)); ((GridData) (label.getLayoutData())).horizontalAlignment = GridData.BEGINNING; ((GridData) (label.getLayoutData())).grabExcessHorizontalSpace = false; buildCommand = ControlFactory.createTextField(group, SWT.SINGLE | SWT.BORDER); ((GridData) (buildCommand.getLayoutData())).horizontalAlignment = GridData.FILL; ((GridData) (buildCommand.getLayoutData())).grabExcessHorizontalSpace = true; buildCommand.addListener( SWT.Modify, new Listener() { public void handleEvent(Event e) { getContainer().updateContainer(); } }); if (fBuildInfo.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, null) != null) { StringBuffer cmd = new StringBuffer( fBuildInfo.getBuildAttribute(IMakeCommonBuildInfo.BUILD_COMMAND, "")); // $NON-NLS-1$ if (!fBuildInfo.isDefaultBuildCmd()) { String args = fBuildInfo.getBuildAttribute(IMakeCommonBuildInfo.BUILD_ARGUMENTS, ""); // $NON-NLS-1$ if (args != null && !args.equals("")) { // $NON-NLS-1$ cmd.append(" "); // $NON-NLS-1$ cmd.append(args); } } buildCommand.setText(cmd.toString()); } argumentVariablesButton = addVariablesButton(group, buildCommand); if (fBuildInfo.isDefaultBuildCmd()) { buildCommand.setEnabled(false); argumentVariablesButton.setEnabled(false); } defButton.setSelection(fBuildInfo.isDefaultBuildCmd()); }