JBoss Tools SVN: r7331 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: resources/panelMenuItem and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-04-04 09:10:21 -0400 (Fri, 04 Apr 2008)
New Revision: 7331
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuItem/style.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1588, css styles updated to look "like in browser"
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css 2008-04-04 12:47:57 UTC (rev 7330)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuGroup/style.css 2008-04-04 13:10:21 UTC (rev 7331)
@@ -6,18 +6,16 @@
vertical-align: middle;
}
-.rich-pmenu-disabled-element {
- color: #B1ADA7;
-}
-
.rich-pmenu-top-group-div, .rich-pmenu-group-div {
- border-color: #C4C0B9;
- border: 1px solid;
margin-bottom: 3px;
padding: 1px;
cursor: pointer;
}
-
+.rich-pmenu-group{
+ padding: 0px;
+ height: 20px;
+ width: 100%;
+}
.rich-pmenu-top-group {
background-color: #D4CFC7;
font-family: Arial, Verdana, sans-serif;
@@ -25,8 +23,8 @@
font-weight: bold;
background-position: left top;
background-repeat: repeat-x;
+ padding: 0px;
height: 20px;
- padding: 2px 1px 2px 2px;
width: 100%;
}
@@ -37,4 +35,8 @@
font-family: Arial, Verdana, sans-serif;
font-size: 11px;
font-weight: bold;
+}
+
+.rich-pmenu-disabled-element {
+ color: #B1ADA7;
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuItem/style.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuItem/style.css 2008-04-04 12:47:57 UTC (rev 7330)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/panelMenuItem/style.css 2008-04-04 13:10:21 UTC (rev 7331)
@@ -1,68 +1,29 @@
-
-.dr-pmenu-top-group-div {
- border-color:#C4C0B9;
+.rich-pmenu-item-label, .rich-pmenu-top-item-label {
+ font-size: 11px;
+ padding-left: 5px;
+ width: 100%;
}
-.dr-pmenu-top-group-div {
- border:1px solid;
- margin-bottom:3px;
- padding:1px;
- border-color:#C4C0B9;
-
-}
-
-.dr-pmenu-top-group {
- background-color:#D4CFC7;
+.rich-pmenu-item, .rich-pmenu-top-item {
+ cursor:pointer;
+ padding: 0px;
color:#000000;
font-family:Arial,Verdana,sans-serif;
font-size:11px;
- font-weight:bold;
}
-.dr-pmenu-top-group {
- background-position:left top;
- background-repeat:repeat-x;
- cursor:pointer;
- height:20px;
- padding:2px 1px 2px 2px;
- width:100%;
-}
-
.dr-pmenu-nowrap {
- white-space:nowrap;
+ white-space: nowrap;
}
-element.style {
- width:100%;
+.dr-pmenu-top-self-div {
+ border-top: 1px solid;
+ border-color: #C4C0B9;
}
-
-.rich-pmenu-item-label {
- padding-left:5px;
-}
-
.rich-pmenu-disabled-element {
color:#B1ADA7;
font-family:Arial,Verdana,sans-serif;
font-size:11px;
- margin-top:1px;
- padding:2px 1px 1px;
+ width: 100%;
}
-
-.rich-pmenu-item {
- cursor:pointer;
- margin-top:1px;
- padding:2px 1px 1px;
- color:#000000;
- font-family:Arial,Verdana,sans-serif;
- font-size:11px;
-}
-
-.dr-pmenu-nowrap {
- white-space: nowrap;
-}
-
-.dr-pmenu-top-self-div {
- border-top: 1px solid;
- border-color: #C4C0B9;
-}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java 2008-04-04 12:47:57 UTC (rev 7330)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuGroupTemplate.java 2008-04-04 13:10:21 UTC (rev 7331)
@@ -75,7 +75,9 @@
private static final String RIGHT = "right"; //$NON-NLS-1$
private static final String SPACE = " "; //$NON-NLS-1$
private static final String EMPTY = ""; //$NON-NLS-1$
-
+
+ private static final String WIDTH_100_PERSENTS = "width: 100%; "; //$NON-NLS-1$
+ private static final String MARGIN_TOP = "margin-top: 3px; "; //$NON-NLS-1$
/*
* rich:panelMenu attributes for groups
*/
@@ -233,12 +235,17 @@
boolean disabled, String activeChildId) {
String disabledStyle = EMPTY;
String disableClass = EMPTY;
- String style = EMPTY;
- String styleClass = EMPTY;
+ String tableStyle = MARGIN_TOP;
+ String tableClass = EMPTY;
+ String col1ImgClass = EMPTY;
+ String col2Class = EMPTY;
+ String col3ImgClass = EMPTY;
+ String divClass = EMPTY;
nsIDOMElement table = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TABLE);
div.appendChild(table);
+
table.setAttribute(HtmlComponentUtil.HTML_CELLSPACING_ATTR, "0"); //$NON-NLS-1$
table.setAttribute(HtmlComponentUtil.HTML_CELLPADDING_ATTR, "0"); //$NON-NLS-1$
table.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0"); //$NON-NLS-1$
@@ -260,7 +267,7 @@
nsIDOMElement column2 = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TD);
tableBodyRow.appendChild(column2);
- column2.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "width: 100%;"); //$NON-NLS-1$
+ column2.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, WIDTH_100_PERSENTS);
nsIDOMText name = visualDocument.createTextNode(pmg_label);
column2.appendChild(name);
@@ -282,46 +289,8 @@
boolean childOfPanelMenu = parent.getNodeName().endsWith(
PANEL_MENU_END_TAG);
- if (childOfPanelMenu) {
-
- tableBodyRow.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_TOP_GROUP + SPACE + CSS_GROUP);
- columnn1_img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_TOP_GROUP_ICON + SPACE + CSS_GROUP_ICON);
- column2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_GROUP_LABEL + SPACE + CSS_TOP_GROUP_LABEL);
- column3_img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_TOP_GROUP_ICON + SPACE + CSS_GROUP_ICON);
-
- if (attrPresents(pm_topGroupClass)) {
- styleClass = SPACE + pm_topGroupClass;
- }
- if (attrPresents(pm_topGroupStyle)) {
- style += pm_topGroupStyle;
- }
- div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_TOP_GROUP_DIV + SPACE + CSS_GROUP_DIV);
- } else {
-
- tableBodyRow.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_GROUP);
- columnn1_img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_GROUP_ICON);
- column2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_GROUP_LABEL);
- column3_img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_GROUP_ICON);
-
- if (attrPresents(pm_groupClass)) {
- styleClass = SPACE + pm_groupClass;
- }
- if (attrPresents(pm_groupStyle)) {
- style += pm_groupStyle;
- }
- div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, CSS_GROUP_DIV);
- }
-
- if (attrPresents(pmg_style)) {
- style += SPACE + pmg_style;
- }
- if (attrPresents(pm_styleClass)) {
- styleClass += SPACE + pm_styleClass;
- }
- if (attrPresents(pmg_styleClass)) {
- styleClass += SPACE + pmg_styleClass;
- }
-
+ tableClass += SPACE + CSS_GROUP;
+
if (disabled) {
if (attrPresents(pm_disabledGroupClass)) {
disableClass += pm_disabledGroupClass;
@@ -330,7 +299,7 @@
disableClass += SPACE + pmg_disabledClass;
}
disableClass += SPACE + CSS_DISABLED_ELEMENT;
- styleClass += SPACE + disableClass;
+ tableClass += SPACE + disableClass;
if (attrPresents(pm_disabledGroupStyle)) {
disabledStyle += pm_disabledGroupStyle;
@@ -338,13 +307,52 @@
if (attrPresents(pmg_disabledStyle)) {
disabledStyle += SPACE + pmg_disabledStyle;
}
- style += SPACE + disabledStyle;
+ tableStyle += SPACE + disabledStyle;
+ } else {
+
+ if (attrPresents(pm_groupClass)) {
+ tableClass += SPACE + pm_groupClass;
+ }
+ if (attrPresents(pm_groupStyle)) {
+ tableStyle += pm_groupStyle;
+ }
+ col1ImgClass += SPACE + CSS_GROUP_ICON;
+ col2Class += SPACE + CSS_GROUP_LABEL;
+ col3ImgClass += SPACE + CSS_GROUP_ICON;
+ divClass += SPACE + CSS_GROUP_DIV;
+
+ if (childOfPanelMenu) {
+ if (attrPresents(pm_topGroupClass)) {
+ tableClass += SPACE + pm_topGroupClass;
+ }
+ if (attrPresents(pm_topGroupStyle)) {
+ tableStyle += pm_topGroupStyle;
+ }
+ tableClass += SPACE + CSS_TOP_GROUP + SPACE + CSS_GROUP;
+ col1ImgClass += SPACE + CSS_TOP_GROUP_ICON;
+ col2Class += SPACE + CSS_TOP_GROUP_LABEL;
+ col3ImgClass += SPACE + CSS_TOP_GROUP_ICON;
+ divClass += SPACE + CSS_TOP_GROUP_DIV;
+ }
}
- if (!EMPTY.equals(style.trim())) {
- table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+
+ if (attrPresents(pm_styleClass)) {
+ tableClass += SPACE + pm_styleClass;
}
- table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, styleClass);
+ if (attrPresents(pmg_styleClass)) {
+ tableClass += SPACE + pmg_styleClass;
+ }
+ if (attrPresents(pmg_style)) {
+ tableStyle += SPACE + pmg_style;
+ }
+
+ columnn1_img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, col1ImgClass);
+ column2.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, col2Class);
+ column3_img.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, col3ImgClass);
+ div.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, divClass);
+ table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, tableClass);
+ table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, tableStyle);
}
private static final Element getRichPanelParent(Element sourceElement) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2008-04-04 12:47:57 UTC (rev 7330)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuItemTemplate.java 2008-04-04 13:10:21 UTC (rev 7331)
@@ -69,13 +69,12 @@
private static final String LEFT = "left"; //$NON-NLS-1$
private static final String NO_SIZE_VALUE = "0"; //$NON-NLS-1$
private static final String DEFAULT_SIZE_VALUE = "16"; //$NON-NLS-1$
- private static final String SRC = "16"; //$NON-NLS-1$
- private static final String FILE = "16"; //$NON-NLS-1$
private static final String COMPONENT_NAME = "panelMenuItem"; //$NON-NLS-1$
private static final String PANEL_MENU_END_TAG = ":panelMenu"; //$NON-NLS-1$
private static final String PANEL_MENU_GROUP_END_TAG = ":panelMenuGroup"; //$NON-NLS-1$
private static final String EMPTY_DIV_STYLE = "display: none;"; //$NON-NLS-1$
+ private static final String MARGIN_TOP = "margin-top: 3px; "; //$NON-NLS-1$
/*
* rich:panelMenu attributes for items
@@ -130,11 +129,14 @@
nsIDOMElement parentDiv = visualDocument.createElement(HtmlComponentUtil.HTML_TAG_DIV);
parentDiv.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, DR_TOP_DIV);
+ parentDiv.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0"); //$NON-NLS-1$
+ parentDiv.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, MARGIN_TOP);
parentVisualElement.appendChild(parentDiv);
nsIDOMElement div = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_DIV);
parentDiv.appendChild(div);
-
+
+
boolean childOfPanelMenu = sourceElement.getParentNode().getNodeName().endsWith(
PANEL_MENU_END_TAG);
boolean childOfPanelMenuGroup = sourceElement.getParentNode().getNodeName().endsWith(
@@ -250,7 +252,7 @@
}
/**
- * Gets the specified icon from panelMenu or .panelMenuGroupItem
+ * Gets the specified icon from panelMenu or panelMenuGroupItem
*
* @param pm_icon the panelMenu icon attribute
* @param pmi_icon the panelMenuGroupItem icon attribute
@@ -343,60 +345,64 @@
nsIDOMElement td2,
nsIDOMElement img3) {
- String tableStyle = EMPTY;
+ String tableStyle = MARGIN_TOP;
String tableClass = EMPTY;
- String trClass = CSS_ITEM;
- String img1Class = DR_NOWARP_CLASS + SPACE + CSS_ITEM_ICON;
- String td2Class = CSS_ITEM_LABEL;
- String img3Class = CSS_ITEM_ICON;
+ String trClass = EMPTY;
+ String img1Class = EMPTY;
+ String td2Class = EMPTY;
+ String img3Class = EMPTY;
- if (attrPresents(pm_itemClass)) {
- tableClass += pm_itemClass;
- }
if (attrPresents(pmi_styleClass)) {
- tableClass += pmi_styleClass;
+ tableClass += SPACE + pmi_styleClass;
}
- if (attrPresents(pm_itemStyle)) {
- tableStyle += pm_itemStyle;
- }
if (attrPresents(pmi_style)) {
- tableStyle += pmi_style;
+ tableStyle += SPACE + pmi_style;
}
- if (childOfPanelMenu) {
- trClass += SPACE + CSS_TOP_ITEM;
- img1Class += SPACE + CSS_TOP_ITEM_ICON;
- td2Class += SPACE + CSS_TOP_ITEM_LABEL;
- img3Class += SPACE + CSS_TOP_ITEM_ICON;
- if (attrPresents(pm_topItemClass)) {
- tableClass += pm_topItemClass;
- }
- if (attrPresents(pm_topItemStyle)) {
- tableStyle += pm_topItemStyle;
- }
- }
+ tableClass = CSS_ITEM;
if ((TRUE.equalsIgnoreCase(pmi_disabled))
|| (TRUE.equalsIgnoreCase(pm_disabled))) {
- trClass += SPACE + CSS_DISABLED_ELEMENT;
- img1Class += SPACE + CSS_DISABLED_ELEMENT;
- td2Class += SPACE + CSS_DISABLED_ELEMENT;
- img3Class += SPACE + CSS_DISABLED_ELEMENT;
+ tableClass += SPACE + CSS_DISABLED_ELEMENT;
if (attrPresents(pm_disabledItemClass)) {
- tableClass += pm_disabledItemClass;
+ tableClass += SPACE + pm_disabledItemClass;
}
+ if (attrPresents(pm_disabledItemStyle)) {
+ tableStyle += SPACE + pm_disabledItemStyle;
+ }
if (attrPresents(pmi_disabledClass)) {
- tableClass += pmi_disabledClass;
+ tableClass += SPACE + pmi_disabledClass;
}
- if (attrPresents(pm_disabledItemStyle)) {
- tableStyle += pm_disabledItemStyle;
- }
if (attrPresents(pmi_disabledStyle)) {
- tableStyle += pmi_disabledStyle;
+ tableStyle += SPACE + pmi_disabledStyle;
}
+
+ } else {
+ img1Class = DR_NOWARP_CLASS + SPACE + CSS_ITEM_ICON;
+ td2Class = CSS_ITEM_LABEL;
+ img3Class = CSS_ITEM_ICON;
+ if (attrPresents(pm_itemClass)) {
+ tableClass += SPACE + pm_itemClass;
+ }
+ if (attrPresents(pm_itemStyle)) {
+ tableStyle += SPACE + pm_itemStyle;
+ }
+ if (childOfPanelMenu) {
+ tableClass += SPACE + CSS_TOP_ITEM;
+ img1Class += SPACE + CSS_TOP_ITEM_ICON;
+ td2Class += SPACE + CSS_TOP_ITEM_LABEL;
+ img3Class += SPACE + CSS_TOP_ITEM_ICON;
+ if (attrPresents(pm_topItemClass)) {
+ tableClass += SPACE + pm_topItemClass;
+ }
+ if (attrPresents(pm_topItemStyle)) {
+ tableStyle += SPACE + pm_topItemStyle;
+ }
+ }
}
table.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, tableStyle);
+
table.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, tableClass);
tr.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, trClass);
img3.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR, img1Class);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java 2008-04-04 12:47:57 UTC (rev 7330)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelMenuTemplate.java 2008-04-04 13:10:21 UTC (rev 7331)
@@ -102,6 +102,7 @@
private static final String PANEL_MENU_GROUP_END = ":panelMenuGroup"; //$NON-NLS-1$
private static final String PANEL_MENU_ITEM_END = ":panelMenuItem"; //$NON-NLS-1$
private static final String TRUE = "true"; //$NON-NLS-1$
+ private static final String MARGIN_TOP = "margin-top: 3px; "; //$NON-NLS-1$
private List<String> activeIds = new ArrayList<String>();
@@ -125,9 +126,10 @@
nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
VpeCreationData vpeCreationData = new VpeCreationData(div);
-
+ div.setAttribute(HtmlComponentUtil.HTML_BORDER_ATTR, "0"); //$NON-NLS-1$
+
if (style != null) {
- div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, style);
+ div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, MARGIN_TOP + style);
}
if (styleClass != null) {
17 years, 8 months
JBoss Tools SVN: r7330 - in trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf: model/handlers and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 08:47:57 -0400 (Fri, 04 Apr 2008)
New Revision: 7330
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesConfigLoader.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFEntityRecognizer.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/DeleteManagedBeanHandler.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameManagedPropertyChange.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/RenameManagedBeanHandler.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFPagesRefactoringChange.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFRenameFolderFacesConfigChange.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFRenamePageFacesConfigChange.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/JSFPageUpdateManager.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/bean/BeanHelper.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFPromptingProvider.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/AddJSFCapabilitiesSupport.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/JSFCapabilities.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/LibrariesPerformer.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/JSFWatcherContributor.java
Log:
JBIDE-895
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesConfigLoader.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesConfigLoader.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/FacesConfigLoader.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -22,7 +22,6 @@
import org.jboss.tools.common.model.filesystems.impl.*;
import org.jboss.tools.common.model.loaders.impl.SimpleWebFileLoader;
import org.jboss.tools.common.model.util.*;
-import org.jboss.tools.common.xml.SAXValidator;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jst.web.model.*;
@@ -33,7 +32,7 @@
boolean isLight = false;
public void load(XModelObject object) {
- String entity = object.getModelEntity().getName();
+// String entity = object.getModelEntity().getName();
String body = XModelObjectLoaderUtil.getTempBody(object);
@@ -155,7 +154,7 @@
XModelObjectLoaderUtil.setTempBody(process, sw.toString());
aux.write(object.getParent(), object, process);
return true;
- } catch (Exception exc) {
+ } catch (IOException exc) {
JSFModelPlugin.getPluginLog().logError(exc);
return false;
}
@@ -177,17 +176,20 @@
? XMLUtil.createDocumentElement(object.getModelEntity().getXMLSubPath())
: XMLUtil.createDocumentElement(object.getModelEntity().getXMLSubPath(), DOC_QUALIFIEDNAME, publicId, systemId, null);
+ util.setup(null, false);
+ util.saveAttributes(element, object);
+ util.saveChildren(element, object);
+ util.saveFinalComment(element, object);
+ element.removeAttribute("NAME");
+ element.removeAttribute("EXTENSION");
try {
- util.setup(null, false);
- util.saveAttributes(element, object);
- util.saveChildren(element, object);
- util.saveFinalComment(element, object);
- element.removeAttribute("NAME");
- element.removeAttribute("EXTENSION");
return SimpleWebFileLoader.serialize(element, object);
- } catch (Exception e) {
+ } catch (IOException e) {
JSFModelPlugin.getPluginLog().logError(e);
return null;
+ } catch (XModelException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ return null;
}
}
@@ -455,11 +457,7 @@
XMLUtil.createElement(element, "null-value");
} else {
Element ce = XMLUtil.createElement(element, "value");
- try {
- saveAttribute(ce, "#text", cs[i].getAttributeValue("value"));
- } catch (Exception t) {
- JSFModelPlugin.log("Error in saving list entries", t);
- }
+ saveAttribute(ce, "#text", cs[i].getAttributeValue("value"));
}
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFEntityRecognizer.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFEntityRecognizer.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFEntityRecognizer.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.jsf.model;
+import java.io.IOException;
+
import org.jboss.tools.common.model.loaders.*;
import org.jboss.tools.common.xml.XMLEntityResolver;
import org.jboss.tools.jsf.JSFModelPlugin;
@@ -21,7 +23,7 @@
Class<?> c = JSFEntityRecognizer.class;
XMLEntityResolver.registerPublicEntity(DOC_PUBLICID, c, "/meta/web-facesconfig_1_0.dtd");
XMLEntityResolver.registerPublicEntity(DOC_PUBLICID_11, c, "/meta/web-facesconfig_1_1.dtd");
- } catch (Exception e) {
+ } catch (IOException e) {
JSFModelPlugin.getPluginLog().logError(e);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/DeleteManagedBeanHandler.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/DeleteManagedBeanHandler.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/DeleteManagedBeanHandler.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -63,14 +63,9 @@
IType type = beans.getType(object.getAttributeValue("managed-bean-class"));
if(type == null || type.isBinary()) return null;
ICompilationUnit u = type.getCompilationUnit();
- if(u == null) return null;
- try {
- IFile file = ModelPlugin.getWorkspace().getRoot().getFile(u.getPath());
- return (file == null || !file.exists()) ? null : file;
- } catch (Exception e) {
- //ignore
- return null;
- }
+ if(u == null || u.getPath() == null) return null;
+ IFile file = ModelPlugin.getWorkspace().getRoot().getFile(u.getPath());
+ return (file == null || !file.isAccessible() || !file.exists()) ? null : file;
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameManagedPropertyChange.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameManagedPropertyChange.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/JSFRenameManagedPropertyChange.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -20,7 +20,6 @@
import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
import org.jboss.tools.common.model.impl.XModelObjectImpl;
import org.jboss.tools.common.model.util.*;
-import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.messages.JSFUIMessages;
public class JSFRenameManagedPropertyChange extends TextFileChange {
@@ -73,11 +72,9 @@
if(ok) {
return super.perform(pm);
}
- try {
+ if(beanProperty != null) {
beanProperty.getModel().changeObjectAttribute(beanProperty, "property-name", newName);
- } catch (Exception e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
+ }
return null;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/RenameManagedBeanHandler.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/RenameManagedBeanHandler.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/bean/RenameManagedBeanHandler.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -11,6 +11,8 @@
package org.jboss.tools.jsf.model.handlers.bean;
import java.util.Properties;
+
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.ui.refactoring.RenameSupport;
import org.eclipse.swt.widgets.Display;
@@ -67,12 +69,12 @@
public void run() {
try {
runInternal();
- } catch (Exception e) {
+ } catch (CoreException e) {
ProblemReportingHelper.reportProblem("org.jboss.tools.jsf", e);
}
}
- public void runInternal() throws Exception {
+ public void runInternal() throws CoreException {
RenameSupport renameSupport = RenameSupport.create(type, null, RenameSupport.UPDATE_REFERENCES);
if (!renameSupport.preCheck().isOK()) return;
IElementChangedListener listener = new JavaElementChangedListener(object, type);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFPagesRefactoringChange.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFPagesRefactoringChange.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFPagesRefactoringChange.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -16,7 +16,6 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.refactoring.RefactoringHelper;
-import org.jboss.tools.jsf.JSFModelPlugin;
public class JSFPagesRefactoringChange extends CompositeChange {
protected String newName;
@@ -28,18 +27,14 @@
this.model = model;
this.newName = newName;
this.replacements = replacements;
- try {
- addChanges();
- } catch (Exception e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
+ addChanges();
}
public XModel getModel() {
return model;
}
- private void addChanges() throws Exception {
+ private void addChanges() {
if(model == null) return;
XModelObject webRoot = FileSystemsHelper.getWebRoot(model);
if(webRoot == null) return;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFRenameFolderFacesConfigChange.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFRenameFolderFacesConfigChange.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFRenameFolderFacesConfigChange.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -21,7 +21,6 @@
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
-import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.messages.JSFUIMessages;
import org.jboss.tools.jsf.model.ReferenceGroupImpl;
import org.jboss.tools.jsf.model.handlers.RenameViewSupport;
@@ -58,14 +57,10 @@
parent = parent.getParent();
}
replacements.setProperty(">" + oldPath, ">" + newPath);
- try {
- addChanges();
- } catch (Exception e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
+ addChanges();
}
- private void addChanges() throws Exception {
+ private void addChanges() {
if(object == null) return;
XModelObject root = JSFProjectsTree.getProjectsRoot(object.getModel());
XModelObject conf = (root == null) ? null : root.getChildByPath("Configuration");
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFRenamePageFacesConfigChange.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFRenamePageFacesConfigChange.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/refactoring/JSFRenamePageFacesConfigChange.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -21,7 +21,6 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
-import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.messages.JSFUIMessages;
import org.jboss.tools.jsf.model.ReferenceGroupImpl;
import org.jboss.tools.jsf.model.handlers.RenameViewSupport;
@@ -50,11 +49,7 @@
int i = oldText.lastIndexOf("/");
newText = oldText.substring(0, i + 1) + newName;
replacements.setProperty(oldText, newText);
- try {
- addChanges();
- } catch (Exception e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
+ addChanges();
}
public JSFRenamePageFacesConfigChange(XModelObject object, String name, XModelObject newParent) {
@@ -65,14 +60,10 @@
String oldText = XModelObjectLoaderUtil.getResourcePath(object);
String newText = XModelObjectLoaderUtil.getResourcePath(newParent) + "/" + name;
replacements.setProperty(oldText, newText);
- try {
- addChanges();
- } catch (Exception e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
+ addChanges();
}
- private void addChanges() throws Exception {
+ private void addChanges() {
if(object == null) return;
XModelObject root = JSFProjectsTree.getProjectsRoot(object.getModel());
XModelObject conf = (root == null) ? null : root.getChildByPath("Configuration");
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/JSFPageUpdateManager.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/JSFPageUpdateManager.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/JSFPageUpdateManager.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -136,13 +136,13 @@
synchronized(this) {
try {
wait();
- } catch (Exception e) {
+ } catch (InterruptedException e) {
//ignore
}
}
try {
Thread.sleep(250);
- } catch (Exception e) {
+ } catch (InterruptedException e) {
//ignore
}
if(stopped) break;
@@ -164,11 +164,7 @@
public void run() {
if(!isLocked()) {
- try {
- updateAll();
- } catch (Exception t) {
- JSFModelPlugin.log("Error while running page update", t);
- }
+ updateAll();
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/bean/BeanHelper.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/bean/BeanHelper.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/helpers/bean/BeanHelper.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -13,6 +13,7 @@
import java.util.*;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.*;
import org.jboss.tools.common.model.XModelObject;
@@ -53,8 +54,8 @@
IJavaProject p = type.getJavaProject();
IType stype = null;
try {
- stype = p.findType(st);
- } catch (Exception e) {
+ if(p != null) stype = p.findType(st);
+ } catch (JavaModelException e) {
//ignore
}
return (stype == null) ? null : getJavaProperties(stype);
@@ -62,13 +63,10 @@
public static IJavaProject getJavaProject(XModelObject context) {
if(context == null) return null;
- try {
- IProject project = EclipseResourceUtil.getResource(context).getProject();
- return EclipseResourceUtil.getJavaProject(project);
- } catch (Exception e) {
- //ignore
- return null;
- }
+ IResource r = EclipseResourceUtil.getResource(context);
+ if(r == null) return null;
+ IProject project = r.getProject();
+ return EclipseResourceUtil.getJavaProject(project);
}
public static IMethod findGetter(IType type, String property) throws JavaModelException {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFPromptingProvider.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFPromptingProvider.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/JSFPromptingProvider.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -13,6 +13,7 @@
import java.util.*;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.common.model.java.handlers.OpenJavaSourceHandler;
import org.eclipse.jdt.core.IType;
@@ -53,7 +54,7 @@
}
}
- private List<Object> getListInternal(XModel model, String id, String prefix, Properties properties) throws Exception {
+ private List<Object> getListInternal(XModel model, String id, String prefix, Properties properties) throws CoreException {
String error = null;
if(JSF_BUNDLES.equals(id)) return getBundles(model);
if(JSF_REGISTERED_BUNDLES.equals(id)) {
@@ -138,7 +139,7 @@
list.addAll(map.keySet());
return list;
}
- if(error != null) throw new Exception(error);
+ if(error != null) throw new XModelException(error);
return EMPTY_LIST;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/AddJSFCapabilitiesSupport.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/AddJSFCapabilitiesSupport.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/AddJSFCapabilitiesSupport.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -11,11 +11,11 @@
package org.jboss.tools.jsf.project.capabilities;
import java.lang.reflect.InvocationTargetException;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.*;
import org.jboss.tools.common.meta.action.impl.*;
import org.jboss.tools.common.model.*;
-import org.jboss.tools.jsf.JSFModelPlugin;
public class AddJSFCapabilitiesSupport extends SpecialWizardSupport {
static String ATTR_CAPABILITY = "capability";
@@ -30,11 +30,7 @@
}
public void reset() {
- try {
- performer.init(getTarget().getModel());
- } catch (Exception e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
+ performer.init(getTarget().getModel());
getProperties().put("CapabilitiesPerformer", performer);
}
@@ -70,10 +66,12 @@
final Executor executor = new Executor();
try {
context.run(false, true, executor);
- } catch (Exception e) {
+ } catch (InvocationTargetException e) {
throw new XModelException(e);
+ } catch (InterruptedException e) {
+ throw new XModelException(e);
}
- if(executor.exception != null) throw new XModelException(executor.exception);
+ if(executor.exception != null) XModelException.rethrow(executor.exception);
getProperties().put("addedCapabilities", (executor.added != null) ? executor.added : new String[0]);
return !executor.cancelled;
}
@@ -85,6 +83,11 @@
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("" + getTitle(), getTaskCount());
+ try {
+ XJob.waitForJob();
+ } catch (InterruptedException e) {
+ //ignore
+ }
PerformerContext context = new PerformerContext(monitor);
try {
IPerformerItem[] items = performer.getChildren();
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/JSFCapabilities.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/JSFCapabilities.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/JSFCapabilities.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -16,8 +16,6 @@
import org.jboss.tools.common.model.loaders.XObjectLoader;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.*;
-import org.jboss.tools.common.reporting.ProblemReportingHelper;
-import org.jboss.tools.jsf.messages.JSFUIMessages;
public class JSFCapabilities extends ExtraRootImpl {
private static final long serialVersionUID = 1L;
@@ -25,11 +23,7 @@
public static JSFCapabilities getInstance() {
if(instance == null) {
- try {
- createInstance();
- } catch (Exception t) {
- ProblemReportingHelper.reportProblem("org.jboss.tools.jsf", JSFUIMessages.CANNOT_LOAD_JSF_CAPABILITIES, t);
- }
+ createInstance();
}
return instance;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/LibrariesPerformer.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/LibrariesPerformer.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/project/capabilities/LibrariesPerformer.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -11,6 +11,7 @@
package org.jboss.tools.jsf.project.capabilities;
import java.io.File;
+import java.io.IOException;
import java.util.*;
import org.eclipse.core.resources.*;
@@ -188,7 +189,7 @@
String webRoot = WebProject.getInstance(model).getWebRootLocation();
try {
FileUtil.unzip(new File(webRoot), source.getAbsolutePath());
- } catch (Exception e) {
+ } catch (IOException e) {
//ignore
}
zip = true;
@@ -207,7 +208,7 @@
IProject p = EclipseResourceUtil.getProject(model.getRoot());
if(p != null) try {
p.refreshLocal(IResource.DEPTH_INFINITE, null);
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/JSFWatcherContributor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/JSFWatcherContributor.java 2008-04-04 12:46:49 UTC (rev 7329)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/JSFWatcherContributor.java 2008-04-04 12:47:57 UTC (rev 7330)
@@ -35,7 +35,7 @@
public String getError() {
try {
checkCorrectness();
- } catch (Exception e) {
+ } catch (XModelException e) {
return e.getMessage();
}
return null;
17 years, 8 months
JBoss Tools SVN: r7329 - trunk/jsf/plugins/org.jboss.tools.jsf.verification/src/org/jboss/tools/jsf/verification/vrules.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 08:46:49 -0400 (Fri, 04 Apr 2008)
New Revision: 7329
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.verification/src/org/jboss/tools/jsf/verification/vrules/JSFCheckClass.java
Log:
JBIDE-895
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.verification/src/org/jboss/tools/jsf/verification/vrules/JSFCheckClass.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.verification/src/org/jboss/tools/jsf/verification/vrules/JSFCheckClass.java 2008-04-04 12:45:30 UTC (rev 7328)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.verification/src/org/jboss/tools/jsf/verification/vrules/JSFCheckClass.java 2008-04-04 12:46:49 UTC (rev 7329)
@@ -11,6 +11,7 @@
package org.jboss.tools.jsf.verification.vrules;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.verification.vrules.*;
@@ -30,17 +31,26 @@
IType type = object.getModel().getValidType(value);
if(type != null) {
String mustImpl = null;
- try { mustImpl = checkImplements(object, type); } catch (Exception e) {}
+ try {
+ mustImpl = checkImplements(object, type);
+ } catch (JavaModelException e) {
+ //ignore
+ }
if(mustImpl != null) return fireImplements(object, attr, attr, value, mustImpl);
String mustExtend = null;
- try { mustExtend = checkExtends(object, type); } catch (Exception e) {}
+ try {
+ mustExtend = checkExtends(object, type);
+ } catch (JavaModelException e) {
+ //ignore
+ }
if(mustExtend != null) return fireExtends(object, attr, attr, value, mustExtend);
return null;
}
return fire(object, attr, attr, value);
}
- private String checkImplements(VObject object, IType type) throws Exception {
+ private String checkImplements(VObject object, IType type) throws JavaModelException {
+ if(object == null || type == null) return null;
if("java.lang.Class".equals(type.getFullyQualifiedName())) return null;
String impl = rule.getProperty("implements");
if(impl == null || impl.length() == 0) return null;
@@ -59,7 +69,8 @@
return checkImplements(object, type);
}
- private String checkExtends(VObject object, IType type) throws Exception {
+ private String checkExtends(VObject object, IType type) throws JavaModelException {
+ if(object == null || type == null) return null;
if(type.isInterface()) return null;
if("java.lang.Class".equals(type.getFullyQualifiedName())) return null;
String ext = rule.getProperty("extends");
17 years, 8 months
JBoss Tools SVN: r7327 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 08:35:24 -0400 (Fri, 04 Apr 2008)
New Revision: 7327
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFLinkHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java
Log:
JBIDE-895
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BeanHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
@@ -27,14 +28,14 @@
protected void doHyperlink(IRegion region) {
XModel xModel = getXModel();
if (xModel == null || region == null) return;
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
+ region = JSPBeanHyperlinkPartitioner.getRegionPart(getDocument(), region.getOffset());
try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
- region = JSPBeanHyperlinkPartitioner.getRegionPart(getDocument(), region.getOffset());
if(region == null) return;
String beanName = getDocument().get(region.getOffset(), region.getLength());
if(beanName == null) return;
provider.getList(xModel, WebPromptingProvider.JSF_BEAN_OPEN, beanName, null);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,9 +12,11 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
@@ -39,17 +41,17 @@
IFile fileToOpen = getFileToOpen(fileName, "properties");
IWorkbenchPage workbenchPage = JSFExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(workbenchPage,fileToOpen,true);
- } catch (Exception x) {
+ } catch (CoreException x) {
// could not open editor
openFileFailed();
}
}
private String getBundleBasename(IRegion region) {
- if(region == null) return null;
+ if(region == null || getDocument() == null) return null;
try {
return getDocument().get(region.getOffset(), region.getLength());
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -72,7 +74,7 @@
if(file != null && file.exists()) return file;
}
return null;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -83,18 +85,13 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
private IRegion getRegion(int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -154,7 +151,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import java.util.*;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IEditorPart;
import org.w3c.dom.Attr;
@@ -37,6 +38,7 @@
public class BundleHyperlink extends XModelBasedHyperlink {
private String getBundleProperty(IRegion region) {
+ if(getDocument() == null) return null;
try {
String fullText = getDocument().get(region.getOffset(), region.getLength());
@@ -69,7 +71,7 @@
sProp = Utils.trimQuotes(fullText.substring(startProp, endProp));
}
return sProp;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -78,8 +80,8 @@
private String getBundleBasename(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -116,7 +118,7 @@
if(list2 == null || list2.size() < 1) return null;
Map map = (Map)list2.get(0);
return (String)map.get(bundleVar);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -188,9 +190,6 @@
String locale = Utils.trimQuotes((jsfCoreViewTag.getAttributeNode(LOCALE_ATTRNAME)).getValue());
if (locale == null || locale.length() == 0) return null;
return locale;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -68,8 +68,8 @@
private IRegion getRegion(int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -129,7 +129,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -36,24 +36,19 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
-
- try {
- String forID = getForId(region);
- IRegion elementByID = findElementByID(forID);
- if (elementByID != null) {
- StructuredSelectionHelper.setSelectionAndRevealInActiveEditor(elementByID);
- } else {
- openFileFailed();
- }
- } catch (Exception x) {
+ String forID = getForId(region);
+ IRegion elementByID = findElementByID(forID);
+ if (elementByID != null) {
+ StructuredSelectionHelper.setSelectionAndRevealInActiveEditor(elementByID);
+ } else {
openFileFailed();
}
}
private IRegion findElementByID (String id) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -85,9 +80,6 @@
};
}
return null;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -221,7 +213,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,11 +10,11 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
-import java.io.FileNotFoundException;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
@@ -32,26 +32,25 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
-
- try {
- String fileName = getFilePath(region);
- IFile fileToOpen = getFileToOpen(fileName);
- if (fileToOpen.exists()) {
- IWorkbenchPage workbenchPage = JSFExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ String fileName = getFilePath(region);
+ IFile fileToOpen = getFileToOpen(fileName);
+ if (fileToOpen.exists()) {
+ IWorkbenchPage workbenchPage = JSFExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
IDE.openEditor(workbenchPage,fileToOpen,true);
- } else {
- throw new FileNotFoundException((fileToOpen == null ? "" : fileToOpen.toString()));
+ } catch (CoreException e) {
+ openFileFailed();
}
- } catch (Exception x) {
- // could not open editor
+ } else {
openFileFailed();
}
}
private String getFilePath(IRegion region) {
+ if(getDocument() == null || region == null) return null;
try {
return getDocument().get(region.getOffset(), region.getLength());
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -61,29 +60,19 @@
private IFile getFileToOpen(String fileName) {
IFile documentFile = getFile();
XModel xModel = getXModel(documentFile);
- try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
- if (xModel != null) {
- List list = provider.getList(xModel, WebPromptingProvider.JSF_GET_PATH, fileName, null);
- if (list != null && list.size() > 0) {
- for (Iterator i = list.iterator(); i.hasNext();) {
- Object o = i.next();
- if (o instanceof String) {
- fileName = (String)o;
- break;
- }
+ if (xModel != null) {
+ List<Object> list = WebPromptingProvider.getInstance().getList(xModel, WebPromptingProvider.JSF_GET_PATH, fileName, null);
+ if (list != null && list.size() > 0) {
+ for (Object o: list) {
+ if (o instanceof String) {
+ fileName = (String)o;
+ break;
}
}
}
- // End of Slava's magic
- return super.getFileFromProject(fileName);
-
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
}
-
+ // End of Slava's magic
+ return super.getFileFromProject(fileName);
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Document;
@@ -27,8 +28,8 @@
public class JSFContextParamLinkHyperlink extends JSFLinkHyperlink {
protected IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -99,7 +100,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.jboss.tools.jsf.project.JSFNature;
@@ -39,8 +40,8 @@
*/
protected boolean recognizeNature(IDocument document) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
@@ -49,7 +50,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFLinkHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFLinkHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFLinkHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -21,7 +21,6 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.ext.hyperlink.LinkHyperlink;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
/**
@@ -52,14 +51,10 @@
protected IFile getFileFromProject(String fileName) {
IFile documentFile = getFile();
+ if(documentFile == null) return null;
- try {
- IProject project = documentFile.getProject();
- return super.getFileFromProject(updateFilenameForModel(fileName, project));
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ IProject project = documentFile.getProject();
+ return super.getFileFromProject(updateFilenameForModel(fileName, project));
}
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Document;
@@ -49,17 +51,18 @@
*/
protected boolean recognizeNature(IDocument document) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
+ if(project == null || !project.isAccessible()) return false;
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
if (project.getNature(JSF_PROJECT_NATURES[i]) != null)
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -81,8 +84,8 @@
return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -111,7 +114,6 @@
if (paramNameNode == null) return false;
String paramNameValue = null;
- try {
NodeList list = paramNameNode.getChildNodes();
for (int i = 0; paramNameValue == null && list != null && i < list.getLength(); i++) {
if (list.item(i) instanceof Text) {
@@ -126,17 +128,13 @@
}
}
}
- }
- catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- }
if (paramNameValue == null) return false;
for (int i = 0; i < VALID_CONTEXT_PARAM_NAMES.length; i++) {
if (VALID_CONTEXT_PARAM_NAMES[i].equals(paramNameValue))
return true;
}
return false;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.jboss.tools.jsf.project.JSFNature;
@@ -43,16 +44,17 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
+ if(project == null || !project.isAccessible()) return false;
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
if (project.getNature(JSF_PROJECT_NATURES[i]) != null)
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBeanHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -13,6 +13,7 @@
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -42,8 +43,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -62,9 +63,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -120,7 +118,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -129,12 +127,14 @@
}
public static IHyperlinkRegion getRegionPart(IDocument document, final int offset) {
+ if(document == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
+
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
-
+
Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
@@ -142,6 +142,7 @@
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
if(start < 0 || start > end || start > offset) return null;
+
String attrText = document.get(start, end - start);
StringBuffer sb = new StringBuffer(attrText);
@@ -172,7 +173,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -225,7 +226,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -238,8 +239,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -271,7 +272,7 @@
if (beanName == null) return false;
return true;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -279,4 +280,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPBundleHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -42,8 +43,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -60,9 +61,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -77,8 +75,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -122,7 +120,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -136,8 +134,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -214,7 +212,7 @@
if (lbTag == null) return false;
return true;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -33,9 +34,11 @@
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ if(document == null || superRegion == null) return null;
+
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -51,9 +54,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -107,7 +107,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -33,9 +34,11 @@
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ if(document == null || superRegion == null) return null;
+
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -51,9 +54,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -68,8 +68,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -107,7 +107,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -24,7 +24,6 @@
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.common.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
/**
* @author Jeremy
@@ -41,8 +40,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -60,9 +59,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -78,8 +74,8 @@
private IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -122,9 +118,6 @@
}
}
return null;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -136,18 +129,16 @@
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ if(document == null || region == null) return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
Utils.findNodeForOffset(xmlDocument, region.getOffset());
return (getRegion(document, region.getOffset()) != null);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
@@ -35,8 +36,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -52,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -69,8 +67,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -109,7 +107,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
@@ -37,8 +38,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -54,9 +55,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -71,8 +69,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -111,7 +109,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -125,8 +123,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -162,9 +160,6 @@
lbTagBasename.getNodeValue().trim().length() == 0) return false;
return true;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -37,8 +38,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -56,9 +57,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -116,7 +114,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -130,8 +128,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -167,9 +165,6 @@
lbTagBasename.getNodeValue().trim().length() == 0) return false;
return true;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
@@ -35,8 +36,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -52,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -109,7 +107,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
@@ -35,8 +36,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -52,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -127,7 +125,8 @@
}
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
+ JSFExtensionsPlugin.log(x);
return null;
} finally {
smw.dispose();
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -14,7 +14,7 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -42,23 +42,17 @@
IFile documentFile = getFile();
XModel xModel = getXModel(documentFile);
if (xModel == null) return;
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
- try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
- Properties p = getRequestProperties(region);
- p.put(WebPromptingProvider.FILE, documentFile);
-
- List list = provider.getList(xModel, WebPromptingProvider.JSF_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
- if (list != null && list.size() >= 1) {
- openFileInEditor((String)list.get(0));
- return;
- }
- String error = p.getProperty(WebPromptingProvider.ERROR);
- if ( error != null && error.length() > 0) {
- openFileFailed();
- }
- } catch (Exception x) {
+ Properties p = getRequestProperties(region);
+ p.put(WebPromptingProvider.FILE, documentFile);
+ List<Object> list = provider.getList(xModel, WebPromptingProvider.JSF_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
+ if (list != null && list.size() >= 1) {
+ openFileInEditor((String)list.get(0));
+ return;
+ }
+ String error = p.getProperty(WebPromptingProvider.ERROR);
+ if ( error != null && error.length() > 0) {
openFileFailed();
}
}
@@ -85,8 +79,8 @@
private String getURI(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -111,18 +105,16 @@
if (!tmw.exists()) return null;
return tmw.getUri(nodePrefix);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("Error while getting uri from region", x);
- return null;
} finally {
smw.dispose();
}
}
private String getTagName(IRegion region) {
+ if(region == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -139,9 +131,6 @@
if (tagName.indexOf(':') == -1) return null;
return tagName.substring(tagName.indexOf(':') + 1);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -151,18 +140,14 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
private String getTagAttributeName(IRegion region) {
+ if(region == null || getDocument() == null) return null;
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -171,8 +156,8 @@
protected IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -232,7 +217,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -240,14 +225,4 @@
}
}
- protected String getAttributeValue (IDocument document, Node node, String attrName) {
- try {
- Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
- return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
- }
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
@@ -45,12 +47,12 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
IRegion r = getRegion(document, superRegion.getOffset());
if (r == null) return null;
@@ -62,9 +64,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -81,11 +80,12 @@
IProject project = documentFile.getProject();
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
+ if(!project.isAccessible()) return false;
if (project.getNature(JSF_PROJECT_NATURES[i]) != null)
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -95,8 +95,8 @@
protected IRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -159,7 +159,7 @@
}
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -15,6 +15,7 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
@@ -43,22 +44,18 @@
IFile documentFile = getFile();
XModel xModel = getXModel(documentFile);
if (xModel == null) return;
- try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
- Properties p = getRequestProperties(region);
- p.put(WebPromptingProvider.FILE, documentFile);
+ Properties p = getRequestProperties(region);
+ p.put(WebPromptingProvider.FILE, documentFile);
- List list = provider.getList(xModel, WebPromptingProvider.JSF_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
- if (list != null && list.size() >= 1) {
- openFileInEditor((String)list.get(0));
- return;
- }
- String error = p.getProperty(WebPromptingProvider.ERROR);
- if ( error != null && error.length() > 0) {
- openFileFailed();
- }
- } catch (Exception x) {
+ List<Object> list = provider.getList(xModel, WebPromptingProvider.JSF_OPEN_TAG_LIBRARY, p.getProperty("prefix"), p);
+ if (list != null && list.size() >= 1) {
+ openFileInEditor((String)list.get(0));
+ return;
+ }
+ String error = p.getProperty(WebPromptingProvider.ERROR);
+ if ( error != null && error.length() > 0) {
openFileFailed();
}
}
@@ -81,8 +78,8 @@
private String getURI(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -102,9 +99,6 @@
Map trackers = JSPRootHyperlinkPartitioner.getTrackersMap(getDocument(), region.getOffset());
return (String)(trackers == null ? null : trackers.get(nodePrefix));
- } catch (Exception x) {
- JSFExtensionsPlugin.log("Error while getting uri from region", x);
- return null;
} finally {
smw.dispose();
}
@@ -112,8 +106,8 @@
private String getTagName(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -127,9 +121,6 @@
if (tagName.indexOf(':') == -1) return null;
return tagName.substring(tagName.indexOf(':') + 1);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -139,18 +130,13 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
protected IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -191,22 +177,9 @@
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
}
- protected String getAttributeValue (IDocument document, Node node, String attrName) {
- try {
- Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
- return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
- }
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
@@ -43,8 +44,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -60,9 +61,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -73,8 +71,8 @@
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
@@ -82,7 +80,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -92,8 +90,8 @@
protected IRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -134,9 +132,6 @@
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -39,8 +39,8 @@
protected Properties getRequestProperties(IRegion region) {
Properties p = new Properties();
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -67,8 +67,6 @@
}
}
}
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
} finally {
smw.dispose();
}
@@ -78,8 +76,8 @@
protected IRegion getRegion(final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -114,9 +112,6 @@
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("Error while getting region", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
@@ -49,8 +50,8 @@
return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -61,9 +62,6 @@
Element rootElem = xmlnsAttr.getOwnerElement();
if (!rootElem.getNodeName().equals("jsp:root")) return false;
return true;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
@@ -84,7 +82,7 @@
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -128,9 +126,6 @@
}
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,7 +12,6 @@
import java.util.Properties;
-import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -21,7 +20,6 @@
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.common.text.ext.hyperlink.XModelBasedHyperlink;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
/**
@@ -37,8 +35,8 @@
protected Properties getRequestProperties(IRegion region) {
Properties p = new Properties();
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -49,12 +47,10 @@
Node node = n;
- String uri = getAttributeValue(getDocument(), node, "uri");
+ String uri = Utils.getAttributeValue(getDocument(), node, "uri");
if (uri != null) {
p.setProperty("prefix", uri);
}
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
} finally {
smw.dispose();
}
@@ -62,20 +58,10 @@
return p;
}
- private String getAttributeValue (IDocument document, Node node, String attrName) {
- try {
- Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
- return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
- }
-
protected IRegion getRegion(final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -112,9 +98,6 @@
}
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
@@ -54,8 +55,8 @@
return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -67,9 +68,6 @@
if(propStart < 0) return false;
return true;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return false;
} finally {
smw.dispose();
}
@@ -80,17 +78,18 @@
*/
protected boolean recognizeNature(IDocument document) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
IFile documentFile = smw.getFile();
IProject project = documentFile.getProject();
+ if(project == null || !project.isAccessible()) return false;
for (int i = 0; i < JSF_PROJECT_NATURES.length; i++) {
if (project.getNature(JSF_PROJECT_NATURES[i]) != null)
return true;
}
return false;
- } catch (Exception x) {
+ } catch (CoreException x) {
JSFExtensionsPlugin.log("", x);
return false;
} finally {
@@ -100,8 +99,8 @@
public IRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -135,9 +134,6 @@
}
};
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -22,7 +22,6 @@
import org.jboss.tools.common.text.ext.util.TaglibManagerWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.common.text.ext.hyperlink.XModelBasedHyperlink;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
/**
@@ -52,8 +51,8 @@
private String getBundleBasename(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -67,9 +66,6 @@
lbTagBasename.getNodeValue().trim().length() == 0) return null;
return lbTagBasename.getNodeValue();
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -80,6 +76,8 @@
private static final String PREFIX_SEPARATOR = ":";
private String getPageLocale(IRegion region) {
+ if(getDocument() == null || region == null) return null;
+
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
TaglibManagerWrapper tmw = new TaglibManagerWrapper();
@@ -117,9 +115,6 @@
String locale = Utils.trimQuotes(((Attr)jsfCoreViewTag.getAttributeNode(LOCALE_ATTRNAME)).getValue());
if (locale == null || locale.length() == 0) return null;
return locale;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -13,6 +13,7 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
@@ -28,19 +29,20 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
+ if(region == null) return;
IFile file = getFile();
XModel xModel = getXModel(file);
if (xModel == null) return;
try {
WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
region = JSPNavigationCaseHyperlinkPartitioner.getRegion(getDocument(), region.getOffset());
+ if(region == null) return;
String beanName = getDocument().get(region.getOffset(), region.getLength());
Properties p = new Properties();
p.put(WebPromptingProvider.FILE, file);
provider.getList(xModel, WebPromptingProvider.JSF_OPEN_ACTION, beanName, p);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -39,23 +40,18 @@
XModel xModel = getXModel();
if (xModel == null) return;
- try {
- String propertyName = getPropertyName(region);
- String beanClassName = getBeanClassName(region);
+ String propertyName = getPropertyName(region);
+ String beanClassName = getBeanClassName(region);
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
- Properties p = new Properties();
- p.setProperty("ignoreWarning", "true");
- p.setProperty("property", propertyName);
- beanClassName = beanClassName.replace('.', '/') + ".class";
+ Properties p = new Properties();
+ p.setProperty("ignoreWarning", "true");
+ p.setProperty("property", propertyName);
+ beanClassName = beanClassName.replace('.', '/') + ".class";
- provider.getList(xModel, WebPromptingProvider.JSF_OPEN_CLASS_PROPERTY, beanClassName, p);
- String error = p.getProperty(WebPromptingProvider.ERROR);
- if ( error != null && error.length() > 0) {
- openFileFailed();
- }
- } catch (Exception x) {
+ provider.getList(xModel, WebPromptingProvider.JSF_OPEN_CLASS_PROPERTY, beanClassName, p);
+ String error = p.getProperty(WebPromptingProvider.ERROR);
+ if ( error != null && error.length() > 0) {
openFileFailed();
}
}
@@ -64,18 +60,14 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
private String getPropertyName(IRegion region) {
+ if(getDocument() == null || region == null) return null;
try {
return trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
}
@@ -83,8 +75,8 @@
private String getBeanClassName(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -122,7 +114,7 @@
beanClassName = trimQuotes(beanClassName);
return (beanClassName.length() == 0 ? null : beanClassName);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -132,8 +124,8 @@
private IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -193,7 +185,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -202,29 +194,23 @@
}
private String trimQuotes(String word) {
- try {
- String attrText = word;
- int bStart = 0;
- int bEnd = word.length() - 1;
- StringBuffer sb = new StringBuffer(attrText);
-
+ String attrText = word;
+ int bStart = 0;
+ int bEnd = word.length() - 1;
+ StringBuffer sb = new StringBuffer(attrText);
//find start and end of path property
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
- bStart++;
- }
- while (bEnd > bStart &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
- bEnd--;
- }
- bEnd++;
- return sb.substring(bStart, bEnd);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return word;
- }
+ while (bStart < bEnd &&
+ (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
+ Character.isWhitespace(sb.charAt(bStart)))) {
+ bStart++;
+ }
+ while (bEnd > bStart &&
+ (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
+ Character.isWhitespace(sb.charAt(bEnd)))) {
+ bEnd--;
+ }
+ bEnd++;
+ return sb.substring(bStart, bEnd);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -34,6 +35,7 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
+ if(getDocument() == null || region == null) return;
XModel xModel = getXModel();
if (xModel == null) return;
try {
@@ -49,7 +51,7 @@
openFileFailed();
}
- } catch (Exception x) {
+ } catch (BadLocationException x) {
openFileFailed();
}
}
@@ -58,18 +60,13 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
*/
protected IRegion doGetHyperlinkRegion(int offset) {
- try {
- return getRegion(offset);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
- }
+ return getRegion(offset);
}
private IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -129,7 +126,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
@@ -138,29 +135,23 @@
}
private String trimQuotes(String word) {
- try {
- String attrText = word;
- int bStart = 0;
- int bEnd = word.length() - 1;
- StringBuffer sb = new StringBuffer(attrText);
-
- //find start and end of path property
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
- bStart++;
- }
- while (bEnd > bStart &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
- bEnd--;
- }
- bEnd++;
- return sb.substring(bStart, bEnd);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return word;
- }
+ String attrText = word;
+ int bStart = 0;
+ int bEnd = word.length() - 1;
+ StringBuffer sb = new StringBuffer(attrText);
+ //find start and end of path property
+ while (bStart < bEnd &&
+ (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
+ Character.isWhitespace(sb.charAt(bStart)))) {
+ bStart++;
+ }
+ while (bEnd > bStart &&
+ (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
+ Character.isWhitespace(sb.charAt(bEnd)))) {
+ bEnd--;
+ }
+ bEnd++;
+ return sb.substring(bStart, bEnd);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -13,6 +13,7 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -35,14 +36,15 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
+ if(region == null) return;
IFile file = getFile();
XModel xModel = getXModel(file);
if (xModel == null) return;
+ WebPromptingProvider provider = WebPromptingProvider.getInstance();
try {
- WebPromptingProvider provider = WebPromptingProvider.getInstance();
-
region = getRegion(region.getOffset());
+ if(region == null) return;
String validatorID = getDocument().get(region.getOffset(), region.getLength());
Properties p = new Properties();
p.put(WebPromptingProvider.FILE, file);
@@ -51,7 +53,7 @@
if ( error != null && error.length() > 0) {
openFileFailed();
}
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
}
}
@@ -127,7 +129,7 @@
};
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -33,8 +34,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -50,9 +51,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -60,17 +58,14 @@
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
return Utils.getParentAxisForNode(xmlDocument, n);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -114,7 +109,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -33,8 +34,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -50,9 +51,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -60,17 +58,14 @@
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
return Utils.getParentAxisForNode(xmlDocument, n);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -112,7 +107,7 @@
if (propStart > offset || propStart + propLength < offset) return null;
return new HyperlinkRegion(propStart, propLength, null, null, null);
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
@@ -35,8 +36,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -52,9 +53,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -62,17 +60,14 @@
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if(xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
return Utils.getParentAxisForNode(xmlDocument, n);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -80,8 +75,8 @@
public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -118,7 +113,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java 2008-04-04 12:35:24 UTC (rev 7327)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -34,8 +35,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -51,9 +52,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -61,16 +59,11 @@
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
-
Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
-
return Utils.getParentAxisForNode(xmlDocument, n);
- } catch (Exception x) {
- JSFExtensionsPlugin.log("", x);
- return null;
} finally {
smw.dispose();
}
@@ -116,7 +109,7 @@
IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
return region;
- } catch (Exception x) {
+ } catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x);
return null;
} finally {
17 years, 8 months
JBoss Tools SVN: r7326 - in trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext: hyperlink/jsp and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 08:33:45 -0400 (Fri, 04 Apr 2008)
New Revision: 7326
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/JSPStylesheetRelLinkHyperlink.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/JSPStylesheetRelLinkHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTagAttributeHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTaglibHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTaglibHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/Utils.java
Log:
JBIDE-895
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-04-04 12:31:50 UTC (rev 7325)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
@@ -139,9 +139,10 @@
protected IFile getFileFromProject(String fileName) {
IFile documentFile = getFile();
+ if(documentFile == null || !documentFile.isAccessible()) return null;
+ IProject project = documentFile.getProject();
try {
- IProject project = documentFile.getProject();
String name = Utils.trimFilePath(fileName);
IPath currentPath = documentFile.getLocation()
.removeLastSegments(1);
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JSPStylesheetRelLinkHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JSPStylesheetRelLinkHyperlink.java 2008-04-04 12:31:50 UTC (rev 7325)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JSPStylesheetRelLinkHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -29,8 +30,8 @@
protected IRegion getRegion (int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- smw.init(getDocument());
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -117,7 +118,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/JSPRootHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java 2008-04-04 12:31:50 UTC (rev 7325)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
@@ -62,8 +62,8 @@
public static String computeAxis(IDocument document, int offset) {
String axis = "";
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -89,8 +89,6 @@
parent = parent.getParentNode();
}
}
- } catch (Exception x) {
- //ignore
} finally {
smw.dispose();
}
@@ -148,6 +146,7 @@
return map;
} catch (Exception x) {
//ignore
+ //TODO narrow catch after study
return null;
} finally {
smw.dispose();
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPStylesheetRelLinkHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPStylesheetRelLinkHyperlinkPartitioner.java 2008-04-04 12:31:50 UTC (rev 7325)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPStylesheetRelLinkHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
@@ -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.eclipse.jface.text.IRegion;
import org.w3c.dom.Attr;
@@ -45,9 +46,10 @@
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ if(superRegion == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -64,9 +66,6 @@
IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
return region;
- } catch (Exception x) {
- //ignore
- return null;
} finally {
smw.dispose();
}
@@ -76,9 +75,10 @@
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ if(region == null) return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -104,7 +104,7 @@
if (!LINK_TAGNAME.equalsIgnoreCase(tag.getNodeName()))
return false;
- String linkRel = getAttributeValue(document, tag, REL_ATTRNAME);
+ String linkRel = Utils.getAttributeValue(document, tag, REL_ATTRNAME);
if (!VALID_REL_ATTRVALUE.equalsIgnoreCase(linkRel))
return false;
@@ -143,24 +143,11 @@
return false;
return true;
- } catch (Exception x) {
- //ignore
- return false;
} finally {
smw.dispose();
}
}
- protected String getAttributeValue (IDocument document, Node node, String attrName) {
- try {
- Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
- return Utils.getTrimmedValue(document, attr);
- } catch (Exception x) {
- //ignore
- return null;
- }
- }
-
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
if (superRegion.getAxis() == null || superRegion.getAxis().length() == 0) {
return JSPRootHyperlinkPartitioner.computeAxis(document, superRegion.getOffset()) + "/";
@@ -170,8 +157,9 @@
protected IRegion getRegion (IDocument document, int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -258,7 +246,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/JSPTagAttributeHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTagAttributeHyperlinkPartitioner.java 2008-04-04 12:31:50 UTC (rev 7325)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTagAttributeHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
@@ -16,7 +16,6 @@
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.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
@@ -37,8 +36,8 @@
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -58,9 +57,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();
}
@@ -70,9 +66,10 @@
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ if(region == null) return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -82,9 +79,6 @@
return (JSP_ATTRIBUTE_TAGNAME.equals(n.getNodeName()) &&
!JSP_ELEMENT_TAGNAME.equals(n.getParentNode().getNodeName()) &&
n.getNodeName().indexOf(':') != -1);
- } 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/JSPTaglibHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTaglibHyperlink.java 2008-04-04 12:31:50 UTC (rev 7325)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTaglibHyperlink.java 2008-04-04 12:33:45 UTC (rev 7326)
@@ -21,6 +21,8 @@
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.Attr;
+import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.jboss.tools.common.model.XModel;
@@ -28,6 +30,7 @@
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.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.web.tld.ITaglibMapping;
import org.jboss.tools.jst.web.tld.IWebProject;
@@ -42,14 +45,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();
- }
+ 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$
@@ -58,18 +55,14 @@
* @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);
- IEditorPart part = openFileInEditor(jarEditorInput, fileString);
- if (part == null) openFileFailed();
- } else {
- super.openFileInEditor(fileString);
- }
- } catch (Exception x) {
- openFileFailed();
- }
+ 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 {
+ super.openFileInEditor(fileString);
+ }
}
private XModelObject getFilename(IRegion region) {
@@ -98,9 +91,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 {
if (model != null) model.releaseFromRead();
}
@@ -118,14 +108,14 @@
}
private IRegion getRegion(int offset) {
- IStructuredModel model = null;
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(getDocument());
try {
- model = getModelManager().getExistingModelForRead(getDocument());
- IDOMDocument xmlDocument = (model instanceof IDOMModel) ? ((IDOMModel) model).getDocument() : null;
+ Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, offset);
- if (n instanceof IDOMAttr) n = ((IDOMAttr)n).getOwnerElement();
+ if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
if (!(n instanceof IDOMElement)) return null;
if (!"jsp:directive.taglib".equals(n.getNodeName())) return null;
@@ -154,11 +144,8 @@
};
return region;
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error in obtaining region", x);
- return null;
} finally {
- if (model != null) model.releaseFromRead();
+ smw.dispose();
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTaglibHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTaglibHyperlinkPartitioner.java 2008-04-04 12:31:50 UTC (rev 7325)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPTaglibHyperlinkPartitioner.java 2008-04-04 12:33:45 UTC (rev 7326)
@@ -16,7 +16,6 @@
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.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
@@ -33,9 +32,10 @@
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ if(document == null || superRegion == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
@@ -56,9 +56,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();
}
@@ -69,9 +66,10 @@
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ if(document == null || region == null) return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
@@ -79,9 +77,6 @@
if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
if (!(n instanceof Element)) return false;
return ("jsp:directive.taglib".equals(n.getNodeName()));
- } 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/util/Utils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/Utils.java 2008-04-04 12:31:50 UTC (rev 7325)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/util/Utils.java 2008-04-04 12:33:45 UTC (rev 7326)
@@ -33,12 +33,13 @@
*/
public class Utils {
public static String trimQuotes(String word) {
+ if(word == null) return null;
+ String attrText = word;
+ int bStart = 0;
+ int bEnd = word.length() - 1;
+ StringBuffer sb = new StringBuffer(attrText);
+
try {
- String attrText = word;
- int bStart = 0;
- int bEnd = word.length() - 1;
- StringBuffer sb = new StringBuffer(attrText);
-
//find start and end of path property
while (bStart < bEnd &&
(sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
@@ -54,6 +55,7 @@
if (bEnd < bStart) bEnd = bStart;
return sb.substring(bStart, bEnd);
} catch (Exception x) {
+ //TODO remove that catch after study safety of code
return word;
}
}
@@ -63,41 +65,33 @@
}
static public Node findNodeForOffset(IDOMNode node, int offset) {
- Node result = null;
- try {
- if (!node.contains(offset)) return null;
+ if(node == null) return null;
+ if (!node.contains(offset)) return null;
- if (node.hasChildNodes()) {
- // Try to find the node in children
- NodeList children = node.getChildNodes();
- for (int i = 0; children != null && i < children.getLength(); i++) {
- IDOMNode child = (IDOMNode)children.item(i);
- if (child.contains(offset)) {
- result = findNodeForOffset(child, offset);
- return result;
- }
+ if (node.hasChildNodes()) {
+ // Try to find the node in children
+ NodeList children = node.getChildNodes();
+ for (int i = 0; children != null && i < children.getLength(); i++) {
+ IDOMNode child = (IDOMNode)children.item(i);
+ if (child.contains(offset)) {
+ return findNodeForOffset(child, offset);
}
}
+ }
// Not found in children or nave no children
- if (node.hasAttributes()) {
- // Try to find in the node attributes
- NamedNodeMap attributes = node.getAttributes();
-
- for (int i = 0; attributes != null && i < attributes.getLength(); i++) {
- IDOMNode attr = (IDOMNode)attributes.item(i);
- if (attr.contains(offset)) {
- result = attr;
- return attr;
- }
+ if (node.hasAttributes()) {
+ // Try to find in the node attributes
+ NamedNodeMap attributes = node.getAttributes();
+
+ for (int i = 0; attributes != null && i < attributes.getLength(); i++) {
+ IDOMNode attr = (IDOMNode)attributes.item(i);
+ if (attr.contains(offset)) {
+ return attr;
}
}
- // Return the node itself
- result = node;
- return node;
- } catch (Exception x) {
- ExtensionsPlugin.getPluginLog().logError("Error while finding node for offset", x);
- return null;
}
+ // Return the node itself
+ return node;
}
public static String getParentAxisForNode(Document xmlDocument, Node node) {
@@ -115,22 +109,19 @@
}
public static String trimFilePath(String name) {
- try {
- StringTokenizer st = new StringTokenizer(name.replace('\\', '/'), "/");
- String result = "";
- while(st.hasMoreTokens()) {
- String token = st.nextToken();
- if (!".".equals(token)){
- result += (result.length() == 0 ? token : "/" + token);
- }
+ if(name == null) return null;
+
+ StringTokenizer st = new StringTokenizer(name.replace('\\', '/'), "/");
+ String result = "";
+ while(st.hasMoreTokens()) {
+ String token = st.nextToken();
+ if (!".".equals(token)){
+ result += (result.length() == 0 ? token : "/" + token);
}
- if (name.startsWith("/"))
- result = "/" + result;
- return result;
- } catch (Exception x) {
- //ignore
}
- return name;
+ if (name.startsWith("/"))
+ result = "/" + result;
+ return result;
}
public static IPath getRelativePath (final IPath base, final IPath path) {
@@ -156,6 +147,17 @@
domAttr.getEndOffset() - domAttr.getValueRegionStartOffset()));
}
+ public static String getAttributeValue (IDocument document, Node node, String attrName) {
+ if(node == null || attrName == null || node.getAttributes() == null) return null;
+ Attr attr = (Attr)node.getAttributes().getNamedItem(attrName);
+ try {
+ return Utils.getTrimmedValue(document, attr);
+ } catch (BadLocationException x) {
+ ExtensionsPlugin.getPluginLog().logError(x);
+ return null;
+ }
+ }
+
public static int getValueStart(Node n) {
return (n instanceof IDOMAttr)
? ((IDOMAttr)n).getValueRegionStartOffset()
17 years, 8 months
JBoss Tools SVN: r7325 - in trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui: adopt and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 08:31:50 -0400 (Fri, 04 Apr 2008)
New Revision: 7325
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/JSFMultiPageContributor.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPAdopt.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPTokenizer.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/AuxiliaryFileLauncher.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/dnd/DndHelper.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/GroupEditPart.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/PageEditPart.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/ImportJSFWarOperation.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java
Log:
JBIDE-895
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/JSFMultiPageContributor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/JSFMultiPageContributor.java 2008-04-04 12:25:29 UTC (rev 7324)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/action/JSFMultiPageContributor.java 2008-04-04 12:31:50 UTC (rev 7325)
@@ -17,7 +17,6 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.actions.ActionFactory;
@@ -25,7 +24,6 @@
import org.eclipse.ui.ide.IDEActionFactory;
import org.eclipse.ui.texteditor.ITextEditor;
import org.jboss.tools.common.gef.action.ActionRegistrySupport;
-import org.jboss.tools.jsf.ui.JsfUiPlugin;
import org.jboss.tools.jsf.ui.editor.FacesConfigGuiEditor;
import org.jboss.tools.jsf.ui.editor.actions.JSFCutRetargetAction;
@@ -66,7 +64,7 @@
ActionRegistry registry = null;
if(fActiveEditorPart instanceof FacesConfigGuiEditor)
registry = (ActionRegistry)part.getAdapter(ActionRegistry.class);
- Iterator globalActionKeys = registrySupport.getGlobalActionKeys();
+ Iterator<String> globalActionKeys = registrySupport.getGlobalActionKeys();
while(globalActionKeys.hasNext()) {
String id = (String)globalActionKeys.next();
actionBars.setGlobalActionHandler(id, (registry == null ? null : registry.getAction(id)));
@@ -120,13 +118,9 @@
actionBars.updateActionBars();
}
- try {
- if(fToggleOccurencesMarkUp != null) {
- fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
- fToggleOccurencesMarkUp.update();
- }
- } catch (Exception x) {
- JsfUiPlugin.getPluginLog().logError(x);
+ if(fToggleOccurencesMarkUp != null) {
+ fToggleOccurencesMarkUp.setEditor(getTextEditor(part));
+ fToggleOccurencesMarkUp.update();
}
updateStatus();
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPAdopt.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPAdopt.java 2008-04-04 12:25:29 UTC (rev 7324)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPAdopt.java 2008-04-04 12:31:50 UTC (rev 7325)
@@ -12,6 +12,7 @@
import java.util.*;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.source.SourceViewer;
import org.jboss.tools.common.meta.XAdoptManager;
import org.jboss.tools.common.model.XModelObject;
@@ -33,13 +34,9 @@
}
protected boolean isAdoptableNature(XModelObject target) {
- try {
- String nature = (String)target.getModel().getProperties().get("nature");
- return JSF_NATURE_STRING.equalsIgnoreCase(nature);
- } catch (Exception x) {
- JsfUiPlugin.getPluginLog().logError("Error in checking nature", x);
- }
- return false;
+ if(target == null) return false;
+ String nature = (String)target.getModel().getProperties().get("nature");
+ return JSF_NATURE_STRING.equalsIgnoreCase(nature);
}
protected boolean isAdoptableBundle(XModelObject object) {
@@ -56,21 +53,22 @@
String bundle = getBundle(object.getParent());
int pos = -1;
try {
- String s = p.getProperty("pos");
+ String s = p == null ? null : p.getProperty("pos");
if(s != null && s.length() > 0) pos = Integer.parseInt(s);
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
SourceViewer viewer = (SourceViewer)p.get("viewer");
-
- JSPTokenizer tokenizer = new JSPTokenizer();
- Token root = null;
- try {
- root = tokenizer.parse(viewer.getDocument());
- } catch (Exception e) {
- JsfUiPlugin.getPluginLog().logError(e);
+ if(viewer == null) {
+ JsfUiPlugin.getPluginLog().logError("Viewer is null", new NullPointerException("Viewer is null"));
return;
}
+ if(viewer.getDocument() == null) {
+ return;
+ }
+
+ JSPTokenizer tokenizer = new JSPTokenizer();
+ Token root = tokenizer.parse(viewer.getDocument());
Token t = root.firstChild;
while(t != null) {
t = t.nextSibling;
@@ -86,7 +84,7 @@
if(prefix.equals("???")) {
WebPromptingProvider fProvider = WebPromptingProvider.getInstance();
- List l = fProvider.getList(target.getModel(), WebPromptingProvider.JSF_REGISTERED_BUNDLES, null, null);
+ List<Object> l = fProvider.getList(target.getModel(), WebPromptingProvider.JSF_REGISTERED_BUNDLES, null, null);
int map_index = 1;
Map map = l.size() <= map_index ? null : (Map)l.get(map_index);
if(map != null && map.containsKey(bundle)) prefix = map.get(bundle).toString();
@@ -102,7 +100,7 @@
try {
viewer.getDocument().replace(bp, 0, loadBundle);
if(pos >= bp) pos += loadBundle.length();
- } catch (Exception e) {
+ } catch (BadLocationException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
}
@@ -115,7 +113,7 @@
viewer.getDocument().replace(pos, 0, start);
viewer.setSelectedRange(pos, 0);
viewer.getTextWidget().setFocus();
- } catch (Exception e) {
+ } catch (BadLocationException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
p.remove("start text");
@@ -139,14 +137,10 @@
private int getContextIndex(JSPTokenizer tokenizer, int pos) {
if(tokenizer.root == null) return -1;
if (tokenizer.isInTagAttributeValue(pos)) return 0;
- try {
- Token e = tokenizer.getTokenAt(pos);
- if(e == null) return -1;
- if (e.kind == JSPTokenizer.TEXT || (pos == e.off)) {
- return 1;
- }
- } catch (Exception x) {
- JsfUiPlugin.getPluginLog().logError(x);
+ Token e = tokenizer.getTokenAt(pos);
+ if(e == null) return -1;
+ if (e.kind == JSPTokenizer.TEXT || (pos == e.off)) {
+ return 1;
}
return -1;
}
@@ -163,21 +157,17 @@
int pos = -1;
try {
- String s = p.getProperty("pos");
+ String s = p == null ? null : p.getProperty("pos");
if(s != null && s.length() > 0) pos = Integer.parseInt(s);
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
SourceViewer viewer = (SourceViewer)p.get("viewer");
+
+ if(viewer == null || viewer.getDocument() == null) return;
JSPTokenizer tokenizer = new JSPTokenizer();
- Token root = null;
- try {
- root = tokenizer.parse(viewer.getDocument());
- } catch (Exception e) {
- JsfUiPlugin.getPluginLog().logError(e);
- return;
- }
+ Token root = tokenizer.parse(viewer.getDocument());
int contextIndex = getContextIndex(tokenizer, pos);
String start = bundle;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPTokenizer.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPTokenizer.java 2008-04-04 12:25:29 UTC (rev 7324)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPTokenizer.java 2008-04-04 12:31:50 UTC (rev 7325)
@@ -33,7 +33,7 @@
int start = -1;
int end = -1;
- public Token parse(IDocument document) throws Exception {
+ public Token parse(IDocument document) {
selectionStart = 0;
selectionEnd = document.getLength();
text = document.get();
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/AuxiliaryFileLauncher.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/AuxiliaryFileLauncher.java 2008-04-04 12:25:29 UTC (rev 7324)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/AuxiliaryFileLauncher.java 2008-04-04 12:31:50 UTC (rev 7325)
@@ -30,9 +30,9 @@
IResource r = file.getParent().findMember(s);
if(!(r instanceof IFile) || !r.exists()) return;
IWorkbenchPage workbenchPage = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
- try {
+ if(workbenchPage != null) try {
workbenchPage.openEditor(new FileEditorInput((IFile)r), "org.jboss.tools.common.model.ui.editor.EditorPartWrapper");
- } catch (Exception e) {
+ } catch (PartInitException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/dnd/DndHelper.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/dnd/DndHelper.java 2008-04-04 12:25:29 UTC (rev 7324)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/dnd/DndHelper.java 2008-04-04 12:31:50 UTC (rev 7325)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.XModelTransferBuffer;
@@ -40,7 +41,7 @@
properties.setProperty("actionSourceGUIComponentID", "editor");
try {
copy.executeHandler((XModelObject) source, properties);
- } catch (Exception e) {
+ } catch (XModelException e) {
JsfUiPlugin.getPluginLog().logError(e);
XModelTransferBuffer.getInstance().disable();
return false;
@@ -64,7 +65,7 @@
}
try {
DnDUtil.paste((XModelObject) target, properties);
- } catch (Exception ex) {
+ } catch (XModelException ex) {
JsfUiPlugin.getPluginLog().logError(ex);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/GroupEditPart.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/GroupEditPart.java 2008-04-04 12:25:29 UTC (rev 7324)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/GroupEditPart.java 2008-04-04 12:31:50 UTC (rev 7325)
@@ -26,6 +26,7 @@
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.jboss.tools.common.meta.action.XAction;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.jsf.ui.JsfUiPlugin;
import org.jboss.tools.jsf.ui.editor.figures.GroupFigure;
@@ -61,7 +62,7 @@
if (action != null)
action.executeHandler((XModelObject) getGroupModel()
.getSource(), null);
- } catch (Exception e) {
+ } catch (XModelException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/PageEditPart.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/PageEditPart.java 2008-04-04 12:25:29 UTC (rev 7324)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/edit/PageEditPart.java 2008-04-04 12:31:50 UTC (rev 7325)
@@ -24,6 +24,7 @@
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.jboss.tools.common.meta.action.XAction;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.jsf.ui.JsfUiPlugin;
import org.jboss.tools.jsf.ui.editor.figures.PageFigure;
@@ -55,7 +56,7 @@
if (action != null)
action.executeHandler(
(XModelObject) getPageModel().getSource(), null);
- } catch (Exception e) {
+ } catch (XModelException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/ImportJSFWarOperation.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/ImportJSFWarOperation.java 2008-04-04 12:25:29 UTC (rev 7324)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/ImportJSFWarOperation.java 2008-04-04 12:31:50 UTC (rev 7325)
@@ -11,6 +11,7 @@
package org.jboss.tools.jsf.ui.operation;
import java.io.File;
+import java.io.IOException;
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.resources.IResource;
@@ -54,7 +55,7 @@
if(!warContext.isClassicEclipseProject()) {
try {
FileUtil.unjar(target, warLocation);
- } catch (Exception e) {
+ } catch (IOException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
for (int i = 0; i < os.length; i++) {
@@ -66,7 +67,7 @@
File webContent = new File(target, "WebContent");
try {
FileUtil.unjar(webContent, warLocation);
- } catch (Exception e) {
+ } catch (IOException e) {
JsfUiPlugin.getPluginLog().logError(e);
}
for (int i = 0; i < os.length; i++) {
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java 2008-04-04 12:25:29 UTC (rev 7324)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/preferences/JSFFlowTabbedPreferencesPage.java 2008-04-04 12:31:50 UTC (rev 7325)
@@ -14,7 +14,6 @@
import org.eclipse.ui.*;
import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintAList;
import org.jboss.tools.common.model.*;
-import org.jboss.tools.jsf.ui.JsfUiPlugin;
import org.jboss.tools.jsf.web.JSFTemplate;
public class JSFFlowTabbedPreferencesPage extends TabbedPreferencesPage implements IWorkbenchPreferencePage {
@@ -33,12 +32,10 @@
public void init(IWorkbench workbench) {}
void initTemplateList(XModelObject addView) {
- try {
- JSFTemplate templates = new JSFTemplate();
- XAttributeConstraintAList l = (XAttributeConstraintAList)addView.getModelEntity().getAttribute("Page Template").getConstraint();
- l.setValues(templates.getPageTemplateList());
- } catch (Exception e) {
- JsfUiPlugin.getPluginLog().logError(e);
- }
+ if(addView == null) return;
+ JSFTemplate templates = new JSFTemplate();
+ XAttributeConstraintAList l = (XAttributeConstraintAList)addView.getModelEntity().getAttribute("Page Template").getConstraint();
+ l.setValues(templates.getPageTemplateList());
}
+
}
17 years, 8 months
JBoss Tools SVN: r7324 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-04-04 08:25:29 -0400 (Fri, 04 Apr 2008)
New Revision: 7324
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java
Log:
code adjustment
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java 2008-04-04 12:24:19 UTC (rev 7323)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/EditableTemplateAdapter.java 2008-04-04 12:25:29 UTC (rev 7324)
@@ -710,8 +710,8 @@
TemplateManagingUtil.setSourceSelection(pageContext, targetSourceNode,
focusOffset, length);
- setSelectionRange(selection,
- targetVisualNode, new Point(focusOffset, length));
+ // setSelectionRange(selection,
+ // targetVisualNode, new Point(focusOffset, length));
// check for text node
if (targetVisualNode.getNodeType() != nsIDOMNode.ELEMENT_NODE)
@@ -816,12 +816,13 @@
}
- TemplateManagingUtil.setSourceSelection(pageContext, targetSourceNode, selectionOffset, selectionLength);
-
- setSelectionRange(selectionController
- .getSelection(nsISelectionController.SELECTION_NORMAL),
- targetVisualNode, new Point(selectionOffset, selectionLength));
+ TemplateManagingUtil.setSourceSelection(pageContext, targetSourceNode,
+ selectionOffset, selectionLength);
+ // setSelectionRange(selectionController
+ // .getSelection(nsISelectionController.SELECTION_NORMAL),
+ // targetVisualNode, new Point(selectionOffset, selectionLength));
+
// check for text node
if (targetVisualNode.getNodeType() != nsIDOMNode.ELEMENT_NODE) {
targetVisualNode = targetVisualNode.getParentNode();
@@ -1121,6 +1122,8 @@
.getSelectionRangeFromInputElement(focusedNode);
} else {
+
+ ;
range.x = selection.getFocusOffset();
range.y = selection.getAnchorOffset()
- selection.getFocusOffset();
@@ -1139,14 +1142,13 @@
protected void setSelectionRange(nsISelection selection, nsIDOMNode node,
Point range) {
- selection.removeAllRanges();
if (node.getNodeType() == nsIDOMNode.TEXT_NODE) {
selection.collapse(node, range.x);
// if(visualFocus!=visualAnchor)
// selection.extend(visualNode, visualAnchor );
} else {
-
+
if ((HTML.TAG_INPUT.equalsIgnoreCase(node.getLocalName()))
|| (HTML.TAG_TEXTAREA.equalsIgnoreCase(node.getLocalName()))) {
TemplateManagingUtil.setSelectionRangeInInputElement(node,
17 years, 8 months
JBoss Tools SVN: r7323 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 08:24:19 -0400 (Fri, 04 Apr 2008)
New Revision: 7323
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/AbstractWebProjectTemplate.java
Log:
JBIDE-895
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/AbstractWebProjectTemplate.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/AbstractWebProjectTemplate.java 2008-04-04 12:22:24 UTC (rev 7322)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/AbstractWebProjectTemplate.java 2008-04-04 12:24:19 UTC (rev 7323)
@@ -97,12 +97,12 @@
getTemplates(templateDir, getNatureDir(), pages);
}
- public Map getPageTemplates() {
+ public Map<String,File> getPageTemplates() {
return pages;
}
public String[] getPageTemplateList() {
- return (String[])pages.keySet().toArray(new String[0]);
+ return pages.keySet().toArray(new String[0]);
}
private void getTemplates(File parent, String name, Map<String,File> templates) {
17 years, 8 months
JBoss Tools SVN: r7322 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 08:22:24 -0400 (Fri, 04 Apr 2008)
New Revision: 7322
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
Log:
JBIDE-895
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2008-04-04 12:20:05 UTC (rev 7321)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/FileUtil.java 2008-04-04 12:22:24 UTC (rev 7322)
@@ -278,7 +278,7 @@
}
}
- public static void unjar(File dest, String jar) throws Exception {
+ public static void unjar(File dest, String jar) throws IOException {
dest.mkdirs();
JarFile jf = new JarFile(jar);
try {
@@ -311,7 +311,7 @@
}
}
- public static void unjar(File dest, InputStream is) throws Exception {
+ public static void unjar(File dest, InputStream is) throws IOException {
dest.mkdirs();
JarInputStream jis = new JarInputStream(is);
try {
17 years, 8 months
JBoss Tools SVN: r7321 - trunk/common/plugins/org.jboss.tools.common.gef/src/org/jboss/tools/common/gef/action.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-04 08:20:05 -0400 (Fri, 04 Apr 2008)
New Revision: 7321
Modified:
trunk/common/plugins/org.jboss.tools.common.gef/src/org/jboss/tools/common/gef/action/ActionRegistrySupport.java
Log:
JBIDE-895
Modified: trunk/common/plugins/org.jboss.tools.common.gef/src/org/jboss/tools/common/gef/action/ActionRegistrySupport.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.gef/src/org/jboss/tools/common/gef/action/ActionRegistrySupport.java 2008-04-04 11:44:22 UTC (rev 7320)
+++ trunk/common/plugins/org.jboss.tools.common.gef/src/org/jboss/tools/common/gef/action/ActionRegistrySupport.java 2008-04-04 12:20:05 UTC (rev 7321)
@@ -36,7 +36,7 @@
globalActionKeys.add(key);
}
- public Iterator getGlobalActionKeys() {
+ public Iterator<String> getGlobalActionKeys() {
return globalActionKeys.iterator();
}
17 years, 8 months