-
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.
[4373] Allow backend definition of ExpandAll tool in the explorer
Bug: #4373 Signed-off-by: Gwendal Daniel <[email protected]>
- Loading branch information
Showing
61 changed files
with
2,979 additions
and
1,674 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
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
50 changes: 50 additions & 0 deletions
50
...ius/web/application/views/explorer/services/ExplorerTreeItemContextMenuEntryProvider.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,50 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.web.application.views.explorer.services; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.collaborative.trees.api.ITreeItemContextMenuEntryProvider; | ||
import org.eclipse.sirius.components.collaborative.trees.dto.ITreeItemContextMenuEntry; | ||
import org.eclipse.sirius.components.collaborative.trees.dto.SingleClickTreeItemContextMenuEntry; | ||
import org.eclipse.sirius.components.core.api.IEditingContext; | ||
import org.eclipse.sirius.components.trees.Tree; | ||
import org.eclipse.sirius.components.trees.TreeItem; | ||
import org.eclipse.sirius.components.trees.description.TreeDescription; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Provides the context menu entries for tree items in the explorer. | ||
* | ||
* @author gdaniel | ||
*/ | ||
@Service | ||
public class ExplorerTreeItemContextMenuEntryProvider implements ITreeItemContextMenuEntryProvider { | ||
|
||
@Override | ||
public boolean canHandle(IEditingContext editingContext, TreeDescription treeDescription, Tree tree, TreeItem treeItem) { | ||
return tree.getId().startsWith(ExplorerDescriptionProvider.PREFIX) | ||
&& Objects.equals(tree.getDescriptionId(), ExplorerDescriptionProvider.DESCRIPTION_ID); | ||
} | ||
|
||
@Override | ||
public List<ITreeItemContextMenuEntry> getTreeItemContextMenuEntries(IEditingContext editingContext, TreeDescription treeDescription, Tree tree, TreeItem treeItem) { | ||
if (treeItem.isHasChildren()) { | ||
return List.of(new SingleClickTreeItemContextMenuEntry("siriusweb_treeItem#backendContextMenuEntry_expandAll", "", List.of())); | ||
} else { | ||
return List.of(); | ||
} | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
...org/eclipse/sirius/web/application/views/tree/DomainTreeItemContextMenuEntryProvider.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,48 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.web.application.views.tree; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.sirius.components.collaborative.trees.api.ITreeItemContextMenuEntryProvider; | ||
import org.eclipse.sirius.components.collaborative.trees.dto.ITreeItemContextMenuEntry; | ||
import org.eclipse.sirius.components.collaborative.trees.dto.SingleClickTreeItemContextMenuEntry; | ||
import org.eclipse.sirius.components.core.api.IEditingContext; | ||
import org.eclipse.sirius.components.trees.Tree; | ||
import org.eclipse.sirius.components.trees.TreeItem; | ||
import org.eclipse.sirius.components.trees.description.TreeDescription; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Provides the context menu entries for tree items in the domain explorer. | ||
* | ||
* @author gdaniel | ||
*/ | ||
@Service | ||
public class DomainTreeItemContextMenuEntryProvider implements ITreeItemContextMenuEntryProvider { | ||
|
||
@Override | ||
public boolean canHandle(IEditingContext editingContext, TreeDescription treeDescription, Tree tree, TreeItem treeItem) { | ||
return treeDescription.getId().equals(DomainTreeRepresentationDescriptionProvider.DESCRIPTION_ID); | ||
} | ||
|
||
@Override | ||
public List<ITreeItemContextMenuEntry> getTreeItemContextMenuEntries(IEditingContext editingContext, TreeDescription treeDescription, Tree tree, TreeItem treeItem) { | ||
if (treeItem.isHasChildren()) { | ||
return List.of(new SingleClickTreeItemContextMenuEntry("siriusweb_treeItem#backendContextMenuEntry_expandAll", "", List.of())); | ||
} else { | ||
return List.of(); | ||
} | ||
} | ||
|
||
} |
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
Oops, something went wrong.