1 20 21 package org.apache.directory.ldapstudio.browser.common.widgets.entryeditor; 22 23 24 import org.apache.directory.ldapstudio.valueeditors.ValueEditorManager; 25 import org.eclipse.jface.viewers.TreeViewer; 26 27 28 36 public class EntryEditorWidgetConfiguration 37 { 38 39 40 private boolean disposed = false; 41 42 43 protected EntryEditorWidgetSorter sorter; 44 45 46 protected EntryEditorWidgetFilter filter; 47 48 49 protected EntryEditorWidgetPreferences preferences; 50 51 52 protected EntryEditorWidgetContentProvider contentProvider; 53 54 55 protected EntryEditorWidgetLabelProvider labelProvider; 56 57 58 protected EntryEditorWidgetCellModifier cellModifier; 59 60 61 protected ValueEditorManager valueEditorManager; 62 63 64 67 public EntryEditorWidgetConfiguration() 68 { 69 } 70 71 72 75 public void dispose() 76 { 77 if ( !disposed ) 78 { 79 if ( sorter != null ) 80 { 81 sorter.dispose(); 82 sorter = null; 83 } 84 85 if ( filter != null ) 86 { 87 filter.dispose(); 88 filter = null; 89 } 90 91 if ( preferences != null ) 92 { 93 preferences.dispose(); 94 preferences = null; 95 } 96 97 if ( contentProvider != null ) 98 { 99 contentProvider.dispose(); 100 contentProvider = null; 101 } 102 103 if ( labelProvider != null ) 104 { 105 labelProvider.dispose(); 106 labelProvider = null; 107 } 108 109 if ( cellModifier != null ) 110 { 111 cellModifier.dispose(); 112 cellModifier = null; 113 } 114 115 if ( valueEditorManager != null ) 116 { 117 valueEditorManager.dispose(); 118 valueEditorManager = null; 119 } 120 121 disposed = true; 122 } 123 } 124 125 126 133 public EntryEditorWidgetContentProvider getContentProvider( EntryEditorWidget mainWidget ) 134 { 135 if ( contentProvider == null ) 136 { 137 contentProvider = new EntryEditorWidgetContentProvider( getPreferences(), mainWidget ); 138 } 139 140 return contentProvider; 141 } 142 143 144 151 public EntryEditorWidgetLabelProvider getLabelProvider( TreeViewer viewer ) 152 { 153 if ( labelProvider == null ) 154 { 155 labelProvider = new EntryEditorWidgetLabelProvider( getValueEditorManager( viewer ) ); 156 } 157 158 return labelProvider; 159 } 160 161 162 169 public EntryEditorWidgetCellModifier getCellModifier( TreeViewer viewer ) 170 { 171 if ( cellModifier == null ) 172 { 173 cellModifier = new EntryEditorWidgetCellModifier( getValueEditorManager( viewer ) ); 174 } 175 176 return cellModifier; 177 } 178 179 180 187 public ValueEditorManager getValueEditorManager( TreeViewer viewer ) 188 { 189 if ( valueEditorManager == null ) 190 { 191 valueEditorManager = new ValueEditorManager( viewer.getTree() ); 192 } 193 194 return valueEditorManager; 195 } 196 197 198 203 public EntryEditorWidgetSorter getSorter() 204 { 205 if ( sorter == null ) 206 { 207 sorter = new EntryEditorWidgetSorter( getPreferences() ); 208 } 209 210 return sorter; 211 } 212 213 214 219 public EntryEditorWidgetFilter getFilter() 220 { 221 if ( filter == null ) 222 { 223 filter = new EntryEditorWidgetFilter(); 224 } 225 226 return filter; 227 } 228 229 230 235 public EntryEditorWidgetPreferences getPreferences() 236 { 237 if ( preferences == null ) 238 { 239 preferences = new EntryEditorWidgetPreferences(); 240 } 241 242 return preferences; 243 } 244 245 } 246 | Popular Tags |