Changeset 1953
- Timestamp:
- 02/25/08 14:49:06 (9 months ago)
- Files:
-
- branches/mls/framework-plugin/src/com/tresys/framework/compiler/PolicyGenerator.java (modified) (4 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/compiler/mls/MLSLevel.java (modified) (2 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/compiler/mls/MLSSupport.java (modified) (8 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkNature.java (modified) (5 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/builder/SELinuxSystem.java (modified) (3 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/PolicyComponentFigure.java (modified) (1 diff)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/ControlResourceShape.java (modified) (8 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/DefaultMLSLevelUpdateVisitor.java (added)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/DomainShape.java (modified) (15 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/EntryPointShape.java (modified) (12 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/ModelElement.java (modified) (1 diff)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/ResourceShape.java (modified) (11 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/Shape.java (modified) (2 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/DomainEditPart.java (modified) (3 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/PolicyEditPart.java (modified) (3 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/ShapeEditPart.java (modified) (4 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/preferences/MLSEclipseLevel.java (modified) (5 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/preferences/MLSSettingsProjProperties.java (modified) (10 diffs)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/preferences/Messages.java (modified) (1 diff)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/preferences/SEFPreferencePage.java (modified) (1 diff)
- branches/mls/framework-plugin/src/com/tresys/framework/plugin/preferences/messages.properties (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/mls/framework-plugin/src/com/tresys/framework/compiler/PolicyGenerator.java
r1878 r1953 71 71 buf.append(" }"); 72 72 } 73 74 String mlsLevel = i_resource.getMLSLabel (); 75 appendMLSLevel (buf, mlsLevel); 76 73 77 buf.append(";"); 74 78 buf.append(newLine); … … 113 117 buf.append("}"); 114 118 } 119 120 String mlsLevel = i_domain.getMLSLabel (); 121 appendMLSLevel (buf, mlsLevel); 122 115 123 buf.append(";"); 116 124 buf.append(newLine); … … 123 131 StringBuffer buf = new StringBuffer(); 124 132 125 buf.append("entrypoint " + i_ep.getName() + ";"); 133 buf.append("entrypoint "); 134 buf.append(i_ep.getName()); 135 136 String mlsLevel = i_ep.getMLSLabel (); 137 appendMLSLevel (buf, mlsLevel); 138 139 buf.append(";"); 126 140 buf.append(newLine); 127 141 … … 393 407 return fullResult.toString(); 394 408 } 409 410 protected void appendMLSLevel(StringBuffer buf, String mlsLevel) 411 { 412 if ((null != mlsLevel) && (!mlsLevel.equals (""))) 413 { 414 buf.append ("\""); 415 buf.append (mlsLevel); 416 buf.append ("\""); 417 } 418 419 return; 420 } 395 421 } branches/mls/framework-plugin/src/com/tresys/framework/compiler/mls/MLSLevel.java
r1936 r1953 32 32 * 33 33 */ 34 public class MLSLevel 34 public class MLSLevel 35 35 { 36 36 private static final String COLOR_ATTRIBUTE_NAME = "color"; … … 218 218 return retValue; 219 219 } 220 220 221 } branches/mls/framework-plugin/src/com/tresys/framework/compiler/mls/MLSSupport.java
r1936 r1953 21 21 package com.tresys.framework.compiler.mls; 22 22 23 import java.io.BufferedOutputStream;24 23 import java.io.File; 25 24 import java.io.FileInputStream; … … 27 26 import java.io.IOException; 28 27 import java.io.InputStream; 29 import java.io.OutputStream;30 28 import java.util.Collection; 31 29 import java.util.Enumeration; … … 79 77 80 78 private static final String LEVEL_ELEMENT_NAME = "level"; 81 79 80 private static final String DEFAULT_MLS_SYSTEM_HIGH_RANGE = "mls-systemhigh"; 81 82 private static final String DEFAULT_MLS_SYSTEM_LOW_RANGE = "mls-systemlow"; 83 84 private static final String DEFAULT_MLS_HIGH_COLOR_VALUE = "0xff0000"; 85 86 private static final String DEFAULT_MLS_HIGH_LEVEL_NAME = "mls-high"; 87 88 private static final String DEFAULT_MLS_LOW_COLOR_VALUE = "0xffffff"; 89 90 private static final String DEFAULT_MLS_LOW_LEVEL_NAME = "mls-low"; 91 92 private static MLSSupport _LEVELS = null; 93 94 public static MLSSupport getInstance() 95 { 96 return _LEVELS; 97 } 98 82 99 // The file 83 100 private File _file = null; … … 85 102 // Internal representation of the MLS configuration as defined. 86 103 private Hashtable _levels = new Hashtable(); 104 105 private MLSLevel _defaultLevel = null; 87 106 88 107 /** … … 100 119 { 101 120 initialize (f); 121 if (null == MLSSupport._LEVELS) 122 { 123 MLSSupport._LEVELS = this; 124 } 102 125 } 103 126 catch (ParserConfigurationException pce) … … 125 148 { 126 149 _file = new File(fileName); 150 151 MLSLevel mls = new MLSLevel(DEFAULT_MLS_LOW_LEVEL_NAME); 152 mls.setColor (DEFAULT_MLS_LOW_COLOR_VALUE); 153 mls.setRange (DEFAULT_MLS_SYSTEM_LOW_RANGE); 154 mls.setOrder (this.size ()); 155 this.add (mls); 156 157 mls = new MLSLevel(DEFAULT_MLS_HIGH_LEVEL_NAME); 158 mls.setColor (DEFAULT_MLS_HIGH_COLOR_VALUE); 159 mls.setRange (DEFAULT_MLS_SYSTEM_HIGH_RANGE); 160 mls.setOrder (this.size ()); 161 this.add (mls); 162 163 if (null == MLSSupport._LEVELS) 164 { 165 MLSSupport._LEVELS = this; 166 } 127 167 } 128 168 … … 425 465 * @param o - The object to be identified. 426 466 * @return - True if the object is defined within the configuration; otherwise false. 427 * @throws ClassCastException - Thrown if object is not of type MLSLevel 467 * @throws ClassCastException - Thrown if object is not of type MLSLevel or String 428 468 * 429 469 */ 430 470 public boolean contains(Object o) 431 471 { 432 if ( !(o instanceof MLSLevel))472 if ((!(o instanceof MLSLevel)) && (!(o instanceof String))) 433 473 { 434 474 throw new ClassCastException("Can not add non-MLSLevel Objects to collection."); 435 475 } 436 476 437 return ( _levels.containsValue (o));477 return ((_levels.containsValue (o)) || (_levels.containsKey (o))); 438 478 } 439 479 … … 657 697 return; 658 698 } 699 700 /** 701 * orderOf 702 * 703 * Determines the ordering of the MLS by name 704 * 705 * @param name - The name of the MLS Level whose ordering is requested 706 * @return - The ordering of the identified MLS Level 707 */ 708 public int orderOf(String name) 709 { 710 int retValue = -1; 711 712 if (contains(name)) 713 { 714 MLSLevel mls = getLevel (name); 715 retValue = mls.getOrder (); 716 } 717 return retValue; 718 } 719 720 /** 721 * getLevelOrderedAt 722 * 723 * Determines the MLS Level given the ordering 724 * 725 * @param order - The user identified ordering 726 * @return - The identified MLS Level. 727 */ 728 public MLSLevel getLevelOrderedAt(int order) 729 { 730 MLSLevel retValue = null; 731 Iterator _iter = iterator (); 732 733 while(_iter.hasNext ()) 734 { 735 retValue = (MLSLevel)_iter.next (); 736 737 if (order == retValue.getOrder ()) 738 { 739 break; 740 } 741 } 742 743 return retValue; 744 } 745 746 /** 747 * getDefaultMLSLevel 748 * 749 * Returns the currently defined Default Level 750 * 751 * @return - The currently set default Level. 752 * 753 */ 754 public MLSLevel getDefaultMLSLevel() 755 { 756 return _defaultLevel; 757 } 758 759 /** 760 * setDefaultMLSLevel 761 * 762 * Defines the Default MLS Level 763 * 764 * @param mls - The user selected Default Level. 765 * 766 */ 767 public void setDefaultMLSLevel(MLSLevel mls) 768 { 769 this._defaultLevel = mls; 770 771 return; 772 } 659 773 } 660 774 branches/mls/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkNature.java
r1910 r1953 54 54 import com.tresys.framework.plugin.SEFramework_Plugin; 55 55 import com.tresys.framework.plugin.builder.FrameworkBuilder; 56 import com.tresys.framework.plugin.editor.policy.graphic.model.Shape; 56 57 import com.tresys.framework.plugin.preferences.PreferenceInitializer; 57 58 import com.tresys.framework.plugin.preferences.SEFPreferencePage; … … 127 128 m_dictionary = null; 128 129 } 130 131 if (event.getKey ().equals (SEFPreferencePage.MLS_UPDATE)) 132 { 133 Iterator _iter = getSystems ().iterator (); 134 135 while (_iter.hasNext ()) 136 { 137 SELinuxSystem sels = (SELinuxSystem)_iter.next (); 138 139 sels.mlsDefinitionChanged (event); 140 } 141 } 142 143 if (event.getKey ().equals (SEFPreferencePage.DEFAULT_MLS_LEVEL)) 144 { 145 Iterator _iter = getSystems ().iterator (); 146 147 while (_iter.hasNext ()) 148 { 149 SELinuxSystem sels = (SELinuxSystem)_iter.next (); 150 151 sels.mlsDefaultChanged (event); 152 } 153 } 154 155 return; 129 156 } 130 157 … … 148 175 catch (IOException e) 149 176 {} 150 } 177 } 151 178 } 152 179 … … 243 270 244 271 resetSupportFiles (); 272 273 try 274 { 275 this.getMLSSupport (); 276 } 277 catch (MLSInitializationException mie) 278 { 279 280 } 281 282 return; 245 283 } 246 284 … … 566 604 if (null == _mlsConfiguration) 567 605 { 568 IFile mlsConfigurationFile = this.getSupportFolder ().getFile (MLS_CONFIGURATION_FILE); 569 _mlsConfiguration = new MLSSupport(mlsConfigurationFile.getLocation ().toFile ()); 606 _mlsConfiguration = MLSSupport.getInstance (); 607 608 if (null == _mlsConfiguration) 609 { 610 IFile mlsConfigurationFile = this.getSupportFolder ().getFile (MLS_CONFIGURATION_FILE); 611 _mlsConfiguration = new MLSSupport(mlsConfigurationFile.getLocation ().toFile ()); 612 } 570 613 } 571 614 branches/mls/framework-plugin/src/com/tresys/framework/plugin/builder/SELinuxSystem.java
r1901 r1953 30 30 import org.eclipse.core.runtime.Path; 31 31 import org.eclipse.core.runtime.PlatformObject; 32 import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; 32 33 import org.eclipse.jface.resource.ImageDescriptor; 33 34 import org.eclipse.swt.widgets.Display; … … 43 44 import com.tresys.framework.plugin.SEFramework_Plugin; 44 45 import com.tresys.framework.plugin.editor.policy.graphic.GraphicPolicyRefresh; 46 import com.tresys.framework.plugin.editor.policy.graphic.IShapeVisitor; 47 import com.tresys.framework.plugin.editor.policy.graphic.model.AccessConnection; 48 import com.tresys.framework.plugin.editor.policy.graphic.model.BaseDomainShape; 49 import com.tresys.framework.plugin.editor.policy.graphic.model.BaseResourceShape; 50 import com.tresys.framework.plugin.editor.policy.graphic.model.Connection; 51 import com.tresys.framework.plugin.editor.policy.graphic.model.ControlResourceShape; 52 import com.tresys.framework.plugin.editor.policy.graphic.model.DefaultMLSLevelUpdateVisitor; 53 import com.tresys.framework.plugin.editor.policy.graphic.model.DomainShape; 54 import com.tresys.framework.plugin.editor.policy.graphic.model.EntryConnection; 55 import com.tresys.framework.plugin.editor.policy.graphic.model.EntryPointShape; 45 56 import com.tresys.framework.plugin.editor.policy.graphic.model.PolicyDiagram; 57 import com.tresys.framework.plugin.editor.policy.graphic.model.ResourceShape; 58 import com.tresys.framework.plugin.editor.policy.graphic.model.UserDomainShape; 46 59 import com.tresys.framework.plugin.preferences.SEFPreferencePage; 47 60 … … 691 704 } 692 705 } 706 707 public void mlsDefinitionChanged(PreferenceChangeEvent event) 708 { 709 IShapeVisitor isv = new DefaultMLSLevelUpdateVisitor(event); 710 this.m_diagram.Accept (isv); 711 712 return; 713 } 714 715 public void mlsDefaultChanged(PreferenceChangeEvent event) 716 { 717 IShapeVisitor isv = new DefaultMLSLevelUpdateVisitor(event); 718 this.m_diagram.Accept (isv); 719 720 return; 721 } 722 723 724 // protected class MLSUpdateVisitor 725 // implements IShapeVisitor 726 // { 727 // public void Visit (DomainShape i_domain) 728 // { 729 // i_domain.updateMLS (); 730 // 731 // return; 732 // } 733 // 734 // public void Visit (BaseDomainShape i_baseDom) 735 // { 736 // return; 737 // } 738 // 739 // public void Visit (UserDomainShape i_userDom) 740 // { 741 // return; 742 // } 743 // 744 // public void Visit (ResourceShape i_resource) 745 // { 746 // i_resource.updateMLS (); 747 // 748 // return; 749 // } 750 // 751 // public void Visit (BaseResourceShape i_baseRes) 752 // { 753 // return; 754 // } 755 // 756 // public void Visit (AccessConnection i_access) 757 // { 758 // return; 759 // } 760 // 761 // public void Visit (PolicyDiagram i_diagram) 762 // { 763 // return; 764 // } 765 // 766 // public void Visit (EntryPointShape i_entryPt) 767 // { 768 // i_entryPt.updateMLS (); 769 // 770 // return; 771 // } 772 // 773 // public void Visit (EntryConnection i_enter) 774 // { 775 // return; 776 // } 777 // 778 // public void Visit (Connection conn) 779 // { 780 // return; 781 // } 782 // 783 // public void Visit (ControlResourceShape i_controlResource) 784 // { 785 // i_controlResource.updateMLS (); 786 // 787 // return; 788 // } 789 // } 693 790 } branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/figure/PolicyComponentFigure.java
r1825 r1953 15 15 import org.eclipse.ui.ISharedImages; 16 16 import org.eclipse.ui.PlatformUI; 17 18 17 import org.eclipse.draw2d.ColorConstants; 19 18 import org.eclipse.draw2d.Graphics; branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/ControlResourceShape.java
r1825 r1953 26 26 import com.tresys.framework.compiler.dictionary.Dictionary; 27 27 import com.tresys.framework.compiler.dictionary.Rdef; 28 import com.tresys.framework.compiler.mls.MLSLevel; 29 import com.tresys.framework.compiler.mls.MLSSupport; 28 30 import com.tresys.framework.compiler.policy.Access; 29 31 import com.tresys.framework.compiler.policy.AccessResource; 30 32 import com.tresys.framework.compiler.policy.Component; 33 import com.tresys.framework.compiler.policy.ComponentWithDictObjects; 31 34 import com.tresys.framework.compiler.policy.ControlResource; 32 35 import com.tresys.framework.compiler.policy.Domain; … … 37 40 import com.tresys.framework.plugin.builder.SELinuxSystem; 38 41 import com.tresys.framework.plugin.editor.policy.graphic.IShapeVisitor; 42 import com.tresys.framework.plugin.preferences.SEFPreferencePage; 39 43 import com.tresys.framework.plugin.wizards.ControlResourcePropertyWizard; 40 44 … … 53 57 private String [] m_rdefNames; 54 58 private int m_nPosition = PositionConstants.NONE; 59 60 private MLSSupport _levels = null; 61 private static final String MLS_LEVEL_PROPERTY_NAME = "MLS Level"; 62 55 63 56 64 public ControlResourceShape (SELinuxSystem i_system) … … 183 191 public IPropertyDescriptor [] getPropertyDescriptors() 184 192 { 185 final int nStatPropCount = 1;193 final int nStatPropCount = 2; 186 194 187 195 Policy policy = getPolicy (); … … 234 242 myDescriptors[0] = new ComboBoxPropertyDescriptor (RDEF_PROP, Messages.control_resource, m_rdefNames); 235 243 myDescriptors[0].setCategory(PROP_SECTION_BASE); 244 245 myDescriptors[1] = new PropertyDescriptor(ControlResourceShape.MLS_LEVEL_PROPERTY_NAME,Messages.mls_level); 246 myDescriptors[1].setCategory (PROP_SECTION_BASE); 236 247 237 248 m_descriptors = new IPropertyDescriptor [parentDescriptors.length + myDescriptors.length]; … … 259 270 } 260 271 272 if (ControlResourceShape.MLS_LEVEL_PROPERTY_NAME.equals (propertyId)) 273 { 274 ComponentWithDictObjects component = (ComponentWithDictObjects) this.m_domain.getComponent (); 275 return component.getMLSLabel (); 276 } 277 261 278 return super.getPropertyValue(propertyId); 262 279 } … … 278 295 setName (component.getSubName ()); 279 296 updateAccess(oldRdef); 297 } 298 else if (ControlResourceShape.MLS_LEVEL_PROPERTY_NAME.equals (propertyId)) 299 { 300 ComponentWithDictObjects component = (ComponentWithDictObjects) getComponent(); 301 Integer index = (Integer)value; 302 MLSLevel mls = _levels.getLevelOrderedAt (index.intValue ()); 303 304 component.setMLSLabel (mls.getName ()); 280 305 } 281 306 else … … 410 435 return verbs; 411 436 } 437 438 // public void updateMLS() 439 // { 440 // ComponentWithDictObjects component = (ComponentWithDictObjects) getComponent(); 441 // 442 // firePropertyChange(Shape.MLS_PROP, null, component.getMLSLabel ()); 443 // 444 // return; 445 // } 446 // 447 // public void updateDefaultMLS() 448 // { 449 // ComponentWithDictObjects component = (ComponentWithDictObjects) getComponent(); 450 // 451 // firePropertyChange(SEFPreferencePage.DEFAULT_MLS_LEVEL, null, component.getMLSLabel ()); 452 // 453 // return; 454 // } 455 412 456 } branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/DomainShape.java
r1936 r1953 9 9 package com.tresys.framework.plugin.editor.policy.graphic.model; 10 10 11 import java.io.File; 11 12 import java.util.Collection; 12 13 import java.util.Iterator; … … 14 15 import java.util.Vector; 15 16 17 import org.eclipse.core.resources.IFile; 18 import org.eclipse.core.resources.IProject; 19 import org.eclipse.core.resources.IResource; 20 import org.eclipse.core.runtime.IPath; 21 import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; 16 22 import org.eclipse.draw2d.PositionConstants; 17 23 import org.eclipse.draw2d.geometry.Dimension; … … 30 36 import com.tresys.framework.compiler.dictionary.SysResourceState; 31 37 import com.tresys.framework.compiler.linkage.flnkage.Ability; 38 import com.tresys.framework.compiler.mls.MLSLevel; 39 import com.tresys.framework.compiler.mls.MLSSupport; 32 40 import com.tresys.framework.compiler.policy.Domain; 33 41 import com.tresys.framework.compiler.policy.EntrypointResource; … … 37 45 import com.tresys.framework.compiler.systemResources.SystemResourceTypes; 38 46 import com.tresys.framework.plugin.FRAMEWORKImageRegistry; 47 import com.tresys.framework.plugin.builder.FrameworkNature; 39 48 import com.tresys.framework.plugin.builder.SELinuxSystem; 40 49 import com.tresys.framework.plugin.editor.policy.graphic.IShapeVisitable; … … 43 52 import com.tresys.framework.plugin.editor.properties.PathPropertyDescriptor; 44 53 import com.tresys.framework.plugin.editor.properties.PathRdefEditContainer; 54 import com.tresys.framework.plugin.preferences.SEFPreferencePage; 45 55 import com.tresys.framework.plugin.wizards.ShapePropertyWizard; 46 56 … … 53 63 private IPropertyDescriptor[] m_descriptors; 54 64 65 private MLSSupport _levels = null; 66 55 67 private static final Image DOMAIN_ICON = createImage(FRAMEWORKImageRegistry.DOMAIN_ICON); 56 68 … … 68 80 Domain dom = new Domain (tok, null, i_system.getPolicy()); 69 81 70 setComponent (dom); 82 setComponent (dom); 71 83 } 72 84 … … 119 131 public IPropertyDescriptor [] getPropertyDescriptors() 120 132 { 121 if (m_descriptors == null) 133 String [] values = null; 134 Iterator _iter = null; 135 136 // if (m_descriptors == null) 122 137 { 123 138 final int nStatPropCount = 2; … … 168 183 169 184 // Fetch project to get the current MLS Level configuration definitions 170 String [] values = new String [] { "mls-low", "mls-high"}; 185 this.initializeMLSSupport (); 186 187 values = new String[_levels.size ()]; 188 _iter = _levels.iterator (); 189 190 while (_iter.hasNext ()) 191 { 192 MLSLevel mls = (MLSLevel)_iter.next (); 193 values[mls.getOrder ()] = mls.getName (); 194 } 195 171 196 // myDescriptors[1] = new TextPropertyDescriptor(DomainShape.MLS_LEVEL_PROPERTY_NAME, Messages.mls_level); 172 197 myDescriptors[1] = new ComboBoxPropertyDescriptor(DomainShape.MLS_LEVEL_PROPERTY_NAME, Messages.mls_level, values); 173 myDescriptors[1].setCategory (PROP_SECTION_BASE); 174 198 myDescriptors[1].setCategory (PROP_SECTION_BASE); 199 200 175 201 { 176 202 Iterator itr = rdefVec.iterator(); … … 238 264 239 265 IPropertyDescriptor [] returnDescriptors = m_descriptors; 240 266 241 267 Domain dom = (Domain) getComponent(); 242 268 if (dom != null && dom.GetChildren().isEmpty()) … … 299 325 if (DomainShape.MLS_LEVEL_PROPERTY_NAME.equals (propertyId)) 300 326 { 301 return "mls-low"; 327 Domain dom = (Domain)getComponent (); 328 int index = 0; 329 String name = dom.getMLSLabel (); 330 if (null != name) 331 { 332 index = _levels.orderOf (name); 333 334 if (-1 == index) 335 { 336 index = 0; 337 } 338 } 339 340 return new Integer(index); 302 341 } 303 342 … … 328 367 } 329 368 else 369 { 330 370 dom.ClearRdef ((Rdef) propertyId); 371 } 331 372 } 332 373 else if (propertyId instanceof PathRdefEditContainer) … … 334 375 ((PathRdefEditContainer) propertyId).setPath((Domain) getComponent(), (String) value); 335 376 } 377 else if (DomainShape.MLS_LEVEL_PROPERTY_NAME.equals (propertyId)) 378 { 379 Domain dom = (Domain)getComponent (); 380 Integer index = (Integer)value; 381 MLSLevel mls = _levels.getLevelOrderedAt (index.intValue ()); 382 383 String oldName = dom.getMLSLabel (); 384 385 dom.setMLSLabel (mls.getName ()); 386 387 firePropertyChange(Shape.MLS_PROP, oldName, mls.getName ()); 388 } 336 389 else 390 { 337 391 super.setPropertyValue (propertyId, value); 392 } 393 394 return; 338 395 } 339 396 … … 361 418 return (Domain) getComponent(); 362 419 } 420 363 421 364 422 public void setLocation (Point newLocation) … … 483 541 return m_availableEntrypoints; 484 542 } 543 544 protected void initializeMLSSupport() 545 { 546 // Has Initialization taken place 547 if (null == _levels) 548 { 549 // Has 'someone' else initialized the MLS Configuration settings 550 _levels = MLSSupport.getInstance (); 551 552 if (null == _levels) 553 { 554 // Prepare to load the MLS Level configuration from the 555 // file system, where it was persisted. 556 IProject ip = ((IResource)this.m_system.getAdapter (IResource.class)).getProject (); 557 FrameworkNature fn = FrameworkNature.getNature (ip); 558 559 if (null != fn) 560 { 561 try 562 { 563 _levels = fn.getMLSSupport(); 564 } 565 catch (Exception e) 566 { 567 // Establish a minimal MLS configuration 568 // if it can't be loaded from the file system. 569 IFile _if = fn.getSupportFolder ().getFile (FrameworkNature.MLS_CONFIGURATION_FILE); 570 IPath ipFull = _if.getLocation (); 571 File file = ipFull.toFile (); 572 _levels = new MLSSupport(file.getAbsolutePath ()); 573 574 } 575 } 576 } 577 } 578 579 return; 580 } 581 582 // public void updateMLS() 583 // { 584 // Domain dom = (Domain)getComponent (); 585 // 586 // firePropertyChange(Shape.MLS_PROP, null, dom.getMLSLabel ()); 587 // } 588 // 589 // public void updateDefaultMLS(PreferenceChangeEvent event) 590 // { 591 // Domain dom = (Domain)getComponent (); 592 // 593 // firePropertyChange(SEFPreferencePage.DEFAULT_MLS_LEVEL, event.getOldValue (), dom.getMLSLabel ()); 594 // } 485 595 } branches/mls/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/EntryPointShape.java
r1825
