mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
Warnings elimination: "PixelConverter" is not referenced now.
This commit is contained in:
parent
5a7db03823
commit
1565582172
3 changed files with 30 additions and 32 deletions
|
@ -18,17 +18,19 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.util.PixelConverter;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.ui.newui.NewUIMessages;
|
||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||
import org.eclipse.cdt.ui.newui.MultiLineTextFieldEditor;
|
||||
import org.eclipse.cdt.ui.newui.NewUIMessages;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.preference.StringFieldEditor;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.FontMetrics;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
@ -100,8 +102,6 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
|
|||
// Map that holds all user object options and its values
|
||||
private HashMap userObjsMap;
|
||||
|
||||
private AbstractCBuildPropertyTab buildPropPage;
|
||||
|
||||
public BuildToolSettingUI(AbstractCBuildPropertyTab page,
|
||||
IResourceInfo info, ITool _tool) {
|
||||
// Cache the configuration and tool this page is for
|
||||
|
@ -131,14 +131,14 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
|
|||
super.createFieldEditors();
|
||||
// Add a string editor to edit the tool command
|
||||
Composite parent = getFieldEditorParent();
|
||||
PixelConverter converter = new PixelConverter(parent);
|
||||
FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent);
|
||||
commandStringField = new StringFieldEditor(fTool.getId(),
|
||||
NewUIMessages.getResourceString(COMMAND),
|
||||
parent);
|
||||
commandStringField.setEmptyStringAllowed(false);
|
||||
GridData gd = ((GridData)commandStringField.getTextControl(parent).getLayoutData());
|
||||
gd.grabExcessHorizontalSpace = true;
|
||||
gd.minimumWidth = converter.convertWidthInCharsToPixels(3);
|
||||
gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 3);
|
||||
addField(commandStringField);
|
||||
// Add a field editor that displays overall build options
|
||||
Composite par = getFieldEditorParent();
|
||||
|
@ -147,17 +147,17 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
|
|||
allOptionFieldEditor.getTextControl(par).setEditable(false);
|
||||
// gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData());
|
||||
gd.grabExcessHorizontalSpace = true;
|
||||
gd.minimumWidth = converter.convertWidthInCharsToPixels(20);
|
||||
gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);
|
||||
addField(allOptionFieldEditor);
|
||||
|
||||
// Create the Advanced Settings group
|
||||
createAdvancedSettingsGroup(converter);
|
||||
createAdvancedSettingsGroup(fm);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Creates the group that contains the build artifact name controls.
|
||||
*/
|
||||
private void createAdvancedSettingsGroup(PixelConverter converter) {
|
||||
private void createAdvancedSettingsGroup(FontMetrics fm) {
|
||||
addField( createLabelEditor( getFieldEditorParent(), WHITESPACE ) ); //$NON-NLS-1$
|
||||
addField( createLabelEditor( getFieldEditorParent(), NewUIMessages.getResourceString(ADVANCED_GROUP) ) );
|
||||
|
||||
|
@ -168,8 +168,8 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
|
|||
parent);
|
||||
GridData gd = ((GridData)commandLinePatternField.getTextControl(parent).getLayoutData());
|
||||
gd.grabExcessHorizontalSpace = true;
|
||||
gd.widthHint = converter.convertWidthInCharsToPixels(30);
|
||||
gd.minimumWidth = converter.convertWidthInCharsToPixels(20);
|
||||
gd.widthHint = Dialog.convertWidthInCharsToPixels(fm,30);
|
||||
gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);
|
||||
addField(commandLinePatternField);
|
||||
|
||||
}
|
||||
|
@ -178,23 +178,6 @@ public class BuildToolSettingUI extends AbstractToolSettingUI {
|
|||
return new LabelFieldEditor( parent, title );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates single string from the string array with a separator
|
||||
*
|
||||
* @param items
|
||||
* @return
|
||||
*/
|
||||
private String createList(String[] items) {
|
||||
StringBuffer path = new StringBuffer(""); //$NON-NLS-1$
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
path.append(items[i]);
|
||||
if (i < (items.length - 1)) {
|
||||
path.append(DEFAULT_SEPERATOR);
|
||||
}
|
||||
}
|
||||
return path.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.internal.ui.util.PixelConverter;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IConfigurationScannerConfigBuilderInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||
|
@ -34,6 +33,7 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
|||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -125,8 +125,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
|||
|
||||
profileComp = new Composite(usercomp, SWT.NONE);
|
||||
gd = new GridData(GridData.FILL, GridData.FILL, true, true);
|
||||
PixelConverter converter = new PixelConverter(parent);
|
||||
gd.heightHint = converter.convertVerticalDLUsToPixels(DEFAULT_HEIGHT);
|
||||
gd.heightHint = Dialog.convertVerticalDLUsToPixels(getFontMetrics(parent), DEFAULT_HEIGHT);
|
||||
profileComp.setLayoutData(gd);
|
||||
profileComp.setLayout(new TabFolderLayout());
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.eclipse.jface.window.Window;
|
|||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.FontMetrics;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -485,4 +487,18 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Added to avoid usage PixelConverter class.
|
||||
* @param control
|
||||
* @return FontMetrics
|
||||
*/
|
||||
public static FontMetrics getFontMetrics(Control control) {
|
||||
GC gc = new GC(control);
|
||||
gc.setFont(control.getFont());
|
||||
FontMetrics fFontMetrics= gc.getFontMetrics();
|
||||
gc.dispose();
|
||||
return fFontMetrics;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue