[Jiemamy-notify:1894] commit [3064] Import成功後、RootEditPartにrefresh () を投げるようにした。

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2009年 4月 3日 (金) 01:15:52 JST


Revision: 3064
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3064
Author:   daisuke_m
Date:     2009-04-03 01:15:52 +0900 (Fri, 03 Apr 2009)

Log Message:
-----------
Import成功後、RootEditPartにrefresh()を投げるようにした。

Modified Paths:
--------------
    hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/action/ImportAction.java


-------------- next part --------------
Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/action/ImportAction.java
===================================================================
--- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/action/ImportAction.java	2009-04-02 16:15:24 UTC (rev 3063)
+++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/action/ImportAction.java	2009-04-02 16:15:52 UTC (rev 3064)
@@ -40,6 +40,7 @@
 import org.jiemamy.composer.ImportException;
 import org.jiemamy.composer.Importer;
 import org.jiemamy.eclipse.editor.JiemamyEditor;
+import org.jiemamy.eclipse.editor.editpart.diagram.RootEditPart;
 import org.jiemamy.eclipse.ui.ImporterWizard;
 import org.jiemamy.eclipse.utils.ExceptionHandler;
 import org.jiemamy.model.RootModel;
@@ -83,17 +84,21 @@
 		this.importer = importer;
 		this.wizard = wizard;
 		this.editor = editor;
-		logger.debug(LogMarker.LIFECYCLE, "instanciated" + importer.getName());
+		
+		assert importer != null;
+		logger.debug(LogMarker.LIFECYCLE, "instanciated " + importer.getName());
 	}
 	
 	@Override
 	public void run() {
 		logger.debug(LogMarker.LIFECYCLE, "run " + importer.getName());
-		RootModel rootModel = (RootModel) getViewer().getContents().getModel();
+		GraphicalViewer viewer = getViewer();
+		RootEditPart rootEditPart = (RootEditPart) viewer.getContents();
+		RootModel rootModel = rootEditPart.getModel();
 		IFileEditorInput input = (IFileEditorInput) editor.getEditorInput();
 		wizard.setInput(input);
 		
-		IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
+		IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
 		List<Object> selectedModels = CollectionsUtil.newArrayList();
 		for (Object selectedObject : selection.toList()) {
 			if (selectedObject instanceof EditPart) {
@@ -102,7 +107,7 @@
 			}
 		}
 		
-		Shell shell = getViewer().getControl().getShell();
+		Shell shell = viewer.getControl().getShell();
 		try {
 			// パラメータを取得
 			WizardDialog dialog = new WizardDialog(shell, wizard);
@@ -116,12 +121,13 @@
 			boolean success = importer.importModel(rootModel, config);
 			
 			if (success) {
+				rootEditPart.refresh();
 				MessageDialog.openInformation(shell, "import succeeded", "インポートが正常に完了しました。"); // RESOURCE
 			} else {
 				MessageDialog.openWarning(shell, "import aborted", "インポートは行われませんでした。"); // RESOURCE
 			}
 		} catch (ImportException e) {
-			ExceptionHandler.handleException(e);
+			ExceptionHandler.handleException(e.getCause());
 		} finally {
 			// リフレッシュ
 			try {



Jiemamy-notify メーリングリストの案内
アーカイブの一覧に戻る