-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add "Collaps All" button to ouline view
- Loading branch information
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
org.eclipse.lsp4e/src/org/eclipse/lsp4e/outline/CollapseAllOutlineHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Vegard IT GmbH and others. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Sebastian Thomschke (Vegard IT GmbH) - initial implementation. | ||
*******************************************************************************/ | ||
package org.eclipse.lsp4e.outline; | ||
|
||
import org.eclipse.core.commands.AbstractHandler; | ||
import org.eclipse.core.commands.ExecutionEvent; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.lsp4e.ui.UI; | ||
import org.eclipse.ui.views.contentoutline.ContentOutline; | ||
|
||
public class CollapseAllOutlineHandler extends AbstractHandler { | ||
|
||
@Override | ||
public @Nullable Object execute(ExecutionEvent event) { | ||
final var workbenchPage = UI.getActivePage(); | ||
if (workbenchPage != null // | ||
&& workbenchPage.getActivePart() instanceof ContentOutline outline | ||
&& outline.getCurrentPage() instanceof CNFOutlinePage page) { | ||
page.collapseTree(); | ||
} | ||
return null; | ||
} | ||
} |