Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8961145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:49:10+00:00 2026-06-15T15:49:10+00:00

I have Eclipse RCP application. My own IntroPart extends org.eclipse.ui.part.IntroPart . Through inheritance I

  • 0

I have Eclipse RCP application. My own IntroPart extends org.eclipse.ui.part.IntroPart.

Through inheritance I got this method:

@Override
public void saveState(IMemento memento) {
}

Here it is stated that when the workbench is shut down, the method saveState is called on all open views. But this is true only if I close my whole application.

What should I do, to save the intro page state before if I close only this page, not the hole application?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:49:11+00:00Added an answer on June 15, 2026 at 3:49 pm

    Your link to the FAQ answers that:

    Another mechanism for persisting view state is the JFace IDialogSettings facility. The advantage of dialog settings over the view save/init mechanism is that you can control when settings are persisted.

    This is an example on how to use IDialogSettings to persist the state of an IntroPart when it is closed and how to restore it when it is created. MyIntroPart is an IntroPart that has a Text widget. The displayed text is saved when the IntroPart is closed and restored when it is created.

    To get the partClosed event, MyIntroPart implements IPartListener2 and registers itself with the PartService.

    private static final String MY_INTRO_SETTINGS = "my_intro_settings";
    private static final String MY_INTRO_TEXT_KEY = "my_intro_text";
    
    @Override
    public void createPartControl(Composite parent) {
        this.text = new Text(parent, SWT.BORDER);
    
        // try to load the settings
        IDialogSettings settings = Activator.getDefault().getDialogSettings();
        IDialogSettings section = settings.getSection(MyIntroPart.MY_INTRO_SETTINGS);
        if (section != null) {
            // set the restored text string in the text widget
            this.text.setText(section.get(MyIntroPart.MY_INTRO_TEXT_KEY));
        }
    
        // register the part listener
        getIntroSite().getWorkbenchWindow().getPartService().addPartListener(this);
    }
    

    This will restore the text to the text widget.

    MyIntroPart implements partClosed of IPartListener2 to save dialog settings when the view is closed:

    @Override
    public void partClosed(IWorkbenchPartReference partRef) {
        // remove part listener from part service
        getIntroSite().getWorkbenchWindow().getPartService().removePartListener(this);
    
        IDialogSettings settings = Activator.getDefault().getDialogSettings();
    
        // get the section of the text
        IDialogSettings section = settings.getSection(MyIntroPart.MY_INTRO_SETTINGS);
    
        // if it doesn't exist, create it
        if (section == null) {
            section = settings.addNewSection(MyIntroPart.MY_INTRO_SETTINGS);
        }
    
        // put text from text field in section
        section.put(MyIntroPart.MY_INTRO_TEXT_KEY, this.text.getText());
    }
    

    Thanks to fredrik for pointing out that no loading from or saving to a file is required here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Eclipse RCP application with own editor. Class editor extends from org.eclipse.ui.texteditor.AbstractTextEditor
I'm developing an Eclipse RCP application. I have been told that the UI part
I have an Eclipse RCP application which uses some bindings from org.eclipse.ui.defaultAcceleratorConfiguration in addition
I have an eclipse rcp application. This application will try to load class files
I am developing the Eclipse RCP application and have added org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false to the plugin_customization.ini
I have an eclipse rcp application. And I have a command when this command
I have an Eclipse RCP application that will launch properly after a clean install
I have an Eclipse RCP based Application, in which I have a menu of
I have an Eclipse RCP application that I'd like to make available to end
I have many views opened while My Eclipse RCP application is running.Could anyone show

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.