package org.dbflute.erflute.editor.view.action.outline;

import java.util.List;

import org.dbflute.erflute.core.DisplayMessages;
import org.dbflute.erflute.editor.model.ERDiagram;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.ermodel.ERVirtualDiagram;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.ui.parts.TreeViewer;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.PlatformUI;

public class ChangeNameAction extends AbstractOutlineBaseAction {

    public static final String ID = ChangeNameAction.class.getName();

    public ChangeNameAction(TreeViewer treeViewer) {
        super(ID, DisplayMessages.getMessage("action.title.change.name"), treeViewer);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void execute(Event event) {

        ERDiagram diagram = this.getDiagram();

        List selectedEditParts = this.getTreeViewer().getSelectedEditParts();
        EditPart editPart = (EditPart) selectedEditParts.get(0);
        Object model = editPart.getModel();
        if (model instanceof ERVirtualDiagram) {
            ERVirtualDiagram ermodel = (ERVirtualDiagram) model;

            InputDialog dialog =
                    new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "���O�ύX",
                            "�_�C�A�O����������͂��ĉ������B", ermodel.getName(), null);
            if (dialog.open() == IDialogConstants.OK_ID) {
                ermodel.setName(dialog.getValue());
                diagram.getDiagramContents().getVirtualDiagramSet().changeModel(ermodel);
                ermodel.getDiagram().getEditor().setDirty(true);
                //				ermodel.changeAll();
                //				AddERModelCommand command = new AddERModelCommand(diagram, dialog.getValue());
                //				this.execute(command);
            }
        }

    }

}

@@ -78,57 +78,8 @@
 t;%0A%0A
-import org.dbflute.erflute.core.DisplayMessages;%0A
 impo
@@ -681,62 +681,16 @@
 ID, 
-DisplayMessages.getMessage(%22action.title.change.
+%22Re
 name%22
-)
 , tr
@@ -806,16 +806,22 @@
         
+final 
 ERDiagra
@@ -860,16 +860,22 @@
         
+final 
 List sel
@@ -944,16 +944,22 @@
         
+final 
 EditPart
@@ -1015,16 +1015,22 @@
         
+final 
 Object m
@@ -1118,16 +1118,22 @@
         
+final 
 ERVirtua
@@ -1190,16 +1190,22 @@
         
+final 
 InputDia

fix change name text