下面列出了org.eclipse.ui.ISources#org.eclipse.ui.handlers.HandlerUtil 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// Get selection already validated by handler in plugin.xml
ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
if (!(selection instanceof IStructuredSelection)) {
return null;
}
TmfExperimentElement experiment = (TmfExperimentElement) ((IStructuredSelection) selection).getFirstElement();
// Fire the Copy Experiment dialog
Shell shell = HandlerUtil.getActiveShellChecked(event);
CopyExperimentDialog dialog = new CopyExperimentDialog(shell, experiment);
dialog.open();
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
try {
// get the parameter
String param = event.getParameter(PARAMETERID);
PersistentObject artikel =
(PersistentObject) event.getCommand().getParameterType(PARAMETERID)
.getValueConverter().convertToObject(param);
// create and open the dialog with the parameter
Shell parent = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
ArtikelDetailDialog dialog = new ArtikelDetailDialog(parent, artikel);
dialog.open();
} catch (Exception ex) {
throw new RuntimeException(COMMANDID, ex);
}
return null;
}
/**
* Returns an OSGi service from {@link ExecutionEvent}. It looks up a service in the following
* locations (if exist) in the given order:
*
* {@code HandlerUtil.getActiveSite(event)}
* {@code HandlerUtil.getActiveEditor(event).getEditorSite()}
* {@code HandlerUtil.getActiveEditor(event).getSite()}
* {@code HandlerUtil.getActiveWorkbenchWindow(event)}
* {@code PlatformUI.getWorkbench()}
*/
public static <T> T getService(ExecutionEvent event, Class<T> api) {
IWorkbenchSite activeSite = HandlerUtil.getActiveSite(event);
if (activeSite != null) {
return activeSite.getService(api);
}
IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
if (activeEditor != null) {
IEditorSite editorSite = activeEditor.getEditorSite();
if (editorSite != null) {
return editorSite.getService(api);
}
IWorkbenchPartSite site = activeEditor.getSite();
if (site != null) {
return site.getService(api);
}
}
IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
if (workbenchWindow != null) {
return workbenchWindow.getService(api);
}
return PlatformUI.getWorkbench().getService(api);
}
public static List<IProject> getProjects(ExecutionEvent event) throws ExecutionException {
List<IProject> projects = new ArrayList<>();
ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
for (Object selected : structuredSelection.toList()) {
IProject project = AdapterUtil.adapt(selected, IProject.class);
if (project != null) {
projects.add(project);
}
}
}
return projects;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
try {
// create and open the dialog
Shell parent = HandlerUtil.getActiveWorkbenchWindow(event).getShell();
EigenLeistungDialog dialog = new EigenLeistungDialog(parent, null);
// open dialog and add created IVerrechenbar to the selected Leistungsblock
if (dialog.open() == Dialog.OK) {
Optional<ICodeElementBlock> block =
ContextServiceHolder.get().getTyped(ICodeElementBlock.class);
if (block.isPresent()) {
IVerrechenbar created = dialog.getResult();
Optional<Identifiable> createdIdentifiable = StoreToStringServiceHolder.get()
.loadFromString(((PersistentObject) created).storeToString());
createdIdentifiable.ifPresent(ci -> {
block.get().addElement((ICodeElement) ci);
ContextServiceHolder.get().postEvent(ElexisEventTopics.EVENT_UPDATE,
block.get());
});
}
}
} catch (Exception ex) {
throw new RuntimeException(COMMANDID, ex);
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) {
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
ICellEditor cellEditor = xliffEditor.getTable().getConfigRegistry().getConfigAttribute(
EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, XLIFFEditorImplWithNatTable.SOURCE_EDIT_CELL_LABEL);
if (cellEditor == null || !(cellEditor instanceof StyledTextCellEditor)) {
return null;
}
HsMultiActiveCellEditor.commit(false);
StyledTextCellEditor sce = (StyledTextCellEditor) cellEditor;
EditableManager editableManager = sce.getEditableManager();
// SourceEditMode nextMode = editableManager.getSourceEditMode().getNextMode();
SourceEditMode nextMode = getSourceEditMode(editableManager);
editableManager.setSourceEditMode(nextMode);
// element.setIcon(Activator.getImageDescriptor(nextMode.getImagePath()));
if (!sce.isClosed()) {
editableManager.judgeEditable();
// 更新全局 Action 的可用状态,主要是更新编辑-删除功能的可用状态。
sce.getActionHandler().updateActionsEnableState();
}
sce.addClosingListener(listener);
}
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
if (selection instanceof IStructuredSelection) {
for (Object element : ((IStructuredSelection) selection).toList()) {
if (element instanceof ITmfProjectModelElement) {
IResource resource = ((ITmfProjectModelElement) element).getResource();
if (resource != null) {
try {
resource.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
Activator.getDefault().logError("Error refreshing projects", e); //$NON-NLS-1$
}
}
}
}
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (!(editor instanceof XLIFFEditorImplWithNatTable)) {
return null;
}
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
int[] selectedRows = xliffEditor.getSelectedRows();
if (selectedRows.length < 1) {
return null;
}
Arrays.sort(selectedRows);
int firstSelectedRow = selectedRows[0];
if (firstSelectedRow == 0) {
firstSelectedRow = 1;
}
xliffEditor.jumpToRow(firstSelectedRow - 1);
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
RenameRefactoringInfo refactoringInfo = getRenameRefactoringInfo();
if (refactoringInfo == null) {
MessageDialog.openError(HandlerUtil.getActiveShell(event), Messages.RenameCompilationUnitHandler_InvalidSelection, Messages.RenameCompilationUnitHandler_CannotPerformRefactoringWithCurrentSelection);
return null;
}
if (DebugCommons.isProjectInDebug(refactoringInfo.getProject())) {
MessageDialog.openError(HandlerUtil.getActiveShell(event), Messages.RenameCompilationUnitHandler_ProjectDebugged, Messages.RenameCompilationUnitHandler_CannotChangeFilesOfDebuggedProject);
return null;
}
RenameRefactoringProcessor refactoringProcessor = new RenameRefactoringProcessor(refactoringInfo);
RenameRefactoring renameRefactoring = new RenameRefactoring(refactoringProcessor);
RenameRefactoringWizard wizard = new RenameRefactoringWizard(renameRefactoring, refactoringInfo);
RefactoringWizardOpenOperation op
= new RefactoringWizardOpenOperation( wizard );
try {
String titleForFailedChecks = ""; //$NON-NLS-1$
op.run( HandlerUtil.getActiveShell(event), titleForFailedChecks );
} catch( final InterruptedException irex ) {
}
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
// get selection
ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
if (selection == null || !(selection instanceof IStructuredSelection)) {
return null;
}
Map<String, Integer> data = processSelectionData((IStructuredSelection) selection);
boolean dataWrittenSuccessfully = false;
try {
// overwrite csv with new data
dataWrittenSuccessfully = overwriteCSVFile(data);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// call website on writen file
if (dataWrittenSuccessfully) {
Program.launch(Activator.getUrl() + "bar.index.html");
}
return null;
}
/**
* {@inheritDoc}
*/
@Override // IHandler
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IEditorPart part = window.getActivePage().getActiveEditor();
XFindPanel panel = XFindPanelManager.getXFindPanel(part, true);
if (panel != null) {
panel.showPanel();
}
else {
// failed to create XFindPanel, execute standard command "Find and Replace".
IHandlerService handlerService = (IHandlerService)window.getService(IHandlerService.class);
try {
handlerService.executeCommand(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE, null);
} catch (Exception ex) {
LogHelper.logError("Command " + IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE + " not found"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (!(editor instanceof XLIFFEditorImplWithNatTable)) {
return null;
}
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
int[] selectedRows = xliffEditor.getSelectedRows();
if (selectedRows.length < 1) {
return null;
}
Arrays.sort(selectedRows);
int lastSelectedRow = selectedRows[selectedRows.length - 1];
XLFHandler handler = xliffEditor.getXLFHandler();
int row = handler.getNextFuzzySegmentIndex(lastSelectedRow);
if (row != -1) {
xliffEditor.jumpToRow(row);
} else {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
MessageDialog.openWarning(window.getShell(), "", "不存在下一模糊匹配文本段。");
}
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof StructuredSelection
&& !((StructuredSelection) selection).isEmpty()) {
List<?> iDocuments = ((StructuredSelection) selection).toList();
for (Object documentToExport : iDocuments) {
if (documentToExport instanceof IDocument) {
openExportDialog(shell, (IDocument) documentToExport);
}
}
}
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
ISelection selection =
HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
if (selection != null) {
IStructuredSelection strucSelection = (IStructuredSelection) selection;
Object firstElement = strucSelection.getFirstElement();
if (firstElement != null && firstElement instanceof TextTemplate) {
TextTemplate textTemplate = (TextTemplate) firstElement;
Brief template = textTemplate.getTemplate();
textTemplate.removeTemplateReference();
if (template != null) {
template.delete();
ElexisEventDispatcher.getInstance().fire(new ElexisEvent(Brief.class, null,
ElexisEvent.EVENT_RELOAD, ElexisEvent.PRIORITY_NORMAL));
}
}
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (editor instanceof XLIFFEditorImplWithNatTable) {
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
XLFHandler handler = xliffEditor.getXLFHandler();
List<String> selectedRowIds = xliffEditor.getSelectedRowIds();
boolean isNeedReview = true;
//先判断所有的选择文本段的是否锁定状态
for(String rowId : selectedRowIds){
if (!handler.isNeedReview(rowId)) {
isNeedReview = false;
break;
}
}
NattableUtil util = NattableUtil.getInstance(xliffEditor);
util.changIsQuestionState(selectedRowIds, isNeedReview ? "no" : "yes");
}
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
TmxEditorViewer viewer = TmxEditorViewer.getInstance();
if (viewer == null) {
return null;
}
TmxEditor editor = viewer.getTmxEditor();
if (editor == null) {
return null;
}
if (editor.getTmxDataAccess().getDisplayTuCount() == 0
|| editor.getTmxEditorImpWithNattable().getSelectedRows().length == 0) {
OpenMessageUtils.openMessage(IStatus.INFO, Messages.getString("tmxeditor.deleteTuHandler.noSelectedMsg"));
return null;
}
boolean confirm = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event),
Messages.getString("tmxeditor.deleteTuHandler.warn.msg"),
Messages.getString("tmxeditor.deleteTuHandler.warn.desc"));
if (!confirm) {
return null;
}
editor.deleteSelectedTu();
IOperationHistory histor = OperationHistoryFactory.getOperationHistory();
histor.dispose(PlatformUI.getWorkbench().getOperationSupport().getUndoContext(), true, true, true);
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (!(editor instanceof XLIFFEditorImplWithNatTable)) {
return null;
}
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
int[] selectedRows = xliffEditor.getSelectedRows();
if (selectedRows.length < 1) {
return null;
}
Arrays.sort(selectedRows);
int lastSelectedRow = selectedRows[selectedRows.length - 1];
XLFHandler handler = xliffEditor.getXLFHandler();
int row = handler.getNextUnapprovedSegmentIndex(lastSelectedRow);
if (row != -1) {
xliffEditor.jumpToRow(row);
} else {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
MessageDialog.openWarning(window.getShell(), "", "不存在下一个未批准文本段。");
}
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
try {
// get the parameter
String param = event.getParameter(PARAMETERID);
PersistentObject labitem =
(PersistentObject) event.getCommand().getParameterType(PARAMETERID)
.getValueConverter().convertToObject(param);
// create and open the dialog with the parameter
Shell parent = HandlerUtil.getActiveShell(event);
EditLabItem dialog = new EditLabItem(parent, (LabItem) labitem);
dialog.open();
} catch (Exception ex) {
throw new RuntimeException(COMMANDID, ex);
}
return null;
}
public Object execute(final ExecutionEvent event) throws ExecutionException {
final FilteredItemsSelectionDialog dialog = new TLAFilteredItemsSelectionDialog(HandlerUtil.getActiveShell(event));
dialog.open();
final Object[] result = dialog.getResult();
if (result != null && result.length == 1) {
final Map<String, String> parameters = new HashMap<String, String>();
if (result[0] instanceof Module && ((Module) result[0]).isRoot()) {
parameters.put(OpenSpecHandler.PARAM_SPEC, ((Module) result[0]).getModuleName());
UIHelper.runCommand(OpenSpecHandler.COMMAND_ID, parameters);
} else if (result[0] instanceof Module) {
parameters.put(OpenModuleHandler.PARAM_MODULE, ((Module) result[0]).getModuleName());
UIHelper.runCommand(OpenModuleHandler.COMMAND_ID, parameters);
} else if (result[0] instanceof Model) {
parameters.put(OpenModelHandler.PARAM_MODEL_NAME, ((Model) result[0]).getName());
UIHelper.runCommand(OpenModelHandler.COMMAND_ID, parameters);
} else if (result[0] instanceof Spec) {
parameters.put(OpenSpecHandler.PARAM_SPEC, ((Spec) result[0]).getName());
UIHelper.runCommand(OpenSpecHandler.COMMAND_ID, parameters);
}
}
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event)
.getActivePage().getSelection();
if(selection instanceof TreeSelection) {
TreeSelection treeSelection = (TreeSelection) selection;
if(treeSelection.getFirstElement() instanceof File) {
File file = (File) treeSelection.getFirstElement();
if(file.getFileExtension().equals("bib")){
WorkspaceBibTexEntry entry = wm.getWorkspaceBibTexEntryByUri(file.getLocationURI());
if(entry != null) {
if(entry.getMendeleyFolder() != null) {
// by setting the MendeleyFolder of a WorkspaceBibTexEntry to null, the connection will be removed
entry.setMendeleyFolder(null);
decoratorManager.update("de.tudresden.slr.model.mendeley.decorators.MendeleyOverlayDecorator");
}
}
}
}
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (editor instanceof XLIFFEditorImplWithNatTable) {
XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor;
List<String> selectedRowIds = xliffEditor.getSelectedRowIds();
if (selectedRowIds != null && selectedRowIds.size() > 0) {
boolean isSendtoTm = true;
XLFHandler handler = xliffEditor.getXLFHandler();
for (String rowId : selectedRowIds) {
if (!handler.isSendToTM(rowId) && isSendtoTm) {
isSendtoTm = false;
break;
}
}
NattableUtil util = NattableUtil.getInstance(xliffEditor);
util.changeSendToTmState(selectedRowIds, isSendtoTm ? "yes" : "no");
}
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException
{
/*
* Try to get the spec from active navigator if any
*/
ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
if (selection != null && selection instanceof IStructuredSelection
&& ((IStructuredSelection) selection).size() == 1)
{
Object selected = ((IStructuredSelection) selection).getFirstElement();
if (selected instanceof Model)
{
Map<String, String> parameters = new HashMap<String, String>();
// fill the model name for the handler
parameters.put(OpenModelHandler.PARAM_MODEL_NAME, ((Model) selected).getName());
// delegate the call to the open model handler
UIHelper.runCommand(OpenModelHandler.COMMAND_ID, parameters);
}
}
return null;
}
/** (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
if (window != null) {
PreferenceUtil.openPreferenceDialog(window, null);
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
NewTmDbWizard wizard = new NewTmDbWizard();
ImportTmxWizardDialog dialog = new ImportTmxWizardDialog(window.getShell(), wizard);
dialog.open();
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IStructuredSelection currentSelection = getSelectionToUse(event);
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IExportWizard wizard = getExportWizard(event);
wizard.init(window.getWorkbench(), currentSelection);
TSWizardDialog dialog = new TSWizardDialog(window.getShell(), wizard);
dialog.create();
dialog.open();
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
root = ResourcesPlugin.getWorkspace().getRoot();
//先检查目录管理器配置所需要的文件是否都存在于工作空间
File catalogXmlFile = root.getLocation().append(ADConstants.catalogueXmlPath).toFile();
// 如果不存在,就将net.heartsome.cat.ts.configurationfile.feature插件的net.heartsome.cat.converter里的catalogue.xml拷到工作空间
if (!catalogXmlFile.exists() || new File(catalogXmlFile.getParent()).list().length <= 0) {
//这是产品打包后,catalogue.xml所在的路径
String srcLocation = Platform.getConfigurationLocation().getURL().getPath()
+ "net.heartsome.cat.converter"
+ System.getProperty("file.separator") + "catalogue" + System.getProperty("file.separator")
+ "catalogue.xml";
String tagLoaction = catalogXmlFile.getParent();
try {
ResourceUtils.copyDirectory(new File(srcLocation).getParentFile(), new File(tagLoaction));
} catch (Exception e) {
e.printStackTrace();
}
}
catalogXmlFile = root.getLocation().append(ADConstants.catalogueXmlPath).toFile();
if (!catalogXmlFile.exists()) {
MessageDialog.openInformation(HandlerUtil.getActiveSite(event).getShell(), Messages.getString("handlers.CatalogManagerHandler.msgTitle"), Messages.getString("handlers.CatalogManagerHandler.msg"));
return null;
}
CatalogManagerDialog dialog = new CatalogManagerDialog(HandlerUtil.getActiveSite(event).getShell(), root);
dialog.open();
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final Shell shell = HandlerUtil.getActiveShell(event);
final TmxEditorViewer tmxEditorViewer = TmxEditorViewer.getInstance();
if (tmxEditorViewer == null) {
OpenMessageUtils.openMessage(IStatus.ERROR,
Messages.getString("handler.OpenTmxFileHandler.cantFindEditorViewerMsg"));
return null;
}
if (tmxEditorViewer.getTmxEditor() != null) {
if (!tmxEditorViewer.closeTmx()) {
return null;
}
}
BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
@Override
public void run() {
NewTmxFileDialog dialog = new NewTmxFileDialog(shell);
if (dialog.open() == Dialog.OK) {
String path = dialog.getNewFilePath();
if (path != null) {
File f = new File(path);
if (f.exists()) {
OpenTmxFileHandler.open(f);
}
}
}
}
});
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (editor instanceof IXliffEditor) {
IXliffEditor xliffEditor = (IXliffEditor) editor;
IFile file = ((FileEditorInput) editor.getEditorInput()).getFile();
// ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(file.getProject());
// List<DatabaseModelBean> lstDatabase = projectConfig.getTermBaseDbs(true);
TbImporter.getInstance().setProject(file.getProject());
if (!TbImporter.getInstance().checkImporter()) {
MessageDialog.openInformation(HandlerUtil.getActiveShell(event),
Messages.getString("handler.AddTermToTBHandler.msgTitle"),
Messages.getString("handler.AddTermToTBHandler.msg"));
return null;
}
StringBuffer srcTerm = new StringBuffer();
StringBuffer tgtTerm = new StringBuffer();
String srcAllText = xliffEditor.getRowTransUnitBean(xliffEditor.getSelectedRows()[0]).getSrcText();
xliffEditor.getSelectSrcOrTgtPureText(srcTerm, tgtTerm);
AddTermToTBDialog dialog = AddTermToTBDialog.getInstance(editor.getSite().getShell(), srcTerm.toString().trim(),
tgtTerm.toString().trim(),AddTermToTBDialog.ADD_TYPE);
dialog.setProject(file.getProject());
dialog.setSrcLang(xliffEditor.getSrcColumnName());
dialog.setTgtLang(xliffEditor.getTgtColumnName());
dialog.setSrcAllText(srcAllText);
dialog.open();
}
return null;
}
public Object execute(ExecutionEvent event) throws ExecutionException {
Node state = unwrap(HandlerUtil.getCurrentSelection(event));
if (state == null)
return null;
CreateSubDiagramCommand cmd = new CreateSubDiagramCommand(state);
executeCommand(cmd);
return null;
}
private List<IPrescription> sortPrescriptions(List<IPrescription> prescRecipes,
ExecutionEvent event){
SorterAdapter sorter = new SorterAdapter(event);
IWorkbenchPart part = HandlerUtil.getActivePart(event);
if (part instanceof MedicationView) {
return sorter.getSorted(prescRecipes);
}
return prescRecipes;
}