Author: mareshkau
Date: 2008-11-05 07:13:29 -0500 (Wed, 05 Nov 2008)
New Revision: 11522
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/AbstractActionManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHref.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
Log:
code adjustment, removing suspect copy past
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/AbstractActionManager.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/AbstractActionManager.java 2008-11-05
12:01:10 UTC (rev 11521)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/AbstractActionManager.java 2008-11-05
12:13:29 UTC (rev 11522)
@@ -568,97 +568,4 @@
return model;
}
- /**
- * @depracated
- */
- public class InsertAction extends NodeAction {
- protected String description;
-
- protected int nodeType;
-
- protected int index;
-
- protected Node parent;
-
- public InsertAction(int nodeType, Node parent, int index) {
- this.nodeType = nodeType;
- this.index = index;
- this.parent = parent;
- switch (nodeType) {
- case Node.COMMENT_NODE: {
- description = XMLCommonResources.getInstance().getString(
- "_UI_MENU_COMMENT"); //$NON-NLS-1$
- break;
- }
- case Node.PROCESSING_INSTRUCTION_NODE: {
- description = XMLCommonResources.getInstance().getString(
- "_UI_MENU_PROCESSING_INSTRUCTION"); //$NON-NLS-1$
- break;
- }
- case Node.CDATA_SECTION_NODE: {
- description = XMLCommonResources.getInstance().getString(
- "_UI_MENU_CDATA_SECTION"); //$NON-NLS-1$
- break;
- }
- case Node.TEXT_NODE: {
- description = XMLCommonResources.getInstance().getString(
- "_UI_MENU_PCDATA"); //$NON-NLS-1$
- break;
- }
- }
- setText(description);
- }
-
- public InsertAction(int nodeType, Node parent, int index, String title) {
- this.nodeType = nodeType;
- this.index = index;
- this.parent = parent;
- description = title;
- setText(description);
- }
-
- public String getUndoDescription() {
- return XMLCommonResources.getInstance().getString("_UI_MENU_ADD") + "
" + description; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void run() {
- beginNodeAction(this);
-
- Document document = parent.getNodeType() == Node.DOCUMENT_NODE ? (Document) parent
- : parent.getOwnerDocument();
- Node newChildNode = null;
- boolean format = true;
- switch (nodeType) {
- case Node.COMMENT_NODE: {
- newChildNode = document.createComment(XMLCommonResources
- .getInstance().getString("_UI_COMMENT_VALUE")); //$NON-NLS-1$
- break;
- }
- case Node.PROCESSING_INSTRUCTION_NODE: {
- newChildNode = document
- .createProcessingInstruction(
- XMLCommonResources.getInstance().getString(
- "_UI_PI_TARGET_VALUE"),
XMLCommonResources.getInstance().getString("_UI_PI_DATA_VALUE")); //$NON-NLS-1$
//$NON-NLS-2$
- break;
- }
- case Node.CDATA_SECTION_NODE: {
- newChildNode = document.createCDATASection(""); //$NON-NLS-1$
- break;
- }
- case Node.TEXT_NODE: {
- format = false;
- newChildNode = document.createTextNode(parent.getNodeName());
- break;
- }
- }
-
- if (newChildNode != null) {
- List list = new Vector(1);
- list.add(newChildNode);
- insertNodesAtIndex(2, parent, list, index, format);
- }
-
- endNodeAction(this);
- }
- }
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHref.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHref.java 2008-11-05
12:01:10 UTC (rev 11521)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHref.java 2008-11-05
12:13:29 UTC (rev 11522)
@@ -19,6 +19,7 @@
import org.w3c.dom.Node;
import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
public class VpeFunctionHref extends VpeFunctionSrc {
@Override
@@ -64,7 +65,7 @@
imgPath = inputPath.append(tagValue);
} else {
IPath basePath = tagPath.isAbsolute()
- ? getRootPath(input)
+ ? VpeStyleUtil.getRootPath(input)
: inputPath;
if (basePath != null) {
imgPath = basePath.append(tagPath);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2008-11-05
12:01:10 UTC (rev 11521)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2008-11-05
12:13:29 UTC (rev 11522)
@@ -15,7 +15,6 @@
import java.net.URLDecoder;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.IDocument;
@@ -27,16 +26,13 @@
import org.jboss.tools.common.kb.KbException;
import org.jboss.tools.common.kb.ParamList;
import org.jboss.tools.common.kb.wtp.WtpKbConnector;
-import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.model.project.IModelNature;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.resref.core.ResourceReference;
-import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.tld.IFilePathEncoder;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreatorUtil;
import org.jboss.tools.vpe.editor.util.ElService;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.w3c.dom.Node;
public class VpeFunctionSrc extends VpeFunction {
@@ -90,7 +86,7 @@
if (input instanceof ILocationProvider) {
imgPath = inputPath.append(tagValue);
} else {
- IPath basePath = tagPath.isAbsolute() ? getRootPath(input)
+ IPath basePath = tagPath.isAbsolute() ? VpeStyleUtil.getRootPath(input)
: inputPath;
if (basePath != null) {
imgPath = basePath.append(tagPath);
@@ -153,31 +149,6 @@
return inputPath;
}
- protected IPath getRootPath(IEditorInput input) {
- IPath rootPath = null;
- if (input instanceof IFileEditorInput) {
- IProject project = ((IFileEditorInput) input).getFile()
- .getProject();
- if (project != null && project.isOpen()) {
- IModelNature modelNature = EclipseResourceUtil
- .getModelNature(project);
- if (modelNature != null) {
- XModel model = modelNature.getModel();
- String rootPathStr = WebProject.getInstance(model)
- .getWebRootLocation();
- if (rootPathStr != null) {
- rootPath = new Path(rootPathStr);
- } else {
- rootPath = project.getLocation();
- }
- } else {
- rootPath = project.getLocation();
- }
- }
- }
- return rootPath;
- }
-
protected String getUnresolved() {
return IMG_PREFIX + getAbsoluteResourcePath(IMG_UNRESOLVED).replace('\\',
'/');
}
Show replies by date