Eclipse RCP: How to programmatically obtain the application window image? - eclipse

When building an Eclipse RCP application you get to define the window images in the .product and plugin.xml files for the application plugin. These are the images that show up in the upper-left corner of the main application window. But say you want to use this same image in a dialog window that your application might open. How do you get access to this image programmatically?
In my use case I am building two products that only differ in branding elements so I wanted all my dialogs to be consistent and use the same branding image that the main application window uses.

I figured out the answer through some trial and error and failed web searches. Turns out it is as simple as:
shell.setImage(ApplicationWindow.getDefaultImage());
(for completeness, I'm currently developing in Eclipse 3.8. Not sure if this carries forward to Juno/4.X)

Related

What is this Eclipse view and how to implement it in other Eclipse-based products?

In Flash Builder 4.6's code assist, there is this extra box on the right of the classes, outlined in red, (image: http://oi42.tinypic.com/rqyuqq.jpg) that pops up when using the default Flex SDK. What is it called?
I find this feature very useful and wondering where I can get more information to implement a similar one in another Eclipsed-based IDE that I'm using.
this window is called JavaDoc View
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fviews%2Fref-view-javadoc.htm
any developer that uses the eclipse IDE knows this windows, it's shown the javadoc content of selected element,
it's part of Eclipse Java development tools (JDT)

How to develop interface like Eclipse using GTK?

I want a write a desktop application using GTKMM. I want the interface to be made of different panels like in Eclipse you have the Project Explorer, Console, Properties, etc. You should be able to drag the panels to change their position, close them and popout them (not sure if you can popout the panels in Eclipse but you can do it in Visual Studio).
I am using the word panels here as I am not sure what the right term is. I guess some call it dockable windows.
Any pointers on how this can be achieved in GTKMM?
The term is "docking" widgets and the GDL Library is the easiest way to get started with that. You may have seen GDL in action in applications like Anjuta and Inkscape. The documentation isn't that great, but, the source code includes a sample app and once you get going with it it's not that hard.
Basically, you add your widgets to a DockItem and those to a Dock. You put a DockBar somewhere in your application to which the docked items can be minimized. You can save and load the dock "layout" to XML files so that the user doesn't have to re-arrange the dock items every time they start the application.

Eclipse look & feel customization

I need to customize the look & feel of my RCP application.
I took a look at Eclipse Presentation API and I suppose it allows to customize everything in workbench except controls.
So is there any solution to customize controls?
I made some research work and implemented some ad-hoc SWT cunstomization using control canvas drawning. May be there are better solutions?
In Swing you can use Synth theme. It would be great if some 'skin' framework exists for SWT.
One way of customizing an RCP app is by using a plugin_customization.ini file. Like this:
Create a new file called "plugin_customization.ini" in the root of your project.
If you have not already done so, create a product configuration and define a Product.
In your plugin's manifest editor, on the "Extensions" tab, locate the "org.eclipse.core.runtime.products" extension, expand the node, right click on your product node and select "New > property" from the context menu.
Enter "preferenceCustomization" in the "name" field and "plugin_customization.ini" in the "value" field.
Select "File > Save" from the main menu.
You can then customize a lot of things simply by editing plugin_customization.ini file. For example, adding the following line
org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false
will give you rounded tabs on your views and editors (similar to those that Eclipse IDE has) instead of the default ones.
You can find other constants that you can use in IWorkbenchPreferenceConstants javadoc.
Also, check out the Eclipse skins project, if you haven't already.
There is also the possibility to use CSS to change the look & feel of your app, but that is still in development and can be buggy
As for customizing the SWT controls themselves, the only way to do that (apart from small customizations such as changing the background colour of a control etc.) is by creating your own custom controls by extending Canvas or Composite, but you already know that. Keep in mind that the point of SWT is to use native controls, so if you desire the ability to completely customize your controls, perhaps using Swing would be a better option. However, if you're going to use Swing, it may be better to use another RCP entirely - namely, NetBeans RCP. I haven't tried it out yet, but I know that whereas Eclipse RCP uses SWT as a widget toolkit, NetBeans RCP relies on Swing, so that may save you from some headaches regarding compatibility problems and so on.
The new Eclipse 4 work contains plugins that allow the L&F to be customized using CSS. These plugins can be run in a 3.7 Eclipse environment. See Kai's blog for a presentation on the subject: http://www.toedter.com/blog/?p=477
The Eclipse 4 Styling Tutorial has a slide (p.66) on where to get an 3.7 based RCP example.

how to access package explorer element in eclipse plugin

i am making an eclipse plugin which make a ui on right clicking a project in eclipse workspce . the ui contains text fields , package explorer for the current project and directory explorer for current project.
i have successfully made a ui which appears on clicking a menu item on right clicking the project but it seems i can't make any jface or swt ui since they are not visible when we are using eclipse command hadlers .so in order to overcome it i made dialog pages but they have limited dialog like directorty dialog and file dialog and that too for entire window directory..... but i want package explorer and directory explorer for the project i just chose like it happens when u try making a new class in a project the browse buttons just show packages and directory struture w.r.t to current selection
am i doin things wrong or is there a way out please suggest .....
It seems a bit unclear to me, what the 'UI' is about. If you plan to embed the package and directory views inside a dialog next to each other, then I think you have to build similar lists on your own, since they are views with their own event logic. But if you plan to use them via the browse buttons as describes, take a look at this page. It gives a good overview of the available selection dialogs in eclipse.
It is also always a good practice to search for code in eclipse that does nearly the same you want to do.
As an example, take a look at the new class wizard from the jdt.ui plug-in (This is the wizard you mentioned in your question): Press Cmd-Shift-T and begin typing 'newclass' and open NewClassWizardPage from org.eclipse.jdt.ui.wizards. This works as expected if you imported all jdt plug-ins as (binary) projects.
Take a look at the createControl method and dive into the createXXXControls methods via F3 and try to find out how JDT is doing the job.
As an alternative, open the desired selection dialog class (again with Cmd-Shift-T) and open the call hierarchy of that class...

Eclipse RCP Splash Screen

I'm involved in a project that is attempting to use the Eclipse RCP splash screen to gather user credentials, language, etc. If this screen loses focus, it is not available (under Windows at least) through the ALt-Tab functionality, and can only be found by minimizing all other windows and uncovering it. Any way of having this screen allow itself to be activated in this way? They're avoiding creating an intermediate screen, for reasons unknown at this point.
I think it might be time to examine those unknown reasons. Even eclipse doesn't use the splash screen in this way. If it needs to prompt for information, it opens a new dialog to ask for it.
Good luck.
[Edit] I stand corrected. This thread seems to have a solution to this. Good luck, I'm no SWT/RCP guru.
See this page. From one of the comments:
The splash screen window is created natively with the extended window style WS_EX_TOOLWINDOW which makes it not appear in the task bar. This corresponds to the SWT constant SWT.TOOL.
I don't know if it's possible to change the window style after it is created on Windows. You can always drop down to JNI if that's necessary.
Create your own implementation of AbstractSplashHandler.
When creating the shell, don't use the SWT.TOOL style.
The shell will be accessible through the windows task bar.