Unable to set left/right/ancestor viewer labels [message #1746586] |
Tue, 01 November 2016 12:40 |
Vlad Acretoaie Messages: 95 Registered: April 2014 |
Member |
|
|
Hi,
I am trying to display custom labels for the left, right, and ancestor compare/merge viewers. To do this, I have implemented a class like the following (I am only showing the relevant code here):
public class MyEditorInput extends CompareEditorInput {
protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
CompareConfiguration compConfig = getCompareConfiguration();
compConfig.setAncestorLabel("My Ancestor Label");
compConfig.setLeftLabel("My Left Label");
compConfig.setRightLabel("My Right Label");
}
}
However, the viewers are still displayed with different titles.
I know that the labels I set myself are only used "if the element for which a label is requested does not have a left/right/ancestor contributor or the element does not have a registered label provider or the label provider returns null as the label". To check that this is not the case, I set a breakpoint in the getLeftLabel(Object input) method of the CompareConfiguration$DefaultLabelProvider inner class. I can see that this method always returns the values I have set, so I don't know why the displayed labels are still different.
Cheers,
Vlad
|
|
|
Re: Unable to set left/right/ancestor viewer labels [message #1746632 is a reply to message #1746586] |
Wed, 02 November 2016 09:50 |
|
Hi Vlad,
are you talking about the labels on top of the left and right tree viewer in the tree content merge viewer?
If yes, you could try to add a storage path adapter to the left/right/origin resource of the comparison scope of your comparison input. This should allow you to control the left and right titles of the tree content merge viewer:
StoragePathAdapter storagePathAdapter = new StoragePathAdapter(label, isLocal);
resource.eAdapters().add(storagePathAdapter)
Hope that helps!
Best wishes,
Philip
--
Philip Langer
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Re: Unable to set left/right/ancestor viewer labels [message #1746661 is a reply to message #1746586] |
Wed, 02 November 2016 15:05 |
|
Hi Vlad,
I'm not exactly sure how to trace that, but what happens if you put a breakpoint in EMFCompareConfiguration.getLabel and go back up in the stack? is there any place where your labels are ditched in favor of generic ones? I don't really have a setup to test this atm.
Laurent Goubet
Obeo
|
|
|
|
Powered by
FUDForum. Page generated in 0.03724 seconds