How to get the present object in an Eclipse RCP view? - eclipse-rcp

I'm starting with the coding of an Eclipse RCP and be relatively new to the RCP-World.
Currently i have one perspective with two views. One is a list with a tableViewer which shows a few names of workers.
The second view is a "single view" with a few textboxes. I use the ISelectionListener to notify when i have selected another entry in the list, so i can set the text boxes in the "single view" wiht the current selected worker objetc.
I didn't wrote the code on my own, and i used this page (Vogella) to learn all the stuff behind RCP.
My question is: How can i get the current Object showed by the active view? I mean, i have it
because of the SelectionListener, but i want to click on my own "save"
button to update changes to the object.
I want the object in the single view, so do i need another change listener, or is the object stored in the view and can i get it with the ISelection Interface?
Can someone tell me in one or two sentences how it works? Or is it
just too simple, because i couldn't find anything elsewhere.

This can be done, but is not very easy, because the behaviour is not very standard. You are treating the two views as one usually deals with linked controls of a dialog or window. That's not necessarily wrong, but i smells bad (I cannot recall an example in the Eclipse IDE). Are you sure you are not confusing the roles of Views and Viewers? A View, in Eclipse, is a "Part" of a Workbench (you have basically Views and Editors), each view shows information and/or performs actions, but they are typically quite decoupled, you should be able open and close freely and independently each View, they rarely interact with each other directly (they typically display information or modify objects in the workspace). Further, you should not have a "Save" button in a View (again, look at the Eclipse IDE as an example), changes done throught a view should be direct.
It is very doubtful for me that your design here in sound, perhaps you should instead use a single View, or a dialog. I suggest you to read more about Views.

Related

Build some sort of workflow in JavaFX

I'm trying to build some sort of visual workflow in JavaFX. I want my application to have one main screen with the next and previous buttons, something like an installer. When a user clicks next, all the elements of the next screen appear in the same element. All previous choices of the user have to be saved. So when a user clicks on the previous button that all of his choices are still there.
How would I go on to do this?
I found these links on Google, but they don't seem to help me. Something like this is a bit the direction that I want to go, but the code in this tutorial isnt't really that good for scene's with a lot of elements.
The DataFX Framework provides a Flow API that can be used to define workflows. By doing so you can simply navigate between MVC Groups by only using annotations or configurations. You can find some examples of the API here:
http://www.guigarage.com/2014/06/datafx-tutorial-5/
http://www.guigarage.com/2015/02/quick-overview-datafx-mvc-flow-api/
http://www.guigarage.com/2015/01/datafx-tutorial-6/
I haven't worked with JavaFX in a while, but I'll start by saying I really hope you are using the JavaFX scene builder.
The way I would do it off the top of my head without going back and relearning JavaFX is to create a main window in the scene builder, and have a sort of central content display area, which holds another custom JavaFX container that contains the content you want to display, of which you can then create several of and swap out which one is being displayed programmatically.
Basically, create several smaller components representing each step or screen and display them programmatically in an owning container.

forms showing in runtime as soon as they are created

In runtime when the forms are being created, 2 forms constantly keep appearing when I haven't programmed them to show as soon as they are created, and my system runs. I was wondering why this happened and whether there is anything to solve this? I don't think I need to show my code here since it's pretty basic and there is none for the OnCreate event.
From the main menu, use Project->Options->Forms, and remove the forms you don't want to see from the Auto-create list. (Click the >> button to move them from the left side to the right side.)
(It's worth mentioning that you can also affect the order in which any autocreated forms or datamodules are created from that dialog by just dragging them up or down in the list. Note that the first form to be created becomes the application main form, so when it is closed the application will close as well; this means that the only thing above your main form in the autocreate list should be datamodule(s) that are accessed by the main form.)
If you never want any forms auto-created, go to Tools->Options->Environment Options->Form Designer, and uncheck the very last item labeled Auto create forms & data modules at the bottom. Note that your main form will always be auto-created, as it's what controls the application's lifetime for form based applications.
By default delphi creates all the forms in the beginning. You can open the .dpr file and delete the ones that you don't need. You could also do that from the UI.
For the forms that you don't want to appear at the start of runtime, go to the properties of the form (lower left hand side) and uncheck Visible. This should do the trick

View visible across perspectives

I have an Eclipse RCP application that defines multiple perspectives. The default perspective allows opening views (through the showView method) that are not defined in the IPerspectiveLayout class.
When switching to another perspective, these views disappear as they belong to the default one.
Is there a way of making these views persistable through perspective changes?
AFAIK there is no way to do that in RCP other than to declare a view as "sticky". But the sticky views have their limitations, use it with great care.
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_ui_views.html
A sticky view is a view that will appear by default across all
perspectives in a window once it is opened. Its initial placement is
governemed by the location attribute, but nothing prevents it from
being moved or closed by the user. Use of this element will only cause
a placeholder for the view to be created, it will not show the view.
Please note that usage of this element should be done with great care
and should only be applied to views that truely have a need to live
across perspectives.
The view won't appear in the perspective, unless you define, that the view belongs to this perspective, while creating perspective layout or unless user opens it in the, using some action. So, you have to consider adding view placeholders to the perspective layout, see org.eclipse.ui.IFolderLayout.addPlaceholder(String viewId) method.

GWT Activity - Places => DialogBox?

I'm trying to use the GWT Activity & Place model, but I'm having some
troubles with it about how to use my activities.
I've got a LoginActivity which drives the user to another activity :
DemandsActivity.
My DemandsActivity manages a view ("DemandsView") which displays a
simple list of demands (with a CellTable).
The whole works fine.
I would like to be able to show the details of a demand, from a
selected line of my cellTable, by displaying
a DialogBox with the informations.
I thought I could use one more
activity to do that : DemandDetailsActivity.
But I don't know how to do that.
Or I've been wrong from the beginning. Maybe should I put several presenters (displays) into my activity ? One presenter to display my CellTable, and another one to display a selected element of my CellTable in a DialogBox, without changing Place ?
What do you think of that ?
Thanks
What you are trying to do is called master-detail view. People have been implementing it with GWT, just google around.
On a side note: in MVP parlance Activities are presenters and Views are displays, so when you say put several presenters (displays) into my activity it really makes no sense.
Presenters should correspond to a place and handle business logic. They should not be concerned with the display part. And they should be testable, which means they should run on desktop/server JRE without GWT client dependencies.
So, all the GUI building part should be inside Views. And, yes, you could have multiple Views per Activity if this makes sense. BUt, personally, I'd go with one View that shows details (possibly dialog) when Activity instructs it to.
You should normally have a one to one relationship between Places and Activities but you may have many Views per a given Activity. In the project I'm currently working on we create an interface per Presenter and its associated View and then have our Activities implement any Presenters for the Views it needs to display.

iPhone Table View Data Edit Pane

I have an application I'm working on, and I need the user to be able to add new "Shows", "Movements" and "Dots." These are all represented by classes. At the root of the application, all the shows are shown, the user can click on the show, see the movement in that show, then tap on a movement and see the dots in the movement. It works beautifully.
Now, I need the user to be able to add and edit these instances of these classes. The way I am thinking this will work is when the user clicks on the "Add Show" button (Or the "Add Movement", etc) a new view will be pushed onto the Navigation Controller. This works. When the button is pressed, a new instance of the show class is created, and passed to the new view controller. This also works. If the user wants to edit the show, then they will hit the edit button for the row, and the instance of the class (which already exists) will be passed to new view controller, and the user will be able to edit it (It should use the same view controller for adding and editing)
My question is, in the examples I have seen, it is always really dirty to create the editing view. The edit view is a table view with each row having some sort of control. Usually it is a UITextField, but it may be a slider, and it may be one where another view is popped, and the user needs to check one value. (This is similar to the address book application when adding and editing a contact)
Is there any way that is cleaner than just manually going in and creating a bunch of arrays to hold what custom table view cells need to be at what row? This gets very messy, very fast. I can do it this way, I just was wondering if there is a better, possibly faster way.
To my knowledge there's no structural solution to solve this. I'm afraid managing the cells with child UITextField or other controls yourself is the only method. This indeed gets dirty and painful very fast, I certainly feel your pain.
Although it doesn't exist, it would be very convenient if Apple added out of the box editing cells to the SDK, similar to the different normal cell styles. I haven't come across an open source project that addresses this issue, but it might exist.
If you do find a better/cleaner method to handle these situations, be sure to ping back.
as far as i know, editing mode is the only way to make the changes you describe (if i understood correctly). I agree that it doesn't seem like the most elegant approach.
http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/TableView_iPhone/ManageInsertDeleteRow/ManageInsertDeleteRow.html#//apple_ref/doc/uid/TP40007451-CH10-SW19