Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Open DialectEditor programmatically outside of main editor area
Open DialectEditor programmatically outside of main editor area [message #1771678] Tue, 29 August 2017 13:30 Go to next message
M V is currently offline M VFriend
Messages: 31
Registered: July 2017
Member
Hello,

add advise from here i ask my question here again:

what I want to do:

In my RCP I have project and library based on sirius tree. The User can drag an drop item from the library tree to the project tree. This works fine and was no great problem to build in. So now I want to make the UI more usable. It should looks like this layout:

index.php/fa/30524/0/

After application startup i open my library presentation with the DialectUIManager.

final DialectEditor editor = (DialectEditor) DialectUIManager.INSTANCE.openEditor(siriusSession, description, monitor);


Okay, this work also. But it open it in the editor in part market as org.eclipse.ui.editorss. This it not what I want

index.php/fa/30525/0/

I want to show it in the "Library Part". I can move it manually after open the editor, but how can i tell DialectUIManager the to open it direct there?

I do a lot of google research but i don't found a solution. The only thing I found was a hint Pierre-Charles David

Quote:
If you need is simply to show the editor outside of the main editor
area, this is possible since Eclipse 4.2 (e4 does not really treat the
main editor area as something special), so you can have your editor
"around" another editor in the middle of other views.


But at this step I stuck.

Thanks for help, code snippets or links to right part of manual.
Re: Open DialectEditor programmatically outside of main editor area [message #1772188 is a reply to message #1771678] Wed, 06 September 2017 13:04 Go to previous message
M V is currently offline M VFriend
Messages: 31
Registered: July 2017
Member
I've found a solution. It's not very nice, but it works. I execute these code here after the editors have opened.

What the code does:

He is looking for the MPlaceholder which has the ID: org. eclipse. ui. editorss. There he descends until he is with the parts. These are in the Compatibly editor mode. Then he chooses the part we wants to move out of and Attach them to the MPartStack target.



public static void movePart(MApplication application,
EModelService modelService) {

MPart partToMove = null;
MUIElement muiElement =
modelService.find("org.eclipse.ui.editorss", application);

if (muiElement instanceof MPlaceholder) {
MPlaceholder placeholder = (MPlaceholder) muiElement;
MUIElement ref = placeholder.getRef();

if (ref instanceof MArea) {
MArea area = (MArea) ref;
List<MPartSashContainerElement> children = area.getChildren();

for (MPartSashContainerElement mPartSashContainerElement
: children) {

if (mPartSashContainerElement instanceof MPartStack) {
MPartStack partStack = (MPartStack) mPartSashContainerElement;
List<MStackElement> children2 = partStack.getChildren();
for (MStackElement mStackElement : children2) {
if (mStackElement instanceof MPart) {
MPart part = (MPart) mStackElement;
// Library is the Editor Name wiche I want to move
if (part.getLabel().equals("Library")) {
partToMove = part;
break;
}
}
}
}
}

}
}

if (partToMove != null) {
moveElement(modelService, application, partToMove);
}
}

private static void moveElement(EModelService modelService,
MApplication application, MPart part) {
// target PartStack
MUIElement find = modelService.find("de.bsg.onesps.rcp.
partstack.library", application);

if (find instanceof MPartStack) {
MPartStack mPartStack = (MPartStack) find;

mPartStack.getChildren().add(part);
mPartStack.setSelectedElement(part);
}
}
Previous Topic:Part specific toolbar buttons
Next Topic:SWT Ribbon
Goto Forum:
  


Current Time: Tue Apr 23 12:39:51 GMT 2024

Powered by FUDForum. Page generated in 0.04041 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top