how to save data after closing view - eclipse-rcp

In a view I have a tree viewer. I set data in tree viewer. Now, I close application. Again I run application, Now again I have to set the data from beginning. I want that My data will saved, it will not vanished.

You can use preferences.Copy your data in preferences, and while loading the tree view again get your data from preferences again.
refer this http://www.vogella.com/tutorials/EclipsePreferences/article.html

Related

I can't save data in table in PgAdmin

I am trying to add data manually to my table customers in PgAdmin and then I would like to click the save button and save them in the table.
The problem is that the save button is unclickable.
Here are the screenshots:
I only manage to save these two rows by exiting this window and when the prompt says if I would like to save the data I click yes and it saves it but I would like to save them by clicking on the save button in this window.
How can I do that?
Thank you for your help.
Perhaps you didn't want to save them to a new file Save File (accesskey + S), but you wanted to save the changes you made on that file. What you want is to click Save Data Changes (F6) instead.

Project data doesn't updates / Mapbox

I'm using Mapbox editor (https://www.mapbox.com/editor) for editing my maps.
But after first save, only Editor view updates with new data.
So, I'm adding new markers and press Save and see changes on the screen.
But my embeded map doesn't have new updates.
I've also checked 'markers.geojson' and Share link, both have only first time saved data.
I've checked diff preferences but can't find anything related to this issue...
Got response from Mapbox:
"Between the time that you edit data on your maps and when the GeoJSON
public representation (your markers) updates, there's a delay of up to
an hour. Hope this helps and let me know if you have questions."
Yes, looks like it updates with delay or how i suppose rather ones per hour.

Best way to update view from command or filedialog in an eclipse rcp application

In my application I have a menu which open a SelectionDialog, this dialog is used to choose an object.
When this object is selected I have to display it in the view.
What is the best way to update my view?
Currently, I call myview.update(object) after the dialog is closed (in the handler of the menu). But I think this solution is not well design.
I have read about update my model and notify my view but my model does not change (no data are changed, I only display different Data ).
Does anyone has some ideas for a well design solution ?
Define model listener ( dataPopulated(Event e))
Make your view implement model listener and register it with the Model.
Define a Model class that can contain the objects that you want to populate in the view
When Model.setInput(Object input) is invoked fire dataPopulated() event on all registered model listeners.
Above steps works properly when you have view activated. You need to consider cases like when if view is deactivated or not visible ( make sure you refresh view is visible else you will have unnecessary overhead of refreshing view though it is notvisible)
Try adding a selection listener in the view and register this selection in the dialog.
In the listener action, add the code to show the selected object.

Updating a view from a command handler

I have a file dialogue opening from the menu where a user can select a file. The FileDialog is called from the menu command's handler class in execute().
Based on the file the user selected, I would like to update a view, for which (I believe) I'd need the same Composite element that's passed to the view in createPartControl().
Is it possible to get access to it from the command handler, or would it be better to trigger the view updating via something like ISourceProviderListener or PropertyChangeListener?
Thank you.
Yes, it's possible:
IViewPart part = HandlerUtil.getActiveWorkbenchWindow(executionEvent).getActivePage()
.findView(viewId);
It would be better to first update the data that your view is displaying (the model in MVC) and the change in data should trigger view refresh. It's hard to say which listener is better without knowing all the details.

How to view updated data on one property page updated by another property page without closing the properties in eclipse plugin?

I am facing a strange issue!!
I have a set of property page with same storage file.
The scenario is as follow..
For the first time opening the properties by right clicking on the project, list of property pages are viewed. I click on the first property page and make changes then apply the changes to the file.
Now I select the second page, it shows the changes that were applied from the first page.
But now without closing the properties i go back to first page and make changes then apply the changes.
Then again I go to second page it wont show the updated data. The changes that were applied are not viewed until I close the properties and reopen then by right clicking on the project.
My question is
"Is there any way to reflect changes on the pages without closing the properties??"
I appreciate your valuable time you will give for reading and replying..
Plz help
Your problem seems to just absent of reliable model which can notify problem.
If the properties are related IProject.
You should use ScopedPreferenceStore as model.
IScopeContenxt scope = new ProjectScope(myProject);
IPreferenceStore store =
new ScopedPreferenceStore(scope, "myProperties(qualifier)");
IPreferenceStore can manipulate primitive data, default value. And it support property change event. You can create multiple instances of IPreferenceStore, If they have same scope and qualifier then automatically synchronized. So individual page can retrive input model without coupling.