Ignore:
Timestamp:
04/26/07 23:08:52 (17 years ago)
Author:
x07vasba
Message:

Work restructured.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/org.modelica.uml.sysml.diagram2/src/org/modelica/uml/sysml/diagram2/part/SysmlInheritanceDiagramAction.java

    r503 r504  
    172172            if(createdEditPart != null){
    173173               
    174                 //Here we change the name of the displayed figure
    175                 ModelicaClassName2EditPart nameEditPart;
    176                 nameEditPart = (ModelicaClassName2EditPart)createdEditPart.getPrimaryChildEditPart();
    177                 if(nameEditPart != null){
    178                 /*  WrapLabel newName = ((WrapLabel)nameEditPart.getFigure());
    179                     newName.setText(classes[i]);
    180                     nameEditPart.setLabel(newName);
    181                    
    182                    
    183                     if(!nameEditPart.isEditModeEnabled())
    184                         nameEditPart.enableEditMode();
    185                    
    186                     nameEditPart.setLabelText(classes[i]);
    187                    
    188                     ((ClassFigure)createdEditPart.getContentPane()).getFigureClassName().setText(classes[i]);
    189                     */
    190                    
    191                     EObject elementToEdit = ((NodeImpl)createdEditPart.getModel()).getElement();
    192                    
    193                     EStructuralFeature nameFeature = UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
    194                     "name");
    195                    
    196                    
    197                    
    198                     SetRequest setNameRequest = new SetRequest(elementToEdit, nameFeature ,classes[i]);
    199                     SetValueCommand setNameCommand = new SetValueCommand(setNameRequest);
    200                     DiagramCommandStack commandStack = editPart.getDiagramEditDomain()
    201                     .getDiagramCommandStack();
    202         //          ICommandProxy command = ICommandProxy((ICommand)setNameCommand);
    203                     //Command command =
    204                 //  commandStack.execute(setNameCommand,null);
    205                     try{
    206                     setNameCommand.execute(new NullProgressMonitor(), null);
    207                     }
    208                     catch(Exception e){
    209                        
    210                     }
    211                    
    212                    
    213                
    214                     //SetRequest setName = new SetRequest(nameEditPart);
    215                    
    216                     //second try to set class names
    217                 //  TextCellEditor nameCellEditor = new TextCellEditor(nameEditPart);
    218                    
    219                 }
     174                setClassName(createdEditPart,classes[i]);
     175               
    220176                createdNode = new CustomNode(classType.trim(),classes[i],createdEditPart);
    221177
     
    263219        }
    264220
     221    }
     222   
     223    protected void setClassName(ModelicaClassEditPart partToEdit, String newName){
     224
     225        //Here we change the name of the displayed figure
     226
     227        ModelicaClassName2EditPart nameEditPart;
     228
     229        nameEditPart = (ModelicaClassName2EditPart)partToEdit.getPrimaryChildEditPart();
     230        if(nameEditPart != null){
     231
     232            EObject elementToEdit = ((NodeImpl)partToEdit.getModel()).getElement();
     233
     234            EStructuralFeature nameFeature = UMLPackage.eINSTANCE.getNamedElement().getEStructuralFeature(
     235                    "name");
     236
     237
     238
     239            SetRequest setNameRequest = new SetRequest(elementToEdit, nameFeature , newName);
     240            SetValueCommand setNameCommand = new SetValueCommand(setNameRequest);
     241
     242            try{
     243                setNameCommand.execute(new NullProgressMonitor(), null);
     244            }
     245            catch(Exception e){
     246
     247            }
     248
     249        }
     250
     251
     252       
    265253    }
    266254
Note: See TracChangeset for help on using the changeset viewer.