Author: vrubezhny
Date: 2011-03-18 13:45:44 -0400 (Fri, 18 Mar 2011)
New Revision: 29906
Added:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/GoToMatchingTagAction.java
Modified:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/pom.xml
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/AbstractMultiPageContributor.java
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/MultiPageContributor.java
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/pom.xml
branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF
branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/pom.xml
branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/JSFMultiPageContributor.java
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/pom.xml
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/META-INF/MANIFEST.MF
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/pom.xml
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesMultiPageContributor.java
Log:
JBIDE-8546
Ctrl+Shift+> Matching tag shortcut broken in JBoss Tools HTML Editor.
Issue is fixed. Fixed for 3.2.1
Modified:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF
===================================================================
---
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/META-INF/MANIFEST.MF 2011-03-18
17:45:44 UTC (rev 29906)
@@ -93,6 +93,6 @@
org.jboss.tools.common.ui,
org.eclipse.jst.standard.schemas,
org.eclipse.wst.standard.schemas
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.2.1.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: org.jboss.tools.common.model.ui.jar
Modified:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/pom.xml
===================================================================
---
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/pom.xml 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/pom.xml 2011-03-18
17:45:44 UTC (rev 29906)
@@ -8,6 +8,6 @@
</parent>
<groupId>org.jboss.tools.common</groupId>
<artifactId>org.jboss.tools.common.model.ui</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Modified:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/AbstractMultiPageContributor.java
===================================================================
---
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/AbstractMultiPageContributor.java 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/AbstractMultiPageContributor.java 2011-03-18
17:45:44 UTC (rev 29906)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.model.ui.texteditors;
@@ -31,9 +31,11 @@
import org.eclipse.jface.text.ITextOperationTarget;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.jboss.tools.common.text.xml.ui.TextEditorMessages;
+import org.jboss.tools.common.text.xml.xpl.GoToMatchingTagAction;
public abstract class AbstractMultiPageContributor extends
MultiPageEditorActionBarContributor {
-
+ protected static final String GO_TO_MATCHING_TAG_ID =
"org.eclipse.wst.xml.ui.gotoMatchingTag"; //$NON-NLS-1$
+
/** The global actions to be connected with editor actions */
protected final static String[] ACTIONS= {
ITextEditorActionConstants.UNDO,
@@ -96,7 +98,8 @@
protected RetargetTextEditorAction fContentAssistTip;
protected TextEditorAction fToggleOccurencesMarkUp;
-
+ protected GoToMatchingTagAction fGoToMatchingTagAction;
+
public AbstractMultiPageContributor() {
super();
createAssistObjects();
Modified:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/MultiPageContributor.java
===================================================================
---
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/MultiPageContributor.java 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/MultiPageContributor.java 2011-03-18
17:45:44 UTC (rev 29906)
@@ -1,15 +1,17 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.model.ui.texteditors;
+import java.util.ResourceBundle;
+
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.actions.ActionFactory;
@@ -18,6 +20,8 @@
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.jboss.tools.common.text.xml.xpl.GoToMatchingTagAction;
import org.jboss.tools.common.text.xml.xpl.ToggleOccurencesMarkUpAction;
/**
@@ -25,10 +29,17 @@
*
*/
public class MultiPageContributor extends AbstractMultiPageContributor {
+ private static final String GO_TO_MATCHING_TAG_ID =
"org.eclipse.wst.xml.ui.gotoMatchingTag"; //$NON-NLS-1$
+
protected FakeTextEditor fakeTextEditor = new FakeTextEditor();
public MultiPageContributor() {
fToggleOccurencesMarkUp = new ToggleOccurencesMarkUpAction();
+
+ ResourceBundle resourceBundle = XMLUIMessages.getResourceBundle();
+ fGoToMatchingTagAction = new GoToMatchingTagAction(resourceBundle,
"gotoMatchingTag_", null); //$NON-NLS-1$
+ fGoToMatchingTagAction.setActionDefinitionId(GO_TO_MATCHING_TAG_ID);
+ fGoToMatchingTagAction.setId(GO_TO_MATCHING_TAG_ID);
}
public void init(IActionBars bars) {
@@ -78,9 +89,16 @@
actionBars.updateActionBars();
}
- fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
+ ITextEditor textEditor = getTextEditor(part);
+
+ fToggleOccurencesMarkUp.setEditor(textEditor);
fToggleOccurencesMarkUp.update();
+ fGoToMatchingTagAction.setEditor(textEditor);
+ if (textEditor != null) {
+ textEditor.setAction(GO_TO_MATCHING_TAG_ID, fGoToMatchingTagAction);
+ }
+
updateStatus();
}
Modified:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF
===================================================================
---
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/META-INF/MANIFEST.MF 2011-03-18
17:45:44 UTC (rev 29906)
@@ -27,5 +27,5 @@
org.eclipse.core.resources,
org.eclipse.wst.xsd.ui,
org.eclipse.wst.dtd.ui
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.2.1.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/pom.xml
===================================================================
---
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/pom.xml 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/pom.xml 2011-03-18
17:45:44 UTC (rev 29906)
@@ -8,6 +8,6 @@
</parent>
<groupId>org.jboss.tools.common</groupId>
<artifactId>org.jboss.tools.common.text.xml</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Added:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/GoToMatchingTagAction.java
===================================================================
---
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/GoToMatchingTagAction.java
(rev 0)
+++
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/GoToMatchingTagAction.java 2011-03-18
17:45:44 UTC (rev 29906)
@@ -0,0 +1,301 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 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
+ *******************************************************************************/
+
+package org.jboss.tools.common.text.xml.xpl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IAnnotationModelExtension;
+import org.eclipse.jface.viewers.IPostSelectionProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.TextEditorAction;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Node;
+
+/**
+ * Moves the cursor to the end tag if it is in a start tag, and vice versa.
+ * Also updates the matching tag annotation in the active editor.
+ *
+ * @author nitin
+ *
+ */
+public class GoToMatchingTagAction extends TextEditorAction {
+
+ private class UpdateListener implements ISelectionChangedListener {
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateFor(event.getSelection());
+ }
+ }
+
+ private static final String ANNOTATION_TYPE =
"org.eclipse.wst.xml.ui.matching.tag"; //$NON-NLS-1$
+ private ISelectionChangedListener fUpdateListener = null;
+ static final boolean DEBUG = false;
+
+ /**
+ * @param bundle
+ * @param prefix
+ * @param editor
+ * @param style
+ */
+ public GoToMatchingTagAction(ResourceBundle bundle, String prefix, ITextEditor editor)
{
+ super(bundle, prefix, editor);
+ fUpdateListener = new UpdateListener();
+ }
+
+ void removeAnnotation(boolean allMatching) {
+ ITextEditor textEditor = getTextEditor();
+ if (textEditor == null) {
+ if (DEBUG) {
+ System.out.println("no editor"); //$NON-NLS-1$
+ }
+ return;
+ }
+ IDocumentProvider documentProvider = textEditor.getDocumentProvider();
+ if (documentProvider == null) {
+ if (DEBUG) {
+ System.out.println("no document provider"); //$NON-NLS-1$
+ }
+ return;
+ }
+ IAnnotationModel annotationModel =
documentProvider.getAnnotationModel(textEditor.getEditorInput());
+ if (annotationModel == null) {
+ if (DEBUG) {
+ System.out.println("no annotation model"); //$NON-NLS-1$
+ }
+ return;
+ }
+
+ Iterator annotationIterator = annotationModel.getAnnotationIterator();
+ List oldAnnotations = new ArrayList();
+ while (annotationIterator.hasNext()) {
+ Annotation annotation = (Annotation) annotationIterator.next();
+ if (ANNOTATION_TYPE.equals(annotation.getType())) {
+ annotation.markDeleted(true);
+ /**
+ * Sometimes it is supported, sometime's it is not. Confusing.
+ */
+ try {
+ annotationIterator.remove();
+ }
+ catch (UnsupportedOperationException e) {
+ oldAnnotations.add(annotation);
+ }
+ if (DEBUG) {
+ System.out.println("removed " + annotation); //$NON-NLS-1$
+ }
+ if (!allMatching)
+ break;
+ }
+ }
+ if (!oldAnnotations.isEmpty()) {
+ int size = oldAnnotations.size();
+ for (int i = 0; i < size; i++) {
+ annotationModel.removeAnnotation((Annotation) oldAnnotations.get(i));
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
+ */
+ public void runWithEvent(Event event) {
+ super.runWithEvent(event);
+ if (getTextEditor() == null)
+ return;
+
+ ISelection selection = getTextEditor().getSelectionProvider().getSelection();
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection
&& selection instanceof ITextSelection) {
+ Object o = ((IStructuredSelection) selection).getFirstElement();
+ if (o instanceof IDOMNode) {
+ int offset = ((ITextSelection) selection).getOffset();
+ IStructuredDocumentRegion matchRegion = null;
+ if (((Node) o).getNodeType() == Node.ATTRIBUTE_NODE) {
+ o = ((Attr) o).getOwnerElement();
+ }
+
+ int targetOffset = -1;
+ if (o instanceof IDOMNode) {
+ IDOMNode node = (IDOMNode) o;
+ IStructuredDocumentRegion startStructuredDocumentRegion =
node.getStartStructuredDocumentRegion();
+ if (startStructuredDocumentRegion != null &&
startStructuredDocumentRegion.containsOffset(offset)) {
+ matchRegion = ((IDOMNode) o).getEndStructuredDocumentRegion();
+ if (matchRegion != null)
+ targetOffset = matchRegion.getStartOffset() + 2;
+ }
+ else {
+ IStructuredDocumentRegion endStructuredDocumentRegion =
node.getEndStructuredDocumentRegion();
+ if (endStructuredDocumentRegion != null &&
endStructuredDocumentRegion.containsOffset(offset)) {
+ matchRegion = ((IDOMNode) o).getStartStructuredDocumentRegion();
+ if (matchRegion != null)
+ targetOffset = matchRegion.getStartOffset() + 1;
+ }
+ }
+ }
+
+ if (targetOffset >= 0) {
+ getTextEditor().getSelectionProvider().setSelection(new TextSelection(targetOffset,
0));
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.eclipse.ui.texteditor.TextEditorAction#setEditor(org.eclipse.ui.texteditor.ITextEditor)
+ */
+ public void setEditor(ITextEditor editor) {
+ ITextEditor textEditor = getTextEditor();
+ if (textEditor != null) {
+ removeAnnotation(true);
+
+ ISelectionProvider selectionProvider = textEditor.getSelectionProvider();
+ if (selectionProvider instanceof IPostSelectionProvider) {
+ ((IPostSelectionProvider)
selectionProvider).removePostSelectionChangedListener(fUpdateListener);
+ }
+ }
+ super.setEditor(editor);
+ if (editor != null) {
+ ISelectionProvider selectionProvider = editor.getSelectionProvider();
+ if (selectionProvider instanceof IPostSelectionProvider) {
+ ((IPostSelectionProvider)
selectionProvider).addPostSelectionChangedListener(fUpdateListener);
+ }
+
+ updateFor(selectionProvider.getSelection());
+ }
+ }
+
+ public void update() {
+ setEnabled(true);
+
+ }
+
+ void updateFor(ISelection selection) {
+ ITextEditor textEditor = getTextEditor();
+ if (textEditor == null) {
+ if (DEBUG) {
+ System.out.println("no editor"); //$NON-NLS-1$
+ }
+ return;
+ }
+ IDocumentProvider documentProvider = textEditor.getDocumentProvider();
+ if (documentProvider == null) {
+ if (DEBUG) {
+ System.out.println("no document provider"); //$NON-NLS-1$
+ }
+ return;
+ }
+ IAnnotationModel annotationModel =
documentProvider.getAnnotationModel(textEditor.getEditorInput());
+ if (annotationModel == null || !(annotationModel instanceof IAnnotationModelExtension))
{
+ if (DEBUG) {
+ System.out.println("no annotation model"); //$NON-NLS-1$
+ }
+ return;
+ }
+
+ List oldAnnotations = new ArrayList(2);
+ Iterator annotationIterator = annotationModel.getAnnotationIterator();
+ while (annotationIterator.hasNext()) {
+ Annotation annotation = (Annotation) annotationIterator.next();
+ if (ANNOTATION_TYPE.equals(annotation.getType())) {
+ annotation.markDeleted(true);
+ if (DEBUG) {
+ System.out.println("removing " + annotation); //$NON-NLS-1$
+ }
+ oldAnnotations.add(annotation);
+ }
+ }
+
+ Map newAnnotations = new HashMap();
+ if (!selection.isEmpty() && selection instanceof IStructuredSelection
&& selection instanceof ITextSelection) {
+ Object o = ((IStructuredSelection) selection).getFirstElement();
+ if (o instanceof IDOMNode) {
+ int offset = ((ITextSelection) selection).getOffset();
+ IStructuredDocumentRegion matchRegion = null;
+ if (((Node) o).getNodeType() == Node.ATTRIBUTE_NODE) {
+ o = ((Attr) o).getOwnerElement();
+ }
+
+ Position pStart = null;
+ Position pEnd = null;
+ String tag = ""; //$NON-NLS-1$
+ if (o instanceof IDOMNode) {
+ IDOMNode node = (IDOMNode) o;
+ IStructuredDocumentRegion startStructuredDocumentRegion =
node.getStartStructuredDocumentRegion();
+ if (startStructuredDocumentRegion != null &&
startStructuredDocumentRegion.containsOffset(offset)) {
+ if (startStructuredDocumentRegion.getNumberOfRegions() > 1) {
+ ITextRegion nameRegion = startStructuredDocumentRegion.getRegions().get(1);
+ pStart = new Position(startStructuredDocumentRegion.getStartOffset(nameRegion),
nameRegion.getTextLength());
+ tag = startStructuredDocumentRegion.getText(nameRegion);
+ }
+ matchRegion = ((IDOMNode) o).getEndStructuredDocumentRegion();
+ if (matchRegion != null && matchRegion.getNumberOfRegions() > 1) {
+ ITextRegion nameRegion = matchRegion.getRegions().get(1);
+ pEnd = new Position(matchRegion.getStartOffset(nameRegion),
nameRegion.getTextLength());
+ }
+ }
+ else {
+ IStructuredDocumentRegion endStructuredDocumentRegion =
node.getEndStructuredDocumentRegion();
+ if (endStructuredDocumentRegion != null &&
endStructuredDocumentRegion.containsOffset(offset)) {
+ if (endStructuredDocumentRegion.getNumberOfRegions() > 1) {
+ ITextRegion nameRegion = endStructuredDocumentRegion.getRegions().get(1);
+ pEnd = new Position(endStructuredDocumentRegion.getStartOffset(nameRegion),
nameRegion.getTextLength());
+ tag = endStructuredDocumentRegion.getText(nameRegion);
+ }
+ matchRegion = ((IDOMNode) o).getStartStructuredDocumentRegion();
+ if (matchRegion != null && matchRegion.getNumberOfRegions() > 1) {
+ ITextRegion nameRegion = matchRegion.getRegions().get(1);
+ pStart = new Position(matchRegion.getStartOffset(nameRegion),
nameRegion.getTextLength());
+ }
+ }
+ }
+ }
+ if (pStart != null && pEnd != null) {
+ Annotation annotation = new Annotation(ANNOTATION_TYPE, false,
NLS.bind(XMLUIMessages.gotoMatchingTag_start, tag));
+ newAnnotations.put(annotation, pStart);
+ if (DEBUG) {
+ System.out.println("adding " + annotation); //$NON-NLS-1$
+ }
+ annotation = new Annotation(ANNOTATION_TYPE, false,
NLS.bind(XMLUIMessages.gotoMatchingTag_end, tag));
+ newAnnotations.put(annotation, pEnd);
+ if (DEBUG) {
+ System.out.println("adding " + annotation); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ ((IAnnotationModelExtension) annotationModel).replaceAnnotations((Annotation[])
oldAnnotations.toArray(new Annotation[oldAnnotations.size()]), newAnnotations);
+ }
+}
Property changes on:
branches/jbosstools-3.2.x/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/GoToMatchingTagAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF
===================================================================
---
branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/META-INF/MANIFEST.MF 2011-03-18
17:45:44 UTC (rev 29906)
@@ -56,7 +56,8 @@
org.eclipse.wst.html.ui;bundle-version="1.0.401",
org.eclipse.pde.ui;bundle-version="[3.6.0,4.0.0)",
org.eclipse.jst.jsf.core,
- org.eclipse.wst.common.project.facet.core
-Bundle-Version: 3.2.0.qualifier
+ org.eclipse.wst.common.project.facet.core,
+ org.eclipse.wst.xml.ui;bundle-version="1.1.103"
+Bundle-Version: 3.2.1.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/pom.xml
===================================================================
--- branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/pom.xml 2011-03-18
17:12:15 UTC (rev 29905)
+++ branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/pom.xml 2011-03-18
17:45:44 UTC (rev 29906)
@@ -8,6 +8,6 @@
</parent>
<groupId>org.jboss.tools.jsf.plugins</groupId>
<artifactId>org.jboss.tools.jsf.ui</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Modified:
branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/JSFMultiPageContributor.java
===================================================================
---
branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/JSFMultiPageContributor.java 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/JSFMultiPageContributor.java 2011-03-18
17:45:44 UTC (rev 29906)
@@ -1,17 +1,20 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.ui.action;
import java.util.Iterator;
+import java.util.ResourceBundle;
+
import org.jboss.tools.common.model.ui.texteditors.AbstractMultiPageContributor;
+import org.jboss.tools.common.text.xml.xpl.GoToMatchingTagAction;
import org.jboss.tools.common.text.xml.xpl.ToggleOccurencesMarkUpAction;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.jface.action.IAction;
@@ -24,6 +27,7 @@
import org.eclipse.ui.ide.IDEActionFactory;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
import org.jboss.tools.common.gef.action.ActionRegistrySupport;
import org.jboss.tools.jsf.ui.editor.FacesConfigGuiEditor;
import org.jboss.tools.jsf.ui.editor.actions.JSFCutRetargetAction;
@@ -32,11 +36,18 @@
* @author Jeremy
*/
public class JSFMultiPageContributor extends AbstractMultiPageContributor {
+ private static final String GO_TO_MATCHING_TAG_ID =
"org.eclipse.wst.xml.ui.gotoMatchingTag"; //$NON-NLS-1$
+
protected FakeTextEditor fakeTextEditor = new FakeTextEditor();
ActionRegistrySupport registrySupport = new ActionRegistrySupport();
public JSFMultiPageContributor() {
fToggleOccurencesMarkUp = new ToggleOccurencesMarkUpAction();
+
+ ResourceBundle resourceBundle = XMLUIMessages.getResourceBundle();
+ fGoToMatchingTagAction = new GoToMatchingTagAction(resourceBundle,
"gotoMatchingTag_", null); //$NON-NLS-1$
+ fGoToMatchingTagAction.setActionDefinitionId(GO_TO_MATCHING_TAG_ID);
+ fGoToMatchingTagAction.setId(GO_TO_MATCHING_TAG_ID);
}
public void dispose() {
@@ -119,11 +130,18 @@
actionBars.updateActionBars();
}
+ ITextEditor textEditor = getTextEditor(part);
+
if(fToggleOccurencesMarkUp != null) {
- fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
+ fToggleOccurencesMarkUp.setEditor(textEditor);
fToggleOccurencesMarkUp.update();
}
+ fGoToMatchingTagAction.setEditor(textEditor);
+ if (textEditor != null) {
+ textEditor.setAction(GO_TO_MATCHING_TAG_ID, fGoToMatchingTagAction);
+ }
+
updateStatus();
}
Modified:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
===================================================================
---
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2011-03-18
17:45:44 UTC (rev 29906)
@@ -55,5 +55,5 @@
org.eclipse.ui,
org.eclipse.jst.standard.schemas,
org.eclipse.wst.standard.schemas
-Bundle-Version: 3.2.0.qualifier
+Bundle-Version: 3.2.1.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/pom.xml
===================================================================
--- branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/pom.xml 2011-03-18
17:12:15 UTC (rev 29905)
+++ branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/pom.xml 2011-03-18
17:45:44 UTC (rev 29906)
@@ -8,6 +8,6 @@
</parent>
<groupId>org.jboss.tools.jst.plugins</groupId>
<artifactId>org.jboss.tools.jst.jsp</artifactId>
- <version>3.2.0-SNAPSHOT</version>
+ <version>3.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Modified:
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java
===================================================================
---
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageContributor.java 2011-03-18
17:45:44 UTC (rev 29906)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.jsp.jspeditor;
@@ -27,9 +27,10 @@
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.ui.texteditor.ITextEditorExtension;
import org.eclipse.ui.texteditor.RetargetTextEditorAction;
-import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.jboss.tools.common.text.xml.xpl.GoToMatchingTagAction;
import org.jboss.tools.common.text.xml.xpl.ToggleOccurencesMarkUpAction;
/**
@@ -37,9 +38,15 @@
*
*/
public class JSPMultiPageContributor extends AbstractMultiPageContributor {
+ private static final String GO_TO_MATCHING_TAG_ID =
"org.eclipse.wst.xml.ui.gotoMatchingTag"; //$NON-NLS-1$
public JSPMultiPageContributor() {
fToggleOccurencesMarkUp = new ToggleOccurencesMarkUpAction();
+
+ ResourceBundle resourceBundle = XMLUIMessages.getResourceBundle();
+ fGoToMatchingTagAction = new GoToMatchingTagAction(resourceBundle,
"gotoMatchingTag_", null); //$NON-NLS-1$
+ fGoToMatchingTagAction.setActionDefinitionId(GO_TO_MATCHING_TAG_ID);
+ fGoToMatchingTagAction.setId(GO_TO_MATCHING_TAG_ID);
}
public void init(IActionBars bars) {
@@ -176,9 +183,17 @@
cleanActionBarStatus();
actionBars.updateActionBars();
}
- fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
+
+ ITextEditor textEditor = getTextEditor(part);
+
+ fToggleOccurencesMarkUp.setEditor(textEditor);
fToggleOccurencesMarkUp.update();
+ fGoToMatchingTagAction.setEditor(textEditor);
+ if (textEditor != null) {
+ textEditor.setAction(GO_TO_MATCHING_TAG_ID, fGoToMatchingTagAction);
+ }
+
updateStatus();
}
Modified:
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/META-INF/MANIFEST.MF
===================================================================
---
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/META-INF/MANIFEST.MF 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/META-INF/MANIFEST.MF 2011-03-18
17:45:44 UTC (rev 29906)
@@ -33,6 +33,7 @@
org.eclipse.pde.ui,
org.jboss.tools.common.gef,
org.eclipse.jface.text,
- org.eclipse.core.expressions
-Bundle-Version: 3.1.0.qualifier
+ org.eclipse.core.expressions,
+ org.eclipse.wst.xml.ui;bundle-version="1.1.103"
+Bundle-Version: 3.2.1.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/pom.xml
===================================================================
---
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/pom.xml 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/pom.xml 2011-03-18
17:45:44 UTC (rev 29906)
@@ -8,6 +8,6 @@
</parent>
<groupId>org.jboss.tools.seam.plugins</groupId>
<artifactId>org.jboss.tools.seam.ui.pages</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.2.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Modified:
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesMultiPageContributor.java
===================================================================
---
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesMultiPageContributor.java 2011-03-18
17:12:15 UTC (rev 29905)
+++
branches/jbosstools-3.2.x/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesMultiPageContributor.java 2011-03-18
17:45:44 UTC (rev 29906)
@@ -1,17 +1,20 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.seam.ui.pages.editor;
import java.util.Iterator;
+import java.util.ResourceBundle;
+
import org.jboss.tools.common.model.ui.texteditors.AbstractMultiPageContributor;
+import org.jboss.tools.common.text.xml.xpl.GoToMatchingTagAction;
import org.jboss.tools.common.text.xml.xpl.ToggleOccurencesMarkUpAction;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.jface.action.IAction;
@@ -25,6 +28,7 @@
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
import org.jboss.tools.common.gef.action.ActionRegistrySupport;
/**
@@ -36,6 +40,11 @@
public PagesMultiPageContributor() {
fToggleOccurencesMarkUp = new ToggleOccurencesMarkUpAction();
+
+ ResourceBundle resourceBundle = XMLUIMessages.getResourceBundle();
+ fGoToMatchingTagAction = new GoToMatchingTagAction(resourceBundle,
"gotoMatchingTag_", null); //$NON-NLS-1$
+ fGoToMatchingTagAction.setActionDefinitionId(GO_TO_MATCHING_TAG_ID);
+ fGoToMatchingTagAction.setId(GO_TO_MATCHING_TAG_ID);
}
public void dispose() {
@@ -118,11 +127,18 @@
actionBars.updateActionBars();
}
+ ITextEditor textEditor = getTextEditor(part);
+
if(fToggleOccurencesMarkUp != null) {
- fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
+ fToggleOccurencesMarkUp.setEditor(textEditor);
fToggleOccurencesMarkUp.update();
}
+ fGoToMatchingTagAction.setEditor(textEditor);
+ if (textEditor != null) {
+ textEditor.setAction(GO_TO_MATCHING_TAG_ID, fGoToMatchingTagAction);
+ }
+
updateStatus();
}