Author: scabanovich
Date: 2008-04-04 08:35:24 -0400 (Fri, 04 Apr 2008)
New Revision: 7327
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFLinkHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java
Log:
JBIDE-895
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
@@ -27,14 +28,14 @@
protected void doHyperlink(IRegion region) {
XModel xModel = getXModel();
if (xModel == null || region == null) return;
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
+ region = JSPBeanHyperlinkPartitioner.getRegionPart(getDocument(), region.getOffset());
try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
- region = JSPBeanHyperlinkPartitioner.getRegionPart(getDocument(),
region.getOffset());
if(region == null) return;
String beanName = getDocument().get(region.getOffset(), region.getLength());
if(beanName == null) return;
provider.getList(xModel, WebPromptingProvider.JSF_BEAN_OPEN, beanName, null);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,9 +12,11 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
@@ -39,17 +41,17 @@
IFile fileToOpen = getFileToOpen(fileName, "properties");
IWorkbenchPage workbenchPage =
JSFExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(workbenchPage,fileToOpen,true);
- } catch (Exception x) {
+ } catch (CoreException x) {
// could not open editor
openFileFailed();
}
}
private String getBundleBasename(IRegion region) {
- if(region == null) return null;
+ if(region == null || getDocument() == null) return null;
try {
return getDocument().get(region.getOffset(), region.getLength());
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -72,7 +74,7 @@
if(file != null && file.exists()) return file;
}
return null;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -83,18 +85,13 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
private IRegion getRegion(int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -154,7 +151,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import java.util.*;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IEditorPart;
import org.w3c.dom.Attr;
@@ -37,6 +38,7 @@
public class BundleHyperlink extends XModelBasedHyperlink {
private String getBundleProperty(IRegion region) {
+ if(getDocument() == null) return null;
try {
String fullText = getDocument().get(region.getOffset(), region.getLength());
@@ -69,7 +71,7 @@
sProp = Utils.trimQuotes(fullText.substring(startProp, endProp));
}
return sProp;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -78,8 +80,8 @@
private String getBundleBasename(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -116,7 +118,7 @@
if(list2 == null || list2.size() < 1) return null;
Map map = (Map)list2.get(0);
return (String)map.get(bundleVar);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -188,9 +190,6 @@
String locale =
Utils.trimQuotes((jsfCoreViewTag.getAttributeNode(LOCALE_ATTRNAME)).getValue());
if (locale == null || locale.length() == 0) return null;
return locale;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -68,8 +68,8 @@
private IRegion getRegion(int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -129,7 +129,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -36,24 +36,19 @@
* @see
com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
-
- try {
- String forID = getForId(region);
- IRegion elementByID = findElementByID(forID);
- if (elementByID != null) {
- StructuredSelectionHelper.setSelectionAndRevealInActiveEditor(elementByID);
- } else {
- openFileFailed();
- }
- } catch (Exception x) {
+ String forID = getForId(region);
+ IRegion elementByID = findElementByID(forID);
+ if (elementByID != null) {
+ StructuredSelectionHelper.setSelectionAndRevealInActiveEditor(elementByID);
+ } else {
openFileFailed();
}
}
private IRegion findElementByID (String id) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -85,9 +80,6 @@
};
}
return null;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -221,7 +213,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,11 +10,11 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
-import java.io.FileNotFoundException;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
@@ -32,26 +32,25 @@
* @see
com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
-
- try {
- String fileName = getFilePath(region);
- IFile fileToOpen = getFileToOpen(fileName);
- if (fileToOpen.exists()) {
- IWorkbenchPage workbenchPage =
JSFExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ String fileName = getFilePath(region);
+ IFile fileToOpen = getFileToOpen(fileName);
+ if (fileToOpen.exists()) {
+ IWorkbenchPage workbenchPage =
JSFExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
IDE.openEditor(workbenchPage,fileToOpen,true);
- } else {
- throw new FileNotFoundException((fileToOpen == null ? "" :
fileToOpen.toString()));
+ } catch (CoreException e) {
+ openFileFailed();
}
- } catch (Exception x) {
- // could not open editor
+ } else {
openFileFailed();
}
}
private String getFilePath(IRegion region) {
+ if(getDocument() == null || region == null) return null;
try {
return getDocument().get(region.getOffset(), region.getLength());
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -61,29 +60,19 @@
private IFile getFileToOpen(String fileName) {
IFile documentFile = getFile();
XModel xModel = getXModel(documentFile);
- try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
- if (xModel != null) {
- List list = provider.getList(xModel, WebPromptingProvider.JSF_GET_PATH, fileName,
null);
- if (list != null && list.size() > 0) {
- for (Iterator i = list.iterator(); i.hasNext();) {
- Object o = i.next();
- if (o instanceof String) {
- fileName = (String)o;
- break;
- }
+ if (xModel != null) {
+ List<Object> list = WebPromptingProvider.getInstance().getList(xModel,
WebPromptingProvider.JSF_GET_PATH, fileName, null);
+ if (list != null && list.size() > 0) {
+ for (Object o: list) {
+ if (o instanceof String) {
+ fileName = (String)o;
+ break;
}
}
}
- // End of Slava's magic
- return super.getFileFromProject(fileName);
-
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
}
-
+ // End of Slava's magic
+ return super.getFileFromProject(fileName);
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Document;
@@ -27,8 +28,8 @@
public class JSFContextParamLinkHyperlink extends JSFLinkHyperlink {
protected IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -99,7 +100,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.jboss.tools.jsf.project.JSFNature;
@@ -39,8 +40,8 @@
*/
protected boolean recognizeNature(IDocument document) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
@@ -49,7 +50,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFLinkHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFLinkHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFLinkHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -21,7 +21,6 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.ext.hyperlink.LinkHyperlink;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
/**
@@ -52,14 +51,10 @@
protected IFile getFileFromProject(String fileName) {
IFile documentFile = getFile();
+ if(documentFile == null) return null;
- try {
- IProject project = documentFile.getProject();
- return super.getFileFromProject(updateFilenameForModel(fileName, project));
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ IProject project = documentFile.getProject();
+ return super.getFileFromProject(updateFilenameForModel(fileName, project));
}
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Document;
@@ -49,17 +51,18 @@
*/
protected boolean recognizeNature(IDocument document) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
+ if(project == null || !project.isAccessible()) return false;
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
if (project.getNature(JSF_PROJECT_NATURES[i]) != null)
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -81,8 +84,8 @@
return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -111,7 +114,6 @@
if (paramNameNode == null) return false;
String paramNameValue = null;
- try {
NodeList list = paramNameNode.getChildNodes();
for (int i = 0; paramNameValue == null && list != null && i <
list.getLength(); i++) {
if (list.item(i) instanceof Text) {
@@ -126,17 +128,13 @@
}
}
}
- }
- catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- }
if (paramNameValue == null) return false;
for (int i = 0; i < VALID_CONTEXT_PARAM_NAMES.length; i++) {
if (VALID_CONTEXT_PARAM_NAMES[i].equals(paramNameValue))
return true;
}
return false;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.jboss.tools.jsf.project.JSFNature;
@@ -43,16 +44,17 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
+ if(project == null || !project.isAccessible()) return false;
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
if (project.getNature(JSF_PROJECT_NATURES[i]) != null)
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -13,6 +13,7 @@
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -42,8 +43,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -62,9 +63,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -120,7 +118,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -129,12 +127,14 @@
}
public static IHyperlinkRegion getRegionPart(IDocument document, final int offset) {
+ if(document == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
+
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
-
+
Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
@@ -142,6 +142,7 @@
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
if(start < 0 || start > end || start > offset) return null;
+
String attrText = document.get(start, end - start);
StringBuffer sb = new StringBuffer(attrText);
@@ -172,7 +173,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -225,7 +226,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -238,8 +239,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -271,7 +272,7 @@
if (beanName == null) return false;
return true;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -279,4 +280,4 @@
}
}
-}
\ No newline at end of file
+}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -42,8 +43,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -60,9 +61,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -77,8 +75,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -122,7 +120,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -136,8 +134,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -214,7 +212,7 @@
if (lbTag == null) return false;
return true;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -33,9 +34,11 @@
* @see
com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument,
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ if(document == null || superRegion == null) return null;
+
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -51,9 +54,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -107,7 +107,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -33,9 +34,11 @@
* @see
com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument,
com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ if(document == null || superRegion == null) return null;
+
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -51,9 +54,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -68,8 +68,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -107,7 +107,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -24,7 +24,6 @@
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
/**
* @author Jeremy
@@ -41,8 +40,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -60,9 +59,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -78,8 +74,8 @@
private IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -122,9 +118,6 @@
}
}
return null;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -136,18 +129,16 @@
* @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) {
+ if(document == null || region == null) return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
Utils.findNodeForOffset(xmlDocument, region.getOffset());
return (getRegion(document, region.getOffset()) != null);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
@@ -35,8 +36,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -52,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -69,8 +67,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -109,7 +107,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
@@ -37,8 +38,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -54,9 +55,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -71,8 +69,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -111,7 +109,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -125,8 +123,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -162,9 +160,6 @@
lbTagBasename.getNodeValue().trim().length() == 0) return false;
return true;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -37,8 +38,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -56,9 +57,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -116,7 +114,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -130,8 +128,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -167,9 +165,6 @@
lbTagBasename.getNodeValue().trim().length() == 0) return false;
return true;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
@@ -35,8 +36,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -52,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -109,7 +107,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
@@ -35,8 +36,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -52,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -127,7 +125,8 @@
}
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
+ JSFExtensionsPlugin.log(x);
return null;
} finally {
smw.dispose();
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -14,7 +14,7 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -42,23 +42,17 @@
IFile documentFile = getFile();
XModel xModel = getXModel(documentFile);
if (xModel == null) return;
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
- try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
- Properties p = getRequestProperties(region);
- p.put(WebPromptingProvider.FILE, documentFile);
-
- List list = provider.getList(xModel, WebPromptingProvider.JSF_OPEN_TAG_LIBRARY,
p.getProperty("prefix"), p);
- if (list != null && list.size() >= 1) {
- openFileInEditor((String)list.get(0));
- return;
- }
- String error = p.getProperty(WebPromptingProvider.ERROR);
- if ( error != null && error.length() > 0) {
- openFileFailed();
- }
- } catch (Exception x) {
+ Properties p = getRequestProperties(region);
+ p.put(WebPromptingProvider.FILE, documentFile);
+ List<Object> list = provider.getList(xModel,
WebPromptingProvider.JSF_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
+ if (list != null && list.size() >= 1) {
+ openFileInEditor((String)list.get(0));
+ return;
+ }
+ String error = p.getProperty(WebPromptingProvider.ERROR);
+ if ( error != null && error.length() > 0) {
openFileFailed();
}
}
@@ -85,8 +79,8 @@
private String getURI(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -111,18 +105,16 @@
if (!tmw.exists()) return null;
return tmw.getUri(nodePrefix);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("Error while getting uri from region", x);
- return null;
} finally {
smw.dispose();
}
}
private String getTagName(IRegion region) {
+ if(region == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -139,9 +131,6 @@
if (tagName.indexOf(':') == -1) return null;
return tagName.substring(tagName.indexOf(':') + 1);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -151,18 +140,14 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
private String getTagAttributeName(IRegion region) {
+ if(region == null || getDocument() == null) return null;
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -171,8 +156,8 @@
protected IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -232,7 +217,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -240,14 +225,4 @@
}
}
- protected String getAttributeValue (IDocument document, Node node, String attrName) {
- try {
- Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
- return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
- }
-
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
@@ -45,12 +47,12 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
IRegion r = getRegion(document, superRegion.getOffset());
if (r == null) return null;
@@ -62,9 +64,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -81,11 +80,12 @@
IProject project = documentFile.getProject();
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
+ if(!project.isAccessible()) return false;
if (project.getNature(JSF_PROJECT_NATURES[i]) != null)
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -95,8 +95,8 @@
protected IRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -159,7 +159,7 @@
}
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -15,6 +15,7 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
@@ -43,22 +44,18 @@
IFile documentFile = getFile();
XModel xModel = getXModel(documentFile);
if (xModel == null) return;
- try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
- Properties p = getRequestProperties(region);
- p.put(WebPromptingProvider.FILE, documentFile);
+ Properties p = getRequestProperties(region);
+ p.put(WebPromptingProvider.FILE, documentFile);
- List list = provider.getList(xModel, WebPromptingProvider.JSF_OPEN_TAG_LIBRARY,
p.getProperty("prefix"), p);
- if (list != null && list.size() >= 1) {
- openFileInEditor((String)list.get(0));
- return;
- }
- String error = p.getProperty(WebPromptingProvider.ERROR);
- if ( error != null && error.length() > 0) {
- openFileFailed();
- }
- } catch (Exception x) {
+ List<Object> list = provider.getList(xModel,
WebPromptingProvider.JSF_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
+ if (list != null && list.size() >= 1) {
+ openFileInEditor((String)list.get(0));
+ return;
+ }
+ String error = p.getProperty(WebPromptingProvider.ERROR);
+ if ( error != null && error.length() > 0) {
openFileFailed();
}
}
@@ -81,8 +78,8 @@
private String getURI(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -102,9 +99,6 @@
Map trackers = JSPRootHyperlinkPartitioner.getTrackersMap(getDocument(),
region.getOffset());
return (String)(trackers == null ? null : trackers.get(nodePrefix));
- } catch (Exception x) {
- JSFExtensionsPlugin.log("Error while getting uri from region", x);
- return null;
} finally {
smw.dispose();
}
@@ -112,8 +106,8 @@
private String getTagName(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -127,9 +121,6 @@
if (tagName.indexOf(':') == -1) return null;
return tagName.substring(tagName.indexOf(':') + 1);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -139,18 +130,13 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
protected IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -191,22 +177,9 @@
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
}
- protected String getAttributeValue (IDocument document, Node node, String attrName) {
- try {
- Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
- return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
- }
-
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
@@ -43,8 +44,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -60,9 +61,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -73,8 +71,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
@@ -82,7 +80,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -92,8 +90,8 @@
protected IRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -134,9 +132,6 @@
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -39,8 +39,8 @@
protected Properties getRequestProperties(IRegion region) {
Properties p = new Properties();
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -67,8 +67,6 @@
}
}
}
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
} finally {
smw.dispose();
}
@@ -78,8 +76,8 @@
protected IRegion getRegion(final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -114,9 +112,6 @@
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("Error while getting region", x);
- return null;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
@@ -49,8 +50,8 @@
return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -61,9 +62,6 @@
Element rootElem = xmlnsAttr.getOwnerElement();
if (!rootElem.getNodeName().equals("jsp:root")) return false;
return true;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
@@ -84,7 +82,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -128,9 +126,6 @@
}
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,7 +12,6 @@
import java.util.Properties;
-import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -21,7 +20,6 @@
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.common.text.ext.hyperlink.XModelBasedHyperlink;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
/**
@@ -37,8 +35,8 @@
protected Properties getRequestProperties(IRegion region) {
Properties p = new Properties();
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -49,12 +47,10 @@
Node node = n;
- String uri = getAttributeValue(getDocument(), node, "uri");
+ String uri = Utils.getAttributeValue(getDocument(), node, "uri");
if (uri != null) {
p.setProperty("prefix", uri);
}
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
} finally {
smw.dispose();
}
@@ -62,20 +58,10 @@
return p;
}
- private String getAttributeValue (IDocument document, Node node, String attrName) {
- try {
- Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
- return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
- }
-
protected IRegion getRegion(final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -112,9 +98,6 @@
}
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
@@ -54,8 +55,8 @@
return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -67,9 +68,6 @@
if(propStart < 0) return false;
return true;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
@@ -80,17 +78,18 @@
*/
protected boolean recognizeNature(IDocument document) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
+ if(project == null || !project.isAccessible()) return false;
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
if (project.getNature(JSF_PROJECT_NATURES[i]) != null)
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -100,8 +99,8 @@
public IRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -135,9 +134,6 @@
}
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -22,7 +22,6 @@
import org.jboss.tools.common.text.ext.util.TaglibManagerWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.common.text.ext.hyperlink.XModelBasedHyperlink;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
/**
@@ -52,8 +51,8 @@
private String getBundleBasename(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -67,9 +66,6 @@
lbTagBasename.getNodeValue().trim().length() == 0) return null;
return lbTagBasename.getNodeValue();
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -80,6 +76,8 @@
private static final String PREFIX_SEPARATOR = ":";
private String getPageLocale(IRegion region) {
+ if(getDocument() == null || region == null) return null;
+
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
TaglibManagerWrapper tmw = new TaglibManagerWrapper();
@@ -117,9 +115,6 @@
String locale =
Utils.trimQuotes(((Attr)jsfCoreViewTag.getAttributeNode(LOCALE_ATTRNAME)).getValue());
if (locale == null || locale.length() == 0) return null;
return locale;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -13,6 +13,7 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
@@ -28,19 +29,20 @@
* @see
com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
+ if(region == null) return;
IFile file = getFile();
XModel xModel = getXModel(file);
if (xModel == null) return;
try {
WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
region = JSPNavigationCaseHyperlinkPartitioner.getRegion(getDocument(),
region.getOffset());
+ if(region == null) return;
String beanName = getDocument().get(region.getOffset(), region.getLength());
Properties p = new Properties();
p.put(WebPromptingProvider.FILE, file);
provider.getList(xModel, WebPromptingProvider.JSF_OPEN_ACTION, beanName, p);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -39,23 +40,18 @@
XModel xModel = getXModel();
if (xModel == null) return;
- try {
- String propertyName = getPropertyName(region);
- String beanClassName = getBeanClassName(region);
+ String propertyName = getPropertyName(region);
+ String beanClassName = getBeanClassName(region);
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
- Properties p = new Properties();
- p.setProperty("ignoreWarning", "true");
- p.setProperty("property", propertyName);
- beanClassName = beanClassName.replace('.', '/') + ".class";
+ Properties p = new Properties();
+ p.setProperty("ignoreWarning", "true");
+ p.setProperty("property", propertyName);
+ beanClassName = beanClassName.replace('.', '/') + ".class";
- provider.getList(xModel, WebPromptingProvider.JSF_OPEN_CLASS_PROPERTY, beanClassName,
p);
- String error = p.getProperty(WebPromptingProvider.ERROR);
- if ( error != null && error.length() > 0) {
- openFileFailed();
- }
- } catch (Exception x) {
+ provider.getList(xModel, WebPromptingProvider.JSF_OPEN_CLASS_PROPERTY, beanClassName,
p);
+ String error = p.getProperty(WebPromptingProvider.ERROR);
+ if ( error != null && error.length() > 0) {
openFileFailed();
}
}
@@ -64,18 +60,14 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
private String getPropertyName(IRegion region) {
+ if(getDocument() == null || region == null) return null;
try {
return trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -83,8 +75,8 @@
private String getBeanClassName(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -122,7 +114,7 @@
beanClassName = trimQuotes(beanClassName);
return (beanClassName.length() == 0 ? null : beanClassName);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -132,8 +124,8 @@
private IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -193,7 +185,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -202,29 +194,23 @@
}
private String trimQuotes(String word) {
- try {
- String attrText = word;
- int bStart = 0;
- int bEnd = word.length() - 1;
- StringBuffer sb = new StringBuffer(attrText);
-
+ String attrText = word;
+ int bStart = 0;
+ int bEnd = word.length() - 1;
+ StringBuffer sb = new StringBuffer(attrText);
//find start and end of path property
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
- bStart++;
- }
- while (bEnd > bStart &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
- bEnd--;
- }
- bEnd++;
- return sb.substring(bStart, bEnd);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return word;
- }
+ while (bStart < bEnd &&
+ (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
+ Character.isWhitespace(sb.charAt(bStart)))) {
+ bStart++;
+ }
+ while (bEnd > bStart &&
+ (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
+ Character.isWhitespace(sb.charAt(bEnd)))) {
+ bEnd--;
+ }
+ bEnd++;
+ return sb.substring(bStart, bEnd);
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -34,6 +35,7 @@
* @see
com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
+ if(getDocument() == null || region == null) return;
XModel xModel = getXModel();
if (xModel == null) return;
try {
@@ -49,7 +51,7 @@
openFileFailed();
}
- } catch (Exception x) {
+ } catch (BadLocationException x) {
openFileFailed();
}
}
@@ -58,18 +60,13 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
private IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -129,7 +126,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -138,29 +135,23 @@
}
private String trimQuotes(String word) {
- try {
- String attrText = word;
- int bStart = 0;
- int bEnd = word.length() - 1;
- StringBuffer sb = new StringBuffer(attrText);
-
- //find start and end of path property
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
- bStart++;
- }
- while (bEnd > bStart &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
- bEnd--;
- }
- bEnd++;
- return sb.substring(bStart, bEnd);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return word;
- }
+ String attrText = word;
+ int bStart = 0;
+ int bEnd = word.length() - 1;
+ StringBuffer sb = new StringBuffer(attrText);
+ //find start and end of path property
+ while (bStart < bEnd &&
+ (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
+ Character.isWhitespace(sb.charAt(bStart)))) {
+ bStart++;
+ }
+ while (bEnd > bStart &&
+ (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
+ Character.isWhitespace(sb.charAt(bEnd)))) {
+ bEnd--;
+ }
+ bEnd++;
+ return sb.substring(bStart, bEnd);
}
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -13,6 +13,7 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -35,14 +36,15 @@
* @see
com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
+ if(region == null) return;
IFile file = getFile();
XModel xModel = getXModel(file);
if (xModel == null) return;
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
region = getRegion(region.getOffset());
+ if(region == null) return;
String validatorID = getDocument().get(region.getOffset(), region.getLength());
Properties p = new Properties();
p.put(WebPromptingProvider.FILE, file);
@@ -51,7 +53,7 @@
if ( error != null && error.length() > 0) {
openFileFailed();
}
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
}
}
@@ -127,7 +129,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -33,8 +34,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -50,9 +51,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -60,17 +58,14 @@
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
return Utils.getParentAxisForNode(xmlDocument, n);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -114,7 +109,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -33,8 +34,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -50,9 +51,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -60,17 +58,14 @@
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
return Utils.getParentAxisForNode(xmlDocument, n);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -112,7 +107,7 @@
if (propStart > offset || propStart + propLength < offset) return null;
return new HyperlinkRegion(propStart, propLength, null, null, null);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
@@ -35,8 +36,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -52,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -62,17 +60,14 @@
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if(xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
return Utils.getParentAxisForNode(xmlDocument, n);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -80,8 +75,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -118,7 +113,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java 2008-04-04
12:33:45 UTC (rev 7326)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java 2008-04-04
12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -34,8 +35,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -51,9 +52,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType,
type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -61,16 +59,11 @@
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
-
Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
-
return Utils.getParentAxisForNode(xmlDocument, n);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -116,7 +109,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null,
null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {