use of org.eclipse.jface.preference.RadioGroupFieldEditor in project tdi-studio-se by Talend.
the class SqlBuilderPreferencePage method createFieldEditors.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
@Override
protected void createFieldEditors() {
booleanFieldEditor = new BooleanFieldEditor(ITalendCorePrefConstants.SQL_ADD_QUOTE, Messages.getString("SqlBuilderPreferencePage.AddQuotes"), //$NON-NLS-1$
getFieldEditorParent());
choiceAS4Sql = new RadioGroupFieldEditor(ITalendCorePrefConstants.AS400_SQL_SEG, Messages.getString("SqlBuilderPreferencePage.AS400SqlGen"), 1, new String[][] { //$NON-NLS-1$
{ Messages.getString("SqlBuilderPreferencePage.StandardSQL"), STANDARD_MODE }, { Messages.getString("SqlBuilderPreferencePage.SystemSQL"), SYSTEM_MODE } }, //$NON-NLS-1$
getFieldEditorParent());
sqlwarn = new BooleanFieldEditor(ITalendCorePrefConstants.SQL_ADD_WARNING, //$NON-NLS-1$
Messages.getString("SqlBuilderPreferencePage.sql"), getFieldEditorParent());
// dbConnTimeoutActive = new CheckBoxFieldEditor(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT_ACTIVED,
// Messages
// .getString("SqlBuilderPreferencePage.ActivedTimeoutSetting"), getFieldEditorParent()); //$NON-NLS-1$
// dbConnTimeoutActive.getButton().addSelectionListener(new SelectionAdapter() {
//
// public void widgetSelected(SelectionEvent e) {
// checkDBTimeout();
// }
// });
// dbConnTimeout = new IntegerFieldEditor(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT, Messages
// .getString("SqlBuilderPreferencePage.ConnectionTimeout"), //$NON-NLS-1$
// getFieldEditorParent());
// Text textControl = dbConnTimeout.getTextControl(getFieldEditorParent());
// textControl.setToolTipText(Messages.getString("SqlBuilderPreferencePage.ConnectionTimeoutTip")); //$NON-NLS-1$
// dbConnTimeout.setValidRange(0, Short.MAX_VALUE);
addField(booleanFieldEditor);
addField(choiceAS4Sql);
addField(sqlwarn);
// addField(dbConnTimeoutActive);
// addField(dbConnTimeout);
}
use of org.eclipse.jface.preference.RadioGroupFieldEditor in project tdi-studio-se by Talend.
the class DragAndDrogDialog method createDialogArea.
/*
* (non-Javadoc) Method declared on Dialog.
*/
protected Control createDialogArea(Composite parent) {
// create composite
Composite composite = (Composite) super.createDialogArea(parent);
// composite.setLayout(new GridLayout());
// String[][] namevalues = new String[][] { { "Create as sub-element of target node", CREATE_AS_SUBELEMENT },
// { "Create as attribute of target node", CREATE_AS_ATTRIBUTE }, { "Add linker to target node", CREATE_AS_TEXT
// } };
String[][] namevalues = null;
if (hasChildren) {
namevalues = new String[][] { { "Create as sub-element of target node", CREATE_AS_SUBELEMENT }, { "Create as attribute of target node", CREATE_AS_ATTRIBUTE } };
} else {
namevalues = new String[][] { { "Create as sub-element of target node", CREATE_AS_SUBELEMENT }, { "Create as attribute of target node", CREATE_AS_ATTRIBUTE }, { "Add linker to target node", CREATE_AS_TEXT } };
}
RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor("", "Select the operation:", 1, namevalues, composite, true);
GridLayout layout = new GridLayout();
layout.marginWidth = 12;
composite.setLayout(layout);
rgfe.setPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
value = event.getNewValue().toString();
}
});
applyDialogFont(composite);
return composite;
}
use of org.eclipse.jface.preference.RadioGroupFieldEditor in project tdi-studio-se by Talend.
the class DesignerPreferencePage method createFieldEditors.
/**
* Creates the field editors. Field editors are abstractions of the common GUI blocks needed to manipulate various
* types of preferences. Each field editor knows how to save and restore itself.
*/
@Override
public void createFieldEditors() {
StringFieldEditor labelField;
StringFieldEditor hintField;
StringFieldEditor connectionField;
BooleanFieldEditor showHint;
// BooleanFieldEditor displayComponent;
BooleanFieldEditor useRepositoryName;
// BooleanFieldEditor deactiveRepositoryUpdate;
labelField = new StringFieldEditor(TalendDesignerPrefConstants.DEFAULT_LABEL, //$NON-NLS-1$
Messages.getString("DesignerPreferencePage.component.defaultLabel"), getFieldEditorParent());
hintField = new StringFieldEditor(TalendDesignerPrefConstants.DEFAULT_HINT, //$NON-NLS-1$
Messages.getString("DesignerPreferencePage.component.defaultHint"), getFieldEditorParent());
connectionField = new StringFieldEditor(TalendDesignerPrefConstants.DEFAULT_CONNECTION_FORMAT, Messages.getString("DesignerPreferencePage.defaultConnection"), //$NON-NLS-1$
getFieldEditorParent());
showHint = new BooleanFieldEditor(TalendDesignerPrefConstants.DEFAULT_HINT_USED, //$NON-NLS-1$
Messages.getString("DesignerPreferencePage.hintShowed"), getFieldEditorParent());
// displayComponent = new BooleanFieldEditor(TalendDesignerPrefConstants.DEFAULT_DISPLAY, Messages
// .getString("DesignerPreferencePage.display.hiddenComponents"), getFieldEditorParent()); //$NON-NLS-1$
useRepositoryName = new BooleanFieldEditor(TalendDesignerPrefConstants.USE_REPOSITORY_NAME, Messages.getString("DesignerPreferencePage.display.useRepositoryName"), //$NON-NLS-1$
getFieldEditorParent());
// deactiveRepositoryUpdate = new BooleanFieldEditor(ITalendCorePrefConstants.DEACTIVE_REPOSITORY_UPDATE,
// Messages
// .getString("DesignerPreferencePage.display.deactiveRepositoryUpdate"), getFieldEditorParent()); //$NON-NLS-1$
addField(labelField);
addField(hintField);
addField(connectionField);
addField(showHint);
// addField(displayComponent);
addField(useRepositoryName);
// addField(deactiveRepositoryUpdate);
// addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPERTY_CODE_CHECK, Messages
// .getString("DesignerPreferencePage.propertyCodeCheck"), getFieldEditorParent())); //$NON-NLS-1$
BooleanFieldEditor antialiasing;
antialiasing = new BooleanFieldEditor(TalendDesignerPrefConstants.EDITOR_ANTIALIASING, Messages.getString("DesignerPreferencePage.actionInJobDesigner"), //$NON-NLS-1$
getFieldEditorParent());
addField(antialiasing);
BooleanFieldEditor lineStyle;
lineStyle = new BooleanFieldEditor(TalendDesignerPrefConstants.EDITOR_LINESTYLE, Messages.getString("DesignerPreferencePage.lineStyle"), //$NON-NLS-1$
getFieldEditorParent());
addField(lineStyle);
if (PluginChecker.isTestCasePluginLoaded()) {
BooleanFieldEditor duplicateTestCases;
duplicateTestCases = new BooleanFieldEditor(TalendDesignerPrefConstants.DUPLICATE_TESTCASE, Messages.getString("DesignerPreferencePage.duplicateTestCases"), //$NON-NLS-1$
getFieldEditorParent());
addField(duplicateTestCases);
}
DirectoryFieldEditor compDefaultFileDir = new DirectoryFieldEditor(TalendDesignerPrefConstants.COMP_DEFAULT_FILE_DIR, Messages.getString("DesignerPreferencePage.defaultFilePathDirectory"), getFieldEditorParent()) {
@Override
protected // wzhang added to set the separator as "/" of default component filePath in preference.
String changePressed() {
File f = new File(getTextControl().getText());
if (!f.exists()) {
f = null;
}
DirectoryDialog fileDialog = new DirectoryDialog(getShell(), SWT.OPEN);
if (f != null) {
fileDialog.setFilterPath(f.getPath());
}
String openDir = fileDialog.open();
if (openDir != null) {
openDir.trim();
if (openDir.length() > 0) {
File filePath = new File(openDir);
if (!filePath.exists()) {
return null;
}
}
return Path.fromOSString(openDir).toPortableString();
}
return null;
}
};
addField(compDefaultFileDir);
RadioGroupFieldEditor largeIconsSizeField = new RadioGroupFieldEditor(TalendDesignerPrefConstants.LARGE_ICONS_SIZE, Messages.getString("DesignerPreferencePage.largeIconsSize"), 2, new String[][] { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
{ Messages.getString("DesignerPreferencePage.iconSize24"), "" + 24 }, { Messages.getString("DesignerPreferencePage.iconSize32"), "" + 32 } }, //$NON-NLS-1$ //$NON-NLS-2$
getFieldEditorParent());
addField(largeIconsSizeField);
// disable this feature 1722 for the M1 release as it's not used yet in Perl or Java.
// RadioGroupFieldEditor schemaOptions = new RadioGroupFieldEditor(
// TalendDesignerPrefConstants.SCHEMA_OPTIONS,
// Messages.getString("DesignerPreferencePage.schemaOptions"), 4, new String[][] { { "do nothing", "nothing" },
// { "die", "die" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// { "warn", "warn" }, { "enlarge or truncate row", "adapt" } }, getFieldEditorParent(), true); //$NON-NLS-1$
// //$NON-NLS-2$
// addField(schemaOptions);
RadioGroupFieldEditor viewOptions = new RadioGroupFieldEditor(TalendDesignerPrefConstants.VIEW_OPTIONS, Messages.getString("DesignerPreferencePage.viewOptions"), 2, new String[][] { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
{ Messages.getString("DesignerPreferencePage.compactView"), "default" }, { Messages.getString("DesignerPreferencePage.tableView"), "table view" } }, getFieldEditorParent(), //$NON-NLS-1$ //$NON-NLS-2$
true);
addField(viewOptions);
// BooleanFieldEditor viewSubjobs = new BooleanFieldEditor(TalendDesignerPrefConstants.DISPLAY_SUBJOBS,
// "Highlight subjobs in the job designs", getFieldEditorParent());
// addField(viewSubjobs);
// BooleanFieldEditor generateCodeWhenOpenJob = new BooleanFieldEditor(
// TalendDesignerPrefConstants.GENERATE_CODE_WHEN_OPEN_JOB, Messages
// .getString("DesignerPreferencePage.generateCode"), //$NON-NLS-1$
// getFieldEditorParent());
// addField(generateCodeWhenOpenJob);
// When updating jobs or joblets, check only the last version, and checked by default
// BooleanFieldEditor checkOnlyLastVersion = new
// BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION,
// Messages.getString("DesignerPreferencePage.checkVersion"), getFieldEditorParent()); //$NON-NLS-1$
// addField(checkOnlyLastVersion);
// BooleanFieldEditor propagateContextVariable = new BooleanFieldEditor(
// TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE, Messages
// .getString("DesignerPreferencePage.addOrDeleteVariable"), getFieldEditorParent()); //$NON-NLS-1$
// addField(propagateContextVariable);
BooleanFieldEditor displayMethodSize = new BooleanFieldEditor(TalendDesignerPrefConstants.DISPLAY_METHOD_SIZE, Messages.getString("DesignerPreferencePage.computeLength"), //$NON-NLS-1$
getFieldEditorParent());
addField(displayMethodSize);
BooleanFieldEditor allowDelConnWithJLTriggLinkCompField = new BooleanFieldEditor(TalendDesignerPrefConstants.NOT_SHOW_WARNING_WHEN_DELETE_LINK_WITH_JOBLETTRIGGERLINKCOMPONENT, Messages.getString("DesignerPreferencePage.notShowWarningDialog"), //$NON-NLS-1$
getFieldEditorParent());
addField(allowDelConnWithJLTriggLinkCompField);
}
use of org.eclipse.jface.preference.RadioGroupFieldEditor in project linuxtools by eclipse.
the class AbstractProviderPreferencesPage method createFieldEditors.
@Override
protected void createFieldEditors() {
String providerId = ProviderFramework.getHighestProviderId(type);
if (providerId != null) {
getPreferenceStore().setDefault(ProviderProfileConstants.PREFS_KEY + type, providerId);
}
HashMap<String, String> map = ProviderFramework.getProviderNamesForType(type);
// 2d array containing launch provider names on the first column and
// corresponding id's on the second.
String[][] providerList = new String[map.size()][2];
int i = 0;
for (Entry<String, String> entry : map.entrySet()) {
String toolId = entry.getValue();
String toolDescription = ProviderFramework.getToolInformationFromId(toolId, PROVIDER_ATT_DESC);
String toolName = entry.getKey();
// Append tool description to tool name if available.
if (toolDescription != null && !toolDescription.equals("")) {
// $NON-NLS-1$
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
toolName = toolName + " " + "[" + toolDescription + "]";
}
providerList[i][0] = toolName;
providerList[i][1] = toolId;
i++;
}
// Create basic field editor.
RadioGroupFieldEditor editor = new RadioGroupFieldEditor(ProviderProfileConstants.PREFS_KEY + type, Messages.ProviderPreferencesPage_1, 1, providerList, getFieldEditorParent(), true);
editor.setPreferenceStore(getPreferenceStore());
addField(editor);
Composite radioBoxControl = editor.getRadioBoxControl(getFieldEditorParent());
Control[] providerOptions = radioBoxControl.getChildren();
// Set tool tip text on field editors.
for (Control control : providerOptions) {
// Get tool specific information from provider id.
String curProviderId = (String) control.getData();
// Set tool tip description text.
String toolDescription = ProviderFramework.getToolInformationFromId(curProviderId, PROVIDER_ATT_INFO);
if (toolDescription != null && !toolDescription.equals("")) {
// $NON-NLS-1$
control.setToolTipText(toolDescription);
}
}
}
use of org.eclipse.jface.preference.RadioGroupFieldEditor in project linuxtools by eclipse.
the class CreaterepoGeneralPropertyPage method addContents.
@Override
protected Composite addContents(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
GridData layoutData = new GridData();
composite.setLayout(layout);
// TODO: use BooleanFieldEditor and get it to layout properly
// with the link (lnWorkspaceSettings)
btnProjectSettings = new Button(composite, SWT.CHECK);
btnProjectSettings.addListener(SWT.Selection, event -> toggleEnabled());
layoutData = new GridData();
layoutData.horizontalAlignment = GridData.BEGINNING;
layoutData.horizontalAlignment = GridData.FILL;
layoutData.grabExcessHorizontalSpace = true;
btnProjectSettings.setText(Messages.CreaterepoGeneralPropertyPage_projectSettings);
btnProjectSettings.setLayoutData(layoutData);
btnProjectSettings.setSelection(Activator.getDefault().getPreferenceStore().getBoolean(CreaterepoPreferenceConstants.PREF_GENERAL_ENABLED));
btnProjectSettings.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> checkState()));
lnWorkspaceSettings = new Link(composite, SWT.NONE);
layoutData = new GridData();
layoutData.horizontalAlignment = SWT.END;
lnWorkspaceSettings.setLayoutData(layoutData);
lnWorkspaceSettings.setText(NLS.bind(linkTags, Messages.CreaterepoGeneralPropertyPage_workspaceSettings));
lnWorkspaceSettings.setFont(parent.getFont());
lnWorkspaceSettings.addListener(SWT.Selection, event -> {
PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(getShell(), CREATEREPO_PREFERENCE_ID, new String[] { CREATEREPO_PREFERENCE_ID }, null);
preferenceDialog.open();
});
// general group
generalGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
layout = new GridLayout(2, false);
generalGroup.setLayout(layout);
generalGroup.setText(Messages.CreaterepoPreferencePage_generalGroupLabel);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(generalGroup);
// generate unique metadata filenames
bfeIncludeChecksum = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_UNIQUE_MD_NAME, Messages.CreaterepoPreferencePage_booleanChecksumName, generalGroup);
bfeIncludeChecksum.fillIntoGrid(generalGroup, 2);
bfeIncludeChecksum.setPreferenceStore(preferenceStore);
bfeIncludeChecksum.setPropertyChangeListener(this);
bfeIncludeChecksum.load();
// generate sqlite databases
bfeSQLDB = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_GENERATE_DB, Messages.CreaterepoPreferencePage_booleanGenerateSQLDB, generalGroup);
bfeSQLDB.fillIntoGrid(generalGroup, 2);
bfeSQLDB.setPreferenceStore(preferenceStore);
bfeSQLDB.setPropertyChangeListener(this);
bfeSQLDB.load();
// ignore symlinks for packages
bfeIgnoreSymlinks = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_IGNORE_SYMLINKS, Messages.CreaterepoPreferencePage_booleanIgnoreSymlinks, generalGroup);
bfeIgnoreSymlinks.fillIntoGrid(generalGroup, 2);
bfeIgnoreSymlinks.setPreferenceStore(preferenceStore);
bfeIgnoreSymlinks.setPropertyChangeListener(this);
bfeIgnoreSymlinks.load();
// output files in pretty xml format
bfePrettyXML = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_PRETTY_XML, Messages.CreaterepoPreferencePage_booleanPrettyXML, generalGroup);
bfePrettyXML.fillIntoGrid(generalGroup, 2);
bfePrettyXML.setPreferenceStore(preferenceStore);
bfePrettyXML.setPropertyChangeListener(this);
bfePrettyXML.load();
// number of workers
ifeSpawns = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_WORKERS, Messages.CreaterepoPreferencePage_numWorkers, generalGroup);
ifeSpawns.fillIntoGrid(generalGroup, 2);
// more than 128 is alot. limiting. (createrepo warning)
ifeSpawns.setValidRange(0, 128);
ifeSpawns.setPreferenceStore(preferenceStore);
ifeSpawns.setPropertyChangeListener(this);
ifeSpawns.load();
updateGroupSpacing(generalGroup);
// updates group
updatesGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
updatesGroup.setText(Messages.CreaterepoPreferencePage_updateGroupLabel);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).hint(10, SWT.DEFAULT).applyTo(updatesGroup);
// don't generate repo metadata, if their timestamps are newer than its rpms
bfeSameFilename = new BooleanFieldEditor(CreaterepoPreferenceConstants.PREF_CHECK_TS, Messages.CreaterepoPreferencePage_booleanCheckTS, updatesGroup);
bfeSameFilename.fillIntoGrid(updatesGroup, 2);
bfeSameFilename.setPreferenceStore(preferenceStore);
bfeSameFilename.setPropertyChangeListener(this);
bfeSameFilename.load();
// note of caution
lblCheckTs = new Label(updatesGroup, SWT.WRAP);
lblCheckTs.setText(Messages.CreaterepoPreferencePage_checkTSNote);
layoutData = new GridData();
layoutData.widthHint = 130;
layoutData.horizontalAlignment = SWT.FILL;
layoutData.grabExcessHorizontalSpace = true;
layoutData.horizontalIndent = 5;
lblCheckTs.setLayoutData(layoutData);
updateGroupSpacing(updatesGroup);
// changelog group
changelogGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
changelogGroup.setText(Messages.CreaterepoPreferencePage_changelogGroupLabel);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).hint(10, SWT.DEFAULT).applyTo(changelogGroup);
// don't generate repo metadata, if their timestamps are newer than its rpms
ifeChangelogLimit = new IntegerFieldEditor(CreaterepoPreferenceConstants.PREF_CHANGELOG_LIMIT, Messages.CreaterepoPreferencePage_numChangelogLimit, changelogGroup);
ifeChangelogLimit.fillIntoGrid(changelogGroup, 2);
ifeChangelogLimit.setValidRange(0, Integer.MAX_VALUE);
ifeChangelogLimit.setPreferenceStore(preferenceStore);
ifeChangelogLimit.setPropertyChangeListener(this);
ifeChangelogLimit.load();
updateGroupSpacing(changelogGroup);
checksumsContainer = new Composite(composite, SWT.NONE);
checksumsContainer.setLayout(new GridLayout());
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 20).grab(true, false).applyTo(checksumsContainer);
// available checksums
rgfeChecksums = new RadioGroupFieldEditor(CreaterepoPreferenceConstants.PREF_CHECKSUM, Messages.CreaterepoPreferencePage_checksumGroupLabel, 1, new String[][] { { ICreaterepoChecksums.SHA1, ICreaterepoChecksums.SHA1 }, { ICreaterepoChecksums.MD5, ICreaterepoChecksums.MD5 }, { ICreaterepoChecksums.SHA256, ICreaterepoChecksums.SHA256 }, { ICreaterepoChecksums.SHA512, ICreaterepoChecksums.SHA512 } }, checksumsContainer, true);
rgfeChecksums.setPreferenceStore(preferenceStore);
rgfeChecksums.setPropertyChangeListener(this);
rgfeChecksums.load();
compressContainer = new Composite(composite, SWT.NONE);
compressContainer.setLayout(new GridLayout());
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(0, 20).grab(true, false).applyTo(compressContainer);
// available compression types
rgfeCompressionTypes = new RadioGroupFieldEditor(CreaterepoPreferenceConstants.PREF_COMPRESSION_TYPE, Messages.CreaterepoPreferencePage_compressionGroupLabel, 1, new String[][] { { ICreaterepoCompressionTypes.COMPAT, ICreaterepoCompressionTypes.COMPAT }, { ICreaterepoCompressionTypes.XZ, ICreaterepoCompressionTypes.XZ }, { ICreaterepoCompressionTypes.GZ, ICreaterepoCompressionTypes.GZ }, { ICreaterepoCompressionTypes.BZ2, ICreaterepoCompressionTypes.BZ2 } }, compressContainer, true);
rgfeCompressionTypes.setPreferenceStore(preferenceStore);
rgfeCompressionTypes.setPropertyChangeListener(this);
rgfeCompressionTypes.load();
toggleEnabled();
return composite;
}
Aggregations