forked from eclipse-sirius/sirius-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4286] Make default explorer DnD work only for the default explorer
Bug: eclipse-sirius#4286 Signed-off-by: Gwendal Daniel <[email protected]>
- Loading branch information
Showing
5 changed files
with
61 additions
and
4 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
54 changes: 54 additions & 0 deletions
54
...pse/sirius/web/application/studio/services/representations/DomainDropTreeItemHandler.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,54 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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.studio.services.representations; | ||
|
||
import org.eclipse.sirius.components.collaborative.trees.api.IDropTreeItemHandler; | ||
import org.eclipse.sirius.components.core.api.IEditingContext; | ||
import org.eclipse.sirius.components.core.api.IObjectService; | ||
import org.eclipse.sirius.components.trees.Tree; | ||
import org.eclipse.sirius.components.view.emf.IRepresentationDescriptionIdProvider; | ||
import org.eclipse.sirius.components.view.emf.IViewRepresentationDescriptionSearchService; | ||
import org.eclipse.sirius.web.application.views.explorer.services.ExplorerDescriptionProvider; | ||
import org.eclipse.sirius.web.application.views.explorer.services.ExplorerDropTreeItemHandler; | ||
import org.eclipse.sirius.web.domain.services.api.IMessageService; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Provides the drop tree item tool for the Domain explorer by DSL explorer. | ||
* | ||
* @author gdaniel | ||
*/ | ||
@Service | ||
public class DomainDropTreeItemHandler extends ExplorerDropTreeItemHandler implements IDropTreeItemHandler { | ||
|
||
private final IViewRepresentationDescriptionSearchService viewRepresentationDescriptionSearchService; | ||
|
||
public DomainDropTreeItemHandler(IObjectService objectService, IMessageService messageService, IViewRepresentationDescriptionSearchService viewRepresentationDescriptionSearchService) { | ||
super(objectService, messageService); | ||
this.viewRepresentationDescriptionSearchService = viewRepresentationDescriptionSearchService; | ||
} | ||
|
||
@Override | ||
public boolean canHandle(IEditingContext editingContext, Tree tree) { | ||
boolean result = false; | ||
if (tree.getId().startsWith(ExplorerDescriptionProvider.PREFIX) | ||
&& tree.getDescriptionId().startsWith(IRepresentationDescriptionIdProvider.PREFIX)) { | ||
var optionalViewTreeDescription = this.viewRepresentationDescriptionSearchService.findById(editingContext, tree.getDescriptionId()); | ||
if (optionalViewTreeDescription.isPresent()) { | ||
result = optionalViewTreeDescription.get().getName().equals(DomainViewTreeDescriptionProvider.DOMAIN_EXPLORER_DESCRIPTION_NAME); | ||
} | ||
} | ||
return result; | ||
} | ||
|
||
} |
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