1 /******************************************************************************* 2 * Copyright (c) 2010 BestSolution.at and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation 13 ******************************************************************************/ 14 package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; 15 16 import org.eclipse.e4.tools.emf.ui.common.IModelResource; 17 import org.eclipse.e4.tools.emf.ui.internal.Messages; 18 import org.eclipse.e4.ui.model.application.commands.MCommand; 19 import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; 20 import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; 21 import org.eclipse.emf.common.command.Command; 22 import org.eclipse.emf.edit.command.SetCommand; 23 import org.eclipse.emf.edit.domain.EditingDomain; 24 import org.eclipse.swt.widgets.Shell; 25 26 public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog { 27 private final MHandledItem handler; 28 HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource, Messages Messages)29 public HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource, 30 Messages Messages) { 31 super(parentShell, resource, Messages); 32 this.handler = handler; 33 } 34 35 @Override getShellTitle()36 protected String getShellTitle() { 37 return Messages.HandledToolItemCommandSelectionDialog_ShellTitle; 38 } 39 40 @Override getDialogTitle()41 protected String getDialogTitle() { 42 return Messages.HandledToolItemCommandSelectionDialog_DialogTitle; 43 } 44 45 @Override getDialogMessage()46 protected String getDialogMessage() { 47 return Messages.HandledToolItemCommandSelectionDialog_DialogMessage; 48 } 49 50 @Override createStoreCommand(EditingDomain editingDomain, MCommand command)51 protected Command createStoreCommand(EditingDomain editingDomain, MCommand command) { 52 return SetCommand.create(editingDomain, handler, MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, command); 53 } 54 } 55