[128290] navigation broken in the XSD editor (F3/hyperlink)
diff --git a/bundles/org.eclipse.wst.xsd.ui/plugin.xml b/bundles/org.eclipse.wst.xsd.ui/plugin.xml index a360ccf..f9e475f 100644 --- a/bundles/org.eclipse.wst.xsd.ui/plugin.xml +++ b/bundles/org.eclipse.wst.xsd.ui/plugin.xml
@@ -52,19 +52,22 @@ id="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage"> </page> </extension> -<!-- <extension point="org.eclipse.wst.sse.ui.editorConfiguration"> +<!-- <provisionalDefinition type="preferencepages" value="org.eclipse.wst.xsd.ui.internal.preferences.XSDPreferencePage" target="org.eclipse.wst.xsd.ui.internal.XSDEditor.source" /> - <sourceViewerConfiguration - class="org.eclipse.wst.xsd.ui.internal.StructuredTextViewerConfigurationXSD" +--> + <sourceViewerConfiguration + class="org.eclipse.wst.xsd.ui.internal.editor.StructuredTextViewerConfigurationXSD" target="org.eclipse.wst.xsd.core.xsdsource" /> +<!-- <contentOutlineConfiguration class="org.eclipse.wst.xsd.ui.internal.XSDContentOutlineConfiguration" target="org.eclipse.wst.xsd.core.xsdsource" /> - </extension> --> +--> + </extension> <!-- ==================================================== --> <!-- Support help on the tags -->
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/BaseHyperlinkDetector.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/BaseHyperlinkDetector.java index c81ef74..f2a74ac 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/BaseHyperlinkDetector.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/BaseHyperlinkDetector.java
@@ -245,10 +245,13 @@ int regLength = valueRegion.getTextLength(); String attValue = att.getValueRegionText(); - // Do not include quotes in attribute value region. + // Do not include quotes in attribute value region and only + // underline the actual value, not the quotes. + if (StringUtils.isQuoted(attValue)) { regLength = regLength - 2; + regOffset++; } hyperRegion = new Region(regOffset, regLength); }
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/StructuredTextViewerConfigurationXSD.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/StructuredTextViewerConfigurationXSD.java new file mode 100644 index 0000000..47649de --- /dev/null +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/editor/StructuredTextViewerConfigurationXSD.java
@@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2004, 20065 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - Initial API and implementation + * Jens Lukowski/Innoopract - initial renaming/restructuring + *******************************************************************************/ +package org.eclipse.wst.xsd.ui.internal.editor; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; +import org.eclipse.jface.text.source.ISourceViewer; +import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; +import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML; + +/** + * Configuration for editing XSD content type + */ +public class StructuredTextViewerConfigurationXSD extends StructuredTextViewerConfigurationXML { + public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { + if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED)) + return null; + + List allDetectors = new ArrayList(0); + // add XSD Hyperlink detector + allDetectors.add(new XSDHyperlinkDetector()); + + IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer); + for (int m = 0; m < superDetectors.length; m++) { + IHyperlinkDetector detector = superDetectors[m]; + if (!allDetectors.contains(detector)) { + allDetectors.add(detector); + } + } + return (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]); + } +}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java index ce8b6af..6abccf9 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java
@@ -170,6 +170,18 @@ { objects = schema.getTypeDefinitions(); } + else if (comp instanceof XSDAttributeGroupDefinition) + { + objects = schema.getAttributeGroupDefinitions(); + } + else if (comp instanceof XSDIdentityConstraintDefinition) + { + objects = schema.getIdentityConstraintDefinitions(); + } + else if (comp instanceof XSDModelGroupDefinition) + { + objects = schema.getModelGroupDefinitions(); + } if (objects != null) {