configure the hover visibility from UI
This commit is contained in:
		| @@ -1,17 +1,9 @@ | ||||
| package com.minres.scviewer.database.swt.internal; | ||||
|  | ||||
| import org.eclipse.swt.SWT; | ||||
| import org.eclipse.swt.events.MouseEvent; | ||||
| import org.eclipse.swt.events.MouseListener; | ||||
| import org.eclipse.swt.events.MouseTrackAdapter; | ||||
| import org.eclipse.swt.events.PaintEvent; | ||||
| import org.eclipse.swt.events.PaintListener; | ||||
| import org.eclipse.swt.graphics.Font; | ||||
| import org.eclipse.swt.graphics.Point; | ||||
| import org.eclipse.swt.graphics.Rectangle; | ||||
| import org.eclipse.swt.layout.FillLayout; | ||||
| import org.eclipse.swt.layout.GridData; | ||||
| import org.eclipse.swt.layout.GridLayout; | ||||
| import org.eclipse.swt.layout.RowLayout; | ||||
| import org.eclipse.swt.widgets.Control; | ||||
| import org.eclipse.swt.widgets.Display; | ||||
| @@ -21,9 +13,6 @@ import org.eclipse.swt.widgets.Listener; | ||||
| import org.eclipse.swt.widgets.Shell; | ||||
| import org.eclipse.swt.widgets.Table; | ||||
| import org.eclipse.swt.widgets.TableColumn; | ||||
| import org.eclipse.swt.widgets.TableItem; | ||||
| import org.eclipse.swt.widgets.ToolBar; | ||||
| import org.eclipse.swt.widgets.Tree; | ||||
| import org.eclipse.swt.widgets.Widget; | ||||
|  | ||||
| import com.minres.scviewer.database.swt.Constants; | ||||
| @@ -35,10 +24,6 @@ class ToolTipHandler { | ||||
| 	private final Display display; | ||||
| 	private Shell  parentShell; | ||||
| 	private Shell  shell; | ||||
| 	private Label  label; | ||||
| 	private Table  table; | ||||
| 	private TableColumn nameCol; | ||||
| 	private TableColumn valueCol; | ||||
|  | ||||
| 	private Widget tipWidget; // widget this tooltip is hovering over | ||||
| 	private Point  tipPosition; // the position being hovered over | ||||
| @@ -66,13 +51,20 @@ class ToolTipHandler { | ||||
| 			@Override | ||||
| 			public void handleEvent (Event event) { | ||||
| 				switch (event.type) { | ||||
| 				case SWT.KeyDown:{ | ||||
| 					if (tip != null && tip.isVisible() && event.keyCode == SWT.F2) { | ||||
| 						tip.setFocus(); | ||||
| 						break; | ||||
| 					}  | ||||
| 				} | ||||
| 				case SWT.Dispose: | ||||
| 				case SWT.KeyDown: | ||||
| 				case SWT.MouseMove: { | ||||
| 					if (tip == null) break; | ||||
| 					tip.dispose (); | ||||
| 					tip = null; | ||||
| 					label = null; | ||||
| 				case SWT.MouseMove: | ||||
| 				case SWT.MouseDown: { | ||||
| 					if (tip != null){ | ||||
| 						tip.dispose (); | ||||
| 						tip = null; | ||||
| 						tipWidget=null; | ||||
| 					} | ||||
| 					break; | ||||
| 				} | ||||
| 				case SWT.MouseHover: { | ||||
| @@ -91,6 +83,8 @@ class ToolTipHandler { | ||||
| 						tip.pack(); | ||||
| 						setHoverLocation(tip, tipPosition);	 | ||||
| 						tip.setVisible (visible); | ||||
| 						if(visible) | ||||
| 							tipWidget=event.widget; | ||||
| 					} | ||||
| 				} | ||||
| 				} | ||||
| @@ -98,8 +92,9 @@ class ToolTipHandler { | ||||
| 		}; | ||||
| 		control.addListener (SWT.Dispose, listener); | ||||
| 		control.addListener (SWT.KeyDown, listener); | ||||
| 		control.addListener (SWT.MouseMove, listener); | ||||
| 		//control.addListener (SWT.MouseMove, listener); | ||||
| 		control.addListener (SWT.MouseHover, listener); | ||||
| 		control.addListener (SWT.MouseDown, listener); | ||||
|  | ||||
| 		/* | ||||
| 		 * Trap F1 Help to pop up a custom help box | ||||
|   | ||||
| @@ -123,17 +123,22 @@ | ||||
|         </children> | ||||
|       </children> | ||||
|       <children xsi:type="menu:ToolBar" xmi:id="_oQdMUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.1"> | ||||
|         <children xsi:type="menu:HandledToolItem" xmi:id="_5DrGQHf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfit" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom.png" tooltip="Restore default zoom level" command="_693GoHcqEeWwZ-9vrAR2UQ"> | ||||
|         <children xsi:type="menu:HandledToolItem" xmi:id="_5DrGQHf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfit" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magnifier.png" tooltip="Restore default zoom level" command="_693GoHcqEeWwZ-9vrAR2UQ"> | ||||
|           <parameters xmi:id="_5DrGQXf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="fit"/> | ||||
|         </children> | ||||
|         <children xsi:type="menu:ToolBarSeparator" xmi:id="_p1AvUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.1"/> | ||||
|         <children xsi:type="menu:HandledToolItem" xmi:id="_XMQPAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomin" label="Zoom in" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_in.png" tooltip="Zoom in by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ"> | ||||
|         <children xsi:type="menu:HandledToolItem" xmi:id="_XMQPAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomin" label="Zoom in" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png" tooltip="Zoom in by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ"> | ||||
|           <parameters xmi:id="_fi5w4HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/> | ||||
|         </children> | ||||
|         <children xsi:type="menu:HandledToolItem" xmi:id="_XqTc8HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomout" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_out.png" tooltip="Zoom out by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ"> | ||||
|         <children xsi:type="menu:HandledToolItem" xmi:id="_XqTc8HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomout" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magifier_zoom_out.png" tooltip="Zoom out by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ"> | ||||
|           <parameters xmi:id="_d7OBYHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/> | ||||
|         </children> | ||||
|       </children> | ||||
|       <children xsi:type="menu:ToolBar" xmi:id="_fwn8wGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.toolbar.2"> | ||||
|         <children xsi:type="menu:HandledToolItem" xmi:id="_j-XIgGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handledtoolitem.hover" label="Hover" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/lightbulb.png" tooltip="Enable hover window in waveform" selected="true" type="Check" command="_uyeyYGtTEeqmlpoaaMHoiw"> | ||||
|           <tags>EnableHover</tags> | ||||
|         </children> | ||||
|       </children> | ||||
|     </trimBars> | ||||
|     <trimBars xmi:id="_JHMt8HS8EeWBq8z1Dv39LA" elementId="org.eclipse.ui.trim.status" side="Bottom"> | ||||
|       <children xsi:type="menu:ToolControl" xmi:id="_YsBi8HfLEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.StatusLine" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl"> | ||||
| @@ -156,6 +161,7 @@ | ||||
|   <handlers xmi:id="_UUnX8IoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.handler.set_them" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ThemeSetHandler" command="_KlGlsIoNEeWxJ_wPkM6yGQ"/> | ||||
|   <handlers xmi:id="_V4EscIuGEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.setreleationtype" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SetRelationTypeHandler" command="_E9lUgIt2EeWid7xO48ZBXw"/> | ||||
|   <handlers xmi:id="__99WoJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handler.loadStoreSettings" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.LoadStoreSettingsHandler" command="_7-AIMJebEeW09eyIbHsdvg"/> | ||||
|   <handlers xmi:id="_x4pSEGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handler.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableHover" command="_uyeyYGtTEeqmlpoaaMHoiw"/> | ||||
|   <bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA"> | ||||
|     <bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA"> | ||||
|       <tags>type:user</tags> | ||||
| @@ -286,6 +292,7 @@ | ||||
|   <commands xmi:id="_4C_asM3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.command.changevaluedisplay" commandName="Change Value Display Command"> | ||||
|     <parameters xmi:id="_4C_asc3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay" name="Type" optional="false"/> | ||||
|   </commands> | ||||
|   <commands xmi:id="_uyeyYGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.command.enablehover" commandName="Enable hover" description="Enable hover window in waveform"/> | ||||
|   <addons xmi:id="_95PfsnNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/> | ||||
|   <addons xmi:id="_95Pfs3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/> | ||||
|   <addons xmi:id="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/> | ||||
|   | ||||
| @@ -5,34 +5,34 @@ Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true | ||||
| Bundle-Version: 2.4.0.qualifier | ||||
| Bundle-Vendor: %Bundle-Vendor | ||||
| Require-Bundle: javax.inject;bundle-version="1.0.0", | ||||
|   org.eclipse.core.runtime;bundle-version="3.11.1", | ||||
|   org.eclipse.swt;bundle-version="3.104.1", | ||||
|   org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100", | ||||
|   org.eclipse.jface;bundle-version="3.11.0", | ||||
|   org.eclipse.e4.ui.services;bundle-version="1.2.0", | ||||
|   org.eclipse.e4.ui.workbench;bundle-version="1.3.0", | ||||
|   org.eclipse.e4.core.di;bundle-version="1.5.0", | ||||
|   org.eclipse.e4.ui.di;bundle-version="1.1.0", | ||||
|   org.eclipse.e4.core.contexts;bundle-version="1.4.0", | ||||
|   com.minres.scviewer.database.ui.swt;bundle-version="1.0.0", | ||||
|   com.minres.scviewer.database.ui, | ||||
|   com.minres.scviewer.database;bundle-version="1.0.0", | ||||
|   org.eclipse.equinox.ds;bundle-version="1.4.300", | ||||
|   org.eclipse.equinox.util;bundle-version="1.0.500", | ||||
|   org.eclipse.osgi.services;bundle-version="3.5.0", | ||||
|   org.eclipse.e4.core.services;bundle-version="2.0.0", | ||||
|   org.eclipse.osgi.services;bundle-version="3.5.0", | ||||
|   org.eclipse.core.jobs, | ||||
|   org.eclipse.osgi, | ||||
|   com.google.guava, | ||||
|   org.eclipse.equinox.preferences, | ||||
|   org.eclipse.core.expressions, | ||||
|   org.eclipse.e4.core.commands;bundle-version="0.11.0", | ||||
|   org.eclipse.e4.ui.workbench.addons.swt, | ||||
|   com.opcoach.e4.preferences, | ||||
|   org.eclipse.e4.core.di.extensions, | ||||
|   org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0" | ||||
|  org.eclipse.core.runtime;bundle-version="3.11.1", | ||||
|  org.eclipse.swt;bundle-version="3.104.1", | ||||
|  org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100", | ||||
|  org.eclipse.jface;bundle-version="3.11.0", | ||||
|  org.eclipse.e4.ui.services;bundle-version="1.2.0", | ||||
|  org.eclipse.e4.ui.workbench;bundle-version="1.3.0", | ||||
|  org.eclipse.e4.core.di;bundle-version="1.5.0", | ||||
|  org.eclipse.e4.ui.di;bundle-version="1.1.0", | ||||
|  org.eclipse.e4.core.contexts;bundle-version="1.4.0", | ||||
|  com.minres.scviewer.database.ui.swt;bundle-version="1.0.0", | ||||
|  com.minres.scviewer.database.ui, | ||||
|  com.minres.scviewer.database;bundle-version="1.0.0", | ||||
|  org.eclipse.equinox.ds;bundle-version="1.4.300", | ||||
|  org.eclipse.equinox.util;bundle-version="1.0.500", | ||||
|  org.eclipse.osgi.services;bundle-version="3.5.0", | ||||
|  org.eclipse.e4.core.services;bundle-version="2.0.0", | ||||
|  org.eclipse.osgi.services;bundle-version="3.5.0", | ||||
|  org.eclipse.core.jobs, | ||||
|  org.eclipse.osgi, | ||||
|  com.google.guava, | ||||
|  org.eclipse.equinox.preferences, | ||||
|  org.eclipse.core.expressions, | ||||
|  org.eclipse.e4.core.commands;bundle-version="0.11.0", | ||||
|  org.eclipse.e4.ui.workbench.addons.swt, | ||||
|  com.opcoach.e4.preferences, | ||||
|  org.eclipse.e4.core.di.extensions, | ||||
|  org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0" | ||||
| Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||||
| Import-Package: com.minres.scviewer.database, | ||||
|   javax.inject;version="1.0.0" | ||||
|  javax.inject;version="1.0.0" | ||||
| Automatic-Module-Name: com.minres.scviewer.e4.application | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								com.minres.scviewer.e4.application/icons/lightbulb.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								com.minres.scviewer.e4.application/icons/lightbulb.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 782 B | 
							
								
								
									
										
											BIN
										
									
								
								com.minres.scviewer.e4.application/icons/magifier_zoom_out.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								com.minres.scviewer.e4.application/icons/magifier_zoom_out.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 657 B | 
							
								
								
									
										
											BIN
										
									
								
								com.minres.scviewer.e4.application/icons/magnifier.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								com.minres.scviewer.e4.application/icons/magnifier.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 615 B | 
							
								
								
									
										
											BIN
										
									
								
								com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 680 B | 
| @@ -22,6 +22,7 @@ public class Messages extends NLS { | ||||
| 	public static String RelationTypeToolControl_1; | ||||
| 	public static String ResourceManager_0; | ||||
| 	public static String SCViewerPreferencesPage_0; | ||||
| 	public static String SCViewerPreferencesPage_1; | ||||
| 	public static String StatusBarControl_1; | ||||
| 	public static String StatusBarControl_2; | ||||
| 	public static String StatusBarControl_3; | ||||
|   | ||||
| @@ -0,0 +1,49 @@ | ||||
|   | ||||
| package com.minres.scviewer.e4.application.handlers; | ||||
|  | ||||
| import java.util.LinkedList; | ||||
| import java.util.List; | ||||
|  | ||||
| import javax.annotation.PostConstruct; | ||||
| import javax.inject.Inject; | ||||
|  | ||||
| import org.eclipse.core.runtime.preferences.IEclipsePreferences; | ||||
| import org.eclipse.e4.core.contexts.Active; | ||||
| import org.eclipse.e4.core.di.annotations.Execute; | ||||
| import org.eclipse.e4.core.di.extensions.Preference; | ||||
| import org.eclipse.e4.ui.model.application.MApplication; | ||||
| import org.eclipse.e4.ui.model.application.ui.basic.MPart; | ||||
| import org.eclipse.e4.ui.model.application.ui.basic.MWindow; | ||||
| import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; | ||||
| import org.eclipse.e4.ui.workbench.modeling.EModelService; | ||||
|  | ||||
| import com.minres.scviewer.e4.application.preferences.PreferenceConstants; | ||||
|  | ||||
| @SuppressWarnings("restriction") | ||||
| public class EnableHover { | ||||
| 	static final String TAG_NAME = "EnableHover"; //$NON-NLS-1$ | ||||
|  | ||||
| 	@Inject | ||||
| 	@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) | ||||
| 	IEclipsePreferences prefs; | ||||
|  | ||||
| 	@Inject | ||||
| 	MApplication application; | ||||
| 		 | ||||
| 	@PostConstruct | ||||
| 	public void initialize(EModelService modelService) { | ||||
| 		List<String> tags = new LinkedList<>(); | ||||
| 		tags.add(TAG_NAME); | ||||
| 		List<MHandledItem> elements = modelService.findElements(application, null, MHandledItem.class, tags ); | ||||
| 	   // cover initialization stuff, sync it with code | ||||
| 		for( MHandledItem hi : elements ){ | ||||
| 			hi.setSelected(prefs.getBoolean(PreferenceConstants.SHOW_HOVER, true)); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	@Execute | ||||
| 	public void execute(@Active MPart part, @Active MWindow window, MHandledItem handledItem, EModelService modelService ) { | ||||
| 		prefs.putBoolean(PreferenceConstants.SHOW_HOVER, handledItem.isSelected()); | ||||
| 	} | ||||
| 		 | ||||
| } | ||||
| @@ -16,6 +16,7 @@ RelationTypeToolControl_0=------------ | ||||
| RelationTypeToolControl_1=Select | ||||
| ResourceManager_0=Wrong decorate corner | ||||
| SCViewerPreferencesPage_0=Check for changed database | ||||
| SCViewerPreferencesPage_1=Show hover window in waveform | ||||
| StatusBarControl_1=Currently running:  | ||||
| StatusBarControl_2=\nLast task:  | ||||
| StatusBarControl_3=Currently running:  | ||||
|   | ||||
| @@ -50,9 +50,6 @@ import com.minres.scviewer.e4.application.Messages; | ||||
|  */ | ||||
| public class AboutDialog extends Dialog { | ||||
|  | ||||
| 	/** The product title. */ | ||||
| 	private String productTitle=Messages.AboutDialog_0; | ||||
| 	 | ||||
| 	/** The copyright text. */ | ||||
| 	private String copyrightText=Messages.AboutDialog_1; | ||||
|  | ||||
| @@ -106,8 +103,8 @@ public class AboutDialog extends Dialog { | ||||
| 		styledText.setLayoutData(gd_styledText); | ||||
| 		Version version = Platform.getProduct().getDefiningBundle().getVersion(); | ||||
| 		String versionString = String.format("%d.%d.%d", version.getMajor(), version.getMinor(), version.getMicro()); | ||||
| 		String pt = NLS.bind(Messages.AboutDialog_0, versionString); | ||||
| 		styledText.setText(pt+copyrightText); | ||||
| 		String productTitle = NLS.bind(Messages.AboutDialog_0, versionString); | ||||
| 		styledText.setText(productTitle+copyrightText); | ||||
| 		styledText.setBackground(white); | ||||
| 		styledText.setWordWrap(true); | ||||
| 		styledText.setLeftMargin(5); | ||||
|   | ||||
| @@ -65,13 +65,13 @@ import org.eclipse.jface.viewers.StructuredSelection; | ||||
| import org.eclipse.swt.SWT; | ||||
| import org.eclipse.swt.events.DisposeEvent; | ||||
| import org.eclipse.swt.events.DisposeListener; | ||||
| import org.eclipse.swt.events.FocusListener; | ||||
| import org.eclipse.swt.events.PaintEvent; | ||||
| import org.eclipse.swt.events.PaintListener; | ||||
| import org.eclipse.swt.graphics.Font; | ||||
| import org.eclipse.swt.graphics.Point; | ||||
| import org.eclipse.swt.graphics.RGB; | ||||
| import org.eclipse.swt.graphics.Rectangle; | ||||
| import org.eclipse.swt.layout.GridData; | ||||
| import org.eclipse.swt.widgets.Composite; | ||||
| import org.eclipse.swt.widgets.Display; | ||||
| import org.eclipse.swt.widgets.Event; | ||||
| @@ -381,7 +381,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis | ||||
| 		 | ||||
| 		waveformPane.addDisposeListener(this); | ||||
|  | ||||
| 		waveformPane.getWaveformControl().setData(Constants.CONTENT_PROVIDER_TAG, new ToolTipHelpTextProvider() { | ||||
| 		waveformPane.getWaveformControl().setData(Constants.HELP_PROVIDER_TAG, new ToolTipHelpTextProvider() { | ||||
| 			@Override | ||||
| 			public String getHelpText(Widget widget) { | ||||
| 				return "Waveform pane: press F2 to set the focus to the tooltip"; | ||||
| @@ -390,6 +390,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis | ||||
| 		waveformPane.getWaveformControl().setData(Constants.CONTENT_PROVIDER_TAG, new ToolTipContentProvider() { | ||||
| 			@Override | ||||
| 			public boolean createContent(Composite parent, Point pt) { | ||||
| 				if(!prefs.getBoolean(PreferenceConstants.SHOW_HOVER, true)) return false; | ||||
| 				List<Object> res = waveformPane.getElementsAt(pt); | ||||
| 				if(res.size()>0) | ||||
| 					if(res.get(0) instanceof ITx) { | ||||
| @@ -438,6 +439,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis | ||||
| 								valueCol.setWidth(area.width - nameCol.getWidth()); | ||||
| 							} | ||||
| 						}); | ||||
| 						parent.addFocusListener(FocusListener.focusGainedAdapter(e -> { | ||||
| 							table.setFocus(); | ||||
| 						})); | ||||
| 						return true; | ||||
| 					} else  if(res.get(0) instanceof TrackEntry) { | ||||
| 						TrackEntry te = (TrackEntry)res.get(0); | ||||
|   | ||||
| @@ -67,6 +67,7 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer { | ||||
| 		IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE); | ||||
|  | ||||
| 		store.setDefault(PreferenceConstants.DATABASE_RELOAD, true); | ||||
| 		store.setDefault(PreferenceConstants.SHOW_HOVER, true); | ||||
|         for (WaveformColors c : WaveformColors.values()) { | ||||
|         	 store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$ | ||||
|         } | ||||
|   | ||||
| @@ -21,6 +21,9 @@ public class PreferenceConstants { | ||||
| 	/** The Constant DATABASE_RELOAD. */ | ||||
| 	public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$ | ||||
| 	 | ||||
| 	/** The Constant DATABASE_RELOAD. */ | ||||
| 	public static final String SHOW_HOVER="showWaveformHover"; //$NON-NLS-1$ | ||||
| 	 | ||||
| 	/** The Constant LINE_COLOR. */ | ||||
| 	public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$ | ||||
| 	 | ||||
|   | ||||
| @@ -36,6 +36,8 @@ public class SCViewerPreferencesPage extends FieldEditorPreferencePage { | ||||
|  | ||||
| 		addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, Messages.SCViewerPreferencesPage_0, | ||||
| 				getFieldEditorParent())); | ||||
| 		addField(new BooleanFieldEditor(PreferenceConstants.SHOW_HOVER, Messages.SCViewerPreferencesPage_1, | ||||
| 				getFieldEditorParent())); | ||||
|  | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user