I know how to programmatically rename a eclipse RCP IViewPart. It is by using setPartname() method. However I want to know if in-place editing of the view name on mouse-click on the view tab (like we usually do for excel spreadsheet tabs).
There is no support for in-place editing of the view name.
Related
I am editing a .java file in eclipse, is there a short cut key to launch/open the current .java file I am editing into a new window to make use of my multiple displays?
I am using Eclipse 3.x
There is no shortcut key in Eclipse to reopen a file in a new window, but I'm unclear on how that would work anyway. Maybe I'm missing something, but how would Eclipse know which display to use, where to position the new window on the display, and what dimensions to use for the new window? And even if it did know how to do all that, it's not improbable that you would still want to adjust the size and positioning of the new window.
Besides, there already is a better alternative to a shortcut key: just position the mouse cursor over the tab of the open file, drag it to wherever you want on any of your displays, and optionally resize that new window as desired. The change will persist over restarts of Eclipse.
(I verified this on the latest release of Eclipse, Oxygen.2 Release 4.7.2, but I don't know when that drag and drop functionality was first implemented.)
I'm doing some manteinance to a .cpp file with eclipse and I need to compare two methods. It's very uncomfortable to jump ahead and back to check differences.
Is there a way to duplicate the view of the same source file, in order to compare them side by side?
Edit the file and use Window > New Editor to open a second editor on the file. Then drag the title tab of the second editor and Eclipse will show on outline of how it is going to arrange the two editors. You can arrange the two editors vertically or horizontally.
Update:
Eclipse 4.4 Luna (currently only available as Milestone builds) adds support for splitting the editor directly using Ctrl+_ and Ctrl+{.
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.
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?)
If there's one thing I miss about emacs it's having 4 windows of the same file open, each at a different location in that file, for super quick referencing. Is there a way to get Eclipse to present multiple tabs of the same file?
On the Window menu choose Editor, then Clone (since 4.4.x) or New Editor (earlier versions). You can then drag the title bar around to get side-by-side views.
Another way would be to split the code editor view twice
But this will only be possible with Eclipse Luna 4.4 M4, as detailed by Lars Vogel in "Split editor implemented in Eclipse M4 Luna", in Bug 8009:
The split editor functionality has been developed in Bug 378298, and will be available as of Eclipse Luna M4. The Note & Newsworthy of Eclipse Luna M4 will contain the announcement.
Current shortcut for splitting is:
Ctrl + _ for split horizontally, and
Ctrl + { for split vertically.
Depending on your keyboard layout:
Andrew adds in the comments that you can need Ctrl + Shift .
el-teedee mentions (also in the comments) that, when pressing CTRL+{ in my Javascript editor, it inserts ''.
To fix this, I need to press CTRL+ALTGR+{ (Linux Ubuntu French keyboard),
Yeah, just right-click on the editor tab you want, and select "New Editor". It'll create a new tab editing the same file. You can then drag this new tab to the left or right edge of the view to get them in a "split screen" state. It's really very flexible.
I figured it out. Right-click tab > New Editor.
Other answers explain how to open multiple editors or split editor. If we are talking about other tabs/views that are not editor, it depends on the implementation.
TLDR: search for pin toggle or create new view button/option in view!
History view, Search view and other pinnable tabs - have "Pin this XXX View" toggle:
If you pin it it will keep the content and new Search (or history show) will show in new history view.
History view also has "Reuse Compare Editor" option so compares can be opened in same or separate tabs:
Markers view has option "New Markers View":
This view can be named and you can set custom filter for each view.
Similar is "Terminal View" that has button to open new terminal view:
Some tabs do not have any option to be duplicated. Tested with Eclipse 2019-12 (4.14.0)
I faced similar problem, but not with the main edit tabs: I wanted to have duplicate tabs in additional view panel (exactly: two junit views to compare different test runs).
In my case the only possible way to achive such thing was creating separate window: Window > New Window and openning new view there.
p.s. I'm using eclipse kepler 4.3.1.
For eclipse kepler , you can try right-click > open-with > any other like text editor
select window menu, then editor option, then clone