Author: vrubezhny
Date: 2012-01-30 14:22:30 -0500 (Mon, 30 Jan 2012)
New Revision: 38292
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBPropertyLinkHyperlinkPartitioner.java
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBXMLLinkHyperlinkPartitioner.java
Log:
JBIDE-10621
Redesign HyperlinkDetector so that partitioning and hyperlinks not do twice the same job.
Hyperlinks and Hyperlink Partitioners are redesigned due to exclude duplication work on
regions calculation.
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBPropertyLinkHyperlinkPartitioner.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBPropertyLinkHyperlinkPartitioner.java 2012-01-30
19:22:08 UTC (rev 38291)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBPropertyLinkHyperlinkPartitioner.java 2012-01-30
19:22:30 UTC (rev 38292)
@@ -1,22 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2007-2012 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.esb.ui.hyperlink;
import java.util.HashSet;
import java.util.Set;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IDocument;
-
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLClassHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLLinkHyperlinkPartitioner;
@@ -27,7 +24,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author V.Kabanovich
@@ -63,15 +59,12 @@
/**
* @see
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument,
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
- IFile documentFile = smw.getFile();
- IProject project = documentFile.getProject();
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
-
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr)) return false;
Attr a = (Attr)n;
@@ -94,5 +87,4 @@
smw.dispose();
}
}
-
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBXMLLinkHyperlinkPartitioner.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBXMLLinkHyperlinkPartitioner.java 2012-01-30
19:22:08 UTC (rev 38291)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBXMLLinkHyperlinkPartitioner.java 2012-01-30
19:22:30 UTC (rev 38292)
@@ -1,22 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2007-2012 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.esb.ui.hyperlink;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IDocument;
-
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLLinkHyperlinkPartitioner;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
/**
* @author Jeremy
@@ -34,17 +30,7 @@
/**
* @see
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument,
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(document);
- try {
- IFile documentFile = smw.getFile();
- IProject project = documentFile.getProject();
-
- return true;
- } finally {
- smw.dispose();
- }
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
+ return true;
}
-
}