Index: BasicTextEditorActionContributor.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/BasicTextEditorActionContributor.java,v retrieving revision 1.2 diff -u -r1.2 BasicTextEditorActionContributor.java --- BasicTextEditorActionContributor.java 25 Sep 2002 14:11:24 -0000 1.2 +++ BasicTextEditorActionContributor.java 11 Nov 2002 02:41:37 -0000 @@ -73,7 +73,17 @@ ITextEditorActionConstants.STATUS_CATEGORY_INPUT_MODE, ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION }; - + + /** + * The sizes of the status fields to be set to the editor + * @since 2.1 + */ + private final static int[] STATUSFIELDS_SIZES= { + 9, + 9, + 9 + }; + /** The active editor part */ private IEditorPart fActiveEditorPart; /** @@ -121,7 +131,7 @@ fStatusFields= new HashMap(3); for (int i= 0; i < STATUSFIELDS.length; i++) - fStatusFields.put(STATUSFIELDS[i], new StatusLineContributionItem(STATUSFIELDS[i])); + fStatusFields.put(STATUSFIELDS[i], new StatusLineContributionItem(STATUSFIELDS[i], STATUSFIELDS_SIZES[i])); } /** Index: StatusLineContributionItem.java =================================================================== RCS file: /home/eclipse/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/StatusLineContributionItem.java,v retrieving revision 1.1 diff -u -r1.1 StatusLineContributionItem.java --- StatusLineContributionItem.java 24 Sep 2002 16:56:43 -0000 1.1 +++ StatusLineContributionItem.java 11 Nov 2002 02:41:38 -0000 @@ -44,13 +44,20 @@ * Creates a new status line label. * @param parent parent control * @param style the swt style bits + * @param numOfChars the maximum number of characters this label can + * show */ - public StatusLineLabel(Composite parent, int style) { + public StatusLineLabel(Composite parent, int style, int numOfChars) { super(parent, style); + char[] chs = new char[numOfChars]; + + for (int i = numOfChars - 1; i >= 0; i--) + chs[i] = 'M'; + GC gc= new GC(parent); gc.setFont(parent.getFont()); - Point extent= gc.textExtent("MMMMMMMMM"); //$NON-NLS-1$ + Point extent= gc.textExtent(new String(chs)); //$NON-NLS-1$ gc.dispose(); fFixedSize= new Point(extent.x + INDENT * 2, 10); @@ -71,13 +78,34 @@ /** The status line label widget */ private StatusLineLabel fLabel; + /** The number of characters this status line contribution will show. */ + private int fNumOfChars; + + /** Default: 9 characters will be shown. */ + private static int DEFAULT_NUM_OF_CHARS = 9; + /** * Creates a new item with the given id. * * @param id the item's id */ public StatusLineContributionItem(String id) { + this(id, DEFAULT_NUM_OF_CHARS); + } + + /** + * Creates a new item with the given id and number of characters to be + * shown. + * + * @param id the item's id + * @param numOfChars the maximum number of characters this lable can show + * @since 2.1 + * + */ + public StatusLineContributionItem(String id, int numOfChars) { super(id); + + fNumOfChars= (numOfChars < 1) ? DEFAULT_NUM_OF_CHARS : numOfChars; } /* @@ -104,7 +132,7 @@ * @see IContributionItem#fill(Composite) */ public void fill(Composite parent) { - fLabel= new StatusLineLabel(parent, SWT.SHADOW_IN); + fLabel= new StatusLineLabel(parent, SWT.SHADOW_IN, fNumOfChars); fLabel.setData(this); if (fText != null)