Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[bpel-dev] refresh all Activities of bpel-editor

hello, Michael,

i have build an extension-point with name "customervisual" in bpel.ui for bpel-editor, the new extension is to change the default behavior of the the activitiy nodes. For exsample, the "
org.eclipse.bpel.ui.editparts.borders.LeafBorder" has an extension class "iaas.bpel.ui.editpart.borders.LeafBorder", the shape of elements border will be adjusted by the extensions:

in the org.eclipse.bpel.ui.editparts.borders.LeafBorder i have made some modifies in paint( ):
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public void paint(IFigure figure, Graphics graphics, Insets insets) {
       if (BPELUIRegistry.ExtensionCustomervisualAktiv == true && extension != null)
        {
            extension.paint(figure, graphics, insets);
        }   
        else
        {   // the original codes of paint() method    
            this.bounds = figure.getBounds();
            this.bounds.x = this.bounds.x;
            .......
        }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

For switching between the "original visualization" and the "customer viusalization", i have built a actionSet button, which by clicking event will change the value of  "Boolean BPELUIRegistry.ExtensionCustomervisualAktiv".

The poblem is, after click the button "customer viusalization", the value of BPELUIRegistry.ExtensionCustomervisualAktiv has been changed.
But to show the changes,  the bpel-editor need a refresh() of reload() to paint the activity nodes again, i have searched for a long time, but didn't get the point:

the codes in the run() method of the actionSet:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public class customervisualAction implements IWorkbenchWindowActionDelegate {

...
    public void run(IAction action) {

       
        if (BPELUIRegistry.ExtensionCustomervisualAktiv == false)
              BPELUIRegistry.ExtensionCustomervisualAktiv = true;
        else
            BPELUIRegistry.ExtensionCustomervisualAktiv = false;
 

// To refresh() the bpeleditor or repaint the editpait
      
//----------------------------------------------1. trying:----------------------------------------------
// here i have found the actuell bpel editor, and tried to refresh this, but nothing happen.

       IWorkbenchPage page = this.window.getActivePage();
       BPELMultipageEditorPart editorpart = (BPELMultipageEditorPart)page.getActiveEditor();
       org.eclipse.bpel.ui.BPELEditor  bpeleditor =  editorpart.getDesignEditor();   
       bpeleditor.refreshGraphicalViewer();
     
//-----------------------------------------------2. trying------------------------------------------------------
//here i have get the leaf activity node in bpel editor

       RootEditPart  root = editorpart.getDesignEditor().getGraphicalViewer().getRootEditPart();
        List children = root.getChildren();                         // children:  [0]=>processEditPart
       
        ProcessEditPart processEditPart = (ProcessEditPart) children.get(0);
        children = processEditPart.getChildren();          // children :  [0]=>startEditPart [1]=>SequenceEditPart [2]=>EndNodeEditPart
        SequenceEditPart maineditpart =  (SequenceEditPart) children.get(1);
        children =  maineditpart.getChildren();              // children:  [0]=>LeafEditPart [1]=>LeafEditPart [2]=>SequenceEditPart
        LeafEditPart leafeditpart = (LeafEditPart) children.get(0);
        //i have tried to use the following methods  to make the node to refresh it figure, but not work!
        leafeditpart.createFigure();
        leafeditpart.refresh();
        leafeditpart.refreshVisuals();
        leafeditpart.regenerateVisuals();
        leafeditpart.getFigure().repaint();
}

//-----------------------------------------------3. trying------------------------------------------------------
//send a fake event message:
  Activity a = editorpart.getDesignEditor().getProcess().getActivity();
  a.eNotify(new ENotificationImpl((InternalEObject) a,
                Notification.SET, BPELPackage.PROCESS__ACTIVITY,
                a, a));

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

mein question is , how can can i refresh the editor to repaint the activity nodes?

Best regards!


Zhen Zeng



Back to the top