JBoss Tools SVN: r9258 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-07-23 20:54:46 -0400 (Wed, 23 Jul 2008)
New Revision: 9258
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandlerLoadingException.java
Log:
fix copyright comment
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandlerLoadingException.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandlerLoadingException.java 2008-07-24 00:31:39 UTC (rev 9257)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandlerLoadingException.java 2008-07-24 00:54:46 UTC (rev 9258)
@@ -1,6 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.vpe.editor.toolbar.format.handler;
+/**
+ *
+ * @author eskimo
+ *
+ */
public class FormatHandlerLoadingException extends Exception {
public FormatHandlerLoadingException(String message) {
16 years, 5 months
JBoss Tools SVN: r9257 - in trunk/common/plugins/org.jboss.tools.common.text.ext: META-INF and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-07-23 20:31:39 -0400 (Wed, 23 Jul 2008)
New Revision: 9257
Added:
trunk/common/plugins/org.jboss.tools.common.text.ext/.ruleset
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/.project
trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkDetector.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerDefinition.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JumpToHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/RelativeLinkHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/TLDAttributeNameHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/XModelBasedHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPCSSClassHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPElementNameHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPElementNameHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPForBeanIdHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPForBeanIdHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPXmlNsHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPXmlNsHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLContextParamLinkHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementNameHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLJumpToHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLLinkHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLRootHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTagAttributeValueHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/HyperlinkDefinition.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredModelWrapper.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/TextScanner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/Utils.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2472:
1. The unnecessary catches for Exception removed;
2. Wide catches for Exception replaced for particular one(s) where it was possible.
3. Logical errors like provided below were fixed where it was obvious:
try {
String fileName = getFilePath(region);
IFile fileToOpen = getFileFromProject(fileName);
if (fileToOpen.exists()) {
IWorkbenchPage workbenchPage = ExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(workbenchPage,fileToOpen,true);
} else {
// thids exception is caught by local catch block
throw new FileNotFoundException((fileToOpen == null ? "" : fileToOpen.toString()));
}
} catch (Exception x) {
// could not open editor
openFileFailed();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/.project
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/.project 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/.project 2008-07-24 00:31:39 UTC (rev 9257)
@@ -1,28 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.jboss.tools.common.text.ext</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.common.text.ext</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>net.sourceforge.pmd.runtime.pmdNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/common/plugins/org.jboss.tools.common.text.ext/.ruleset
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/.ruleset (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/.ruleset 2008-07-24 00:31:39 UTC (rev 9257)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset xmlns="http://pmd.sf.net/ruleset/1.0.0" name="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
+<description></description>
+<rule class="net.sourceforge.pmd.rules.XPathRule" dfa="false" externalInfoUrl="" message="Exception catch is too generic" name="Avoid Catching Excetpion" typeResolution="true">
+<description></description>
+<priority>1</priority>
+<properties>
+<property name="xpath">
+<value><![CDATA[//CatchStatement/FormalParameter/Type
+ /ReferenceType/ClassOrInterfaceType[@Image='Exception']]]></value>
+</property>
+</properties>
+<example></example>
+<example></example>
+<example></example>
+</rule>
+</ruleset>
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/META-INF/MANIFEST.MF 2008-07-24 00:31:39 UTC (rev 9257)
@@ -14,7 +14,7 @@
Bundle-ManifestVersion: 2
Bundle-Vendor: %providerName
Plugin-Class: org.jboss.tools.common.text.ext.ExtensionsPlugin
-Bundle-SymbolicName: org.jboss.tools.common.text.ext; singleton:=true
+Bundle-SymbolicName: org.jboss.tools.common.text.ext;singleton:=true
Bundle-Localization: plugin
Require-Bundle: org.jboss.tools.common,
org.jboss.tools.common.model,
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -59,9 +59,6 @@
try {
smw.init(getDocument());
return smw.getFile();
- } catch (Exception t) {
- // ignore
- return null;
} finally {
smw.dispose();
}
@@ -72,9 +69,6 @@
try {
smw.init(getDocument());
return smw.getXModel();
- } catch (Exception t) {
- // ignore
- return null;
} finally {
smw.dispose();
}
@@ -111,26 +105,23 @@
}
public static IFile getFile(IStructuredModel structuredModel) {
- if (structuredModel == null)
+ if (structuredModel == null) {
return null;
+ }
String wsRelativePath = structuredModel.getBaseLocation();
- if (wsRelativePath == null)
+ if (wsRelativePath == null) {
return null;
- try {
- if (wsRelativePath.startsWith("/")) {
- IPath path = new Path(wsRelativePath);
- IResource r = ModelPlugin.getWorkspace().getRoot().findMember(
- path);
- if (r.exists() && r instanceof IFile)
- return (IFile) r;
- }
- String path = Platform.getLocation().append(wsRelativePath)
- .toFile().getAbsolutePath();
- return EclipseResourceUtil.getFile(path);
- } catch (Exception e) {
- //ignore
- return null;
}
+ if (wsRelativePath.startsWith("/")) {
+ IPath path = new Path(wsRelativePath);
+ IResource r = ModelPlugin.getWorkspace().getRoot().findMember(
+ path);
+ if (r.exists() && r instanceof IFile)
+ return (IFile) r;
+ }
+ String path = Platform.getLocation().append(wsRelativePath)
+ .toFile().getAbsolutePath();
+ return EclipseResourceUtil.getFile(path);
}
abstract protected IRegion doGetHyperlinkRegion(int offset);
@@ -142,107 +133,95 @@
if(documentFile == null || !documentFile.isAccessible()) return null;
IProject project = documentFile.getProject();
- try {
- String name = Utils.trimFilePath(fileName);
- IPath currentPath = documentFile.getLocation()
- .removeLastSegments(1);
- IResource member = null;
- StructureEdit se = StructureEdit.getStructureEditForRead(project);
- if (se == null) {
- return null;
- }
- WorkbenchComponent[] modules = se.getWorkbenchModules();
- for (int i = 0; i < modules.length; i++) {
- if (name.startsWith("/")) {
- member = findFileByAbsolutePath(project, modules[i], name);
- } else {
- member = findFileByRelativePath(project, modules[i],
- currentPath, name);
- if (member == null && name.length() > 0) {
- // in some cases path having no leading "/" is
- // nevertheless absolute
- member = findFileByAbsolutePath(project, modules[i],
- "/" + name);
- }
+ String name = Utils.trimFilePath(fileName);
+ IPath currentPath = documentFile.getLocation()
+ .removeLastSegments(1);
+ IResource member = null;
+ StructureEdit se = StructureEdit.getStructureEditForRead(project);
+ if (se == null) {
+ return null;
+ }
+ WorkbenchComponent[] modules = se.getWorkbenchModules();
+ for (int i = 0; i < modules.length; i++) {
+ if (name.startsWith("/")) {
+ member = findFileByAbsolutePath(project, modules[i], name);
+ } else {
+ member = findFileByRelativePath(project, modules[i],
+ currentPath, name);
+ if (member == null && name.length() > 0) {
+ // in some cases path having no leading "/" is
+ // nevertheless absolute
+ member = findFileByAbsolutePath(project, modules[i],
+ "/" + name);
}
- if (member != null) {
- if (((IFile) member).exists())
- return (IFile) member;
- }
}
- } catch (Exception x) {
- //ignore
+ if (member != null) {
+ if (((IFile) member).exists())
+ return (IFile) member;
+ }
}
return null;
}
private IFile findFileByRelativePath(IProject project,
WorkbenchComponent module, IPath basePath, String path) {
- try {
- ComponentResource[] resources = module.findResourcesBySourcePath(
- new Path("/"), 0);
- IPath projectPath = project.getLocation();
- IResource member = null;
+ ComponentResource[] resources = module.findResourcesBySourcePath(
+ new Path("/"), 0);
+ IPath projectPath = project.getLocation();
+ IResource member = null;
- for (int i = 0; resources != null && i < resources.length; i++) {
- IPath runtimePath = resources[i].getRuntimePath();
- IPath sourcePath = resources[i].getSourcePath();
+ for (int i = 0; resources != null && i < resources.length; i++) {
+ IPath runtimePath = resources[i].getRuntimePath();
+ IPath sourcePath = resources[i].getSourcePath();
- // Look in source environment
- IPath webRootPath = projectPath.append(sourcePath);
- IPath relativePath = Utils.getRelativePath(webRootPath,
- basePath);
- IPath filePath = relativePath.append(path);
- member = project.getFolder(sourcePath).findMember(filePath);
- if (member != null) {
- if (((IFile) member).exists())
- return (IFile) member;
- }
+ // Look in source environment
+ IPath webRootPath = projectPath.append(sourcePath);
+ IPath relativePath = Utils.getRelativePath(webRootPath,
+ basePath);
+ IPath filePath = relativePath.append(path);
+ member = project.getFolder(sourcePath).findMember(filePath);
+ if (member != null) {
+ if (((IFile) member).exists())
+ return (IFile) member;
+ }
- // Look in runtime environment
- webRootPath = projectPath.append(runtimePath);
- relativePath = Utils.getRelativePath(webRootPath, basePath);
- filePath = relativePath.append(path);
- member = project.getFolder(runtimePath).findMember(filePath);
- if (member != null) {
- if (((IFile) member).exists())
- return (IFile) member;
- }
+ // Look in runtime environment
+ webRootPath = projectPath.append(runtimePath);
+ relativePath = Utils.getRelativePath(webRootPath, basePath);
+ filePath = relativePath.append(path);
+ member = project.getFolder(runtimePath).findMember(filePath);
+ if (member != null) {
+ if (((IFile) member).exists())
+ return (IFile) member;
}
- } catch (Exception x) {
- //ignore
}
return null;
}
private IFile findFileByAbsolutePath(IProject project,
- WorkbenchComponent module, String path) {
- try {
- ComponentResource[] resources = module.findResourcesBySourcePath(
- new Path("/"), 0);
+ WorkbenchComponent module, String path) {
+ ComponentResource[] resources = module.findResourcesBySourcePath(
+ new Path("/"), 0);
// IPath projectPath = project.getLocation();
- IResource member = null;
+ IResource member = null;
- for (int i = 0; resources != null && i < resources.length; i++) {
- IPath runtimePath = resources[i].getRuntimePath();
- IPath sourcePath = resources[i].getSourcePath();
+ for (int i = 0; resources != null && i < resources.length; i++) {
+ IPath runtimePath = resources[i].getRuntimePath();
+ IPath sourcePath = resources[i].getSourcePath();
- // Look in source environment
- member = project.getFolder(sourcePath).findMember(path);
- if (member != null) {
- if (((IFile) member).exists())
- return (IFile) member;
- }
+ // Look in source environment
+ member = project.getFolder(sourcePath).findMember(path);
+ if (member != null) {
+ if (((IFile) member).exists())
+ return (IFile) member;
+ }
- // Look in runtime environment
- member = project.getFolder(runtimePath).findMember(path);
- if (member != null) {
- if (((IFile) member).exists())
- return (IFile) member;
- }
+ // Look in runtime environment
+ member = project.getFolder(runtimePath).findMember(path);
+ if (member != null) {
+ if (((IFile) member).exists())
+ return (IFile) member;
}
- } catch (Exception x) {
- //ignore
}
return null;
}
@@ -266,8 +245,7 @@
f.setParent(root);
JarEntryEditorInput jarEditorInput = new JarEntryEditorInput(f) {
public boolean equals(Object arg) {
- try {return this.toString().equals(arg.toString());}
- catch (Exception x) {return false;}
+ return this.toString().equals(arg.toString());
}
};
return jarEditorInput;
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -13,7 +13,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.IExtension;
import org.eclipse.jface.text.IDocument;
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
@@ -125,9 +124,6 @@
return Utils.getParentAxisForNode(xmlDocument, attr) + attr.getName() + "/";
}
return Utils.getParentAxisForNode(xmlDocument, node);
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/CSSClassHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
+import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.text.MessageFormat;
@@ -19,12 +20,14 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.ui.IEditorPart;
@@ -85,7 +88,7 @@
openFileFailed();
}
- } catch (Exception x) {
+ } catch (CoreException x) {
// could not open editor
openFileFailed();
}
@@ -94,7 +97,7 @@
private String getStyleName(IRegion region) {
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
}
@@ -120,7 +123,7 @@
if(file != null && file.exists()) return file;
}
return null;
- } catch (Exception x) {
+ } catch (CoreException x) {
//ignore
return null;
}
@@ -195,7 +198,7 @@
}
return null;
- } catch (Exception x) {
+ } catch (CoreException x) {
//ignore
return null;
} finally {
@@ -247,14 +250,8 @@
token = scanner.nextToken();
}
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error while looking for style region " + styleName, x);
} finally {
- try {
reader.close();
- } catch (Exception x) {
- //ignore
- }
}
return null;
}
@@ -294,12 +291,12 @@
token = scanner.nextToken();
}
- } catch (Exception x) {
+ } catch (CoreException x) {
ExtensionsPlugin.getPluginLog().logError("Error while looking for style region ", x);
} finally {
try {
stream.close();
- } catch (Exception x) {
+ } catch (IOException x) {
//ignore
}
}
@@ -308,9 +305,7 @@
private List<Node> findStyleLinks (NodeList list) {
List<Node> styleLinks = new ArrayList<Node>();
- try {
for (int i = 0; list != null && i < list.getLength(); i++) {
- try {
IDOMElement element = (IDOMElement)list.item(i);
String axis = JSPRootHyperlinkPartitioner.computeAxis(getDocument(), element.getStartOffset());
axis = axis.toLowerCase();
@@ -338,16 +333,8 @@
if (add != null)
styleLinks.addAll(add);
}
- } catch (Exception x) {
- // Probably not an XMLElement
- //ignore
- }
}
return styleLinks;
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error while looking for style links", x);
- return null;
- }
}
protected IRegion getRegion (int offset) {
@@ -419,7 +406,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -34,6 +34,7 @@
import org.eclipse.jdt.internal.core.PackageFragmentRoot;
import org.eclipse.jdt.internal.core.SourceType;
import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -72,7 +73,7 @@
// could not open editor
openFileFailed();
}
- } catch (Exception x) {
+ } catch (CoreException x) {
// could not open editor
openFileFailed();
}
@@ -81,7 +82,7 @@
private String getClassName(IRegion region) {
try {
return getDocument().get(region.getOffset(), region.getLength());
- } catch (Exception x) {
+ } catch (BadLocationException x) {
return null;
} finally {
}
@@ -122,23 +123,18 @@
}
private String getQualifiedClassName(IJavaElement element) {
- try {
- String classQualifiedName = null;
- if (element instanceof SourceType || element instanceof BinaryType ) {
- classQualifiedName = element.getElementName();
+ String classQualifiedName = null;
+ if (element instanceof SourceType || element instanceof BinaryType ) {
+ classQualifiedName = element.getElementName();
+ }
+ while ( element != null && !(element instanceof PackageFragmentRoot)) {
+ element = element.getParent();
+ if (element instanceof PackageFragment) {
+ classQualifiedName = element.getElementName() + "." + classQualifiedName;
}
- while ( element != null && !(element instanceof PackageFragmentRoot)) {
- element = element.getParent();
- if (element instanceof PackageFragment) {
- classQualifiedName = element.getElementName() + "." + classQualifiedName;
- }
- }
-
- return classQualifiedName;
- } catch (Exception x) {
- //ignore
- return null;
}
+
+ return classQualifiedName;
}
private IJavaElement searchForClass(String className) {
@@ -168,7 +164,7 @@
IJavaProject javaProject = JavaCore.create(project);
return searchForClass(javaProject, className);
- } catch (Exception x) {
+ } catch (CoreException x) {
ExtensionsPlugin.getPluginLog().logError("Error while looking for class " + className, x);
return null;
}
@@ -269,7 +265,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -29,6 +29,7 @@
import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.jdt.core.search.SearchRequestor;
import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -77,7 +78,7 @@
} else {
openFileFailed();
}
- } catch (Exception x) {
+ } catch (CoreException x) {
openFileFailed();
}
}
@@ -129,7 +130,7 @@
if (propStart > offset || propStart + propLength < offset) return null;
IRegion region = new HyperlinkRegion(propStart, propLength);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
@@ -195,7 +196,7 @@
IJavaProject javaProject = JavaCore.create(project);
return searchForClassMethod(javaProject, className, methodName);
- } catch (Exception x) {
+ } catch (CoreException x) {
ExtensionsPlugin.getPluginLog().logError("Error while looking for method " + methodName + " of class " + className, x);
return null;
}
@@ -206,7 +207,7 @@
try {
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(getDocument(), attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
}
@@ -228,7 +229,7 @@
Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
return Utils.getTrimmedValue(getDocument(), attr);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkDetector.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkDetector.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkDetector.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -33,13 +33,11 @@
protected String[] getPartitionTypes(IDocument document, int offset) {
String documentRegionType = null;
ITypedRegion region = null;
- try {
+
region = (document instanceof IDocumentExtension3 ?
((IDocumentExtension3)document).getDocumentPartitioner("org.eclipse.wst.sse.core.default_structured_text_partitioning").getPartition(offset) :
document.getDocumentPartitioner().getPartition(offset));
- } catch (Exception x) {
- //ignore
- }
+
if (region != null) {
documentRegionType = region.getType();
} else {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerDefinition.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerDefinition.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerDefinition.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -132,7 +132,7 @@
public void run() {
try {
result[0] = element.createExecutableExtension(name);
- } catch (Exception e) {
+ } catch (CoreException e) {
handleCreateExecutableException(result, e);
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JumpToHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JumpToHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JumpToHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -13,11 +13,11 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLRootHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.util.RegionHolder;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
@@ -39,7 +39,6 @@
*/
protected void doHyperlink(IRegion region) {
- try {
RegionHolder holder = getRegionHolder(getName(region), region);
if (holder != null) {
StructuredSelectionHelper.setSelectionAndRevealInActiveEditor(holder.region);
@@ -47,16 +46,12 @@
openFileFailed();
}
- } catch (Exception x) {
- // could not open editor
- openFileFailed();
- }
}
protected String getName(IRegion region) {
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
}
@@ -74,9 +69,6 @@
if (xmlDocument == null) return null;
return xmlDocument.getChildNodes();
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -104,16 +96,12 @@
}
}
return null;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
}
protected String getElementText(Node element) {
- try {
if (element instanceof IDOMText)
return ((IDOMText)element).getData();
@@ -130,18 +118,13 @@
String result = text.toString();
if (result == null || result.length() == 0) return null;
return result;
- } catch (Exception x) {
- //ignore
- return null;
- }
+
}
protected List<Node> findElementsByAxis (NodeList list, String axis) {
String requiredAxis = axis.toLowerCase();
List<Node> elements = new ArrayList<Node>();
- try {
for (int i = 0; list != null && i < list.getLength(); i++) {
- try {
IDOMElement element = (IDOMElement)list.item(i);
String currentAxis = XMLRootHyperlinkPartitioner.computeAxis(getDocument(), element.getStartOffset()) + "/";
currentAxis = currentAxis.toLowerCase();
@@ -155,28 +138,16 @@
if (add != null)
elements.addAll(add);
}
- } catch (Exception x) {
- // Probably not an XMLElement
- //ignore
- }
+
}
return elements;
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in looking elements for axis " + axis, x);
- return null;
- }
}
/**
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
return getRegion(offset);
- } catch (Exception x) {
- //ignore
- return null;
- }
}
protected IRegion getRegion(int offset) {
@@ -236,15 +207,13 @@
return true;
}
};
-
return region;
- } catch (Exception x) {
- //ignore
- return null;
+ } catch (BadLocationException e) {
+ openFileFailed();
} finally {
smw.dispose();
}
-
+ return null;
}
/*
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,11 +10,12 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
-import java.io.FileNotFoundException;
import java.text.MessageFormat;
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.IRegion;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
@@ -44,9 +45,9 @@
IWorkbenchPage workbenchPage = ExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(workbenchPage,fileToOpen,true);
} else {
- throw new FileNotFoundException((fileToOpen == null ? "" : fileToOpen.toString()));
+ openFileFailed();
}
- } catch (Exception x) {
+ } catch (CoreException x) {
// could not open editor
openFileFailed();
}
@@ -55,11 +56,10 @@
private String getFilePath(IRegion region) {
try {
return getDocument().get(region.getOffset(), region.getLength());
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
- } finally {
- }
+ }
}
protected String updateFilenameForModel(String filename, IProject project) {
@@ -129,7 +129,7 @@
if (propStart > offset + 1 || propStart + propLength < offset) return null;
IRegion region = new HyperlinkRegion(propStart, propLength);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/RelativeLinkHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/RelativeLinkHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/RelativeLinkHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,11 +10,12 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
-import java.io.FileNotFoundException;
import java.text.MessageFormat;
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.IRegion;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
@@ -36,7 +37,6 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
-
try {
String fileName = getFilePath(region);
IFile fileToOpen = getFileFromProject(fileName);
@@ -44,9 +44,9 @@
IWorkbenchPage workbenchPage = ExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(workbenchPage,fileToOpen,true);
} else {
- throw new FileNotFoundException((fileToOpen == null ? "" : fileToOpen.toString()));
+ openFileFailed();
}
- } catch (Exception x) {
+ } catch (CoreException x) {
// could not open editor
openFileFailed();
}
@@ -55,11 +55,10 @@
private String getFilePath(IRegion region) {
try {
return getDocument().get(region.getOffset(), region.getLength());
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
- } finally {
- }
+ }
}
protected String updateFilenameForModel(String filename, IProject project) {
@@ -69,13 +68,8 @@
protected IFile getFileFromProject(String fileName) {
IFile documentFile = getFile();
- try {
IProject project = documentFile.getProject();
return super.getFileFromProject(updateFilenameForModel(fileName, project));
- } catch (Exception x) {
- //ignore
- return null;
- }
}
IRegion fLastRegion = null;
@@ -153,7 +147,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/TLDAttributeNameHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/TLDAttributeNameHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/TLDAttributeNameHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -52,38 +52,29 @@
return null;
return tagElement.getChildNodes();
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
}
private boolean validAxis(Node n, String validAxisEnding) {
- try {
- if (validAxisEnding == null || validAxisEnding.lastIndexOf('/') == -1) return false;
- StringTokenizer st = new StringTokenizer(validAxisEnding, "/");
- List<String> tokens = new ArrayList<String>();
- while (st.hasMoreTokens()) {
- tokens.add(st.nextToken());
- }
- if (tokens.size() == 0) return false;
- Node currentElement = n;
- for (int i = tokens.size() - 1; i >= 0; i--) {
- if (currentElement == null || !(currentElement instanceof Element))
- return false;
- String token = (String)tokens.get(i);
- if (!token.equals(currentElement.getNodeName()))
- return false;
- currentElement = currentElement.getParentNode();
- }
- return true;
-
- } catch (Exception x) {
- //ignore
- return false;
+ if (validAxisEnding == null || validAxisEnding.lastIndexOf('/') == -1) return false;
+ StringTokenizer st = new StringTokenizer(validAxisEnding, "/");
+ List<String> tokens = new ArrayList<String>();
+ while (st.hasMoreTokens()) {
+ tokens.add(st.nextToken());
}
+ if (tokens.size() == 0) return false;
+ Node currentElement = n;
+ for (int i = tokens.size() - 1; i >= 0; i--) {
+ if (currentElement == null || !(currentElement instanceof Element))
+ return false;
+ String token = (String)tokens.get(i);
+ if (!token.equals(currentElement.getNodeName()))
+ return false;
+ currentElement = currentElement.getParentNode();
+ }
+ return true;
}
/*
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/XModelBasedHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/XModelBasedHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/XModelBasedHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -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.IRegion;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.project.IPromptingProvider;
@@ -38,7 +39,6 @@
XModel xModel = getXModel(documentFile);
if (xModel == null) return;
- try {
IPromptingProvider provider = PromptingProviderFactory.WEB;
Properties p = getRequestProperties(region);
@@ -53,9 +53,6 @@
if ( error != null && error.length() > 0) {
openFileFailed();
}
- } catch (Exception x) {
- openFileFailed();
- }
}
protected abstract String getRequestMethod();
@@ -133,7 +130,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -12,11 +12,12 @@
import java.text.MessageFormat;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.ClassMethodHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
@@ -91,7 +92,7 @@
} else {
openFileFailed();
}
- } catch (Exception x) {
+ } catch (CoreException x) {
openFileFailed();
}
}
@@ -113,9 +114,6 @@
element = findElementByIDBackward(xmlDocument.getChildNodes(), id, endOffset, tagname);
}
return element;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -130,7 +128,6 @@
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;
@@ -151,13 +148,8 @@
Element child = findElementByIDBackward(element.getChildNodes(), id, endOffset, tagName);
if (child != null) return child;
}
- } catch (Exception x) {
- // Probably not an XMLElement
- //ignore
- }
+
}
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in finding element by id " + id, x);
} finally {
smw.dispose();
}
@@ -167,7 +159,7 @@
String getPropertyName(IRegion region) {
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
}
@@ -187,9 +179,6 @@
Node node = ((Attr)n).getOwnerElement();
return getAttributeValue(node, NAME_ATTRNAME);
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -53,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -87,9 +84,6 @@
return false;
return true;
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -51,9 +51,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -85,9 +82,6 @@
return false;
return true;
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPCSSClassHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPCSSClassHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPCSSClassHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.jsp;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -50,9 +51,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -107,7 +105,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPElementNameHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPElementNameHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPElementNameHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -39,14 +39,11 @@
*/
protected void doHyperlink(IRegion region) {
- try {
- XModelObject object = getFilename(region);
- if(object != null) FindObjectHelper.findModelObject(object, FindObjectHelper.IN_EDITOR_ONLY);
-
- } catch (Exception x) {
- // could not open editor
- openFileFailed();
+ XModelObject object = getFilename(region);
+ if(object != null) {
+ FindObjectHelper.findModelObject(object, FindObjectHelper.IN_EDITOR_ONLY);
}
+
}
protected final String JAR_FILE_PROTOCOL = "jar:file:/";//$NON-NLS-1$
@@ -93,15 +90,8 @@
ITaglibMapping tm = wp.getTaglibMapping();
if (tm == null) return null;
- try {
- tm.invalidate();
- } catch (Exception x) {
- //ignore
- }
+ tm.invalidate();
return tm.getTaglibObject(uri);
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in getting file name from region", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPElementNameHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPElementNameHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPElementNameHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -57,9 +57,6 @@
Map trackers = JSPRootHyperlinkPartitioner.getTrackersMap(document, region.getOffset());
return (trackers != null && trackers.containsKey(nodePrefix));
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPForBeanIdHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPForBeanIdHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPForBeanIdHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -12,9 +12,9 @@
import java.text.MessageFormat;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
@@ -39,7 +39,6 @@
*/
protected void doHyperlink(IRegion region) {
- try {
String forID = getForId(region);
IRegion elementByID = findElementByIDBackward(forID, region.getOffset(), USEBEAN_TAGNAME);
if (elementByID != null) {
@@ -47,9 +46,6 @@
} else {
openFileFailed();
}
- } catch (Exception x) {
- openFileFailed();
- }
}
private IRegion findElementByIDBackward (String id, int endOffset, String tagname) {
@@ -96,9 +92,6 @@
return "IRegion [" + getOffset() +", " + getLength()+ "]";
}
};
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -113,7 +106,6 @@
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;
@@ -134,14 +126,7 @@
Element child = findElementByIDBackward(element.getChildNodes(), id, endOffset, tagName);
if (child != null) return child;
}
- } catch (Exception x) {
- // Probably not an XMLElement
- //ignore
- }
}
- } catch (Exception x) {
- Exception e = x instanceof Exception ? (Exception)x : new Exception(x);
- ExtensionsPlugin.getPluginLog().logError(e);
} finally {
smw.dispose();
}
@@ -152,7 +137,7 @@
String getForId(IRegion region) {
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
}
@@ -232,7 +217,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPForBeanIdHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPForBeanIdHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPForBeanIdHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.jsp;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -50,9 +51,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -107,7 +105,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -19,13 +19,6 @@
import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
@@ -36,6 +29,11 @@
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.web.tld.ITaglibMapping;
import org.jboss.tools.jst.web.tld.WebProjectFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -100,7 +98,6 @@
public static String extractName (String name, Map trackersMap, ITaglibMapping tm) {
if (trackersMap == null || trackersMap.size() == 0) return name;
if (name == null) return null;
- try {
int column = name.indexOf(":");
if (column == -1) return name;
String prefix = name.substring(0, column);
@@ -112,10 +109,6 @@
String resolvedUri = (tm == null ? uri : tm.resolveURI(uri));
return "[" + resolvedUri + "]" + name.substring(column);
- } catch (Exception x) {
- //ignore
- return name;
- }
}
public static Map getTrackersMap(IDocument document, int offset) {
@@ -144,10 +137,6 @@
map = addAlternativeTrackersMap(map, document, offset);
return map;
- } catch (Exception x) {
- //ignore
- //TODO narrow catch after study
- return null;
} finally {
smw.dispose();
}
@@ -189,9 +178,6 @@
}
return map;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -212,9 +198,6 @@
if (n == null) return false;
return true;
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPXmlNsHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPXmlNsHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPXmlNsHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -20,7 +20,6 @@
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.FindObjectHelper;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
@@ -42,14 +41,8 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
-
- try {
XModelObject object = getFilename(region);
if(object != null) FindObjectHelper.findModelObject(object, FindObjectHelper.IN_EDITOR_ONLY);
- } catch (Exception x) {
- // could not open editor
- openFileFailed();
- }
}
protected final String JAR_FILE_PROTOCOL = "jar:file:/";//$NON-NLS-1$
@@ -58,7 +51,6 @@
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlink#openFileInEditor(java.lang.String)
*/
protected void openFileInEditor(String fileString) {
- try {
if (fileString.startsWith(JAR_FILE_PROTOCOL)) {
fileString = fileString.substring(JAR_FILE_PROTOCOL.length());
IEditorInput jarEditorInput = createEditorInput(fileString);
@@ -67,9 +59,6 @@
} else {
super.openFileInEditor(fileString);
}
- } catch (Exception x) {
- openFileFailed();
- }
}
private XModelObject getFilename(IRegion region) {
@@ -99,9 +88,6 @@
ITaglibMapping tm = wp.getTaglibMapping();
if (tm == null) return null;
return tm.getTaglibObject(uri);
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in obtaining file name from region", x);
- return null;
} finally {
smw.dispose();
}
@@ -129,9 +115,6 @@
if (uri == null || uri.trim().length() == 0) return null;
return uri;
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in obtaining file name from region", x);
- return null;
} finally {
smw.dispose();
}
@@ -185,9 +168,6 @@
};
return region;
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in obtaining region", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPXmlNsHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPXmlNsHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPXmlNsHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -12,18 +12,16 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -56,9 +54,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in parsing region", x);
- return null;
} finally {
smw.dispose();
}
@@ -82,9 +77,6 @@
Element rootElem = xmlnsAttr.getOwnerElement();
if (!(rootElem.getNodeName().equals("jsp:root") || rootElem.getNodeName().equalsIgnoreCase("html"))) return false;
return true;
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -51,9 +52,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -99,7 +97,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLContextParamLinkHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLContextParamLinkHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLContextParamLinkHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Document;
@@ -51,9 +52,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -121,7 +119,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,17 +10,16 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
-import org.eclipse.jdt.internal.core.ModelUpdater;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
+import org.jboss.tools.common.text.ext.ExtensionsPlugin;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Node;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-
public class XMLDoctypeHyperlink extends XMLXmlNsHyperlink {
protected IRegion getRegion(int offset) {
@@ -44,7 +43,7 @@
String text = "";
try {
text = getDocument().get(start, end - start);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
ExtensionsPlugin.getPluginLog().logError(x);
};
String publicId = (node.getPublicId() == null ? "" : node.getPublicId());
@@ -100,9 +99,6 @@
}
};
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -123,13 +119,9 @@
DocumentType node = (DocumentType)n;
return node.getPublicId();
- } catch (Exception x) {
- //ignore
} finally {
smw.dispose();
}
-
- return null;
}
protected String getSystemId(IRegion region) {
@@ -146,13 +138,9 @@
DocumentType node = (DocumentType)n;
return node.getSystemId();
- } catch (Exception x) {
- //ignore
} finally {
smw.dispose();
}
-
- return null;
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -54,9 +54,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -74,9 +71,6 @@
return "/@DOCTYPE/" + node.getNodeName() + "/";
}
return Utils.getParentAxisForNode(xmlDocument, node);
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -96,9 +90,6 @@
if (!(n instanceof DocumentType)) return false;
return true;
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -56,9 +56,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -78,9 +75,6 @@
if (!(n instanceof Attr || n instanceof Element)) return false;
return true;
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementNameHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementNameHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementNameHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -12,16 +12,14 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -52,9 +50,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error while parsing region", x);
- return null;
} finally {
smw.dispose();
}
@@ -80,9 +75,6 @@
IHyperlinkRegion region = new HyperlinkRegion(nameStart, nameEnd - nameStart, null, null, null);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -108,9 +100,6 @@
int nameStart = start + (elem.isEndTag() ? "<" : "</").length();
int nameEnd = nameStart + tagName.length();
return (region.getOffset() > nameStart && region.getOffset() <= nameEnd);
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLJumpToHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLJumpToHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLJumpToHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -14,6 +14,7 @@
import java.util.List;
import java.util.StringTokenizer;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Document;
@@ -61,9 +62,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -129,7 +127,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
@@ -143,7 +141,6 @@
}
private boolean validAxis(Node n, String validAxisEnding) {
- try {
if (validAxisEnding == null || validAxisEnding.lastIndexOf('/') == -1) return false;
StringTokenizer st = new StringTokenizer(validAxisEnding, "/");
List<String> tokens = new ArrayList<String>();
@@ -161,11 +158,6 @@
currentElement = currentElement.getParentNode();
}
return true;
-
- } catch (Exception x) {
- //ignore
- return false;
- }
}
/**
@@ -189,9 +181,6 @@
return true;
}
return false;
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLLinkHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLLinkHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLLinkHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
@@ -51,8 +52,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- return null;
} finally {
smw.dispose();
}
@@ -129,7 +128,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
return null;
} finally {
smw.dispose();
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLRootHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLRootHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLRootHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -14,18 +14,16 @@
import java.util.Map;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -76,8 +74,6 @@
parent = parent.getParentNode();
}
}
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError(x);
} finally {
smw.dispose();
}
@@ -89,19 +85,15 @@
public static String extractName (String name, Map trackersMap) {
if (trackersMap == null || trackersMap.size() == 0) return name;
if (name == null) return null;
- try {
- int column = name.indexOf(":");
- if (column == -1) return name;
- String prefix = name.substring(0, column);
- if (prefix == null || prefix.trim().length() == 0) return name;
-
- String uri = (String)trackersMap.get(prefix);
- if (uri == null || uri.length() == 0) return name;
-
- return "[" + uri + "]" + name.substring(column);
- } catch (Exception x) {
- return name;
- }
+ int column = name.indexOf(":");
+ if (column == -1) return name;
+ String prefix = name.substring(0, column);
+ if (prefix == null || prefix.trim().length() == 0) return name;
+
+ String uri = (String)trackersMap.get(prefix);
+ if (uri == null || uri.length() == 0) return name;
+
+ return "[" + uri + "]" + name.substring(column);
}
/**
@@ -117,8 +109,6 @@
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
return n != null;
- } catch (Exception x) {
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTagAttributeValueHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTagAttributeValueHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTagAttributeValueHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
@@ -48,9 +49,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -116,7 +114,7 @@
}
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
//ignore
return null;
} finally {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -53,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -73,9 +70,6 @@
Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
return (n != null && n instanceof Text);
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlink.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlink.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -12,8 +12,10 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.StringTokenizer;
@@ -25,6 +27,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.pde.internal.ui.editor.JarEntryEditorInput;
import org.eclipse.pde.internal.ui.editor.JarEntryFile;
@@ -107,7 +110,7 @@
public InputStream getContents() throws CoreException {
try {
return new FileInputStream(fFile);
- } catch (Exception x) {
+ } catch (FileNotFoundException x) {
//ignore
return null;
}
@@ -155,22 +158,19 @@
String uri = getURI(region);
if (uri != null && uri.toLowerCase().startsWith("http:")) {
URL url = null;
- try {
- url = new URL(uri);
- IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
- IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null);
- browser.openURL(url);
- } catch (Exception e) {
- openFileFailed();
- }
-
- } else
+ url = new URL(uri);
+ IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
+ IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null);
+ browser.openURL(url);
+ } else {
openFileFailed();
+ }
}
-
- } catch (Exception x) {
+ } catch (MalformedURLException x) {
// could not open editor
openFileFailed();
+ } catch (PartInitException x) {
+ openFileFailed();
}
}
@@ -207,23 +207,19 @@
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlink#openFileInEditor(java.lang.String)
*/
protected void openFileInEditor(String fileString) {
- try {
- if (fileString.startsWith(JAR_FILE_PROTOCOL)) {
- fileString = fileString.substring(JAR_FILE_PROTOCOL.length());
- IEditorInput jarEditorInput = createEditorInput(fileString);
+ if (fileString.startsWith(JAR_FILE_PROTOCOL)) {
+ fileString = fileString.substring(JAR_FILE_PROTOCOL.length());
+ IEditorInput jarEditorInput = createEditorInput(fileString);
+ IEditorPart part = openFileInEditor(jarEditorInput, fileString);
+ if (part == null) openFileFailed();
+ } else if (fileString.startsWith(JAR_FILE)) {
+ fileString = fileString.substring(JAR_FILE.length());
+ IEditorInput jarEditorInput = createEditorInputAlternate(fileString);
IEditorPart part = openFileInEditor(jarEditorInput, fileString);
if (part == null) openFileFailed();
- } else if (fileString.startsWith(JAR_FILE)) {
- fileString = fileString.substring(JAR_FILE.length());
- IEditorInput jarEditorInput = createEditorInputAlternate(fileString);
- IEditorPart part = openFileInEditor(jarEditorInput, fileString);
- if (part == null) openFileFailed();
- } else {
- super.openFileInEditor(fileString);
- }
- } catch (Exception x) {
- openFileFailed();
- }
+ } else {
+ super.openFileInEditor(fileString);
+ }
}
protected IEditorInput createEditorInputAlternate(String fileString) {
@@ -240,8 +236,7 @@
JarEntryEditorInput jarEditorInput = new JarEntryEditorInput(jarEntryFile) {
public boolean equals(Object arg) {
- try {return this.toString().equals(arg.toString());}
- catch (Exception x) {return false;}
+ return this.toString().equals(arg.toString());
}
};
return jarEditorInput;
@@ -250,38 +245,28 @@
String getURI(IRegion region) {
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
- //ignore
+ } catch (BadLocationException x) {
return null;
}
+
}
protected String getPublicId(IRegion region) {
- try {
- String text = getURI(region);
- if (text == null) return null;
- int spacer = text.indexOf(" ");
- if (spacer == -1) spacer = text.indexOf("\t");
- return (spacer == -1 ? text : text.substring(0, spacer));
- } catch (Exception x) {
- //ignore
- return null;
- }
+ String text = getURI(region);
+ if (text == null) return null;
+ int spacer = text.indexOf(" ");
+ if (spacer == -1) spacer = text.indexOf("\t");
+ return (spacer == -1 ? text : text.substring(0, spacer));
}
protected String getSystemId(IRegion region) {
- try {
- String text = getURI(region);
- if (text == null) return null;
- int spacer = text.indexOf(" ");
- if (spacer == -1) spacer = text.indexOf("\t");
- if (spacer == -1) spacer = 0;
-
- return text.substring(spacer).trim();
- } catch (Exception x) {
- //ignore
- return null;
- }
+ String text = getURI(region);
+ if (text == null) return null;
+ int spacer = text.indexOf(" ");
+ if (spacer == -1) spacer = text.indexOf("\t");
+ if (spacer == -1) spacer = 0;
+
+ return text.substring(spacer).trim();
}
private String getMappedSystemIdFromCatalog(String publicId, String systemId) {
@@ -293,8 +278,8 @@
mappedSystemId = XMLCorePlugin.getDefault().getDefaultXMLCatalog().resolveSystem(systemId);
if (mappedSystemId == null && systemId != null)
mappedSystemId = XMLCorePlugin.getDefault().getDefaultXMLCatalog().resolveURI(systemId);
- } catch (Exception e) {
- // Ignore, just return null as result
+ } catch (IOException e) {
+ return null;
}
return mappedSystemId;
}
@@ -308,8 +293,8 @@
fileName = file.getAbsolutePath();
}
}
- } catch (Exception x) {
- //ignore
+ } catch (MalformedURLException x) {
+ return null;
}
return fileName;
}
@@ -386,10 +371,6 @@
};
return region;
-
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error while obtaining region", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlinkPartitioner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlinkPartitioner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -11,22 +11,17 @@
package org.jboss.tools.common.text.ext.hyperlink.xml;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -61,9 +56,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error while parsing region", x);
- return null;
} finally {
smw.dispose();
}
@@ -91,9 +83,6 @@
Element rootElement = xmlnsAttr.getOwnerElement();
if(!(rootElement instanceof IDOMElement)) return false;
return true;
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/HyperlinkDefinition.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/HyperlinkDefinition.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/HyperlinkDefinition.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -137,8 +137,7 @@
public void run() {
try {
result[0] = element.createExecutableExtension(name);
- }
- catch (Exception e) {
+ } catch (CoreException e) {
handleCreateExecutableException(result, e);
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredModelWrapper.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredModelWrapper.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredModelWrapper.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -15,7 +15,6 @@
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/StructuredSelectionHelper.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -18,8 +18,6 @@
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
-
-import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.IEditorWrapper;
import org.jboss.tools.common.text.ext.IMultiPageEditor;
@@ -30,22 +28,13 @@
public class StructuredSelectionHelper {
public static IndexedRegion getSourceElement(StructuredTextEditor editor, int offset) {
- try {
- return editor.getModel().getIndexedRegion(offset);
- } catch (Exception x) {
- return null;
- }
+ return editor.getModel().getIndexedRegion(offset);
}
public static void setSelectionAndRevealInActiveEditor(IRegion region) {
- try {
- setSelectionAndReveal(null, region);
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in setting selection to active text editor", x);
- }
+ setSelectionAndReveal(null, region);
}
public static StructuredTextEditor getStructuredTextEditor (IEditorPart editorPart) {
- try {
IEditorPart activeEditorPart = editorPart;
if (activeEditorPart == null) {
IWorkbenchPage workbenchPage = ExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
@@ -58,29 +47,22 @@
IEditorWrapper editorPartWraper = (IEditorWrapper)activeEditorPart;
return getStructuredTextEditor(editorPartWraper.getEditor());
} else if (activeEditorPart instanceof StructuredTextEditor) {
- return (StructuredTextEditor)activeEditorPart;
-
+ return (StructuredTextEditor)activeEditorPart;
}
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in obtaining structured text editor", x);
- }
+
return null;
}
public static void setSelectionAndReveal(IEditorPart editorPart, IRegion region) {
- try {
- StructuredTextEditor sourceEditor = getStructuredTextEditor(editorPart);
- if (sourceEditor == null) {
- if (editorPart instanceof ITextEditor) {
- ((ITextEditor)editorPart).selectAndReveal(region.getOffset(), region.getLength());
- }
- return;
+ StructuredTextEditor sourceEditor = getStructuredTextEditor(editorPart);
+ if (sourceEditor == null) {
+ if (editorPart instanceof ITextEditor) {
+ ((ITextEditor)editorPart).selectAndReveal(region.getOffset(), region.getLength());
}
- ISelectionProvider provider = sourceEditor.getSelectionProvider();
- provider.setSelection(new TextSelection(region.getOffset(), region.getLength()));
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in setting selection", x);
+ return;
}
+ ISelectionProvider provider = sourceEditor.getSelectionProvider();
+ provider.setSelection(new TextSelection(region.getOffset(), region.getLength()));
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/TextScanner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/TextScanner.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/TextScanner.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -11,6 +11,7 @@
package org.jboss.tools.common.text.ext.util;
import java.io.BufferedReader;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
@@ -129,7 +130,7 @@
} else {
try {
ch = reader.read();
- } catch (Exception x) {
+ } catch (IOException x) {
return ICharacterScanner.EOF;
}
if ( ch == -1 ) return ICharacterScanner.EOF;
@@ -258,7 +259,7 @@
length--;
}
return d.get(0, length);
- } catch (Exception ex) {
+ } catch (BadLocationException ex) {
return text;
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/Utils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/Utils.java 2008-07-23 22:58:18 UTC (rev 9256)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/Utils.java 2008-07-24 00:31:39 UTC (rev 9257)
@@ -19,7 +19,6 @@
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -39,25 +38,20 @@
int bEnd = word.length() - 1;
StringBuffer sb = new StringBuffer(attrText);
- try {
- //find start and end of path property
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
- bStart++;
- }
- while (bEnd >= 0 &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
- bEnd--;
- }
- bEnd++;
- if (bEnd < bStart) bEnd = bStart;
- return sb.substring(bStart, bEnd);
- } catch (Exception x) {
- //TODO remove that catch after study safety of code
- return word;
- }
+ //find start and end of path property
+ while (bStart < bEnd &&
+ (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
+ Character.isWhitespace(sb.charAt(bStart)))) {
+ bStart++;
+ }
+ while (bEnd >= 0 &&
+ (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
+ Character.isWhitespace(sb.charAt(bEnd)))) {
+ bEnd--;
+ }
+ bEnd++;
+ if (bEnd < bStart) bEnd = bStart;
+ return sb.substring(bStart, bEnd);
}
static public Node findNodeForOffset(Node node, int offset) {
16 years, 5 months
JBoss Tools SVN: r9256 - in trunk/portlet/plugins/org.jboss.tools.portlet.core: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-07-23 18:58:18 -0400 (Wed, 23 Jul 2008)
New Revision: 9256
Added:
trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/project/facet/PortletConfigurationPresetFactory10.java
Removed:
trunk/portlet/plugins/org.jboss.tools.portlet.core/resources/portlet/1.0/portal-common-lib.jar
trunk/portlet/plugins/org.jboss.tools.portlet.core/resources/portlet/2.0/portal-common-lib.jar
Modified:
trunk/portlet/plugins/org.jboss.tools.portlet.core/META-INF/MANIFEST.MF
trunk/portlet/plugins/org.jboss.tools.portlet.core/plugin.xml
trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/IPortletConstants.java
Log:
JBIDE-2233 Ability to create a new "Portlet" project - Thomas's suggestions
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/META-INF/MANIFEST.MF 2008-07-23 22:58:08 UTC (rev 9255)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/META-INF/MANIFEST.MF 2008-07-23 22:58:18 UTC (rev 9256)
@@ -11,7 +11,9 @@
org.eclipse.wst.common.frameworks,
org.eclipse.jst.j2ee,
org.eclipse.jdt.core,
- org.jboss.ide.eclipse.as.classpath.core
+ org.jboss.ide.eclipse.as.classpath.core,
+ org.eclipse.jst.j2ee.web,
+ org.eclipse.jst.common.frameworks
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.portlet.core,
org.jboss.tools.portlet.core.internal,
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.core/plugin.xml
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/plugin.xml 2008-07-23 22:58:08 UTC (rev 9255)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/plugin.xml 2008-07-23 22:58:18 UTC (rev 9256)
@@ -53,13 +53,9 @@
<extension
point="org.eclipse.wst.common.project.facet.core.presets">
- <static-preset id="preset.jboss.portlet.v10">
- <label>Portlet Project v1.0</label>
- <facet id="jst.java" version="5.0" />
- <facet id="jst.web" version="2.3"/>
- <facet id="jboss.portlet" version="1.0" />
- <description>Portlet Project v1.0</description>
- </static-preset>
+ <dynamic-preset id="preset.jboss.portlet.v10">
+ <factory class="org.jboss.tools.portlet.core.internal.project.facet.PortletConfigurationPresetFactory10"/>
+ </dynamic-preset>
</extension>
<extension point="org.eclipse.wst.common.project.facet.core.runtimes">
Deleted: trunk/portlet/plugins/org.jboss.tools.portlet.core/resources/portlet/1.0/portal-common-lib.jar
===================================================================
(Binary files differ)
Deleted: trunk/portlet/plugins/org.jboss.tools.portlet.core/resources/portlet/2.0/portal-common-lib.jar
===================================================================
(Binary files differ)
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/IPortletConstants.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/IPortletConstants.java 2008-07-23 22:58:08 UTC (rev 9255)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/IPortletConstants.java 2008-07-23 22:58:18 UTC (rev 9256)
@@ -33,4 +33,6 @@
static final String PORTLET_INSTANCES_FILE = "WEB-INF/portlet-instances.xml";
+ static final String PORTLET_OBJECT_FILE = "WEB-INF/default-object.xml";
+
}
Added: trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/project/facet/PortletConfigurationPresetFactory10.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/project/facet/PortletConfigurationPresetFactory10.java (rev 0)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.core/src/org/jboss/tools/portlet/core/internal/project/facet/PortletConfigurationPresetFactory10.java 2008-07-23 22:58:18 UTC (rev 9256)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * Copyright (c) 2008 BEA Systems, Inc. and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Konstantin Komissarchik
+ ******************************************************************************/
+
+package org.jboss.tools.portlet.core.internal.project.facet;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jst.common.project.facet.JavaFacetUtils;
+import org.eclipse.jst.j2ee.web.project.facet.WebFacetUtils;
+import org.eclipse.wst.common.project.facet.core.IDynamicPreset;
+import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
+import org.eclipse.wst.common.project.facet.core.IPresetFactory;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.PresetDefinition;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.portlet.core.IPortletConstants;
+
+/**
+ * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a>
+ * @author snjeza
+ */
+
+public final class PortletConfigurationPresetFactory10
+
+implements IPresetFactory {
+ public PresetDefinition createPreset(final String presetId,
+ final Map<String, Object> context)
+
+ throws CoreException {
+ final IFacetedProjectBase fproj = (IFacetedProjectBase) context
+ .get(IDynamicPreset.CONTEXT_KEY_FACETED_PROJECT);
+ final IProjectFacetVersion webFacetVersion = fproj
+ .getProjectFacetVersion(WebFacetUtils.WEB_FACET);
+ if (webFacetVersion != null
+ && webFacetVersion.compareTo(WebFacetUtils.WEB_23) >= 0) {
+ final Set<IProjectFacetVersion> facets = new HashSet<IProjectFacetVersion>();
+ final IProjectFacet portletFacet = ProjectFacetsManager
+ .getProjectFacet(IPortletConstants.PORTLET_FACET_ID);
+ final IProjectFacetVersion portletFacetVersion10 = portletFacet
+ .getVersion(IPortletConstants.PORTLET_FACET_VERSION_10);
+ facets.add(portletFacetVersion10);
+ facets.add(webFacetVersion);
+ facets.add(JavaFacetUtils.JAVA_50);
+ return new PresetDefinition("Portlet Project v1.0",
+ "Portlet Project v1.0", facets);
+ }
+ return null;
+ }
+}
16 years, 5 months
JBoss Tools SVN: r9255 - in trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet: ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-07-23 18:58:08 -0400 (Wed, 23 Jul 2008)
New Revision: 9255
Modified:
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/operations/AddPortletOperation.java
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/INewPortletClassDataModelProperties.java
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/IPortletUIConstants.java
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/AddJBossPortletWizardPage.java
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassDataModelProvider.java
trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassOptionsWizardPage.java
Log:
JBIDE-2233 Ability to create a new "Portlet" project - Thomas's suggestions
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/operations/AddPortletOperation.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/operations/AddPortletOperation.java 2008-07-23 21:47:32 UTC (rev 9254)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/operations/AddPortletOperation.java 2008-07-23 22:58:08 UTC (rev 9255)
@@ -13,6 +13,7 @@
import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.PAGE_REGION;
import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.PARENT_PORTAL;
import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.PORTLET_HEIGHT;
+import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.ADD_PORTLET;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -63,13 +64,16 @@
protected void generateMetaData(IDataModel aModel, String qualifiedClassName) {
// update the portlet.xml file
- updatePortletXml(aModel);
+ updatePortletXml(aModel);
- // generate/update portlet-instances.xml
- updatePortletInstance(aModel);
-
- // generate/update *.object.xml
- updatePortletObject(aModel);
+ boolean addPortlet = model.getBooleanProperty(ADD_PORTLET);
+ if (addPortlet) {
+ // generate/update portlet-instances.xml
+ updatePortletInstance(aModel);
+
+ // generate/update *.object.xml
+ updatePortletObject(aModel);
+ }
}
private void updatePortletObject(IDataModel model) {
@@ -82,12 +86,10 @@
String region = model.getStringProperty(PAGE_REGION);
String height = model.getStringProperty(PORTLET_HEIGHT);
- String fileName = name.toLowerCase() + "-object.xml";
-
IProject project = getTargetProject();
IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFile portletVirtualFile = component.getRootFolder().getFolder("WEB-INF").getFile(
- fileName);
+ IVirtualFile portletVirtualFile = component.getRootFolder().getFile(
+ IPortletConstants.PORTLET_OBJECT_FILE);
if (!portletVirtualFile.getUnderlyingFile().exists()) {
try {
@@ -136,6 +138,7 @@
}
private void updatePortletInstance(IDataModel model) {
+
String name = model.getStringProperty(NAME);
String instanceId = model.getStringProperty(INSTANCE_NAME);
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/INewPortletClassDataModelProperties.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/INewPortletClassDataModelProperties.java 2008-07-23 21:47:32 UTC (rev 9254)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/INewPortletClassDataModelProperties.java 2008-07-23 22:58:08 UTC (rev 9255)
@@ -41,4 +41,6 @@
static final String IF_EXISTS = "NewPortletClassDataModel.IF_EXISTS";
+ static final String ADD_PORTLET = "NewPortletClassDataModel.ADD_PORTLET";
+
}
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/IPortletUIConstants.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/IPortletUIConstants.java 2008-07-23 21:47:32 UTC (rev 9254)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/IPortletUIConstants.java 2008-07-23 22:58:08 UTC (rev 9255)
@@ -51,6 +51,7 @@
static final String RENDER_SIGNATURE = "(Ljavax/portlet/RenderRequest;Ljavax/portlet/RenderResponse;)V"; //$NON-NLS-1$
static final String PROCESS_ACTION_SIGNATURE = "(Ljavax/portlet/ActionRequest;Ljavax/portlet/ActionResponse;)V"; //$NON-NLS-1$
+ static final String ADD_PORTLET_LABEL = "Create Portlet Instance";
static final String INSTANCE_NAME_LABEL = "Instance Name:";
static final String WINDOW_NAME_LABEL = "Window Name:";
static final String PARENT_PORTAL_LABEL = "Parent Reference:";
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/AddJBossPortletWizardPage.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/AddJBossPortletWizardPage.java 2008-07-23 21:47:32 UTC (rev 9254)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/AddJBossPortletWizardPage.java 2008-07-23 22:58:08 UTC (rev 9255)
@@ -23,6 +23,7 @@
import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.INSTANCE_NAME;
import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.WINDOW_NAME;
import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.IF_EXISTS;
+import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.ADD_PORTLET;
import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.PAGE_REGION;
import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.PARENT_PORTAL;
import static org.jboss.tools.portlet.ui.INewPortletClassDataModelProperties.PORTLET_HEIGHT;
@@ -33,6 +34,7 @@
import static org.jboss.tools.portlet.ui.IPortletUIConstants.PAGE_REGION_LABEL;
import static org.jboss.tools.portlet.ui.IPortletUIConstants.PARENT_PORTAL_LABEL;
import static org.jboss.tools.portlet.ui.IPortletUIConstants.PORTLET_HEIGHT_LABEL;
+import static org.jboss.tools.portlet.ui.IPortletUIConstants.ADD_PORTLET_LABEL;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jem.util.emf.workbench.ProjectUtilities;
@@ -44,6 +46,7 @@
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -112,11 +115,18 @@
composite.setLayout(new GridLayout(2, false));
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ final Button addPortlet = new Button(composite,SWT.CHECK);
+ addPortlet.setText(ADD_PORTLET_LABEL);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gd.horizontalSpan = 2;
+ addPortlet.setLayoutData(gd);
+ synchHelper.synchCheckbox(addPortlet, ADD_PORTLET, null);
+
// if exists
Label ifExistsLabel = new Label(composite, SWT.LEFT);
ifExistsLabel.setText(IF_EXISTS_LABEL);
ifExistsLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- Combo ifExistsCombo = new Combo(composite,SWT.NONE);
+ final Combo ifExistsCombo = new Combo(composite,SWT.NONE);
ifExistsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ifExistsCombo.setItems(new String[] {"overwrite","keep"});
synchHelper.synchCombo(ifExistsCombo, IF_EXISTS, null);
@@ -125,7 +135,7 @@
Label instanceNameLabel = new Label(composite, SWT.LEFT);
instanceNameLabel.setText(INSTANCE_NAME_LABEL);
instanceNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- Text instanceNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ final Text instanceNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
instanceNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
synchHelper.synchText(instanceNameText, INSTANCE_NAME, null);
@@ -133,7 +143,7 @@
Label windowNameLabel = new Label(composite, SWT.LEFT);
windowNameLabel.setText(WINDOW_NAME_LABEL);
windowNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- Text windowNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ final Text windowNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
windowNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
synchHelper.synchText(windowNameText, WINDOW_NAME, null);
@@ -141,7 +151,7 @@
Label parentReferenceLabel = new Label(composite, SWT.LEFT);
parentReferenceLabel.setText(PARENT_PORTAL_LABEL);
parentReferenceLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- Text parentReferenceText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ final Text parentReferenceText = new Text(composite, SWT.SINGLE | SWT.BORDER);
parentReferenceText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
synchHelper.synchText(parentReferenceText, PARENT_PORTAL, null);
@@ -149,7 +159,7 @@
Label regionLabel = new Label(composite, SWT.LEFT);
regionLabel.setText(PAGE_REGION_LABEL);
regionLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- Text regionText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ final Text regionText = new Text(composite, SWT.SINGLE | SWT.BORDER);
regionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
synchHelper.synchText(regionText, PAGE_REGION, null);
@@ -157,10 +167,31 @@
Label heightLabel = new Label(composite, SWT.LEFT);
heightLabel.setText(PORTLET_HEIGHT_LABEL);
heightLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
- Text heightText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ final Text heightText = new Text(composite, SWT.SINGLE | SWT.BORDER);
heightText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
synchHelper.synchText(heightText, PORTLET_HEIGHT, null);
+ addPortlet.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //enableComponents();
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ enableComponents();
+ }
+
+ private void enableComponents() {
+ boolean enable = addPortlet.getSelection();
+ ifExistsCombo.setEnabled(enable);
+ instanceNameText.setEnabled(enable);
+ windowNameText.setEnabled(enable);
+ parentReferenceText.setEnabled(enable);
+ regionText.setEnabled(enable);
+ heightText.setEnabled(enable);
+ }
+ });
+
}
public boolean canFlipToNextPage() {
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassDataModelProvider.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassDataModelProvider.java 2008-07-23 21:47:32 UTC (rev 9254)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassDataModelProvider.java 2008-07-23 22:58:08 UTC (rev 9255)
@@ -96,6 +96,7 @@
propertyNames.add(PAGE_REGION);
propertyNames.add(PORTLET_HEIGHT);
propertyNames.add(IF_EXISTS);
+ propertyNames.add(ADD_PORTLET);
return propertyNames;
}
@@ -125,6 +126,9 @@
@Override
public Object getDefaultProperty(String propertyName) {
+ if (propertyName.equals(ADD_PORTLET)) {
+ return Boolean.TRUE;
+ }
if (propertyName.equals(DO_VIEW)) {
return Boolean.TRUE;
}
Modified: trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassOptionsWizardPage.java
===================================================================
--- trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassOptionsWizardPage.java 2008-07-23 21:47:32 UTC (rev 9254)
+++ trunk/portlet/plugins/org.jboss.tools.portlet.ui/src/org/jboss/tools/portlet/ui/internal/wizard/NewPortletClassOptionsWizardPage.java 2008-07-23 22:58:08 UTC (rev 9255)
@@ -58,10 +58,10 @@
getConfigButton.setEnabled(enable);
doDispatchButton.setEnabled(enable);
doEditButton.setEnabled(enable);
- doViewButton.setEnabled(true);
- doHelpButton.setEnabled(true);
- processActionButton.setEnabled(true);
- renderButton.setEnabled(true);
+ doViewButton.setEnabled(enable);
+ doHelpButton.setEnabled(enable);
+ processActionButton.setEnabled(enable);
+ renderButton.setEnabled(enable);
}
});
@@ -97,10 +97,6 @@
doHelpButton = new Button(comp, SWT.CHECK);
doHelpButton.setText("doHelp"); //$NON-NLS-1$
synchHelper.synchCheckbox(doHelpButton, INewPortletClassDataModelProperties.DO_HELP, null);
-
- doDispatchButton = new Button(comp, SWT.CHECK);
- doDispatchButton.setText("doDispatch"); //$NON-NLS-1$
- synchHelper.synchCheckbox(doDispatchButton, INewPortletClassDataModelProperties.DO_DISPATCH, null);
doDispatchButton = new Button(comp, SWT.CHECK);
doDispatchButton.setText("doDispatch"); //$NON-NLS-1$
16 years, 5 months
JBoss Tools SVN: r9254 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe: editor and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-07-23 17:47:32 -0400 (Wed, 23 Jul 2008)
New Revision: 9254
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandlerLoadingException.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/ResourceReferenceList.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/VpeResourcesDialogView.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dnd/context/xpl/DragNodeCommand2.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/AbstractActionManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelectionBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreatorUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeGridCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelLayoutCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFile.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeAttributeOperand.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionFactory.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionTldVersionCheck.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/TextFormattingToolBar.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/HandlerFactory.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/XmlUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
Log:
Cleanup VPE code:
1. Unnecessary catch(Exception ex) blocks were removed;
2. Catch(Exception ex) blocks were converted to catch particular exception(s);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpePlugin.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -112,7 +112,7 @@
URL url = null;
try {
url = bundle == null ? null : FileLocator.resolve(bundle.getEntry("/resources"));
- } catch (Exception e) {
+ } catch (IOException e) {
url = bundle.getEntry("/resources");
}
return (url == null) ? null : url.getPath();
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -18,6 +18,7 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jface.action.IAction;
@@ -329,7 +330,7 @@
} else
return null;
- } catch (Exception e) {
+ } catch (CoreException e) {
VpePlugin.getPluginLog().logError(e);
return null;
}
@@ -348,7 +349,7 @@
file.setPersistentProperty(SPLITTER_POSITION_KEY2, s);
s = String.valueOf(weights[2]);
file.setPersistentProperty(SPLITTER_POSITION_KEY3, s);
- } catch (Exception e) {
+ } catch (CoreException e) {
VpePlugin.getPluginLog().logError(e);
}
}
@@ -640,7 +641,7 @@
window.getPartService().addPartListener(activationListener);
window.getShell().addShellListener(activationListener);
- } catch (Exception e) {
+ } catch (CoreException e) {
VpePlugin.reportProblem(e);
}
// setVisualMode(visualMode);
@@ -731,7 +732,7 @@
visualEditor = new MozillaEditor();
try {
visualEditor.init(getEditorSite(), getEditorInput());
- } catch (Exception e) {
+ } catch (PartInitException e) {
VpePlugin.reportProblem(e);
}
if (visualEditor != null) {
@@ -766,7 +767,7 @@
}
});
previewWebBrowser.createPartControl(previewContent);
- } catch (Exception e) {
+ } catch (PartInitException e) {
VpePlugin.reportProblem(e);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.vpe.editor;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
@@ -117,7 +118,7 @@
IndexedRegion region = (IndexedRegion)sourceNode;
String text = sourceBuilder.getStructuredTextViewer().getDocument().get(region.getStartOffset(), region.getEndOffset()-region.getStartOffset());
pos = TextUtil.sourcePosition(text, visualSelectedNode.getNodeValue(), selection.getFocusOffset());
- }catch(Exception ex){
+ }catch(BadLocationException ex){
VpePlugin.reportProblem(ex);
}
sourceBuilder.setSelection(sourceNode, pos, 0);
@@ -135,7 +136,7 @@
IndexedRegion region = (IndexedRegion)sourceNode;
String text = sourceBuilder.getStructuredTextViewer().getDocument().get(region.getStartOffset(), region.getEndOffset()-region.getStartOffset());
pos = TextUtil.sourcePosition(text, visualSelectedNode.getNodeValue(), selection.getFocusOffset());
- }catch(Exception ex){
+ }catch(BadLocationException ex){
VpePlugin.reportProblem(ex);
}
sourceBuilder.setSelection(sourceNode, pos, 0);
@@ -222,7 +223,7 @@
String text = sourceBuilder.getStructuredTextViewer().getDocument().get(region.getStartOffset(), region.getEndOffset()-region.getStartOffset());
start = TextUtil.sourcePosition(text, visualSelectedAncestor.getNodeValue(), selection.getAnchorOffset());
end = TextUtil.sourcePosition(text, visualSelectedAncestor.getNodeValue(), selection.getFocusOffset());
- }catch(Exception ex){
+ }catch(BadLocationException ex){
VpePlugin.reportProblem(ex);
}
@@ -240,7 +241,7 @@
String text = sourceBuilder.getStructuredTextViewer().getDocument().get(region.getStartOffset(), region.getEndOffset()-region.getStartOffset());
start = TextUtil.sourcePosition(text, sourceAncestor.getNodeValue(), selection.getAnchorOffset());
end = TextUtil.sourcePosition(text, sourceAncestor.getNodeValue(), selection.getFocusOffset());
- }catch(Exception ex){
+ }catch(BadLocationException ex){
VpePlugin.reportProblem(ex);
}
sourceBuilder.setSelection(sourceAncestor, start, end - start);
@@ -299,7 +300,7 @@
String visualValue = visualNode.getNodeValue();
return start + TextUtil.sourcePosition(sourceText, visualValue, visualValue.length());
}
- } catch(Exception ex){
+ } catch(BadLocationException ex){
VpePlugin.reportProblem(ex);
return 0;
}
@@ -382,12 +383,8 @@
if(sourceNode.getNodeType()!=Node.TEXT_NODE) {
sourceBuilder.setSelection(sourceNode, 0, 0);
} else if(sourceNode.getNodeType()==Node.TEXT_NODE) {
- try{
- IndexedRegion region = (IndexedRegion)sourceNode;
- sourceBuilder.setSelection(sourceNode, 0, region.getLength());
- }catch(Exception ex){
- VpePlugin.reportProblem(ex);
- }
+ IndexedRegion region = (IndexedRegion)sourceNode;
+ sourceBuilder.setSelection(sourceNode, 0, region.getLength());
}
return sourceNode;
}
@@ -902,7 +899,7 @@
int start = region.getStartOffset();
String text = sourceBuilder.getStructuredTextViewer().getDocument().get(start, region.getEndOffset() - start);
position = start + TextUtil.sourcePosition(text, visualSelectedNode.getNodeValue(), visualInitOffset);
- }catch(Exception ex){
+ }catch(BadLocationException ex){
VpePlugin.reportProblem(ex);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -336,17 +336,14 @@
// }
//Added by Max Areshkau in scope of bug JBIDE-1209
} else {
- try{
- IndexedRegion region = (IndexedRegion)sourceParent;
- String text = sourceParent.getNodeValue();
- int start= TextUtil.sourcePosition(text, visualText.getNodeValue(), offset);
- int end =TextUtil.sourcePosition(text, visualText.getNodeValue(), offset+length);
- offset=start;
- length=end-start;
- }catch(Exception ex){
- VpePlugin.reportProblem(ex);
- }
- setSelection(sourceParent, offset, length);
+ IndexedRegion region = (IndexedRegion)sourceParent;
+ String text = sourceParent.getNodeValue();
+ int start= TextUtil.sourcePosition(text, visualText.getNodeValue(), offset);
+ int end =TextUtil.sourcePosition(text, visualText.getNodeValue(), offset+length);
+ offset=start;
+ length=end-start;
+
+ setSelection(sourceParent, offset, length);
}
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -16,6 +16,7 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
@@ -30,6 +31,7 @@
import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
import org.eclipse.wst.xml.core.internal.document.AttrImpl;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.document.InvalidCharacterException;
import org.eclipse.wst.xml.core.internal.document.TextImpl;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
@@ -241,13 +243,8 @@
private boolean paste() {
- try {
sourceEditor.getAction(ActionFactory.PASTE.getId()).run();
return true;
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- return false;
- }
}
private boolean deleteRight() {
@@ -399,7 +396,7 @@
atLeastOneCharIsDeleted = true;
continue;
}
- } catch(Exception e) {
+ } catch(BadLocationException e) {
VpePlugin.getPluginLog().logError(e);
}
}
@@ -743,7 +740,7 @@
atLeastOneCharIsDeleted = true;
return selection;
}
- } catch(Exception ex) {
+ } catch(BadLocationException ex) {
VpePlugin.getPluginLog().logError(ex);
}
}
@@ -895,68 +892,52 @@
}
private boolean isVisualEditableForNode(Node node) {
- try {
- nsIDOMNode visualNode = domMapping.getVisualNode(node);
- if (visualNode.getNodeType() == Node.ELEMENT_NODE) {
- nsIDOMNode styleAttr = visualNode.getAttributes().getNamedItem("style");
- if (styleAttr != null) {
- String style = styleAttr.getNodeValue();
- if (style != null) {
- if (style.indexOf(VpeHtmlTemplate.ATTR_STYLE_MODIFY_READ_ONLY_VALUE) < 0) {
- return true;
- }
+
+ nsIDOMNode visualNode = domMapping.getVisualNode(node);
+ if (visualNode.getNodeType() == Node.ELEMENT_NODE) {
+ nsIDOMNode styleAttr = visualNode.getAttributes().getNamedItem("style");
+ if (styleAttr != null) {
+ String style = styleAttr.getNodeValue();
+ if (style != null) {
+ if (style.indexOf(VpeHtmlTemplate.ATTR_STYLE_MODIFY_READ_ONLY_VALUE) < 0) {
+ return true;
}
}
- } else if (visualNode.getNodeType() == Node.TEXT_NODE) {
- return true;
}
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
+ } else if (visualNode.getNodeType() == Node.TEXT_NODE) {
+ return true;
}
return false;
}
private boolean isVisualNodeSourceAttribute(Node node) {
- try {
- nsIDOMNode visualNode = domMapping.getVisualNode(node);
- VpeNodeMapping nm = domMapping.getNodeMapping(visualNode);
- if (nm.getType() == VpeNodeMapping.ELEMENT_MAPPING) {
- VpeElementMapping em = (VpeElementMapping)nm;
- return em.getTemplate().isOutputAttributes();
- }
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
+ nsIDOMNode visualNode = domMapping.getVisualNode(node);
+ VpeNodeMapping nm = domMapping.getNodeMapping(visualNode);
+ if (nm.getType() == VpeNodeMapping.ELEMENT_MAPPING) {
+ VpeElementMapping em = (VpeElementMapping)nm;
+ return em.getTemplate().isOutputAttributes();
}
return false;
}
private boolean isVisualNodeEmpty(Node node) {
- try {
- nsIDOMNode visualNode = domMapping.getVisualNode(node);
- return pageContext.getVisualBuilder().isEmptyElement(visualNode);
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- }
- return false;
+ nsIDOMNode visualNode = domMapping.getVisualNode(node);
+ return pageContext.getVisualBuilder().isEmptyElement(visualNode);
}
private Attr getVisualNodeSourceAttribute(Node node) {
- try {
- nsIDOMNode visualNode = domMapping.getVisualNode(node);
- if(visualNode==null) {
- return null;
+ nsIDOMNode visualNode = domMapping.getVisualNode(node);
+ if(visualNode==null) {
+ return null;
+ }
+ VpeNodeMapping nm = domMapping.getNodeMapping(visualNode);
+ if (nm.getType() == VpeNodeMapping.ELEMENT_MAPPING) {
+ VpeElementMapping mapping = (VpeElementMapping)nm;
+ String[] names = mapping.getTemplate().getOutputAtributeNames();
+ if(names!=null) {
+ String name = names[0];
+ return (Attr)node.getAttributes().getNamedItem(name);
}
- VpeNodeMapping nm = domMapping.getNodeMapping(visualNode);
- if (nm.getType() == VpeNodeMapping.ELEMENT_MAPPING) {
- VpeElementMapping mapping = (VpeElementMapping)nm;
- String[] names = mapping.getTemplate().getOutputAtributeNames();
- if(names!=null) {
- String name = names[0];
- return (Attr)node.getAttributes().getNamedItem(name);
- }
- }
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
}
return null;
}
@@ -1158,12 +1139,8 @@
Node focusNode = selection.getFocusNode();
int formatStart = 0;
- try {
- formatStart = ((IDOMNode)focusNode).getStartOffset();
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
- }
-
+ formatStart = ((IDOMNode)focusNode).getStartOffset();
+
VpeNodeMapping parentMapping = domMapping.getNearParentMapping(focusNode);
if (parentMapping != null) {
boolean handled = false;
@@ -1226,15 +1203,11 @@
}
}
- try {
- StructuredTextViewer viewer = sourceEditor.getTextViewer();
- if (region != null){
- if (sourceEditor instanceof ITextFormatter) {
- ((ITextFormatter)sourceEditor).formatTextRegion(sourceEditor.getTextViewer().getDocument(), region);
- }
- }
- } catch (Exception x) {
- VpePlugin.reportProblem(x);
+ StructuredTextViewer viewer = sourceEditor.getTextViewer();
+ if (region != null){
+ if (sourceEditor instanceof ITextFormatter) {
+ ((ITextFormatter)sourceEditor).formatTextRegion(sourceEditor.getTextViewer().getDocument(), region);
+ }
}
return true;
}
@@ -1252,7 +1225,7 @@
break;
}
return linePrefix.substring(0, linePrefixLength);
- } catch (Exception e) {
+ } catch (BadLocationException e) {
VpePlugin.getPluginLog().logError(e);
return "";
}
@@ -1274,7 +1247,7 @@
try {
String source = ((TextImpl)node).getSource();
((TextImpl)node).setSource(source.substring(0, so) + source.substring(eo));
- } catch (Exception e) {
+ } catch (InvalidCharacterException e) {
VpePlugin.getPluginLog().logError(e);
}
if (node.getNodeValue().trim().length() == 0) {
@@ -1385,7 +1358,6 @@
}
private boolean isTextToSkip(char[] chars, int position) {
- try {
if (chars[position] == ' ')
return true;
@@ -1393,12 +1365,7 @@
TextUtil.isWhitespaceText(new String(chars, position, chars.length - position))) {
return true;
}
-
return false;
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- return true;
- }
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -25,6 +25,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -114,7 +115,7 @@
if (project.getNature(JSF_PROJECT_NATURES[i]) != null)
return true;
}
- } catch (Exception e) {
+ } catch (CoreException e) {
VpePlugin.getPluginLog().logError(e);
}
return false;
@@ -186,7 +187,7 @@
IFile file = (IFile)project.getWorkspace().getRoot().getFolder(es[i].getPath()).findMember("/"+name);
if(file != null && file.exists()) return file;
}
- } catch (Exception e) {
+ } catch (CoreException e) {
VpePlugin.getPluginLog().logError(e);
return null;
}
@@ -317,7 +318,7 @@
String value;
try{
value = (String)entry.bundle.getObject(key.key);
- }catch(Exception ex){
+ }catch(MissingResourceException ex){
value = null;
fireBundleKeyChanged(key.prefix, key.key, value);
usedKeys.remove(key);
@@ -413,7 +414,7 @@
if(!usedKeys.containsKey(name))
usedKeys.put(name, new UsedKey(entry.uri, prefix, propertyName, value, entry.hashCode, entry.offset));
return value;
- }catch(Exception ex){
+ }catch(MissingResourceException ex){
return null;
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -24,6 +24,7 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.jboss.tools.common.kb.KbConnectorFactory;
@@ -89,12 +90,16 @@
}
public void refreshConnector() {
- try {
IDocument document = sourceBuilder.getStructuredTextViewer().getDocument();
- connector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, document);
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- }
+ try {
+ connector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, document);
+ } catch (InstantiationException e) {
+ VpePlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ VpePlugin.getPluginLog().logError(e);
+ } catch (ClassNotFoundException e) {
+ VpePlugin.getPluginLog().logError(e);
+ }
}
public VpeVisualDomBuilder getVisualBuilder(){
@@ -219,7 +224,7 @@
if (f != null) {
IDE.openEditor(workbenchPage, f, true);
}
- }catch(Exception ex){
+ }catch(PartInitException ex){
VpePlugin.reportProblem(ex);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/ResourceReferenceList.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/ResourceReferenceList.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/ResourceReferenceList.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -86,7 +86,7 @@
String s = null;
try {
s = resource.getPersistentProperty(getPropertyName());
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
}
if(s == null || s.length() == 0) return new String[0];
@@ -121,7 +121,7 @@
String newValue = encodeDeclaredResources(entries, scope, depth);
if(oldValue.equals(newValue)) return false;
resource.setPersistentProperty(getPropertyName(), newValue);
- } catch (Exception e) {
+ } catch (CoreException e) {
return false;
}
return true;
@@ -162,7 +162,7 @@
try {
s = ModelPlugin.getWorkspace().getRoot().getPersistentProperty(getPropertyName());
if(s != null) parseExternalResources(s);
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
}
}
@@ -192,7 +192,7 @@
}
try {
ModelPlugin.getWorkspace().getRoot().setPersistentProperty(getPropertyName(), sb.toString());
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
}
}
@@ -248,7 +248,6 @@
}
private boolean setDeclaredResources(IPath path, ResourceReference[] entries, int scope, int depth) {
- try {
String oldValue = (String)getAllExternalResources().get(path.toString());
if(oldValue == null) oldValue = "";
String newValue = encodeDeclaredResources(entries, scope, depth);
@@ -258,9 +257,6 @@
} else {
getAllExternalResources().put(path.toString(), newValue);
}
- } catch (Exception e) {
- return false;
- }
return true;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/VpeResourcesDialogView.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/VpeResourcesDialogView.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/css/VpeResourcesDialogView.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -90,14 +90,10 @@
}
public Point getPreferredSize() {
- try {
- //changed by estherbin
- //http://jira.jboss.com/jira/browse/JBIDE-2010
- String os_name = System.getProperty("os.name");
- if(os_name != null && os_name.indexOf("Windows") >= 0) return new Point(800, 600);
- } catch (Exception e) {
- //ignore
- }
+ //changed by estherbin
+ //http://jira.jboss.com/jira/browse/JBIDE-2010
+ String os_name = System.getProperty("os.name");
+ if(os_name != null && os_name.indexOf("Windows") >= 0) return new Point(800, 600);
//changed by estherbin
//http://jira.jboss.com/jira/browse/JBIDE-2010
return new Point(700, 600);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dnd/context/xpl/DragNodeCommand2.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dnd/context/xpl/DragNodeCommand2.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dnd/context/xpl/DragNodeCommand2.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -78,28 +78,20 @@
if (parentNode.getNodeType() == Node.ELEMENT_NODE && sourceAttributeOwnerElement != parentNode) {
result = true;
if (!testOnly) {
- try {
- if(getOperation() == DND.DROP_MOVE) {
- Element targetElement = (Element) parentNode;
- sourceAttributeOwnerElement.removeAttributeNode(sourceAttribute);
- targetElement.getAttributes().setNamedItem(sourceAttribute);
- fSelections.add(sourceAttribute);
- }
- else if (getOperation() == DND.DROP_COPY) {
- Attr cloneAttribute = (Attr) sourceAttribute.cloneNode(false);
- Element targetElement = (Element) parentNode;
- targetElement.getAttributes().setNamedItem(cloneAttribute);
- fSelections.add(cloneAttribute);
- }
+
+ if(getOperation() == DND.DROP_MOVE) {
+ Element targetElement = (Element) parentNode;
+ sourceAttributeOwnerElement.removeAttributeNode(sourceAttribute);
+ targetElement.getAttributes().setNamedItem(sourceAttribute);
+ fSelections.add(sourceAttribute);
}
- catch (Exception e) {
- ResourcesPlugin.getPlugin().getLog()
- .log(new Status(IStatus.ERROR,
- "org.jboss.tools.vpe",
- 0,
- e.getMessage(),
- e));
+ else if (getOperation() == DND.DROP_COPY) {
+ Attr cloneAttribute = (Attr) sourceAttribute.cloneNode(false);
+ Element targetElement = (Element) parentNode;
+ targetElement.getAttributes().setNamedItem(cloneAttribute);
+ fSelections.add(cloneAttribute);
}
+
}
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/AbstractActionManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/AbstractActionManager.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/AbstractActionManager.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -414,53 +414,40 @@
}
public void fillContextMenu(IMenuManager menuManager, ISelection selection) {
- try {
- List selectionList = new ArrayList();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection es = (IStructuredSelection) selection;
- for (Iterator i = es.iterator(); i.hasNext();) {
- selectionList.add(i.next());
- }
+ List selectionList = new ArrayList();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection es = (IStructuredSelection) selection;
+ for (Iterator i = es.iterator(); i.hasNext();) {
+ selectionList.add(i.next());
}
-
- contributeActions(menuManager, selectionList);
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
}
+ contributeActions(menuManager, selectionList);
}
public void fillContextMenuForVpe(IMenuManager menuManager,
- ISelection selection) {
- try {
- List selectionList = new ArrayList();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection es = (IStructuredSelection) selection;
- for (Iterator i = es.iterator(); i.hasNext();) {
- selectionList.add(i.next());
- }
+ ISelection selection) {
+ List selectionList = new ArrayList();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection es = (IStructuredSelection) selection;
+ for (Iterator i = es.iterator(); i.hasNext();) {
+ selectionList.add(i.next());
}
-
- contributeActionsForVpe(menuManager, selectionList);
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
}
+
+ contributeActionsForVpe(menuManager, selectionList);
}
public void addContextMenuForVpe(IMenuManager menuManager,
ISelection selection) {
- try {
- List selectionList = new ArrayList();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection es = (IStructuredSelection) selection;
- for (Iterator i = es.iterator(); i.hasNext();) {
- selectionList.add(i.next());
- }
+ List selectionList = new ArrayList();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection es = (IStructuredSelection) selection;
+ for (Iterator i = es.iterator(); i.hasNext();) {
+ selectionList.add(i.next());
}
-
- contributeDeleteActionForVpe(menuManager, selectionList);
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
}
+
+ contributeDeleteActionForVpe(menuManager, selectionList);
}
public void remove(Node parent, int startIndex, int endIndex) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -60,6 +60,7 @@
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.xulrunner.XPCOM;
+import org.jboss.tools.vpe.xulrunner.XulRunnerException;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -287,7 +288,7 @@
}
xulRunnerEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}
- catch (Exception e) {
+ catch (XulRunnerException e) {
VpePlugin.getPluginLog().logError(e);
layout.verticalSpacing = 10;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -38,6 +38,7 @@
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.util.DocTypeUtil;
import org.jboss.tools.vpe.messages.VpeUIMessages;
+import org.jboss.tools.vpe.xulrunner.XulRunnerException;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
/**
@@ -94,7 +95,7 @@
getXulRunnerEditor().setText(DocTypeUtil.prepareInitFile(INIT_URL,
getEditorInput()));
getXulRunnerEditor().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- } catch (Exception e) {
+ } catch (XulRunnerException e) {
Label title = new Label(parent, SWT.WRAP);
title.setText(VpeUIMessages.MOZILLA_LOADING_ERROR);
title.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelectionBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelectionBuilder.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/selection/VpeSourceSelectionBuilder.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -68,24 +68,20 @@
if (focusNode instanceof IDOMElement) {
IDOMElement element = (IDOMElement)focusNode;
if (focusPosition < element.getEndStartOffset()) {
- try {
- NamedNodeMap attrs = focusNode.getAttributes();
- for (int i = 0; i < attrs.getLength(); i++) {
- AttrImpl attr = (AttrImpl)attrs.item(i);
- ITextRegion region = attr.getValueRegion();
- if(region==null) {
- break;
- }
- int attrStart = region.getStart();
- int attrEnd = attrStart + attr.getValue().length();
- if (range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1 >= attrStart && range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1 <= attrEnd) {
- selectedNodes = new ArrayList();
- selectedNodes.add(attr);
- break;
- }
+ NamedNodeMap attrs = focusNode.getAttributes();
+ for (int i = 0; i < attrs.getLength(); i++) {
+ AttrImpl attr = (AttrImpl)attrs.item(i);
+ ITextRegion region = attr.getValueRegion();
+ if(region==null) {
+ break;
}
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
+ int attrStart = region.getStart();
+ int attrEnd = attrStart + attr.getValue().length();
+ if (range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1 >= attrStart && range.x - ((ElementImpl)attr.getOwnerElement()).getStartOffset() - 1 <= attrEnd) {
+ selectedNodes = new ArrayList();
+ selectedNodes.add(attr);
+ break;
+ }
}
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -480,8 +480,6 @@
.getDocument(), getRegionToFormat());
}
}
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
} finally {
clearRegionToFormat();
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreatorUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreatorUtil.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCreatorUtil.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -10,7 +10,11 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.template;
+import java.io.IOException;
+
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.ui.IEditorInput;
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
@@ -76,8 +80,10 @@
if (file != null && file.exists()) {
try {
return (IDOMModel)StructuredModelManager.getModelManager().getModelForRead(file);
- } catch(Exception ex) {
+ } catch(IOException ex) {
VpePlugin.reportProblem(ex);
+ } catch(CoreException ex) {
+ VpePlugin.reportProblem(ex);
}
}
return null;
@@ -114,24 +120,23 @@
}
IEditorInput input = pageContext.getEditPart().getEditorInput();
IFile file = null;
- try {
- if(pageContext.getVisualBuilder().getCurrentIncludeInfo()==null) {
- file = FileUtil.getFile(input, fileName);
- } else {
- IFile includedFile =
- pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
- file = FileUtil.getFile(fileName, includedFile);
- }
- } catch (Exception e) {
- // nothing
+
+ if(pageContext.getVisualBuilder().getCurrentIncludeInfo()==null) {
+ file = FileUtil.getFile(input, fileName);
+ } else {
+ IFile includedFile =
+ pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
+ file = FileUtil.getFile(fileName, includedFile);
}
if (file != null) {
if (!file.isSynchronized(0)){
try {
file.refreshLocal(0, null);
- } catch (Exception ex) {
+ } catch (CoreException ex) {
VpePlugin.getPluginLog().logError(ex);
+ } catch (OperationCanceledException ex) {
+ VpePlugin.getPluginLog().logError(ex);
}
}
if (file.exists()) {
@@ -146,8 +151,10 @@
try {
wtpModel = (IDOMModel)StructuredModelManager.getModelManager().getModelForRead(file);
if (wtpModel != null) return wtpModel.getDocument();
- } catch(Exception e) {
+ } catch(IOException e) {
VpePlugin.getPluginLog().logError(e);
+ } catch(CoreException e) {
+ VpePlugin.getPluginLog().logError(e);
}
return null;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeDataTableCreator.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -628,12 +628,9 @@
private VisualDataTableElements getVisualDataTableElements(Map visualNodeMap) {
if (visualNodeMap != null) {
Object o = visualNodeMap.get(this);
- try {
- if (o != null && o instanceof Object[]
- && ((Object[]) o)[0] instanceof VisualDataTableElements) {
- return (VisualDataTableElements) ((Object[]) o)[0];
- }
- } catch (Exception e) {
+ if (o != null && o instanceof Object[]
+ && ((Object[]) o)[0] instanceof VisualDataTableElements) {
+ return (VisualDataTableElements) ((Object[]) o)[0];
}
}
return null;
@@ -642,12 +639,9 @@
private SourceDataTableElements getSourceDataTableElements(Map visualNodeMap) {
if (visualNodeMap != null) {
Object o = visualNodeMap.get(this);
- try {
- if (o != null && o instanceof Object[]
- && ((Object[]) o)[1] instanceof SourceDataTableElements) {
- return (SourceDataTableElements) ((Object[]) o)[1];
- }
- } catch (Exception e) {
+ if (o != null && o instanceof Object[]
+ && ((Object[]) o)[1] instanceof SourceDataTableElements) {
+ return (SourceDataTableElements) ((Object[]) o)[1];
}
}
return null;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeGridCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeGridCreator.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeGridCreator.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -102,11 +102,11 @@
if (vpeValue != null) {
String strValue = vpeValue.stringValue();
try {
- int val = Integer.valueOf(strValue).intValue();
+ int val = Integer.parseInt(strValue);
if (val > 0) {
tableSize = val;
}
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
VpePlugin.getPluginLog().logError(e);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -351,9 +351,6 @@
String locale = jsfCoreViewTag.getAttribute(LOCALE_ATTRNAME);
if (locale == null || locale.length() == 0) return null;
return locale;
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- return null;
} finally {
if (model != null) model.releaseFromRead();
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelGridCreator.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -195,11 +195,11 @@
if (vpeValue != null) {
String strValue = vpeValue.stringValue();
try {
- int val = Integer.valueOf(strValue).intValue();
+ int val = Integer.parseInt(strValue);
if (val > 0) {
tableSize = val;
}
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
}
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelLayoutCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelLayoutCreator.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpePanelLayoutCreator.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -10,14 +10,22 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.template;
+import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorInput;
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilder;
+import org.jboss.tools.vpe.editor.util.FileUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -25,13 +33,6 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.jboss.tools.vpe.VpePlugin;
-import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilder;
-import org.jboss.tools.vpe.editor.util.FileUtil;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-
public class VpePanelLayoutCreator extends VpeAbstractCreator {
@@ -268,8 +269,10 @@
if(wtpModel != null){
init(wtpModel.getDocument(), node);
}
- }catch(Exception ex){
+ } catch(IOException ex) {
VpePlugin.reportProblem(ex);
+ } catch(CoreException ex) {
+ VpePlugin.reportProblem(ex);
} finally {
if(wtpModel!=null)
wtpModel.releaseFromRead();
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFile.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFile.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFile.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -11,6 +11,7 @@
package org.jboss.tools.vpe.editor.template;
import java.io.File;
+import java.io.IOException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
@@ -20,19 +21,16 @@
long stamp;
IConfigurationElement configElement;
- VpeTemplateFile(String fileName,IConfigurationElement element) throws Exception {
+ VpeTemplateFile(String fileName,IConfigurationElement element) throws IOException {
this(element);
path = VpeTemplateFileList.getFilePath(fileName,element);
File file = path.toFile();
if (file.exists() && file.isFile()) {
stamp = file.lastModified();
- } else {
- throw new Exception("File " + path.toOSString() + " not exist");
- }
+ }
}
- VpeTemplateFile(IConfigurationElement element) throws Exception {
-
+ VpeTemplateFile(IConfigurationElement element) {
configElement = element;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -39,8 +39,8 @@
VpeTemplateFile newAutoTemplateFile = null;
try {
newAutoTemplateFile = new VpeTemplateFile(VpeTemplateManager.AUTO_TEMPLATES_FILE_NAME, null);
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
+ } catch (IOException e) {
+ VpePlugin.getPluginLog().logError("Default template for unknown tags loading error ",e);
}
changed = (autoTemplateFile == null) != (newAutoTemplateFile == null);
if (!changed && autoTemplateFile != null) {
@@ -93,8 +93,8 @@
try {
VpeTemplateFile templateFile = new VpeTemplateFile(pathAttrValue, elements[j]);
templateList.add(templateFile);
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
+ } catch (IOException e) {
+ VpePlugin.getPluginLog().logError("Error during loading template '" + pathAttrValue + "'", e);
}
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -688,7 +688,7 @@
}
}
- private Element createNewTagElement(Document document, VpeAnyData data) {
+ static public Element createNewTagElement(Document document, VpeAnyData data) {
Element newTagElement = document.createElement(TAG_TAG);
newTagElement.setAttribute(ATTR_TAG_NAME, data.getName());
newTagElement.setAttribute(ATTR_TAG_CASE_SENSITIVE, data.isCaseSensitive() ? ATTR_VALUE_YES : ATTR_VALUE_NO);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeAttributeOperand.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeAttributeOperand.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeAttributeOperand.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -28,16 +28,7 @@
public VpeValue exec(VpePageContext pageContext, Node sourceNode) {
String value = null;
-
- try {
- value = ((Element)sourceNode).getAttribute(name);
- if (value == null) {
- value = "";
- }
- } catch (Exception e) {
-// throw new VpeExpressionError(x.getMessage());
- VpePlugin.getPluginLog().logError(e);
- }
+ value = ((Element)sourceNode).getAttribute(name);
return new VpeValue((value == null ? "" : value));
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionFactory.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionFactory.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionFactory.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -44,10 +44,12 @@
}
try {
return (VpeFunction)cls.newInstance();
- } catch(Exception e) {
+ } catch(IllegalAccessException e) {
VpePlugin.getPluginLog().logError(e);
- return null;
+ } catch (InstantiationException e) {
+ VpePlugin.getPluginLog().logError(e);
}
+ return null;
}
private static Class<?> createCls(String name) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -24,6 +24,7 @@
import org.eclipse.ui.editors.text.ILocationProvider;
import org.jboss.tools.common.kb.AttributeDescriptor;
import org.jboss.tools.common.kb.AttributeValueDescriptor;
+import org.jboss.tools.common.kb.KbException;
import org.jboss.tools.common.kb.ParamList;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
import org.jboss.tools.common.model.XModel;
@@ -224,7 +225,7 @@
tagValue = tagValue.substring(vs[0].length());
}
}
- } catch (Exception e) {
+ } catch (KbException e) {
VpePlugin.getPluginLog().logError(e);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionTldVersionCheck.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionTldVersionCheck.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionTldVersionCheck.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -71,63 +71,58 @@
public VpeValue exec(VpePageContext pageContext, Node sourceNode) {
//gets function parameter
- try {
- String tagValue = getParameter(0).exec(pageContext, sourceNode)
- .stringValue();
-
- double startValue = getStartVersion(tagValue);
-
- double endValue = getEndVersion(tagValue);
-
- if(sourceNode==null || sourceNode.getPrefix()==null) {
-
- return new VpeValue(false);
- }
-
- List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode,pageContext);
-
- TaglibData sourceNodeTaglib = XmlUtil.getTaglibForPrefix(sourceNode.getPrefix(), taglibs);
- //this function works only for jsp files
- String tldVersion = TLDVersionHelper.getTldVersion(sourceNodeTaglib.getUri(), sourceNodeTaglib.getPrefix(),
- pageContext.getSourceBuilder().getStructuredTextViewer().getDocument());
-
- double tldVersionNumber =0;
- if(tldVersion!=null) {
+
+ String tagValue = getParameter(0).exec(pageContext, sourceNode)
+ .stringValue();
- tldVersionNumber = Double.parseDouble(tldVersion);
-
- } else {
- //here we getting tld version for xhtml files
- XModel xm = null;
- IProject project = ((IFileEditorInput)pageContext.getEditPart().getEditorInput()).getFile().getProject();
- IModelNature mn = EclipseResourceUtil.getModelNature(project);
- if(mn!=null) {
- xm = mn.getModel();
+ double startValue = getStartVersion(tagValue);
+
+ double endValue = getEndVersion(tagValue);
+
+ if(sourceNode==null || sourceNode.getPrefix()==null) {
+
+ return new VpeValue(false);
}
- tldVersion=WebProject.getTldVersion(sourceNodeTaglib.getUri(),
- sourceNodeTaglib.getPrefix(),
- pageContext.getSourceBuilder().getStructuredTextViewer().getDocument(),
- xm);
- if(tldVersion!=null) {
+ List<TaglibData> taglibs = XmlUtil.getTaglibsForNode(sourceNode,pageContext);
+
+ TaglibData sourceNodeTaglib = XmlUtil.getTaglibForPrefix(sourceNode.getPrefix(), taglibs);
+ //this function works only for jsp files
+ String tldVersion = TLDVersionHelper.getTldVersion(sourceNodeTaglib.getUri(), sourceNodeTaglib.getPrefix(),
+ pageContext.getSourceBuilder().getStructuredTextViewer().getDocument());
+
+ double tldVersionNumber =0;
+ if(tldVersion!=null) {
+
tldVersionNumber = Double.parseDouble(tldVersion);
+
} else {
- tldVersionNumber = 0;
+ //here we getting tld version for xhtml files
+ XModel xm = null;
+ IProject project = ((IFileEditorInput)pageContext.getEditPart().getEditorInput()).getFile().getProject();
+ IModelNature mn = EclipseResourceUtil.getModelNature(project);
+ if(mn!=null) {
+ xm = mn.getModel();
+ }
+ tldVersion=WebProject.getTldVersion(sourceNodeTaglib.getUri(),
+ sourceNodeTaglib.getPrefix(),
+ pageContext.getSourceBuilder().getStructuredTextViewer().getDocument(),
+ xm);
+ if(tldVersion!=null) {
+
+ tldVersionNumber = Double.parseDouble(tldVersion);
+ } else {
+ tldVersionNumber = 0;
+ }
}
- }
- if((startValue<=tldVersionNumber)&&
- (endValue>=tldVersionNumber)) {
-
- return new VpeValue(true);
- } else {
+ if((startValue<=tldVersionNumber)&&
+ (endValue>=tldVersionNumber)) {
+
+ return new VpeValue(true);
+ } else {
+ return new VpeValue(false);
+ }
- return new VpeValue(false);
- }
- }catch (Exception e) {
- //if this function throws exception templates are not working more, so we should processed it's here
- VpePlugin.getPluginLog().logError(e);
- }
- return null;
}
private double getStartVersion(String tagValue) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -16,6 +16,7 @@
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.template.expression.VpeExpression;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilder;
+import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilderException;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionInfo;
import org.jboss.tools.vpe.editor.template.expression.VpeValue;
import org.jboss.tools.vpe.editor.util.SourceDomUtil;
@@ -135,7 +136,7 @@
}else{
resizeData = resizeData.getNext();
}
- }catch(Exception ex){
+ }catch(VpeExpressionBuilderException ex){
VpePlugin.reportProblem(ex);
resizeData = resizeData.getNext();
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -15,6 +15,7 @@
import java.util.List;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.eclipse.wst.xml.core.internal.document.TextImpl;
@@ -89,7 +90,7 @@
return;
}
currentSelectedTagValue = newSelectedTagValue;
- } catch (Exception e) {
+ } catch (BadLocationException e) {
VpePlugin.getPluginLog().logError(e);
}
} else {
@@ -163,7 +164,6 @@
private TextFormatingData getParentFormatingDataForTextNode(VpeSelectedNodeInfo selectedNodeInfo) {
Node selectedNode = selectedNodeInfo.getNode();
if(selectedNode instanceof TextImpl) {
- try {
// int startOffset = selectedNodeInfo.getStartOffset()>selectedNodeInfo.getEndOffset()?selectedNodeInfo.getEndOffset():selectedNodeInfo.getStartOffset();
// int endOffset = selectedNodeInfo.getStartOffset()>selectedNodeInfo.getEndOffset()?selectedNodeInfo.getStartOffset():selectedNodeInfo.getEndOffset();
//
@@ -182,11 +182,6 @@
// }
currentSelectedElement = selectedNode.getParentNode();
return getFormatTemplateForTag(selectedNode.getParentNode());
- } catch(Exception e) {
- Status status = new Status(Status.WARNING, VpePlugin.PLUGIN_ID, Status.ERROR, "Can't get value of selected text node.", e);
- ProblemReportingHelper.reportProblem(status);
- VpePlugin.getDefault().getLog().log(status);
- }
}
return null;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/TextFormattingToolBar.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/TextFormattingToolBar.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/TextFormattingToolBar.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -104,7 +104,7 @@
String[] font = null;
try {
font = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
- } catch (Exception ex) {
+ } catch (Error ex) {
VpePlugin.getPluginLog().logWarning(ex);
font = FONT_ARRAY;
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandler.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandler.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -13,6 +13,7 @@
import java.util.Properties;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.TextSelection;
@@ -171,7 +172,7 @@
}
try {
document.replace(element.getStartOffset(), length, body);
- } catch (Exception e) {
+ } catch (BadLocationException e) {
VpePlugin.getPluginLog().logError("Can't format text", e);
}
@@ -214,7 +215,7 @@
}
try {
document.replace(element.getStartOffset(), length, newElement);
- } catch (Exception e) {
+ } catch (BadLocationException e) {
VpePlugin.getPluginLog().logError("Can't format text", e);
}
Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandlerLoadingException.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandlerLoadingException.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandlerLoadingException.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -0,0 +1,18 @@
+
+package org.jboss.tools.vpe.editor.toolbar.format.handler;
+
+public class FormatHandlerLoadingException extends Exception {
+
+ public FormatHandlerLoadingException(String message) {
+ super(message);
+ }
+
+ public FormatHandlerLoadingException(Throwable cause) {
+ super(cause);
+ }
+
+ public FormatHandlerLoadingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandlerLoadingException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/HandlerFactory.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/HandlerFactory.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/HandlerFactory.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -57,10 +57,14 @@
return handler;
} else {
VpePlugin.getPluginLog().logError("Wrong format handler. Class - " + handlerClassName + ". Handler must be instance of org.jboss.tools.vpe.editor.toolbar.format.handler.IFormatHandler", //$NON-NLS-1$//$NON-NLS-2$
- new Exception("Handler must be instance of org.jboss.tools.vpe.editor.toolbar.format.handler.IFormatHandler")); //$NON-NLS-1$
+ new FormatHandlerLoadingException("Handler must be instance of org.jboss.tools.vpe.editor.toolbar.format.handler.IFormatHandler")); //$NON-NLS-1$
}
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError("Can't create format handler. Class: " + handlerClassName, e); //$NON-NLS-1$
+ } catch (IllegalAccessException e) {
+ reportException(e,handlerClassName);
+ } catch (InstantiationException e) {
+ reportException(e,handlerClassName);
+ } catch (ClassNotFoundException e) {
+ reportException(e,handlerClassName);
}
}
return null;
@@ -84,4 +88,8 @@
public int getCountHandlers() {
return handlers.size();
}
+
+ private void reportException(Exception e, String handlerClassName) {
+ VpePlugin.getPluginLog().logError("Can't create format handler. Class: " + handlerClassName, e); //$NON-NLS-1$
+ }
}
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -14,6 +14,7 @@
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.viewers.ISelectionProvider;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.ui.dnd.DnDUtil;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
@@ -33,12 +34,12 @@
properties.put("selectionProvider", provider);
properties.put("viewer", viewer);
- try {
- DnDUtil.paste(input.getXModelObject(), properties);
- PaletteInsertHelper.insertIntoEditor(viewer, properties);
- } catch (Exception ex) {
- VpePlugin.getPluginLog().logError(ex);
- }
+ try {
+ DnDUtil.paste(input.getXModelObject(), properties);
+ PaletteInsertHelper.insertIntoEditor(viewer, properties);
+ } catch (XModelException ex) {
+ VpePlugin.getPluginLog().logError(ex);
+ }
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/XmlUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/XmlUtil.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/XmlUtil.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -11,6 +11,7 @@
package org.jboss.tools.vpe.editor.util;
import java.io.FileInputStream;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -45,7 +46,7 @@
} finally {
try {
if (inStream != null) inStream.close();
- } catch (Exception e) {
+ } catch (IOException e) {
VpePlugin.getPluginLog().logError(e);
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java 2008-07-23 20:59:03 UTC (rev 9253)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java 2008-07-23 21:47:32 UTC (rev 9254)
@@ -134,7 +134,7 @@
sash.setWeights(weights);
}
}
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
// Do nothing
}
}
16 years, 5 months
JBoss Tools SVN: r9253 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-07-23 16:59:03 -0400 (Wed, 23 Jul 2008)
New Revision: 9253
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.project
Log:
pmd feature removed from .project
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.project
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.project 2008-07-23 20:58:01 UTC (rev 9252)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.project 2008-07-23 20:59:03 UTC (rev 9253)
@@ -20,15 +20,9 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>net.sourceforge.pmd.runtime.pmdNature</nature>
</natures>
</projectDescription>
16 years, 5 months
JBoss Tools SVN: r9252 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: src/org/jboss/tools/jsf/vpe/richfaces and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-07-23 16:58:01 -0400 (Wed, 23 Jul 2008)
New Revision: 9252
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.project
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
Log:
Clean up the code (minor things)
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.project
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.project 2008-07-23 18:26:23 UTC (rev 9251)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.project 2008-07-23 20:58:01 UTC (rev 9252)
@@ -1,28 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.jboss.tools.jsf.vpe.richfaces</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.jsf.vpe.richfaces</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sourceforge.pmd.runtime.pmdBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sourceforge.pmd.runtime.pmdNature</nature>
+ </natures>
+</projectDescription>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-07-23 18:26:23 UTC (rev 9251)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2008-07-23 20:58:01 UTC (rev 9252)
@@ -195,7 +195,7 @@
if (file.exists()) {
return file.getAbsolutePath();
} else {
- throw new RuntimeException("Can't get path for " //$NON-NLS-1$
+ throw new IllegalArgumentException("Can't get path for " //$NON-NLS-1$
+ resourcePathInPlugin);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-07-23 18:26:23 UTC (rev 9251)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesComboBoxTemplate.java 2008-07-23 20:58:01 UTC (rev 9252)
@@ -155,9 +155,8 @@
} else {
intValue = Integer.parseInt(with);
}
- return String.valueOf((intValue - minus)) + String.valueOf("px");
+ return String.valueOf((intValue - minus)) + "px";
} catch (NumberFormatException e) {
- System.err.println(e.getMessage());
return with;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java 2008-07-23 18:26:23 UTC (rev 9251)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesScrollableDataTableTemplate.java 2008-07-23 20:58:01 UTC (rev 9252)
@@ -46,7 +46,7 @@
private static String STYLE_FOR_LOW_SCROLL = "overflow: scroll; width: 100%; height: 17px;";
private static String STYLE_FOR_RIGHT_SCROLL = "overflow: scroll; width: 17px; height: 100%;";
- private static int NUM_ROW = 5;
+ private static final int NUM_ROW = 5;
/**
* Creates a node of the visual tree on the node of the source tree. This
16 years, 5 months
JBoss Tools SVN: r9251 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-07-23 14:26:23 -0400 (Wed, 23 Jul 2008)
New Revision: 9251
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java
Log:
Cleanup Exceptions and Boolean instances
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java 2008-07-23 17:12:02 UTC (rev 9250)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesOrderingList.java 2008-07-23 18:26:23 UTC (rev 9251)
@@ -26,30 +26,30 @@
*/
public class RichFacesOrderingList extends VpeAbstractTemplate {
- final static String DEFAULT_LIST_HEIGHT = "150px";
- final static String DEFAULT_LIST_WIDTH = "300px";
+ private static final String DEFAULT_LIST_HEIGHT = "150px";
+ private static final String DEFAULT_LIST_WIDTH = "300px";
- final static String DEFAULT_HEIGHT = "200px";
- final static String DEFAULT_WIDTH = "300px";
+ private static final String DEFAULT_HEIGHT = "200px";
+ private static final String DEFAULT_WIDTH = "300px";
- final static String CAPTION_FACET = "caption";
- final static String TOP_CONTROL_FACET = "topControl";
- final static String UP_CONTROL_FACET = "upControl";
- final static String DOWN_CONTROL_FACET = "downControl";
- final static String BOTTOM_CONTROL_FACET = "bottomControl";
+ private static final String CAPTION_FACET = "caption";
+ private static final String TOP_CONTROL_FACET = "topControl";
+ private static final String UP_CONTROL_FACET = "upControl";
+ private static final String DOWN_CONTROL_FACET = "downControl";
+ private static final String BOTTOM_CONTROL_FACET = "bottomControl";
- final static String HEADER = "header";
- final static String HEADER_CLASS = "headerClass";
- final static String FOOTER = "footer";
- final static String FOOTER_CLASS = "footerClass";
- final static String CAPTION_CLASS = "captionClass";
- final static String CAPTION_STYLE = "captionStyle";
- final static String SPACE = " ";
+ private static final String HEADER = "header";
+ private static final String HEADER_CLASS = "headerClass";
+ private static final String FOOTER = "footer";
+ private static final String FOOTER_CLASS = "footerClass";
+ private static final String CAPTION_CLASS = "captionClass";
+ private static final String CAPTION_STYLE = "captionStyle";
+ private static final String SPACE = " ";
- private static String STYLE_FOR_LOW_SCROLL = "overflow: scroll; width: 100%; height: 17px;";
- private static String STYLE_FOR_RIGHT_SCROLL = "overflow: scroll; width: 17px; height: 100%;";
+ private static final String STYLE_FOR_LOW_SCROLL = "overflow: scroll; width: 100%; height: 17px;";
+ private static final String STYLE_FOR_RIGHT_SCROLL = "overflow: scroll; width: 17px; height: 100%;";
- private static int NUM_ROW = 1;
+ private static final int NUM_ROW = 1;
private static final String TOP_CONTROL_IMG = "orderingList/top.gif";
private static final String UP_CONTROL_IMG = "orderingList/up.gif";
@@ -91,7 +91,6 @@
private static final String BOTTOM_CONTROL_CLASS = "bottomControlClass";
private static final String ROW_CLASSES = "rowClasses";
-
private static final String CSS_CAPTION_CLASS = "rich-ordering-list-caption";
private static final String CSS_CONTROLS_CLASS = "rich-ordering-controls";
@@ -332,20 +331,20 @@
if (fastOrderControlsVisible) {
nsIDOMElement btnTopDiv = createSingleButtonDiv(creationData, visualDocument,
(null == topControlLabel ? TOP_CONTROL_LABEL_DEFAULT
- : topControlLabel), TOP_CONTROL_IMG, new Boolean(
- showButtonLabels).booleanValue(), top_control_facet, CSS_TOP_CONTROL_CLASS, topControlClass);
+ : topControlLabel), TOP_CONTROL_IMG,
+ showButtonLabels, top_control_facet, CSS_TOP_CONTROL_CLASS, topControlClass);
buttonsDiv.appendChild(btnTopDiv);
}
if (orderControlsVisible) {
nsIDOMElement btnUpDiv = createSingleButtonDiv(creationData, visualDocument,
(null == upControlLabel ? UP_CONTROL_LABEL_DEFAULT
- : upControlLabel), UP_CONTROL_IMG, new Boolean(
- showButtonLabels).booleanValue(), up_control_facet, CSS_UP_CONTROL_CLASS, upControlClass);
+ : upControlLabel), UP_CONTROL_IMG,
+ showButtonLabels, up_control_facet, CSS_UP_CONTROL_CLASS, upControlClass);
nsIDOMElement btnDownDiv = createSingleButtonDiv(creationData, visualDocument,
(null == downControlLabel ? DOWN_CONTROL_LABEL_DEFAULT
- : downControlLabel), DOWN_CONTROL_IMG, new Boolean(
- showButtonLabels).booleanValue(), down_control_facet, CSS_DOWN_CONTROL_CLASS, downControlClass);
+ : downControlLabel), DOWN_CONTROL_IMG,
+ showButtonLabels, down_control_facet, CSS_DOWN_CONTROL_CLASS, downControlClass);
buttonsDiv.appendChild(btnUpDiv);
buttonsDiv.appendChild(btnDownDiv);
}
@@ -354,7 +353,7 @@
nsIDOMElement btnBottomDiv = createSingleButtonDiv(creationData, visualDocument,
(null == bottomControlLabel ? BOTTOM_CONTROL_LABEL_DEFAULT
: bottomControlLabel), BOTTOM_CONTROL_IMG,
- new Boolean(showButtonLabels).booleanValue(), bottom_control_facet, CSS_BOTTOM_CONTROL_CLASS, bottomControlClass);
+ showButtonLabels, bottom_control_facet, CSS_BOTTOM_CONTROL_CLASS, bottomControlClass);
buttonsDiv.appendChild(btnBottomDiv);
}
@@ -843,15 +842,9 @@
ArrayList<Element> columns) {
int count = 0;
// check for exact value in component
- Integer span = null;
try {
- span = Integer.valueOf(sourceElement.getAttribute("columns"));
- } catch (Exception e) {
- // Ignore bad attribute
- }
- if (null != span && span.intValue() != Integer.MIN_VALUE) {
- count = span.intValue();
- } else {
+ count = Integer.parseInt(sourceElement.getAttribute("columns"));
+ } catch (NumberFormatException e) {
// calculate max html columns count for all columns/rows children.
count = calculateRowColumns(sourceElement, columns);
}
@@ -870,48 +863,32 @@
if (ComponentUtil.isRendered(column)) {
if (column.getNodeName().endsWith(":columnGroup")) {
// Store max calculated value of previous rows.
- if (currentLength > count) {
- count = currentLength;
- }
+ count = Math.max(currentLength, count);
// Calculate number of columns in row.
currentLength = calculateRowColumns(sourceElement,
getColumns(column));
// Store max calculated value
- if (currentLength > count) {
- count = currentLength;
- }
- currentLength = 0;
+ count = Math.max(currentLength, count);
+ currentLength = 0;
+ String colspanStr = column
+ .getAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN);
+
} else if (column.getNodeName().equals(
sourceElement.getPrefix() + ":column")) {
String breakBeforeStr = column.getAttribute("breakBefore");
- boolean breakBefore = false;
- if (breakBeforeStr != null) {
- try {
- breakBefore = Boolean.getBoolean(breakBeforeStr);
- } catch (Exception e) {
- // Ignore bad attribute
- }
- }
+ boolean breakBefore = Boolean.getBoolean(breakBeforeStr);
+
// For new row, save length of previous.
if (breakBefore) {
- if (currentLength > count) {
- count = currentLength;
- }
+ count = Math.max (currentLength, count);
currentLength = 0;
}
- String colspanStr = column
- .getAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN);
- Integer colspan = null;
+
try {
- colspan = Integer.valueOf(colspanStr);
- } catch (Exception e) {
- // Ignore
- }
- // Append colspan of this column
- if (null != colspan
- && colspan.intValue() != Integer.MIN_VALUE) {
- currentLength += colspan.intValue();
- } else {
+ String colspanStr = column
+ .getAttribute(HtmlComponentUtil.HTML_TABLE_COLSPAN);
+ currentLength += Integer.parseInt(colspanStr);
+ } catch (NumberFormatException e) {
currentLength++;
}
} else if (column.getNodeName().endsWith(":column")) {
@@ -921,9 +898,7 @@
}
}
- if (currentLength > count) {
- count = currentLength;
- }
+ count = Math.max (currentLength, count);
return count;
}
16 years, 5 months
JBoss Tools SVN: r9250 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-07-23 13:12:02 -0400 (Wed, 23 Jul 2008)
New Revision: 9250
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
Log:
catch (Exception ex) changed to catch (NumberFormatException ex)
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2008-07-23 14:59:06 UTC (rev 9249)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataTableTemplate.java 2008-07-23 17:12:02 UTC (rev 9250)
@@ -348,7 +348,7 @@
Integer colspan = null;
try {
colspan = Integer.valueOf(colspanStr);
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
// Ignore
}
// Append colspan of this column
16 years, 5 months
JBoss Tools SVN: r9249 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-07-23 10:59:06 -0400 (Wed, 23 Jul 2008)
New Revision: 9249
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/IELService.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java
Log:
Fixed no worked selection https://jira.jboss.com:8443/jira/browse/JBIDE-2010
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java 2008-07-23 14:34:11 UTC (rev 9248)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/ElService.java 2008-07-23 14:59:06 UTC (rev 9249)
@@ -186,4 +186,28 @@
return rst;
}
+
+ /**
+ * Reverse replace.
+ *
+ * @param resourceFile the resource file
+ * @param replacedString the replaced string
+ *
+ * @return the string
+ */
+ public String reverseReplace(IFile resourceFile, String replacedString) {
+ String str = replacedString;
+
+ final ResourceReference[] references = ELReferenceList.getInstance().getAllResources(resourceFile);
+
+ if ((references != null) && (references.length > 0)) {
+ for (ResourceReference rf : references) {
+ if (replacedString.contains(rf.getProperties())) {
+ str = str.replace(rf.getProperties(), rf.getLocation());
+ }
+ }
+ }
+ return str;
+ }
+
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/IELService.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/IELService.java 2008-07-23 14:34:11 UTC (rev 9248)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/IELService.java 2008-07-23 14:59:06 UTC (rev 9249)
@@ -26,6 +26,17 @@
* @return string where el values was substituted.
*/
String replaceEl(IFile resourceFile, String resourceString);
+
+
+ /**
+ * Reverse replace.
+ *
+ * @param resourceFile the resource file
+ * @param replacedString the replaced string
+ *
+ * @return the string
+ */
+ String reverseReplace(IFile resourceFile,String replacedString);
/**
* Checks if is available.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java 2008-07-23 14:34:11 UTC (rev 9248)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/SelectionUtil.java 2008-07-23 14:59:06 UTC (rev 9249)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.swt.graphics.Point;
@@ -75,8 +76,17 @@
int start = NodesManagingUtil.getStartOffsetNode(node);
- pageContext.getSourceBuilder().getStructuredTextViewer()
- .setSelectedRange(start + offset, length);
+ //added by estherbin fix bug JBIDE-2010 with selection.
+ if (start == 0 || start == 1) {
+ final IFile file = pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
+
+ if (file != null) {
+ final String findString = ElService.getInstance().reverseReplace(file, node.getNodeValue());
+
+ start = pageContext.getSourceBuilder().getStructuredTextViewer().getTextWidget().getText().indexOf(findString);
+ }
+ }
+ pageContext.getSourceBuilder().getStructuredTextViewer().setSelectedRange(start + offset, length);
pageContext.getSourceBuilder().getStructuredTextViewer().revealRange(
start + offset, length);
16 years, 5 months