From b8b3ffdfed6564f2ea0004e545ee26b461d8c5e4 Mon Sep 17 00:00:00 2001 From: David Inglis Date: Wed, 13 Aug 2003 19:39:54 +0000 Subject: [PATCH] small refactor to internal --- .../org.eclipse.cdt.make.ui/plugin.properties | 2 +- build/org.eclipse.cdt.make.ui/plugin.xml | 6 +- .../cdt/make/internal/ui/PixelConverter.java | 58 --------- .../eclipse/cdt/make/internal/ui/SWTUtil.java | 122 ------------------ .../ui/preferences/MakePreferencePage.java | 2 +- .../ui/properties/MakePropertyPage.java | 2 +- 6 files changed, 6 insertions(+), 186 deletions(-) delete mode 100644 build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/PixelConverter.java delete mode 100644 build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/SWTUtil.java rename build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/{ => internal}/ui/preferences/MakePreferencePage.java (98%) rename build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/{ => internal}/ui/properties/MakePropertyPage.java (98%) diff --git a/build/org.eclipse.cdt.make.ui/plugin.properties b/build/org.eclipse.cdt.make.ui/plugin.properties index f56a3aefb33..5a10c4fba71 100644 --- a/build/org.eclipse.cdt.make.ui/plugin.properties +++ b/build/org.eclipse.cdt.make.ui/plugin.properties @@ -21,7 +21,7 @@ ActionMakeUpdate.label=Update Old Make Project... CommandMakeBuildCreate.name=Build/Create Make Target CommandMakeBuildCreate.description=Build or create a new make build target -PreferenceMake.name=New Make Projects +PreferenceMakeProject.name=New Make Projects PropertyMakeProject.name= C/C++ Make Project ViewCatagoryMake.name=Make diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml index f6496d42d3e..8bd192faf02 100644 --- a/build/org.eclipse.cdt.make.ui/plugin.xml +++ b/build/org.eclipse.cdt.make.ui/plugin.xml @@ -180,9 +180,9 @@ @@ -192,7 +192,7 @@ objectClass="org.eclipse.core.resources.IProject" adaptable="true" name="%PropertyMakeProject.name" - class="org.eclipse.cdt.make.ui.properties.MakePropertyPage" + class="org.eclipse.cdt.make.internal.ui.properties.MakePropertyPage" id="org.eclipse.cdt.make.ui.properties.MakePropertyPage"> null is returned. - * - * @return the shell for the given widget - */ - public static Shell getShell(Widget widget) { - if (widget instanceof Control) - return ((Control)widget).getShell(); - if (widget instanceof Caret) - return ((Caret)widget).getParent().getShell(); - if (widget instanceof DragSource) - return ((DragSource)widget).getControl().getShell(); - if (widget instanceof DropTarget) - return ((DropTarget)widget).getControl().getShell(); - if (widget instanceof Menu) - return ((Menu)widget).getParent().getShell(); - if (widget instanceof ScrollBar) - return ((ScrollBar)widget).getParent().getShell(); - - return null; - } - - - /** - * Returns a width hint for a button control. - */ - public static int getButtonWidthHint(Button button) { - if (button.getFont().equals(JFaceResources.getDefaultFont())) - button.setFont(JFaceResources.getDialogFont()); - PixelConverter converter= new PixelConverter(button); - int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); - return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); - } - - /** - * Returns a height hint for a button control. - */ - public static int getButtonHeigthHint(Button button) { - if (button.getFont().equals(JFaceResources.getDefaultFont())) - button.setFont(JFaceResources.getDialogFont()); - 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. - * - * @param the button for which to set the dimension hint - */ - 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); - } - } - - public static int getTableHeightHint(Table table, int rows) { - if (table.getFont().equals(JFaceResources.getDefaultFont())) - table.setFont(JFaceResources.getDialogFont()); - int result= table.getItemHeight() * rows + table.getHeaderHeight(); - if (table.getLinesVisible()) - result+= table.getGridLineWidth() * (rows - 1); - return result; - } - - -} diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/preferences/MakePreferencePage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java similarity index 98% rename from build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/preferences/MakePreferencePage.java rename to build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java index 7055ac68100..61503809fad 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/preferences/MakePreferencePage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/preferences/MakePreferencePage.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.make.ui.preferences; +package org.eclipse.cdt.make.internal.ui.preferences; import org.eclipse.cdt.make.internal.ui.MakeProjectOptionBlock; import org.eclipse.cdt.make.internal.ui.MakeUIPlugin; diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/properties/MakePropertyPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java similarity index 98% rename from build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/properties/MakePropertyPage.java rename to build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java index 857b98f3fb2..9eaedc18405 100644 --- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/properties/MakePropertyPage.java +++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/properties/MakePropertyPage.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.make.ui.properties; +package org.eclipse.cdt.make.internal.ui.properties; import java.lang.reflect.InvocationTargetException;