how to embed the Eclipse CSS Editor inside Eclipse MultiPageEditor - eclipse

I want to embed the eclipse defualt CSS Editor inside a page of Eclipse MultiPage Editor. How to achieve the same.

Create a subclass of MultiPageEditorPart and in its createPages() method, instantiate CSS editor part and add it with MultiPageEditorPart.addPage(IEditorPart, IEditorInput).
See this tutorial which does the same with TextEditor.
Cheers,
Max

Related

Adding action item to a treeview's toolbar of eclipse plugin

There is a an eclipse plugin (I don't have source code of it) that I want to contribute to.
Plugin has an Editor, in this editor there is a TreeView with a toolbar.
I want to add new button to this toolbar with my action.
Can it be done?
I wasn't able to get useful information using Plugin Spy.
(Alt-Shift-F1 shows info about the editor and not about the view inside the editor,)
Or it's possible to add toolbar buttons only to eclipse 'core' views like 'Navigator'?
No, you can't add to the Toolbar from outside of the plugin unless the plugin has provided extension points to allow this.

Eclipse Plugin: Palette Viewer

I am creating an eclipse plugin and added HTML editor in it. I want to create palette viewer which can contain the HTML tags in it. So that the developer can directly choose the tags from the palette viewer. I don't find much document of palette viewer tutorial or sample on net which guide me how to create this view programmatically. Can some one help me or give me some links?

Eclipse GEF graphical editor without header

I am developing RCP plug-in with GEF framework.
I've created basic graphical editor (GraphicalEditor and IEditorInput)
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
page.openEditor(new TEditorInput("T"), TGraphicalEditor.ID,false);
When I run the application I get editor with a header that contains the tab with the name of the editor and control buttons to maximize and minimize the editor.
What I need is to display just the editor, without the header.
Can it be done?
To my knowledge, it is not possible to just hide an editor's tab.
However, you can try two workarounds:
Have your GEF editor be displayed in an Eclipse view instead of an editor and open such a view as a standalone view. An example of how to open a GEF diagram in a view can be found in GEF's Directed Graph Example. An example of how to open a view as standalone can be found in one the Eclipse RCP official tutorials.
Extend the presentation factories extension point to control how workbench parts are displayed (which includes control over the part stack tab).
I suggest you try the first approach, as to me it seems easier to implement.
The idea with editors is that you can instantiate them multiply for different editor inputs. I am not aware of any way to restrict the number of open editors to just one (well, it appears you can in Eclipse 4.2 if that helps you)
For views, what you want can be done by setting the perspective to fixed and set showTitle of the org.eclipse.ui.perspectiveExtensions extension to false on the view. Maybe you can use a view instead of an editor and control the editor input yourself?
(For example, using an editor, the default Open action would instantiate a new editor, while you probably want to replace the contents in your only editor, right?)

How to associate an Eclipse sample Editor with a file in project explorer view

I have an sample editor which opens up by selecting an action from a sample Menu created in the menu bar.
How do i associate this editor with a file in Project explorer view?
I mean if i double click on the file in project explorer view , the editor should spawn up.
Basically i want this editor to work like a regular eclipse editor.
Please let me know your suggestions or any online material which explains the framework on how to achieve this.
Thanks,
Karthik
Have a look at IWorkbenchPage.openEditor(IEditorInput input, String editorId). Here you specify the input object of the editor and the ID for the editor.
In a RCP application, the IEditorInput is usually made up by you - nothing fancy is needed unless you want to persist the editors - and ID is specified via the org.eclipse.ui.editors.

how to add menu in eclipse MenuBar through eclipse plugin from java File

I want to add my menu in eclipse through eclipse plug-in development but not through plugin.xml. I want to use java code, as we can do the same by using IWorkBenchWindowPullDown interface for adding pulldown menu.
So what is the way to add menu in menuBar.
As above, you can use org.eclipse.ui.menus and add a menuContribution that includes a dynamic element. Then you can return whatever IContributionItems you would like from your implementation of CompoundContributionItem. See http://wiki.eclipse.org/Menu_Contributions
See the documentation of MenuManager. You could get the MenuManager via WorkbenchWindow.getMenuManager()
Check this out Menu Contributions. Scroll down for Menus API.