Changeset 1837
- Timestamp:
- 01/17/08 11:55:13 (1 year ago)
- Files:
-
- branches/transwork/framework-plugin/.project (modified) (1 diff)
- branches/transwork/framework-plugin/libselinuxjava/Makefile (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/ErrorHandler.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/dictionary/DictionaryParser.jj (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/dictionary/INameValue.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/linkage/flnkage/FLNKParser.jj (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/policy/BaseDomain.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/policy/Component.java (modified) (4 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/policy/IDomain.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/policy/Policy.java (modified) (6 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/translator/Translator.java (modified) (2 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/compiler/translator/TranslatorSELinux.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkBuilder.java (modified) (5 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkNature.java (modified) (3 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/builder/SELinuxSystem.java (modified) (4 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/FrameworkActionContributor.java (modified) (4 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/dictionary/DictionaryHighlightScanner.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/GraphicPolicyEditor.java (modified) (4 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/AccessConnectionCreateCommand.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/ControlResourceCreateCommand.java (modified) (3 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/ShapeCreateCommand.java (modified) (3 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/decorators/BackflowDecoration.java (modified) (5 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/AccessConnection.java (modified) (9 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/Connection.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/DomainShape.java (modified) (5 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/Messages.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/ResourceShape.java (modified) (2 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/model/messages.properties (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/parts/AccessEditPart.java (modified) (13 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/text/PolicyHoverController.java (modified) (3 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/CollapseAllAction.java (modified) (2 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/FrameworkNavigatorAction.java (modified) (3 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/FrameworkNavigatorActionGroup.java (modified) (2 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/FrameworkNavigatorDeleteAction.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/GotoActionGroup.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/MainActionGroup.java (modified) (2 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/Messages.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/OpenActionGroup.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/WorkspaceActionGroup.java (modified) (9 diffs)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/action/messages.properties (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/views/properties/PolicyPropertySorter.java (modified) (1 diff)
- branches/transwork/framework-plugin/src/com/tresys/framework/plugin/wizards/ResourceShapePropertyPage.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/transwork/framework-plugin/.project
r1542 r1837 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <projectDescription> 3 <name>CDSFramework </name>3 <name>CDSFramework_branch_transwork</name> 4 4 <comment>JavaCC Nature</comment> 5 5 <projects> branches/transwork/framework-plugin/libselinuxjava/Makefile
r1010 r1837 35 35 ln -sf $@ $(TARGET) 36 36 37 %.o: %.c37 %.o:%.c 38 38 $(CC) $(CFLAGS) -c -o $@ $< 39 39 40 %.lo: %.c 40 %.lo:%.c 41 $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< 42 43 selinuxswig_wrap.lo: selinuxswig_wrap.c 41 44 $(CC) $(CFLAGS) -fpic -DSHARED -c -o $@ $< 42 45 branches/transwork/framework-plugin/src/com/tresys/framework/compiler/ErrorHandler.java
r1567 r1837 34 34 static final public int ERROR_RDEF_NOT_DEFINED = 27; 35 35 static final public int ERROR_ENTRYPOINT_MISSING_FILE = 28; 36 static final public int ERROR_DUPLICATE_ACCESS = 29; 36 37 37 38 branches/transwork/framework-plugin/src/com/tresys/framework/compiler/dictionary/DictionaryParser.jj
r1763 r1837 569 569 { 570 570 sval = text.image; 571 if (sval.charAt(0) == '"' && sval.charAt(sval.length()-1) == '"') 572 { 573 sval = sval.substring(1,sval.length()-1); 574 } 575 571 576 }) 572 577 { branches/transwork/framework-plugin/src/com/tresys/framework/compiler/dictionary/INameValue.java
r1176 r1837 18 18 */ 19 19 public interface INameValue { 20 public static final String BACKFLOW = "backflow"; 21 public static final String DESCRIPTION = "desc"; 20 22 21 23 /** branches/transwork/framework-plugin/src/com/tresys/framework/compiler/linkage/flnkage/FLNKParser.jj
r1543 r1837 803 803 { 804 804 sval = text.image; 805 if (sval.charAt(0) == '"' && sval.charAt(sval.length()-1) == '"') 806 { 807 sval = sval.substring(1,sval.length()-1); 808 } 805 809 }) 806 810 { branches/transwork/framework-plugin/src/com/tresys/framework/compiler/policy/BaseDomain.java
r1763 r1837 43 43 super (i_copyMe); 44 44 entries = new Vector/*<Enter>*/(); 45 m_sRole = i_copyMe.m_sRole; 46 45 47 NameValuePairs = new TreeMap/*<String, NameValuePair<?>>*/(); 46 47 entries.addAll(i_copyMe.entries);48 48 NameValuePairs.putAll(i_copyMe.NameValuePairs); 49 49 } branches/transwork/framework-plugin/src/com/tresys/framework/compiler/policy/Component.java
r1763 r1837 18 18 import java.util.Vector; 19 19 20 import com.tresys.framework.compiler.ErrorHandler; 20 21 import com.tresys.framework.compiler.IPolicyVisitable; 21 22 import com.tresys.framework.compiler.IPolicyVisitor; … … 84 85 policy = i_copyMe.policy; 85 86 parent = i_copyMe.parent; 87 m_sType = i_copyMe.m_sType; 88 m_sysResToken = i_copyMe.m_sysResToken; 86 89 } 87 90 … … 261 264 } 262 265 263 public boolean Add(Access axx) { 264 // Needs to check because it seems that baseresources and basedomains 265 // keep their accesses during policy reload and with out the check 266 // the access is added multiple times. DJS 8-Mar-2007 267 if (!accesses.contains(axx)) 268 accesses.add(axx); 266 public boolean Add(Access axx) 267 { 268 // Needs to check because it seems that baseresources and basedomains 269 // keep their accesses during policy reload and with out the check 270 // the access is added multiple times. DJS 8-Mar-2007 271 272 // DJS - now we are clearing accesses from BaseDomains and BaseResources 273 // during reload. If there is an existing access it should now be a 274 // warning - 9-Jan-2008 275 if (accesses.contains(axx)) 276 { 277 m_token.Warning ("Component \"" + getName () + "\" already has access\"" + axx.toString (), ErrorHandler.ERROR_DUPLICATE_ACCESS, axx.toString ()); 278 return false; 279 } 280 281 accesses.add(axx); 269 282 return true; 270 283 } … … 272 285 public boolean Remove(Access i_access) { 273 286 return accesses.remove(i_access); 287 } 288 289 public void ClearAccesses(){ 290 accesses.clear(); 274 291 } 275 292 branches/transwork/framework-plugin/src/com/tresys/framework/compiler/policy/IDomain.java
r1522 r1837 42 42 43 43 public boolean Remove(Access axx); 44 45 public void ClearAccesses (); 44 46 45 47 public Policy getPolicy (); branches/transwork/framework-plugin/src/com/tresys/framework/compiler/policy/Policy.java
r1765 r1837 5 5 * Brian Williams <bwilliams@tresys.com> 6 6 * Policy.java: Contains all objects from a policy file 7 * Version: @version@ 7 * $Rev$ 8 * $Date$ 8 9 */ 9 10 … … 178 179 topLevelDomains.put(dom.getSubName(), dom); 179 180 } 181 182 dom.ClearAccesses(); 180 183 181 184 return true; … … 348 351 m_baseResources.put(baseResource.getName(), baseResource); 349 352 353 baseResource.ClearAccesses (); 354 350 355 return true; 351 356 } … … 477 482 * 478 483 * @return map of domains. 479 * @deprecated remove this tag once we are sure its only called when really needed480 484 */ 481 485 public Map/*<String, IDomain>*/GetDomains() { … … 505 509 * 506 510 * @return map of resources. 507 * @deprecated remove this tag once we are sure its only called when really needed508 511 */ 509 512 public Map/*<String, Resource>*/GetResources() { … … 538 541 * 539 542 * @return map of entrypoints. 540 * @deprecated remove this tag once we are sure its only called when really needed541 543 */ 542 544 public Map/*<EntryPoint>*/GetEntrypoints() { branches/transwork/framework-plugin/src/com/tresys/framework/compiler/translator/Translator.java
r1763 r1837 5 5 * ` Brian Williams <bwilliams@tresys.com> 6 6 * Translator.java: Contains translator class for framework->t.e. conversion 7 * Version: @version@ 7 * $Rev$ 8 * $Date$ 8 9 */ 9 10 … … 494 495 if(strcontext != null) { 495 496 String strcon = selinux.char_p_p_value(strcontext); 496 fileType = strcon.substring(strcon.lastIndexOf(":") + 1); 497 fileConMap.put(path, fileType); 497 498 String [] context = strcon.split (":"); 499 if (context.length > 2) 500 { 501 fileType = context[2]; 502 fileConMap.put(path, fileType); 503 } 498 504 } 499 505 branches/transwork/framework-plugin/src/com/tresys/framework/compiler/translator/TranslatorSELinux.java
r1794 r1837 1 /*################################################################################### 2 # Copyright (C) 2007 Tresys Technology, LLC 3 # License: refer to COPYING file for license information. 4 # Authors: Garth Boyst <gboyst@tresys.com> 5 # 6 # TranslatorSeLinux.java 7 # 8 # 9 ################################################################################## */ 10 11 /** 12 * <p>The Translator class is called to convert SEFramework policy to 13 * the underlying SELinux policy language. The Translator walks through 14 * the SEFramework policy and queries the Linkage class. The Linkage class 15 * tells the Translator how the translation is performed.</p> 16 * 17 * <p>The Translator does contain references to underlying policy code. However, 18 * only policy code that is considered version independent should be placed 19 * directly in the Translator. An example of this is the declaration of a domain. 20 * This would be policy version dependent. However, the creation of AccessResource would 21 * be a straight forward combination of types and Rdef permissions and this would be 22 * handled inside the Translator class.</p> 23 * 24 * <p>The relationship between the Translator and the Linkage is rigoursly defined. 25 * Since both components are writing policy each must understand what the other 26 * is doing and how it is doing it. For example, the naming convention used to 27 * derive types must be understood and used by both Translator and Linkage.</p> 28 */ 29 1 30 package com.tresys.framework.compiler.translator; 2 31 branches/transwork/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkBuilder.java
r1764 r1837 30 30 import com.tresys.framework.compiler.policy.Policy; 31 31 import com.tresys.framework.plugin.SEFramework_Plugin; 32 import com.tresys.slide.plugin.nature.SLIDEProjectNature; 32 33 33 34 public class FrameworkBuilder … … 183 184 if (kind == FULL_BUILD) 184 185 { 185 fullBuild ( monitor);186 fullBuild (args, monitor); 186 187 } 187 188 else … … 191 192 if (delta == null) 192 193 { 193 fullBuild ( monitor);194 fullBuild (args, monitor); 194 195 } 195 196 else … … 217 218 * The monitor for progress of the build 218 219 */ 219 private void fullBuild (final IProgressMonitor monitor) 220 { 220 private void fullBuild (Map i_args, final IProgressMonitor monitor) 221 { 222 String sSystemName = null; 223 224 if (i_args != null) 225 { 226 sSystemName = (String) i_args.get (SLIDEProjectNature.BUILD_CONTAINER_KEY); 227 } 228 221 229 try 222 230 { … … 226 234 { 227 235 SELinuxSystem sys = (SELinuxSystem) itr.next(); 236 237 if (sSystemName != null && !sSystemName.equals (sys.getName ())) 238 continue; 239 228 240 buildSystem(sys); 229 241 } branches/transwork/framework-plugin/src/com/tresys/framework/plugin/builder/FrameworkNature.java
r1777 r1837 7 7 * FrameworkNature.java: The nature associated with Framework projects 8 8 * Version: @version@ 9 */ 9 */ 10 10 11 11 package com.tresys.framework.plugin.builder; … … 162 162 ICommand[] newCommands = new ICommand[commands.length + 1]; 163 163 164 System.arraycopy(commands, 0, newCommands, 0, commands.length);164 System.arraycopy(commands, 0, newCommands, 1, commands.length); 165 165 ICommand command = desc.newCommand(); 166 167 166 command.setBuilderName(FrameworkBuilder.BUILDER_ID); 168 newCommands[newCommands.length - 1] = command; 167 168 newCommands[0] = command; 169 169 170 desc.setBuildSpec(newCommands); 171 172 173 170 174 m_project.setDescription(desc, null); 171 175 } … … 183 187 IProjectDescription description = getProject().getDescription(); 184 188 ICommand[] commands = description.getBuildSpec(); 185 186 for (int i = 0; i < commands.length; ++i) 189 ICommand[] newCommands = new ICommand[commands.length - 1]; 190 191 for (int i = 0, j = 0; i < commands.length; ++i) 187 192 { 188 193 if (commands[i].getBuilderName().equals(FrameworkBuilder.BUILDER_ID)) 189 { 190 ICommand[] newCommands = new ICommand[commands.length - 1]; 191 192 System.arraycopy(commands, 0, newCommands, 0, i); 193 System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1); 194 description.setBuildSpec(newCommands); 195 return; 196 } 197 } 194 continue; 195 196 newCommands[j++] = commands[i]; 197 } 198 199 description.setBuildSpec(newCommands); 198 200 } 199 201 branches/transwork/framework-plugin/src/com/tresys/framework/plugin/builder/SELinuxSystem.java
r1794 r1837 3 3 * Authors: Brian Williams <bwilliams@tresys.com> 4 4 * Spencer Shimko 5 * 5 * Garth Boyst 6 6 * Version: @version@ 7 7 */ … … 9 9 package com.tresys.framework.plugin.builder; 10 10 11 import java.io.BufferedOutputStream;12 11 import java.io.ByteArrayInputStream; 13 12 import java.io.ByteArrayOutputStream; … … 16 15 import java.io.InputStream; 17 16 import java.io.InputStreamReader; 18 import java.io.PrintStream;19 17 import java.util.HashMap; 20 18 import java.util.Map; … … 41 39 import com.tresys.framework.compiler.policy.Policy; 42 40 import com.tresys.framework.compiler.systemResources.SystemResources; 43 import com.tresys.framework.compiler.translator.Translator;44 41 import com.tresys.framework.compiler.translator.TranslatorSELinux; 45 42 import com.tresys.framework.plugin.SEFramework_Plugin; branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/FrameworkActionContributor.java
r1763 r1837 1 /* Copyright (C) 2005-200 6Tresys Technology, LLC1 /* Copyright (C) 2005-2008 Tresys Technology, LLC 2 2 * License: refer to COPYING file for license information. 3 3 * Authors: Spencer Shimko <sshimko@tresys.com> … … 5 5 * Brian Williams <bwilliams@tresys.com> 6 6 * 7 * FrameworkActionContributor.java: This controls what actions are avail ible7 * FrameworkActionContributor.java: This controls what actions are available 8 8 * when a Framework file is open 9 9 * 10 * Version: @version@ 10 * $Rev: 1834 $ 11 * $Date: 2008-01-16 13:57:27 +0000 (Wed, 16 Jan 2008) $ 11 12 */ 12 13 … … 37 38 import org.eclipse.ui.PlatformUI; 38 39 40 import com.tresys.framework.plugin.ErrorConstants; 39 41 import com.tresys.framework.plugin.FRAMEWORKImageRegistry; 40 42 import com.tresys.framework.plugin.SEFramework_Plugin; … … 139 141 "Please specify the correct path the base policy directory in SEFramework Preferences", 140 142 new Status(IStatus.ERROR, 141 SEFramework_Plugin.PLUGIN_ID, IStatus.OK,143 SEFramework_Plugin.PLUGIN_ID, ErrorConstants.ERROR_NO_BASE_POLICY_FOUND, 142 144 "No base policy path specified", null)); 143 145 } branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/dictionary/DictionaryHighlightScanner.java
r1512 r1837 79 79 theKeyWords.addWord("rdef"); 80 80 theKeyWords.addWord("entrypoint"); 81 theKeyWords.addWord("unrevokable"); 81 82 82 83 rules[1] = theKeyWords; branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/GraphicPolicyEditor.java
r1763 r1837 4 4 |*| Author: David Sugar <dsugar@tresys.com> 5 5 |*| 6 |*| Version: @version@ 6 |*| $Rev: 1825 $ 7 |*| $Date: 2008-01-15 13:36:57 +0000 (Tue, 15 Jan 2008) $ 7 8 \*/ 8 9 … … 89 90 import com.tresys.framework.plugin.editor.policy.graphic.model.Shape; 90 91 import com.tresys.framework.plugin.editor.policy.graphic.palette.GraphicPolicyEditorPaletteFactory; 92 import com.tresys.framework.plugin.editor.policy.graphic.palette.PolicyEditDomain; 91 93 import com.tresys.framework.plugin.editor.policy.graphic.palette.PolicyPalette; 92 94 import com.tresys.framework.plugin.editor.policy.graphic.palette.PolicyPaletteProvider; … … 223 225 public void commandStackChanged(EventObject event) 224 226 { 225 firePropertyChange (IEditorPart.PROP_DIRTY);227 firePropertyChange (IEditorPart.PROP_DIRTY); 226 228 super.commandStackChanged(event); 227 229 } … … 480 482 IFile file = (IFile) input.getAdapter(IFile.class); 481 483 482 m_EditDomain = new DefaultEditDomain (this);484 m_EditDomain = new PolicyEditDomain (this); 483 485 // m_EditDomain.setDefaultTool() 484 486 branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/AccessConnectionCreateCommand.java
r1556 r1837 153 153 Set availAccess = m_shapeResource.getAvaiableAccessVerbs(); 154 154 155 int i = 0;156 155 int [] order = { Verb.read, Verb.write, Verb.readwrite, Verb.none }; 157 while (order[i] != m_nVerb.intValue()) 158 i++; 159 while (i < order.length && !availAccess.contains(m_nVerb)) 160 { 161 m_nVerb = new Integer (order[i++]); 162 } 163 164 createSegment(m_shapeDomain, m_shapeResource); 156 if (!availAccess.contains (m_nVerb)) 157 { 158 for (int j = 0; j < order.length && !availAccess.contains (m_nVerb); j++) 159 m_nVerb = new Integer (order[j]); 160 } 161 162 createSegment (m_shapeDomain, m_shapeResource); 165 163 } 166 164 branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/ControlResourceCreateCommand.java
r1512 r1837 31 31 PolicyDiagram m_diagram; 32 32 Rectangle m_bounds; 33 boolean m_bWasInserted = false;34 33 35 34 public ControlResourceCreateCommand (ControlResourceShape i_newShape, PolicyDiagram i_parent, Rectangle i_bounds) … … 137 136 if (bShowWizard) 138 137 { 138 boolean wasInserted = false; 139 139 140 //Dialog block to get the initial information for the shape 140 141 if (m_newShape.getWizard() != null) … … 143 144 m_newShape.getWizard()); 144 145 dlg.setBlockOnOpen (true); 145 m_bWasInserted = dlg.open() == Window.OK; 146 wasInserted = dlg.open() == Window.OK; 147 } 148 149 if (! wasInserted) 150 { 151 undo (); 152 throw new UserCanceledException(); 146 153 } 147 154 } 148 else149 m_bWasInserted = true;150 155 151 if (m_bWasInserted) 152 { 153 setLabel (Messages.creation + " " + m_newShape.getName()); 154 } 155 else 156 { 157 undo (); 158 } 156 setLabel (Messages.creation + " " + m_newShape.getName()); 159 157 } 160 158 branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/commands/ShapeCreateCommand.java
r1693 r1837 55 55 private Rectangle m_bounds; 56 56 57 private boolean m_bWasInserted = false;58 59 57 /** 60 58 * Create a command that will add a new Shape to a ShapesDiagram. … … 109 107 if (bShowWizard) 110 108 { 109 boolean bWasInserted = false; 111 110 Wizard wiz = m_newShape.getWizard(); 112 111 //Dialog block to get the initial information for the shape … … 115 114 WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), wiz); 116 115 dlg.setBlockOnOpen (true); 117 m_bWasInserted = dlg.open() == Window.OK;116 bWasInserted = dlg.open() == Window.OK; 118 117 } 119 } 120 else 121 m_bWasInserted = true; 122 123 if (m_bWasInserted) 124 { 125 setLabel (Messages.creation + " " + m_newShape.getName()); 126 } 118 119 if (!bWasInserted) 120 { 121 undo (); 122 throw new UserCanceledException(); 123 } 124 } 125 126 setLabel (Messages.creation + " " + m_newShape.getName()); 127 127 } 128 129 //If shape properties are not complete then remove from policy 130 if (!m_bWasInserted) 131 { 132 undo(); 133 } 134 135 } 136 137 public boolean canUndo () 138 { 139 return m_bWasInserted; 140 } 141 128 } 129 142 130 /* (non-Javadoc) 143 131 * @see org.eclipse.gef.commands.Command#redo() branches/transwork/framework-plugin/src/com/tresys/framework/plugin/editor/policy/graphic/decorators/BackflowDecoration.java
r1787 r1837 2 2 3 3 4 import org.eclipse.draw2d.FigureUtilities;5 4 import org.eclipse.draw2d.Graphics; 6 5 import org.eclipse.draw2d.PolygonDecoration; 7 import org.eclipse.draw2d.geometry.Dimension;8 import org.eclipse.draw2d.geometry.Point;9 import org.eclipse.draw2d.geometry.Rectangle;10 6 import org.eclipse.jface.resource.JFaceResources; 11 7 import org.eclipse.jface.util.IPropertyChangeListener; 12 8 import org.eclipse.jface.util.PropertyChangeEvent; 9 import org.eclipse.swt.graphics.Color; 10 import org.eclipse.swt.graphics.Device; 13 11 import org.eclipse.swt.graphics.Font; 14 12 import org.eclipse.swt.graphics.FontData; 15 import org.eclipse.swt.graphics. FontMetrics;13 import org.eclipse.swt.graphics.RGB; 16 14 17 15 import com.tresys.framework.plugin.editor.policy.graphic.figure.IFigureColors; 16 18 17 19 18 public class BackflowDecoration … … 21 20 implements IPropertyChangeListener, IFigureColors 22 21 { 22 23 private static final double INTENDEDFLOW_SCALED_WIDTH = 10.0; 24 private static final double INTENDDEDFLOW_SCALED_HEIGHT = 5.0; 25 private static final double BACKFLOW_SCALED_WIDTH = 6.0; 26 private static final double BACKFLOW_SCALED_HEIGHT = 2.0; 27 28 private static int BACKFLOW_MAXIMUM = 10; 29 private static int MAXIMUM_COLOR_TUPLE = 255; 30 private static Color[] BACKFLOW_ARROWHEAD_COLORS; 31 private static Color DEFAULT_START = new Color(null, 128, 0, 128); 32 private static Color DEFAULT_END = new Color(null, 255, 0, 255); 33 34 protected static int selectColorComponentValue(double dValue) 35 { 36 return (int)Math.max (0.0, Math.min (MAXIMUM_COLOR_TUPLE, dValue)); 37 } 38 39 protected static boolean defineArrowHeadColors() 40 { 41 boolean retValue = false; 42 Device device = JFaceResources.getDefaultFont ().getDevice (); 43 Color cRangeStart = JFaceResources.getColorRegistry().get(BACKFLOW_RANGE_START_COLOR); 44 Color cRangeEnd = JFaceResources.getColorRegistry ().get (BACKFLOW_RANGE_END_COLOR); 45 46  
