Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbateman2006-11-22 19:31:27 +0000
committercbateman2006-11-22 19:31:27 +0000
commitea2a101ddf171c5440035d5f41bdbcfab56d4dae (patch)
tree721d7d0f81a971937c829b3f98070663bb796eb7 /jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter
parent164b3b30cffdfb86f0207ddc71962f17fde3602f (diff)
downloadwebtools.jsf-ea2a101ddf171c5440035d5f41bdbcfab56d4dae.tar.gz
webtools.jsf-ea2a101ddf171c5440035d5f41bdbcfab56d4dae.tar.xz
webtools.jsf-ea2a101ddf171c5440035d5f41bdbcfab56d4dae.zip
Code cleanup including:
- some deprecated fixes - fixed some try-catch statements - removed unnecessary casts - renamed member shadowing locals - removed unnecessary else statements - commented out unused variables and dead code.
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter')
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java22
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDeepTagConverter.java32
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java4
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HTMLStringTagConverter.java2
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java3
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/ATagConverter.java3
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/IncludeTagConverterPreview.java19
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/JSPConverterFactory.java16
9 files changed, 54 insertions, 54 deletions
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java
index 8bfd3ecdd..5f7e65151 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java
@@ -180,6 +180,10 @@ public abstract class AbstractTagConverter implements ITagConverter,
* @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#dispose()
*/
public void dispose() {
+ // do nothing; children may wish to sub-class
+ // TODO: null shared references?
+ // this doesn't seem to be called by anybody..
+ // need to review this
}
protected boolean shouldIgnore(Node node) {
@@ -234,9 +238,8 @@ public abstract class AbstractTagConverter implements ITagConverter,
public IDOMDocument getDestDocument() {
if (this._targetDocument != null) {
return this._targetDocument;
- } else {
- return (IDOMDocument) _hostElement.getOwnerDocument();
}
+ return (IDOMDocument) _hostElement.getOwnerDocument();
}
/**
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java
index ba738678e..483ecdf9e 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java
@@ -91,19 +91,17 @@ public class ConverterFactoryRegistry {
if (uri == null || IJMTConstants.URI_HTML.equals(uri)) {
// basically, for HTML or non JSP tag, directly renders it.
return new DumTagConverter(ele);
- } else {
- CMElementDeclaration decl = CMUtil.getElementDeclaration(ele);
- if (decl == null) {
- return new DumTagConverter(ele);
- }
- int contentType = decl.getContentType();
- if (contentType == CMElementDeclaration.EMPTY) {
- // if the tag is empty, show it as icon.
- return new HiddenTagConverter(ele, getUnknownImage());
- } else {
- return new DefaultUnknownTagConverter(ele);
- }
}
+ CMElementDeclaration decl = CMUtil.getElementDeclaration(ele);
+ if (decl == null) {
+ return new DumTagConverter(ele);
+ }
+ int contentType = decl.getContentType();
+ if (contentType == CMElementDeclaration.EMPTY) {
+ // if the tag is empty, show it as icon.
+ return new HiddenTagConverter(ele, getUnknownImage());
+ }
+ return new DefaultUnknownTagConverter(ele);
}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDeepTagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDeepTagConverter.java
index c56d0760c..079487bcd 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDeepTagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDeepTagConverter.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.jst.pagedesigner.converter;
-import org.eclipse.jst.pagedesigner.IHTMLConstants;
import org.eclipse.jst.pagedesigner.dom.DOMUtil;
import org.w3c.dom.Element;
@@ -51,21 +50,22 @@ public class DumDeepTagConverter extends AbstractTagConverter {
* @param result
* @return
*/
- private boolean internalIsWidget(Element result) {
- String tagname = result.getTagName();
- if (IHTMLConstants.TAG_INPUT.equalsIgnoreCase(tagname)
- || IHTMLConstants.TAG_SELECT.equalsIgnoreCase(tagname)
- || IHTMLConstants.TAG_TEXTAREA.equalsIgnoreCase(tagname)
- || IHTMLConstants.TAG_IMG.equalsIgnoreCase(tagname)
- || IHTMLConstants.TAG_HEAD.equalsIgnoreCase(tagname)
- || IHTMLConstants.TAG_SCRIPT.equalsIgnoreCase(tagname)
- || IHTMLConstants.TAG_LINK.equalsIgnoreCase(tagname)) {
- return true;
- } else {
-
- return false;
- }
- }
+ // TODO: dead?
+// private boolean internalIsWidget(Element result) {
+// String tagname = result.getTagName();
+// if (IHTMLConstants.TAG_INPUT.equalsIgnoreCase(tagname)
+// || IHTMLConstants.TAG_SELECT.equalsIgnoreCase(tagname)
+// || IHTMLConstants.TAG_TEXTAREA.equalsIgnoreCase(tagname)
+// || IHTMLConstants.TAG_IMG.equalsIgnoreCase(tagname)
+// || IHTMLConstants.TAG_HEAD.equalsIgnoreCase(tagname)
+// || IHTMLConstants.TAG_SCRIPT.equalsIgnoreCase(tagname)
+// || IHTMLConstants.TAG_LINK.equalsIgnoreCase(tagname)) {
+// return true;
+// } else {
+//
+// return false;
+// }
+// }
/*
* (non-Javadoc)
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java
index 6abec2f10..43c987e2f 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java
@@ -77,10 +77,8 @@ public class DumTagConverter extends AbstractTagConverter {
|| IHTMLConstants.TAG_STYLE.equalsIgnoreCase(tagname)
|| IHTMLConstants.TAG_HR.equalsIgnoreCase(tagname)) {
return true;
- } else {
-
- return false;
}
+ return false;
}
/*
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HTMLStringTagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HTMLStringTagConverter.java
index 610b0c061..4e9f4009d 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HTMLStringTagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HTMLStringTagConverter.java
@@ -18,8 +18,8 @@ import org.eclipse.jst.pagedesigner.PDPlugin;
import org.eclipse.jst.pagedesigner.common.logging.Logger;
import org.eclipse.jst.pagedesigner.common.utils.ResourceUtils;
import org.eclipse.jst.pagedesigner.dom.DOMUtil;
+import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.w3c.dom.Element;
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java
index 23714d7ad..122afec79 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java
@@ -47,6 +47,7 @@ public class HiddenTagConverter implements ITagConverter {
* @see org.eclipse.jst.pagedesigner.converter.ITagConverter#setDestDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)
*/
public void setDestDocument(IDOMDocument document) {
+ // do nothing?
}
/*
@@ -136,6 +137,8 @@ public class HiddenTagConverter implements ITagConverter {
* @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#dispose()
*/
public void dispose() {
+ // do nothing
+ // TODO: dispose of image or Element here?
}
/*
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/ATagConverter.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/ATagConverter.java
index ab9708102..a86dd8902 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/ATagConverter.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/ATagConverter.java
@@ -43,9 +43,8 @@ public class ATagConverter extends DumTagConverter {
Text fakedNode = createText("link");
resultEle.appendChild(fakedNode);
return resultEle;
- } else {
- return super.doConvertRefresh();
}
+ return super.doConvertRefresh();
}
/*
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/IncludeTagConverterPreview.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/IncludeTagConverterPreview.java
index 00c0f9909..a0d46ca46 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/IncludeTagConverterPreview.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/IncludeTagConverterPreview.java
@@ -66,17 +66,15 @@ public class IncludeTagConverterPreview extends AbstractTagConverter {
String fileName = getResolvedURL(getHostElement(), this._fileAttrName);
if (fileName == null || fileName.length() == 0) {
return null;
- } else {
- IPath includedPath = new Path(fileName);
- includedPath.makeAbsolute();
-
- IFile file = getFile(includedPath);
- if (file == null) {
- return null;
- } else {
- return previewFile(file);
- }
}
+ IPath includedPath = new Path(fileName);
+ includedPath.makeAbsolute();
+
+ IFile file = getFile(includedPath);
+ if (file == null) {
+ return null;
+ }
+ return previewFile(file);
}
public IFile getFile(IPath includedPath) {
@@ -165,6 +163,7 @@ public class IncludeTagConverterPreview extends AbstractTagConverter {
static String getResolvedURL(Element element, String attrName) {
URIResolver resolver = null;
if (element instanceof IDOMNode) {
+ // TODO: the new URI resolver is not available on the IStructuredModel
resolver = ((IDOMNode) element).getModel().getResolver();
}
if (null == resolver) {
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/JSPConverterFactory.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/JSPConverterFactory.java
index 9931241f4..b969136d0 100644
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/JSPConverterFactory.java
+++ b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/JSPConverterFactory.java
@@ -30,6 +30,7 @@ public class JSPConverterFactory implements IConverterFactory {
*
*/
public JSPConverterFactory() {
+ // do nothing
}
/*
@@ -63,15 +64,14 @@ public class JSPConverterFactory implements IConverterFactory {
} else {
return new HiddenTagConverter(element, image);
}
- } else {
- if (IJSPCoreConstants.TAG_ROOT.equalsIgnoreCase(tagName)) {
- TagConverterToDumBlock c = new TagConverterToDumBlock(element);
- c.setNeedBorderDecorator(true);
- c.setMode(mode);
- return c;
- }
- return new HiddenTagConverter(element, image);
}
+ if (IJSPCoreConstants.TAG_ROOT.equalsIgnoreCase(tagName)) {
+ TagConverterToDumBlock c = new TagConverterToDumBlock(element);
+ c.setNeedBorderDecorator(true);
+ c.setMode(mode);
+ return c;
+ }
+ return new HiddenTagConverter(element, image);
}
/**

Back to the top