| 55 | | protected Control createContents(Composite parent) { |
|---|
| 56 | | setTitle("Current CDSFramework Project Preferences"); |
|---|
| 57 | | setImageDescriptor( |
|---|
| 58 | | SEFramework_Plugin.getDefault().getImageRegistry().getDescriptor( |
|---|
| 59 | | FRAMEWORKImageRegistry.FRAMEWORK_ICON)); |
|---|
| 60 | | |
|---|
| 61 | | Composite composite = new Composite(parent, SWT.NONE); |
|---|
| 62 | | GridLayout layout = new GridLayout(1, false); |
|---|
| | 57 | protected Control createContents (Composite parent) |
|---|
| | 58 | { |
|---|
| | 59 | setTitle ("Current CDSFramework Project Preferences"); |
|---|
| | 60 | setImageDescriptor (SEFramework_Plugin.getDefault ().getImageRegistry () |
|---|
| | 61 | .getDescriptor (FRAMEWORKImageRegistry.FRAMEWORK_ICON)); |
|---|
| | 62 | |
|---|
| | 63 | Composite composite = new Composite (parent, SWT.NONE); |
|---|
| | 64 | GridLayout layout = new GridLayout (1, false); |
|---|
| 65 | | composite.setLayout(layout); |
|---|
| 66 | | |
|---|
| 67 | | IScopeContext currProjScope = new ProjectScope(getProject()); |
|---|
| 68 | | |
|---|
| 69 | | projPrefs = currProjScope.getNode(SEFramework_Plugin.PLUGIN_ID); |
|---|
| 70 | | |
|---|
| 71 | | Composite DictArea = new Composite(composite, SWT.NONE); |
|---|
| 72 | | |
|---|
| 73 | | DictArea.setLayout(new GridLayout(3, false)); |
|---|
| 74 | | DictArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
|---|
| 75 | | |
|---|
| 76 | | Label mainDictLabel = new Label(DictArea, SWT.NONE); |
|---|
| 77 | | |
|---|
| 78 | | mainDictLabel.setText("Main Dictionary File:"); |
|---|
| 79 | | mainDictFileName = new Text(DictArea, SWT.SINGLE | SWT.BORDER); |
|---|
| 80 | | mainDictFileName.setText( |
|---|
| 81 | | projPrefs.get(SEFPreferencePage.BASE_DICT_PATH, "")); |
|---|
| 82 | | |
|---|
| 83 | | mainDictSearchButton = new Button(DictArea, SWT.PUSH); |
|---|
| 84 | | mainDictSearchButton.setText("Browse..."); |
|---|
| 85 | | mainDictSearchButton.addSelectionListener( |
|---|
| 86 | | new SelectionAdapter() { |
|---|
| 87 | | public void widgetSelected(SelectionEvent e) { |
|---|
| 88 | | mainDictFileName.setText( |
|---|
| 89 | | FileSelector(mainDictFileName.getText())); |
|---|
| | 67 | composite.setLayout (layout); |
|---|
| | 68 | |
|---|
| | 69 | IScopeContext currProjScope = new ProjectScope (getProject ()); |
|---|
| | 70 | |
|---|
| | 71 | projPrefs = currProjScope.getNode (SEFramework_Plugin.PLUGIN_ID); |
|---|
| | 72 | |
|---|
| | 73 | Composite DictArea = new Composite (composite, SWT.NONE); |
|---|
| | 74 | |
|---|
| | 75 | DictArea.setLayout (new GridLayout (3, false)); |
|---|
| | 76 | DictArea.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); |
|---|
| | 77 | |
|---|
| | 78 | Label mainDictLabel = new Label (DictArea, SWT.NONE); |
|---|
| | 79 | |
|---|
| | 80 | mainDictLabel.setText ("Main Dictionary File:"); |
|---|
| | 81 | mainDictFileName = new Text (DictArea, SWT.SINGLE | SWT.BORDER); |
|---|
| | 82 | mainDictFileName.setText (projPrefs.get (SEFPreferencePage.BASE_DICT_PATH, "")); |
|---|
| | 83 | |
|---|
| | 84 | mainDictSearchButton = new Button (DictArea, SWT.PUSH); |
|---|
| | 85 | mainDictSearchButton.setText ("Browse..."); |
|---|
| | 86 | mainDictSearchButton.addSelectionListener (new SelectionAdapter () |
|---|
| | 87 | { |
|---|
| | 88 | public void widgetSelected (SelectionEvent e) |
|---|
| | 89 | { |
|---|
| | 90 | mainDictFileName.setText (FileSelector (mainDictFileName.getText ())); |
|---|
| 94 | | /* Composite BasePolArea = new Composite(composite, SWT.NONE); |
|---|
| 95 | | |
|---|
| 96 | | BasePolArea.setLayout(new GridLayout(3, false)); |
|---|
| 97 | | BasePolArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
|---|
| 98 | | Label basePolLabel = new Label(BasePolArea, SWT.NONE); |
|---|
| 99 | | |
|---|
| 100 | | basePolLabel.setText("Base Policy Directory:"); |
|---|
| 101 | | basePolDir = new Text(BasePolArea, SWT.SINGLE | SWT.BORDER); |
|---|
| 102 | | basePolDir.setText( |
|---|
| 103 | | projPrefs.get(SEFPreferencePage.BASE_POLICY_PATH, "")); |
|---|
| 104 | | |
|---|
| 105 | | basePolDirSearchButton = new Button(BasePolArea, SWT.PUSH); |
|---|
| 106 | | basePolDirSearchButton.setText("Browse..."); |
|---|
| 107 | | basePolDirSearchButton.addSelectionListener( |
|---|
| 108 | | new SelectionAdapter() { |
|---|
| 109 | | public void widgetSelected(SelectionEvent e) { |
|---|
| 110 | | basePolDir.setText( |
|---|
| 111 | | DirectorySelector(basePolDir.getText())); |
|---|
| 112 | | } |
|---|
| 113 | | });*/ |
|---|
| 114 | | // NEW ROW |
|---|
| 115 | | /* |
|---|
| 116 | | PullFromWorkspacePrefsButton = new Button(composite, SWT.PUSH); |
|---|
| 117 | | PullFromWorkspacePrefsButton.setText("Copy Preferences From Workspace"); |
|---|
| 118 | | PullFromWorkspacePrefsButton.addSelectionListener( |
|---|
| 119 | | new SelectionAdapter() { |
|---|
| 120 | | public void widgetSelected(SelectionEvent e) { |
|---|
| 121 | | PullPrefsFromWorkspace(); |
|---|
| | 95 | Composite BasePolArea = new Composite (composite, SWT.NONE); |
|---|
| | 96 | |
|---|
| | 97 | BasePolArea.setLayout (new GridLayout (3, false)); |
|---|
| | 98 | BasePolArea.setLayoutData (new GridData (GridData.FILL_HORIZONTAL)); |
|---|
| | 99 | Label basePolLabel = new Label (BasePolArea, SWT.NONE); |
|---|
| | 100 | |
|---|
| | 101 | basePolLabel.setText ("Base Policy Directory:"); |
|---|
| | 102 | basePolDir = new Text (BasePolArea, SWT.SINGLE | SWT.BORDER); |
|---|
| | 103 | basePolDir.setText (projPrefs.get (SEFPreferencePage.BASE_POLICY_PATH, "")); |
|---|
| | 104 | |
|---|
| | 105 | basePolDirSearchButton = new Button (BasePolArea, SWT.PUSH); |
|---|
| | 106 | basePolDirSearchButton.setText ("Browse..."); |
|---|
| | 107 | basePolDirSearchButton.addSelectionListener (new SelectionAdapter () |
|---|
| | 108 | { |
|---|
| | 109 | public void widgetSelected (SelectionEvent e) |
|---|
| | 110 | { |
|---|
| | 111 | basePolDir.setText (DirectorySelector (basePolDir.getText ())); |
|---|
| 139 | | protected void performDefaults() { |
|---|
| 140 | | super.performDefaults(); |
|---|
| 141 | | mainDictFileName.setText( |
|---|
| 142 | | SEFramework_Plugin.getDefault().getPreferenceStore().getDefaultString( |
|---|
| 143 | | SEFPreferencePage.BASE_DICT_PATH)); |
|---|
| 144 | | } |
|---|
| 145 | | |
|---|
| 146 | | |
|---|
| | 138 | protected void performDefaults () |
|---|
| | 139 | { |
|---|
| | 140 | super.performDefaults (); |
|---|
| | 141 | mainDictFileName.setText (SEFramework_Plugin.getDefault ().getPreferenceStore () |
|---|
| | 142 | .getDefaultString (SEFPreferencePage.BASE_DICT_PATH)); |
|---|
| | 143 | basePolDir.setText (SEFramework_Plugin.getDefault ().getPreferenceStore () |
|---|
| | 144 | .getString (SEFPreferencePage.BASE_POLICY_PATH)); |
|---|
| | 145 | } |
|---|
| | 146 | |
|---|
| 150 | | public boolean performOk() { |
|---|
| 151 | | try { |
|---|
| 152 | | projPrefs.put(SEFPreferencePage.BASE_DICT_PATH, |
|---|
| 153 | | mainDictFileName.getText()); |
|---|
| 154 | | // projPrefs.put(SEFPreferencePage.BASE_POLICY_PATH, |
|---|
| 155 | | // basePolDir.getText()); |
|---|
| 156 | | |
|---|
| 157 | | projPrefs.flush(); |
|---|
| 158 | | } catch (Exception e) { |
|---|
| 159 | | e.printStackTrace(); |
|---|
| | 150 | public boolean performOk () |
|---|
| | 151 | { |
|---|
| | 152 | try |
|---|
| | 153 | { |
|---|
| | 154 | projPrefs.put (SEFPreferencePage.BASE_DICT_PATH, mainDictFileName.getText ()); |
|---|
| | 155 | projPrefs.put (SEFPreferencePage.BASE_POLICY_PATH, basePolDir.getText ()); |
|---|
| | 156 | |
|---|
| | 157 | projPrefs.flush (); |
|---|
| | 158 | } |
|---|
| | 159 | catch (Exception e) |
|---|
| | 160 | { |
|---|
| | 161 | e.printStackTrace (); |
|---|
| 173 | | |
|---|
| 174 | | protected String DirectorySelector(String startDir) { |
|---|
| 175 | | DirectoryDialog directoryDialog = new DirectoryDialog(getShell(), |
|---|
| 176 | | SWT.OPEN); |
|---|
| 177 | | |
|---|
| 178 | | File startingDirectory = new File(startDir); |
|---|
| 179 | | |
|---|
| 180 | | directoryDialog.setText("Please Choose the Directory"); |
|---|
| 181 | | if (!startingDirectory.exists()) { |
|---|
| | 177 | |
|---|
| | 178 | protected String DirectorySelector (String startDir) |
|---|
| | 179 | { |
|---|
| | 180 | DirectoryDialog directoryDialog = new DirectoryDialog (getShell (), SWT.OPEN); |
|---|
| | 181 | |
|---|
| | 182 | File startingDirectory = new File (startDir); |
|---|
| | 183 | |
|---|
| | 184 | directoryDialog.setText ("Please Choose the Directory"); |
|---|
| | 185 | if (!startingDirectory.exists ()) |
|---|
| | 186 | { |
|---|
| 195 | | |
|---|
| 196 | | protected String FileSelector(String startDir) { |
|---|
| 197 | | |
|---|
| 198 | | FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); |
|---|
| 199 | | |
|---|
| 200 | | fileDialog.setText("Please Choose a File"); |
|---|
| 201 | | |
|---|
| 202 | | File startingDirectory = new File(startDir); |
|---|
| 203 | | |
|---|
| 204 | | if (startingDirectory.exists()) { |
|---|
| 205 | | fileDialog.setFileName(startingDirectory.getPath()); |
|---|
| 206 | | } |
|---|
| 207 | | |
|---|
| 208 | | String file = fileDialog.open(); |
|---|
| 209 | | |
|---|
| 210 | | if (file != null) { |
|---|
| | 203 | |
|---|
| | 204 | protected String FileSelector (String startDir) |
|---|
| | 205 | { |
|---|
| | 206 | |
|---|
| | 207 | FileDialog fileDialog = new FileDialog (getShell (), SWT.OPEN); |
|---|
| | 208 | |
|---|
| | 209 | fileDialog.setText ("Please Choose a File"); |
|---|
| | 210 | |
|---|
| | 211 | File startingDirectory = new File (startDir); |
|---|
| | 212 | |
|---|
| | 213 | if (startingDirectory.exists ()) |
|---|
| | 214 | { |
|---|
| | 215 | fileDialog.setFileName (startingDirectory.getPath ()); |
|---|
| | 216 | } |
|---|
| | 217 | |
|---|
| | 218 | String file = fileDialog.open (); |
|---|
| | 219 | |
|---|
| | 220 | if (file != null) |
|---|
| | 221 | { |
|---|
| 217 | | protected void PullPrefsFromWorkspace() { |
|---|
| 218 | | mainDictFileName.setText( |
|---|
| 219 | | SEFramework_Plugin.getDefault().getPreferenceStore().getString( |
|---|
| 220 | | SEFPreferencePage.BASE_DICT_PATH)); |
|---|
| 221 | | // basePolDir.setText( |
|---|
| 222 | | // SEFramework_Plugin.getDefault().getPreferenceStore().getString( |
|---|
| 223 | | // SEFPreferencePage.BASE_POLICY_PATH)); |
|---|
| 224 | | } |
|---|
| 225 | | |
|---|
| 226 | | public void statusChanged(IStatus status) { |
|---|
| 227 | | setValid(!status.matches(IStatus.ERROR)); |
|---|
| | 228 | /* |
|---|
| | 229 | * private void PullPrefsFromWorkspace() { mainDictFileName.setText( |
|---|
| | 230 | * SEFramework_Plugin.getDefault().getPreferenceStore().getString( |
|---|
| | 231 | * SEFPreferencePage.BASE_DICT_PATH)); basePolDir.setText( |
|---|
| | 232 | * SEFramework_Plugin.getDefault().getPreferenceStore().getString( |
|---|
| | 233 | * SEFPreferencePage.BASE_POLICY_PATH)); } |
|---|
| | 234 | */ |
|---|
| | 235 | public void statusChanged (IStatus status) |
|---|
| | 236 | { |
|---|
| | 237 | setValid (!status.matches (IStatus.ERROR)); |
|---|