Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » closing an Intro page programmatically?
closing an Intro page programmatically? [message #465439] Thu, 29 March 2007 15:28
Paul E. Keyser is currently offline Paul E. KeyserFriend
Messages: 878
Registered: July 2009
Senior Member
R3.2.1, WinXP

So, the Intro Page of my RCP is working pretty well (I extended IntroPart), and appears nicely.

BUT ... Eclipse's Intro-page logic is like this: (a) if current run is first time, or Intro was open
on shutdown of last run, show intro; (b) otherwise do not, unless user explicitly opens with the
Help -> menu item.

AND ... our logic requires: (a) if current run is missing X or Y data, show intro (whether current
run is first or not), but (b) if current run has the X and Y data, do NOT show intro (even if
current run is first or prior run had open Intro). [In the future, we may decide to show some Intro
always on first run.]

SO ... I wound up overriding in my WorkbenchWindowAdvisor as below -- but my code has to use an
Eclipse-internal field -- is there a better way to close the Intro?

thanks,
Paul

@Override
public void openIntro() {
if (doWeHaveAllTheData()) {
// the commented-out code fails to close whole Intro *View*:
// final IIntroManager mgr = PlatformUI.getWorkbench().getIntroManager()
// mgr.showIntro(getWindowConfigurer().getWindow(), true)

final IViewReference intro =
findViewReference(IIntroConstants.INTRO_VIEW_ID);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^PROBLEM IS HERE^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if (null != intro) {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().
getActivePage().hideView(intro);
}

} else {
super.openIntro();
// the next two lines are required in order to get the Intro
// on any run after the first one:
final IIntroManager mgr = PlatformUI.getWorkbench().getIntroManager();
mgr.showIntro(getWindowConfigurer().getWindow(), false);
}
}

The method findViewReference() is:

public static IViewReference findViewReference(final String id) {
final IWorkbenchWindow[] windows =
PlatformUI.getWorkbench().getWorkbenchWindows();

for (final IWorkbenchWindow window : windows) {
final IWorkbenchPage page = window.getActivePage();
if (null == page) {
continue;
}
final IViewReference viewRef = page.findViewReference(id);
if (null != viewRef) {
return viewRef;
}
}
return null;
}
Previous Topic:(Another) java.lang.RuntimeException: No application id has been found.
Next Topic:SWT to RCP project
Goto Forum:
  


Current Time: Tue Sep 17 06:42:27 GMT 2024

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

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

Back to the top