Skip to content
Snippets Groups Projects
Commit 2ce5eb33 authored by Andreas Bayha's avatar Andreas Bayha
Browse files

Merge remote-tracking branch 'origin/master' into 4257


Signed-off-by: default avatarAndreas Bayha <bayha@fortiss.org>
parents c933b86e 63b854a1
No related branches found
No related tags found
1 merge request!1914257
Pipeline #38373 passed
Pipeline: maven-releng

#38374

    Showing
    with 82 additions and 6 deletions
    AbstractNameEditingSupport.java c57336a0e0da18711a1610ca667dfea76728807f GREEN
    ActionUtils.java 322f43d4f92f992daef8ac88eb0f9197c840c89b GREEN
    ContextMenuUtils.java 1b4f2a63dfca9ad363942baf320c93145c251836 GREEN
    ContextMenuUtils.java ac3ce102c5b0cf00ed6ef5d91078c91581d169de GREEN
    EllipseLayoutUIUtils.java 0af2cfc038661828b1bb8c51c0a3816d453e8313 GREEN
    FXDNDUtils.java 6ce94e239e68f9e2b3cc0524b072606f4a120076 GREEN
    FontUtils.java a167a05bdaa8da9853705cc5134f30f6d81bc9f2 GREEN
    ......
    ......@@ -21,6 +21,9 @@ import java.util.ArrayList;
    import java.util.List;
    import org.eclipse.emf.ecore.EObject;
    import org.eclipse.jface.action.ActionContributionItem;
    import org.eclipse.jface.action.IAction;
    import org.eclipse.jface.action.IContributionItem;
    import org.fortiss.tooling.base.dnd.ElementDropContext;
    import org.fortiss.tooling.base.layout.IAutoLayouter;
    import org.fortiss.tooling.base.layout.KielerAutoLayouter;
    ......@@ -33,6 +36,8 @@ import org.fortiss.tooling.kernel.service.ICommandStackService;
    import org.fortiss.tooling.kernel.service.IElementCompositorService;
    import org.fortiss.tooling.kernel.service.IPrototypeService;
    import org.fortiss.tooling.kernel.ui.extension.IModelEditor;
    import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider;
    import org.fortiss.tooling.kernel.ui.service.IContextMenuService;
    import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
    import javafx.scene.control.Menu;
    ......@@ -149,4 +154,36 @@ public final class ContextMenuUtils {
    Point loc = createPoint((int)x, (int)y, "CompositionPoint");
    return new ElementDropContext(target, loc, isRoot, zoom);
    }
    /**
    * Creates javafx context {@link MenuItem}s for the given 'target' {@link EObject}, using the
    * {@link IContextMenuService}.
    *
    * @param target
    * The {@link EObject} to create context {@link MenuItem}s.
    * @param contextProvider
    * The {@link ContextMenuContextProvider} to provide for the
    * {@link IContextMenuService}.
    * @return A {@link List} of {@link MenuItem}s for the given 'target'
    */
    public static List<MenuItem> createContextMenuEntriesFromService(EObject target,
    ContextMenuContextProvider contextProvider) {
    List<MenuItem> ret = new ArrayList<MenuItem>();
    List<IContributionItem> contributions = IContextMenuService.getInstance()
    .getContextMenuContributions(target, contextProvider);
    for(IContributionItem c : contributions) {
    if(c instanceof ActionContributionItem) {
    IAction action = ((ActionContributionItem)c).getAction();
    MenuItem menuItem = new MenuItem(action.getText());
    menuItem.setOnAction(evt -> {
    action.run();
    });
    ret.add(menuItem);
    }
    }
    return ret;
    }
    }
    ......@@ -5,7 +5,7 @@ DynamicTextFieldTreeTableCell.java 62fa0c08b11d87e0eed41f84be85505c2740e75d GREE
    DynamicTreeContentProviderBase.java 91896b1fb5104d126544c44c1ff8c30f2a13a8d6 GREEN
    DynamicTreeItem.java 7e81ea98038b5eca90df583e0268d4e8f37aaf25 GREEN
    DynamicTreeItemBase.java d883066ecc181120302ca32f328538de7a45b093 GREEN
    DynamicTreeTableUIProviderBase.java 29aa753793ab90676d45e5b76b11f7b46ce02a97 GREEN
    DynamicTreeTableUIProviderBase.java 360df9d5114c5d4a391a7a7afe70a5b8ad584490 GREEN
    DynamicTreeTableViewer.java 77e9995a3bee37d57578dad9434a53c702128efa YELLOW
    DynamicTreeUIProviderBase.java 82d3c051213f0147f4c67ad247a08696cee73110 GREEN
    DynamicTreeViewer.java 33066062a82101cf28410e4d04f85bb9c24251db GREEN
    ......
    ......@@ -322,6 +322,8 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
    final Node icon = getIconNode(data, columnIndex);
    cell.setGraphic(icon);
    cell.setStyle(getCellStyle(data, columnIndex));
    addContextMenuToCell(cell, columnIndex);
    } else {
    // reset icon for cases, in which a row was styled before, but became empty by now.
    cell.setGraphic(null);
    ......@@ -585,7 +587,7 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
    * @param columnIndex
    * The column index of the given {@code cell}.
    */
    private void addContextMenuToCell(TreeTableCell<T, String> cell, int columnIndex) {
    private void addContextMenuToCell(TreeTableCell<T, ?> cell, int columnIndex) {
    ContextMenu menu;
    T data = cell.getTreeTableRow().getItem();
    ......@@ -603,7 +605,7 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
    * {@link DynamicTreeViewer} due to the absence of proper selection interfaces in
    * JFX.
    */
    private void addContextMenuHandler(TreeTableCell<T, String> cell, ContextMenu menu, T element) {
    private void addContextMenuHandler(TreeTableCell<T, ?> cell, ContextMenu menu, T element) {
    cell.getTreeTableView().addEventHandler(MouseEvent.MOUSE_RELEASED, e -> {
    if(e.getButton() == MouseButton.SECONDARY) {
    TreeItem<T> selected =
    ......
    ActionService.java e29126b5947c9fd2f1d82bb87001b9d0ead50c3b GREEN
    ContextMenuService.java 9021e4eeb5d7be5d73d87e5947564bdf17f07b9d GREEN
    ContextMenuService.java 16b469599cb8723a433bc97b88dc4a558b25568e GREEN
    MarkerService.java 0bfe2c67638db4e506ea5dc7680765f2a8d632e1 GREEN
    ModelEditorBindingService.java f304addb514cd2de443997e0b52cef7a3a9897bf GREEN
    ModelElementHandlerService.java 34adeef844bf98c69f1b9a7252f34d0a2b741b54 GREEN
    ......
    ......@@ -291,4 +291,22 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
    public IIntrospectionDetailsItem getDetailsItem() {
    return new ContextMenuKISSDetailsItem(contextMenuContributorList);
    }
    /** {@inheritDoc} */
    @Override
    public List<IContributionItem> getContextMenuContributions(EObject element,
    ContextMenuContextProvider contextProvider) {
    List<IContributionItem> ret = new ArrayList<IContributionItem>();
    // Iterate all ContextMenuContributors to collect menu items.
    for(IContextMenuContributor contributor : contextMenuContributorList) {
    List<IContributionItem> contributions =
    contributor.getContributedItems(element, contextProvider);
    if(contributions != null) {
    ret.addAll(contributions);
    }
    }
    return ret;
    }
    }
    IActionService.java 22eafafc8708cbff7f855f7b1b9bef042c127f25 GREEN
    IContextMenuService.java cfb6b8237b6cd2b0e461991a9ceb95969f330265 GREEN
    IContextMenuService.java b28f2b7e7375901a88b420654317c61d3d58d02c GREEN
    IMarkerService.java 82486a5656cd907926fcdf1ca1ab801290f8514c GREEN
    IModelEditorBindingService.java ce2ae1957e2232bb0fac1d1d262103f9adfc5266 GREEN
    IModelElementHandlerService.java 23353de6b85af0e9d44a1c926174fa4ed5152af0 GREEN
    ......
    ......@@ -15,6 +15,10 @@
    +--------------------------------------------------------------------------*/
    package org.fortiss.tooling.kernel.ui.service;
    import java.util.List;
    import org.eclipse.emf.ecore.EObject;
    import org.eclipse.jface.action.IContributionItem;
    import org.eclipse.jface.action.MenuManager;
    import org.eclipse.ui.IWorkbenchActionConstants;
    import org.fortiss.tooling.kernel.ui.extension.IContextMenuContributor;
    ......@@ -74,4 +78,19 @@ public interface IContextMenuService {
    /** Registers the given contributor with the kernel. */
    void registerContextMenuContributor(IContextMenuContributor contributor);
    /**
    * Retrieves all context menu {@link IContributionItem}s for the given 'element' and the given
    * 'ContextProvider'.
    *
    * @param element
    * The {@link EObject} to get the menu contributions for.
    * @param contextProvider
    * The {@link ContextMenuContextProvider} to adhere when getting the context menu
    * contibutions.
    * @return A {@link List} if {@link IContributionItem} for the given 'element' and the given
    * 'contentProvider'.
    */
    public List<IContributionItem> getContextMenuContributions(EObject element,
    ContextMenuContextProvider contextProvider);
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment