I want to programmatically open an eclipse view, I tried this code:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(view.ID);
It opens the view but it only instantiate it once.. I need to open a view on a double click on a file in the package explorer, the only way I found so far is opening it in the editor constructor ( a custom editor, btw if anybody knows how to open a view on double click on a file in the package explorer I'm all ears). To populate the view (tree view) I use data from a file, it works fine the first time I open it but then it does not refresh its content.
Can I perhaps access the view class object and manipulate somehow (get the tree viewer object maybe)? The perfect way to do this would be to open the view on a double click directly in the file that I need to render but I didn't find how, can anybody help?
What you are describing is really a read-only editor. There shouldn't be any reason that you couldn't implement an editor with dummy save() and saveAs() implementations. You'd get the double-click support you want in any navigation view.
Related
I want to achieve something during run time.
I have a customized editor plugin. Now, what I want is whenever someone opens this editor, there should be a view displayed in bottom folder no matter what the current perspective is.
What I meant from above is, say currently "Java" perspective is shown on active page , so whenever someone opens my custom editor, I want to add a view in bottom folder(where we see "Problems" tab). Similarly, for any current perspective, my view should get rendered as soon as my custom editor is opened.
I know about initial layout and adding a place holder view, but I can not add place holder to each and every perspective. I want this to work for any perspective opened.
Can someone please suggest workaround for this ?
Thanks in Advance !
I have a view that can be opened multiple times containing different data. I added a placeholder for the view in a folder that is below the editor area. The first instance of the view opens in the proper location but if I open a second version of the view it opens to the right of the editor. Is there a way to have all views of this type open in the folder below the editor like the first one does? Do I have to add multiple place holders? Even when I close the first instance of the view and open another instance of it, the new view opens to the right of the editor.
The views differ by the secondary id that populates the view based on that id.
I want to open the Eclipse internal Web browser programmatically on the right side of the editor area, regardless of the open perspective.
I have no problem doing it in the main editor area, but when I open the browser as (or inside) a View, it is opened at the bottom position.
How do I do that? So far I tried:
- PlatformUI.getWorkbench().getBrowserSupport().createBrowser
- create a view and call ShowView
- create a fast view and open it using org.eclipse.ui.perspectiveExtensions
but none of them gave me any control over the position.
I don't want to create my own perspective, because the browser I want to add must not change the user's environment.
Thanks for your help,
Yaron.
I have an eclipse view and whenever I open that view, I want it to default open in Right Side of the eclipse.
How to make this possible
while being in an eclipse perspective place the views in the locations you want. After exiting and reopening eclipse the views will remain in the positions you placed them in the respective perspective.
If you want to programatically position your view, right away when it is opened for the first time, you can create your own perspective, adn in that perspective you either include the view in the desired location, or you include a placeholder to define where the view should appear as soon as it's opened. See API for org.eclipse.ui.IPageLayout, method addPlaceholder.
If you don't create your own perspective, you may not be able to influence where your view is initially positioned. You can only manually position the view after it had been opened, and Eclipse will then remember this location in the workspace.
In intelliJ IDEA I can always see what class I'm working on because of clear path to this class shown in the top bar. Is there a possibility to have something like that in Eclipse?
Yes. You can turn on "breadcrumbs" in the Java editor. I can never remember the key binding, but there's a button for it on the default toolbar.
Alternatively, you can have either the Project Explorer or the Package Explorer (depending on which you prefer/use) link with the editor so that the currently edited file is always shown in those views. It's the button on the view toolbar with the two yellow arrows.