Community
Participate
Working Groups
In initial useability testing of our RCP app, users had the biggest problems understanding and even *finding* perspectives. We'd like to have the perspective bar prepopulated. From news:eclipse.platform.rcp: "Chris" <schtoo@schtoo.com> wrote in message news:ctqpsk$231 $1@www.eclipse.org... > Hi Paul, > > I need the same functionality. I've found that the biggest useability > problem with our RCP app so far is understanding and even *finding* > perspectives. I have also thought to preload the perspective bar. > Unfortunately this is not really possible. One option is to create a custom > workbench layout. There were some bugs when creating a custom workbench > layout which I believe are fixed or being worked on. Once we are able to > create a custom workbench layout, then we can create our own toolbar in > place of the current perspective switcher. Its a lot of work for a small > change though. > > I will submit a bug request that we have an option to preload the > perspective bar. > > -Chris > > > "pmurphy" <pmurphy@dimensional.com> wrote in message > news:ctoku3$30h$1@www.eclipse.org... >> Hello, >> >> I have a minimal RCP app with a few perspectives. In one of the RCP >> examples, http://www.eclipse.org/articles/Article-RCP-3/tutorial3.html, I >> found out how to add all of my perspectives to the dropdown menu which >> appears when the "open a perspective" button is pressed, using >> >> layout.addPerspectiveShortcut( MyViewPart1.ID ); >> layout.addPerspectiveShortcut( MyViewPart2.ID ); ... etc., >> >> in createInitialLayout(). However, I'd also like to have all of the >> perspective buttons show up by default when the user opens the app, >> instead of having each button appear only after the user has selected the >> perspective from the dropdown menu. >> >> I've seen in other posts where the position of the perspective bar can be >> configured in plugin_configuration.ini. Is there any value in there which >> will give the behavior I am looking for? >> >> Thanks, Paul > >
Thank you for entering this, Chris. I hope this is not a dupe. I just want to advocate for this bug from the perspective of someone new to the Eclipse platform. I really am impressed with Eclipse and I wouldn't do desktop java development without it, but the API and library design can seem really obscure to a newcomer. I think this bug is an example of that.
A workaround is to open the extra perspectives when the window is first opened (not when restored from a previous session). For example, in the workbench advisor: public void postWindowRestore(IWorkbenchWindowConfigurer windowConfigurer) throws WorkbenchException { windowConfigurer.setData("restored", Boolean.TRUE); //$NON-NLS-1$ } public void postWindowCreate(IWorkbenchWindowConfigurer configurer) { if (Boolean.TRUE.equals(configurer.getData("restored"))) //$NON-NLS-1$ return; IWorkbenchPage page = configurer.getWindow().getActivePage(); if (page != null) { IPerspectiveDescriptor activePersp = page.getPerspective(); IPerspectiveRegistry reg = getWorkbenchConfigurer().getWorkbench().getPerspectiveRegistry(); IPerspectiveDescriptor javaPersp = reg.findPerspectiveWithId("org.eclipse.jdt.ui.JavaPerspective"); //$NON-NLS-1$ if (javaPersp != null) page.setPerspective(javaPersp); page.setPerspective(activePersp); } }
Thanks Nick. I'll have to test it, but that may be enough to close this issue...
(In reply to comment #3) > Thanks Nick. I'll have to test it, but that may be enough to close this > issue... Chris, it is working for me. I made a follow up post in eclipse.platform.rcp concerning it, in case others were interested. However, I have found that I have no control over the order in which the buttons are populated into the perspective bar. This is not a critical problem for me at this time, but I did try to vary the order in which I passed my IPerspectiveDescriptors to page.setPerspective(), but the buttons always appeared in the same order. I do not know if this would be considered a separate issue. (btw, I am using 3.0.1, and I see from this bug you are using 3.1.)
I was able to order the buttons how I wanted. Are you sure you were resetting the workspace between each test? Nick's workaround only populates the perspectives if this is the first time the workbench has been open. Also the perspectives are populated in reverse from how you open them (because each new perspective is added to the front of the list). I did have to close and reopen the default perspective so it would show first. As it turns out though, this isn't an ideal solution for us. Some of our perspectives have views that load a significant amount of data when they open. So opening each perspective takes some time (during which progress dialogs are flashing up). I am hoping we could eventually have a mechanism to prepopulate the perspectives w/o actually loading them. Another related issue, now that we prepopulate the persp bar, plus the fact that we hard code an initial dock on top right preference, the perspective bar isn't big enough to show all the perspectives. Is there any way to programmatically alter the sizing/width of the perspective bar?
The workaround does have the problem with eager activation. I'm leaving this bug open since the original request makes sense, and can take advantage of the lazy perspective creation already done by the workbench. The order of items should be stable, even if they're displayed in the inverse order (there's an existing bug report for this). For the sizing question, please do a query against Platform UI and subject keywords: perspective size. If none of these cover the issue, please file a new one.
I didn't see a similar issue. Its added as Bug 84603.
This workaround is not working for me. When I load a perspective that is defined in a dependent plugin, I get a class not found exception. It look like it is using the CreateExecutableExtension mechanism, which I would expect to sort out the classloader issues. Is anyone else having success loading Perspectives in a workbench advisor for plugin A where the perspective belongs to plugin B and B depends on A?
Chris, the workbench just tries to instantiate the perspective factory using the regular createExecutableExtension. So it's OK for the advisor and perspective to be defined in different plug-ins, as long as all classes needed by the perspective factory are available in either its plug-in or its prerequisites. Try running with -debug and -consoleLog to see if that gives any more details about plug-in dependency problems.
The code to open the extra perspectives when the window is first opened (not when restored from a previous session) seems to be slow. I can see the RCP app switch perspectives when going through the loop to populate the perspective bar with _all_ perspectives. -- Ketan Padegaonkar
Could try window.getShell().setRedraw(false), setRedraw(true) around the change.
(In reply to comment #11) > Could try window.getShell().setRedraw(false), setRedraw(true) around the change. I'm also interested in this feature. I'll give a try of this workaround and report it back but I also would love to see a clean implementation of this fix, not only offering workarounds..
I'd like to provide one too, but unfortunately I just can't for 3.1.
Sure, got your point with the roadmap. At least we'll have something to eagerly wait on post-3.1 releases ;) Disabling the shell redraw for the operation makes it beautifully working, thanks for the suggestion. For the future however, it'd be a must-have to have a clean way of defining what perspectives to show by default, disabling the local menu for customizing/closing/etc perspectives and disabling the open perspective button completely. For non power-users of an RCP application all these are both very confusing and doesn't needed at all..
I agree totally with your suggestions. One of the main themes of the RCP work has been that RCP apps often want to restrict what the user can do much more than in the IDE scenario.
Created attachment 24114 [details] Modified browser example showing custom perspective bar Modified browser example showing a custom perspective bar in a custom window layout. It adds a second perspective, and adds a toolbar containing two items for switching between the two perspectives. See BrowserWindowAdvisor.createWindowContents.
To prevent truncation of the buttons when dragging the banner's edge, add: banner.setRightMinimumSize(perspectiveBar.computeSize(SWT.DEFAULT, SWT.DEFAULT)); after: banner.setRight(perspectiveBar); in createWindowContents.
I would like to emphasize that it is not a satisfactory solution to actually open the perspectives you want to show on the perspective bar simply to get them to display on the bar. In the application I'm working on, my some of perspectives are very data intensive, and require significant database accesses. I wouldn't want to do them every time someone logs in, but I would like the user to have ready access to them.
(In reply to comment #16) > Created an attachment (id=24114) [edit] > Modified browser example showing custom perspective bar > > Modified browser example showing a custom perspective bar in a custom window > layout. It adds a second perspective, and adds a toolbar containing two items > for switching between the two perspectives. See > BrowserWindowAdvisor.createWindowContents. > I created the perspective CBanner exactly the same way on the browser example showing custom perspective bar, but its raises an ERROR_INVALID_ARGUMENT when i set the left side of the CBanner (at banner.setLeft(coolBar);)
I've added support for this by allowing a preference to be set, specifying the perspectives to add to the perspective switcher when the workbench page is first opened. In IWorkbenchPreferenceConstants: /** * Lists the extra perspectives to show in the perspective bar. * The value is a comma-separated list of perspective ids. * The default is the empty string. * * @since 3.2 */ public static final String PERSPECTIVE_BAR_EXTRAS = "PERSPECTIVE_BAR_EXTRAS"; //$NON-NLS-1$ The recommended approach is to use the preference override mechanism described here: http://wiki.eclipse.org/index.php/RCP_FAQ#customPrefs For example, the following entry in the .ini file will add the Java, Debug and CVS perspectives (should all be on one line): org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS=org.eclipse.jdt.ui.JavaPerspective, org.eclipse.debug.ui.DebugPerspective, org.eclipse.team.cvs.ui.cvsPerspective I'd appreciate it if interested folks could try this out and give feedback. The interaction between the "extras" list and the open perspectives may be a bit strange. Note that the initial sizing issue is covered by bug 84603. Being able to preload the perspective bar exacerbates the initial sizing problem.
Note that it's not just the initial window that gets the extra buttons -- they're added in any new window. Buttons for perspectives that are not yet open in the page do not show a Close action.
Verified in I20060213-1200.
This bug has introduced bug 127470 Commenting out this line seems to fix it: class ChangeListener extends PerspectiveAdapter implements IPageListener { public void perspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) { >>>>> if (findPerspectiveShortcut(perspective, page) == null) addPerspectiveShortcut(perspective, page); }
I've fixed bug 127470. The code for this enhancement is unchanged.
Verified in I20060216-0800.
Hello, I created a config.ini file and added this text: #Product Runtime Configuration File osgi.splashPath=platform:/base/plugins/ch.medclipse.application eclipse.product=ch.medclipse.application.product osgi.bundles=org.eclipse.equinox.common@2:start,org.eclipse.core.jobs@2:start,org.eclipse.equinox.registry@2:start,org.eclipse.equinox.preferences,org.eclipse.core.contenttype,org.eclipse.core.runtime@3:start,org.eclipse.update.configurator@4:start osgi.bundles.defaultStartLevel=5 ch.medclipse.application/PERSPECTIVE_BAR_EXTRAS=ch.medclipse.application.PerspectiveAdministration, ch.medclipse.application.PerspectivePatient, ch.medclipse.application.PerspectiveConsultation I also specified in the xxx.product file to use my config.ini file and included the config.ini file in the Binary build of build.properties file, but it still doesn't preload my perspectives shortcuts. Have I forgotten something ? Thanks
Please read http://wiki.eclipse.org/index.php/RCP_FAQ#customPrefs The plugin_customization.ini file mentioned there is not the same as the config.ini. Also, the entry should have "org.eclipse.ui" as the prefix, not your plug-in. E.g.: contents of plugin_customization.ini: org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS=ch.medclipse.application.PerspectiveAdministration,ch.medclipse.application.PerspectivePatient,ch.medclipse.application.PerspectiveConsultation
Be sure to include the plugin_customization.ini file in the build.properties as well.
Thanks this worked well. The only problem left I have is that I cannot specify the order of the perspectives links...
They should appear in the order specified.
>They should appear in the order specified. They are not at first launch and if you clear the run-time workspace data, if you launch the application again without clearing the run-time workspace data, they are correctly displayed.
Dominique, I'm not sure I understand. Are you saying that if you clear the runtime workspace data then the order you specified is not honoured?
Yes you understand well.
Actually, it has nothing to do with "clear the runtime workspace data" but with the last perspective selected when closing the application. The last selected perpective is then displayed first. For example: I have "Administration", "Patient", "Consultation" Perspectives and I would like to display them in this order. I specified this in the configuration.ini file. On launch they are the three displayed in the other way round (Consultation, Patient, Administration)... but displayed. If I select the "Consultation" perspective and closes the application, the next time it opens, the order of the Perspective are: "Consultation", "Patient", "Administration". If I select the "Patient" Perspective the order is on the next launch "Patient", "Consultation", "Administration". How can you "fix" the order of the perspectives ? Thanks
In Eclipse 3.2 M5 the order of the perspectives is maintained when I re-start and it does not matter which was selected.
I confirm that this is a problem. I am using Eclipse 3.2M5a under Mac OS X 10.4.5 with java 1.5 This is the content of my plugin_customization.ini: org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS=ch.medclipse.application.PerspectiveAdministration,ch.medclipse.application.PerspectivePatient,ch.medclipse.application.PerspectiveConsultation
Will look at the ordering problem for M6.
There were several issues with adding "fake" extra perspective buttons to the perspective bar: - ordering inconsistency between first-start and restart (see recent comments) - DnD failures (bug 128281) - inconsistent treatment of actions on the button context menus (e.g. "Close" did not make sense if the perspective had not yet been opened) - inconsistency between what's shown in the perspective bar and what the underlying workbench page reports for its open perspectives For these reasons, I've now taking a different approach. The extra perspectives are now actually opened when the window is first created. This will result in plug-in activation, and the corresponding perspective factories being run. However, the views in the perspective will not actually get created until needed (i.e. until the user activates the perspective). There are strategies that can be followed to reduce the impact of this: - don't do significant work in the plugin class's start method (of the plugin containing the perspective extension) - avoid referring to unneeded classes in the perspective factories (e.g. use a constant pool for the view id, rather than referring to the view class itself). On subsequent runs, the perspectives will get restored from the saved state, without have to run the factories (assuming the advisor does setSaveAndRestore(true)). The ordering issues have been fixed up. The perspective bar now also gets more width if there are extra perspectives. I'd appreciate it if those interested could try this out in build >=N20060406.
If the PERSPECTIVE_BAR_EXTRAS enhancement does not meet the needs for RCP apps (and I know some apps have other requirements, e.g. see comment 14), then the new support in 3.2 M6 for contributing window trim items can be used to provide a custom perspective switcher (without having to go to a custom window layout, as shown in comment 16). I'll attach an example showing how to do this.
Created attachment 37909 [details] Modified browser example showing a custom perspective switcher Here is a modified version of the browser example (for the original, see http://wiki.eclipse.org/index.php/RCP_Browser_Example) showing a custom perspective switcher contributed via the new trim support. The changes over the original are: - in the plugin.xml, added an org.eclipse.ui.menus extension contributing a trim group and a trim widget. - added the corresponding PerspectiveTrimWidget class (this is essentially a factory that creates the perspective switcher control) - added the PerspectiveTrimControl class that is the actual control for the custom perspective switcher One known issue is that a gradient line (from the window's internal CBanner) appears below the toolbar. This is being tracked by bug 135303.
The example also defines 2 new perspectives, so the resulting perspective bar shows: Browser Example (the original perspective), "Browser 2" and "Browser 3". These are all backed by the same BrowserPerspectiveFactory, so they all look the same initially. But if you switch between them, show the History view (View > History) and change the layout via DnD, you'll see that they're actually 3 separate perspectives.
Hello, I tested the order issue with Eclipse SDK 3.2M6 N20060407 with a target made of RCP SDK 2.2M6 and Delta Pack 3.2M6. The problem mentionned in comment #34 is still there. Do I have to change something else than just upgrading the Eclipse SDK ?
Dominique, the fix is not in M6, so please use a build >=N20060406 as your target.
I tested with 3.2RC1 (Eclipse SDK, Eclipse RCP SDK, RCP delta-pack). The order of the perspectives is correctly displayed at first launch but not on the next launches if another perspective than the first one is selected. If you select another perspective, it will be this one which will appear first. Example: Say you have perspective 1,2 and 3 in this order. On first launch I have perspective 1,2,3 correctly displayed in this order. I select perspective 2 and quit the application. Next time I launch I will have the perspectives displayed in this order 2,1,3
Ok I had: public void initialize(IWorkbenchConfigurer configurer) { configurer.setSaveAndRestore(true); } in my ApplicationWorkbenchAdvisor file. If I turn it into "false" the order is respected whatever perspective is selected on quit. Thanks for your help.
The order should get preserved even when you are saving the workbench layout between sessions (configurer.setSaveAndRestore(true)). I was unable to reproduce the problem in 3.2 RC1. My .ini file has: org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS=org.eclipse.jdt.ui.JavaPerspective, org.eclipse.debug.ui.DebugPerspective, org.eclipse.team.cvs.ui.cvsPerspective When I launch a new workspace, they perspective buttons appear in the order given: Java, Debug, CVS. If I select Debug, then shutdown and restart, they appear in the same order (Java, Debug, CVS) with Debug selected.
Hello, I can confirm that if I set "configurer.setSaveAndRestore" to false this will not work. This is on Mac OS X 10.4.6 with Java 1.4.2. My application is an RCP product. You can download it here ( "configurer.setSaveAndRestore" is on false in these files): The binaries: http://www.medclipse.ch/downloads/binaries/medclipseinterface07/ The sources http://www.medclipse.ch/downloads/sources/medclipseinterface07/
In case you will find some videos showing how to import the sources into eclipse here (divx format). http://www.medclipse.ch/devel/install_config_eclipse/
I was able to reproduce the ordering problem. I've filed this as bug 137334, since it's not directly caused by the PERSPECTIVE_BAR_EXTRAS enhancement.
Verified in 3.2 RC3 using -pluginCustomization custom.ini where custom.ini has: org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS=org.eclipse.jdt.ui.JavaPerspective, org.eclipse.debug.ui.DebugPerspective, org.eclipse.team.cvs.ui.cvsPerspective
Matt Passell wrote me a note to say that the later example fails under Eclipse 3.2.2 with a ClassCastException, and that changing PerspectiveTrimWidget to extend AbstractWorkbenchTrimWidget instead of AbstractTrimWidget fixes it up.
Hello there, I have a need to have my perspective bar to be preloaded with a few custom perspectives. For the solution to this you mentions: custom.ini has: org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS=org.eclipse.jdt.ui.JavaPerspective, org.eclipse.debug.ui.DebugPerspective, org.eclipse.team.cvs.ui.cvsPerspective But neither of you attachments has the "org.eclipse.ui/PERSPECTIVE_BAR_EXTRAS" entry in the plugin_customization.ini file. Am I missing something? Thanks for the help.
(In reply to comment #52) > Hello there, > I have a need to have my perspective bar to be preloaded with a few custom > perspectives. For help, you need to go to the newsgroups/forums - http://www.eclipse.org/forums PW
So I have searched the forums. My question is about the zip file placed here.
(In reply to comment #54) > So I have searched the forums. My question is about the zip file placed here. Oh, "If the PERSPECTIVE_BAR_EXTRAS enhancement..." You can use PERSPECTIVE_BAR_EXTRAS or simply provide something like attachment #37909 [details] The zip doesn't work with PERSPECTIVE_BAR_EXTRAS, it is an alternative where you manage your own perspective switcher (if I'm reading it correctly) PW