1 20 21 package org.apache.directory.ldapstudio.browser.common.widgets.entryeditor; 22 23 24 import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator; 25 import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants; 26 import org.apache.directory.ldapstudio.browser.core.BrowserCoreConstants; 27 import org.eclipse.jface.util.IPropertyChangeListener; 28 import org.eclipse.jface.util.PropertyChangeEvent; 29 import org.eclipse.jface.viewers.TreeViewer; 30 import org.eclipse.jface.viewers.Viewer; 31 32 33 39 public class EntryEditorWidgetPreferences implements IPropertyChangeListener 40 { 41 42 43 protected Viewer viewer; 44 45 46 49 public EntryEditorWidgetPreferences() 50 { 51 BrowserCommonActivator.getDefault().getPreferenceStore().addPropertyChangeListener( this ); 52 } 53 54 55 60 public void connect( TreeViewer viewer ) 61 { 62 this.viewer = viewer; 63 } 64 65 66 69 public void dispose() 70 { 71 BrowserCommonActivator.getDefault().getPreferenceStore().removePropertyChangeListener( this ); 72 viewer = null; 73 } 74 75 76 81 public boolean isUseFolding() 82 { 83 return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean( 84 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_ENABLE_FOLDING ); 85 } 86 87 88 93 public int getFoldingThreshold() 94 { 95 return BrowserCommonActivator.getDefault().getPreferenceStore().getInt( 96 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_FOLDING_THRESHOLD ); 97 } 98 99 100 105 public boolean isShowMayAttributes() 106 { 107 return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean( 108 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MAY_ATTRIBUTES ); 109 } 110 111 112 117 public boolean isShowMustAttributes() 118 { 119 return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean( 120 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_MUST_ATTRIBUTES ); 121 } 122 123 124 129 public boolean isShowObjectClassAttribute() 130 { 131 return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean( 132 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OBJECTCLASS_ATTRIBUTES ); 133 } 134 135 136 141 public boolean isShowOperationalAttributes() 142 { 143 return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean( 144 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES ); 145 } 146 147 148 154 public boolean isObjectClassAndMustAttributesFirst() 155 { 156 return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean( 157 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_OBJECTCLASS_AND_MUST_ATTRIBUTES_FIRST ); 158 } 159 160 161 166 public boolean isOperationalAttributesLast() 167 { 168 return BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean( 169 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_OPERATIONAL_ATTRIBUTES_LAST ); 170 } 171 172 173 180 public int getDefaultSortBy() 181 { 182 return BrowserCommonActivator.getDefault().getPreferenceStore().getInt( 183 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_BY ); 184 } 185 186 187 195 public int getDefaultSortOrder() 196 { 197 return BrowserCommonActivator.getDefault().getPreferenceStore().getInt( 198 BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_DEFAULT_SORT_ORDER ); 199 } 200 201 202 205 public void propertyChange( PropertyChangeEvent event ) 206 { 207 if ( this.viewer != null ) 208 { 209 this.viewer.refresh(); 210 } 211 } 212 213 } 214 | Popular Tags |