l1sq0u48
l1sq0u48

Reputation: 381

How to update view title

I'm trying to update the title of a view (ie : the text displayed in the tab) programmatically.

When i do that :

view.setPartName(newTitle);

The view name is well updated but the UI is not. So how can i do that ?

Thank you in advance!

Upvotes: 4

Views: 2627

Answers (2)

Duncan Krebs
Duncan Krebs

Reputation: 3502

You need to make sure you are setting partName in the correct init method and that you make a call to super before setting part name like this. I know this example works pasted from my app.

@Override
public void init(IViewSite site) throws PartInitException {
    super.init(site);
    String scannerName = site.getSecondaryId();
    setPartName("MyName");
}

Upvotes: 9

David G
David G

Reputation: 4014

I'm updating a view's title without a problem ... when are you invoking the setPartName method?

In my class, which extends ViewPart, I'm invoking the setPartName method in the init method.

Upvotes: 2

Related Questions