diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index 17138a9..c78895c 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -135,9 +135,6 @@ - - - @@ -157,6 +154,7 @@ type:user + @@ -244,6 +242,9 @@ + + + diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/HelpHandler.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/HelpHandler.java index 55e6a9f..187c7d7 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/HelpHandler.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/HelpHandler.java @@ -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); } } diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/SelectAllHandler.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/SelectAllHandler.java index 636adff..2c7aa58 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/SelectAllHandler.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/SelectAllHandler.java @@ -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(); diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties index 4768167..6c98d1c 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties @@ -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 diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/help/HelpBrowser.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/help/HelpBrowser.java index e965a43..bdd6fa8 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/help/HelpBrowser.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/help/HelpBrowser.java @@ -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(){ + + } } \ No newline at end of file