Changeset 1955
- Timestamp:
- 02/25/08 16:29:51
(9 months ago)
- Author:
- jjarrett
- Message:
Added logic that would only allow resetting of MLS Level to the Default MLS level when the currently assigned MLS Level was the same as the one being removed.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1954 |
r1955 |
|
| 51 | 51 | import com.tresys.framework.compiler.linkage.flnkage.FLNKParser; |
|---|
| 52 | 52 | import com.tresys.framework.compiler.mls.MLSInitializationException; |
|---|
| | 53 | import com.tresys.framework.compiler.mls.MLSLevel; |
|---|
| 53 | 54 | import com.tresys.framework.compiler.mls.MLSSupport; |
|---|
| 54 | 55 | import com.tresys.framework.plugin.SEFramework_Plugin; |
|---|
| 55 | 56 | import com.tresys.framework.plugin.builder.FrameworkBuilder; |
|---|
| | 57 | import com.tresys.framework.plugin.preferences.MLSSettingsProjProperties; |
|---|
| 56 | 58 | import com.tresys.framework.plugin.preferences.PreferenceInitializer; |
|---|
| 57 | 59 | import com.tresys.framework.plugin.preferences.SEFPreferencePage; |
|---|
| … | … | |
| 152 | 154 | } |
|---|
| 153 | 155 | |
|---|
| | 156 | if (event.getKey ().equals (SEFPreferencePage.DEFAULT_MLS_LEVEL_REMOVED)) |
|---|
| | 157 | { |
|---|
| | 158 | Iterator _iter = getSystems ().iterator (); |
|---|
| | 159 | |
|---|
| | 160 | while (_iter.hasNext ()) |
|---|
| | 161 | { |
|---|
| | 162 | SELinuxSystem sels = (SELinuxSystem)_iter.next (); |
|---|
| | 163 | |
|---|
| | 164 | sels.mlsDefaultChanged (event); |
|---|
| | 165 | } |
|---|
| | 166 | } |
|---|
| | 167 | |
|---|
| 154 | 168 | return; |
|---|
| 155 | 169 | } |
|---|
| … | … | |
| 206 | 220 | |
|---|
| 207 | 221 | desc.setBuildSpec(newCommands); |
|---|
| 208 | | |
|---|
| 209 | | |
|---|
| 210 | 222 | |
|---|
| 211 | 223 | m_project.setDescription(desc, null); |
|---|
| … | … | |
| 270 | 282 | resetSupportFiles (); |
|---|
| 271 | 283 | |
|---|
| | 284 | // Load MLS Support when Project is set |
|---|
| 272 | 285 | try |
|---|
| 273 | 286 | { |
|---|
| 274 | 287 | this.getMLSSupport (); |
|---|
| | 288 | |
|---|
| | 289 | // Redefine the Default MLS Level to match the definition for |
|---|
| | 290 | // the new Project being assigned. |
|---|
| | 291 | MLSLevel mls = this._mlsConfiguration.getLevel (m_projPrefs.get (SEFPreferencePage.DEFAULT_MLS_LEVEL, MLSSettingsProjProperties.DEFAULT_MLS)); |
|---|
| | 292 | this._mlsConfiguration.setDefaultMLSLevel (mls); |
|---|
| 275 | 293 | } |
|---|
| 276 | 294 | catch (MLSInitializationException mie) |
|---|
| 277 | 295 | { |
|---|
| 278 | | |
|---|
| | 296 | // Ignore the exception... |
|---|
| 279 | 297 | } |
|---|
| 280 | 298 | |
|---|
| r1953 |
r1955 |
|
| 48 | 48 | { |
|---|
| 49 | 49 | private ConnectionAnchor anchor; |
|---|
| 50 | | private static List EMPTY_LIST = new ArrayList (); |
|---|
| | 50 | private static List EMPTY_LIST = new ArrayList (); |
|---|
| | 51 | private String _oldDefaultLevel = null; |
|---|
| | 52 | private String _newDefaultLevel = null; |
|---|
| 51 | 53 | |
|---|
| 52 | 54 | final static protected boolean DEBUG = SEFramework_Plugin.getDefault ().isDebugging ("/debug/part"); |
|---|
| … | … | |
| 213 | 215 | if (null != ov) |
|---|
| 214 | 216 | { |
|---|
| 215 | | String oldValue = ov.toString (); |
|---|
| | 217 | this._oldDefaultLevel = ov.toString (); |
|---|
| | 218 | this._newDefaultLevel = evt.getNewValue ().toString (); |
|---|
| | 219 | } |
|---|
| | 220 | } |
|---|
| | 221 | else if (SEFPreferencePage.DEFAULT_MLS_LEVEL_REMOVED.equals (prop)) |
|---|
| | 222 | { |
|---|
| | 223 | Object ov = evt.getOldValue (); |
|---|
| | 224 | if (null != ov) |
|---|
| | 225 | { |
|---|
| | 226 | if (Boolean.TRUE.toString ().equals (evt.getNewValue ().toString ())) |
|---|
| | 227 | { |
|---|
| 216 | 228 | |
|---|
| 217 | | Shape s = this.getCastedModel (); |
|---|
| 218 | | |
|---|
| 219 | | IMLSSetting ims = (IMLSSetting) s.getComponent (); |
|---|
| 220 | | |
|---|
| 221 | | if (oldValue.equals (ims.getMLSLabel ())) |
|---|
| 222 | | { |
|---|
| | 229 | Shape s = this.getCastedModel (); |
|---|
| 223 | 230 | |
|---|
| 224 | | String levelName = evt.getNewValue ().toString (); |
|---|
| | 231 | IMLSSetting ims = (IMLSSetting) s.getComponent (); |
|---|
| 225 | 232 | |
|---|
| 226 | | ims.setMLSLabel (levelName); |
|---|
| 227 | | |
|---|
| 228 | | MLSSupport mlsSupport = MLSSupport.getInstance (); |
|---|
| 229 | | |
|---|
| 230 | | if (null != mlsSupport) |
|---|
| 231 | | { |
|---|
| 232 | | MLSLevel mls = mlsSupport.getLevel (levelName); |
|---|
| | 233 | if (_oldDefaultLevel.equals (ims.getMLSLabel ())) |
|---|
| | 234 | { |
|---|
| 233 | 235 | |
|---|
| 234 | | if (null != mls) |
|---|
| 235 | | { |
|---|
| 236 | | this.figure.setBackgroundColor (MLSEclipseLevel.getColorInstance (mls)); |
|---|
| 237 | | refreshVisuals (); |
|---|
| 238 | | } |
|---|
| 239 | | } |
|---|
| | 236 | String levelName = _newDefaultLevel; |
|---|
| | 237 | |
|---|
| | 238 | ims.setMLSLabel (levelName); |
|---|
| | 239 | |
|---|
| | 240 | MLSSupport mlsSupport = MLSSupport.getInstance (); |
|---|
| | 241 | |
|---|
| | 242 | if (null != mlsSupport) |
|---|
| | 243 | { |
|---|
| | 244 | MLSLevel mls = mlsSupport.getLevel (levelName); |
|---|
| | 245 | |
|---|
| | 246 | if (null != mls) |
|---|
| | 247 | { |
|---|
| | 248 | this.figure.setBackgroundColor (MLSEclipseLevel.getColorInstance (mls)); |
|---|
| | 249 | refreshVisuals (); |
|---|
| | 250 | } |
|---|
| | 251 | } |
|---|
| | 252 | } |
|---|
| 240 | 253 | } |
|---|
| 241 | 254 | } |
|---|
| r1954 |
r1955 |
|
| 91 | 91 | implements IWorkbenchPropertyPage |
|---|
| 92 | 92 | { |
|---|
| | 93 | public static final String DEFAULT_MLS = "mls-low"; |
|---|
| 93 | 94 | |
|---|
| 94 | 95 | private static final int LEVEL_DEFINITION_CONTROL_VERTICAL_SPACING = 2; |
|---|
| … | … | |
| 99 | 100 | private static final int NAME_COLUMN_WIDTH = 200; |
|---|
| 100 | 101 | private static final int COLOR_COLUMN_WIDTH = 200; |
|---|
| 101 | | private static final String DEFAULT_MLS = "mls-low"; |
|---|
| 102 | 102 | protected Table _table = null; |
|---|
| 103 | 103 | protected TableViewer _ctv = null; |
|---|
| … | … | |
| 109 | 109 | protected ComboViewer _levelsDefault = null; |
|---|
| 110 | 110 | protected IEclipsePreferences projPrefs = null; |
|---|
| 111 | | |
|---|
| | 111 | protected boolean _defaultWasRemoved = false; |
|---|
| 112 | 112 | |
|---|
| 113 | 113 | /** |
|---|
| … | … | |
| 176 | 176 | // Prepare the environment |
|---|
| 177 | 177 | this.initProjPrefs (); |
|---|
| | 178 | |
|---|
| | 179 | this._defaultWasRemoved = false; |
|---|
| 178 | 180 | |
|---|
| 179 | 181 | // Define the basics of the page |
|---|
| … | … | |
| 428 | 430 | { |
|---|
| 429 | 431 | MLSLevel dl = _levels.getLevelOrderedAt (0); |
|---|
| 430 | | _levelsDefault.setSelection (new StructuredSelection(dl)); |
|---|
| | 432 | _levelsDefault.setSelection (new StructuredSelection(dl)); |
|---|
| | 433 | _defaultWasRemoved = true; |
|---|
| 431 | 434 | } |
|---|
| 432 | 435 | |
|---|
| … | … | |
| 552 | 555 | |
|---|
| 553 | 556 | this.projPrefs.put (SEFPreferencePage.MLS_UPDATE, Long.toHexString (System.currentTimeMillis ())); |
|---|
| | 557 | |
|---|
| | 558 | if (_defaultWasRemoved) |
|---|
| | 559 | { |
|---|
| | 560 | this.projPrefs.put(SEFPreferencePage.DEFAULT_MLS_LEVEL_REMOVED, Boolean.FALSE.toString ()); |
|---|
| | 561 | this.projPrefs.put(SEFPreferencePage.DEFAULT_MLS_LEVEL_REMOVED, Boolean.TRUE.toString ()); |
|---|
| | 562 | } |
|---|
| 554 | 563 | |
|---|
| 555 | 564 | projPrefs.flush (); |
|---|
| r1953 |
r1955 |
|
| 53 | 53 | */ |
|---|
| 54 | 54 | public static final String DEFAULT_MLS_LEVEL = "defaultMLSLevel"; |
|---|
| | 55 | public static final String DEFAULT_MLS_LEVEL_REMOVED = "defaultMLSLevelRemoved"; |
|---|
| 55 | 56 | public static final String MLS_UPDATE = "mlsUpdated"; |
|---|
| 56 | 57 | |
|---|
Download in other formats:
* Generating other formats may take time.