Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 167352 Details for
Bug 252861
[WPE] Add tag converter transform operation in WPE to support generating markup depending on view mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch with new transform operation and addition to the operations registered in the plugin.xml
patch-bug252861.txt (text/plain), 10.91 KB, created by
Carlin Rogers
on 2010-05-06 13:45:14 EDT
(
hide
)
Description:
patch with new transform operation and addition to the operations registered in the plugin.xml
Filename:
MIME Type:
Creator:
Carlin Rogers
Created:
2010-05-06 13:45:14 EDT
Size:
10.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.pagedesigner >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsf/components/jsf/plugins/org.eclipse.jst.pagedesigner/plugin.xml,v >retrieving revision 1.26 >diff -u -r1.26 plugin.xml >--- plugin.xml 9 Mar 2010 20:24:10 -0000 1.26 >+++ plugin.xml 6 May 2010 17:35:00 -0000 >@@ -53,74 +53,78 @@ > > <extension point="org.eclipse.jst.pagedesigner.pageDesignerExtension"> > <linkCreator class="org.eclipse.jst.pagedesigner.actions.link.HtmlLinkCreator" linkIdentifier="Html Link"/> >- <tagTransformOperation >+ <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.AppendChildElementOperation" > id="AppendChildElementOperation"> >- </tagTransformOperation> >+ </tagTransformOperation> > <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.AppendChildTextFromXPathOperation" > id="AppendChildTextFromXPathOperation"> >- </tagTransformOperation> >+ </tagTransformOperation> > <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.AppendChildTextOperation" > id="AppendChildTextOperation"> >- </tagTransformOperation> >+ </tagTransformOperation> > <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.ConvertAttributeToTextOperation" > id="ConvertAttributeToTextOperation"> >- </tagTransformOperation> >+ </tagTransformOperation> > <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.CopyAllAttributesOperation" > id="CopyAllAttributesOperation"> >- </tagTransformOperation> >+ </tagTransformOperation> > <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.CopyAttributeOperation" > id="CopyAttributeOperation"> >- </tagTransformOperation> >+ </tagTransformOperation> > <tagTransformOperation >- class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.CopyAttributeWithRenameOperation" >- id="CopyAttributeWithRenameOperation"> >+ class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.CopyAttributeWithRenameOperation" >+ id="CopyAttributeWithRenameOperation"> > </tagTransformOperation> > <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.CopyChildrenOperation" > id="CopyChildrenOperation"> >- </tagTransformOperation> >+ </tagTransformOperation> > <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.CreateAttributeFromXPathOperation" > id="CreateAttributeFromXPathOperation"> >- </tagTransformOperation> >+ </tagTransformOperation> > <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.CreateAttributeOperation" > id="CreateAttributeOperation"> >- </tagTransformOperation> >- <tagTransformOperation >+ </tagTransformOperation> >+ <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.CreateElementOperation" > id="CreateElementOperation"> >- </tagTransformOperation> >- <tagTransformOperation >+ </tagTransformOperation> >+ <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.IfNotOperation" > id="IfNotOperation"> >- </tagTransformOperation> >- <tagTransformOperation >+ </tagTransformOperation> >+ <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.IfOperation" > id="IfOperation"> >- </tagTransformOperation> >- <tagTransformOperation >+ </tagTransformOperation> >+ <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.IterateOverElementsOperation" > id="IterateOverElementsOperation"> >- </tagTransformOperation> >- <tagTransformOperation >+ </tagTransformOperation> >+ <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.MakeParentElementCurrentOperation" > id="MakeParentElementCurrentOperation"> >- </tagTransformOperation> >- <tagTransformOperation >+ </tagTransformOperation> >+ <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.RemoveAttributeOperation" > id="RemoveAttributeOperation"> >- </tagTransformOperation> >- <tagTransformOperation >+ </tagTransformOperation> >+ <tagTransformOperation > class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.RenameAttributeOperation" > id="RenameAttributeOperation"> >- </tagTransformOperation> >+ </tagTransformOperation> >+ <tagTransformOperation >+ class="org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal.CheckModeOperation" >+ id="CheckModeOperation"> >+ </tagTransformOperation> > </extension> > > <extension id="org.eclipse.jst.pagedesigner.commands" point="org.eclipse.ui.commands"> >Index: src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DTTagConverterContext.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsf/components/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DTTagConverterContext.java,v >retrieving revision 1.2 >diff -u -r1.2 DTTagConverterContext.java >--- src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DTTagConverterContext.java 8 May 2007 20:30:51 -0000 1.2 >+++ src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DTTagConverterContext.java 6 May 2010 17:35:00 -0000 >@@ -11,6 +11,7 @@ > package org.eclipse.jst.pagedesigner.dtmanager.converter.internal; > > import org.eclipse.jst.pagedesigner.converter.ConvertPosition; >+import org.eclipse.jst.pagedesigner.converter.IConverterFactory; > import org.eclipse.jst.pagedesigner.dtmanager.converter.AbstractTagConverterContext; > import org.w3c.dom.Element; > import org.w3c.dom.Node; >@@ -76,4 +77,23 @@ > } > } > >+ /** >+ * Utility method to get the current converter mode. Values are >+ * defined in <code>IConverterFactory</code>. >+ * >+ * <br>This method is available on the DTTagConverter but was not >+ * part of the ITagConverter and not available as a public API. >+ * The addition of this method allows an ITransformOperation for >+ * a DTTagConverter to get at the mode. >+ * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=252861 >+ * >+ * @return the converter mode. If unable to get the mode, return -1. >+ */ >+ public int getMode() { >+ if (tagConverter != null) { >+ return ((DTTagConverter) tagConverter).getMode(); >+ } >+ >+ return IConverterFactory.MODE_DESIGNER; >+ } > } >Index: src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CheckModeOperation.java >=================================================================== >RCS file: src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CheckModeOperation.java >diff -N src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CheckModeOperation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CheckModeOperation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,81 @@ >+/******************************************************************************* >+* Copyright (c) 2010 Oracle Corporation and others. >+* All rights reserved. This program and the accompanying materials >+* are made available under the terms of the Eclipse Public License v1.0 >+* which accompanies this distribution, and is available at >+* http://www.eclipse.org/legal/epl-v10.html >+* >+* Contributors: >+* Oracle Corporation - initial API and implementation and/or initial documentation >+*******************************************************************************/ >+package org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.jst.pagedesigner.converter.IConverterFactory; >+import org.eclipse.jst.pagedesigner.dtmanager.converter.internal.DTTagConverterContext; >+import org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation; >+import org.w3c.dom.Element; >+ >+ >+/** >+ * Transform operation that executes child ITransformOperation >+ * instances if the view mode matches the argument (parameter) provided. >+ * >+ * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext() to >+ * have been called to provide a valid ITagConverterContext instance prior to >+ * a call to the transform() method. >+ */ >+public class CheckModeOperation extends AbstractTransformOperation { >+ >+ /** >+ * Constant indicating the current render mode is design >+ */ >+ public static final String MODE_DESIGN = "design"; //$NON-NLS-1$ >+ /** >+ * Constant indicating the current render mode is preview >+ */ >+ public static final String MODE_PREVIEW = "preview"; //$NON-NLS-1$ >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.jst.pagedesigner.dtmanager.converter.ITransformOperation#transform(org.w3c.dom.Element, org.w3c.dom.Element) >+ */ >+ @Override >+ public Element transform(Element srcElement, Element curElement) { >+ if (getParameters().length < 1) { >+ getLog().error("Warning.TransformOperationFactory.TooFewParameters", //$NON-NLS-1$ >+ getTransformOperationID()); >+ return null; >+ } >+ >+ String modeParam = getParameters()[0]; >+ Assert.isNotNull(modeParam); >+ >+ int currentMode = getMode(); >+ if ((MODE_DESIGN.equals(modeParam) && currentMode == IConverterFactory.MODE_DESIGNER) >+ || (MODE_PREVIEW.equals(modeParam) && currentMode == IConverterFactory.MODE_PREVIEW)) { >+ return executeChildOperations(srcElement, curElement); >+ } >+ >+ // if we haven't transformed the element at all, and this is >+ // just the initial transform, return null >+ if (srcElement == curElement) { >+ return null; >+ } >+ >+ // otherwise, return the currently transformed element >+ return curElement; >+ } >+ >+ /** >+ * @return the converter mode. If unable to get the mode, return -1. >+ */ >+ protected int getMode() { >+ if (tagConverterContext != null >+ && tagConverterContext instanceof DTTagConverterContext) { >+ return ((DTTagConverterContext) tagConverterContext).getMode(); >+ } >+ >+ return -1; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 252861
: 167352 |
167521