JBoss Tools SVN: r7503 - trunk/seam/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: tromanovich
Date: 2008-04-11 13:36:04 -0400 (Fri, 11 Apr 2008)
New Revision: 7503
Modified:
trunk/seam/docs/reference/en/modules/creating_new_seam.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-140 links in docs should be relative
Updating external links between documents
Modified: trunk/seam/docs/reference/en/modules/creating_new_seam.xml
===================================================================
--- trunk/seam/docs/reference/en/modules/creating_new_seam.xml 2008-04-11 15:17:22 UTC (rev 7502)
+++ trunk/seam/docs/reference/en/modules/creating_new_seam.xml 2008-04-11 17:36:04 UTC (rev 7503)
@@ -156,7 +156,7 @@
<property>Default Configuration for jBoss 4.2 Runtime</property>
</emphasis> allows you later to specify your own set of facets for adding extra
functionality to your project. For more details about facets, see next section. Besides,
- we suggest that you look through our <ulink url="http://www.redhat.com/developer_studio/guides/as/html_single/">AS manager guide</ulink> to find out more about runtimes
+ we suggest that you look through our <ulink url="../../as/html_single/index.html">AS manager guide</ulink> to find out more about runtimes
and servers.</para>
<para>Having all necessary options arranged, click on <emphasis>
18 years
JBoss Tools SVN: r7502 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-04-11 11:17:22 -0400 (Fri, 11 Apr 2008)
New Revision: 7502
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2011 Resources with dot's are handled wrong in code completion
Proposal display strings are fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2008-04-11 14:59:58 UTC (rev 7501)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2008-04-11 15:17:22 UTC (rev 7502)
@@ -120,7 +120,7 @@
* @see org.eclipse.jface.text.contentassist.ICompletionProposal#getDisplayString()
*/
public String getDisplayString() {
- return fPrefix + fString;
+ return (fNewPrefix == null ? fPrefix : fNewPrefix) + fString;
}
/*
18 years
JBoss Tools SVN: r7501 - trunk/as/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-04-11 10:59:58 -0400 (Fri, 11 Apr 2008)
New Revision: 7501
Modified:
trunk/as/docs/reference/en/modules/quick_start.xml
trunk/as/docs/reference/en/modules/runtimes_servers.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-304 - updating screens
Modified: trunk/as/docs/reference/en/modules/quick_start.xml
===================================================================
--- trunk/as/docs/reference/en/modules/quick_start.xml 2008-04-11 14:59:42 UTC (rev 7500)
+++ trunk/as/docs/reference/en/modules/quick_start.xml 2008-04-11 14:59:58 UTC (rev 7501)
@@ -126,10 +126,19 @@
<title>Runtime and Server Sections in the New Project Wizard</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/quick_start/quick_start_4.png" scale="68"/>
+ <imagedata fileref="images/quick_start/quick_start_4a.png" scale="68"/>
</imageobject>
</mediaobject>
</figure>
+
+ <figure>
+ <title>Runtime and Server Sections in the Import Project Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/quick_start/quick_start_4b.png" scale="68"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
<para>You can deploy an existing application to a server by right-clicking the target defined
server in the <property>JBoss Servers View</property> and then selecting <property>Add and
Modified: trunk/as/docs/reference/en/modules/runtimes_servers.xml
===================================================================
--- trunk/as/docs/reference/en/modules/runtimes_servers.xml 2008-04-11 14:59:42 UTC (rev 7500)
+++ trunk/as/docs/reference/en/modules/runtimes_servers.xml 2008-04-11 14:59:58 UTC (rev 7501)
@@ -204,13 +204,24 @@
<title>Installed Server Runtime Environments</title>
<mediaobject>
<imageobject>
- <imagedata fileref="images/runtimes_servers/runtimes_servers_5.png"/>
+ <imagedata fileref="images/runtimes_servers/runtimes_servers_5a.png"/>
</imageobject>
</mediaobject>
</figure>
<para>If the server you want to create doesn't have any installed runtime yet, the combo box
- and button will disappear. The next page in the wizard which has the same form as in <link
+ and button will disappear.</para>
+
+ <figure>
+ <title>Installed Server Runtime Environments</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/runtimes_servers/runtimes_servers_5b.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>In this case the next page in the wizard which has the same form as in <link
linkend="add_runtime_figure">the previous section</link> will ask you to create the
associated runtime.</para>
<para>Either way, after targeting your server to a runtime, the final screen in this wizard is
18 years
JBoss Tools SVN: r7500 - in trunk/as/docs/reference/en/images: runtimes_servers and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-04-11 10:59:42 -0400 (Fri, 11 Apr 2008)
New Revision: 7500
Added:
trunk/as/docs/reference/en/images/quick_start/quick_start_4a.png
trunk/as/docs/reference/en/images/quick_start/quick_start_4b.png
trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_5a.png
trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_5b.png
Log:
http://jira.jboss.com/jira/browse/JBDS-304 - updating screens
Added: trunk/as/docs/reference/en/images/quick_start/quick_start_4a.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/docs/reference/en/images/quick_start/quick_start_4a.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/docs/reference/en/images/quick_start/quick_start_4b.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/docs/reference/en/images/quick_start/quick_start_4b.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_5a.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_5a.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_5b.png
===================================================================
(Binary files differ)
Property changes on: trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_5b.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
18 years
JBoss Tools SVN: r7499 - in trunk/as/docs/reference/en/images: runtimes_servers and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-04-11 10:59:06 -0400 (Fri, 11 Apr 2008)
New Revision: 7499
Modified:
trunk/as/docs/reference/en/images/quick_start/quick_start_1.png
trunk/as/docs/reference/en/images/quick_start/quick_start_2.png
trunk/as/docs/reference/en/images/quick_start/quick_start_3.png
trunk/as/docs/reference/en/images/quick_start/quick_start_5.png
trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_2.png
trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_3.png
trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_4.png
trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_6.png
trunk/as/docs/reference/en/images/webtools/webtools_2.png
trunk/as/docs/reference/en/images/webtools/webtools_3.png
trunk/as/docs/reference/en/images/webtools/webtools_4.png
trunk/as/docs/reference/en/images/webtools/webtools_5.png
Log:
http://jira.jboss.com/jira/browse/JBDS-304 - updating screens in 'modules', 'quic lstart', 'runtime-servers' , 'webtools' chapters
Modified: trunk/as/docs/reference/en/images/quick_start/quick_start_1.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/quick_start/quick_start_2.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/quick_start/quick_start_3.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/quick_start/quick_start_5.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_2.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_3.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_4.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/runtimes_servers/runtimes_servers_6.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/webtools/webtools_2.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/webtools/webtools_3.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/webtools/webtools_4.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/webtools/webtools_5.png
===================================================================
(Binary files differ)
18 years
JBoss Tools SVN: r7498 - trunk/as/docs/reference/en/images/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-04-11 10:58:13 -0400 (Fri, 11 Apr 2008)
New Revision: 7498
Modified:
trunk/as/docs/reference/en/images/modules/modules_1.png
trunk/as/docs/reference/en/images/modules/modules_3.png
trunk/as/docs/reference/en/images/modules/modules_4.png
Log:
http://jira.jboss.com/jira/browse/JBDS-304 - updating screens in 'modules', 'quic lstart', 'runtime-servers' , 'projects' chapters
Modified: trunk/as/docs/reference/en/images/modules/modules_1.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/modules/modules_3.png
===================================================================
(Binary files differ)
Modified: trunk/as/docs/reference/en/images/modules/modules_4.png
===================================================================
(Binary files differ)
18 years
JBoss Tools SVN: r7495 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-04-10 14:39:22 -0400 (Thu, 10 Apr 2008)
New Revision: 7495
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2011 Resources with dot's are handled wrong in code completion
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-04-10 18:39:14 UTC (rev 7494)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2008-04-10 18:39:22 UTC (rev 7495)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -573,7 +574,21 @@
// return all the methods + properties
for (TypeInfoCollector.MemberInfo mbr : members) {
if (mbr instanceof MessagesInfo) {
- proposals.addAll(((MessagesInfo)mbr).getKeys());
+ // Surround the "long" keys containing the dots with [' ']
+ TreeSet<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+ keys.addAll(((MessagesInfo)mbr).getKeys());
+ Iterator<String> sortedKeys = keys.iterator();
+ while(sortedKeys.hasNext()) {
+ String key = sortedKeys.next();
+ if (key == null || key.length() == 0)
+ continue;
+ if (key.indexOf('.') != -1) {
+ proposals.add("['" + key + "']");
+ } else {
+ proposals.add(key);
+ }
+ }
+// proposals.addAll(((MessagesInfo)mbr).getKeys());
continue;
}
if (mbr.getMemberType() == null) {
18 years
JBoss Tools SVN: r7494 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2008-04-10 14:39:14 -0400 (Thu, 10 Apr 2008)
New Revision: 7494
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2011 Resources with dot's are handled wrong in code completion
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2008-04-10 16:38:29 UTC (rev 7493)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/text/java/SeamELProposalProcessor.java 2008-04-10 18:39:14 UTC (rev 7494)
@@ -75,6 +75,7 @@
private final String fString;
private final String fPrefix;
+ private final String fNewPrefix;
private final int fOffset;
private final int fNewPosition;
@@ -83,8 +84,13 @@
}
public Proposal(String string, String prefix, int offset, int newPosition) {
+ this(string, prefix, prefix, offset, offset + string.length());
+ }
+
+ public Proposal(String string, String prefix, String newPrefix, int offset, int newPosition) {
fString = string;
fPrefix = prefix;
+ fNewPrefix = newPrefix;
fOffset = offset;
fNewPosition = newPosition;
}
@@ -136,8 +142,10 @@
*/
public void apply(IDocument document, char trigger, int offset) {
try {
+ int docCharsToReplace = (fNewPrefix == null || fPrefix == null) ? 0 :
+ fPrefix.length() - fNewPrefix.length();
String replacement= fString.substring(offset - fOffset);
- document.replace(offset, 0, replacement);
+ document.replace(offset - docCharsToReplace, docCharsToReplace, replacement);
} catch (BadLocationException x) {
SeamGuiPlugin.getPluginLog().logError(x);
}
@@ -293,7 +301,12 @@
for (String string : uniqueSuggestions) {
if (string.length() >= 0) {
string = proposalPrefix + string + proposalSufix;
- result.add(new Proposal(string, prefix, offset, offset + string.length() - proposalSufix.length()));
+ if (string.startsWith("['") && string.endsWith("']") && prefix != null && prefix.endsWith(".")) {
+ String newPrefix = prefix.substring(0, prefix.length() - 1);
+ result.add(new Proposal(string, prefix, newPrefix, offset, offset - 1 + string.length() - proposalSufix.length()));
+ } else {
+ result.add(new Proposal(string, prefix, offset, offset + string.length() - proposalSufix.length()));
+ }
}
}
18 years
JBoss Tools SVN: r7493 - in trunk/common/plugins/org.jboss.tools.common.model: src/org/jboss/tools/common/java/generation and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-10 12:38:29 -0400 (Thu, 10 Apr 2008)
New Revision: 7493
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/filesystems.meta
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultSpecialHandler.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaLibLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaResourceLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/KeyLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/MountFileSystemHandler.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/MappedEntityRecognizer.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdateWizard.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java
Log:
JBIDE-893
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/meta/filesystems.meta
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/meta/filesystems.meta 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/meta/filesystems.meta 2008-04-10 16:38:29 UTC (rev 7493)
@@ -16,6 +16,7 @@
<PAIR name="htm$5" value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="html$5" value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="java$5" value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
+ <PAIR name="jsf$5" value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="properties$5" value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="txt$5" value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="xhtml$5" value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -74,12 +74,13 @@
}
static IMethod findGetter(IType type, String methodName) {
+ if(type == null || methodName == null) return null;
try {
IMethod[] ms = type.getMethods();
for (int i = 0; i < ms.length; i++) {
if(ms[i].getElementName().equals(methodName) && ms[i].getParameterNames().length == 0) return ms[i];
}
- } catch (Exception e) {
+ } catch (JavaModelException e) {
return null;
}
@@ -136,7 +137,7 @@
IBuffer buf = null;
try {
buf = cu.getBuffer();
- } catch (Exception e) {
+ } catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
if (buf == null) {
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultSpecialHandler.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultSpecialHandler.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultSpecialHandler.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -29,7 +29,7 @@
public static SpecialWizardSupport createSpecialWizardSupport(String id) {
try {
return (SpecialWizardSupport)ModelFeatureFactory.getInstance().createFeatureInstance(id);
- } catch (Exception e) {
+ } catch (ClassCastException e) {
ModelPlugin.getDefault().getLog().log(new Status(Status.ERROR, ModelPlugin.PLUGIN_ID, Status.OK, "Model warning: Cannot load special wizard support " + id + ".",e));
return null;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaLibLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaLibLoader.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaLibLoader.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -41,7 +41,7 @@
try {
Class<?> c = MetaLibLoader.class;
XMLEntityResolver.registerPublicEntity(DOC_PUBLICID, c, "/meta/meta.dtd");
- } catch (Exception e) {
+ } catch (IOException e) {
ModelPlugin.getPluginLog().logError(e);
}
}
@@ -57,17 +57,13 @@
public void load(XModelMetaDataImpl meta) {
this.meta = meta;
- try {
- Map<String,URL> resources = MetaResourceLoader.getMetaResources();
- Iterator<String> it = resources.keySet().iterator();
- while(it.hasNext()) {
- String path = it.next();
- URL url = resources.get(path);
- load(path, url);
- }
- } catch (Exception t) {
- ModelPlugin.getPluginLog().logError("Error in loading meta model resources", t);
- }
+ Map<String,URL> resources = MetaResourceLoader.getMetaResources();
+ Iterator<String> it = resources.keySet().iterator();
+ while(it.hasNext()) {
+ String path = it.next();
+ URL url = resources.get(path);
+ load(path, url);
+ }
// long t = System.currentTimeMillis();
for (int i = 0; i < metarefs.size(); i++) {
@@ -92,12 +88,13 @@
}
void load(String name, URL url) {
+ if(url == null) return;
// long t = System.currentTimeMillis();
InputStream stream = null;
try {
stream = url.openStream();
stream = new BufferedInputStream(stream, 16384);
- } catch (Exception e) {
+ } catch (IOException e) {
ModelPlugin.getPluginLog().logError("MetaLoader: Cannot read resource " + url.toString());
return;
}
@@ -106,10 +103,8 @@
//XMLUtil.getElement(stream);
if(g == null) {
ModelPlugin.getPluginLog().logInfo("Corrupted meta resource " + name);
- } else try {
+ } else {
load0(g, name, url.toString());
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
}
// long dt = - t + (t = System.currentTimeMillis());
@@ -125,7 +120,7 @@
ModelPlugin.getPluginLog().logInfo(errors[i]);
}
}
- } catch (Exception e) {
+ } catch (IOException e) {
ModelPlugin.getPluginLog().logError(e);
}
// dt = - t + (t = System.currentTimeMillis());
@@ -138,11 +133,7 @@
Parser p = new Parser();
p.documentElement = root;
p.current = root;
- try {
- p.parse(stream);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
+ p.parse(stream);
Element g = p.documentElement;
g = XMLUtilities.getUniqueChild(g, "XModelEntityGroup");
p.documentElement.removeChild(g);
@@ -219,10 +210,13 @@
public void parse(org.xml.sax.InputSource is) {
XMLReader parser = createParser();
+ if(parser == null) return;
try {
parser.parse(is);
- } catch (Exception e) {
+ } catch (SAXException e) {
ModelPlugin.getPluginLog().logError(e);
+ } catch (IOException e) {
+ ModelPlugin.getPluginLog().logError(e);
}
}
@@ -232,7 +226,7 @@
try {
parserInstance = XMLReaderFactory.createXMLReader(DEFAULT_SAX_PARSER_CLASS_NAME);
- } catch (Exception e) {
+ } catch (SAXException e) {
return null;
}
@@ -246,7 +240,7 @@
try {
parserInstance.setProperty(ENTITY_RESOLVER_PROPERTY_ID, new XMLEntityResolverImpl());
- } catch (Exception e1) {
+ } catch (SAXException e1) {
CommonPlugin.getPluginLog().logError( e1.getMessage()+"", e1);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaResourceLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaResourceLoader.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaResourceLoader.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -37,18 +37,13 @@
URL url = bundle.getResource(path);
if(url != null) {
resources.put(path, url);
-// if(ModelPlugin.isDebugEnabled()) {
-// ModelPlugin.log("Loaded meta resource " + path + ".");
-// }
} else {
if(ModelPlugin.isDebugEnabled()) {
ModelPlugin.getPluginLog().logInfo("Warning: meta resource " + path + " not found.");
}
}
- } catch (Exception e) {
- if(ModelPlugin.isDebugEnabled()) {
- ModelPlugin.getPluginLog().logError("Warning: meta resource " + path + " not found.");
- }
+ } catch (IllegalStateException e) {
+ ModelPlugin.getPluginLog().logError("MetaResourceLoader warning: meta resource " + path + " not found.");
}
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/KeyLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/KeyLoader.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/KeyLoader.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.meta.key;
+import java.io.IOException;
import java.net.URL;
import java.util.*;
import org.eclipse.core.runtime.*;
@@ -25,18 +26,18 @@
Iterator<URL> it = set.iterator();
if(!it.hasNext()) return keys;
while(it.hasNext()) {
- URL url = (URL)it.next();
+ URL url = it.next();
+ Properties p = new Properties();
try {
- Properties p = new Properties();
p.load(url.openConnection().getInputStream());
- Enumeration ks = p.keys();
- while(ks.hasMoreElements()) {
- String k = (String)ks.nextElement();
- keys.setProperty(k, p.getProperty(k));
- }
- } catch (Exception e) {
+ } catch (IOException e) {
ModelPlugin.getPluginLog().logError("KeyLoader:load" + url);
}
+ Enumeration ks = p.keys();
+ while(ks.hasMoreElements()) {
+ String k = (String)ks.nextElement();
+ keys.setProperty(k, p.getProperty(k));
+ }
}
return keys;
}
@@ -57,15 +58,9 @@
URL url = bundle.getResource(path);
if(url != null) {
resources.add(url);
- } else {
- if(ModelPlugin.isDebugEnabled()) {
- ModelPlugin.getPluginLog().logInfo("Warning: meta resource " + path + " not found.");
- }
}
- } catch (Exception e) {
- if(ModelPlugin.isDebugEnabled()) {
- ModelPlugin.getPluginLog().logInfo("Warning: meta resource " + path + " not found.");
- }
+ } catch (IllegalStateException e) {
+ ModelPlugin.getPluginLog().logInfo("KeyLoader: Plugin " + es[i].getNamespaceIdentifier() + " is uninstalled");
}
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -200,8 +200,10 @@
if(!n2.equals(n1)) {
try {
f.move(new Path(f.getParent().getFullPath() + "/" + toFileName(this)), true, null);
- } catch (Exception e) {
+ } catch (OperationCanceledException e) {
super.set(attr, n1);
+ } catch (CoreException e) {
+ super.set(attr, n1);
}
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -77,10 +77,9 @@
status = OV_RUNNING;
try {
updateOverlappedInternal();
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
+ } finally {
+ overlapper = null;
}
- overlapper = null;
}
public String getId() {
@@ -266,16 +265,7 @@
} else {
doUpdate();
}
-// if(request > 0 && usage < 5) {
-// usage++;
-// request = 0;
-// ModelPlugin.log("run " + usage);
-// run();
-// } else {
-/// synchronized(this) {
- if(this == currentUpdate) currentUpdate = null;
-/// }
-// }
+ if(this == currentUpdate) currentUpdate = null;
}
}
@@ -288,29 +278,23 @@
if(b) {
XModelObjectLoaderUtil.getObjectLoader(FileSystemsImpl.this).update(FileSystemsImpl.this);
}
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
if(saveRequested) {
try {
XModelObjectLoaderUtil.getObjectLoader(FileSystemsImpl.this).save(FileSystemsImpl.this);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
} finally {
saveRequested = false;
+ isUpdating = false;
}
}
isUpdating = false;
}
private boolean isOpenProject() {
- try {
- IProject p = (IProject)getModel().getProperties().get("project");
- return p != null && p.isOpen();
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- return false;
- }
+ IProject p = (IProject)getModel().getProperties().get("project");
+ return p != null && p.isAccessible() && p.isOpen();
}
private IContributorResourceAdapter contributorResourceAdapter = null;
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -67,11 +67,7 @@
updateLibs(object);
removeMissingJarSystems(object);
updateSrcs(object);
- try {
- ((FileSystemsImpl)object).updateOverlapped();
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
+ ((FileSystemsImpl)object).updateOverlapped();
return b;
}
@@ -83,11 +79,7 @@
auto.load(object.getModel());
updateLibs(object);
_updateSrcs(object);
- try {
- ((FileSystemsImpl)object).updateOverlapped();
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
+ ((FileSystemsImpl)object).updateOverlapped();
return;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -25,8 +25,8 @@
static {
try {
contribution = (Contribution)ModelFeatureFactory.getInstance().createFeatureInstance("org.jboss.tools.jst.web.project.FileSystemsRenameListenerContribution");
- } catch (Exception e) {
- //ignore
+ } catch (ClassCastException e) {
+ ModelPlugin.getPluginLog().logError(e);
}
}
XModelObject fileSystems;
@@ -90,20 +90,10 @@
private IPath getLocation(IPath path) {
if(path.segmentCount() > 1) {
- IFolder folder = null;
- try {
- folder = ModelPlugin.getWorkspace().getRoot().getFolder(path);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError("FileSystemsRenameListener:getLocation: Cannot find folder " + path);
- }
+ IFolder folder = ModelPlugin.getWorkspace().getRoot().getFolder(path);
return folder == null ? null : folder.getLocation();
} else {
- IProject project = null;
- try {
- project = ModelPlugin.getWorkspace().getRoot().getProject(path.segments()[0]);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError("FileSystemsRenameListener:getLocation: Cannot find project " + path);
- }
+ IProject project = ModelPlugin.getWorkspace().getRoot().getProject(path.segments()[0]);
return project == null ? null : project.getLocation();
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/MountFileSystemHandler.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/MountFileSystemHandler.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/MountFileSystemHandler.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -12,6 +12,7 @@
import java.util.*;
import java.io.*;
+
import org.jboss.tools.common.meta.action.*;
import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
import org.jboss.tools.common.model.*;
@@ -63,8 +64,8 @@
private String canonize(String location, XModel model) {
try {
location = XModelObjectUtil.expand(location, model, null);
- return (new File(location).getCanonicalPath()).replace('\\', '/');
- } catch (Exception e) {
+ return location == null ? null : (new File(location).getCanonicalPath()).replace('\\', '/');
+ } catch (IOException e) {
return location;
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/MappedEntityRecognizer.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/MappedEntityRecognizer.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/MappedEntityRecognizer.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -22,6 +22,7 @@
map.put("flow", "FileFlow");
map.put("jspx", "FileJSP");
map.put("jspf", "FileJSP");
+ map.put("jsf", "FileHTML");
}
public String getEntityName(String ext, String body) {
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -88,9 +88,10 @@
}
private int parsePriority(String s) {
+ if(s == null) return 10;
try {
return (s.length() == 0) ? 0 : Integer.parseInt(s);
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
return 10;
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -97,12 +97,12 @@
if(dms == null) return;
ms = dms.toArray(new IMarker[0]);
for (int i = 0; i < ms.length; i++) ms[i].delete();
- } catch (Exception e) {
+ } catch (CoreException e) {
ModelPlugin.getPluginLog().logError(e);
}
}
- public static void updateLocation(IMarker marker, int location, int start, int end) throws Exception {
+ public static void updateLocation(IMarker marker, int location, int start, int end) throws CoreException {
if(location >= 0 && marker.getAttribute(IMarker.LINE_NUMBER, -1) != location) {
marker.setAttribute(IMarker.LINE_NUMBER, location);
}
@@ -124,7 +124,7 @@
ms[i].setAttribute("path", path);
}
return ms[i];
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
continue;
}
@@ -167,7 +167,7 @@
public void run(IProgressMonitor monitor) throws CoreException {
try {
for (int i = 0; i < ms.length; i++) ms[i].delete();
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
}
}
@@ -184,19 +184,20 @@
ArrayList<IMarker> l = null;
try {
IMarker[] ms = r.findMarkers(null, false, 1);
- for (int i = 0; i < ms.length; i++) {
+ if(ms != null) for (int i = 0; i < ms.length; i++) {
if(isOwnedMarker(ms[i])) {
if(l == null) l = new ArrayList<IMarker>();
l.add(ms[i]);
}
}
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
}
return (l == null) ? null : l.toArray(new IMarker[0]);
}
- protected boolean isOwnedMarker(IMarker m) throws Exception {
+ protected boolean isOwnedMarker(IMarker m) throws CoreException {
+ if(m == null) return false;
String _type = m.getType();
if(_type == null) return true;
if(_type.startsWith("org.jboss.tools.")) {
@@ -240,8 +241,7 @@
if(r == null) return;
try {
IMarker[] ms = r.findMarkers(ResourceMarkers.JST_WEB_PROBLEM, true, 1);
- for (int i = 0; i < ms.length; i++) {
-// String type = ms[i].getType();
+ if(ms != null) for (int i = 0; i < ms.length; i++) {
String path = ms[i].getAttribute("path", null);
if(path == null) continue;
XModelObject o = file.getModel().getByPath(path);
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdateWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdateWizard.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdateWizard.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -12,6 +12,7 @@
import java.util.*;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.meta.action.SpecialWizard;
import org.jboss.tools.common.model.XModel;
@@ -34,7 +35,7 @@
public int execute() {
try {
u.execute();
- } catch (Exception e) {
+ } catch (CoreException e) {
ModelPlugin.getPluginLog().logError(e);
}
return 0;
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java 2008-04-10 16:35:24 UTC (rev 7492)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java 2008-04-10 16:38:29 UTC (rev 7493)
@@ -25,32 +25,30 @@
}
public static String getMemberTypeAsString(IField f) {
+ if(f == null) return null;
try {
String typeName = new String(Signature.toCharArray(f.getTypeSignature().toCharArray()));
return resolveType(f.getDeclaringType(), typeName);
- } catch (Exception e) {
+ } catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
return null;
}
public static String getMemberTypeAsString(IMethod m) {
+ if(m == null) return null;
try {
return resolveTypeAsString(m.getDeclaringType(), m.getReturnType());
- } catch (Exception e) {
+ } catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
return null;
}
public static String resolveTypeAsString(IType type, String typeName) {
- try {
- typeName = new String(Signature.toCharArray(typeName.toCharArray()));
- return resolveType(type, typeName);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
- return null;
+ if(type == null || typeName == null) return null;
+ typeName = new String(Signature.toCharArray(typeName.toCharArray()));
+ return resolveType(type, typeName);
}
static String NULL = ";;;";
@@ -114,6 +112,7 @@
}
private static String __resolveType(IType type, String typeName) {
+ if(type == null || typeName == null) return null;
try {
String resolvedArray[][] = type.resolveType(typeName);
// resolvedArray == null for primitive types
@@ -122,7 +121,7 @@
for (int i = 0; i < resolvedArray[0].length; i++)
typeName += (!"".equals(typeName) ? "." : "") + resolvedArray[0][i];
return typeName;
- } catch (Exception e) {
+ } catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
return null;
18 years
JBoss Tools SVN: r7492 - trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-10 12:35:24 -0400 (Thu, 10 Apr 2008)
New Revision: 7492
Modified:
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsActionHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsActionMappingHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBeanNameHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBundleHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBundleKeyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigBundleHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigBundleKeyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigFormBeanHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigFormPropertyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigForwardPathHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPageHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsContextParamLinkHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormActionHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormBeanHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormValidationBundleKeyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsForwardHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPLinkHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsLinkHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsLogicPropertyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPageHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPropertiesFileHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPropertyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleKeyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleKeyHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationMethodHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationMethodHyperlink0.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationPropertyHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationValidatorHyperlink.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLContextParamLinkHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLLinkHyperlinkPartitioner.java
trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXModelBasedHyperlink.java
Log:
JBIDE-893
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsActionHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsActionHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsActionHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -42,9 +43,10 @@
}
private String getAction(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
}
@@ -52,8 +54,8 @@
private String getModule(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -63,7 +65,7 @@
Attr bundleAttr = (Attr)node.getAttributes().getNamedItem("module");
if(bundleAttr == null) return "";
return Utils.getTrimmedValue(getDocument(), bundleAttr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsActionMappingHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsActionMappingHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsActionMappingHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -36,9 +37,10 @@
}
private String getAction(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBeanNameHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBeanNameHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBeanNameHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -13,6 +13,7 @@
import java.util.Iterator;
import java.util.Map;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.w3c.dom.Attr;
@@ -53,30 +54,26 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
+ if(region == null) return;
- try {
- String forID = getForId(region);
- String prefix = getPrefix(region);
+ String forID = getForId(region);
+ String prefix = getPrefix(region);
- IRegion elementByID = findElementByIDBackward(forID, region.getOffset(), prefix);
- if (elementByID != null) {
- StructuredSelectionHelper.setSelectionAndRevealInActiveEditor(elementByID);
- return;
- }
- StrutsFormBeanHyperlink openOn = new StrutsFormBeanHyperlink();
- openOn.setTextViewer(getTextViewer());
- openOn.setOffset(getOffset());
- openOn.doHyperlink(region);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- openFileFailed();
+ IRegion elementByID = findElementByIDBackward(forID, region.getOffset(), prefix);
+ if (elementByID != null) {
+ StructuredSelectionHelper.setSelectionAndRevealInActiveEditor(elementByID);
+ return;
}
+ StrutsFormBeanHyperlink openOn = new StrutsFormBeanHyperlink();
+ openOn.setTextViewer(getTextViewer());
+ openOn.setOffset(getOffset());
+ openOn.doHyperlink(region);
}
private IRegion findElementByIDBackward (String id, int endOffset, String prefix) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -117,9 +114,6 @@
return "IRegion [" + getOffset() +", " + getLength()+ "]";
}
};
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
@@ -127,8 +121,8 @@
private Element findElementByIDBackward(NodeList list, String id, int endOffset, String prefix) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -138,34 +132,27 @@
for (int i = list.getLength() - 1; list != null && i >= 0; i--) {
if(!(list.item(i) instanceof Element)) continue;
- try {
- Element element = (Element)list.item(i);
- int start = Utils.getValueStart(element);
- if (start < 0 || start >= endOffset) continue;
+ Element element = (Element)list.item(i);
+ int start = Utils.getValueStart(element);
+ if (start < 0 || start >= endOffset) continue;
- String elementExtracted = JSPRootHyperlinkPartitioner.extractName(element.getNodeName(), trackersMap, tm);
- if (isInList(elementExtracted, trackersMap, tm, prefix)) {
+ String elementExtracted = JSPRootHyperlinkPartitioner.extractName(element.getNodeName(), trackersMap, tm);
+ if (isInList(elementExtracted, trackersMap, tm, prefix)) {
- Attr idAttr = element.getAttributeNode("id");
- if (idAttr != null) {
- String val = Utils.trimQuotes(idAttr.getNodeValue());
- if (id.equals(val)) {
- return element;
- }
+ Attr idAttr = element.getAttributeNode("id");
+ if (idAttr != null) {
+ String val = Utils.trimQuotes(idAttr.getNodeValue());
+ if (id.equals(val)) {
+ return element;
}
}
+ }
- if (element.hasChildNodes()) {
- Element child = findElementByIDBackward(element.getChildNodes(), id, endOffset, prefix);
- if (child != null) return child;
- }
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- // Probably not an IDOMElement
+ if (element.hasChildNodes()) {
+ Element child = findElementByIDBackward(element.getChildNodes(), id, endOffset, prefix);
+ if (child != null) return child;
}
}
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
} finally {
smw.dispose();
}
@@ -191,7 +178,7 @@
String getForId(IRegion region) {
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -268,7 +255,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
@@ -291,9 +278,6 @@
Node node = n;
if (node.getNodeName().indexOf(":") == -1) return null;
return node.getNodeName().substring(0, node.getNodeName().indexOf(":"));
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBundleHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBundleHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBundleHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -39,9 +40,10 @@
}
private String getBundle(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBundleKeyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBundleKeyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsBundleKeyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -36,7 +37,7 @@
Properties p = new Properties();
String value = getKey(region);
- value = (value == null? "" : value);
+ value = (value == null) ? "" : value;
p.setProperty(WebPromptingProvider.KEY, value);
p.setProperty("prefix", value);
@@ -48,9 +49,10 @@
}
private String getBundle(IRegion region) {
+ if(region == null) return "";
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -59,7 +61,7 @@
Attr bundleAttr = (Attr)node.getAttributes().getNamedItem("bundle");
if(bundleAttr == null) return "";
return Utils.getTrimmedValue(getDocument(), bundleAttr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
} finally {
@@ -68,11 +70,12 @@
}
private String getKey(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
+ return "";
}
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigBundleHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigBundleHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigBundleHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -41,9 +42,10 @@
}
private String getBundle(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
- return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigBundleKeyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigBundleKeyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigBundleKeyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -47,9 +48,10 @@
}
private String getBundle(IRegion region) {
+ if(region == null) return "";
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -58,7 +60,7 @@
Attr bundleAttr = (Attr)node.getAttributes().getNamedItem("bundle");
if(bundleAttr == null) return "";
return Utils.getTrimmedValue(getDocument(), bundleAttr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
} finally {
@@ -67,11 +69,12 @@
}
private String getKey(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
+ return "";
}
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigFormBeanHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigFormBeanHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigFormBeanHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -43,9 +44,10 @@
}
private String getAttributeValue(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigFormPropertyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigFormPropertyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigFormPropertyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -45,9 +46,10 @@
}
private String getName(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -55,8 +57,8 @@
private String getFormType(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -67,7 +69,7 @@
if (typeAttr == null) return null;
String type = Utils.getTrimmedValue(getDocument(), typeAttr);
return type;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigForwardPathHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigForwardPathHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigForwardPathHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -51,9 +52,10 @@
}
private String getAttributeValue(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -61,8 +63,8 @@
private String getPath(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -120,7 +122,7 @@
return null;
return parentNode.getNodeName() + "/" + nameOrType;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPageHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPageHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPageHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -38,9 +39,10 @@
}
private String getPage(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -44,9 +45,10 @@
}
private String getAttributeValue(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -105,7 +107,7 @@
if (propStart > offset || propStart + propLength < offset) return null;
IRegion region = new HyperlinkRegion(propStart, propLength);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigPluginSetPropertyHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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.Attr;
import org.w3c.dom.Document;
@@ -46,8 +48,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();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
@@ -55,7 +57,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
@@ -75,7 +77,6 @@
* @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 (!super.recognize(document, region))
return false;
@@ -83,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;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -102,19 +103,17 @@
return false;
return true;
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return false;
} finally {
smw.dispose();
}
}
private String getAttributeValue (IDocument document, Node node, String attrName) {
+ if(node == null || document == null || attrName == null) return "";
try {
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -18,7 +18,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.ClassMethodHyperlink;
-import org.jboss.tools.struts.text.ext.StrutsExtensionsPlugin;
public class StrutsConfigSetPropertyHyperlink extends ClassMethodHyperlink {
private static final String CLASSNAME_ATTRNAME = "className";
@@ -31,9 +30,10 @@
}
protected String getClassName(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;
@@ -45,9 +45,6 @@
Node parentNode = node.getParentNode();
return getAttributeValue(parentNode, CLASSNAME_ATTRNAME);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsConfigSetPropertyHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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.Attr;
import org.w3c.dom.Document;
@@ -41,8 +43,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();
for (int i = 0; i < STRUTS_PROJECT_NATURES.length; i++) {
@@ -50,7 +52,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
@@ -65,7 +67,8 @@
* @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;
+
if (!super.recognize(document, region))
return false;
@@ -73,8 +76,8 @@
return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -88,19 +91,17 @@
String classNameValue = getAttributeValue(document, parent, CLASS_NAME_ATTR);
return (classNameValue != null && classNameValue.length() > 0 &&
propertyValue != null && propertyValue.length() > 0);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return false;
} finally {
smw.dispose();
}
}
private String getAttributeValue (IDocument document, Node node, String attrName) {
+ if(node == null || document == null || attrName == null) return null;
try {
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsContextParamLinkHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsContextParamLinkHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsContextParamLinkHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.struts.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -24,10 +25,11 @@
* @author Jeremy
*/
public class StrutsContextParamLinkHyperlink extends StrutsLinkHyperlink {
+
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;
@@ -77,7 +79,7 @@
if (propStart > offset || propStart + propLength < offset) return null;
IRegion region = new HyperlinkRegion(propStart, propLength);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormActionHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormActionHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormActionHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.struts.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;
@@ -48,8 +49,8 @@
private boolean checkTypeIsEmpty(IDocument document, IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -59,7 +60,7 @@
if (typeAttr == null) return true;
String typeValue = Utils.getTrimmedValue(document, typeAttr);
return (typeValue == null || typeValue.length() == 0);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormBeanHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormBeanHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormBeanHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -38,9 +39,10 @@
}
private String getFormBean(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormValidationBundleKeyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormValidationBundleKeyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsFormValidationBundleKeyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -44,9 +45,10 @@
}
private String getKey(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsForwardHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsForwardHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsForwardHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -38,9 +39,10 @@
}
private String getForward(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPLinkHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPLinkHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPLinkHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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.struts.StrutsProject;
@@ -38,8 +39,8 @@
*/
protected boolean recognizeNature(IDocument document) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if(xmlDocument == null) return false;
IFile documentFile = smw.getFile();
@@ -50,7 +51,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -14,6 +14,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.w3c.dom.Attr;
@@ -42,13 +43,13 @@
IFile file = getFile();
XModel xModel = getXModel(file);
if (xModel == null) return;
- try {
+ {
WebPromptingProvider provider = WebPromptingProvider.getInstance();
Properties p = getRequestProperties(region);
p.put(WebPromptingProvider.FILE, file);
- List list = provider.getList(xModel, WebPromptingProvider.STRUTS_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
+ List<Object> list = provider.getList(xModel, WebPromptingProvider.STRUTS_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
if (list != null && list.size() >= 1) {
openFileInEditor((String)list.get(0));
return;
@@ -57,9 +58,6 @@
if ( error != null && error.length() > 0) {
openFileFailed();
}
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- openFileFailed();
}
}
@@ -84,9 +82,10 @@
}
private String getURI(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;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -105,18 +104,16 @@
if(!tmw.exists()) return null;
return tmw.getUri(nodePrefix);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(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;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -128,9 +125,6 @@
String tagName = node.getNodeName();
if (tagName.indexOf(':') == -1) return null;
return tagName.substring(tagName.indexOf(':') + 1);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
@@ -140,18 +134,14 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -220,7 +210,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
@@ -229,10 +219,11 @@
}
protected String getAttributeValue (IDocument document, Node node, String attrName) {
+ if(document == null || node == null || attrName == null) return null;
try {
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagAttributeHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -42,9 +44,10 @@
* @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;
@@ -60,9 +63,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
@@ -82,7 +82,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
@@ -92,8 +92,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;
@@ -156,7 +156,7 @@
}
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -14,6 +14,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;
@@ -44,13 +45,12 @@
XModel xModel = getXModel(documentFile);
if (xModel == null) return;
- try {
WebPromptingProvider provider = WebPromptingProvider.getInstance();
Properties p = getRequestProperties(region);
p.put(WebPromptingProvider.FILE, documentFile);
- List list = provider.getList(xModel, WebPromptingProvider.STRUTS_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
+ List<Object> list = provider.getList(xModel, WebPromptingProvider.STRUTS_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
if (list != null && list.size() >= 1) {
openFileInEditor((String)list.get(0));
return;
@@ -59,10 +59,6 @@
if ( error != null && error.length() > 0) {
openFileFailed();
}
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- openFileFailed();
- }
}
@@ -82,9 +78,10 @@
}
private String getURI(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;
@@ -105,18 +102,16 @@
if (!tmw.exists()) return null;
return tmw.getUri(nodePrefix);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(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;
@@ -128,9 +123,6 @@
if (tagName.indexOf(':') == -1) return null;
return tagName.substring(tagName.indexOf(':') + 1);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
@@ -140,18 +132,13 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(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;
@@ -192,19 +179,17 @@
};
return region;
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
}
protected String getAttributeValue (IDocument document, Node node, String attrName) {
+ if(document == null || node == null || attrName == null) return null;
try {
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsJSPTagNameHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -40,9 +41,10 @@
* @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;
@@ -60,9 +62,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
@@ -73,8 +72,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();
@@ -83,7 +82,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
@@ -93,8 +92,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;
@@ -135,9 +134,6 @@
};
return region;
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsLinkHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsLinkHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsLinkHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -21,15 +21,11 @@
public class StrutsLinkHyperlink extends LinkHyperlink {
protected IFile getFileFromProject(String fileName) {
+ if(fileName == null || fileName.length() == 0) return null;
IFile documentFile = getFile();
-
- try {
- IProject project = documentFile.getProject();
- return super.getFileFromProject(updateFilenameForModel(fileName, project));
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
- }
+ if(documentFile == null) return null;
+ IProject project = documentFile.getProject();
+ return super.getFileFromProject(updateFilenameForModel(fileName, project));
}
}
\ No newline at end of file
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsLogicPropertyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsLogicPropertyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsLogicPropertyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -16,6 +16,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.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.w3c.dom.Attr;
@@ -55,6 +56,7 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
+ if(region == null) return;
IFile documentFile = getFile();
XModel xModel = getXModel(documentFile);
if (xModel == null) {
@@ -63,8 +65,8 @@
}
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
String forID = getForId(region);
String prefix = getPrefix(region);
@@ -95,7 +97,7 @@
p.setProperty(WebPromptingProvider.PROPERTY, getFormBeanProperty(region));
p.put(WebPromptingProvider.FILE, documentFile);
- List list = provider.getList(xModel, WebPromptingProvider.STRUTS_OPEN_FORM_BEAN, getFormBeanName(region, n), p);
+ List<Object> list = provider.getList(xModel, WebPromptingProvider.STRUTS_OPEN_FORM_BEAN, getFormBeanName(region, n), p);
if (list != null && list.size() >= 1) {
openFileInEditor((String)list.get(0));
return;
@@ -104,9 +106,6 @@
if ( error != null && error.length() > 0) {
openFileFailed();
}
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- openFileFailed();
} finally {
smw.dispose();
}
@@ -114,19 +113,21 @@
}
private String getFormBeanName(IRegion region, Node node) {
+ if(region == null || node == null) return null;
try {
Attr attr = (Attr)node.getAttributes().getNamedItem("name");
return Utils.getTrimmedValue(getDocument(), attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
}
private String getFormBeanProperty(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
}
@@ -134,8 +135,8 @@
private IRegion findElementByIDBackward (String id, int endOffset, String prefix) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -176,9 +177,6 @@
return "IRegion [" + getOffset() +", " + getLength()+ "]";
}
};
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
@@ -186,55 +184,41 @@
private Element findElementByIDBackward(NodeList list, String id, int endOffset, String prefix) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Map trackersMap = JSPRootHyperlinkPartitioner.getTrackersMap(getDocument(), endOffset);
XModel xModel = null;
TaglibMapping tm = null;
- try {
- if(xModel != null) {
- tm = WebProject.getInstance(xModel).getTaglibMapping();
- } else {
- tm = null;
- }
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- tm = null; // For sure
+ if(xModel != null) {
+ tm = WebProject.getInstance(xModel).getTaglibMapping();
}
for (int i = list.getLength() - 1; list != null && i >= 0; i--) {
if(!(list.item(i) instanceof Element)) continue;
- try {
- Element element = (Element)list.item(i);
- int start = Utils.getValueStart(element);
- if (start < 0 || start >= endOffset) continue;
+ Element element = (Element)list.item(i);
+ int start = Utils.getValueStart(element);
+ if (start < 0 || start >= endOffset) continue;
- String elementExtracted = JSPRootHyperlinkPartitioner.extractName(element.getNodeName(), trackersMap, tm);
- if (isInList(elementExtracted, trackersMap, tm, prefix)) {
-
- Attr idAttr = (Attr)element.getAttributeNode("id");
- if (idAttr != null) {
- String val = Utils.trimQuotes(idAttr.getNodeValue());
- if (id.equals(val)) {
- return element;
- }
+ String elementExtracted = JSPRootHyperlinkPartitioner.extractName(element.getNodeName(), trackersMap, tm);
+ if (isInList(elementExtracted, trackersMap, tm, prefix)) {
+
+ Attr idAttr = (Attr)element.getAttributeNode("id");
+ if (idAttr != null) {
+ String val = Utils.trimQuotes(idAttr.getNodeValue());
+ if (id.equals(val)) {
+ return element;
}
}
+ }
- if (element.hasChildNodes()) {
- Element child = findElementByIDBackward(element.getChildNodes(), id, endOffset, prefix);
- if (child != null) return child;
- }
- } catch (Exception x) {
- // Probably not an IDOMElement
- StrutsExtensionsPlugin.getPluginLog().logError(x);
+ if (element.hasChildNodes()) {
+ Element child = findElementByIDBackward(element.getChildNodes(), id, endOffset, prefix);
+ if (child != null) return child;
}
}
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
} finally {
smw.dispose();
}
@@ -258,9 +242,10 @@
}
String getForId(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -276,8 +261,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;
@@ -337,7 +322,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
@@ -346,9 +331,10 @@
}
private String getPrefix(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;
@@ -360,9 +346,6 @@
Node node = n;
if (node.getNodeName().indexOf(":") == -1) return null;
return node.getNodeName().substring(0, node.getNodeName().indexOf(":"));
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPageHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPageHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPageHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -38,9 +39,10 @@
}
private String getPage(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPropertiesFileHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPropertiesFileHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPropertiesFileHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -11,6 +11,8 @@
package org.jboss.tools.struts.text.ext.hyperlink;
import java.util.Properties;
+
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
@@ -35,9 +37,10 @@
}
private String getProperty(IRegion region) {
+ if(region == null || getDocument() == null) return "";
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPropertyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPropertyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsPropertyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -47,18 +48,20 @@
}
private String getProperty(IRegion region) {
- try {
+ if(region == null || getDocument() == null) return "";
+ try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return "";
}
}
private String getFormType(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;
@@ -86,7 +89,7 @@
Attr typeAttr = (Attr)formNode.getAttributes().getNamedItem("type");
if (typeAttr == null) return null;
return Utils.getTrimmedValue(getDocument(), typeAttr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
@@ -95,9 +98,10 @@
}
private String getFormAction (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;
@@ -125,7 +129,7 @@
Attr actionAttr = (Attr)formNode.getAttributes().getNamedItem("action");
if (actionAttr == null) return null;
return Utils.getTrimmedValue(getDocument(), actionAttr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+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;
@@ -38,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;
@@ -54,8 +55,6 @@
if (uri != null) {
p.setProperty("prefix", uri);
}
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
} finally {
smw.dispose();
}
@@ -64,10 +63,11 @@
}
private String getAttributeValue (IDocument document, Node node, String attrName) {
+ if(document == null || node == null || attrName == null)return null;
try {
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(getDocument(), attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -75,8 +75,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;
@@ -85,7 +85,7 @@
if (n == null || !(n instanceof Attr || n instanceof Node)) return null;
if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
- if ((n == null) || !(n instanceof Node)) return null;
+ if ((n == null) || !(n instanceof IDOMNode)) return null;
IDOMNode node = (IDOMNode)n;
@@ -114,9 +114,6 @@
}
};
return region;
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsTaglibDirectiveHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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.IDOMNode;
@@ -51,8 +52,8 @@
return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -60,9 +61,6 @@
if (!(n instanceof Attr || n instanceof Node) ) return false;
return true;
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return false;
} finally {
smw.dispose();
}
@@ -82,7 +80,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
@@ -92,8 +90,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;
@@ -101,7 +99,7 @@
if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
- if ((n == null) || !(n instanceof Node)) return null;
+ if ((n == null) || !(n instanceof IDOMNode)) return null;
IDOMNode node = (IDOMNode)n;
@@ -129,9 +127,6 @@
}
};
return region;
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -41,9 +42,10 @@
}
private String getBundle(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleKeyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleKeyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleKeyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -50,9 +51,10 @@
}
private String getKey(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -60,8 +62,8 @@
private String getBundle(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -69,7 +71,7 @@
Node node = ((Attr)n).getOwnerElement();
Attr bundleAttr = (Attr)node.getAttributes().getNamedItem("bundle");
return Utils.getTrimmedValue(getDocument(), bundleAttr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleKeyHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleKeyHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationBundleKeyHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.struts.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;
@@ -47,8 +48,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 @@
return false;
return true;
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return false;
} finally {
smw.dispose();
}
@@ -71,10 +69,11 @@
}
protected String getAttributeValue (IDocument document, Node node, String attrName) {
+ if(document == null || node == null || attrName == null) return null;
try {
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationMethodHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationMethodHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationMethodHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.struts.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.text.ext.util.Utils;
@@ -28,9 +29,10 @@
protected String getMethodName(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationMethodHyperlink0.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationMethodHyperlink0.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationMethodHyperlink0.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -62,9 +63,10 @@
private String getMethodName(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -76,8 +78,8 @@
private String getAttributeValue(IRegion region, String attrName) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -85,7 +87,7 @@
Node node = ((Attr)n).getOwnerElement();
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(getDocument(), attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationPropertyHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationPropertyHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationPropertyHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -48,23 +49,23 @@
}
return p;
- }
+ }
-
-
private String getProperty(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
}
private String getFormName(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;
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
@@ -74,9 +75,6 @@
Node parentNode = node.getParentNode();
return getAttributeValue(getDocument(), parentNode, NAME_ATTRNAME);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationValidatorHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationValidatorHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsValidationValidatorHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
@@ -43,9 +44,10 @@
}
private String getAttributeValue(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) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
@@ -53,8 +55,8 @@
public IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -117,7 +119,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLContextParamLinkHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLContextParamLinkHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLContextParamLinkHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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;
import org.w3c.dom.Element;
@@ -46,8 +48,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();
@@ -56,7 +58,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
@@ -118,7 +120,6 @@
if (paramNameNode == null) return false;
String paramNameValue = null;
- try {
NodeList list = paramNameNode.getChildNodes();
for (int i = 0; list != null && i < list.getLength(); i++) {
if (list.item(i) instanceof Text) {
@@ -133,9 +134,6 @@
}
}
}
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- }
if (paramNameValue == null) return false;
boolean paramNameValueIsCorrect = false;
for (int i = 0; i < VALID_INIT_PARAM_NAMES.length; i++) {
@@ -160,8 +158,8 @@
if (servletClassNode == null) return false;
String servletClassValue = null;
- try {
- NodeList list = servletClassNode.getChildNodes();
+
+ list = servletClassNode.getChildNodes();
for (int i = 0; list != null && i < list.getLength(); i++) {
if (list.item(i) instanceof Text) {
Text text = (Text)list.item(i);
@@ -175,9 +173,7 @@
}
}
}
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- }
+
if (servletClassValue == null) return false;
boolean servletClassValueIsCorrect = false;
@@ -188,7 +184,7 @@
}
return (paramNameValueIsCorrect && servletClassValueIsCorrect);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLLinkHyperlinkPartitioner.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLLinkHyperlinkPartitioner.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXMLLinkHyperlinkPartitioner.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -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.struts.StrutsProject;
@@ -41,8 +42,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();
@@ -51,7 +52,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return false;
} finally {
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXModelBasedHyperlink.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXModelBasedHyperlink.java 2008-04-10 16:33:44 UTC (rev 7491)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/src/org/jboss/tools/struts/text/ext/hyperlink/StrutsXModelBasedHyperlink.java 2008-04-10 16:35:24 UTC (rev 7492)
@@ -14,6 +14,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.w3c.dom.Attr;
@@ -40,13 +41,13 @@
IFile documentFile = getFile();
XModel xModel = getXModel(documentFile);
if (xModel == null) return;
- try {
+
WebPromptingProvider provider = WebPromptingProvider.getInstance();
Properties p = getRequestProperties(region);
p.put(WebPromptingProvider.FILE, documentFile);
- List list = provider.getList(xModel, getRequestMethod(), p.getProperty("prefix"), p);
+ List<Object> list = provider.getList(xModel, getRequestMethod(), p.getProperty("prefix"), p);
if (list != null && list.size() >= 1) {
openFileInEditor((String)list.get(0));
return;
@@ -55,10 +56,6 @@
if ( error != null && error.length() > 0) {
openFileFailed();
}
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(x);
- openFileFailed();
- }
}
protected abstract String getRequestMethod();
@@ -69,18 +66,13 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- StrutsExtensionsPlugin.getPluginLog().logError(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;
@@ -140,7 +132,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
} finally {
@@ -149,10 +141,11 @@
}
protected String getAttributeValue (IDocument document, Node node, String attrName) {
+ if(document == null || node == null || attrName == null) return null;
try {
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
StrutsExtensionsPlugin.getPluginLog().logError(x);
return null;
}
18 years