开发者

Is there a way to change the title of one of Eclipse's default views, programmatically?

I have a plug-in that uses Eclipse's 'Problems' view and I would really like to change the title to `Errors'.

Is there any way for me to change this programmatically or can I extend the problems view without having to crea开发者_Python百科te my own custom marker view?

I know that to change a view title you use setParName in the viewPart class but since I am using one of Eclipse's views, I don't have the viewPart class.


If you have a custom perspective, you can set a name for the view if you add it in the plugin.xml ("Extensions" tab of the manifest) instead of the custom perspective class.

nEm: I just wanted to add that to make sure you choose this class if you want the error marker behaviour

org.eclipse.ui.internal.views.markers.ProblemsView

Since there is also another Problem view.


You can create your own view definition that works very similar to the ProblemsView by creating a customized Markers view.

org.eclipse.ui.internal.views.markers.ProblemsView uses the markers generator org.eclipse.ui.ide.problemsGenerator. Once you create a class that subclasses org.eclipse.ui.views.markers.MarkerSupportView and provides the marker generator, you can use a simple view definition:

<extension point="org.eclipse.ui.views">
   <view class="com.example.MyErrorView"
         icon="icons/sample.gif"
         id="com.example.myErrorView"
         name="My Error View"/>
</extension>

See http://blog.eclipse-tips.com/2008/11/creating-custom-marker-view.html by Prakash for a more complex example. Using the icon from another plugin is tricky, because there's no guarantee that it remains where it is, but if you really want to you can use

icon="platform:/plugin/org.eclipse.ui.ide/icons/full/eview16/problems_view.gif"

Just a note, the above format doesn't support changing the NL of the icon.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜