Changeset 1456
- Timestamp:
- 02/02/07 11:51:47
(2 years ago)
- Author:
- dsugar
- Message:
Fix ticket:108 problem with domains being created at random.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1437 |
r1456 |
|
| 20 | 20 | |
|---|
| 21 | 21 | import org.eclipse.gef.commands.CommandStack; |
|---|
| | 22 | import org.eclipse.jface.window.Window; |
|---|
| 22 | 23 | import org.eclipse.jface.wizard.WizardDialog; |
|---|
| 23 | 24 | import org.eclipse.swt.graphics.Image; |
|---|
| … | … | |
| 53 | 54 | /** The bounds of the new Shape. */ |
|---|
| 54 | 55 | private Rectangle m_bounds; |
|---|
| | 56 | |
|---|
| | 57 | private boolean m_bWasInserted = false; |
|---|
| 55 | 58 | |
|---|
| 56 | 59 | /** |
|---|
| … | … | |
| 95 | 98 | if (size.width > 0 && size.height > 0) |
|---|
| 96 | 99 | m_newShape.setSize(size); |
|---|
| 97 | | |
|---|
| 98 | | setLabel (Messages.creation + " " + m_newShape.getName()); |
|---|
| 99 | | |
|---|
| 100 | | if ( m_newShape.getComponent() != null ) |
|---|
| | 100 | |
|---|
| | 101 | |
|---|
| | 102 | if (m_newShape.getComponent() != null) |
|---|
| 101 | 103 | { |
|---|
| 102 | 104 | redo(); |
|---|
| 103 | | } |
|---|
| 104 | | //Dialog block to get the initial information for the shape |
|---|
| 105 | | if ( m_newShape.getWizard() != null ) |
|---|
| 106 | | { |
|---|
| 107 | | WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), m_newShape.getWizard()); |
|---|
| 108 | | dlg.setBlockOnOpen (true); |
|---|
| 109 | | dlg.open(); |
|---|
| | 105 | |
|---|
| | 106 | //Dialog block to get the initial information for the shape |
|---|
| | 107 | if (m_newShape.getWizard() != null) |
|---|
| | 108 | { |
|---|
| | 109 | WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), m_newShape.getWizard()); |
|---|
| | 110 | dlg.setBlockOnOpen (true); |
|---|
| | 111 | m_bWasInserted = dlg.open() == Window.OK; |
|---|
| | 112 | } |
|---|
| | 113 | |
|---|
| | 114 | if (m_bWasInserted) |
|---|
| | 115 | { |
|---|
| | 116 | setLabel (Messages.creation + " " + m_newShape.getName()); |
|---|
| | 117 | } |
|---|
| 110 | 118 | } |
|---|
| 111 | 119 | |
|---|
| 112 | 120 | //If shape properties are not complete then remove from policy |
|---|
| 113 | | if (!m_newShape.isShapeComplete() ) |
|---|
| | 121 | if (!m_bWasInserted) |
|---|
| 114 | 122 | { |
|---|
| 115 | 123 | undo(); |
|---|
| 116 | 124 | } |
|---|
| 117 | 125 | |
|---|
| | 126 | } |
|---|
| | 127 | |
|---|
| | 128 | public boolean canUndo () |
|---|
| | 129 | { |
|---|
| | 130 | return m_bWasInserted; |
|---|
| 118 | 131 | } |
|---|
| 119 | 132 | |
|---|
| r1437 |
r1456 |
|
| 69 | 69 | public Wizard getWizard() |
|---|
| 70 | 70 | { |
|---|
| 71 | | if ( getComponent() != null ) |
|---|
| | 71 | if (getComponent() != null) |
|---|
| 72 | 72 | return new BaseDomainPropertyWizard(this); |
|---|
| 73 | 73 | |
|---|
| 74 | | else |
|---|
| 75 | | { |
|---|
| 76 | | setShapeComplete(false); |
|---|
| 77 | | return null; |
|---|
| 78 | | } |
|---|
| 79 | | |
|---|
| | 74 | return null; |
|---|
| 80 | 75 | } |
|---|
| 81 | 76 | |
|---|
| r1437 |
r1456 |
|
| 68 | 68 | public Wizard getWizard() |
|---|
| 69 | 69 | { |
|---|
| 70 | | if (getComponent() != null ) |
|---|
| | 70 | if (getComponent() != null) |
|---|
| 71 | 71 | return new BaseResourcePropertyWizard(this); |
|---|
| 72 | | |
|---|
| 73 | | else |
|---|
| 74 | | { |
|---|
| 75 | | setShapeComplete(false); |
|---|
| 76 | | return null; |
|---|
| 77 | | } |
|---|
| | 72 | return null; |
|---|
| 78 | 73 | } |
|---|
| 79 | 74 | |
|---|
| r1453 |
r1456 |
|
| 78 | 78 | } |
|---|
| 79 | 79 | |
|---|
| | 80 | public Policy getPolicy () |
|---|
| | 81 | { |
|---|
| | 82 | if (getParent () == null) |
|---|
| | 83 | return null; |
|---|
| | 84 | |
|---|
| | 85 | return getParent ().getPolicy(); |
|---|
| | 86 | } |
|---|
| | 87 | |
|---|
| 80 | 88 | /* |
|---|
| 81 | 89 | * Returns a wizard dialog for initial shape information |
|---|
| r1437 |
r1456 |
|
| 123 | 123 | protected PolicyDiagram parent = null; |
|---|
| 124 | 124 | final protected SELinuxSystem m_system; |
|---|
| 125 | | private boolean shapeInfoComplete = false; |
|---|
| 126 | 125 | |
|---|
| 127 | 126 | public Shape (SELinuxSystem i_system, Component i_component) |
|---|
| … | … | |
| 238 | 237 | return i_pd.getPolicy(); |
|---|
| 239 | 238 | } |
|---|
| | 239 | |
|---|
| 240 | 240 | public Policy getPolicy () |
|---|
| 241 | 241 | { |
|---|
| … | … | |
| 466 | 466 | String oldName = getComponent().getName(); |
|---|
| 467 | 467 | |
|---|
| 468 | | if (pol.Rename(getComponent(), i_sName)) |
|---|
| | 468 | if (pol != null && pol.Rename(getComponent(), i_sName)) |
|---|
| 469 | 469 | firePropertyChange(NAME_PROP, oldName, getComponent().getName()); |
|---|
| 470 | 470 | } |
|---|
| … | … | |
| 665 | 665 | } |
|---|
| 666 | 666 | } |
|---|
| 667 | | |
|---|
| 668 | | public void setShapeComplete(boolean i_complete) |
|---|
| 669 | | { |
|---|
| 670 | | shapeInfoComplete = i_complete; |
|---|
| 671 | | } |
|---|
| 672 | | |
|---|
| 673 | | public boolean isShapeComplete() |
|---|
| 674 | | { |
|---|
| 675 | | return shapeInfoComplete; |
|---|
| 676 | | } |
|---|
| 677 | 667 | } |
|---|
| r1437 |
r1456 |
|
| 29 | 29 | m_shape = i_shape; |
|---|
| 30 | 30 | setDefaultPageImageDescriptor (SEFramework_Plugin.getDefault ().getImageRegistry ().getDescriptor (FRAMEWORKImageRegistry.FRAMEWORK_ICON)); |
|---|
| 31 | | m_shape.setShapeComplete(false); |
|---|
| 32 | 31 | } |
|---|
| 33 | 32 | |
|---|
| … | … | |
| 50 | 49 | m_shape.setComponent(m_selectedBaseDomain); |
|---|
| 51 | 50 | |
|---|
| 52 | | m_shape.setShapeComplete(true); |
|---|
| 53 | | |
|---|
| 54 | 51 | return true; |
|---|
| 55 | 52 | } |
|---|
| r1437 |
r1456 |
|
| 29 | 29 | m_shape = i_shape; |
|---|
| 30 | 30 | setDefaultPageImageDescriptor (SEFramework_Plugin.getDefault ().getImageRegistry ().getDescriptor (FRAMEWORKImageRegistry.FRAMEWORK_ICON)); |
|---|
| 31 | | m_shape.setShapeComplete(false); |
|---|
| 32 | 31 | } |
|---|
| 33 | 32 | |
|---|
| … | … | |
| 49 | 48 | |
|---|
| 50 | 49 | m_shape.setComponent(m_selectedBaseResource); |
|---|
| 51 | | |
|---|
| 52 | | m_shape.setShapeComplete(true); |
|---|
| 53 | 50 | |
|---|
| 54 | 51 | return true; |
|---|
| r1437 |
r1456 |
|
| 33 | 33 | { |
|---|
| 34 | 34 | super (i_shape); |
|---|
| 35 | | getShape().setShapeComplete(false); |
|---|
| 36 | 35 | } |
|---|
| 37 | 36 | |
|---|
| … | … | |
| 59 | 58 | m_path = m_resourcePageInfo.getResourcePath(); |
|---|
| 60 | 59 | m_rdef = m_resourcePageInfo.getRDefSelected(); |
|---|
| | 60 | |
|---|
| 61 | 61 | //m_pd.addChild (getShape()); |
|---|
| 62 | | if ( getShape() instanceof ResourceShape ) |
|---|
| | 62 | if (getShape() instanceof ResourceShape) |
|---|
| 63 | 63 | { |
|---|
| 64 | 64 | //set the shape name |
|---|
| … | … | |
| 75 | 75 | component.SetRdef(m_rdef, new Token (m_rdef.GetName (), ((ResourceShape) getShape()).getErrorHandler())); |
|---|
| 76 | 76 | |
|---|
| 77 | | ((ResourceShape) getShape()).updatePath(); |
|---|
| 78 | | |
|---|
| 79 | | getShape().setShapeComplete(true); |
|---|
| | 77 | ((ResourceShape) getShape()).updatePath(); |
|---|
| | 78 | return true; |
|---|
| 80 | 79 | } |
|---|
| 81 | | return true; |
|---|
| | 80 | |
|---|
| | 81 | return false; |
|---|
| 82 | 82 | } |
|---|
| 83 | 83 | |
|---|
| r1437 |
r1456 |
|
| 39 | 39 | setDefaultPageImageDescriptor (SEFramework_Plugin.getDefault ().getImageRegistry ().getDescriptor (FRAMEWORKImageRegistry.FRAMEWORK_ICON)); |
|---|
| 40 | 40 | m_shape = i_shape; |
|---|
| 41 | | m_shape.setShapeComplete(false); |
|---|
| 42 | 41 | } |
|---|
| 43 | 42 | |
|---|
| … | … | |
| 66 | 65 | } |
|---|
| 67 | 66 | |
|---|
| 68 | | m_shape.setShapeComplete(true); |
|---|
| 69 | | |
|---|
| 70 | 67 | return true; |
|---|
| 71 | 68 | } |
|---|
Download in other formats:
* Generating other formats may take time.