jh: apply patch for fix to copy/paste of HTML from pub site
diff --git a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
index c6711b1..dae071d 100644
--- a/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
+++ b/1.5/plugins/org.eclipse.epf.library/src/org/eclipse/epf/library/util/ResourceHelper.java
@@ -1804,6 +1804,41 @@
+ discardedElementURL.toString();
}
+ /**
+ * FOR USE WITH RICH TEXT EDITOR
+ * check whether the url represents a valid element
+ *
+ * @param url
+ * String, the url to be analysed
+ * @return boolean true if it's a valid element of opening method library
+ */
+ public static boolean isLocalElement(String url)
+ {
+ Matcher m = p_link_ref.matcher(url);
+ while (m.find()) {
+ //1. get guid
+ String urltext = m.group(1);
+ Matcher m2 = p_tag_attributes.matcher(urltext);
+ while (m2.find()) {
+ String attrName = m2.group(1).trim().toLowerCase();
+ String attrValue = ""; //$NON-NLS-1$
+ if (m2.group(3) != null) {
+ attrValue = m2.group(3).trim();
+ } else if (m2.group(2) != null) {
+ attrValue = m2.group(2).trim();
+ }
+ if (attrName.equals(LinkInfo.LINK_ATTR_GUID)) {
+ //2. get method element
+ MethodElement e = LinkInfo.getMethodElement(attrValue);
+ if ( null != e)
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
/**
diff --git a/1.5/plugins/org.eclipse.epf.richtext/META-INF/MANIFEST.MF b/1.5/plugins/org.eclipse.epf.richtext/META-INF/MANIFEST.MF
index 068bea4..e462839 100644
--- a/1.5/plugins/org.eclipse.epf.richtext/META-INF/MANIFEST.MF
+++ b/1.5/plugins/org.eclipse.epf.richtext/META-INF/MANIFEST.MF
@@ -12,7 +12,8 @@
org.eclipse.ui.forms;visibility:=reexport,
org.eclipse.jface.text;visibility:=reexport,
org.eclipse.ui.workbench.texteditor;visibility:=reexport,
- org.eclipse.epf.common.ui;visibility:=reexport
+ org.eclipse.epf.common.ui;visibility:=reexport,
+ org.eclipse.epf.library
Eclipse-LazyStart: true
Export-Package: org.eclipse.epf.richtext,
org.eclipse.epf.richtext.actions,
diff --git a/1.5/plugins/org.eclipse.epf.richtext/src/org/eclipse/epf/richtext/actions/PasteAction.java b/1.5/plugins/org.eclipse.epf.richtext/src/org/eclipse/epf/richtext/actions/PasteAction.java
index 5918dfd..eb5d5a6 100644
--- a/1.5/plugins/org.eclipse.epf.richtext/src/org/eclipse/epf/richtext/actions/PasteAction.java
+++ b/1.5/plugins/org.eclipse.epf.richtext/src/org/eclipse/epf/richtext/actions/PasteAction.java
@@ -20,6 +20,7 @@
import org.eclipse.epf.common.ui.util.ClipboardUtil;
import org.eclipse.epf.common.utils.FileUtil;
import org.eclipse.epf.common.utils.NetUtil;
+import org.eclipse.epf.library.util.ResourceHelper;
import org.eclipse.epf.richtext.IRichText;
import org.eclipse.epf.richtext.RichTextCommand;
import org.eclipse.epf.richtext.RichTextEditor;
@@ -121,9 +122,19 @@
sourceURL = new URL(sourceURLStr);
}
- Matcher matcher = HREF_REFERENCES.matcher(html);
+ Matcher matcher = ResourceHelper.p_link_ref.matcher(html);
+ Matcher hrefMatcher;
while (matcher.find()) {
- String href = NetUtil.decodeURL(matcher.group(1));
+ String link = matcher.group();
+ if ( ResourceHelper.isLocalElement(link) )
+ {
+ continue;
+ }
+
+ hrefMatcher = HREF_REFERENCES.matcher(link);
+ if ( hrefMatcher.find())
+ {
+ String href = NetUtil.decodeURL(hrefMatcher.group(1));
try {
URL hrefURL = new URL(sourceURL, href);
String scheme = hrefURL.getProtocol();
@@ -151,7 +162,7 @@
logger.logError(e);
}
}
-
+ }
matcher = p_image_ref.matcher(html);
while (matcher.find()) {
String src = NetUtil.decodeURL(matcher.group(3));