Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » how to (programmatically) not show welcome page at startup?
how to (programmatically) not show welcome page at startup? [message #260007] Fri, 09 July 2004 01:15 Go to next message
Eclipse UserFriend
When automating GUI testing (JUnit driving SWT using Abbot), I want to
minimize my interactions with "non-essential" UIs (i.e. unrelated to
the UIs I want to test), such as the welcome page. I'm trying to do
this like (disconnected snippets follow)

protected void setUp() throws CoreException, InvocationTargetException,
InterruptedException, Exception {
IWorkbench iw = PlatformUI.getWorkbench();
// Set the (persistent) pref to always switch to new perspective
// if requested by new project.
WorkbenchLaunchUtils.alwaysSwitchToPerspective(iw);
// Set the (persistent) pref to NOT show welcome page on startup.
WorkbenchLaunchUtils.preventWelcomePage(iw);
// getWorkbenchWindows() returns a list of the open "main windows"
// associated with this workbench--wizards and dialogs are not included.
IWorkbenchWindow iww = iw.getWorkbenchWindows()[0];
parentShell = iww.getShell();
EclipseUtilities.bringToFront(parentShell);
wbd = parentShell.getDisplay();
}

/**
* Clear the preference to view welcome page at startup.
*/
public static void preventWelcomePage(IWorkbench iw) {
IPreferenceStore ps = iw.getPreferenceStore();
PreferenceUtils.setWelcomeOnStartup(false, ps);
}

/**
* Set the preference to view welcome page on startup.
*/
public static void setWelcomeOnStartup(boolean trueToShow,
IPreferenceStore ps) {
setBooleanPreference(IDEInternalPreferences.WELCOME_DIALOG,
trueToShow, ps);
}

/**
* Set the value of the preference named by the passed key
* into the passed <code>IPreferenceStore</code>.
*/
public static void setBooleanPreference(
String key, boolean val, IPreferenceStore ps) {
Assert.isNotNull(ps, "ERROR: bad PreferenceStore");
if (isEmpty(key)) { // TODO_Tom: can validate more?
Logger.log("ERROR: bad key");
} else {
if (ps.contains(key)) {
ps.setValue(key, val);
} else {
Logger.log(
"ERROR: PreferenceStore does not contain desired pref key=\"" +
key + "\""
);
}
}
}

The workbench launches (with Run>JUnit Plug-in Test) and I can
interact with it ... but it's showing the @#$%^&! welcome page.
What am I doing wrong?
Re: how to (programmatically) not show welcome page at startup? [message #260806 is a reply to message #260007] Mon, 12 July 2004 12:49 Go to previous message
Eclipse UserFriend
Originally posted by: xxx.ca.ibm.com

Tom,
it seems to me that you are using an internal preference (which might be the
preference that the workbench uses to remember if this is the first time the
workbench has been started or not). As cliche as it may sound, this is not
recommended.

Why dont you try to programatically close the Welcome page after it has been
opened? Is that too late?
look at the IIntroManager.closeIntro() api. maybe that might be a better
solution.

Mazen.



"Tom Roche" <tlroche@us.ibm.com> wrote in message
news:ccl9k9$9mn$1@eclipse.org...
> When automating GUI testing (JUnit driving SWT using Abbot), I want to
> minimize my interactions with "non-essential" UIs (i.e. unrelated to
> the UIs I want to test), such as the welcome page. I'm trying to do
> this like (disconnected snippets follow)
>
> protected void setUp() throws CoreException, InvocationTargetException,
> InterruptedException, Exception {
> IWorkbench iw = PlatformUI.getWorkbench();
> // Set the (persistent) pref to always switch to new perspective
> // if requested by new project.
> WorkbenchLaunchUtils.alwaysSwitchToPerspective(iw);
> // Set the (persistent) pref to NOT show welcome page on startup.
> WorkbenchLaunchUtils.preventWelcomePage(iw);
> // getWorkbenchWindows() returns a list of the open "main windows"
> // associated with this workbench--wizards and dialogs are not
included.
> IWorkbenchWindow iww = iw.getWorkbenchWindows()[0];
> parentShell = iww.getShell();
> EclipseUtilities.bringToFront(parentShell);
> wbd = parentShell.getDisplay();
> }
>
> /**
> * Clear the preference to view welcome page at startup.
> */
> public static void preventWelcomePage(IWorkbench iw) {
> IPreferenceStore ps = iw.getPreferenceStore();
> PreferenceUtils.setWelcomeOnStartup(false, ps);
> }
>
> /**
> * Set the preference to view welcome page on startup.
> */
> public static void setWelcomeOnStartup(boolean trueToShow,
> IPreferenceStore ps) {
> setBooleanPreference(IDEInternalPreferences.WELCOME_DIALOG,
> trueToShow, ps);
> }
>
> /**
> * Set the value of the preference named by the passed key
> * into the passed <code>IPreferenceStore</code>.
> */
> public static void setBooleanPreference(
> String key, boolean val, IPreferenceStore ps) {
> Assert.isNotNull(ps, "ERROR: bad PreferenceStore");
> if (isEmpty(key)) { // TODO_Tom: can validate more?
> Logger.log("ERROR: bad key");
> } else {
> if (ps.contains(key)) {
> ps.setValue(key, val);
> } else {
> Logger.log(
> "ERROR: PreferenceStore does not contain desired pref key=\"" +
> key + "\""
> );
> }
> }
> }
>
> The workbench launches (with Run>JUnit Plug-in Test) and I can
> interact with it ... but it's showing the @#$%^&! welcome page.
> What am I doing wrong?
Previous Topic:Storing multidimensional String arrays in preferences
Next Topic:[Bug?] Feature build errors
Goto Forum:
  


Current Time: Thu Jul 17 21:51:05 EDT 2025

Powered by FUDForum. Page generated in 1.06852 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top