java - In Eclipse statusbar is there a way to include a new statusfield (say the file's line delimiters )? -
iam writing eclipse plugin customized text editor. status bar contibutor iam using is default one. , these fields displayed
i believe because of following in org.eclipse.ui.part.editoractionbarcontributor
/** * status fields set editor * @since 3.0 */ private final static statusfielddef[] status_field_defs= { new statusfielddef(itexteditoractionconstants.status_category_find_field, null, false, editormessages.editor_findincremental_reverse_name.length() + 15), new statusfielddef(itexteditoractionconstants.status_category_element_state, null, true, statuslinecontributionitem.default_width_in_chars + 1), new statusfielddef(itexteditoractionconstants.status_category_input_mode, itexteditoractiondefinitionids.toggle_overwrite, true, statuslinecontributionitem.default_width_in_chars), new statusfielddef(itexteditoractionconstants.status_category_input_position, itexteditoractionconstants.goto_line, true, statuslinecontributionitem.default_width_in_chars) };
my question how add new status field linedelimiter type
you should define own editor action bar contributor extends basictexteditoractioncontributor
standard status fields.
override contributetostatusline
, add new status line contribution items items:
@override public void contributetostatusline(istatuslinemanager statuslinemanager) { super.contributetostatusline(statuslinemanager); statuslinemanager.add(item); }
where item
statuslinecontributionitem
should create in action bar contributor construtor:
item = new statuslinecontributionitem("id", true, width in characters);
in setactiveeditor
method should set action item , tell editor status field:
@override public void setactiveeditor(ieditorpart part) { // todo check editor item.setactionhandler(... action handler editor...); itexteditorextension extension = (itexteditorextension)part; extension.setstatusfield(item, "id"); }
in main editor code extending texteditor
can call
istatusfield statusfield = getstatusfield("id"); statusfield.settext("text"); statusfield.setimage(image);
Comments
Post a Comment