简体   繁体   中英

how to ask user if he wants to always show welcome page?

In my RCP application, I have a intro page, which has a few explanations about the product itself.
But the intro only shows up on the first time that the application is opened.
Is there a way to ask user if he wants to 'never show this again on startup'? my introContent:

<?xml version="1.0" encoding="utf-8" ?>
<introContent>
    <page id="root" content="content/root.xhtml" />
    <page id="concept1" content="content/concept1.xhtml" />
    <page id="concept2" content="content/concept2.xhtml" />

    <contentProvider id="awc"
        class="org.eclipse.ui.intro.contentproviders.AlwaysWelcomeCheckbox"
        pluginId="org.eclipse.ui.intro">
    </contentProvider>
</introContent>

any ideas?

thanks in advance

There's a workbench preference SHOW_INTRO defined in IWorkbenchPreferenceConstants . If this is true then intro page is opened during startup.

You would have to implement the asking the user part yourself (eg by showing a MessageDialogWithToggle when the Intro view is closed).

i've done the following:

public void postWindowOpen(){
     addPartListener();
}

    private void addPartListener() {
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener(new PartListenerAdapter() {

                @Override
                public void partClosed(IWorkbenchPart part) {
                    if(part.getClass().getCanonicalName().equals("org.eclipse.ui.internal.ViewIntroAdapterPart")){
                        //fechou a intro
                        System.out.println(part.getTitle());
                        MessageDialogWithToggle openToggle = MessageHelper.openToggle("Deseja mostrar a ajuda sempre?");
                        if(openToggle.open() == IDialogConstants.OK_ID){
                            if(openToggle.getToggleState()){
                                PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, true);
                            }
                        }
                    }
                }
            });
        }

it's just an 'alpha' version, but it's working! thank you guys

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM