List of usage examples for org.eclipse.jface.preference StringFieldEditor StringFieldEditor
public StringFieldEditor(String name, String labelText, Composite parent)
From source file:ch.berchtold.emanuel.privatrechnung.views.Preferences.java
License:Open Source License
@Override protected void createFieldEditors() { lMandanten = Hub.getMandantenList(); String[] fields = new String[lMandanten.size()]; for (int i = 0; i < fields.length; i++) { fields[i] = lMandanten.get(i).getLabel(); }/* w w w . j a va 2s .c o m*/ cfe = new ComboFieldEditor(PreferenceConstants.cfgBase, "Mandant", fields, getFieldEditorParent()); sfESR = new StringFieldEditor(PreferenceConstants.cfgTemplateESR, "Vorlage mit ESR", getFieldEditorParent()); sf1st = new StringFieldEditor(PreferenceConstants.cfgTemplateBill, "Erste Folgeseite", getFieldEditorParent()); ifh1 = new IntegerFieldEditor(PreferenceConstants.cfgTemplateBillHeight, "Verfgbare Hhe erste Seite (cm)", getFieldEditorParent()); sf2nd = new StringFieldEditor(PreferenceConstants.cfgTemplateBill2, "Vorlage weitere Seiten", getFieldEditorParent()); if2nd = new IntegerFieldEditor(PreferenceConstants.cfgTemplateBill2Height, "Verfgbare Hhe Folgeseiten (cm)", getFieldEditorParent()); kfBank = new KontaktFieldEditor(CoreHub.localCfg, PreferenceConstants.cfgBank, "Bank", getFieldEditorParent()); sfESRNr = new StringFieldEditor(PreferenceConstants.esrIdentity, "ESR-Teilnehmernummer", getFieldEditorParent()); sfESRKd = new StringFieldEditor(PreferenceConstants.esrUser, "ESR-Kundennummer", getFieldEditorParent()); addField(cfe); addField(sfESR); addField(sf1st); addField(ifh1); addField(sf2nd); addField(if2nd); addField(kfBank); addField(sfESRNr); addField(sfESRKd); cfe.getCombo().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (selected != null) { flush(selected); } String mandLabel = cfe.getCombo().getText(); Mandant m = getMandant(mandLabel); if (m != null) { selected = m; load(selected); } } }); selected = null; // lMandanten.get(0); // cfe.getCombo().setText(selected.getLabel()); }
From source file:ch.docbox.elexis.UserDocboxPreferences.java
License:Open Source License
@Override protected void createFieldEditors() { oldSha1Password = getSha1DocboxPassword(); oldLoginId = getDocboxLoginID(true); oldAppointmentsEmergencyService = isAppointmentsEmergencyService(); oldAppointmentsPharmaVisits = isAppointmentsPharmaVisits(); oldAppointmentsTerminvereinbarung = isAppointmentsTerminvereinbarung(); oldAppointmentsBereich = getAppointmentsBereich(); oldUseHCard = useHCard();// w w w.j av a2 s .co m oldUseProxy = useProxy(); oldProxyHost = getProxyHost(); oldProxyPort = getProxyPort(); oldSecretKey = getSha1DocboxSecretKey(); boolean enableForMandant = CoreHub.acl.request(AccessControlDefaults.ACL_USERS); loginIdFieldEditor = new StringFieldEditor(WsClientConfig.USR_DEFDOCBXLOGINID, Messages.UserDocboxPreferences_LoginId, getFieldEditorParent()); addField(loginIdFieldEditor); loginIdFieldEditor.setEnabled(enableForMandant, getFieldEditorParent()); passwordFieldEditor = new StringFieldEditor(WsClientConfig.USR_DEFDOCBOXPASSWORD, Messages.UserDocboxPreferences_Password, getFieldEditorParent()); passwordFieldEditor.getTextControl(getFieldEditorParent()).setEchoChar('*'); //$NON-NLS-1$ passwordFieldEditor.setEnabled(enableForMandant, getFieldEditorParent()); addField(passwordFieldEditor); if (showSha1SecretKey) { secretkeyFieldEditor = new StringFieldEditor(WsClientConfig.USR_SECRETKEY, Messages.UserDocboxPreferences_SecretKey, getFieldEditorParent()); secretkeyFieldEditor.getTextControl(getFieldEditorParent()).setEchoChar('*'); //$NON-NLS-1$ secretkeyFieldEditor.setEnabled(enableForMandant, getFieldEditorParent()); addField(secretkeyFieldEditor); } buttonConfigureCert = new Button(getFieldEditorParent(), SWT.PUSH); buttonConfigureCert.setText("Zertifikat konfigurieren"); buttonConfigureCert.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); buttonConfigureCert.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { CertificateConfigDialog dlg = new CertificateConfigDialog(getShell()); dlg.open(); } }); if (WsClientUtil.isMedelexisCertAvailable()) { buttonConfigureCert.setEnabled(false); } buttonUseHCard = new Button(getFieldEditorParent(), SWT.CHECK); buttonUseHCard.setText(Messages.UserDocboxPreferences_UseHCard); buttonUseHCard.setSelection(useHCard()); buttonUseHCard.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); buttonUseHCard.setEnabled(enableForMandant); directoryhCardEditor = new DirectoryFieldEditor(USR_DEFDOCBOXPATHHCARDAPI, Messages.UserDocboxPreferences_PathHCardAPI, getFieldEditorParent()); directoryhCardEditor.setEnabled(enableForMandant, getFieldEditorParent()); addField(directoryhCardEditor); buttonUseProxy = new Button(getFieldEditorParent(), SWT.CHECK); buttonUseProxy.setText(Messages.UserDocboxPreferences_UseProxy); buttonUseProxy.setSelection(useProxy()); buttonUseProxy.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); buttonUseProxy.setEnabled(enableForMandant); proxyHostFieldEditor = new StringFieldEditor(USR_PROXYHOST, Messages.UserDocboxPreferences_UseProxyHost, getFieldEditorParent()); addField(proxyHostFieldEditor); proxyHostFieldEditor.setEnabled(enableForMandant, getFieldEditorParent()); proxyPortFieldEditor = new StringFieldEditor(USR_PROXYPORT, Messages.UserDocboxPreferences_UseProxyPort, getFieldEditorParent()); addField(proxyPortFieldEditor); proxyPortFieldEditor.setEnabled(enableForMandant, getFieldEditorParent()); new Label(getFieldEditorParent(), SWT.SEPARATOR | SWT.HORIZONTAL) .setLayoutData(SWTHelper.getFillGridData(3, true, 1, false)); Button docboxConnectionTestButton = new Button(getFieldEditorParent(), SWT.PUSH); docboxConnectionTestButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { String sha1Password = (passwordFieldEditor.getStringValue().equals(oldSha1Password) ? oldSha1Password : CDACHServicesClient.getSHA1(passwordFieldEditor.getStringValue())); CoreHub.mandantCfg.set(WsClientConfig.USR_DEFDOCBXLOGINID, loginIdFieldEditor.getStringValue()); CoreHub.mandantCfg.set(WsClientConfig.USR_DEFDOCBOXPASSWORD, sha1Password); if (showSha1SecretKey && secretkeyFieldEditor != null) { CoreHub.mandantCfg.set(WsClientConfig.USR_SECRETKEY, secretkeyFieldEditor.getStringValue()); } setUseHCard(buttonUseHCard.getSelection()); setUseProxy(buttonUseProxy.getSelection()); setProxyHost(proxyHostFieldEditor.getStringValue()); setProxyPort(proxyPortFieldEditor.getStringValue()); if (getSha1DocboxSecretKey() == null || "".equals(getSha1DocboxSecretKey())) { MessageBox box = new MessageBox(UiDesk.getDisplay().getActiveShell(), SWT.ICON_ERROR); box.setText(Messages.UserDocboxPreferences_NoSecretKeyTitle); box.setMessage(Messages.UserDocboxPreferences_NoSecretKey); box.open(); } else { javax.xml.ws.Holder<java.lang.String> message = new javax.xml.ws.Holder<java.lang.String>(); boolean isOk = performConnectionTest(message); MessageBox box = new MessageBox(UiDesk.getDisplay().getActiveShell(), (isOk ? SWT.ICON_WORKING : SWT.ICON_ERROR)); box.setText(Messages.UserDocboxPreferences_ConnectionTestWithDocbox); box.setMessage(message.value); box.open(); } } }); docboxConnectionTestButton.setText(Messages.UserDocboxPreferences_ConnectionTest); docboxConnectionTestButton.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); new Label(getFieldEditorParent(), SWT.SEPARATOR | SWT.HORIZONTAL) .setLayoutData(SWTHelper.getFillGridData(3, true, 1, false)); directoryFieldEditor = new DirectoryFieldEditor(USR_DEFDOCBOXPATHFILES, Messages.UserDocboxPreferences_PathFiles, getFieldEditorParent()); addField(directoryFieldEditor); directoryFieldEditor.setEnabled(enableForMandant, getFieldEditorParent()); new Label(getFieldEditorParent(), SWT.SEPARATOR | SWT.HORIZONTAL) .setLayoutData(SWTHelper.getFillGridData(3, true, 1, false)); if (hasAgendaPlugin() && enableForMandant) { buttonAgendaSettingsPerUser = new Button(getFieldEditorParent(), SWT.CHECK); buttonAgendaSettingsPerUser.setText(Messages.UserDocboxPreferences_AgendaSettingsPerUser); buttonAgendaSettingsPerUser.setSelection(getAgendaSettingsPerUser()); buttonAgendaSettingsPerUser.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); } if (hasAgendaPlugin()) { boolean enabled = getAgendaSettingsPerUser() || enableForMandant; Label textLabel = new Label(getFieldEditorParent(), SWT.NONE); textLabel.setText(Messages.UserDocboxPreferences_AgendaBerich); textLabel.setLayoutData(SWTHelper.getFillGridData(1, false, 1, false)); agendaBereichCombo = new Combo(getFieldEditorParent(), SWT.READ_ONLY | SWT.SINGLE); agendaBereichCombo.setItems(bereiche); agendaBereichCombo.select(getAgendaIndex()); agendaBereichCombo.setEnabled(enabled); textLabel.setLayoutData(SWTHelper.getFillGridData(2, false, 1, false)); buttonGetAppointmentsEmergencyService = new Button(getFieldEditorParent(), SWT.CHECK); buttonGetAppointmentsEmergencyService .setText(Messages.UserDocboxPreferences_GetAppointmentsEmergencyService); buttonGetAppointmentsEmergencyService.setSelection(isAppointmentsEmergencyService()); buttonGetAppointmentsEmergencyService.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); buttonGetAppointmentsEmergencyService.setEnabled(enabled); buttonGetAppointmentsPharmaVisits = new Button(getFieldEditorParent(), SWT.CHECK); buttonGetAppointmentsPharmaVisits.setText(Messages.UserDocboxPreferences_GetAppointmentsPharmaVisits); buttonGetAppointmentsPharmaVisits.setSelection(isAppointmentsPharmaVisits()); buttonGetAppointmentsPharmaVisits.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); buttonGetAppointmentsPharmaVisits.setEnabled(enabled); buttonGetAppointmentsTerminvereinbarung = new Button(getFieldEditorParent(), SWT.CHECK); buttonGetAppointmentsTerminvereinbarung .setText(Messages.UserDocboxPreferences_GetAppointmentsTerminvereinbarungen); buttonGetAppointmentsTerminvereinbarung.setSelection(isAppointmentsTerminvereinbarung()); buttonGetAppointmentsTerminvereinbarung.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); buttonGetAppointmentsTerminvereinbarung.setEnabled(enabled); } if (enableForMandant) { new Label(getFieldEditorParent(), SWT.SEPARATOR | SWT.HORIZONTAL) .setLayoutData(SWTHelper.getFillGridData(3, true, 1, false)); buttonClearDocboxInbox = new Button(getFieldEditorParent(), SWT.PUSH); buttonClearDocboxInbox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent selectionEvent) { MessageBox box = new MessageBox(UiDesk.getDisplay().getActiveShell(), SWT.ICON_WARNING | SWT.YES | SWT.NO); box.setText(Messages.UserDocboxPreferences_ClearDocboxInbox); box.setMessage(Messages.UserDocboxPreferences_ClearDocboxInboxConfirm); if (box.open() == SWT.YES) { CdaMessage.deleteCdaMessages(CoreHub.actMandant); } } }); buttonClearDocboxInbox.setText(Messages.UserDocboxPreferences_ClearDocboxInbox); buttonClearDocboxInbox.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); } Button btnConvertDocboxIds = new Button(getFieldEditorParent(), SWT.PUSH); btnConvertDocboxIds.setText(Messages.UserDocboxPreferences_ConvertDocboxIds); btnConvertDocboxIds.setToolTipText(Messages.UserDocboxPreferences_ConvertDocboxIds_Tooltip); btnConvertDocboxIds.setLayoutData(SWTHelper.getFillGridData(3, false, 1, false)); btnConvertDocboxIds.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { IProgressService progService = PlatformUI.getWorkbench().getProgressService(); try { progService.runInUI(progService, new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { DocboxContact.importDocboxIdsFromKontaktExtinfo(monitor); } }, null); } catch (Exception e) { e.printStackTrace(); } } }); }
From source file:ch.elexis.core.ui.preferences.TextTemplatePreferences.java
License:Open Source License
@Override protected void createFieldEditors() { Label expl = new Label(getFieldEditorParent(), SWT.WRAP); expl.setText(Messages.TextTemplatePreferences_ExplanationLine1 + Messages.TextTemplatePreferences_ExplanationLine2 + Messages.TextTemplatePreferences_ExplanationLine3); expl.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false)); addField(new StringFieldEditor(SUFFIX_STATION, SUFFIX_FOR_THIS_STATION, getFieldEditorParent())); /*/* ww w .j a v a 2s. c om*/ * IExtensionRegistry exr = Platform.getExtensionRegistry(); IExtensionPoint exp = * exr.getExtensionPoint("ch.elexis.documentTemplates"); if (exp != null) { IExtension[] * extensions = exp.getExtensions(); for (IExtension ex : extensions) { * IConfigurationElement[] elems = ex.getConfigurationElements(); for (IConfigurationElement * el : elems) { String n=el.getAttribute("name"); addField(new StringFieldEditor(BRANCH+n, * n, getFieldEditorParent())); } } * * } */ }
From source file:ch.elexis.core.ui.preferences.UserCasePreferences.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor(Preferences.USR_DEFCASELABEL, Messages.UserCasePreferences_DefaultName, getFieldEditorParent()));/*from w w w. j av a 2 s . c o m*/ addField(new StringFieldEditor(Preferences.USR_DEFCASEREASON, Messages.UserCasePreferences_DefaultReason, getFieldEditorParent())); addField(new StringFieldEditor(Preferences.USR_DEFLAW, Messages.UserCasePreferences_DefaultBillingSystem, getFieldEditorParent())); }
From source file:ch.elexis.core.ui.preferences.UserTextPref.java
License:Open Source License
@Override protected void createFieldEditors() { for (int i = 0; i < fields.length; i++) { addField(new StringFieldEditor(fields[i], texte[i], getFieldEditorParent())); }/*from ww w. j a v a 2 s . c o m*/ Set<String> makroNames = makros.keySet(); for (String name : makroNames) { addField(new BooleanFieldEditor(EnhancedTextField.MACRO_ENABLED + "/" + makros.get(name), name, getFieldEditorParent())); } }
From source file:ch.elexis.extdoc.preferences.ExterneDokumente.java
License:Open Source License
@Override protected void createFieldEditors() { DirectoryFieldEditor dfe;//from w w w . j ava2 s . c o m StringFieldEditor sfe; FileFieldEditor ffe; PreferenceConstants.PathElement[] prefElems = PreferenceConstants.getPrefenceElements(); for (int j = 0; j < prefElems.length; j++) { sfe = new StringFieldEditor(prefElems[j].prefName, String.format(Messages.ExterneDokumente_shorthand_for_path, j), getFieldEditorParent()); sfe.setTextLimit(8); addField(sfe); dfe = new DirectoryFieldEditor(prefElems[j].prefBaseDir, Messages.ExterneDokumente_path_name_preference, getFieldEditorParent()); addField(dfe); } sfe = new StringFieldEditor(PreferenceConstants.CONCERNS, Messages.ExterneDokumente_Concerns, getFieldEditorParent()); sfe.setTextLimit(60); addField(sfe); Composite composite = getFieldEditorParent(); ffe = new FileFieldEditor(PreferenceConstants.EMAIL_PROGRAM, Messages.ExterneDokumente_email_app, getFieldEditorParent()); ffe.getLabelControl(composite).setToolTipText( "Programm das zum Verschicken von E-Mails verwendet werden soll, falls leer wird dir URL mailto: verwendet, welche keine Anhnge untersttzt"); addField(ffe); }
From source file:ch.elexis.icpc.fire.ui.Preferences.java
License:Open Source License
@Override protected void createFieldEditors() { Label expl = new Label(getFieldEditorParent(), SWT.WRAP); expl.setText(/*from w w w . j a va 2s.c o m*/ "Geben Sie bitte fr jedes der folgenden Felder\nan, wie der entsprechende Befund definiert ist.\nVerwenden Sie dafr die Notation Name:Feld"); expl.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false)); addField(new StringFieldEditor(CFG_BD_SYST, EXPL_BD_SYST, getFieldEditorParent())); addField(new StringFieldEditor(CFG_BD_DIAST, EXPL_BD_DIAST, getFieldEditorParent())); addField(new StringFieldEditor(CFG_PULS, EXPL_PULS, getFieldEditorParent())); addField(new StringFieldEditor(CFG_HEIGHT, EXPL_HEIGHT, getFieldEditorParent())); addField(new StringFieldEditor(CFG_WEIGHT, EXPL_WEIGHT, getFieldEditorParent())); addField(new StringFieldEditor(CFG_BU, EXPL_BU, getFieldEditorParent())); }
From source file:ch.elexis.laborimport.analytica.PreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { addField(new StringFieldEditor(FTP_HOST, Messages.getString("PreferencePage.label.host"), //$NON-NLS-1$ getFieldEditorParent()));/*ww w .j a v a2s .c om*/ addField(new StringFieldEditor(FTP_USER, Messages.getString("PreferencePage.label.user"), //$NON-NLS-1$ getFieldEditorParent())); addField(new StringFieldEditor(FTP_PWD, Messages.getString("PreferencePage.label.password"), //$NON-NLS-1$ getFieldEditorParent())); addField(new InexistingDirectoryOKDirectoryFieldEditor(DL_DIR, Messages.getString("PreferencePage.label.download"), getFieldEditorParent())); //$NON-NLS-1$ addField(new InexistingFileOKFileFieldEditor(OVPN_DIR, Messages.getString("PreferencePage.label.ovpn"), //$NON-NLS-1$ getFieldEditorParent())); }
From source file:ch.elexis.laborimport.teamw.PreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { final Composite parentComp = getFieldEditorParent(); final RadioGroupFieldEditor groupFieldEditor = new RadioGroupFieldEditor(BATCH_OR_FTP, Messages.getString("PreferencePage.direktimport.label"), 2, new String[][] { //$NON-NLS-1$ { Messages.getString("PreferencePage.batchscript.label"), BATCH }, //$NON-NLS-1$ { Messages.getString("PreferencePage.ftpserver.label"), FTP } }, //$NON-NLS-1$ parentComp, true);// w ww . j av a 2s .c o m final FileFieldEditor batchFileEditor = new FileFieldEditor(BATCH_DATEI, Messages.getString("PreferencePage.batchdatei.label"), //$NON-NLS-1$ parentComp); addField(groupFieldEditor); addField(batchFileEditor); addField(new StringFieldEditor(FTP_HOST, Messages.getString("PreferencePage.label.host"), //$NON-NLS-1$ getFieldEditorParent())); addField(new StringFieldEditor(FTP_USER, Messages.getString("PreferencePage.label.user"), //$NON-NLS-1$ getFieldEditorParent())); addField(new StringFieldEditor(FTP_PWD, Messages.getString("PreferencePage.label.password"), //$NON-NLS-1$ getFieldEditorParent())); addField(new InexistingDirectoryOKDirectoryFieldEditor(DL_DIR, Messages.getString("PreferencePage.label.download"), getFieldEditorParent())); //$NON-NLS-1$ }
From source file:ch.elexis.omnivore.ui.preferences.PreferencePage.java
License:Open Source License
@Override protected void createFieldEditors() { // I'd like to place ALL groups in this preference dialog one under another, // so that each group completely occupies the available horizontal space. // But the default behaviour is to put the groups next to each other :-( // For instructions, see: // http://www.eclipse.org/articles/article.php?file=Article-Understanding-Layouts/index.html // I can't use any other layout but GridLayout. // Otherwise some adjustGridLayout() somewhere else will invariably throw: // "The currently displayed page contains invalid values." at runtime. 201304110439js // Besides, RowLayout() wouldn't make sense here. // ---//from w ww.j a v a 2 s .c om // Nachdem ich aussenrum einmal eine globale Gruppe installiere, // bekomme ich wenigstens die nachfolgend tieferen Gruppen untereinander in einer Spalte, // und nicht mehr nebeneinander. // Offenbar hat die Zuweisung eines Layouts zu getFieldEditorParent() keinen Effekt gehabt. // Warum auch immer... Group gAllOmnivorePrefs = new Group(getFieldEditorParent(), SWT.NONE); // getFieldEditorParent().setLayoutData(SWTHelper.getFillGridData(1,false,0,false)); GridLayout gOmnivorePrefsGridLayout = new GridLayout(); gOmnivorePrefsGridLayout.numColumns = 1; // this is sadly and apparently ignored. gOmnivorePrefsGridLayout.makeColumnsEqualWidth = true; gAllOmnivorePrefs.setLayout(gOmnivorePrefsGridLayout); // getFieldEditorParent().setLayout(gOmnivorePrefsGridLayout); GridData gOmnivorePrefsGridLayoutData = new GridData(); gOmnivorePrefsGridLayoutData.grabExcessHorizontalSpace = true; gOmnivorePrefsGridLayoutData.horizontalAlignment = GridData.FILL; gAllOmnivorePrefs.setLayoutData(gOmnivorePrefsGridLayoutData); Group gGeneralOptions = new Group(gAllOmnivorePrefs, SWT.NONE); GridData gGeneralOptionsGridLayoutData = new GridData(); gGeneralOptionsGridLayoutData.grabExcessHorizontalSpace = true; gGeneralOptionsGridLayoutData.horizontalAlignment = GridData.FILL; gGeneralOptions.setLayoutData(gGeneralOptionsGridLayoutData); addField(new BooleanFieldEditor(DATE_MODIFIABLE, Messages.Preferences_dateModifiable, gGeneralOptions)); Group gPathForDocs = new Group(gGeneralOptions, SWT.NONE); gPathForDocs.setLayout(new FillLayout()); bStoreFSGlobal = new BooleanFieldEditor(STOREFSGLOBAL, "Dateisystem Einstellungen global speichern", gPathForDocs) { @Override protected void fireValueChanged(String property, Object oldValue, Object newValue) { super.fireValueChanged(property, oldValue, newValue); if ((Boolean) newValue) { Preferences.setFsSettingStore(new SettingsPreferenceStore(CoreHub.globalCfg)); updateFSSettingsStore(); } else { Preferences.setFsSettingStore(new SettingsPreferenceStore(CoreHub.localCfg)); updateFSSettingsStore(); } } }; addField(bStoreFSGlobal); bStoreFS = new BooleanFieldEditor(STOREFS, Messages.Preferences_storeInFS, gPathForDocs); addField(bStoreFS); Preferences.storeInFilesystem(); dfStorePath = new DirectoryFieldEditor(BASEPATH, Messages.Preferences_pathForDocs, gPathForDocs); Preferences.getBasepath(); dfStorePath.setEmptyStringAllowed(true); addField(dfStorePath); Label label = new Label(gAllOmnivorePrefs, SWT.NONE); label.setText("Datenbankeintrge auf Filesystem auslagern"); outsource = new Button(gAllOmnivorePrefs, SWT.PUSH); outsource.setText("Auslagern"); outsource.setEnabled(false); outsource.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { OutsourceUiJob job = new OutsourceUiJob(); job.execute(getShell()); } }); Group gPathForMaxChars = new Group(gGeneralOptions, SWT.NONE); gPathForMaxChars.setLayout(new FillLayout()); IPreferenceStore preferenceStore = new SettingsPreferenceStore(CoreHub.localCfg); preferenceStore.setDefault(PREF_MAX_FILENAME_LENGTH, OmnivoreMax_Filename_Length_Default); IntegerFieldEditor maxCharsEditor = new IntegerFieldEditor(PREF_MAX_FILENAME_LENGTH, Messages.Preferences_MAX_FILENAME_LENGTH, gPathForMaxChars); maxCharsEditor.setValidRange(OmnivoreMax_Filename_Length_Min, OmnivoreMax_Filename_Length_Max); addField(maxCharsEditor); // --- // For automatic archiving of incoming files: // add field groups for display or editing of rule sets. // First, we define a new group (that will visually appear as an outlined box) and give it a // header like setText("Regel i"); // Then, within this group, we add one StringFieldEditor for the search pattern to be // matched, and a DirectoryFieldEditor for the auto archiving target to be used. Integer nAutoArchiveRules = Preferences.getOmnivorenRulesForAutoArchiving(); Group gAutoArchiveRules = new Group(gAllOmnivorePrefs, SWT.NONE); // Group gAutoArchiveRules = new Group(getFieldEditorParent(), SWT.NONE); // gAutoArchiveRules.setLayoutData(SWTHelper.getFillGridData(1,true,nAutoArchiveRules,false)); GridLayout gAutoArchiveRulesGridLayout = new GridLayout(); gAutoArchiveRulesGridLayout.numColumns = 1; // bestimmt die Anzahl der Spalten, in denen die // Regeln innerhab des AutoArchiveRules containers angeordnet werden. gAutoArchiveRules.setLayout(gAutoArchiveRulesGridLayout); GridData gAutoArchiveRulesGridLayoutData = new GridData(); gAutoArchiveRulesGridLayoutData.grabExcessHorizontalSpace = true; gAutoArchiveRulesGridLayoutData.horizontalAlignment = GridData.FILL; gAutoArchiveRules.setLayoutData(gAutoArchiveRulesGridLayoutData); gAutoArchiveRules.setText(Messages.Preferences_automatic_archiving_of_processed_files); for (int i = 0; i < nAutoArchiveRules; i++) { // Just to check whether the loop is actually used, even if nothing appears in the // preference dialog: log.debug(PREF_SRC_PATTERN[i] + " : " + Messages.Preferences_SRC_PATTERN); log.debug(PREF_DEST_DIR[i] + " : " + Messages.Preferences_DEST_DIR); Group gAutoArchiveRule = new Group(gAutoArchiveRules, SWT.NONE); GridLayout gAutoArchiveRuleGridLayout = new GridLayout(); gAutoArchiveRuleGridLayout.numColumns = 1; // bestimmt die Anzahl der Spalten fr jede // Regel: links label, rechts eingabefeld (ggf. mit Knopf), but: 1, 2, 3: no change. gAutoArchiveRule.setLayout(gAutoArchiveRuleGridLayout); GridData gAutoArchiveRuleGridLayoutData = new GridData(); gAutoArchiveRuleGridLayoutData.grabExcessHorizontalSpace = true; // damit die Gruppe der // Rules so breit ist, wie oben Label und Max_Filename_Length Eingabefeld zusammen. gAutoArchiveRuleGridLayoutData.horizontalAlignment = GridData.FILL; gAutoArchiveRule.setLayoutData(gAutoArchiveRuleGridLayoutData); // Cave: The labels show 1-based rule numbers, although the actual array indizes are 0 // based. gAutoArchiveRule.setText(Messages.Preferences_Rule + " " + (i + 1)); // The brackets are // needed, or the string representations of i and 1 will both be added... addField( new StringFieldEditor(PREF_SRC_PATTERN[i], Messages.Preferences_SRC_PATTERN, gAutoArchiveRule)); addField(new DirectoryFieldEditor(PREF_DEST_DIR[i], Messages.Preferences_DEST_DIR, gAutoArchiveRule)); } // --- // Make the temporary filename configurable // which is generated to extract the document from the database for viewing. // Thereby, simplify tasks like adding a document to an e-mail. // For most elements noted below, we can set the maximum number of digits // to be used (taken from the source from left); which character to add thereafter; // and whether to fill leading digits by a given character. // This makes a large number of options, so I construct the required preference store keys // from arrays. // Originally, I would have preferred a simple tabular matrix: // columns: element name, fill_lead_char, num_digits, add_trail_char // lines: each of the configurable elements of the prospective temporary filename. // But such a simple thing is apparently not so simple to make using the PreferencePage // class. // So instead, I add a new group for each configurable element, including each of the 3 // parameters. Integer nCotfRules = PREFERENCE_cotf_elements.length; Group gCotfRules = new Group(gAllOmnivorePrefs, SWT.NONE); // Group gCotfRules = new Group(getFieldEditorParent(), SWT.NONE); // gCotfRules.setLayoutData(SWTHelper.getFillGridData(6,false,nCotfRules,false)); //This // would probably make groups-within-group completely disappear. GridLayout gCotfRulesGridLayout = new GridLayout(); gCotfRulesGridLayout.numColumns = nCotfRules; // at least this one is finally honoured... gCotfRules.setLayout(gCotfRulesGridLayout); GridData gCotfRulesGridLayoutData = new GridData(); gCotfRulesGridLayoutData.grabExcessHorizontalSpace = true; gCotfRulesGridLayoutData.horizontalAlignment = GridData.FILL; gCotfRules.setLayoutData(gCotfRulesGridLayoutData); gCotfRules.setText(Messages.Preferences_construction_of_temporary_filename); for (int i = 0; i < nCotfRules; i++) { Group gCotfRule = new Group(gCotfRules, SWT.NONE); gCotfRule.setLayout(new FillLayout()); GridLayout gCotfRuleGridLayout = new GridLayout(); gCotfRuleGridLayout.numColumns = 6; gCotfRule.setLayout(gCotfRuleGridLayout); GridData gCotfRuleGridLayoutData = new GridData(); gCotfRuleGridLayoutData.grabExcessHorizontalSpace = true; gCotfRuleGridLayoutData.horizontalAlignment = GridData.FILL; gCotfRule.setLayoutData(gCotfRuleGridLayoutData); gCotfRule.setText(PREFERENCE_cotf_elements_messages[i]); if (PREFERENCE_cotf_elements[i].contains("constant")) { addField(new StringFieldEditor("", "", 10, gCotfRule)); addField(new StringFieldEditor( PREFBASE + PREFERENCE_COTF + PREFERENCE_cotf_elements[i] + "_" + PREFERENCE_cotf_parameters[1], PREFERENCE_cotf_elements_messages[i], 10, gCotfRule)); addField(new StringFieldEditor("", "", 10, gCotfRule)); } else { addField(new StringFieldEditor( PREFBASE + PREFERENCE_COTF + PREFERENCE_cotf_elements[i] + "_" + PREFERENCE_cotf_parameters[0], PREFERENCE_cotf_parameters_messages[0], 10, gCotfRule)); addField(new StringFieldEditor( PREFBASE + PREFERENCE_COTF + PREFERENCE_cotf_elements[i] + "_" + PREFERENCE_cotf_parameters[1], PREFERENCE_cotf_parameters_messages[1], 10, gCotfRule)); addField(new StringFieldEditor( PREFBASE + PREFERENCE_COTF + PREFERENCE_cotf_elements[i] + "_" + PREFERENCE_cotf_parameters[2], PREFERENCE_cotf_parameters_messages[2], 10, gCotfRule)); } } enableOutsourceButton(); }