@Override
 protected void doExecute() {
   if (designEditor != null) {
     GraphicalViewer graphicalViewer = designEditor.getGraphicalViewer();
     if (graphicalViewer != null && graphicalViewer.getEditPartRegistry() != null) {
       ScalableFreeformRootEditPart rootEditPart =
           (ScalableFreeformRootEditPart)
               graphicalViewer.getEditPartRegistry().get(LayerManager.ID);
       IFigure gridFigure = ((LayerManager) rootEditPart).getLayer(LayerConstants.GRID_LAYER);
       IColorConstant cc =
           StyleUtil.getColorConstant(
               PreferenceManager.getInstance()
                   .loadPreferenceAsString(PreferencesConstants.EDITOR_GRID_COLOR));
       Diagram diagram = designEditor.getDiagramTypeProvider().getDiagram();
       if (cc != null && diagram != null) {
         GraphicsAlgorithm ga = diagram.getGraphicsAlgorithm();
         if (ga != null) {
           ga.setForeground(GraphitiUi.getGaService().manageColor(diagram, cc));
           gridFigure.repaint();
           gridFigure.revalidate();
           designEditor.getDiagramBehavior().refreshContent();
         }
       }
     }
   }
 }
Exemple #2
0
 protected void handleResize() {
   slotFigure.revalidate();
 }