Mercurial > projects > dwt-addons
diff dwtx/jface/text/AbstractInformationControl.d @ 136:6dcb0baaa031
Regex removal of throws decls, some instanceof
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 02:20:40 +0200 |
parents | 65801ad2b265 |
children | 75302ef3f92f |
line wrap: on
line diff
--- a/dwtx/jface/text/AbstractInformationControl.d Sun Aug 24 01:52:31 2008 +0200 +++ b/dwtx/jface/text/AbstractInformationControl.d Sun Aug 24 02:20:40 2008 +0200 @@ -210,7 +210,7 @@ * They should also extend {@link #computeTrim()} if they create a content area * with additional trim (e.g. scrollbars) and override {@link #getInformationPresenterControlCreator()}. * </p> - * + * * @since 3.4 */ public abstract class AbstractInformationControl : IInformationControl, IInformationControlExtension, IInformationControlExtension3, IInformationControlExtension4, IInformationControlExtension5 { @@ -221,7 +221,7 @@ private final Composite fContentComposite; /** Whether the information control is resizable. */ private final bool fResizable; - + /** Composite containing the status line content or <code>null</code> if none. */ private Composite fStatusComposite; /** Separator between content and status line or <code>null</code> if none. */ @@ -232,17 +232,17 @@ private final ToolBarManager fToolBarManager; /** Status line toolbar or <code>null</code> if none. */ private ToolBar fToolBar; - + /** Listener for shell activation and deactivation. */ private Listener fShellListener; /** All focus listeners registered to this information control. */ private ListenerList fFocusListeners= new ListenerList(ListenerList.IDENTITY); - + /** Size constraints, x is the maxWidth and y is the maxHeight, or <code>null</code> if not set. */ private Point fSizeConstraints; /** The size of the resize handle if already set, -1 otherwise */ private int fResizeHandleSize; - + /** * Creates an abstract information control with the given shell as parent. * The control will not be resizable and optionally show a status line with @@ -250,7 +250,7 @@ * <p> * <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em> * </p> - * + * * @param parentShell the parent of this control's shell * @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field */ @@ -265,7 +265,7 @@ * <p> * <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em> * </p> - * + * * @param parentShell the parent of this control's shell * @param toolBarManager the manager or <code>null</code> if toolbar is not desired */ @@ -278,7 +278,7 @@ * <p> * <em>Important: Subclasses are required to call {@link #create()} at the end of their constructor.</em> * </p> - * + * * @param parentShell the parent of this control's shell * @param isResizable <code>true</code> if the control should be resizable */ @@ -296,47 +296,47 @@ * <p> * <strong>Important:</strong>: Subclasses are required to call {@link #create()} at the end of their constructor. * </p> - * + * * @param parentShell the parent of this control's shell * @param shellStyle style of this control's shell * @param statusFieldText the text to be used in the status field or <code>null</code> to hide the status field * @param toolBarManager the manager or <code>null</code> if toolbar is not desired - * + * * @deprecated clients should use one of the public constructors */ this(Shell parentShell, int shellStyle, final String statusFieldText, final ToolBarManager toolBarManager) { Assert.isTrue(statusFieldText is null || toolBarManager is null); fResizeHandleSize= -1; fToolBarManager= toolBarManager; - + if ((shellStyle & DWT.NO_TRIM) !is 0) shellStyle&= ~(DWT.NO_TRIM | DWT.SHELL_TRIM); // make sure we get the OS border but no other trims - + fResizable= (shellStyle & DWT.RESIZE) !is 0; // on GTK, Shell removes DWT.RESIZE if DWT.ON_TOP is set fShell= new Shell(parentShell, shellStyle); Display display= fShell.getDisplay(); Color foreground= display.getSystemColor(DWT.COLOR_INFO_FOREGROUND); Color background= display.getSystemColor(DWT.COLOR_INFO_BACKGROUND); setColor(fShell, foreground, background); - + GridLayout layout= new GridLayout(1, false); layout.marginHeight= 0; layout.marginWidth= 0; layout.verticalSpacing= 0; fShell.setLayout(layout); - + fContentComposite= new Composite(fShell, DWT.NONE); fContentComposite.setLayoutData(new GridData(DWT.FILL, DWT.FILL, true, true)); fContentComposite.setLayout(new FillLayout()); setColor(fContentComposite, foreground, background); - + createStatusComposite(statusFieldText, toolBarManager, foreground, background); } private void createStatusComposite(final String statusFieldText, final ToolBarManager toolBarManager, Color foreground, Color background) { if (toolBarManager is null && statusFieldText is null) return; - + fStatusComposite= new Composite(fShell, DWT.NONE); GridData gridData= new GridData(DWT.FILL, DWT.BOTTOM, true, false); fStatusComposite.setLayoutData(gridData); @@ -345,10 +345,10 @@ statusLayout.marginWidth= 0; statusLayout.verticalSpacing= 1; fStatusComposite.setLayout(statusLayout); - + fSeparator= new Label(fStatusComposite, DWT.SEPARATOR | DWT.HORIZONTAL); fSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + if (statusFieldText !is null) { createStatusLabel(statusFieldText, foreground, background); } else { @@ -360,39 +360,39 @@ fStatusLabel= new Label(fStatusComposite, DWT.RIGHT); fStatusLabel.setLayoutData(new GridData(DWT.FILL, DWT.CENTER, true, false)); fStatusLabel.setText(statusFieldText); - + FontData[] fontDatas= JFaceResources.getDialogFont().getFontData(); for (int i= 0; i < fontDatas.length; i++) { fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10); } fStatusLabel.setFont(new Font(fStatusLabel.getDisplay(), fontDatas)); - + fStatusLabel.setForeground(fStatusLabel.getDisplay().getSystemColor(DWT.COLOR_WIDGET_DARK_SHADOW)); fStatusLabel.setBackground(background); setColor(fStatusComposite, foreground, background); } - + private void createToolBar(ToolBarManager toolBarManager) { final Composite bars= new Composite(fStatusComposite, DWT.NONE); bars.setLayoutData(new GridData(DWT.FILL, DWT.FILL, false, false)); - + GridLayout layout= new GridLayout(3, false); layout.marginHeight= 0; layout.marginWidth= 0; layout.horizontalSpacing= 0; layout.verticalSpacing= 0; bars.setLayout(layout); - + fToolBar= toolBarManager.createControl(bars); GridData gd= new GridData(DWT.BEGINNING, DWT.BEGINNING, false, false); fToolBar.setLayoutData(gd); - + Composite spacer= new Composite(bars, DWT.NONE); gd= new GridData(DWT.FILL, DWT.FILL, true, true); gd.widthHint= 0; gd.heightHint= 0; spacer.setLayoutData(gd); - + addMoveSupport(spacer); addResizeSupportIfNecessary(bars); } @@ -405,11 +405,11 @@ final bool isWin= platform.equals("win32"); //$NON-NLS-1$ if (!isWin && !platform.equals("gtk")) //$NON-NLS-1$ return; - + final Canvas resizer= new Canvas(bars, DWT.NONE); - + int size= getResizeHandleSize(bars); - + GridData data= new GridData(DWT.END, DWT.END, false, true); data.widthHint= size; data.heightHint= size; @@ -432,7 +432,7 @@ for (int i= 0; i <= 2; i++) for (int j= 0; j <= 2 - i; j++) e.gc.fillRectangle(end - 4 * i, end - 4 * j, 2, 2); - + } else { // draw diagonal lines e.gc.setForeground(resizer.getDisplay().getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW)); @@ -446,11 +446,11 @@ } } }); - + resizer.setCursor(new Cursor(resizer.getDisplay(), DWT.CURSOR_SIZESE)); MouseAdapter resizeSupport= new class() MouseAdapter { private MouseMoveListener fResizeListener; - + public void mouseDown(MouseEvent e) { Point shellSize= fShell.getSize(); final int shellX= shellSize.x; @@ -468,7 +468,7 @@ }; resizer.addMouseMoveListener(fResizeListener); } - + public void mouseUp(MouseEvent e) { resizer.removeMouseMoveListener(fResizeListener); fResizeListener= null; @@ -487,13 +487,13 @@ sliderH.dispose(); fResizeHandleSize= Math.min(width, height); } - + return fResizeHandleSize; } /** * Adds support to move the shell by dragging the given control. - * + * * @param control the control that can be used to move the shell */ private void addMoveSupport(final Control control) { @@ -529,7 +529,7 @@ /** * Utility to set the foreground and the background color of the given * control - * + * * @param control the control to modify * @param foreground the color to use for the foreground * @param background the color to use for the background @@ -541,17 +541,17 @@ /** * The shell of the popup window. - * + * * @return the shell used for the popup window */ protected final Shell getShell() { return fShell; } - + /** * The toolbar manager used to manage the toolbar, or <code>null</code> if * no toolbar is shown. - * + * * @return the tool bar manager or <code>null</code> */ protected final ToolBarManager getToolBarManager() { @@ -582,11 +582,11 @@ * The given <code>parent</code> comes with a {@link FillLayout}. * Subclasses may set a different layout. * </p> - * + * * @param parent the container of the content */ protected abstract void createContent(Composite parent); - + /** * Sets the information to be presented by this information control. * <p> @@ -594,16 +594,16 @@ * or implement {@link IInformationControlExtension2}. * * @param information the information to be presented - * + * * @see dwtx.jface.text.IInformationControl#setInformation(java.lang.String) */ public void setInformation(String information) { - + } - + /** * Returns whether the information control is resizable. - * + * * @return <code>true</code> if the information control is resizable, * <code>false</code> if it is not resizable. */ @@ -617,7 +617,7 @@ public void setVisible(bool visible) { if (fShell.isVisible() is visible) return; - + fShell.setVisible(visible); } @@ -649,10 +649,10 @@ public void setSizeConstraints(int maxWidth, int maxHeight) { fSizeConstraints= new Point(maxWidth, maxHeight); } - + /** * Returns the size constraints. - * + * * @return the size constraints or <code>null</code> if not set * @see #setSizeConstraints(int, int) */ @@ -668,7 +668,7 @@ Point constrains= getSizeConstraints(); if (constrains is null) return fShell.computeSize(DWT.DEFAULT, DWT.DEFAULT, true); - + return fShell.computeSize(constrains.x, constrains.y, true); } @@ -676,7 +676,7 @@ * Computes the trim (status text and tool bar are considered as trim). * Subclasses can extend this method to add additional trim (e.g. scroll * bars for resizable information controls). - * + * * @see dwtx.jface.text.IInformationControlExtension3#computeTrim() */ public Rectangle computeTrim() { @@ -756,7 +756,7 @@ /** * This default implementation sets the focus on the popup shell. * Subclasses can override or extend. - * + * * @see IInformationControl#setFocus() */ public void setFocus() { @@ -812,10 +812,10 @@ * shown if the information control has been created with a non-null status * field text. * </p> - * + * * @param statusFieldText the text to be used in the optional status field * or <code>null</code> if the status field should be hidden - * + * * @see dwtx.jface.text.IInformationControlExtension4#setStatusText(java.lang.String) */ public void setStatusText(String statusFieldText) { @@ -828,7 +828,7 @@ } } } - + /* * @see dwtx.jface.text.IInformationControlExtension5#containsControl(dwt.widgets.Control) */ @@ -836,7 +836,7 @@ do { if (control is fShell) return true; - if (control instanceof Shell) + if (cast(Shell)control ) return false; control= control.getParent(); } while (control !is null); @@ -862,7 +862,7 @@ * Computes the size constraints based on the * {@link JFaceResources#getDialogFont() dialog font}. Subclasses can * override or extend. - * + * * @see dwtx.jface.text.IInformationControlExtension5#computeSizeConstraints(int, int) */ public Point computeSizeConstraints(int widthInChars, int heightInChars) { @@ -874,5 +874,5 @@ return new Point(widthInChars * width, heightInChars * height); } - + }