[249431] browse.. and new.. dialog automatically pops up when traversed in properties view's comboboxes
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java
index 128f9c0..9f2362b 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/AbstractSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -42,6 +42,7 @@
import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+import org.eclipse.wst.xsd.ui.internal.editor.Messages;
import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
import org.eclipse.xsd.XSDComponent;
import org.eclipse.xsd.XSDConcreteComponent;
@@ -59,6 +60,7 @@
protected CustomListener customListener = new CustomListener();
protected IEditorPart owningEditor;
private IStatusLineManager statusLine;
+ protected boolean isTraversing = false;
public static final Image ICON_ERROR = XSDEditorPlugin.getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
@@ -362,5 +364,33 @@
}
}
}
+
+ protected boolean shouldPerformComboSelection(int eventType, Object selectedItem)
+ {
+ // if traversing through combobox, don't automatically pop up
+ // the browse and new dialog boxes
+ boolean wasTraversing = isTraversing;
+ if (isTraversing)
+ isTraversing = false;
+ // we only care about default selecting (hitting enter in combobox)
+ // for browse.. and new.. otherwise, selection event will be fired
+ if (eventType == SWT.DefaultSelection)
+ {
+ if (selectedItem instanceof String && ((Messages._UI_ACTION_BROWSE.equals(selectedItem) || Messages._UI_ACTION_NEW.equals(selectedItem))))
+ return true;
+ return false;
+ }
+
+ // if was traversing and got selection event, do nothing if it's
+ // browse.. or new..
+ if (wasTraversing && selectedItem instanceof String)
+ {
+ if (Messages._UI_ACTION_BROWSE.equals(selectedItem) || Messages._UI_ACTION_NEW.equals(selectedItem))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java
index 97987cd..673328b 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDAttributeDeclarationSection.java
@@ -121,6 +121,7 @@
componentNameCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
componentNameCombo.addSelectionListener(this);
+ componentNameCombo.addListener(SWT.Traverse, this);
componentNameCombo.setLayoutData(data);
PlatformUI.getWorkbench().getHelpSystem().setHelp(componentNameCombo,
@@ -143,6 +144,7 @@
typeCombo = getWidgetFactory().createCCombo(composite);
typeCombo.setLayoutData(data);
typeCombo.addSelectionListener(this);
+ typeCombo.addListener(SWT.Traverse, this);
PlatformUI.getWorkbench().getHelpSystem().setHelp(typeCombo,
XSDEditorCSHelpIds.GENERAL_TAB__ATTRIBUTE__TYPE);
@@ -429,13 +431,49 @@
return false;
}
+ public void doWidgetDefaultSelected(SelectionEvent e)
+ {
+ if (e.widget == typeCombo)
+ {
+ String selection = typeCombo.getText();
+ if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
+ handleWidgetSelection(e);
+ } else if (e.widget == componentNameCombo)
+ {
+ String selection = componentNameCombo.getText();
+ if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
public void doWidgetSelected(SelectionEvent e)
{
if (e.widget == typeCombo)
{
+ String selection = typeCombo.getText();
+ if (shouldPerformComboSelection(SWT.Selection, selection))
+ handleWidgetSelection(e);
+ } else if (e.widget == componentNameCombo)
+ {
+ String selection = componentNameCombo.getText();
+ if (shouldPerformComboSelection(SWT.Selection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
+ private void handleWidgetSelection(SelectionEvent e)
+ {
+ if (e.widget == typeCombo)
+ {
IEditorPart editor = getActiveEditor();
if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
+ ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
String selection = typeCombo.getText();
ComponentSpecification newValue;
@@ -474,7 +512,7 @@
{
IEditorPart editor = getActiveEditor();
if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDAttributeReferenceEditManager.class);
+ ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDAttributeReferenceEditManager.class);
String selection = componentNameCombo.getText();
ComponentSpecification newValue;
@@ -506,17 +544,16 @@
if (newValue != null)
manager.modifyComponentReference(input, newValue);
}
-
}
else
{
- XSDAttributeDeclaration xsdAttribute = (XSDAttributeDeclaration) input;
- Element element = xsdAttribute.getElement();
+ XSDAttributeDeclaration xsdAttribute = (XSDAttributeDeclaration) input;
+ Element element = xsdAttribute.getElement();
if (e.widget == usageCombo)
- {
- final String newValue = usageCombo.getText();
- if (element != null)
- {
+ {
+ final String newValue = usageCombo.getText();
+ if (element != null)
+ {
PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_USAGE)
{
protected void doExecuteSteps()
@@ -528,13 +565,13 @@
}
};
getCommandStack().execute(command);
- }
- }
- else if (e.widget == formCombo)
- {
- final String newValue = formCombo.getText();
- if (element != null)
- {
+ }
+ }
+ else if (e.widget == formCombo)
+ {
+ final String newValue = formCombo.getText();
+ if (element != null)
+ {
PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_LABEL_FORM)
{
protected void doExecuteSteps()
@@ -546,19 +583,19 @@
}
};
getCommandStack().execute(command);
- }
- }
- else if (e.widget == defaultButton)
- {
- boolean newValue = defaultButton.getSelection();
- if (element != null)
- {
- if (newValue)
- {
- if (element.hasAttribute(XSDConstants.FIXED_ATTRIBUTE))
- {
- final String value = element.getAttribute(XSDConstants.FIXED_ATTRIBUTE);
-
+ }
+ }
+ else if (e.widget == defaultButton)
+ {
+ boolean newValue = defaultButton.getSelection();
+ if (element != null)
+ {
+ if (newValue)
+ {
+ if (element.hasAttribute(XSDConstants.FIXED_ATTRIBUTE))
+ {
+ final String value = element.getAttribute(XSDConstants.FIXED_ATTRIBUTE);
+
PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_DEFAULT)
{
protected void doExecuteSteps()
@@ -568,20 +605,20 @@
}
};
getCommandStack().execute(command);
- }
- }
- }
- }
- else if (e.widget == fixedButton)
- {
- boolean newValue = fixedButton.getSelection();
- if (element != null)
- {
- if (newValue)
- {
- if (element.hasAttribute(XSDConstants.DEFAULT_ATTRIBUTE))
- {
- final String value = element.getAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
+ }
+ }
+ }
+ }
+ else if (e.widget == fixedButton)
+ {
+ boolean newValue = fixedButton.getSelection();
+ if (element != null)
+ {
+ if (newValue)
+ {
+ if (element.hasAttribute(XSDConstants.DEFAULT_ATTRIBUTE))
+ {
+ final String value = element.getAttribute(XSDConstants.DEFAULT_ATTRIBUTE);
PropertiesChangeCommand command = new PropertiesChangeCommand(element, org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_FIXED)
{
protected void doExecuteSteps()
@@ -591,16 +628,22 @@
}
};
getCommandStack().execute(command);
- }
- }
- }
- }
+ }
+ }
+ }
+ }
}
super.doWidgetSelected(e);
}
protected void doHandleEvent(Event event)
{
+ if (event.type == SWT.Traverse) {
+ if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
+ isTraversing = true;
+ return;
+ }
+ }
super.doHandleEvent(event);
if (event.widget == nameText)
{
@@ -717,11 +760,17 @@
public void dispose()
{
if (componentNameCombo != null && !componentNameCombo.isDisposed())
+ {
componentNameCombo.removeSelectionListener(this);
+ componentNameCombo.removeListener(SWT.Traverse, this);
+ }
if (nameText != null && !nameText.isDisposed())
removeListeners(nameText);
if (typeCombo != null && !typeCombo.isDisposed())
+ {
typeCombo.removeSelectionListener(this);
+ typeCombo.removeListener(SWT.Traverse, this);
+ }
super.dispose();
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeSection.java
index 0da2f51..32f001e 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDComplexTypeSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -109,6 +109,7 @@
baseTypeCombo.setEditable(false);
baseTypeCombo.setLayoutData(data);
baseTypeCombo.addSelectionListener(this);
+ baseTypeCombo.addListener(SWT.Traverse, this);
PlatformUI.getWorkbench().getHelpSystem().setHelp(baseTypeCombo,
XSDEditorCSHelpIds.GENERAL_TAB__COMPLEX_TYPE__INHERIT_FROM);
@@ -220,16 +221,39 @@
}
}
- /**
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent)
- */
+ public void doWidgetDefaultSelected(SelectionEvent e)
+ {
+ if (e.widget == baseTypeCombo)
+ {
+ String selection = baseTypeCombo.getText();
+ if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
public void doWidgetSelected(SelectionEvent e)
{
if (e.widget == baseTypeCombo)
{
+ String selection = baseTypeCombo.getText();
+ if (shouldPerformComboSelection(SWT.Selection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
+ private void handleWidgetSelection(SelectionEvent e)
+ {
+ if (e.widget == baseTypeCombo)
+ {
IEditorPart editor = getActiveEditor();
if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDComplexTypeBaseTypeEditManager.class);
+ ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDComplexTypeBaseTypeEditManager.class);
String selection = baseTypeCombo.getText();
ComponentSpecification newValue;
@@ -261,7 +285,7 @@
XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
String value = derivedByCombo.getText();
Command command = new UpdateComplexTypeDerivationBy(complexType, value);
-
+
if (getCommandStack() != null)
{
getCommandStack().execute(command);
@@ -283,10 +307,18 @@
public void dispose()
{
super.dispose();
+ if (baseTypeCombo != null && !baseTypeCombo.isDisposed())
+ baseTypeCombo.removeListener(SWT.Traverse, this);
}
public void doHandleEvent(Event event)
{
+ if (event.type == SWT.Traverse) {
+ if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
+ isTraversing = true;
+ return;
+ }
+ }
super.doHandleEvent(event);
if (event.widget == nameText)
{
@@ -353,5 +385,4 @@
baseTypeCombo.add(currentTypeName);
}
}
-
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
index 915db92..ff9bbc7 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationAdvancedSection.java
@@ -13,6 +13,7 @@
package org.eclipse.wst.xsd.ui.internal.common.properties.sections;
import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.SelectionEvent;
@@ -149,6 +150,7 @@
substGroupCombo.setLayoutData(data);
substGroupCombo.setEditable(true);
substGroupCombo.addSelectionListener(this);
+ substGroupCombo.addListener(SWT.Traverse, this);
applyAllListeners(substGroupCombo);
// ------------------------------------------------------------------
@@ -180,6 +182,14 @@
{
if (e.widget == substGroupCombo)
{
+ if (e.type == SWT.Traverse) {
+ if (e.detail == SWT.TRAVERSE_ARROW_NEXT || e.detail == SWT.TRAVERSE_ARROW_PREVIOUS)
+ {
+ isTraversing = true;
+ return;
+ }
+ }
+
XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
String value = substGroupCombo.getText();
String oldValue = eleDec.getElement().getAttribute(XSDConstants.SUBSTITUTIONGROUP_ATTRIBUTE);
@@ -194,8 +204,34 @@
}
}
+ public void doWidgetDefaultSelected(SelectionEvent e)
+ {
+ if (e.widget == substGroupCombo)
+ {
+ String selection = substGroupCombo.getText();
+ if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
public void doWidgetSelected(SelectionEvent e)
{
+ if (e.widget == substGroupCombo)
+ {
+ String selection = substGroupCombo.getText();
+ if (shouldPerformComboSelection(SWT.Selection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
+ private void handleWidgetSelection(SelectionEvent e)
+ {
if (e.widget == blockCombo)
{
XSDElementDeclaration eleDec = (XSDElementDeclaration) input;
@@ -226,7 +262,7 @@
{
IEditorPart editor = getActiveEditor();
if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDSubstitutionGroupEditManager.class);
+ ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDSubstitutionGroupEditManager.class);
String selection = substGroupCombo.getText();
ComponentSpecification newValue;
@@ -268,7 +304,6 @@
command.setDeleteIfEmpty(true);
getCommandStack().execute(command);
}
-
}
public void refresh()
@@ -405,5 +440,14 @@
}
return null;
}
+
+ public void dispose()
+ {
+ if (substGroupCombo != null && !substGroupCombo.isDisposed())
+ {
+ substGroupCombo.removeListener(SWT.Traverse, this);
+ }
+ super.dispose();
+ }
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationSection.java
index aabfd39..5d45501 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDElementDeclarationSection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -125,6 +125,7 @@
componentNameCombo = getWidgetFactory().createCCombo(composite, SWT.FLAT);
componentNameCombo.addSelectionListener(this);
+ componentNameCombo.addListener(SWT.Traverse, this);
componentNameCombo.setLayoutData(data);
PlatformUI.getWorkbench().getHelpSystem().setHelp(componentNameCombo,
@@ -149,6 +150,7 @@
typeCombo.setEditable(false);
typeCombo.setLayoutData(data);
typeCombo.addSelectionListener(this);
+ typeCombo.addListener(SWT.Traverse, this);
PlatformUI.getWorkbench().getHelpSystem().setHelp(typeCombo,
XSDEditorCSHelpIds.GENERAL_TAB__ELEMENT__TYPE);
@@ -357,14 +359,49 @@
return false;
}
+ public void doWidgetDefaultSelected(SelectionEvent e)
+ {
+ if (e.widget == typeCombo)
+ {
+ String selection = typeCombo.getText();
+ if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
+ handleWidgetSelection(e);
+ } else if (e.widget == componentNameCombo)
+ {
+ String selection = componentNameCombo.getText();
+ if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
public void doWidgetSelected(SelectionEvent e)
{
if (e.widget == typeCombo)
{
+ String selection = typeCombo.getText();
+ if (shouldPerformComboSelection(SWT.Selection, selection))
+ handleWidgetSelection(e);
+ } else if (e.widget == componentNameCombo)
+ {
+ String selection = componentNameCombo.getText();
+ if (shouldPerformComboSelection(SWT.Selection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
+ private void handleWidgetSelection(SelectionEvent e)
+ {
+ if (e.widget == typeCombo)
+ {
IEditorPart editor = getActiveEditor();
if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
-
+ ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class);
String selection = typeCombo.getText();
ComponentSpecification newValue;
IComponentDialog dialog= null;
@@ -403,7 +440,7 @@
{
IEditorPart editor = getActiveEditor();
if (editor == null) return;
- ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDElementReferenceEditManager.class);
+ ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDElementReferenceEditManager.class);
String selection = componentNameCombo.getText();
ComponentSpecification newValue;
@@ -435,7 +472,6 @@
if (newValue != null)
manager.modifyComponentReference(input, newValue);
}
-
}
else if (e.widget == maxCombo)
{
@@ -472,6 +508,12 @@
public void doHandleEvent(Event event)
{
+ if (event.type == SWT.Traverse) {
+ if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
+ isTraversing = true;
+ return;
+ }
+ }
super.doHandleEvent(event);
if (event.widget == nameText)
{
@@ -523,13 +565,19 @@
public void dispose()
{
if (componentNameCombo != null && !componentNameCombo.isDisposed())
+ {
componentNameCombo.removeSelectionListener(this);
+ componentNameCombo.removeListener(SWT.Traverse, this);
+ }
if (minCombo != null && !minCombo.isDisposed())
minCombo.removeSelectionListener(this);
if (maxCombo != null && !maxCombo.isDisposed())
maxCombo.removeSelectionListener(this);
if (typeCombo != null && !typeCombo.isDisposed())
+ {
typeCombo.removeSelectionListener(this);
+ typeCombo.removeListener(SWT.Traverse, this);
+ }
if (nameText != null && !nameText.isDisposed())
removeListeners(nameText);
super.dispose();
@@ -587,5 +635,4 @@
componentNameCombo.setText(attrValue);
}
}
-
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java
index 8eef6a8..4afc257 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDSimpleTypeSection.java
@@ -156,6 +156,7 @@
typesCombo.setEditable(false);
typesCombo.setLayoutData(data);
typesCombo.addSelectionListener(this);
+ typesCombo.addListener(SWT.Traverse, this);
data = new GridData();
@@ -281,10 +282,36 @@
}
+ public void doWidgetDefaultSelected(SelectionEvent e)
+ {
+ if (e.widget == typesCombo)
+ {
+ String selection = typesCombo.getText();
+ if (shouldPerformComboSelection(SWT.DefaultSelection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
public void doWidgetSelected(SelectionEvent e)
{
if (e.widget == typesCombo)
{
+ String selection = typesCombo.getText();
+ if (shouldPerformComboSelection(SWT.Selection, selection))
+ handleWidgetSelection(e);
+ } else
+ {
+ handleWidgetSelection(e);
+ }
+ }
+
+ private void handleWidgetSelection(SelectionEvent e)
+ {
+ if (e.widget == typesCombo)
+ {
IEditorPart editor = getActiveEditor();
if (editor == null) return;
ComponentReferenceEditManager manager = (ComponentReferenceEditManager)editor.getAdapter(XSDComplexTypeBaseTypeEditManager.class);
@@ -654,6 +681,12 @@
// TODO: Common this up with element declaration
public void doHandleEvent(Event event)
{
+ if (event.type == SWT.Traverse) {
+ if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
+ isTraversing = true;
+ return;
+ }
+ }
if (event.widget == nameText)
{
if (!nameText.getEditable())
@@ -757,6 +790,11 @@
}
return null;
}
-
-
+
+ public void dispose()
+ {
+ if (typesCombo != null && !typesCombo.isDisposed())
+ typesCombo.removeListener(SWT.Traverse, this);
+ super.dispose();
+ }
}