import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.workbench.IWorkbench;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Shell;
+import org.simantics.db.Resource;
import org.simantics.db.exception.DatabaseException;
import org.simantics.district.selection.ui.parts.EditSelectorDialog;
+import org.simantics.utils.ui.AdaptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Execute
public void createNewElementSelector(IEclipseContext context, IWorkbench workbench) {
+ Object currentSelection = context.get(IServiceConstants.ACTIVE_SELECTION);
+
Shell shell = context.getActive(Shell.class);
- EditSelectorDialog dialog = new EditSelectorDialog(shell, null);
+ EditSelectorDialog dialog = new EditSelectorDialog(shell, null, AdaptionUtils.adaptToCollection(currentSelection, Resource.class));
LOGGER.debug("Opening dialog");
int result = dialog.open();
LOGGER.debug("Dialog closed with result code " + result);