コード例 #1
0
  public void actionPerformed(final ActionEvent e) {
    final ModeController modeController = Controller.getCurrentModeController();
    final Controller controller = modeController.getController();
    final NodeModel selected = controller.getSelection().getSelected();
    if (selected.depth() < 2) {
      UITools.errorMessage(TextUtils.getText("can_not_delete_style_group"));
      return;
    }
    final MapModel map = selected.getMap();
    final MapStyleModel styleModel = MapStyleModel.getExtension(map);
    final NodeModel styleNodeGroup = styleModel.getStyleNodeGroup(selected);
    if (!((StyleNamedObject) styleNodeGroup.getUserObject())
        .getObject()
        .equals("styles.user-defined")) {
      UITools.errorMessage(TextUtils.getText("can_not_delete_predefined_style"));
      return;
    }
    final MMapController mapController = (MMapController) modeController.getMapController();
    mapController.deleteNode(selected);
    final IActor actor =
        new IActor() {
          public void undo() {
            styleModel.addStyleNode(selected);
          }

          public String getDescription() {
            return "DeleteStyle";
          }

          public void act() {
            styleModel.removeStyleNode(selected);
          }
        };
    Controller.getCurrentModeController().execute(actor, map);
  }
コード例 #2
0
ファイル: MUIFactory.java プロジェクト: JoaoBarreto/freeplane
 private void updateMapStyles(final MapModel newMap) {
   ignoreChangeEvent = true;
   styles.removeAllElements();
   if (newMap == null) {
     return;
   }
   final Collection<IStyle> styleObjects = MapStyleModel.getExtension(newMap).getStyles();
   for (final IStyle style : styleObjects) {
     styles.addElement(style);
   }
   ignoreChangeEvent = false;
 }