Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 41799 Details for
Bug 141106
TVT3.2:TCT376: RU: Truncation in DTD editor - Properties
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
org.eclipse.wst.dtd.ui.patch
org.eclipse.wst.dtd.ui.patch (text/plain), 57.86 KB, created by
Amy Wu
on 2006-05-17 16:42:48 EDT
(
hide
)
Description:
org.eclipse.wst.dtd.ui.patch
Filename:
MIME Type:
Creator:
Amy Wu
Created:
2006-05-17 16:42:48 EDT
Size:
57.86 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.dtd.ui >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java,v >retrieving revision 1.3 >diff -u -r1.3 NotationSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java 18 Apr 2006 09:03:40 -0000 1.3 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NotationSection.java 17 May 2006 20:43:41 -0000 >@@ -11,11 +11,15 @@ > *******************************************************************************/ > package org.eclipse.wst.dtd.ui.internal.properties.section; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CLabel; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; >@@ -32,6 +36,7 @@ > > private CLabel publicIdLabel; > private CLabel systemIdLabel; >+ private FontMetrics fFontMetrics; > > public void doHandleEvent(Event event) { > if (event.widget == publicIdText) { >@@ -61,37 +66,40 @@ > Composite composite = getWidgetFactory().createFlatFormComposite(parent); > FormData data; > >+ // Create label first then attach other control to it >+ publicIdLabel = getWidgetFactory().createCLabel(composite, PUBLIC_ID); >+ initializeFontMetrics(publicIdLabel); >+ int labelWidth = getLabelWidth(publicIdLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); >+ data.left = new FormAttachment(0, 0); >+ data.top = new FormAttachment(0, 0); >+ publicIdLabel.setLayoutData(data); >+ > // Public ID > publicIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ > data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data.left = new FormAttachment(publicIdLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >+ data.top = new FormAttachment(publicIdLabel, 0, SWT.CENTER); > publicIdText.setLayoutData(data); > publicIdText.addListener(SWT.Modify, this); > >- publicIdLabel = getWidgetFactory().createCLabel(composite, PUBLIC_ID); >- data = new FormData(); >+ // Create label first then attach other control to it >+ systemIdLabel = getWidgetFactory().createCLabel(composite, SYSTEM_ID); >+ labelWidth = getLabelWidth(systemIdLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(publicIdText, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(publicIdText, 0, SWT.CENTER); >- publicIdLabel.setLayoutData(data); >+ data.top = new FormAttachment(publicIdLabel, +ITabbedPropertyConstants.VSPACE); >+ systemIdLabel.setLayoutData(data); > > // System ID > systemIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ > data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data.left = new FormAttachment(systemIdLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(publicIdText, +ITabbedPropertyConstants.VSPACE); >+ data.top = new FormAttachment(systemIdLabel, 0, SWT.CENTER); > systemIdText.setLayoutData(data); > systemIdText.addListener(SWT.Modify, this); >- >- systemIdLabel = getWidgetFactory().createCLabel(composite, SYSTEM_ID); >- data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(systemIdText, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(systemIdText, 0, SWT.CENTER); >- systemIdLabel.setLayoutData(data); > } > > /* >@@ -121,4 +129,29 @@ > return false; > } > >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >\ No newline at end of file >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java,v >retrieving revision 1.3 >diff -u -r1.3 ContentModelTypeSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java 18 Apr 2006 09:03:40 -0000 1.3 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelTypeSection.java 17 May 2006 20:43:41 -0000 >@@ -13,13 +13,17 @@ > > import java.util.Iterator; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CCombo; > import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; > import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; > import org.eclipse.wst.dtd.core.internal.CMBasicNode; >@@ -35,6 +39,7 @@ > > private CCombo typeCombo; > private String[] typeComboValues = {CMNode.ANY, CMNode.EMPTY, CMNode.PCDATA, CMNode.CHILDREN, CMNode.MIXED}; >+ private FontMetrics fFontMetrics; > > /** > * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, >@@ -43,28 +48,25 @@ > public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { > super.createControls(parent, factory); > Composite composite = getWidgetFactory().createFlatFormComposite(parent); >- FormData data = new FormData(); >+ FormData data; >+ >+ // Create label first then attach other control to it >+ CLabel cLabel = getWidgetFactory().createCLabel(composite, CONTENT_TYPE); >+ initializeFontMetrics(cLabel); >+ int labelWidth = getLabelWidth(cLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(100, 0); > data.top = new FormAttachment(0, 0); >- data.bottom = new FormAttachment(100, 0); >+ cLabel.setLayoutData(data); > > typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); > data = new FormData(); >- data.left = new FormAttachment(0, 100); >- data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >+ data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); >+ data.right = new FormAttachment(100); >+ data.top = new FormAttachment(cLabel, 0, SWT.CENTER); > typeCombo.setLayoutData(data); > typeCombo.addSelectionListener(this); > typeCombo.setItems(typeComboValues); >- >- CLabel cLabel = getWidgetFactory().createCLabel(composite, CONTENT_TYPE); >- data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); >- cLabel.setLayoutData(data); >- > } > > /* >@@ -121,4 +123,30 @@ > public boolean shouldUseExtraSpace() { > return false; > } >+ >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >\ No newline at end of file >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java,v >retrieving revision 1.2 >diff -u -r1.2 OccurrenceSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java 18 Apr 2006 09:03:41 -0000 1.2 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/OccurrenceSection.java 17 May 2006 20:43:41 -0000 >@@ -11,13 +11,17 @@ > *******************************************************************************/ > package org.eclipse.wst.dtd.ui.internal.properties.section; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CCombo; > import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; > import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; > import org.eclipse.wst.dtd.core.internal.CMRepeatableNode; >@@ -32,6 +36,7 @@ > > private CCombo occurrenceCombo; > private String[] occurrenceComboValues = {ONCE, ONE_OR_MORE, OPTIONAL, ZERO_OR_MORE}; >+ private FontMetrics fFontMetrics; > > /** > * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, >@@ -41,21 +46,23 @@ > super.createControls(parent, factory); > Composite composite = getWidgetFactory().createFlatFormComposite(parent); > >+ // Create label first then attach other control to it >+ CLabel usageLabel = getWidgetFactory().createCLabel(composite, OCCURENCE); >+ initializeFontMetrics(usageLabel); >+ int labelWidth = getLabelWidth(usageLabel.getText()); >+ FormData data = new FormData(labelWidth, SWT.DEFAULT); >+ data.left = new FormAttachment(0, 0); >+ data.top = new FormAttachment(0, 0); >+ usageLabel.setLayoutData(data); >+ > occurrenceCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); >- FormData data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data = new FormData(); >+ data.left = new FormAttachment(usageLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >+ data.top = new FormAttachment(usageLabel, 0, SWT.CENTER); > occurrenceCombo.setLayoutData(data); > occurrenceCombo.addSelectionListener(this); > occurrenceCombo.setItems(occurrenceComboValues); >- >- CLabel usageLabel = getWidgetFactory().createCLabel(composite, OCCURENCE); >- data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(occurrenceCombo, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(occurrenceCombo, 0, SWT.CENTER); >- usageLabel.setLayoutData(data); > } > > /* >@@ -98,4 +105,29 @@ > } > } > >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >\ No newline at end of file >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java,v >retrieving revision 1.2 >diff -u -r1.2 EntityTypeSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java 18 Apr 2006 09:03:41 -0000 1.2 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityTypeSection.java 17 May 2006 20:43:41 -0000 >@@ -11,14 +11,18 @@ > *******************************************************************************/ > package org.eclipse.wst.dtd.ui.internal.properties.section; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CCombo; > import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; > import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; > import org.eclipse.wst.dtd.core.internal.Entity; >@@ -33,6 +37,7 @@ > private CCombo typeCombo; > private String[] typeComboValues = {PARAMETER, GENERAL}; > private Button checkBox; >+ private FontMetrics fFontMetrics; > > public static boolean isExternalEntity = false; > >@@ -44,27 +49,30 @@ > super.createControls(parent, factory); > Composite composite = getWidgetFactory().createFlatFormComposite(parent); > >+ // Create label first then attach other control to it >+ CLabel cLabel = getWidgetFactory().createCLabel(composite, ENTITY_TYPE); >+ initializeFontMetrics(cLabel); >+ int labelWidth = getLabelWidth(cLabel.getText()); >+ FormData data = new FormData(labelWidth, SWT.DEFAULT); >+ data.left = new FormAttachment(0, 0); >+ data.top = new FormAttachment(0, 0); >+ cLabel.setLayoutData(data); >+ > typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); >- FormData data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data = new FormData(); >+ data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >+ data.top = new FormAttachment(cLabel, 0, SWT.CENTER); > typeCombo.setLayoutData(data); > typeCombo.addSelectionListener(this); > typeCombo.setItems(typeComboValues); > >- CLabel cLabel = getWidgetFactory().createCLabel(composite, ENTITY_TYPE); >- data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); >- cLabel.setLayoutData(data); >- > checkBox = getWidgetFactory().createButton(composite, EXTERNAL_ENTITY, SWT.CHECK); >- data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ labelWidth = getLabelWidth(checkBox.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); >+ data.left = new FormAttachment(0, 0); > data.right = new FormAttachment(95, 0); >- data.top = new FormAttachment(typeCombo, +ITabbedPropertyConstants.VSPACE); >+ data.top = new FormAttachment(cLabel, +ITabbedPropertyConstants.VSPACE); > checkBox.setLayoutData(data); > checkBox.addSelectionListener(this); > } >@@ -129,4 +137,30 @@ > public boolean shouldUseExtraSpace() { > return false; > } >+ >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >\ No newline at end of file >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java,v >retrieving revision 1.3 >diff -u -r1.3 ContentModelNameSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java 18 Apr 2006 09:03:41 -0000 1.3 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelNameSection.java 17 May 2006 20:43:41 -0000 >@@ -13,13 +13,17 @@ > > import java.util.Iterator; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CCombo; > import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; > import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; > import org.eclipse.wst.dtd.core.internal.CMBasicNode; >@@ -34,6 +38,7 @@ > > private CCombo typeCombo; > private String[] typeComboValues = {CMNode.PCDATA}; >+ private FontMetrics fFontMetrics; > > /** > * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, >@@ -43,22 +48,23 @@ > super.createControls(parent, factory); > Composite composite = getWidgetFactory().createFlatFormComposite(parent); > >- typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT | SWT.READ_ONLY); >- FormData data = new FormData(); >- data.left = new FormAttachment(0, 100); >- data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >- typeCombo.setLayoutData(data); >- typeCombo.addSelectionListener(this); >- typeCombo.setItems(typeComboValues); >- >+ // Create label first then attach other control to it > CLabel cLabel = getWidgetFactory().createCLabel(composite, CONTENT_MODEL); >- data = new FormData(); >+ initializeFontMetrics(cLabel); >+ int labelWidth = getLabelWidth(cLabel.getText()); >+ FormData data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); >+ data.top = new FormAttachment(0, 0); > cLabel.setLayoutData(data); > >+ typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT | SWT.READ_ONLY); >+ data = new FormData(); >+ data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); >+ data.right = new FormAttachment(100); >+ data.top = new FormAttachment(cLabel, 0, SWT.CENTER); >+ typeCombo.setLayoutData(data); >+ typeCombo.addSelectionListener(this); >+ typeCombo.setItems(typeComboValues); > } > > /* >@@ -103,4 +109,30 @@ > public boolean shouldUseExtraSpace() { > return false; > } >+ >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >\ No newline at end of file >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java,v >retrieving revision 1.3 >diff -u -r1.3 AttributeDefaultSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java 18 Apr 2006 09:03:40 -0000 1.3 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/AttributeDefaultSection.java 17 May 2006 20:43:41 -0000 >@@ -11,13 +11,17 @@ > *******************************************************************************/ > package org.eclipse.wst.dtd.ui.internal.properties.section; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CCombo; > import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; >@@ -35,6 +39,7 @@ > private String[] usageComboValues = {IMPLIED, REQUIRED, FIXED, DTDPropertiesMessages._UI_DEFAULT}; > private Text defaultValueText; > private CLabel defaultValueLabel; >+ private FontMetrics fFontMetrics; > > /** > * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, >@@ -44,36 +49,39 @@ > super.createControls(parent, factory); > Composite composite = getWidgetFactory().createFlatFormComposite(parent); > >+ // Create label first then attach other control to it >+ CLabel usageLabel = getWidgetFactory().createCLabel(composite, DTDPropertiesMessages._UI_LABEL_USAGE); >+ initializeFontMetrics(usageLabel); >+ int labelWidth = getLabelWidth(usageLabel.getText()); >+ FormData data = new FormData(labelWidth, SWT.DEFAULT); >+ data.left = new FormAttachment(0, 0); >+ data.top = new FormAttachment(0, 0); >+ usageLabel.setLayoutData(data); >+ > usageCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); >- FormData data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data = new FormData(); >+ data.left = new FormAttachment(usageLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >+ data.top = new FormAttachment(usageLabel, 0, SWT.CENTER); > usageCombo.setLayoutData(data); > usageCombo.addSelectionListener(this); > usageCombo.setItems(usageComboValues); > >- CLabel usageLabel = getWidgetFactory().createCLabel(composite, DTDPropertiesMessages._UI_LABEL_USAGE); >- data = new FormData(); >+ // Create label first then attach other control to it >+ defaultValueLabel = getWidgetFactory().createCLabel(composite, DTDPropertiesMessages._UI_LABEL_DEFAULT_VALUE); >+ labelWidth = getLabelWidth(defaultValueLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(usageCombo, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(usageCombo, 0, SWT.CENTER); >- usageLabel.setLayoutData(data); >+ data.top = new FormAttachment(usageLabel, +ITabbedPropertyConstants.VSPACE); >+ defaultValueLabel.setLayoutData(data); > > defaultValueText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ > data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data.left = new FormAttachment(defaultValueLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(usageCombo, +ITabbedPropertyConstants.VSPACE); >+ data.top = new FormAttachment(defaultValueLabel, 0, SWT.CENTER); > defaultValueText.setLayoutData(data); > defaultValueText.addListener(SWT.Modify, this); >- >- defaultValueLabel = getWidgetFactory().createCLabel(composite, DTDPropertiesMessages._UI_LABEL_DEFAULT_VALUE); >- data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(defaultValueText, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(defaultValueText, 0, SWT.CENTER); >- defaultValueLabel.setLayoutData(data); > } > > /* >@@ -92,12 +100,14 @@ > > if ("".equals(kind) || FIXED.equals(kind)) { //$NON-NLS-1$ > defaultValueLabel.setVisible(true); >+ defaultValueText.setVisible(true); > defaultValueText.setEnabled(true); > defaultValueText.setText(((Attribute) input).getDefaultValue()); > } > else { > defaultValueText.setText(""); //$NON-NLS-1$ > defaultValueLabel.setVisible(false); >+ defaultValueText.setVisible(false); > defaultValueText.setEnabled(false); > } > } >@@ -118,10 +128,12 @@ > > if (DTDPropertiesMessages._UI_DEFAULT.equals(usage) || FIXED.equals(usage)) { > defaultValueLabel.setVisible(true); >+ defaultValueText.setVisible(true); > defaultValueText.setEnabled(true); > } > else { > defaultValueLabel.setVisible(false); >+ defaultValueText.setVisible(false); > defaultValueText.setEnabled(false); > } > } >@@ -138,4 +150,29 @@ > } > } > >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >\ No newline at end of file >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java,v >retrieving revision 1.2 >diff -u -r1.2 ContentModelGroupSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java 18 Apr 2006 09:03:41 -0000 1.2 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/ContentModelGroupSection.java 17 May 2006 20:43:41 -0000 >@@ -11,13 +11,17 @@ > *******************************************************************************/ > package org.eclipse.wst.dtd.ui.internal.properties.section; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CCombo; > import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; > import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; > import org.eclipse.wst.dtd.core.internal.CMGroupNode; >@@ -30,6 +34,7 @@ > > private CCombo modelGroupCombo; > private String[] modelGroupComboValues = {SEQUENCE, CHOICE}; >+ private FontMetrics fFontMetrics; > > /** > * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, >@@ -39,22 +44,23 @@ > super.createControls(parent, factory); > Composite composite = getWidgetFactory().createFlatFormComposite(parent); > >- modelGroupCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); >- FormData data = new FormData(); >- data.left = new FormAttachment(0, 100); >- data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >- modelGroupCombo.setLayoutData(data); >- modelGroupCombo.addSelectionListener(this); >- modelGroupCombo.setItems(modelGroupComboValues); >- >+ // Create label first then attach other control to it > CLabel cLabel = getWidgetFactory().createCLabel(composite, MODEL_GROUP); >- data = new FormData(); >+ initializeFontMetrics(cLabel); >+ int labelWidth = getLabelWidth(cLabel.getText()); >+ FormData data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(modelGroupCombo, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(modelGroupCombo, 0, SWT.CENTER); >+ data.top = new FormAttachment(0, 0); > cLabel.setLayoutData(data); > >+ modelGroupCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); >+ data = new FormData(); >+ data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); >+ data.right = new FormAttachment(100); >+ data.top = new FormAttachment(cLabel, 0, SWT.CENTER); >+ modelGroupCombo.setLayoutData(data); >+ modelGroupCombo.addSelectionListener(this); >+ modelGroupCombo.setItems(modelGroupComboValues); > } > > /* >@@ -89,4 +95,30 @@ > } > } > >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } >+ > } >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java,v >retrieving revision 1.2 >diff -u -r1.2 EmptySection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java 18 Apr 2006 09:03:41 -0000 1.2 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EmptySection.java 17 May 2006 20:43:41 -0000 >@@ -43,4 +43,8 @@ > public boolean shouldUseExtraSpace() { > return false; > } >+ >+ public int getMinimumHeight() { >+ return 0; >+ } > } >\ No newline at end of file >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java,v >retrieving revision 1.3 >diff -u -r1.3 NewEntitySection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java 18 Apr 2006 09:03:40 -0000 1.3 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NewEntitySection.java 17 May 2006 20:43:41 -0000 >@@ -12,6 +12,7 @@ > package org.eclipse.wst.dtd.ui.internal.properties.section; > > import org.eclipse.core.resources.IFile; >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.ViewerFilter; > import org.eclipse.jface.window.Window; >@@ -20,10 +21,13 @@ > import org.eclipse.swt.custom.CCombo; > import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Shell; >@@ -60,6 +64,7 @@ > private CCombo typeCombo; > private String[] typeComboValues = {PARAMETER, GENERAL}; > private PageBook pageBook; >+ private FontMetrics fFontMetrics; > > /** > * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, >@@ -95,50 +100,50 @@ > data.top = new FormAttachment(0, 0); > entityCommonComposite.setLayoutData(data); > >+ // Create label first then attach other control to it >+ CLabel nameLabel = getWidgetFactory().createCLabel(entityCommonComposite, NAME); //$NON-NLS-1$ >+ initializeFontMetrics(nameLabel); >+ int labelWidth = getLabelWidth(nameLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); >+ data.left = new FormAttachment(0, 0); >+ data.top = new FormAttachment(0, 0); >+ nameLabel.setLayoutData(data); >+ > nameText = getWidgetFactory().createText(entityCommonComposite, "", SWT.NONE); //$NON-NLS-1$ > data = new FormData(); >- data.left = new FormAttachment(0, 100); >- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(0, 0); >+ data.left = new FormAttachment(nameLabel, -ITabbedPropertyConstants.HSPACE); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(nameLabel, 0, SWT.CENTER); > nameText.setLayoutData(data); > nameText.addListener(SWT.Modify, this); > >- CLabel nameLabel = getWidgetFactory().createCLabel(entityCommonComposite, NAME); //$NON-NLS-1$ >- data = new FormData(); >+ // Create label first then attach other control to it >+ CLabel cLabel = getWidgetFactory().createCLabel(entityCommonComposite, ENTITY_TYPE); >+ labelWidth = getLabelWidth(cLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(nameText, +ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(nameText, 0, SWT.CENTER); >- nameLabel.setLayoutData(data); >+ data.top = new FormAttachment(nameLabel, +ITabbedPropertyConstants.VSPACE); >+ cLabel.setLayoutData(data); > > // Create Checkbox > checkBox = getWidgetFactory().createButton(entityCommonComposite, EXTERNAL_ENTITY, SWT.CHECK); //$NON-NLS-1$ >+ data = new FormData(); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(cLabel, 0, SWT.CENTER); >+ checkBox.setLayoutData(data); > checkBox.addSelectionListener(this); > > // Create CCombo > typeCombo = getWidgetFactory().createCCombo(entityCommonComposite, SWT.FLAT | SWT.READ_ONLY); >+ data = new FormData(); >+ data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE - 2); >+ data.right = new FormAttachment(checkBox, -ITabbedPropertyConstants.HSPACE); >+ data.top = new FormAttachment(cLabel, 0, SWT.CENTER); >+ typeCombo.setLayoutData(data); > typeCombo.addSelectionListener(this); > typeCombo.setItems(typeComboValues); > typeCombo.setText(PARAMETER); > >- FormData checkBoxFormData = new FormData(); >- checkBoxFormData.left = new FormAttachment(90, -rightMarginSpace + 2); >- checkBoxFormData.right = new FormAttachment(100, 0); >- checkBoxFormData.top = new FormAttachment(typeCombo, 0, SWT.CENTER); >- checkBox.setLayoutData(checkBoxFormData); >- >- FormData typeComboFormData = new FormData(); >- typeComboFormData.left = new FormAttachment(0, 100); >- typeComboFormData.right = new FormAttachment(checkBox, 0); >- typeComboFormData.top = new FormAttachment(nameText, +ITabbedPropertyConstants.VSPACE); >- typeCombo.setLayoutData(typeComboFormData); >- >- CLabel cLabel = getWidgetFactory().createCLabel(entityCommonComposite, ENTITY_TYPE); >- data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); >- cLabel.setLayoutData(data); >- > return entityCommonComposite; > } > >@@ -149,26 +154,26 @@ > FormData data = new FormData(); > data.left = new FormAttachment(0, 0); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(entityCommonComposite, +ITabbedPropertyConstants.VSPACE); >- // data.bottom = new FormAttachment(100,0); >+ data.top = new FormAttachment(entityCommonComposite, -ITabbedPropertyConstants.VSPACE); > internalEntityComposite.setLayoutData(data); > >- entityValueText = getWidgetFactory().createText(internalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ >- entityValueText.setEditable(true); >- entityValueText.addListener(SWT.Modify, this); >- data = new FormData(); >- data.left = new FormAttachment(0, 100); >- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(0, 0); >- entityValueText.setLayoutData(data); >- >+ // Create label first then attach other control to it > CLabel entityValueLabel = getWidgetFactory().createCLabel(internalEntityComposite, VALUE); //$NON-NLS-1$ >- data = new FormData(); >+ int labelWidth = getLabelWidth(entityValueLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(entityValueText, 0); >- data.top = new FormAttachment(entityValueText, 0, SWT.CENTER); >+ data.top = new FormAttachment(0, 0); > entityValueLabel.setLayoutData(data); > >+ entityValueText = getWidgetFactory().createText(internalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ >+ data = new FormData(); >+ data.left = new FormAttachment(entityValueLabel, -ITabbedPropertyConstants.HSPACE); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(entityValueLabel, 0, SWT.CENTER); >+ entityValueText.setLayoutData(data); >+ entityValueText.setEditable(true); >+ entityValueText.addListener(SWT.Modify, this); >+ > return internalEntityComposite; > } > >@@ -179,57 +184,53 @@ > FormData data = new FormData(); > data.left = new FormAttachment(0, 0); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(entityCommonComposite, +ITabbedPropertyConstants.VSPACE); >- // data.bottom = new FormAttachment(100,0); >+ data.top = new FormAttachment(entityCommonComposite, -ITabbedPropertyConstants.VSPACE); > externalEntityComposite.setLayoutData(data); > >+ // Create label first then attach other control to it >+ CLabel publicIdLabel = getWidgetFactory().createCLabel(externalEntityComposite, PUBLIC_ID); //$NON-NLS-1$ >+ int labelWidth = getLabelWidth(publicIdLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); >+ data.left = new FormAttachment(0, 0); >+ data.top = new FormAttachment(0, 0); >+ publicIdLabel.setLayoutData(data); >+ > publicIdText = getWidgetFactory().createText(externalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ > publicIdText.setEditable(true); >- publicIdText.addListener(SWT.Modify, this); > data = new FormData(); >- data.left = new FormAttachment(0, 100); >- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); >- // data.top = new FormAttachment(nameText, >- // +ITabbedPropertyConstants.VSPACE); >- data.top = new FormAttachment(0, 0); >+ data.left = new FormAttachment(publicIdLabel, -ITabbedPropertyConstants.HSPACE); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(publicIdLabel, 0, SWT.CENTER); > publicIdText.setLayoutData(data); >+ publicIdText.addListener(SWT.Modify, this); > >- CLabel publicIdLabel = getWidgetFactory().createCLabel(externalEntityComposite, PUBLIC_ID); //$NON-NLS-1$ >- data = new FormData(); >+ // Create label first then attach other control to it >+ // Create System ID Label >+ CLabel systemIdLabel = getWidgetFactory().createCLabel(externalEntityComposite, SYSTEM_ID); //$NON-NLS-1$ >+ labelWidth = getLabelWidth(systemIdLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(publicIdText, 0); >- data.top = new FormAttachment(publicIdText, 0, SWT.CENTER); >- publicIdLabel.setLayoutData(data); >+ data.top = new FormAttachment(publicIdLabel, +ITabbedPropertyConstants.VSPACE); >+ systemIdLabel.setLayoutData(data); > > // Create Wizard Button > wizardButton = getWidgetFactory().createButton(externalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ > wizardButton.setImage(AbstractUIPlugin.imageDescriptorFromPlugin(DTDUIPlugin.getDefault().getBundle().getSymbolicName(), "icons/browsebutton.gif").createImage()); //$NON-NLS-1$ >+ data = new FormData(); >+ data.right = new FormAttachment(100, 0); >+ data.top = new FormAttachment(systemIdLabel, 0, SWT.CENTER); >+ wizardButton.setLayoutData(data); >+ wizardButton.addSelectionListener(this); > > // Create System ID Text > systemIdText = getWidgetFactory().createText(externalEntityComposite, "", SWT.NONE); //$NON-NLS-1$ > // systemIdText.setEditable(false); >- >- FormData buttonFormData = new FormData(); >- buttonFormData.left = new FormAttachment(100, -rightMarginSpace + 2); >- buttonFormData.right = new FormAttachment(100, 0); >- buttonFormData.top = new FormAttachment(systemIdText, 0, SWT.CENTER); >- wizardButton.setLayoutData(buttonFormData); >- wizardButton.addSelectionListener(this); >- >- FormData systemIdData = new FormData(); >- systemIdData.left = new FormAttachment(0, 100); >- systemIdData.right = new FormAttachment(wizardButton, 0); >- systemIdData.top = new FormAttachment(publicIdText, +ITabbedPropertyConstants.VSPACE); >- systemIdText.setLayoutData(systemIdData); >- systemIdText.addListener(SWT.Modify, this); >- >- // Create System ID Label >- CLabel systemIdLabel = getWidgetFactory().createCLabel(externalEntityComposite, SYSTEM_ID); //$NON-NLS-1$ > data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(systemIdText, 0); >- data.top = new FormAttachment(systemIdText, 0, SWT.CENTER); >- systemIdLabel.setLayoutData(data); >+ data.left = new FormAttachment(systemIdLabel, -ITabbedPropertyConstants.HSPACE); >+ data.right = new FormAttachment(wizardButton, -ITabbedPropertyConstants.HSPACE); >+ data.top = new FormAttachment(systemIdLabel, 0, SWT.CENTER); >+ systemIdText.setLayoutData(data); >+ systemIdText.addListener(SWT.Modify, this); > > return externalEntityComposite; > } >@@ -362,4 +363,30 @@ > } > > } >+ >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java,v >retrieving revision 1.2 >diff -u -r1.2 TypeSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java 18 Apr 2006 09:03:41 -0000 1.2 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/TypeSection.java 17 May 2006 20:43:41 -0000 >@@ -11,13 +11,17 @@ > *******************************************************************************/ > package org.eclipse.wst.dtd.ui.internal.properties.section; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CCombo; > import org.eclipse.swt.custom.CLabel; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; > import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; > import org.eclipse.wst.dtd.core.internal.Attribute; >@@ -28,6 +32,7 @@ > > private CCombo typeCombo; > private String[] typeComboValues = {Attribute.CDATA, Attribute.ID, Attribute.IDREF, Attribute.IDREFS, Attribute.ENTITY, Attribute.ENTITIES, Attribute.NMTOKEN, Attribute.NMTOKENS, Attribute.ENUMERATED_NAME, Attribute.ENUMERATED_NOTATION}; >+ private FontMetrics fFontMetrics; > > /** > * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, >@@ -36,28 +41,25 @@ > public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { > super.createControls(parent, factory); > Composite composite = getWidgetFactory().createFlatFormComposite(parent); >- FormData data = new FormData(); >+ FormData data; >+ >+ // Create label first then attach other control to it >+ CLabel cLabel = getWidgetFactory().createCLabel(composite, TYPE); >+ initializeFontMetrics(cLabel); >+ int labelWidth = getLabelWidth(cLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(100, 0); > data.top = new FormAttachment(0, 0); >- data.bottom = new FormAttachment(100, 0); >+ cLabel.setLayoutData(data); > > typeCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT); > data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data.left = new FormAttachment(cLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >+ data.top = new FormAttachment(cLabel, 0, SWT.CENTER); > typeCombo.setLayoutData(data); > typeCombo.addSelectionListener(this); > typeCombo.setItems(typeComboValues); >- >- CLabel cLabel = getWidgetFactory().createCLabel(composite, TYPE); >- data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(typeCombo, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); >- cLabel.setLayoutData(data); >- > } > > /* >@@ -90,4 +92,29 @@ > return false; > } > >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >\ No newline at end of file >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java,v >retrieving revision 1.3 >diff -u -r1.3 NameSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java 18 Apr 2006 09:03:41 -0000 1.3 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/NameSection.java 17 May 2006 20:43:41 -0000 >@@ -11,11 +11,15 @@ > *******************************************************************************/ > package org.eclipse.wst.dtd.ui.internal.properties.section; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CLabel; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; >@@ -26,6 +30,7 @@ > public class NameSection extends AbstractSection { > private final String NAME = DTDPropertiesMessages._UI_LABEL_NAME; > private Text nameText; >+ private FontMetrics fFontMetrics; > > public void doHandleEvent(Event event) { > if (event.widget == nameText) { >@@ -45,23 +50,25 @@ > public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { > super.createControls(parent, factory); > Composite composite = getWidgetFactory().createFlatFormComposite(parent); >+ > FormData data; >+ // Create label first then attach other control to it >+ CLabel nameLabel = getWidgetFactory().createCLabel(composite, NAME); >+ initializeFontMetrics(nameLabel); >+ int labelWidth = getLabelWidth(nameLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); >+ data.left = new FormAttachment(0, 0); >+ data.top = new FormAttachment(0, 0); >+ nameLabel.setLayoutData(data); > > nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ > data = new FormData(); >- data.left = new FormAttachment(0, 100); >- data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >+ data.left = new FormAttachment(nameLabel, -ITabbedPropertyConstants.HSPACE); >+ data.right = new FormAttachment(100); >+ data.top = new FormAttachment(nameLabel, 0, SWT.CENTER); > nameText.setLayoutData(data); > nameText.addListener(SWT.Modify, this); > >- CLabel nameLabel = getWidgetFactory().createCLabel(composite, NAME); >- data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(nameText, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(nameText, 0, SWT.CENTER); >- nameLabel.setLayoutData(data); >- > // listener.startListeningForEnter(nameText); > // listener.startListeningTo(nameText); > } >@@ -89,4 +96,30 @@ > public boolean shouldUseExtraSpace() { > return false; > } >+ >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >\ No newline at end of file >Index: src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/dtd/plugins/org.eclipse.wst.dtd.ui/src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java,v >retrieving revision 1.3 >diff -u -r1.3 EntityValueSection.java >--- src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java 18 Apr 2006 09:03:40 -0000 1.3 >+++ src-properties/org/eclipse/wst/dtd/ui/internal/properties/section/EntityValueSection.java 17 May 2006 20:43:41 -0000 >@@ -11,11 +11,15 @@ > *******************************************************************************/ > package org.eclipse.wst.dtd.ui.internal.properties.section; > >+import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CLabel; >+import org.eclipse.swt.graphics.FontMetrics; >+import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.layout.FormAttachment; > import org.eclipse.swt.layout.FormData; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; >@@ -35,6 +39,7 @@ > private CLabel valueLabel; > private CLabel publicIdLabel; > private CLabel systemIdLabel; >+ private FontMetrics fFontMetrics; > > public void doHandleEvent(Event event) { > if (event.widget == valueText) { >@@ -72,53 +77,57 @@ > Composite composite = getWidgetFactory().createFlatFormComposite(parent); > FormData data; > >+ // Create label first then attach other control to it >+ valueLabel = getWidgetFactory().createCLabel(composite, VALUE); >+ initializeFontMetrics(valueLabel); >+ int labelWidth = getLabelWidth(valueLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); >+ data.left = new FormAttachment(0, 0); >+ data.top = new FormAttachment(0, 0); >+ valueLabel.setLayoutData(data); >+ > // Entity Value > valueText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ > data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data.left = new FormAttachment(valueLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(0, 0); >+ data.top = new FormAttachment(valueLabel, 0, SWT.CENTER); > valueText.setLayoutData(data); > valueText.addListener(SWT.Modify, this); > >- valueLabel = getWidgetFactory().createCLabel(composite, VALUE); >- data = new FormData(); >+ // Create label first then attach other control to it >+ publicIdLabel = getWidgetFactory().createCLabel(composite, PUBLIC_ID); >+ labelWidth = getLabelWidth(publicIdLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(valueText, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(valueText, 0, SWT.CENTER); >- valueLabel.setLayoutData(data); >+ data.top = new FormAttachment(valueLabel, +ITabbedPropertyConstants.VSPACE); >+ publicIdLabel.setLayoutData(data); > > // Public ID > publicIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ > data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data.left = new FormAttachment(publicIdLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(valueText, +ITabbedPropertyConstants.VSPACE); >+ data.top = new FormAttachment(publicIdLabel, 0, SWT.CENTER); > publicIdText.setLayoutData(data); > publicIdText.addListener(SWT.Modify, this); > >- publicIdLabel = getWidgetFactory().createCLabel(composite, PUBLIC_ID); >- data = new FormData(); >+ // Create label first then attach other control to it >+ systemIdLabel = getWidgetFactory().createCLabel(composite, SYSTEM_ID); >+ labelWidth = getLabelWidth(systemIdLabel.getText()); >+ data = new FormData(labelWidth, SWT.DEFAULT); > data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(publicIdText, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(publicIdText, 0, SWT.CENTER); >- publicIdLabel.setLayoutData(data); >+ data.top = new FormAttachment(publicIdLabel, +ITabbedPropertyConstants.VSPACE); >+ systemIdLabel.setLayoutData(data); > > // System ID > systemIdText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ > data = new FormData(); >- data.left = new FormAttachment(0, 100); >+ data.left = new FormAttachment(systemIdLabel, -ITabbedPropertyConstants.HSPACE); > data.right = new FormAttachment(100, 0); >- data.top = new FormAttachment(publicIdText, +ITabbedPropertyConstants.VSPACE); >+ data.top = new FormAttachment(systemIdLabel, 0, SWT.CENTER); > systemIdText.setLayoutData(data); > systemIdText.addListener(SWT.Modify, this); >- >- systemIdLabel = getWidgetFactory().createCLabel(composite, SYSTEM_ID); >- data = new FormData(); >- data.left = new FormAttachment(0, 0); >- data.right = new FormAttachment(systemIdText, -ITabbedPropertyConstants.HSPACE); >- data.top = new FormAttachment(systemIdText, 0, SWT.CENTER); >- systemIdLabel.setLayoutData(data); > } > > /* >@@ -170,4 +179,30 @@ > private boolean isExternalEntity() { > return EntityTypeSection.isExternalEntity; > } >+ >+ /** >+ * Initilize font metrics >+ * >+ * @param control >+ */ >+ private void initializeFontMetrics(Control control) { >+ GC gc = new GC(control); >+ gc.setFont(control.getFont()); >+ fFontMetrics = gc.getFontMetrics(); >+ gc.dispose(); >+ } >+ >+ /** >+ * Determine appropriate label width >+ * >+ * @param labelText >+ * @return >+ */ >+ private int getLabelWidth(String labelText) { >+ int labelWidth = 98; >+ >+ int pixels = Dialog.convertWidthInCharsToPixels(fFontMetrics, labelText.length() + 5); >+ labelWidth = Math.max(pixels, labelWidth); >+ return labelWidth; >+ } > } >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 141106
:
40983
|
40984
|
40985
|
41014
|
41015
|
41799
|
43859
|
61176