fix behavior of help window
This commit is contained in:
parent
9a59947e67
commit
3405e90df9
|
@ -135,9 +135,6 @@
|
|||
</children>
|
||||
</trimBars>
|
||||
</children>
|
||||
<children xsi:type="basic:Window" xmi:id="_Gm0qAEamEeyPDuc8x6Ggxw" elementId="com.minres.scviewer.e4.application.window.help" toBeRendered="false" selectedElement="_M5eT0EamEeyPDuc8x6Ggxw" label="SC Viewer Help" width="800" height="600">
|
||||
<children xsi:type="basic:Part" xmi:id="_M5eT0EamEeyPDuc8x6Ggxw" elementId="com.minres.scviewer.e4.application.part.container" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.help.HelpBrowser"/>
|
||||
</children>
|
||||
<handlers xmi:id="_95PfvXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.quitCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.QuitHandler" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||
<handlers xmi:id="_95PfwXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.openCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.OpenHandler" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<handlers xmi:id="_95PfxHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.saveCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SaveHandler" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
|
||||
|
@ -157,6 +154,7 @@
|
|||
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA">
|
||||
<tags>type:user</tags>
|
||||
</bindings>
|
||||
<bindings xmi:id="_2-008EhnEeyp3vLifEzGbQ" elementId="com.minres.scviewer.e4.application.keybinding.help" keySequence="F1" command="_lqjIYEYEEeyPM8G0E2EYww"/>
|
||||
</bindingTables>
|
||||
<bindingTables xmi:id="_XullMGVOEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.window" bindingContext="_95PfunNmEeWBq8z1Dv39LA">
|
||||
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.load" keySequence="M1+L" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
|
@ -244,6 +242,9 @@
|
|||
</children>
|
||||
</menus>
|
||||
</descriptors>
|
||||
<snippets xsi:type="basic:Window" xmi:id="_R8mJUEhwEeyp3vLifEzGbQ" elementId="com.minres.scviewer.e4.application.window.help" selectedElement="_R8mJUUhwEeyp3vLifEzGbQ" label="SC Viewer Help" width="800" height="600">
|
||||
<children xsi:type="basic:Part" xmi:id="_R8mJUUhwEeyp3vLifEzGbQ" elementId="com.minres.scviewer.e4.application.part.container" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.help.HelpBrowser"/>
|
||||
</snippets>
|
||||
<commands xmi:id="_95PfvHNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.exit" commandName="Quit Command"/>
|
||||
<commands xmi:id="_95PfwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.open" commandName="Open Command"/>
|
||||
<commands xmi:id="_95Pfw3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.save" commandName="Save Command"/>
|
||||
|
|
|
@ -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);
|
||||
|
@ -142,5 +149,7 @@ public class HelpBrowser {
|
|||
return container;
|
||||
}
|
||||
|
||||
void handleShellCloseEvent(){
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue