I am building an application with E4 and SWT . For a button click, sometimes a new window(shell) is opened. The problem is when I open a new window, I am unable to use the other windows, in a sense, it's getting locked. Unless I close the latest window, cannot access the others. This makes debugging a little difficult. I am not sure if this is due to e4 model or SWT framework.
Could you please tell me why this is and how to overcome this?
Thanks in advance.
I have run into this issue before as I was creating a new window (MWindow) and adding it to a perpective (MPerspective). If this is what you are doing then you have two options:
Add the new window to the application (MApplication) instead of the perspective
Add the tag IPresentationEngine.WINDOW_TOP_LEVEL to the new window. (For more Information see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=441251)
Additional Information to (2): If you also want your window to be minimizable and to have an icon representation in the windows task bar you can use the following setting to configure the renderer
MWindow window = modelService.createModelElement(MTrimmedWindow.class);
window.getTags().add(IPresentationEngine.WINDOW_TOP_LEVEL);
window.getPersistedState().put(IPresentationEngine.STYLE_OVERRIDE_KEY, "" + SWT.SHELL_TRIM);
I found what was wrong.
The shell creation was wrong because I was using APPLICATION_MODAL bit:
shell = new Shell(Display.getCurrent(), SWT.TITLE | SWT.CLOSE | SWT.MAX | SWT.SHELL_TRIM | SWT.APPLICATION_MODAL | SWT.YES | SWT.NO);
It had to be PRIMARY_MODAL:
shell = new Shell(Display.getCurrent(), SWT.TITLE | SWT.CLOSE | SWT.MAX | SWT.SHELL_TRIM | SWT.PRIMARY_MODAL | SWT.YES | SWT.NO);
Thanks for all the help.
Related
I'm using Codename One to develop a mobile app.
I have an outer-Container which I added an ActionListener by invoking the method addPointerReleasedListener to it.
There are more inner-Containers which are NOT added with any listeners.
To illustrate:
outer-Container (added `addPointerReleasedListener` to it)
- An Image Container (NO listener added)
- A Text Container (NO listener added)
--------------------------------------------------------------
| | | |
| | | |
| | Image | Some Text here |
| | | |
| | | |
--------------------------------------------------------------
^ ^ ^
works only if I click/press
here
I noticed that in order to invoke the event, I have to click/press on an area which is not occupied any inner-Containers. That is, it does not work if I click/press on any text and image areas (because there no listeners added to it). I have to specifically click/press on an "empty" area of the outer-Container. Obviously, this does not make sense because I want to make the entire container react the same way when the user clicks/presses anywhere within it.
What is the best method/practice to implement this? (I find it a bit redundant to add the same listener to many inner-Containers.)
Your approach won't work properly on real devices.
Create a button and add your actionListener to it and set your outer container's leadComponent to that button.
Button btn = new Button("");
btn.addActionListener(e -> {
//Your action here
});
outerContainer.setLeadComponent(btn);
You don't have to add that button to your container, just set it as the leadComponent only.
Overview
I have an application that consists of a SplitLayoutPanel that has a StackLayoutPanel with two menu selections on the left and a DeckLayoutPanel on the right. The DeckLayoutPanel has two subpanels, one a SimpleLayoutPanel containing a Label and one a DockLayoutPanel containing a Label and another SimpleLayoutPanel. The last SimpleLayoutPanel contains a DataGrid.
SplitLayoutPanel (TestUI)
|
+ StackLayoutPanel
| |
| + CellList (Profile)
| |
| + CellList (Admin)
|
+ DeckLayoutPanel
|
+ SimpleLayoutPanel
| |
| + Label
|
+ DockLayoutPanel (BudgetPanel)
|
+ Label
|
+ SimpleLayoutPanel (LedgerPanel)
|
+ DataGrid
All subpanels have their height and width set to 100% by their containing panels.
Expected Behavior
The expected behavior is that clicking on the "Budget" menu item in the StackLayoutPanel will show the BudgetPanel, including the LedgerPanel's DataGrid.
Observed Behavior
When the "Budget" menu item is clicked, the DockLayoutPanel is displayed, with its header Label, the DataGrid column headers are displayed, but the DataGrid rows do not appear.
When a Label is added to the south area of the DockLayoutPanel, the application compiles but nothing is displayed, not even the top level StackLayoutPanel.
When the DataGrid is replaced with a CellTable, the data is displayed (although the height of each row is much more than necessary to hold the data).
Questions
What needs to be done to get the DataGrid to display as expected?
How can the rows be styled to have a smaller height?
Source Code
The full source code demonstrating this problem is available on GitHub.
I've looked really fast at your code, and from what I saw, you've set a height of 100% for your datagrid. Unfortunately in GWT, you have to put a fixed value for your datagrid.
datagrid.setHeight("300px");
You can do a workaround by dynamically changing the height of your datagrid.
Window.addResizeHandler(new ResizeHandler() {
#Override
public void onResize(ResizeEvent event) {
datagrid.setHeight(Window.getClientHeight() - menuSize);
}
});
I got the answer from Thomas Broyer on the GWT mailing list. The trick is to call forceLayout() on the BudgetPanel instance when it is shown in its containing DeckLayoutPanel.
Thanks for all the suggestions.
It's late, I'm tired and I can't figure out why a simple popup panel instead of showing as it should, displays a label beneath my. For example:
|SOME CLICKABLE BUTTONS| | |
|SOME MORE OPTIONS | | SOME CONTENT |
|EVEN MORE OPTIONS | | |
|Please wait|
"Please wait" is the label as you can see is created like so in the:
#Override
public void onModuleLoad()
{ ...<snip> //creates
final PopupPanel popup = new PopupPanel(false, true);
popup.add(new Label("Please wait"));
popup.center();
RootPanel.get().add(popup);
Some things you should know:
I'm running this in development mode via Jetty. I'm using reflections without class literals to load my panels because I haven't come round to implementing the workaround using generators (and the application is rather large, so it needs splitting). Though I doubt these things are causing it problems.
Shouldn't upon load, a popup display? My overall goal is to have something which displays a loading gif everytime a new part of the application is loading.
Do not add your PopupPanel to a RootPanel.
Delete this line
RootPanel.get().add(popup);
and it will work.
In Eclipse plugin development How to open standard View like InternalWebBrowser or bring up/activate Console View (all those standard things)?
To open the Internal Browser you need this code:
int style = IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.STATUS;
IWebBrowser browser = WorkbenchBrowserSupport.getInstance().createBrowser(style, "MyBrowserID", "MyBrowserName", "MyBrowser Tooltip");
browser.openURL(new URL("http://www.google.de"));
Alternative:
final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser("abc");
browser.openURL(new URL("http://www.google.de"));
To open a view use this:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(arg0);
I have a basic implementation of ElementListSelectionDialog, like following.
ElementListSelectionDialog dialog =
new ElementListSelectionDialog(shell, new LabelProvider());
dialog.setElements(new String[] { "Linux", "Mac", "Windows" });
dialog.setTitle("Which operating system are you using");
dialog.open();
The dialog opens well, but the list is empty, and when we type something in the search field, nothing happens.
I don't have any exception, I am under Eclipse Kepeler 4.3
I read somewhere that the selection dialog are directly reusable after 4.2 release of eclipse.
I deeply examined the ElementListSelectionDialog class, and I found that the problem comes from FiltredList not draw the elements provided via LabelProvider.
FilteredList list = new FilteredList(workArea,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL,new LabelProvider(),false,true,true);
list.setLayoutData(new GridData(GridData.FILL,
GridData.BEGINNING, true, false, 1, 1));
list.setFilter(""); //$NON-NLS-1$
list.setElements( new Object[] {"Item 1","Item 2","Item 3","Item"});
I don't know why it does not work for me, but one thing I am sure of is that it works fine in the Eclipse IDE.
I think I have no alternative, I must define my own Dialog based on a TableViewer
Has anyone succeeded to run a ElementListSelectionDialog in Eclipse 4 because it would be a shame not to use it, it's a Dialog to use as standrad
I have the same issue. Dialog updates it content via TableUpdateJob. Method schedule contains check against PlatformUI.isWorkbenchRunning(). So ever if you have custom RCP application you must start Workbench anyway or emulate this behavior.