How to make a shell behaves like CompletionProposalPopup#fProposalShell [message #1797684] |
Mon, 05 November 2018 07:29 |
Missing name Mising name Messages: 43 Registered: July 2011 |
Member |
|
|
Hello, I'm writing this message from Japan.
I want to make a tooltip shell which is available even in Modal Shell.
In the following SSCCE, tooltipShell fails to grab focus (fails to activate) when clicking.
It seems that [ org.eclipse.jface.text.contentassist.CompletionProposalPopup#fProposalShell ] can grab focus even if SourceViewer is placed in Modal Shell.
Note: fProposalShell is the popup shell which is used when completing.
I read the source code near fProposalShell but I didn't understand how to make it focusable.
Thank you very much in advance.
Here is a single file SSCCE :
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class ModalTooltipTest2 extends SWTApp {
public static void main(String[] args) {
Composite comp = launch(new FillLayout(), SWT.APPLICATION_MODAL | SWT.SHELL_TRIM);
comp.getShell().setLocation(100,100);
Label l = new Label(comp, SWT.NONE);
l.setText("TEST");
Shell tooltipShell = new Shell(Display.getCurrent(), SWT.ON_TOP | SWT.TOOL | SWT.RESIZE);
tooltipShell.setLayout(new FillLayout());
Text t = new Text(tooltipShell, SWT.BORDER | SWT.MULTI);
t.setText("TOOLTIP\nTEST\nI WANT TO MAKE THIS TEXT FOCUSED");
tooltipShell.setLocation(110, 110);
tooltipShell.pack();
tooltipShell.open();
loop();
}
}
class SWTApp {
private static Display display;
private static Shell shell;
protected static Composite launch( Layout layout , int shellStyle) {
display = new Display();
shell = new Shell(display, shellStyle);
shell.setLayout(new FillLayout());
Composite comp = new Composite(shell, SWT.None);
comp.setLayout( layout );
return comp;
}
protected static void loop() {
loop(true);
}
protected static void loop(boolean pack) {
shell.open();
if(pack) shell.pack();
while( !shell.isDisposed() ) {
if( !display.readAndDispatch() ) {
display.sleep();
}
}
display.dispose();
}
}
[Updated on: Mon, 05 November 2018 07:39] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04682 seconds