Search in sources :

Example 1 with SwitchWorkspaceAction

use of com.cubrid.common.ui.common.action.SwitchWorkspaceAction in project cubrid-manager by CUBRID.

the class SelectWorkspaceDialog method getWorkspaceMenu.

/**
	 * 
	 * Get workspace menu
	 * 
	 * @param productName String
	 * @param productVersion String
	 * @return MenuManager
	 */
public static MenuManager getWorkspaceMenu(String productName, String productVersion) {
    MenuManager workspaceMenu = new MenuManager(Messages.menuSwitchWorkspace);
    String lastUsed = PREFERENCES.get(KEY_LAST_WORKSPACE, null);
    String recentUsed = PREFERENCES.get(KEY_RECENT_WORKSPACES, null);
    if (recentUsed != null) {
        String[] all = recentUsed.split(WORKSPACE_SPLIT_CHAR);
        for (String str : all) {
            if (str.equals(lastUsed)) {
                continue;
            }
            SwitchWorkspaceAction action = new SwitchWorkspaceAction(str, productName, productVersion, false);
            workspaceMenu.add(action);
        }
    }
    workspaceMenu.add(new Separator());
    workspaceMenu.add(new SwitchWorkspaceAction(Messages.menuOther, productName, productVersion, true));
    return workspaceMenu;
}
Also used : SwitchWorkspaceAction(com.cubrid.common.ui.common.action.SwitchWorkspaceAction) MenuManager(org.eclipse.jface.action.MenuManager) Separator(org.eclipse.jface.action.Separator)

Aggregations

SwitchWorkspaceAction (com.cubrid.common.ui.common.action.SwitchWorkspaceAction)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Separator (org.eclipse.jface.action.Separator)1