Override the configuregraphicalviewer () method of xxxdiagrameditor. Add the followingCodeYou can. However, after a background image is added, the gridlines cannot be displayed, which may be due to the order of layers.
/** * @ Generated not */ Protected Void Configuregraphicalviewer (){ Super . Configuregraphicalviewer (); ////// Background layer ////////////////// Layer backgroundlayer = New Layer () {@ override Protected Void Paintfigure (Graphics graphics ){ Super . Paintfigure (graphics); graphics. drawimage (networkdiagrameditorplugin. getinstance (). getbundledimage ( "Images/worldmap_no_text.gif"), 0 , 0 ) ;}}; Backgroundlayer. setsize ( 4990,248 4 ); //////////////////////////////////////// Diagramrooteditpart Root = (Diagramrooteditpart) getdiagramgraphicalviewer (). getrooteditpart (); layeredpane printablelayers = (Layeredpane) root. getlayer (layerconstants. printable_layers); freeformlayer extlabelslayer = New Freeformlayer (); extlabelslayer. setlayoutmanager ( New Delegatinglayout (); printablelayers. addlayerafter (extlabelslayer, networkeditpartfactory. external_node_labels_layer, layerconstants. primary_layer ); ////// Insert background layer ////////// / Printablelayers. addlayerbefore (backgroundlayer, networkeditpartfactory. external_node_labels_layer, layerconstants. primary_layer ); //////////////////////////////////////// Layeredpane scalablelayers = (Layeredpane) root. getlayer (layerconstants. scalable_layers); freeformlayer scaledfeedbacklayer = New Freeformlayer (); scaledfeedbacklayer. setenabled ( False ); Scalablelayers. addlayerafter (scaledfeedbacklayer, layerconstants. scaled_feedback_layer, diagramrooteditpart. decoration_unprintable_layer );}
Reference: Set a background image for the graphic editor