diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 7f54da43b31..cc2c793afbd 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,16 @@ +2004-04-07 Mikhail Khodjaiants + Strings externalization fixes and reformatting. + * CDebugUIMessages.properties + * CDebugModelPresentation.java + * CDTDebugModelPresentation.java + * ColorManager.java + * InfoStatusHandler.java + * OverlayImageCache.java + * OverlayImageDescriptor.java + * PixelConverter.java + * QuestionStatusHandler.java + * SWTUtil.java + 2004-04-07 Mikhail Khodjaiants Removed the "Show Debugger Console" action. * DebuggerConsoleActionDelegate.java diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java index cb8c37e42ff..02cd7a5fc54 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java @@ -444,7 +444,7 @@ public class CDTDebugModelPresentation extends LabelProvider if ( info != null && info instanceof ICDISignalExitInfo) { ICDISignalExitInfo sigInfo = (ICDISignalExitInfo)info; - label += CDebugUIPlugin.getFormattedString("CDTDebugModelPresentation.Signal_received_Description", //$NON-NLS-1$//$NON-NLS-2$ + label += CDebugUIPlugin.getFormattedString("internal.ui.CDTDebugModelPresentation.Signal_received_Description", //$NON-NLS-1$//$NON-NLS-2$ new String[] { sigInfo.getName(), sigInfo.getDescription() } ); } else if ( info != null && info instanceof ICDIExitInfo ) @@ -493,14 +493,14 @@ public class CDTDebugModelPresentation extends LabelProvider ICDISignal signal = ((ICDISignalReceived)info).getSignal(); String label = threadName + CDebugUIPlugin.getResourceString("internal.ui.CDTDebugModelPresentation.Suspended") + //$NON-NLS-1$ - CDebugUIPlugin.getFormattedString("CDTDebugModelPresentation.Signal_received_Description", //$NON-NLS-1$ + CDebugUIPlugin.getFormattedString("internal.ui.CDTDebugModelPresentation.Signal_received_Description", //$NON-NLS-1$ new String[] { signal.getName(), signal.getDescription() } ); return label; } if ( info != null && info instanceof ICDIWatchpointTrigger ) { String label = threadName + - CDebugUIPlugin.getFormattedString("CDTDebugModelPresentation.Suspended_Watchpoint_triggered_Old_New", //$NON-NLS-1$ + CDebugUIPlugin.getFormattedString("internal.ui.CDTDebugModelPresentation.Suspended_Watchpoint_triggered_Old_New", //$NON-NLS-1$ new String[] { ((ICDIWatchpointTrigger)info).getOldValue(), ((ICDIWatchpointTrigger)info).getNewValue() } ); return label; diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java index aba6bf6bd0a..abde725ebb6 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java @@ -151,13 +151,13 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode label += ( qualified ? path.toOSString() : path.lastSegment() ); } else { - label += "unknown"; + label += CDebugUIMessages.getString( "CDebugModelPresentation.unknown_1" ); //$NON-NLS-1$ } return label; } protected String getRegisterGroupText( IRegisterGroup group ) { - String name = ""; + String name = CDebugUIMessages.getString( "CDebugModelPresentation.not_available_1" ); //$NON-NLS-1$ try { name = group.getName(); } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.properties index 468ca87d39e..f310534a527 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.properties +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIMessages.properties @@ -1 +1,3 @@ CDebugUIPlugin.Error_1=Error +CDebugModelPresentation.unknown_1=unknown +CDebugModelPresentation.not_available_1= diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ColorManager.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ColorManager.java index 6afb13c32c8..6396304391b 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ColorManager.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ColorManager.java @@ -19,40 +19,38 @@ import org.eclipse.swt.widgets.Display; * * @since Jul 23, 2002 */ -public class ColorManager -{ - private static ColorManager fgColorManager; +public class ColorManager { - private ColorManager() - { + private static ColorManager gfColorManager; + + private ColorManager() { } - public static ColorManager getDefault() - { - if ( fgColorManager == null ) - { - fgColorManager = new ColorManager(); + public static ColorManager getDefault() { + if ( gfColorManager == null ) { + gfColorManager = new ColorManager(); } - return fgColorManager; + return gfColorManager; } protected Map fColorTable = new HashMap( 10 ); - public Color getColor( RGB rgb ) - { - Color color = (Color)fColorTable.get( rgb ); - if ( color == null ) - { + public Color getColor( RGB rgb ) { + Color color = (Color)getColorTable().get(rgb); + if ( color == null ) { color = new Color( Display.getCurrent(), rgb ); - fColorTable.put( rgb, color ); + getColorTable().put( rgb, color ); } return color; } - public void dispose() - { - Iterator e = fColorTable.values().iterator(); + public void dispose() { + Iterator e = getColorTable().values().iterator(); while( e.hasNext() ) - ((Color)e.next()).dispose(); + ((Color)e.next()).dispose(); + } + + private Map getColorTable() { + return this.fColorTable; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/InfoStatusHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/InfoStatusHandler.java index 2bf237d4182..72c64b93307 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/InfoStatusHandler.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/InfoStatusHandler.java @@ -18,26 +18,24 @@ import org.eclipse.jface.dialogs.MessageDialog; * * @since Sep 25, 2002 */ -public class InfoStatusHandler implements IStatusHandler -{ +public class InfoStatusHandler implements IStatusHandler { - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.IStatusHandler#handleStatus(IStatus, Object) */ - public Object handleStatus( IStatus status, Object source ) throws CoreException - { - if ( status != null && source != null && source instanceof IDebugTarget ) - { + public Object handleStatus( IStatus status, Object source ) + throws CoreException { + if ( status != null && source != null && source instanceof IDebugTarget ) { final String title = ((IDebugTarget)source).getName(); final String message = status.getMessage(); CDebugUIPlugin.getStandardDisplay().asyncExec( - new Runnable() - { - public void run() - { - MessageDialog.openInformation( CDebugUIPlugin.getActiveWorkbenchShell(), title, message ); - } - } ); + new Runnable() { + public void run() { + MessageDialog.openInformation( CDebugUIPlugin.getActiveWorkbenchShell(), title, message ); + } + } ); } return null; } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/OverlayImageCache.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/OverlayImageCache.java index cd8374870d7..c41c6a09471 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/OverlayImageCache.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/OverlayImageCache.java @@ -1,7 +1,6 @@ /* - *(c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - * + * (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved. + * */ package org.eclipse.cdt.debug.internal.ui; @@ -17,23 +16,23 @@ import org.eclipse.swt.graphics.Image; * * @since May 30, 2003 */ -public class OverlayImageCache -{ - private Map cache = new HashMap(); +public class OverlayImageCache { + + private Map fCache = new HashMap(); /** - * Returns and caches an image corresponding to the specified image descriptor. + * Returns and caches an image corresponding to the specified image + * descriptor. * - * @param imageDecsriptor the image descriptor + * @param imageDecsriptor + * the image descriptor * @return the image */ - public Image getImageFor( OverlayImageDescriptor imageDescriptor ) - { - Image image = (Image)cache.get( imageDescriptor ); - if ( image == null ) - { + public Image getImageFor( OverlayImageDescriptor imageDescriptor ) { + Image image = (Image)getCache().get( imageDescriptor ); + if ( image == null ) { image = imageDescriptor.createImage(); - cache.put( imageDescriptor, image ); + getCache().put( imageDescriptor, image ); } return image; } @@ -41,13 +40,15 @@ public class OverlayImageCache /** * Disposes of all images in the cache. */ - public void disposeAll() - { - for ( Iterator it = cache.values().iterator(); it.hasNext(); ) - { + public void disposeAll() { + for ( Iterator it = getCache().values().iterator(); it.hasNext(); ) { Image image = (Image)it.next(); image.dispose(); } - cache.clear(); + getCache().clear(); + } + + private Map getCache() { + return this.fCache; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/OverlayImageDescriptor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/OverlayImageDescriptor.java index f7d25428682..2785b0979c3 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/OverlayImageDescriptor.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/OverlayImageDescriptor.java @@ -1,7 +1,6 @@ /* - *(c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - * + * (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved. + * */ package org.eclipse.cdt.debug.internal.ui; @@ -14,8 +13,8 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.graphics.Point; -public class OverlayImageDescriptor extends CompositeImageDescriptor -{ +public class OverlayImageDescriptor extends CompositeImageDescriptor { + static final int DEFAULT_WIDTH = 16; static final int DEFAULT_HEIGHT = 16; @@ -33,29 +32,23 @@ public class OverlayImageDescriptor extends CompositeImageDescriptor // the size private Point fSize; - public OverlayImageDescriptor( Image base, ImageDescriptor[] overlays ) - { - fBase = base; - fOverlays = overlays; - fSize = new Point( DEFAULT_WIDTH, DEFAULT_HEIGHT ); + public OverlayImageDescriptor( Image base, ImageDescriptor[] overlays ) { + this( base, overlays, new Point( DEFAULT_WIDTH, DEFAULT_HEIGHT ) ); } - public OverlayImageDescriptor( Image base, ImageDescriptor[] overlays, Point size ) - { - fBase = base; - fOverlays = overlays; - fSize = size; + public OverlayImageDescriptor( Image base, ImageDescriptor[] overlays, Point size ) { + setBase( base ); + setOverlays( overlays ); + setSize( size ); } /** * Draw the fOverlays for the reciever. */ - protected void drawOverlays( ImageDescriptor[] overlays ) - { + protected void drawOverlays(ImageDescriptor[] overlays) { Point size = getSize(); - for ( int i = 0; i < overlays.length; i++ ) - { + for ( int i = 0; i < overlays.length; i++ ) { ImageDescriptor overlay = overlays[i]; if ( overlay == null ) continue; @@ -63,8 +56,7 @@ public class OverlayImageDescriptor extends CompositeImageDescriptor //Use the missing descriptor if it is not there. if ( overlayData == null ) overlayData = ImageDescriptor.getMissingImageDescriptor().getImageData(); - switch( i ) - { + switch( i ) { case TOP_LEFT: drawImage( overlayData, 0, 0 ); break; @@ -81,40 +73,59 @@ public class OverlayImageDescriptor extends CompositeImageDescriptor } } - public boolean equals( Object o ) - { - if ( !( o instanceof OverlayImageDescriptor ) ) + public boolean equals( Object o ) { + if ( !(o instanceof OverlayImageDescriptor) ) return false; OverlayImageDescriptor other = (OverlayImageDescriptor)o; - return fBase.equals( other.fBase ) && Arrays.equals( fOverlays, other.fOverlays ); + return getBase().equals( other.getBase() ) && Arrays.equals( getOverlays(), other.getOverlays() ); } - public int hashCode() - { - int code = fBase.hashCode(); - for ( int i = 0; i < fOverlays.length; i++ ) - { - if ( fOverlays[i] != null ) - code ^= fOverlays[i].hashCode(); + public int hashCode() { + int code = getBase().hashCode(); + for (int i = 0; i < getOverlays().length; i++) { + if ( getOverlays()[i] != null ) + code ^= getOverlays()[i].hashCode(); } return code; } - /* (non-Javadoc) - * @see org.eclipse.jface.resource.CompositeImageDescriptor#drawCompositeImage(int, int) + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.resource.CompositeImageDescriptor#drawCompositeImage(int, + * int) */ - protected void drawCompositeImage( int width, int height ) - { - drawImage( fBase.getImageData(), 0, 0 ); - drawOverlays( fOverlays ); + protected void drawCompositeImage( int width, int height ) { + drawImage( getBase().getImageData(), 0, 0 ); + drawOverlays( getOverlays() ); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.jface.resource.CompositeImageDescriptor#getSize() */ - protected Point getSize() - { - return fSize; + protected Point getSize() { + return this.fSize; } + private Image getBase() { + return this.fBase; + } + + private void setBase( Image base ) { + this.fBase = base; + } + + private ImageDescriptor[] getOverlays() { + return this.fOverlays; + } + + private void setOverlays( ImageDescriptor[] overlays ) { + this.fOverlays = overlays; + } + + private void setSize( Point size ) { + this.fSize = size; + } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/PixelConverter.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/PixelConverter.java index 7ff1efc9e44..4d25a64711b 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/PixelConverter.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/PixelConverter.java @@ -1,62 +1,63 @@ package org.eclipse.cdt.debug.internal.ui; -/********************************************************************** -Copyright (c) 2000, 2002 IBM Corp. and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Common Public License v0.5 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/cpl-v05.html - -Contributors: - IBM Corporation - Initial implementation -**********************************************************************/ +/******************************************************************************* + * Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Common Public License v0.5 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/cpl-v05.html + * + * Contributors: IBM Corporation - Initial implementation + ******************************************************************************/ import org.eclipse.jface.dialogs.Dialog; import org.eclipse.swt.graphics.FontMetrics; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.widgets.Control; -public class PixelConverter -{ +public class PixelConverter { + private FontMetrics fFontMetrics; - public PixelConverter( Control control ) - { + public PixelConverter( Control control ) { GC gc = new GC( control ); gc.setFont( control.getFont() ); - fFontMetrics = gc.getFontMetrics(); + setFontMetrics( gc.getFontMetrics() ); gc.dispose(); } /** * @see org.eclipse.jface.dialogs.DialogPage#convertHeightInCharsToPixels(int) */ - public int convertHeightInCharsToPixels( int chars ) - { - return Dialog.convertHeightInCharsToPixels( fFontMetrics, chars ); + public int convertHeightInCharsToPixels( int chars ) { + return Dialog.convertHeightInCharsToPixels( getFontMetrics(), chars ); } /** * @see org.eclipse.jface.dialogs.DialogPage#convertHorizontalDLUsToPixels(int) */ - public int convertHorizontalDLUsToPixels( int dlus ) - { - return Dialog.convertHorizontalDLUsToPixels( fFontMetrics, dlus ); + public int convertHorizontalDLUsToPixels( int dlus ) { + return Dialog.convertHorizontalDLUsToPixels( getFontMetrics(), dlus ); } /** * @see org.eclipse.jface.dialogs.DialogPage#convertVerticalDLUsToPixels(int) */ - public int convertVerticalDLUsToPixels( int dlus ) - { - return Dialog.convertVerticalDLUsToPixels( fFontMetrics, dlus ); + public int convertVerticalDLUsToPixels( int dlus ) { + return Dialog.convertVerticalDLUsToPixels( getFontMetrics(), dlus ); } /** * @see org.eclipse.jface.dialogs.DialogPage#convertWidthInCharsToPixels(int) */ - public int convertWidthInCharsToPixels( int chars ) - { - return Dialog.convertWidthInCharsToPixels( fFontMetrics, chars ); + public int convertWidthInCharsToPixels( int chars ) { + return Dialog.convertWidthInCharsToPixels( getFontMetrics(), chars ); + } + + private FontMetrics getFontMetrics() { + return this.fFontMetrics; + } + + private void setFontMetrics( FontMetrics fontMetrics ) { + this.fFontMetrics = fontMetrics; } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/QuestionStatusHandler.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/QuestionStatusHandler.java index c14000f29ef..7f620e44f51 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/QuestionStatusHandler.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/QuestionStatusHandler.java @@ -1,7 +1,6 @@ /* - *(c) Copyright QNX Software Systems Ltd. 2002. - * All Rights Reserved. - * + * (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved. + * */ package org.eclipse.cdt.debug.internal.ui; @@ -18,27 +17,25 @@ import org.eclipse.jface.dialogs.MessageDialog; * * @since Sep 25, 2002 */ -public class QuestionStatusHandler implements IStatusHandler -{ +public class QuestionStatusHandler implements IStatusHandler { - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.debug.core.IStatusHandler#handleStatus(IStatus, Object) */ - public Object handleStatus( IStatus status, Object source ) throws CoreException - { + public Object handleStatus( IStatus status, Object source ) throws CoreException { + final boolean result[] = new boolean[1]; - if ( status != null && source != null && source instanceof IDebugTarget ) - { + if ( status != null && source != null && source instanceof IDebugTarget ) { final String title = ((IDebugTarget)source).getName(); final String message = status.getMessage(); CDebugUIPlugin.getStandardDisplay().syncExec( - new Runnable() - { - public void run() - { - result[0] = MessageDialog.openQuestion( CDebugUIPlugin.getActiveWorkbenchShell(), title, message ); - } - } ); + new Runnable() { + public void run() { + result[0] = MessageDialog.openQuestion( CDebugUIPlugin.getActiveWorkbenchShell(), title, message ); + } + } ); } return new Boolean( result[0] ); } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/SWTUtil.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/SWTUtil.java index c88acf148b1..7b915bd36f7 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/SWTUtil.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/SWTUtil.java @@ -1,6 +1,5 @@ /* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. + * (c) Copyright IBM Corp. 2000, 2001. All Rights Reserved. */ package org.eclipse.cdt.debug.internal.ui; @@ -20,18 +19,16 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Widget; /** - * Utility class to simplify access to some SWT resources. + * Utility class to simplify access to some SWT resources. */ -public class SWTUtil -{ +public class SWTUtil { /** - * Returns the standard display to be used. The method first checks, if - * the thread calling this method has an associated disaply. If so, this + * Returns the standard display to be used. The method first checks, if the + * thread calling this method has an associated disaply. If so, this * display is returned. Otherwise the method returns the default display. */ - public static Display getStandardDisplay() - { + public static Display getStandardDisplay() { Display display; display = Display.getCurrent(); if ( display == null ) @@ -45,29 +42,26 @@ public class SWTUtil * * @return the shell for the given widget */ - public static Shell getShell( Widget widget ) - { + public static Shell getShell(Widget widget) { if ( widget instanceof Control ) - return ((Control) widget).getShell(); + return ((Control)widget).getShell(); if ( widget instanceof Caret ) - return ((Caret) widget).getParent().getShell(); + return ((Caret)widget).getParent().getShell(); if ( widget instanceof DragSource ) - return ((DragSource) widget).getControl().getShell(); + return ((DragSource)widget).getControl().getShell(); if ( widget instanceof DropTarget ) - return ((DropTarget) widget).getControl().getShell(); + return ((DropTarget)widget).getControl().getShell(); if ( widget instanceof Menu ) - return ((Menu) widget).getParent().getShell(); + return ((Menu)widget).getParent().getShell(); if ( widget instanceof ScrollBar ) - return ((ScrollBar) widget).getParent().getShell(); - + return ((ScrollBar)widget).getParent().getShell(); return null; } /** * Returns a width hint for a button control. */ - public static int getButtonWidthHint( Button button ) - { + public static int getButtonWidthHint( Button button ) { PixelConverter converter = new PixelConverter( button ); int widthHint = converter.convertHorizontalDLUsToPixels( IDialogConstants.BUTTON_WIDTH ); return Math.max( widthHint, button.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x ); @@ -76,27 +70,23 @@ public class SWTUtil /** * Returns a height hint for a button control. */ - public static int getButtonHeigthHint( Button button ) - { + public static int getButtonHeigthHint( Button button ) { PixelConverter converter = new PixelConverter( button ); return converter.convertVerticalDLUsToPixels( IDialogConstants.BUTTON_HEIGHT ); } /** - * Sets width and height hint for the button control. - * Note: This is a NOP if the button's layout data is not - * an instance of GridData. + * Sets width and height hint for the button control. Note: This + * is a NOP if the button's layout data is not an instance of GridData. * - * @param the button for which to set the dimension hint + * @param the button for which to set the dimension hint */ - public static void setButtonDimensionHint( Button button ) - { + public static void setButtonDimensionHint( Button button ) { Assert.isNotNull( button ); Object gd = button.getLayoutData(); - if ( gd instanceof GridData ) - { - ((GridData) gd).heightHint = getButtonHeigthHint( button ); - ((GridData) gd).widthHint = getButtonWidthHint( button ); + if ( gd instanceof GridData ) { + ((GridData)gd).heightHint = getButtonHeigthHint( button ); + ((GridData)gd).widthHint = getButtonWidthHint( button ); } } }