View | Details | Raw Unified | Return to bug 25960 | Differences between
and this patch

Collapse All | Expand All

(-)BasicTextEditorActionContributor.java (-2 / +12 lines)
Lines 73-79 Link Here
73
		ITextEditorActionConstants.STATUS_CATEGORY_INPUT_MODE,
73
		ITextEditorActionConstants.STATUS_CATEGORY_INPUT_MODE,
74
		ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION
74
		ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION
75
	};
75
	};
76
	
76
77
	/** 
78
	 * The sizes of the status fields to be set to the editor
79
	 * @since 2.1
80
	 */
81
	private final static int[] STATUSFIELDS_SIZES= {
82
		9,
83
		9,
84
		14
85
	};
86
		
77
	/** The active editor part */
87
	/** The active editor part */
78
	private IEditorPart fActiveEditorPart;
88
	private IEditorPart fActiveEditorPart;
79
	/** 
89
	/** 
Lines 121-127 Link Here
121
		
131
		
122
		fStatusFields= new HashMap(3);
132
		fStatusFields= new HashMap(3);
123
		for (int i= 0; i < STATUSFIELDS.length; i++)
133
		for (int i= 0; i < STATUSFIELDS.length; i++)
124
			fStatusFields.put(STATUSFIELDS[i], new StatusLineContributionItem(STATUSFIELDS[i]));
134
			fStatusFields.put(STATUSFIELDS[i], new StatusLineContributionItem(STATUSFIELDS[i], STATUSFIELDS_SIZES[i]));
125
	}
135
	}
126
	
136
	
127
	/**
137
	/**
(-)StatusLineContributionItem.java (-3 / +31 lines)
Lines 44-56 Link Here
44
		 * Creates a new status line label.
44
		 * Creates a new status line label.
45
		 * @param parent parent control
45
		 * @param parent parent control
46
		 * @param style the swt style bits
46
		 * @param style the swt style bits
47
		 * @param numOfChars the maximum number of characters this label can
48
		 *        show
47
		 */
49
		 */
48
		public StatusLineLabel(Composite parent, int style) {
50
		public StatusLineLabel(Composite parent, int style, int numOfChars) {
49
			super(parent, style);
51
			super(parent, style);
50
			
52
			
53
			char[] chs = new char[numOfChars];
54
			
55
			for (int i = numOfChars - 1; i >= 0; i--)
56
				chs[i] = 'M';
57
				 
51
			GC gc= new GC(parent);
58
			GC gc= new GC(parent);
52
			gc.setFont(parent.getFont());
59
			gc.setFont(parent.getFont());
53
			Point extent= gc.textExtent("MMMMMMMMM"); //$NON-NLS-1$
60
			Point extent= gc.textExtent(new String(chs)); //$NON-NLS-1$
54
			gc.dispose();
61
			gc.dispose();
55
			
62
			
56
			fFixedSize= new Point(extent.x + INDENT * 2, 10);
63
			fFixedSize= new Point(extent.x + INDENT * 2, 10);
Lines 71-83 Link Here
71
	/** The status line label widget */
78
	/** The status line label widget */
72
	private StatusLineLabel fLabel;
79
	private StatusLineLabel fLabel;
73
	
80
	
81
	/** The number of characters this status line contribution will show. */ 
82
	private int fNumOfChars;
83
	
84
	/** Default: 9 characters will be shown. */
85
	private static int DEFAULT_NUM_OF_CHARS = 9;
86
74
	/**
87
	/**
75
	 * Creates a new item with the given id.
88
	 * Creates a new item with the given id.
76
	 * 
89
	 * 
77
	 * @param id the item's id
90
	 * @param id the item's id
78
	 */
91
	 */
79
	public StatusLineContributionItem(String id) {
92
	public StatusLineContributionItem(String id) {
93
		this(id, DEFAULT_NUM_OF_CHARS);
94
	}
95
		
96
	/**
97
	 * Creates a new item with the given id and number of characters to be
98
	 * shown.
99
	 * 
100
	 * @param id the item's id
101
	 * @param numOfChars the maximum number of characters this lable can show
102
	 * @since 2.1
103
	 * 
104
	 */
105
	public StatusLineContributionItem(String id, int numOfChars) {
80
		super(id);
106
		super(id);
107
		
108
		fNumOfChars= (numOfChars < 1) ? DEFAULT_NUM_OF_CHARS : numOfChars;
81
	}
109
	}
82
	
110
	
83
	/*
111
	/*
Lines 104-110 Link Here
104
	 * @see IContributionItem#fill(Composite)
132
	 * @see IContributionItem#fill(Composite)
105
	 */
133
	 */
106
	public void fill(Composite parent) {
134
	public void fill(Composite parent) {
107
		fLabel= new StatusLineLabel(parent, SWT.SHADOW_IN);
135
		fLabel= new StatusLineLabel(parent, SWT.SHADOW_IN, fNumOfChars);
108
		fLabel.setData(this);
136
		fLabel.setData(this);
109
		
137
		
110
		if (fText != null)
138
		if (fText != null)

Return to bug 25960