1 20 21 package org.apache.directory.ldapstudio.browser.ui.dialogs.preferences; 22 23 24 import org.apache.directory.ldapstudio.browser.common.widgets.BaseWidgetUtils; 25 import org.apache.directory.ldapstudio.browser.common.widgets.WidgetModifyEvent; 26 import org.apache.directory.ldapstudio.browser.common.widgets.WidgetModifyListener; 27 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants; 28 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin; 29 import org.eclipse.jface.preference.PreferencePage; 30 import org.eclipse.swt.widgets.Button; 31 import org.eclipse.swt.widgets.Composite; 32 import org.eclipse.swt.widgets.Control; 33 import org.eclipse.ui.IWorkbench; 34 import org.eclipse.ui.IWorkbenchPreferencePage; 35 36 37 public class SearchResultEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, 38 WidgetModifyListener 39 { 40 41 private Button showDnButton; 42 43 private Button showLinksButton; 44 45 46 public SearchResultEditorPreferencePage() 47 { 48 super(); 49 super.setPreferenceStore( BrowserUIPlugin.getDefault().getPreferenceStore() ); 50 super.setDescription( "General settings for the LDAP search result editor:" ); 51 } 52 53 54 public void init( IWorkbench workbench ) 55 { 56 } 57 58 59 protected Control createContents( Composite parent ) 60 { 61 62 Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 ); 63 64 BaseWidgetUtils.createSpacer( composite, 1 ); 65 BaseWidgetUtils.createSpacer( composite, 1 ); 66 showDnButton = BaseWidgetUtils.createCheckbox( composite, "Show DN as first column", 1 ); 67 showDnButton.setSelection( getPreferenceStore().getBoolean( 68 BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN ) ); 69 showLinksButton = BaseWidgetUtils.createCheckbox( composite, "Show DN a link", 1 ); 70 showLinksButton.setSelection( getPreferenceStore().getBoolean( 71 BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_LINKS ) ); 72 73 updateEnabled(); 74 validate(); 75 76 applyDialogFont( composite ); 77 return composite; 78 } 79 80 81 private void updateEnabled() 82 { 83 84 } 85 86 87 public boolean performOk() 88 { 89 90 getPreferenceStore().setValue( BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN, 91 this.showDnButton.getSelection() ); 92 getPreferenceStore().setValue( BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_LINKS, 93 this.showLinksButton.getSelection() ); 94 95 updateEnabled(); 96 validate(); 97 98 return true; 99 } 100 101 102 protected void performDefaults() 103 { 104 105 this.showDnButton.setSelection( getPreferenceStore().getDefaultBoolean( 106 BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_DN ) ); 107 this.showLinksButton.setSelection( getPreferenceStore().getDefaultBoolean( 108 BrowserUIConstants.PREFERENCE_SEARCHRESULTEDITOR_SHOW_LINKS ) ); 109 110 updateEnabled(); 111 validate(); 112 113 super.performDefaults(); 114 } 115 116 117 public void widgetModified( WidgetModifyEvent event ) 118 { 119 updateEnabled(); 120 validate(); 121 } 122 123 124 protected void validate() 125 { 126 127 } 128 129 } 130 | Popular Tags |