add reload menu and toolbar item

This commit is contained in:
2020-10-28 13:32:17 +01:00
parent 868eceddc5
commit b34fe0d0ba
4 changed files with 65 additions and 9 deletions

View File

@ -0,0 +1,42 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.handlers;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.swt.widgets.Shell;
import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class ReloadHandler {
@CanExecute
public boolean canExecute(EPartService partService) {
MPart part = partService.getActivePart();
if(part==null) return false;
return (part.getObject() instanceof WaveformViewer);
}
@Execute
public void execute(Shell shell, MApplication app, EModelService modelService,
EPartService partService){
MPart part = partService.getActivePart();
Object obj = part.getObject();
if(part!=null && (obj instanceof WaveformViewer)) {
((WaveformViewer)obj).reloadDatabase();
}
}
}