tzwickl
tzwickl

Reputation: 1371

Open two editors with the same label

I've recently developed a new RCP application with eclipse e4 and now I have run into a problem that whenever I want to open another editor which has the same label, that I cannot open it because I always check if there is already an open editor with the same label and then grant this editor focus in order to bring it on top of the part stack. I use a part descriptor to dynamically open an editor whenever the user double-clicks on a tree element and then uses the tree elements name as label. Now it can happen that some tree elements have the same label ... Is there any other way in eclipse e4 I can check if an editor is already open, besides comparing the label of all open editors with the label of the editor I want to open?

Any help or pointers would be appreciated.

Upvotes: 0

Views: 67

Answers (1)

Severin
Severin

Reputation: 296

The default way is assigning an input uri while creating an editor (InputPart in e4)

MInputPart inputPart = MBasicFactory.INSTANCE.createInputPart();
inputPart.setInputURI("someInputUri");

And then you can call:

Collection<MInputPart> inputParts = partService.getInputParts("someInputUri");

Where partService is an instance of EPartService. You can manage a group of input parts using this approach.

Upvotes: 0

Related Questions