fix behavior of help window
This commit is contained in:
@@ -10,23 +10,24 @@
|
||||
*******************************************************************************/
|
||||
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.MUIElement;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
|
||||
public class HelpHandler {
|
||||
|
||||
static final String DIALOG_ID="com.minres.scviewer.e4.application.dialog.onlinehelp"; //$NON-NLS-1$
|
||||
static final String WINDOW_ID="com.minres.scviewer.e4.application.window.help"; //$NON-NLS-1$
|
||||
@CanExecute
|
||||
public boolean canExecute(MApplication app) {
|
||||
return !app.getChildren().stream().filter(e -> e.getElementId().equals(WINDOW_ID)).findFirst().isPresent();
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(MApplication app, /*MWindow window,*/ EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
||||
// MPart mel = (MPart) ms.find(DIALOG_ID, app); //$NON-NLS-1$
|
||||
// mel.setToBeRendered(true);
|
||||
// mel.setToBeRendered(false);
|
||||
MUIElement w = ms.find(WINDOW_ID, app);
|
||||
if(w!=null) w.setToBeRendered(true);
|
||||
public void execute(MApplication app, MWindow window, EModelService modelService /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
||||
MWindow newWin = (MWindow)modelService.cloneSnippet(app, WINDOW_ID, null);
|
||||
app.getChildren().add(newWin);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -11,18 +11,21 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
|
||||
import com.minres.scviewer.e4.application.parts.DesignBrowser;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class SelectAllHandler {
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
return part.getObject() instanceof WaveformViewer;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
|
@@ -85,7 +85,7 @@ HelpDialog_2=Stop
|
||||
HelpDialog_3=Refresh
|
||||
HelpDialog_4=Go
|
||||
HelpDialog_5=Address
|
||||
HelpDialog_6=https://minres.github.io/SCViewer#key-shortcuts
|
||||
HelpDialog_6=https://minres.github.io/SCViewer/#key-shortcuts
|
||||
HelpDialog_7=Could not instantiate Browser:
|
||||
marker=Marker
|
||||
marker_text=Marker TExt
|
||||
|
@@ -3,8 +3,11 @@ package com.minres.scviewer.e4.application.parts.help;
|
||||
import java.io.File;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.ui.model.application.ui.MUIElement;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.resource.ResourceLocator;
|
||||
@@ -21,6 +24,7 @@ import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.ProgressBar;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
@@ -29,6 +33,10 @@ import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
public class HelpBrowser {
|
||||
|
||||
@Inject IEclipseContext ctx;
|
||||
|
||||
@Inject MUIElement element;
|
||||
|
||||
private static void decorateItem(ToolItem item, String label, String imageName) {
|
||||
String fullpath = File.separator+"icons"+File.separator+imageName; //$NON-NLS-1$
|
||||
ImageDescriptor descr = ResourceLocator.imageDescriptorFromBundle("com.minres.scviewer.e4.application", fullpath).orElse(null); //$NON-NLS-1$
|
||||
@@ -41,13 +49,12 @@ public class HelpBrowser {
|
||||
item.setData(label);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public HelpBrowser() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
protected Control createComposite(Composite container) {
|
||||
// container.getShell().addListener(SWT.Close, e -> {
|
||||
// e.doit= false;
|
||||
// element.setVisible(false);
|
||||
// });
|
||||
GridLayout gridLayout = new GridLayout();
|
||||
gridLayout.numColumns = 3;
|
||||
container.setLayout(gridLayout);
|
||||
@@ -141,6 +148,8 @@ public class HelpBrowser {
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void handleShellCloseEvent(){
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user