mirror of https://github.com/buggins/dlangide.git
fix #448 - expand all / collapse all for workspace tree
This commit is contained in:
parent
8705aff7df
commit
e0c267080f
2
dub.json
2
dub.json
|
@ -12,7 +12,7 @@
|
||||||
"stringImportPaths": ["views"],
|
"stringImportPaths": ["views"],
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dlangui": "==0.9.139",
|
"dlangui": "==0.9.140",
|
||||||
"dsymbol": "~>0.2.9",
|
"dsymbol": "~>0.2.9",
|
||||||
"dcd": "~>0.9.1"
|
"dcd": "~>0.9.1"
|
||||||
},
|
},
|
||||||
|
|
|
@ -60,6 +60,8 @@ enum IDEActions : int {
|
||||||
ProjectFolderOpenItem,
|
ProjectFolderOpenItem,
|
||||||
ProjectFolderRenameItem,
|
ProjectFolderRenameItem,
|
||||||
ProjectFolderRefresh,
|
ProjectFolderRefresh,
|
||||||
|
ProjectFolderExpandAll,
|
||||||
|
ProjectFolderCollapseAll,
|
||||||
|
|
||||||
GoToDefinition,
|
GoToDefinition,
|
||||||
GetCompletionSuggestions,
|
GetCompletionSuggestions,
|
||||||
|
@ -86,6 +88,9 @@ const Action ACTION_PROJECT_FOLDER_OPEN_ITEM = new Action(IDEActions.ProjectFold
|
||||||
const Action ACTION_PROJECT_FOLDER_REMOVE_ITEM = new Action(IDEActions.ProjectFolderRemoveItem, "MENU_PROJECT_FOLDER_REMOVE_ITEM"c);
|
const Action ACTION_PROJECT_FOLDER_REMOVE_ITEM = new Action(IDEActions.ProjectFolderRemoveItem, "MENU_PROJECT_FOLDER_REMOVE_ITEM"c);
|
||||||
const Action ACTION_PROJECT_FOLDER_RENAME_ITEM = new Action(IDEActions.ProjectFolderRenameItem, "MENU_PROJECT_FOLDER_RENAME_ITEM"c);
|
const Action ACTION_PROJECT_FOLDER_RENAME_ITEM = new Action(IDEActions.ProjectFolderRenameItem, "MENU_PROJECT_FOLDER_RENAME_ITEM"c);
|
||||||
const Action ACTION_PROJECT_FOLDER_REFRESH = new Action(IDEActions.ProjectFolderRefresh, "MENU_PROJECT_FOLDER_REFRESH"c);
|
const Action ACTION_PROJECT_FOLDER_REFRESH = new Action(IDEActions.ProjectFolderRefresh, "MENU_PROJECT_FOLDER_REFRESH"c);
|
||||||
|
const Action ACTION_PROJECT_FOLDER_EXPAND_ALL = new Action(IDEActions.ProjectFolderExpandAll, "MENU_PROJECT_FOLDER_EXPAND_ALL"c);
|
||||||
|
const Action ACTION_PROJECT_FOLDER_COLLAPSE_ALL = new Action(IDEActions.ProjectFolderCollapseAll, "MENU_PROJECT_FOLDER_COLLAPSE_ALL"c);
|
||||||
|
|
||||||
const Action ACTION_FILE_WORKSPACE_CLOSE = new Action(IDEActions.CloseWorkspace, "MENU_FILE_WORKSPACE_CLOSE"c).disableByDefault();
|
const Action ACTION_FILE_WORKSPACE_CLOSE = new Action(IDEActions.CloseWorkspace, "MENU_FILE_WORKSPACE_CLOSE"c).disableByDefault();
|
||||||
|
|
||||||
const Action ACTION_FILE_NEW_SOURCE_FILE = new Action(IDEActions.FileNew, "MENU_FILE_NEW_SOURCE_FILE"c, "document-new", KeyCode.KEY_N, KeyFlag.Control);
|
const Action ACTION_FILE_NEW_SOURCE_FILE = new Action(IDEActions.FileNew, "MENU_FILE_NEW_SOURCE_FILE"c, "document-new", KeyCode.KEY_N, KeyFlag.Control);
|
||||||
|
|
|
@ -928,6 +928,10 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
||||||
case IDEActions.ViewToggleTabPositionMarks:
|
case IDEActions.ViewToggleTabPositionMarks:
|
||||||
a.state = _settings.showTabPositionMarks ? ACTION_STATE_CHECKED : ACTION_STATE_ENABLED;
|
a.state = _settings.showTabPositionMarks ? ACTION_STATE_CHECKED : ACTION_STATE_ENABLED;
|
||||||
return true;
|
return true;
|
||||||
|
case IDEActions.ProjectFolderExpandAll:
|
||||||
|
case IDEActions.ProjectFolderCollapseAll:
|
||||||
|
a.state = currentWorkspace !is null ? ACTION_STATE_ENABLED : ACTION_STATE_DISABLE;
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.handleActionStateRequest(a);
|
return super.handleActionStateRequest(a);
|
||||||
}
|
}
|
||||||
|
@ -1220,6 +1224,12 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
||||||
case IDEActions.ProjectFolderRefresh:
|
case IDEActions.ProjectFolderRefresh:
|
||||||
refreshProjectItem(a.objectParam);
|
refreshProjectItem(a.objectParam);
|
||||||
return true;
|
return true;
|
||||||
|
case IDEActions.ProjectFolderExpandAll:
|
||||||
|
_wsPanel.expandAll(a);
|
||||||
|
return true;
|
||||||
|
case IDEActions.ProjectFolderCollapseAll:
|
||||||
|
_wsPanel.collapseAll(a);
|
||||||
|
return true;
|
||||||
case IDEActions.CloseWorkspace:
|
case IDEActions.CloseWorkspace:
|
||||||
closeWorkspace();
|
closeWorkspace();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -86,8 +86,11 @@ class WorkspacePanel : DockWindow {
|
||||||
_tree.popupMenu = &onTreeItemPopupMenu;
|
_tree.popupMenu = &onTreeItemPopupMenu;
|
||||||
|
|
||||||
_workspacePopupMenu = new MenuItem();
|
_workspacePopupMenu = new MenuItem();
|
||||||
_workspacePopupMenu.add(ACTION_PROJECT_FOLDER_REFRESH,
|
_workspacePopupMenu.add(ACTION_PROJECT_FOLDER_REFRESH,
|
||||||
ACTION_FILE_WORKSPACE_CLOSE);
|
ACTION_FILE_WORKSPACE_CLOSE,
|
||||||
|
ACTION_PROJECT_FOLDER_EXPAND_ALL,
|
||||||
|
ACTION_PROJECT_FOLDER_COLLAPSE_ALL
|
||||||
|
);
|
||||||
|
|
||||||
_projectPopupMenu = new MenuItem();
|
_projectPopupMenu = new MenuItem();
|
||||||
_projectPopupMenu.add(ACTION_PROJECT_SET_STARTUP,
|
_projectPopupMenu.add(ACTION_PROJECT_SET_STARTUP,
|
||||||
|
@ -100,19 +103,22 @@ class WorkspacePanel : DockWindow {
|
||||||
ACTION_PROJECT_UPDATE_DEPENDENCIES,
|
ACTION_PROJECT_UPDATE_DEPENDENCIES,
|
||||||
ACTION_PROJECT_REVEAL_IN_EXPLORER,
|
ACTION_PROJECT_REVEAL_IN_EXPLORER,
|
||||||
ACTION_PROJECT_SETTINGS,
|
ACTION_PROJECT_SETTINGS,
|
||||||
|
ACTION_PROJECT_FOLDER_EXPAND_ALL,
|
||||||
|
ACTION_PROJECT_FOLDER_COLLAPSE_ALL
|
||||||
//ACTION_PROJECT_FOLDER_REMOVE_ITEM
|
//ACTION_PROJECT_FOLDER_REMOVE_ITEM
|
||||||
);
|
);
|
||||||
|
|
||||||
_folderPopupMenu = new MenuItem();
|
_folderPopupMenu = new MenuItem();
|
||||||
_folderPopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE, ACTION_PROJECT_FOLDER_REFRESH, ACTION_PROJECT_FOLDER_OPEN_ITEM,
|
_folderPopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE, ACTION_PROJECT_FOLDER_REFRESH, ACTION_PROJECT_FOLDER_OPEN_ITEM,
|
||||||
|
ACTION_PROJECT_FOLDER_EXPAND_ALL, ACTION_PROJECT_FOLDER_COLLAPSE_ALL
|
||||||
//ACTION_PROJECT_FOLDER_REMOVE_ITEM,
|
//ACTION_PROJECT_FOLDER_REMOVE_ITEM,
|
||||||
//ACTION_PROJECT_FOLDER_RENAME_ITEM
|
//ACTION_PROJECT_FOLDER_RENAME_ITEM
|
||||||
);
|
);
|
||||||
|
|
||||||
_filePopupMenu = new MenuItem();
|
_filePopupMenu = new MenuItem();
|
||||||
_filePopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE, ACTION_PROJECT_FOLDER_REFRESH,
|
_filePopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE, ACTION_PROJECT_FOLDER_REFRESH,
|
||||||
ACTION_PROJECT_FOLDER_OPEN_ITEM,
|
ACTION_PROJECT_FOLDER_OPEN_ITEM,
|
||||||
ACTION_PROJECT_FOLDER_REMOVE_ITEM,
|
ACTION_PROJECT_FOLDER_REMOVE_ITEM,
|
||||||
//ACTION_PROJECT_FOLDER_RENAME_ITEM
|
//ACTION_PROJECT_FOLDER_RENAME_ITEM
|
||||||
);
|
);
|
||||||
return _tree;
|
return _tree;
|
||||||
|
@ -123,6 +129,7 @@ class WorkspacePanel : DockWindow {
|
||||||
protected MenuItem _folderPopupMenu;
|
protected MenuItem _folderPopupMenu;
|
||||||
protected MenuItem _filePopupMenu;
|
protected MenuItem _filePopupMenu;
|
||||||
protected string _popupMenuSelectedItemId;
|
protected string _popupMenuSelectedItemId;
|
||||||
|
protected TreeItem _popupMenuSelectedItem;
|
||||||
protected void onPopupMenuItem(MenuItem item) {
|
protected void onPopupMenuItem(MenuItem item) {
|
||||||
if (item.action)
|
if (item.action)
|
||||||
handleAction(item.action);
|
handleAction(item.action);
|
||||||
|
@ -131,6 +138,7 @@ class WorkspacePanel : DockWindow {
|
||||||
protected MenuItem onTreeItemPopupMenu(TreeItems source, TreeItem selectedItem) {
|
protected MenuItem onTreeItemPopupMenu(TreeItems source, TreeItem selectedItem) {
|
||||||
MenuItem menu = null;
|
MenuItem menu = null;
|
||||||
_popupMenuSelectedItemId = selectedItem.id;
|
_popupMenuSelectedItemId = selectedItem.id;
|
||||||
|
_popupMenuSelectedItem = selectedItem;
|
||||||
if (selectedItem.intParam == ProjectItemType.SourceFolder) {
|
if (selectedItem.intParam == ProjectItemType.SourceFolder) {
|
||||||
menu = _folderPopupMenu;
|
menu = _folderPopupMenu;
|
||||||
} else if (selectedItem.intParam == ProjectItemType.SourceFile) {
|
} else if (selectedItem.intParam == ProjectItemType.SourceFile) {
|
||||||
|
@ -217,6 +225,20 @@ class WorkspacePanel : DockWindow {
|
||||||
_tree.items.setDefaultItem(defaultItem);
|
_tree.items.setDefaultItem(defaultItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void expandAll(const Action a) {
|
||||||
|
if (!_workspace)
|
||||||
|
return;
|
||||||
|
if (_popupMenuSelectedItem)
|
||||||
|
_popupMenuSelectedItem.expandAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
void collapseAll(const Action a) {
|
||||||
|
if (!_workspace)
|
||||||
|
return;
|
||||||
|
if (_popupMenuSelectedItem)
|
||||||
|
_popupMenuSelectedItem.collapseAll();
|
||||||
|
}
|
||||||
|
|
||||||
protected bool[string] _itemStates;
|
protected bool[string] _itemStates;
|
||||||
protected bool _itemStatesDirty;
|
protected bool _itemStatesDirty;
|
||||||
protected void readExpandedStateFromWorkspace() {
|
protected void readExpandedStateFromWorkspace() {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
v0.7.85
|
v0.7.86
|
|
@ -133,6 +133,8 @@ MENU_PROJECT_FOLDER_REMOVE_ITEM=Remove
|
||||||
MENU_PROJECT_FOLDER_RENAME_ITEM=Rename...
|
MENU_PROJECT_FOLDER_RENAME_ITEM=Rename...
|
||||||
MENU_PROJECT_FOLDER_REFRESH=Refresh
|
MENU_PROJECT_FOLDER_REFRESH=Refresh
|
||||||
MENU_PROJECT_REVEAL_IN_EXPLORER=Reveal in Explorer
|
MENU_PROJECT_REVEAL_IN_EXPLORER=Reveal in Explorer
|
||||||
|
MENU_PROJECT_FOLDER_EXPAND_ALL=Expand all
|
||||||
|
MENU_PROJECT_FOLDER_COLLAPSE_ALL=Collapse all
|
||||||
|
|
||||||
HEADER_SETTINGS=DlangIDE settings
|
HEADER_SETTINGS=DlangIDE settings
|
||||||
HEADER_OPEN_WORKSPACE_OR_PROJECT=Open Workspace or Project
|
HEADER_OPEN_WORKSPACE_OR_PROJECT=Open Workspace or Project
|
||||||
|
|
|
@ -133,6 +133,8 @@ MENU_PROJECT_FOLDER_REMOVE_ITEM=Удалить
|
||||||
MENU_PROJECT_FOLDER_RENAME_ITEM=Переименовать...
|
MENU_PROJECT_FOLDER_RENAME_ITEM=Переименовать...
|
||||||
MENU_PROJECT_FOLDER_REFRESH=Обновить
|
MENU_PROJECT_FOLDER_REFRESH=Обновить
|
||||||
MENU_PROJECT_REVEAL_IN_EXPLORER=Открыть в проводнике
|
MENU_PROJECT_REVEAL_IN_EXPLORER=Открыть в проводнике
|
||||||
|
MENU_PROJECT_FOLDER_EXPAND_ALL=Раскрыть все
|
||||||
|
MENU_PROJECT_FOLDER_COLLAPSE_ALL=Свернуть все
|
||||||
|
|
||||||
HEADER_SETTINGS=DlangIDE настройки
|
HEADER_SETTINGS=DlangIDE настройки
|
||||||
HEADER_OPEN_WORKSPACE_OR_PROJECT=Открыть рабочее пространство или проект
|
HEADER_OPEN_WORKSPACE_OR_PROJECT=Открыть рабочее пространство или проект
|
||||||
|
|
Loading…
Reference in New Issue