use of org.eclipse.jface.preference.DirectoryFieldEditor in project tdi-studio-se by Talend.
the class ComponentsPreferencePage method createFieldEditors.
@Override
public void createFieldEditors() {
final Composite parent = getFieldEditorParent();
filePathTemp = new DirectoryFieldEditor(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER, //$NON-NLS-1$
Messages.getString("ComponentsPreferencePage.directoryFieldLabel"), parent);
addField(filePathTemp);
filePathTemp.getTextControl(parent).addModifyListener(new ModifyListener() {
String oldPath = getPreferenceStore().getString(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER);
@Override
public void modifyText(ModifyEvent e) {
String newPath = filePathTemp.getTextControl(parent).getText();
File file = new File(newPath);
if (!file.exists() && !"".equals(newPath)) {
//$NON-NLS-1$
// getPreferenceStore().setValue(IComponentPreferenceConstant.USER_COMPONENTS_FOLDER, "");
filePathTemp.showErrorMessage();
setValid(false);
} else {
if (oldPath.equals(newPath)) {
setValid(true);
return;
}
if (!StringUtils.isEmpty(newPath)) {
if (!checkUserComponentsFolder(file)) {
filePathTemp.getTextControl(parent).setText(oldPath);
}
}
setValid(true);
}
}
});
if (PluginChecker.isPreviewPluginLoaded()) {
createForDataViewer(parent);
}
createForMapper(parent);
createFortRunJob(parent);
if (PluginChecker.isJobLetPluginLoaded()) {
createForJoblet(parent);
}
createForComponentAssist(parent);
parent.pack();
}
use of org.eclipse.jface.preference.DirectoryFieldEditor 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.DirectoryFieldEditor in project jop by jop-devel.
the class JOPPropertyPage method createFieldEditors.
/* (non-Javadoc)
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
@Override
protected void createFieldEditors() {
jopDirectoryEditor = new DirectoryFieldEditor(IJOPLaunchConfigurationConstants.ATTR_JOP_HOME, "JOP Directory", getFieldEditorParent());
jopDirectoryEditor.setEmptyStringAllowed(false);
jopDirectoryEditor.setErrorMessage("Not a valid JOP directory");
addField(jopDirectoryEditor);
quartusProjectFileEditor = new FileFieldEditor(IJOPLaunchConfigurationConstants.ATTR_QUARTUS_PROJECT, "Quartus project file", getFieldEditorParent());
quartusProjectFileEditor.setEmptyStringAllowed(false);
quartusProjectFileEditor.setFileExtensions(new String[] { "*.qpf" });
quartusProjectFileEditor.setErrorMessage("Not a valid Quartus project file");
addField(quartusProjectFileEditor);
System.err.printf("Created field editors%n");
}
use of org.eclipse.jface.preference.DirectoryFieldEditor in project tdi-studio-se by Talend.
the class ComponentProjectPreferencePage method createFieldEditors.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
public void createFieldEditors() {
Label l = new Label(getFieldEditorParent(), SWT.NONE);
//$NON-NLS-1$
l.setText(Messages.getString("ComponentProjectPreferencePage.ChooseProject"));
GridData gd = new GridData();
gd.horizontalSpan = 3;
l.setLayoutData(gd);
filePathTemp = new DirectoryFieldEditor(PluginConstant.PROJECT_URL, //$NON-NLS-1$
Messages.getString("ComponentProjectPreferencePage.ComponentProject"), getFieldEditorParent());
addField(filePathTemp);
// addModifyListener for the filePath text
filePathTemp.getTextControl(getFieldEditorParent()).addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String newPath = filePathTemp.getTextControl(getFieldEditorParent()).getText();
File file = new File(newPath);
if (!file.exists() && !"".equals(newPath)) {
filePathTemp.showErrorMessage();
setValid(false);
} else {
setValid(true);
}
}
});
}
Aggregations