[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] Re: Is it possible to open 2 editors in different tab groups ?
|
The way I interpreted the question was that Setya wanted the second editor
to open in a new tab group without creating it first.
I have been struggling with this myself and have not yet found a working
solution. What I have tried to do is something like the following in the
partOpened() method of a PartListener
MyEditor ucdEditor = (MyEditor) part;
PartSite newEditorsSite = (PartSite) myEditor.getSite();
EditorPane newEditorsPane =
(EditorPane)newEditorsSite.getPane();
EditorStack newEditorsStack =
(EditorStack)newEditorsPane.getStack();
EditorSashContainer sashContainer =
newEditorsPane.getWorkbook().getEditorArea();
newStack = EditorStack.newEditorWorkbook(sashContainer,
(WorkbenchPage)newEditorsSite.getPage());
sashContainer.stack(newEditorsPane, newStack);
sashContainer.add(newStack, 2, 0.3f, newEditorsStack);
newStack.becomeActiveWorkbook(true);
newStack.setVisibleEditor(newEditorsPane);
sashContainer.getControl().setRedraw(true);
newStack.getControl().setRedraw(true);
newEditorsPane.getControl().setRedraw(true);
newEditorsPane.setFocus();
It looks really good at first but you soon realise that something is messed
up as the connection between the editor panes and their tabs is broken (at
least :) ). The setRedraw(true) calls are merely fruitless attempts to do
this.
I have put this on the backburner for now but will get back to it in a week
or two. If someone could provide some additional input I would be really
happy as I do not really understand what I am doing here...
However I do ofcourse understand what I do above is completely "wrong" as I
use internal API:s etc.but I am willing to take the consequences of that.
TIA
Svante
"Paul Webster" <pwebster@xxxxxxxxxx> wrote in message
news:d7f23m$7pm$1@xxxxxxxxxxxxxxxxxxx
> Setya wrote:
>> Hi all,
>>
>> When I open 2nd editor I need it to be placed in different tab groups
>> than the 1st one. Is it possible ?
>>
>> The current behaviour the 2nd editor always put in the same tab groups as
>> the 1st one than the 2nd editor can be separated by dragging it outside
>> the 1st editor area. I want this behaviour not by dragging but by opening
>> at the first time.
>
> Once you have the second tabbed stack open, you can choose which stack to
> open an editor in by making it active.
>
> // editors in the 2 different tabbed stacks
> IEditorPart last;
> IEditorPart current;
> // filenames to open in editors
> IFile[] filename;
>
> IWorkbenchPage fActivePage;
> fActivePage = PlatformUI.getWorkbench()
> .getActiveWorkbenchWindow().getActivePage();
> for (int i = 2; i < filename.length; ++i) {
> fActivePage.activate(last);
> last = current;
> current = IDE.openEditor(fActivePage, filename[i], true);
> }
>
> There's some automated code in the unit tests that does this,
> org.eclipse.ui.tests.api.Bug95357Test in the org.eclipse.ui.tests project.
>
> Later,
> Paul