use of com.cubrid.cubridmanager.ui.common.navigator.CubridHostNavigatorView in project cubrid-manager by CUBRID.
the class ImportHostsAction method run.
/**
* Import hosts and groups
*/
public void run() {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN | SWT.APPLICATION_MODAL);
String filePath = CommonUIPlugin.getSettingValue("IMPORT_HOSTS_WORKSPACE_KEY");
if (null != filePath) {
dialog.setFilterPath(filePath);
}
dialog.setMessage(Messages.msgSelectWorkspace);
filePath = dialog.open();
if (filePath == null) {
return;
}
final String workspacePath = filePath;
filePath = filePath + File.separator + ".metadata" + File.separator + ".plugins" + File.separator + "org.eclipse.core.runtime" + File.separator + ".settings" + File.separator + "com.cubrid.cubridmanager.ui.prefs";
File file = new File(filePath);
if (file == null || !file.exists()) {
CommonUITool.openErrorBox(Messages.errInvalidWorkspace);
return;
} else {
CommonUIPlugin.putSettingValue("IMPORT_HOSTS_WORKSPACE_KEY", workspacePath);
}
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
CMGroupNodePersistManager groupNodePersistManager = CMGroupNodePersistManager.getInstance();
boolean isImportHost = CMHostNodePersistManager.getInstance().loadSevers(workspacePath);
boolean isImportGroup = groupNodePersistManager.loadGroupNode(workspacePath);
boolean isImportDb = CMDBNodePersistManager.getInstance().loadDatabases(workspacePath);
if (isImportHost || isImportGroup || isImportDb) {
CubridHostNavigatorView view = (CubridHostNavigatorView) CubridNavigatorView.getNavigatorView(CubridHostNavigatorView.ID);
if (view != null && view.getViewer() != null) {
view.getViewer().refresh(true);
}
}
}
});
}
Aggregations