From 996a563fe61f841276c5cdbc7db21cba08006233 Mon Sep 17 00:00:00 2001 From: Sungho Park Date: Mon, 27 Feb 2012 21:20:00 +0900 Subject: [PATCH] Initialize --- AUTHORS | 7 + LICENSE-2.0.htm | 388 +++ NOTICE | 1 + builder/build.properties.clean | 259 ++ builder/customTargets.xml | 187 ++ org.eclipse.jst.pagedesigner.patch/.classpath | 7 + org.eclipse.jst.pagedesigner.patch/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 8 + .../META-INF/MANIFEST.MF | 12 + .../build.properties | 4 + .../converter/html/HTMLConverterFactory.java | 91 + .../properties/AttributePropertySource.java | 259 ++ org.eclipse.jst.pagedesigner/.classpath | 7 + org.eclipse.jst.pagedesigner/.cvsignore | 3 + org.eclipse.jst.pagedesigner/.options | 5 + org.eclipse.jst.pagedesigner/.project | 30 + .../.settings/org.eclipse.core.resources.prefs | 3 + .../.settings/org.eclipse.jdt.core.prefs | 87 + .../.settings/org.eclipse.jdt.ui.prefs | 3 + .../.settings/org.eclipse.pde.prefs | 22 + org.eclipse.jst.pagedesigner/META-INF/MANIFEST.MF | 135 + org.eclipse.jst.pagedesigner/about.html | 22 + org.eclipse.jst.pagedesigner/build.properties | 23 + org.eclipse.jst.pagedesigner/default.properties | 12 + org.eclipse.jst.pagedesigner/icons/LineBreak.gif | Bin 0 -> 885 bytes org.eclipse.jst.pagedesigner/icons/MoveHandle.png | Bin 0 -> 183 bytes org.eclipse.jst.pagedesigner/icons/PD_Binding.gif | Bin 0 -> 133 bytes .../icons/PD_Binding_disabled.gif | Bin 0 -> 852 bytes org.eclipse.jst.pagedesigner/icons/PD_Plugin.gif | Bin 0 -> 605 bytes .../icons/PD_Toolbar_bold.gif | Bin 0 -> 923 bytes .../icons/PD_Toolbar_bold_disabled.gif | Bin 0 -> 870 bytes .../icons/PD_Toolbar_designer.gif | Bin 0 -> 248 bytes .../icons/PD_Toolbar_hsplit.gif | Bin 0 -> 119 bytes .../icons/PD_Toolbar_italic.gif | Bin 0 -> 880 bytes .../icons/PD_Toolbar_italic_disabled.gif | Bin 0 -> 862 bytes .../icons/PD_Toolbar_largefont.gif | Bin 0 -> 888 bytes .../icons/PD_Toolbar_largefont_disabled.gif | Bin 0 -> 867 bytes .../icons/PD_Toolbar_paragraph.gif | Bin 0 -> 581 bytes .../icons/PD_Toolbar_smallfont.gif | Bin 0 -> 854 bytes .../icons/PD_Toolbar_smallfont_disabled.gif | Bin 0 -> 852 bytes .../icons/PD_Toolbar_source.gif | Bin 0 -> 153 bytes .../icons/PD_Toolbar_underline.gif | Bin 0 -> 916 bytes .../icons/PD_Toolbar_underline_disabled.gif | Bin 0 -> 882 bytes .../icons/PD_Toolbar_vsplit.gif | Bin 0 -> 113 bytes org.eclipse.jst.pagedesigner/icons/PD_nopic.jpg | Bin 0 -> 1006 bytes org.eclipse.jst.pagedesigner/icons/library_obj.gif | Bin 0 -> 338 bytes .../icons/newsuade_wiz.gif | Bin 0 -> 3148 bytes .../palette/GENERIC/large/PD_Palette_Default.gif | Bin 0 -> 300 bytes .../palette/GENERIC/small/PD_Palette_Default.gif | Bin 0 -> 82 bytes .../palette/GENERIC/small/PD_Palette_Export.gif | Bin 0 -> 958 bytes .../GENERIC/small/PD_Palette_Export_Disabled.gif | Bin 0 -> 956 bytes .../GENERIC/small/PD_Palette_Export_Hover.gif | Bin 0 -> 958 bytes .../palette/GENERIC/small/PD_Palette_Import.gif | Bin 0 -> 958 bytes .../GENERIC/small/PD_Palette_Import_Disabled.gif | Bin 0 -> 957 bytes .../GENERIC/small/PD_Palette_Import_Hover.gif | Bin 0 -> 958 bytes org.eclipse.jst.pagedesigner/icons/pin_down.gif | Bin 0 -> 133 bytes org.eclipse.jst.pagedesigner/icons/pin_up.gif | Bin 0 -> 138 bytes org.eclipse.jst.pagedesigner/icons/skin.png | Bin 0 -> 1136 bytes org.eclipse.jst.pagedesigner/model/DTInfo.ecore | 84 + org.eclipse.jst.pagedesigner/model/DTInfo.genmodel | 48 + .../model/QuickEditTabSections.ecore | 24 + .../model/QuickEditTabSections.genmodel | 28 + org.eclipse.jst.pagedesigner/plugin.properties | 37 + org.eclipse.jst.pagedesigner/plugin.xml | 280 ++ .../schema/pageDesignerExtension.exsd | 306 ++ .../schema/popupMenuContributor.exsd | 83 + .../schema/propertyContributor.exsd | 89 + .../schema/tagProperty.xsd | 154 + .../eclipse/jst/pagedesigner/IHTMLConstants.java | 1147 ++++++++ .../eclipse/jst/pagedesigner/IJMTConstants.java | 112 + .../jst/pagedesigner/JMTResources.properties | 258 ++ .../src/org/eclipse/jst/pagedesigner/PDPlugin.java | 456 +++ .../jst/pagedesigner/PageDesignerTraceOptions.java | 111 + .../actions/container/ContainerActionGroup.java | 99 + .../actions/link/AbstractLinkCreator.java | 59 + .../actions/link/CreateLinkWizard.java | 109 + .../pagedesigner/actions/link/ExtensionReader.java | 83 + .../pagedesigner/actions/link/HtmlLinkCreator.java | 69 + .../pagedesigner/actions/link/ILinkCreator.java | 49 + .../jst/pagedesigner/actions/link/LinkRequest.java | 48 + .../jst/pagedesigner/actions/link/LinkUtil.java | 93 + .../pagedesigner/actions/link/LinkWizardPage.java | 168 ++ .../pagedesigner/actions/link/MakeLinkAction.java | 215 ++ .../pagedesigner/actions/link/MakeLinkCommand.java | 103 + .../CustomedContextMenuActionGroup.java | 132 + .../actions/menuextension/RunAction.java | 125 + .../pagedesigner/actions/range/AlignSupport.java | 58 + .../actions/range/ChangeStyleAction.java | 178 ++ .../actions/range/DesignerToolBarAction.java | 155 + .../actions/range/HTagsInsertGroupAction.java | 180 ++ .../actions/range/InsertTagChangeStyleAction.java | 91 + .../actions/range/NoneParagraphStyleAction.java | 94 + .../actions/range/NoneStyleAction.java | 67 + .../actions/range/ParagraphAction.java | 28 + .../actions/range/ParagraphStyleAction.java | 153 + .../actions/range/ParagraphSupport.java | 71 + .../actions/range/RangeActionGroup.java | 207 ++ .../actions/range/RangeStyleAction.java | 46 + .../actions/range/RangeStyleSupport.java | 50 + .../actions/single/BorderStyleAction.java | 34 + .../actions/single/ChangeAttributeAction.java | 59 + .../actions/single/ChangeStyleAction.java | 78 + .../actions/single/ChangeStylePropertyAction.java | 56 + .../pagedesigner/actions/single/ColorSupport.java | 101 + .../jst/pagedesigner/actions/single/Messages.java | 42 + .../actions/single/SelectEditPartAction.java | 61 + .../actions/single/SelectNodeAction.java | 37 + .../actions/single/SelectParentAction.java | 60 + .../actions/single/SingleElementActionGroup.java | 240 ++ .../actions/single/StyleClassSupport.java | 112 + .../pagedesigner/actions/single/StyleSupport.java | 58 + .../actions/single/messages.properties | 3 + .../actions/table/TableActionGroup.java | 196 ++ .../actions/table/TableOperationContext.java | 97 + .../jst/pagedesigner/adapters/IBodyInfo.java | 91 + .../pagedesigner/adapters/internal/BodyInfo.java | 134 + .../pagedesigner/commands/CloneNodeCommand.java | 66 + .../pagedesigner/commands/CommandResources.java | 42 + .../commands/CommandResources.properties | 33 + .../jst/pagedesigner/commands/CopyAction.java | 74 + .../jst/pagedesigner/commands/CopyNodeCommand.java | 78 + .../pagedesigner/commands/CreateItemCommand.java | 134 + .../jst/pagedesigner/commands/CutAction.java | 71 + .../jst/pagedesigner/commands/CutNodeCommand.java | 81 + .../jst/pagedesigner/commands/DeleteAction.java | 67 + .../pagedesigner/commands/DeleteNodeCommand.java | 115 + .../jst/pagedesigner/commands/DesignAction.java | 71 + .../commands/DesignResizeComponentCommand.java | 146 + .../jst/pagedesigner/commands/DesignerCommand.java | 409 +++ .../commands/ICustomizableCommand.java | 21 + .../jst/pagedesigner/commands/MoveNodeCommand.java | 99 + .../jst/pagedesigner/commands/PDDropRequest.java | 66 + .../pagedesigner/commands/PDRequestConstants.java | 23 + .../commands/PaletteDropInsertCommand.java | 140 + .../jst/pagedesigner/commands/PasteAction.java | 61 + .../pagedesigner/commands/PasteNodeCommand.java | 79 + .../pagedesigner/commands/SourceViewerCommand.java | 132 + .../commands/SwitchSelectionCommand.java | 79 + .../commands/html/TableDeleteColumnCommand.java | 103 + .../html/TableDeleteHeaderFooterCommand.java | 86 + .../commands/html/TableDeleteRowCommand.java | 96 + .../commands/html/TableInsertColumnCommand.java | 158 ++ .../html/TableInsertHeaderFooterCommand.java | 132 + .../commands/html/TableInsertRowCommand.java | 169 ++ .../commands/html/TableResizeColumnCommand.java | 106 + .../commands/html/TableResizeRowCommand.java | 94 + .../commands/nav/CaretPositionTracker.java | 28 + .../commands/nav/HorizontalMoveCommand.java | 147 + .../commands/nav/ICaretPositionMover.java | 23 + .../commands/nav/VerticalMoveCommand.java | 201 ++ .../commands/range/ApplyStyleCommand.java | 509 ++++ .../commands/range/BlockNodeFinder.java | 130 + .../pagedesigner/commands/range/ClipboardData.java | 86 + .../commands/range/ContentCommand.java | 124 + .../pagedesigner/commands/range/CopyCommand.java | 41 + .../jst/pagedesigner/commands/range/CopyEdit.java | 126 + .../pagedesigner/commands/range/CutCommand.java | 46 + .../jst/pagedesigner/commands/range/CutEdit.java | 49 + .../pagedesigner/commands/range/DeleteCommand.java | 65 + .../pagedesigner/commands/range/DeleteEdit.java | 291 ++ .../pagedesigner/commands/range/DesignEdit.java | 480 ++++ .../commands/range/IInputSourceProvider.java | 34 + .../pagedesigner/commands/range/InsertCommand.java | 51 + .../pagedesigner/commands/range/InsertEdit.java | 196 ++ .../pagedesigner/commands/range/KeyboardData.java | 126 + .../jst/pagedesigner/commands/range/Paragraph.java | 56 + .../commands/range/ParagraphApplyStyleCommand.java | 408 +++ .../commands/range/ParagraphFinder.java | 124 + .../range/ParagraphUnapplyStyleCommand.java | 85 + .../pagedesigner/commands/range/PasteCommand.java | 45 + .../commands/range/RangeModeCommand.java | 171 ++ .../commands/range/SelectAllCommand.java | 100 + .../commands/range/UnapplyStyleCommand.java | 88 + .../jst/pagedesigner/commands/range/WorkNode.java | 160 ++ .../commands/single/AddSubNodeCommand.java | 87 + .../commands/single/ChangeAttributeCommand.java | 119 + .../commands/single/ChangeStyleCommand.java | 108 + .../commands/single/ChangeTagCommand.java | 118 + .../commands/single/InsertSubNodeCommand.java | 45 + .../commands/single/RemoveSubNodeCommand.java | 43 + .../commands/single/SingleNodeCommand.java | 149 + .../converter/AbstractTagConverter.java | 500 ++++ .../pagedesigner/converter/ConvertPosition.java | 50 + .../converter/ConverterFacRegistryReader.java | 117 + .../converter/ConverterFactoryRegistry.java | 231 ++ .../jst/pagedesigner/converter/ConverterUtil.java | 176 ++ .../converter/DefaultUnknownTagConverter.java | 180 ++ .../converter/DumDeepTagConverter.java | 75 + .../converter/DumDescriptionTagConverter.java | 65 + .../pagedesigner/converter/DumTagConverter.java | 96 + .../converter/HTMLStringTagConverter.java | 111 + .../pagedesigner/converter/HiddenTagConverter.java | 168 ++ .../converter/HiddenTagConverter2.java | 66 + .../pagedesigner/converter/IConverterFactory.java | 46 + .../jst/pagedesigner/converter/IDOMFactory.java | 39 + .../jst/pagedesigner/converter/ITagConverter.java | 121 + .../pagedesigner/converter/JSFConverterUtil.java | 66 + .../pagedesigner/converter/PreferenceReader.java | 40 + .../converter/TagConverterToDumBlock.java | 59 + .../converter/TagConverterToInlineBlock.java | 80 + .../pagedesigner/converter/TagConverterToSpan.java | 66 + .../pagedesigner/converter/html/ATagConverter.java | 77 + .../converter/html/HTMLConverterFactory.java | 90 + .../converter/html/TableTagConverter.java | 76 + .../converter/jsp/IncludeTagConverterPreview.java | 206 ++ .../converter/jsp/JSPConverterFactory.java | 114 + .../jst/pagedesigner/converter/package-info.java | 18 + .../eclipse/jst/pagedesigner/css2/CSSTempUtil.java | 156 ++ .../org/eclipse/jst/pagedesigner/css2/CSSUtil.java | 252 ++ .../eclipse/jst/pagedesigner/css2/ICSSStyle.java | 173 ++ .../jst/pagedesigner/css2/border/CSSBorder.java | 542 ++++ .../pagedesigner/css2/color/CSSColorConverter.java | 132 + .../pagedesigner/css2/color/CSSColorDefaults.java | 284 ++ .../pagedesigner/css2/color/CSSColorManager.java | 44 + .../jst/pagedesigner/css2/font/CSSFont.java | 121 + .../jst/pagedesigner/css2/font/CSSFontManager.java | 200 ++ .../jst/pagedesigner/css2/font/ICSSFont.java | 65 + .../pagedesigner/css2/font/ICSSFontManager.java | 30 + .../org/eclipse/jst/pagedesigner/css2/html4.css | 155 + .../jst/pagedesigner/css2/layout/BlockBox.java | 101 + .../jst/pagedesigner/css2/layout/BlockFlow.java | 113 + .../pagedesigner/css2/layout/BlockFlowContext.java | 288 ++ .../pagedesigner/css2/layout/BlockFlowLayout.java | 253 ++ .../jst/pagedesigner/css2/layout/BoxUtil.java | 66 + .../css2/layout/CSSBlockFlowLayout.java | 745 +++++ .../pagedesigner/css2/layout/CSSBrFlowLayout.java | 66 + .../jst/pagedesigner/css2/layout/CSSFigure.java | 534 ++++ .../css2/layout/CSSInlineFlowLayout.java | 320 +++ .../jst/pagedesigner/css2/layout/CSSLayout.java | 480 ++++ .../css2/layout/CSSListItemLayout.java | 185 ++ .../css2/layout/CSSPageFlowLayout.java | 162 ++ .../pagedesigner/css2/layout/CSSTextFigure.java | 313 +++ .../pagedesigner/css2/layout/CSSTextLayout.java | 233 ++ .../pagedesigner/css2/layout/CSSWidgetLayout.java | 225 ++ .../jst/pagedesigner/css2/layout/CompositeBox.java | 146 + .../jst/pagedesigner/css2/layout/Debug.java | 40 + .../pagedesigner/css2/layout/DisplayToLayout.java | 102 + .../jst/pagedesigner/css2/layout/FigureUtil.java | 55 + .../jst/pagedesigner/css2/layout/FlowBox.java | 230 ++ .../css2/layout/FlowContainerLayout.java | 169 ++ .../jst/pagedesigner/css2/layout/FlowContext.java | 90 + .../jst/pagedesigner/css2/layout/FlowFigure.java | 186 ++ .../pagedesigner/css2/layout/FlowFigureLayout.java | 126 + .../jst/pagedesigner/css2/layout/FlowPage.java | 161 ++ .../pagedesigner/css2/layout/FlowUtilities.java | 271 ++ .../jst/pagedesigner/css2/layout/ICSSFigure.java | 38 + .../jst/pagedesigner/css2/layout/ICSSLayout.java | 55 + .../jst/pagedesigner/css2/layout/ICSSPainter.java | 29 + .../jst/pagedesigner/css2/layout/ICSSPainter2.java | 34 + .../jst/pagedesigner/css2/layout/LineBox.java | 424 +++ .../pagedesigner/css2/layout/MultiLineLabel.java | 134 + .../pagedesigner/css2/layout/PageFlowLayout.java | 74 + .../pagedesigner/css2/layout/TextFragmentBox.java | 92 + .../css2/layout/TextLayoutSupport.java | 427 +++ .../jst/pagedesigner/css2/layout/WidgetBox.java | 40 + .../css2/layout/table/CSSTRGroupLayout.java | 176 ++ .../css2/layout/table/CSSTRLayout.java | 144 + .../css2/layout/table/CSSTableCaptionLayout.java | 113 + .../css2/layout/table/CSSTableCellLayout.java | 208 ++ .../css2/layout/table/CSSTableLayout2.java | 707 +++++ .../css2/layout/table/CachedTableCellLayout.java | 263 ++ .../css2/layout/table/TableCaptionInfo.java | 67 + .../css2/layout/table/TableCellInfo.java | 218 ++ .../pagedesigner/css2/layout/table/TableInfo.java | 379 +++ .../css2/layout/table/TableInfoContext.java | 120 + .../css2/layout/table/TableItemInfo.java | 45 + .../css2/layout/table/TableRowGroupInfo.java | 103 + .../css2/layout/table/TableRowInfo.java | 136 + .../css2/list/CSSHtmlListStyleData.java | 174 ++ .../pagedesigner/css2/list/CSSMarkerStyleData.java | 96 + .../jst/pagedesigner/css2/list/ContentObject.java | 37 + .../jst/pagedesigner/css2/list/CounterHelper.java | 280 ++ .../css2/list/CounterValueGenerator.java | 446 +++ .../pagedesigner/css2/list/HTMLListInfoHelper.java | 84 + .../css2/list/ICounterValueGenerator.java | 64 + .../pagedesigner/css2/list/IIndexConverter.java | 23 + .../pagedesigner/css2/list/IncrementObject.java | 60 + .../jst/pagedesigner/css2/list/ListStyleUtil.java | 39 + .../jst/pagedesigner/css2/list/ResetObject.java | 60 + .../pagedesigner/css2/marker/CounterFactory.java | 64 + .../jst/pagedesigner/css2/marker/CounterUtil.java | 77 + .../pagedesigner/css2/marker/DecimalCounter.java | 50 + .../css2/marker/EnumerableCounter.java | 60 + .../jst/pagedesigner/css2/marker/ICounter.java | 26 + .../jst/pagedesigner/css2/marker/RomanCounter.java | 122 + .../css2/property/BackgroundColorMeta.java | 80 + .../css2/property/BackgroundImageMeta.java | 182 ++ .../css2/property/BorderCollapseMeta.java | 37 + .../css2/property/BorderColorMeta.java | 86 + .../css2/property/BorderSpacingMeta.java | 122 + .../css2/property/BorderStyleMeta.java | 181 ++ .../css2/property/BorderWidthMeta.java | 238 ++ .../css2/property/CSSMetaRegistry.java | 121 + .../css2/property/CSSPropertyMeta.java | 128 + .../css2/property/ColorPropertyMeta.java | 104 + .../pagedesigner/css2/property/ContentMeta.java | 33 + .../css2/property/CounterIncrementMeta.java | 97 + .../css2/property/CounterResetMeta.java | 94 + .../pagedesigner/css2/property/DisplayMeta.java | 67 + .../pagedesigner/css2/property/EmptyCellsMeta.java | 42 + .../jst/pagedesigner/css2/property/FloatInfo.java | 150 + .../pagedesigner/css2/property/FontFamilyMeta.java | 139 + .../pagedesigner/css2/property/FontSizeMeta.java | 195 ++ .../pagedesigner/css2/property/FontStyleMeta.java | 37 + .../pagedesigner/css2/property/FontWeightMeta.java | 103 + .../jst/pagedesigner/css2/property/HeightMeta.java | 55 + .../css2/property/HorizontalAlignMeta.java | 93 + .../pagedesigner/css2/property/ICSSPropertyID.java | 927 ++++++ .../css2/property/ICSSPropertyMeta.java | 111 + .../jst/pagedesigner/css2/property/LengthMeta.java | 219 ++ .../css2/property/ListStyleImageMeta.java | 52 + .../css2/property/ListStylePositionMeta.java | 36 + .../css2/property/ListStyleTypeMeta.java | 86 + .../css2/property/MarginWidthMeta.java | 40 + .../jst/pagedesigner/css2/property/Messages.java | 37 + .../pagedesigner/css2/property/OverflowMeta.java | 48 + .../css2/property/PaddingWidthMeta.java | 79 + .../pagedesigner/css2/property/PositionMeta.java | 55 + .../css2/property/PositionOffsetMeta.java | 25 + .../jst/pagedesigner/css2/property/TableUtil.java | 103 + .../pagedesigner/css2/property/TextAlignMeta.java | 85 + .../css2/property/TextDecorationMeta.java | 103 + .../css2/property/VerticalAlignMeta.java | 133 + .../pagedesigner/css2/property/VisibilityMeta.java | 53 + .../pagedesigner/css2/property/WhiteSpaceMeta.java | 55 + .../jst/pagedesigner/css2/property/WidthMeta.java | 51 + .../pagedesigner/css2/provider/DimensionInfo.java | 61 + .../css2/provider/ICSSTextProvider.java | 40 + .../css2/provider/ICSSWidgetProvider.java | 61 + .../jst/pagedesigner/css2/style/AbstractStyle.java | 716 +++++ .../jst/pagedesigner/css2/style/DefaultStyle.java | 273 ++ .../css2/style/HiddenElementStyle.java | 101 + .../css2/style/IRangeSelectionProxy.java | 25 + .../jst/pagedesigner/css2/style/ITagEditInfo.java | 48 + .../jst/pagedesigner/css2/style/StyleUtil.java | 42 + .../jst/pagedesigner/css2/value/Length.java | 69 + .../css2/widget/AbstractWidgetProvider.java | 60 + .../jst/pagedesigner/css2/widget/BorderUtil.java | 315 +++ .../css2/widget/ButtonWidgetProvider.java | 204 ++ .../css2/widget/CheckboxWidgetProvider.java | 107 + .../css2/widget/ComboWidgetProvider.java | 214 ++ .../pagedesigner/css2/widget/HiddenProvider.java | 159 ++ .../css2/widget/ImageWidgetProvider.java | 122 + .../css2/widget/InputFileWidgetProvider.java | 177 ++ .../css2/widget/ListWidgetProvider.java | 214 ++ .../css2/widget/RadioWidgetProvider.java | 117 + .../css2/widget/TextAreaWidgetProvider.java | 211 ++ .../css2/widget/TextInputWidgetProvider.java | 180 ++ .../eclipse/jst/pagedesigner/dnd/FeedBackInfo.java | 51 + .../jst/pagedesigner/dnd/ILocalDropHandler.java | 93 + .../jst/pagedesigner/dnd/LocalDropRequest.java | 71 + .../internal/DesignerSourceDropTargetListener.java | 182 ++ .../internal/DesignerSourceMouseTrackAdapter.java | 158 ++ .../dnd/internal/DropSelectionWizard.java | 143 + .../dnd/internal/LocalDropCommand.java | 133 + .../dnd/internal/LocalDropEditPolicy.java | 255 ++ .../internal/LocalSelectionDropTargetListener.java | 129 + .../jst/pagedesigner/dnd/internal/Messages.java | 42 + .../PDTemplateTransferDropTargetListener.java | 151 + .../pagedesigner/dnd/internal/RegistryReader.java | 82 + .../dnd/internal/ResouceDropTargetListener.java | 115 + .../dnd/internal/SimpleWizardSelectionPage.java | 274 ++ .../dnd/internal/SourceViewLocalDropCommand.java | 54 + .../dnd/internal/SourceViewerDragDropHelper.java | 394 +++ .../TextEditorDropTargetListenerFactory.java | 50 + .../pagedesigner/dnd/internal/messages.properties | 17 + .../jst/pagedesigner/dom/CaretMoveIterator.java | 271 ++ .../eclipse/jst/pagedesigner/dom/DOMPosition.java | 122 + .../jst/pagedesigner/dom/DOMPositionHelper.java | 395 +++ .../org/eclipse/jst/pagedesigner/dom/DOMRange.java | 75 + .../jst/pagedesigner/dom/DOMRangeHelper.java | 74 + .../jst/pagedesigner/dom/DOMRefPosition.java | 145 + .../jst/pagedesigner/dom/DOMRefPosition2.java | 125 + .../eclipse/jst/pagedesigner/dom/DOMStyleUtil.java | 205 ++ .../org/eclipse/jst/pagedesigner/dom/DOMUtil.java | 236 ++ .../eclipse/jst/pagedesigner/dom/EditHelper.java | 504 ++++ .../jst/pagedesigner/dom/EditModelQuery.java | 1816 ++++++++++++ .../jst/pagedesigner/dom/EditValidateUtil.java | 385 +++ .../eclipse/jst/pagedesigner/dom/IDOMPosition.java | 73 + .../jst/pagedesigner/dom/IDOMRefPosition.java | 30 + .../jst/pagedesigner/dom/ValidatorSupport.java | 119 + .../jst/pagedesigner/dom/html/ColStructure.java | 56 + .../dom/html/TableChildElementPosition.java | 52 + .../jst/pagedesigner/dom/html/TableUtil.java | 534 ++++ .../jst/pagedesigner/dtmanager/DTManager.java | 117 + .../jst/pagedesigner/dtmanager/DefaultDTInfo.java | 87 + .../dtmanager/DefaultDTInfoFactory.java | 125 + .../jst/pagedesigner/dtmanager/IDTInfo.java | 57 + .../jst/pagedesigner/dtmanager/IDTInfoFactory.java | 33 + .../converter/AbstractTagConverterContext.java | 77 + .../dtmanager/converter/IOutputRenderer.java | 37 + .../dtmanager/converter/ITagConverterContext.java | 75 + .../converter/ITagConverterDecorator.java | 32 + .../dtmanager/converter/ITransformOperation.java | 63 + .../dtmanager/converter/ITransformer.java | 48 + .../internal/AbstractAttributeValueResolver.java | 27 + .../AttributeValueResolverRegistryReader.java | 55 + .../converter/internal/DTHTMLOutputRenderer.java | 144 + .../converter/internal/DTTagConverter.java | 467 ++++ .../converter/internal/DTTagConverterContext.java | 99 + .../internal/DTTagConverterDecorator.java | 469 ++++ .../converter/internal/DTTagConverterFactory.java | 48 + .../converter/internal/DefaultTransformer.java | 77 + .../internal/IAttributeValueResolver.java | 44 + .../operations/AbstractTransformOperation.java | 223 ++ .../operations/TransformOperationFactory.java | 210 ++ .../internal/AppendChildElementOperation.java | 61 + .../AppendChildTextFromXPathOperation.java | 65 + .../internal/AppendChildTextOperation.java | 52 + .../operations/internal/CheckModeOperation.java | 81 + .../internal/ConvertAttributeToTextOperation.java | 62 + .../internal/CopyAllAttributesOperation.java | 41 + .../internal/CopyAttributeOperation.java | 60 + .../internal/CopyAttributeWithRenameOperation.java | 50 + .../operations/internal/CopyChildrenOperation.java | 39 + .../CreateAttributeFromXPathOperation.java | 124 + .../internal/CreateAttributeOperation.java | 49 + .../internal/CreateElementOperation.java | 50 + .../operations/internal/IfNotOperation.java | 66 + .../converter/operations/internal/IfOperation.java | 65 + .../internal/IterateOverElementsOperation.java | 137 + .../MakeParentElementCurrentOperation.java | 44 + .../internal/RemoveAttributeOperation.java | 46 + .../internal/RenameAttributeOperation.java | 51 + .../converter/operations/package-info.java | 18 + .../dtmanager/converter/package-info.java | 18 + .../jst/pagedesigner/dtmanager/dtinfo/DTInfo.java | 85 + .../dtmanager/dtinfo/DTInfoFactory.java | 101 + .../dtmanager/dtinfo/DTInfoPackage.java | 892 ++++++ .../pagedesigner/dtmanager/dtinfo/Operation.java | 102 + .../pagedesigner/dtmanager/dtinfo/Parameter.java | 64 + .../dtmanager/dtinfo/ResolveAttributeValue.java | 64 + .../dtmanager/dtinfo/TagConvertInfo.java | 57 + .../dtmanager/dtinfo/TagDecorateInfo.java | 369 +++ .../dtinfo/internal/impl/DTInfoFactoryImpl.java | 161 ++ .../dtmanager/dtinfo/internal/impl/DTInfoImpl.java | 228 ++ .../dtinfo/internal/impl/DTInfoPackageImpl.java | 563 ++++ .../dtinfo/internal/impl/OperationImpl.java | 261 ++ .../dtinfo/internal/impl/ParameterImpl.java | 168 ++ .../internal/impl/ResolveAttributeValueImpl.java | 168 ++ .../dtinfo/internal/impl/TagConvertInfoImpl.java | 151 + .../dtinfo/internal/impl/TagDecorateInfoImpl.java | 791 ++++++ .../dtinfo/internal/util/DTInfoAdapterFactory.java | 212 ++ .../dtinfo/internal/util/DTInfoSwitch.java | 245 ++ .../dtmanager/dtinfo/package-info.java | 18 + .../jst/pagedesigner/dtmanager/package-info.java | 18 + .../AbstractDTResourceProvider.java | 52 + .../dtresourceprovider/AbstractDTSkin.java | 86 + .../DTResourceProviderFactory.java | 170 ++ .../dtresourceprovider/DTSkinManager.java | 183 ++ .../DefaultDTResourceProvider.java | 76 + .../dtresourceprovider/DefaultDTSkin.java | 143 + .../dtresourceprovider/IDTResourceProvider.java | 39 + .../pagedesigner/dtresourceprovider/IDTSkin.java | 64 + .../dtresourceprovider/ProviderClassMap.java | 111 + .../editors/AbstractPropertySheetPageFactory.java | 32 + .../editors/DesignerStructuredTextEditorJSP.java | 180 ++ .../jst/pagedesigner/editors/HTMLEditor.java | 1179 ++++++++ .../jst/pagedesigner/editors/IDesignViewer.java | 41 + .../editors/IPropertySheetPageFactory.java | 35 + .../pagedesigner/editors/OutlineConfiguration.java | 81 + .../editors/PageDesignerActionConstants.java | 142 + .../editors/SelectionSynchronizer.java | 187 ++ .../editors/SimpleGraphicalEditor.java | 897 ++++++ .../editors/actions/ActionsMessages.java | 42 + .../editors/actions/ActionsMessages.properties | 44 + .../editors/actions/ChangeStyleAction.java | 206 ++ .../editors/actions/DataBindingViewAction.java | 59 + .../editors/actions/DesignActionBarFactory.java | 122 + .../actions/DesignPageActionContributor.java | 237 ++ .../editors/actions/DesignerStyleActionGroup.java | 243 ++ .../editors/actions/DesignerUndoRedoAction.java | 109 + .../editors/actions/ManageSkinsAction.java | 181 ++ .../editors/actions/OutlineViewAction.java | 35 + .../actions/PageDesignerActionBarContributor2.java | 350 +++ .../editors/actions/PaletteViewAction.java | 111 + .../editors/actions/PropertiesViewAction.java | 34 + .../editors/actions/RelatedViewActionGroup.java | 148 + .../editors/actions/ShowViewAction.java | 60 + .../editors/actions/SkinsMenuItemBuilder.java | 240 ++ .../actions/SourcePageActionContributor.java | 100 + .../pagedesigner/DelegatingZoomManager.java | 374 +++ .../pagedesigner/IPageDesignerConstants.java | 290 ++ .../pagedesigner/JSPEditorMessages.properties | 23 + .../editors/pagedesigner/MessageFormater.java | 97 + .../pagedesigner/PageDesignerResources.java | 57 + .../editors/palette/AbstractPaletteFactory.java | 28 + .../DesignerPaletteCustomizationsHelper.java | 223 ++ .../editors/palette/DesignerPaletteCustomizer.java | 164 ++ .../palette/DesignerPaletteCustomizerDialog.java | 363 +++ .../editors/palette/DesignerPaletteImages.java | 49 + .../editors/palette/DesignerPaletteRoot.java | 131 + .../palette/DesignerPaletteRootFactory.java | 114 + .../editors/palette/DesignerPaletteViewer.java | 151 + .../palette/DesignerPaletteViewerProvider.java | 109 + .../editors/palette/IDropSourceData.java | 20 + .../editors/palette/IDropSourceDataProvider.java | 16 + .../editors/palette/IEntryChangeListener.java | 27 + .../editors/palette/IPaletteConstants.java | 71 + .../editors/palette/IPaletteContext.java | 15 + .../editors/palette/IPaletteFactory.java | 43 + .../editors/palette/IPaletteItemManager.java | 80 + .../editors/palette/ITagDropSourceData.java | 24 + .../jst/pagedesigner/editors/palette/Messages.java | 37 + .../editors/palette/MetadataTagDropSourceData.java | 145 + .../editors/palette/ShowAllAction.java | 50 + .../editors/palette/TagImageManager.java | 214 ++ .../editors/palette/TagToolCreationAdapter.java | 110 + .../editors/palette/TagToolPaletteEntry.java | 110 + .../palette/impl/PaletteElementTemplateHelper.java | 200 ++ .../editors/palette/impl/PaletteHelper.java | 698 +++++ .../editors/palette/impl/PaletteItemManager.java | 567 ++++ .../editors/palette/impl/TaglibPaletteDrawer.java | 106 + .../editors/palette/messages.properties | 3 + .../properties/IPropertyPageDescriptor.java | 87 + .../internal/EditorValidatorAdapter.java | 51 + .../properties/internal/PropertyDescriptor.java | 194 ++ .../internal/PropertyDescriptorAdapter.java | 72 + .../editors/properties/package-info.java | 18 + .../quickedittabsections/QuickEditTabSections.java | 59 + .../QuickEditTabSectionsFactory.java | 61 + .../QuickEditTabSectionsPackage.java | 288 ++ .../quickedittabsections/SECTION_TYPE.java | 224 ++ .../quickedittabsections/SectionInfo.java | 91 + .../impl/QuickEditTabSectionsFactoryImpl.java | 176 ++ .../internal/impl/QuickEditTabSectionsImpl.java | 157 ++ .../impl/QuickEditTabSectionsPackageImpl.java | 283 ++ .../internal/impl/SectionInfoImpl.java | 225 ++ .../util/QuickEditTabSectionsAdapterFactory.java | 148 + .../internal/util/QuickEditTabSectionsSwitch.java | 162 ++ .../quickedittabsections/package-info.java | 18 + .../editpolicies/AbsolutePointLocator.java | 109 + .../editpolicies/BasicLabelToolTip.java | 73 + .../pagedesigner/editpolicies/ColumnHelper.java | 68 + .../editpolicies/ColumnResizableEditPolicy.java | 229 ++ .../editpolicies/CornerRelativeHandleLocator.java | 122 + .../editpolicies/DesignerElementEditPolicy.java | 137 + .../editpolicies/DragMoveEditPolicy.java | 148 + .../pagedesigner/editpolicies/DropEditPolicy.java | 210 ++ .../editpolicies/ElementDecoratorSquareHandle.java | 88 + .../pagedesigner/editpolicies/ElementMenuBar.java | 231 ++ .../editpolicies/ElementResizableEditPolicy.java | 493 ++++ .../editpolicies/FragmentCornerHandle.java | 35 + .../pagedesigner/editpolicies/FragmentHandle.java | 200 ++ .../editpolicies/HeadItemCreationEditPolicy.java | 117 + .../editpolicies/IEnhancedSelectionEditPolicy.java | 44 + .../editpolicies/ITableEditAdapter.java | 84 + .../editpolicies/JSFDropEditPolicy.java | 91 + .../pagedesigner/editpolicies/LinkEditPolicy.java | 52 + .../pagedesigner/editpolicies/LocationHelper.java | 197 ++ .../MouseSelectableChildDecorator.java | 631 +++++ .../jst/pagedesigner/editpolicies/MoveSupport.java | 61 + .../editpolicies/NonVisualChildDecorator.java | 48 + .../NonVisualChildGraphicalEditPolicy.java | 141 + .../pagedesigner/editpolicies/PDEditPolicy.java | 22 + .../pagedesigner/editpolicies/PolicyHelper.java | 44 + .../elementedit/AbstractElementEdit.java | 139 + .../elementedit/AbstractElementEditFactory.java | 41 + .../elementedit/ElementEditFacRegistryReader.java | 120 + .../elementedit/ElementEditFactoryRegistry.java | 146 + .../jst/pagedesigner/elementedit/IElementEdit.java | 132 + .../elementedit/IElementEditFactory.java | 38 + .../elementedit/html/HTMLElementEditFactory.java | 62 + .../elementedit/html/HeadElementEdit.java | 72 + .../html/InsertStylesheetLinkAction.java | 56 + .../html/StylesheetLinkElementEdit.java | 53 + .../elementedit/html/TableElementEdit.java | 278 ++ .../elementedit/jsp/JSPElementEditFactory.java | 51 + .../elementedit/jsp/TaglibElementEdit.java | 52 + .../elementedit/jsp/TaglibURIAction.java | 148 + .../IContextMenuItemContributor.java | 44 + .../pagedesigner/extensionpoint/package-info.java | 18 + .../figurehandler/AbstractFigureHandler.java | 82 + .../figurehandler/BRFigureHandler.java | 44 + .../figurehandler/DefaultFigureHandler.java | 43 + .../pagedesigner/figurehandler/FigureFactory.java | 218 ++ .../figurehandler/HiddenFigureHandler.java | 44 + .../pagedesigner/figurehandler/IFigureHandler.java | 46 + .../figurehandler/ImgFigureHandler.java | 54 + .../figurehandler/InputFigureHandler.java | 193 ++ .../jst/pagedesigner/figurehandler/Messages.java | 34 + .../figurehandler/ObjectFigureHandler.java | 35 + .../figurehandler/SelectFigureHandler.java | 98 + .../figurehandler/TextareaFigureHandler.java | 49 + .../figurehandler/WidgetFigureHandler.java | 50 + .../pagedesigner/figurehandler/messages.properties | 1 + .../itemcreation/AbstractTagCreationAdvisor.java | 126 + .../itemcreation/AbstractTagCreator.java | 136 + .../pagedesigner/itemcreation/CreationData.java | 316 +++ .../itemcreation/DefaultTagCreationAdvisor.java | 95 + .../itemcreation/ITagCreationAdvisor.java | 48 + .../jst/pagedesigner/itemcreation/ITagCreator.java | 28 + .../itemcreation/ITagDropOverrider.java | 59 + .../itemcreation/ItemCreationEditPolicy.java | 139 + .../itemcreation/ItemCreationRequest.java | 83 + .../itemcreation/ItemCreationTool.java | 299 ++ .../UserCustomizedTagCreationAdvisor.java | 87 + .../command/ContainerCreationCommand.java | 144 + .../command/ElementCustomizationCommand.java | 195 ++ .../command/SingletonContainerCreationCommand.java | 94 + .../command/TagContainerCreationCommand.java | 86 + .../UserCustomizedContainerCreationCommand.java | 90 + .../UserCustomizedElementCustomizationCommand.java | 202 ++ .../customizer/AbstractDropCustomizer.java | 53 + .../itemcreation/customizer/AttributeData.java | 72 + .../itemcreation/customizer/ChildrenData.java | 69 + .../customizer/CustomizationDataImpl.java | 172 ++ .../customizer/DropCustomizationController.java | 99 + .../customizer/ICustomizationData.java | 49 + .../itemcreation/customizer/IDropCustomizer.java | 68 + .../customizer/IWritableCustomizationData.java | 113 + .../itemcreation/customizer/ParentData.java | 65 + .../internal/AbstractCreationCommand.java | 107 + .../itemcreation/internal/DefaultTagCreator.java | 31 + .../itemcreation/internal/ICreationCommand.java | 27 + .../itemcreation/internal/TagCreationFactory.java | 90 + .../internal/TagCreatorFactoryRegistryReader.java | 203 ++ .../internal/UserCustomizedTagCreator.java | 33 + .../jst/pagedesigner/meta/AttributeDescriptor.java | 236 ++ .../pagedesigner/meta/BindingHandlerDelegate.java | 128 + .../pagedesigner/meta/DefaultEditorCreator.java | 256 ++ .../jst/pagedesigner/meta/EditorCreator.java | 155 + .../pagedesigner/meta/IAttributeDescriptor.java | 125 + .../meta/IAttributeRuntimeValueType.java | 189 ++ .../jst/pagedesigner/meta/IBindingHandler.java | 78 + .../meta/ITagAttributeCellEditorFactory.java | 67 + .../meta/internal/CategoryNameComparator.java | 85 + .../meta/internal/CellEditorFacRegistryReader.java | 79 + .../meta/internal/CellEditorFactoryRegistry.java | 160 ++ .../pagedesigner/parts/CSSStyleAdapterFactory.java | 54 + .../jst/pagedesigner/parts/DocumentEditPart.java | 253 ++ .../jst/pagedesigner/parts/EditProxyAdapter.java | 70 + .../jst/pagedesigner/parts/ElementEditPart.java | 641 +++++ .../pagedesigner/parts/HTMLEditPartsFactory.java | 74 + .../jst/pagedesigner/parts/NodeEditPart.java | 251 ++ .../parts/NonVisualComponentEditPart.java | 116 + .../eclipse/jst/pagedesigner/parts/Refresher.java | 119 + .../jst/pagedesigner/parts/RefresherFactory.java | 45 + .../jst/pagedesigner/parts/SubNodeEditPart.java | 26 + .../jst/pagedesigner/parts/TextEditPart.java | 186 ++ .../preview/DefaultELValueResolver.java | 100 + .../jst/pagedesigner/preview/IELValueResolver.java | 21 + .../preview/PageExpressionContext.java | 218 ++ .../preview/PreviewConvertContext.java | 132 + .../pagedesigner/preview/PreviewHandlerNew.java | 164 ++ .../jst/pagedesigner/preview/PreviewResources.java | 59 + .../preview/PreviewResources.properties | 16 + .../jst/pagedesigner/preview/WindowsIEBrowser.java | 76 + .../properties/AllPropertySection.java | 148 + .../properties/AttributePropertySheetPage.java | 63 + .../properties/AttributePropertySource.java | 256 ++ .../AttributePropertySourceProvider.java | 49 + .../pagedesigner/properties/BaseCustomSection.java | 258 ++ .../properties/DesignerPropertyTool.java | 356 +++ .../pagedesigner/properties/ISectionFilter.java | 29 + .../properties/ITabbedPropertiesConstants.java | 28 + .../jst/pagedesigner/properties/Messages.java | 33 + .../properties/NavigationHiearchyAction.java | 136 + .../properties/PropertyDescriptorWrapper.java | 197 ++ .../properties/WPETabbedPropertySheetPage.java | 211 ++ .../attrgroup/AttributeGroupMessages.java | 80 + .../properties/attrgroup/DialogUtil.java | 137 + .../properties/attrgroup/IElementContextable.java | 36 + .../properties/attrgroup/messages.properties | 14 + .../celleditors/AbstractCSSModelAdapter.java | 103 + .../celleditors/CSSDialogCellEditor.java | 78 + .../celleditors/CSSStyleDeclarationFactory.java | 46 + .../properties/celleditors/CellEditorFactory.java | 266 ++ .../properties/celleditors/CellEditorWrapper.java | 359 +++ .../celleditors/EditableDialogCellEditor.java | 140 + .../celleditors/LabeledComboBoxCellEditor.java | 162 ++ .../celleditors/LabeledStyleComboCellEditor.java | 185 ++ .../celleditors/LoadbundleSelectionCellEditor.java | 58 + .../properties/celleditors/ResourceBoundle.java | 42 + .../celleditors/ResourceDialogCellEditor.java | 213 ++ .../celleditors/StyleComboCellEditor.java | 257 ++ .../celleditors/TagStyleAttrAdapter.java | 242 ++ .../properties/celleditors/messages.properties | 13 + .../dialogfields/MDEnabledComboDialogField.java | 64 + .../internal/AllPropertySectionDescriptor.java | 43 + .../properties/internal/AttributeGroup.java | 454 +++ .../properties/internal/AttributeGroupSection.java | 115 + .../internal/AttributesTabDescriptor.java | 58 + .../internal/DefaultPropertyPageDescriptor.java | 140 + .../internal/MDQuickEditTabSectionDescriptor.java | 49 + .../pagedesigner/properties/internal/Messages.java | 37 + .../internal/NullQuickEditTabGroupDescriptor.java | 50 + .../internal/NullQuickEditTabSection.java | 43 + .../internal/QuickEditTabDescriptor.java | 45 + .../properties/internal/QuickEditTabManager.java | 239 ++ .../properties/internal/QuickEditTabSection.java | 209 ++ .../internal/QuickEditTabSectionDescriptor.java | 99 + .../internal/QuickEditTabSectionsDescriptor.java | 122 + .../internal/QuickEditTabSectionsManager.java | 126 + .../internal/WPETabDescriptorProvider.java | 44 + .../WPETabPropertySectionDescriptorProvider.java | 127 + .../properties/internal/messages.properties | 12 + .../pagedesigner/properties/messages.properties | 11 + .../eclipse/jst/pagedesigner/range/RangeUtil.java | 378 +++ .../requests/LocationModifierRequest.java | 53 + .../pagedesigner/requests/NodeCreationFactory.java | 129 + .../requests/PageDesignerRequestConstants.java | 28 + .../jst/pagedesigner/tableedit/ColumnHandle.java | 30 + .../pagedesigner/tableedit/ColumnResizeHandle.java | 40 + .../tableedit/DeleteHeaderFooterAction.java | 47 + .../tableedit/DeleteHeaderFooterRequest.java | 46 + .../tableedit/DeleteRowColumnAction.java | 50 + .../jst/pagedesigner/tableedit/EmptyLocator.java | 38 + .../tableedit/InsertHeaderFooterAction.java | 48 + .../tableedit/InsertHeaderFooterRequest.java | 46 + .../tableedit/InsertRowColumnAction.java | 49 + .../tableedit/MarqueeRectangleFigure.java | 85 + .../jst/pagedesigner/tableedit/RowHandle.java | 30 + .../pagedesigner/tableedit/RowResizeHandle.java | 40 + .../pagedesigner/tableedit/TableColumnHandle.java | 64 + .../tableedit/TableColumnHandleLocator.java | 109 + .../pagedesigner/tableedit/TableEditAdapter.java | 158 ++ .../jst/pagedesigner/tableedit/TableEditConst.java | 28 + .../pagedesigner/tableedit/TableEditHelper.java | 40 + .../jst/pagedesigner/tableedit/TableHandleKit.java | 53 + .../pagedesigner/tableedit/TableInsertRequest.java | 51 + .../tableedit/TableResizableEditPolicy.java | 44 + .../pagedesigner/tableedit/TableResizeRequest.java | 80 + .../tableedit/TableRowColumnDeleteRequest.java | 28 + .../tableedit/TableRowColumnRequest.java | 64 + .../jst/pagedesigner/tableedit/TableRowHandle.java | 65 + .../tableedit/TableRowHandleLocator.java | 108 + .../pagedesigner/tableedit/TableSideHandle.java | 66 + .../tableedit/TableSideItemDragTracker.java | 77 + .../tableedit/TableSideItemHandle.java | 87 + .../tableedit/TableSideResizeDragTracker.java | 177 ++ .../tableedit/TableSideResizeHandle.java | 54 + .../jst/pagedesigner/tools/ExposeHelper.java | 333 +++ .../pagedesigner/tools/ObjectModeDragTracker.java | 57 + .../jst/pagedesigner/tools/RangeDragTracker.java | 314 +++ .../jst/pagedesigner/tools/RangeSelectionTool.java | 319 +++ .../ui/common/CommonResourceDialog.java | 403 +++ .../ui/common/PartActivationHandler.java | 99 + .../ui/common/ResourceOnClasspathDialog.java | 255 ++ .../ui/common/TreeViewerSelectionDialog.java | 328 +++ .../sash/NestedEditorActionBarContributor.java | 43 + .../ui/common/sash/SashEditorPart.java | 531 ++++ .../common/sash/SashEditorSelectionProvider.java | 155 + .../ui/common/sash/SashEditorSite.java | 435 +++ .../ClasspathResourceButtonDialogField.java | 99 + .../ContextableResourceButtonDialogField.java | 67 + .../ui/dialogfields/DialogFieldWrapper.java | 480 ++++ .../ExtendedResourceButtonDialogField.java | 41 + .../ui/dialogfields/StyleButtonDialogField.java | 106 + .../ui/dialogs/BackgroudPreferenceNode.java | 139 + .../ui/dialogs/BackgroundPreferencePage.java | 320 +++ .../ui/dialogs/BlockPreferenceNode.java | 139 + .../ui/dialogs/BlockPreferencePage.java | 398 +++ .../ui/dialogs/BorderPreferenceNode.java | 139 + .../ui/dialogs/BorderPreferencePage.java | 538 ++++ .../pagedesigner/ui/dialogs/BoxPreferenceNode.java | 140 + .../pagedesigner/ui/dialogs/BoxPreferencePage.java | 673 +++++ .../jst/pagedesigner/ui/dialogs/ColorUtil.java | 215 ++ .../pagedesigner/ui/dialogs/DialogsMessages.java | 42 + .../ui/dialogs/DialogsMessages.properties | 99 + .../ui/dialogs/ExtensionsPreferenceNode.java | 140 + .../ui/dialogs/ExtensionsPreferencePage.java | 184 ++ .../pagedesigner/ui/dialogs/IStyleConstants.java | 203 ++ .../ui/dialogs/ListPreferenceNode.java | 139 + .../ui/dialogs/ListPreferencePage.java | 163 ++ .../ui/dialogs/PositioningPreferenceNode.java | 140 + .../ui/dialogs/PositioningPreferencePage.java | 782 ++++++ .../jst/pagedesigner/ui/dialogs/StyleCombo.java | 44 + .../jst/pagedesigner/ui/dialogs/StyleDialog.java | 62 + .../ui/dialogs/TextPreferenceNode.java | 140 + .../ui/dialogs/TextPreferencePage.java | 525 ++++ .../pagedesigner/ui/dialogs/WPEPropertyPage.java | 457 +++ .../ui/preferences/PDPreferencePage.java | 153 + .../pagedesigner/ui/preferences/PDPreferences.java | 85 + .../ui/preferences/PreferenceMessages.java | 29 + .../ui/preferences/PreferenceMessages.properties | 3 + .../eclipse/jst/pagedesigner/utils/BodyHelper.java | 345 +++ .../jst/pagedesigner/utils/CacheManager.java | 85 + .../jst/pagedesigner/utils/CommandUtil.java | 139 + .../eclipse/jst/pagedesigner/utils/DOMUtil.java | 260 ++ .../eclipse/jst/pagedesigner/utils/EditorUtil.java | 99 + .../eclipse/jst/pagedesigner/utils/EntityMap.java | 212 ++ .../pagedesigner/utils/HTMLSpecialCharHelper.java | 464 +++ .../eclipse/jst/pagedesigner/utils/HTMLUtil.java | 114 + .../jst/pagedesigner/utils/ICacheEntryCreator.java | 31 + .../pagedesigner/utils/IFileAdapterFactory.java | 54 + .../utils/IResourceAdapterFactory.java | 54 + .../utils/IWorkbenchAdapterFactory.java | 72 + .../jst/pagedesigner/utils/ImageResolver.java | 102 + .../jst/pagedesigner/utils/IntFlexArray.java | 76 + .../eclipse/jst/pagedesigner/utils/JSPUtil.java | 353 +++ .../eclipse/jst/pagedesigner/utils/JavaUtil.java | 97 + .../pagedesigner/utils/NodeLocationComparator.java | 77 + .../jst/pagedesigner/utils/PreviewUtil.java | 420 +++ .../jst/pagedesigner/utils/ProjectResolver.java | 526 ++++ .../jst/pagedesigner/utils/SelectManyHelper.java | 196 ++ .../jst/pagedesigner/utils/SelectionHelper.java | 384 +++ .../pagedesigner/utils/StructuredModelUtil.java | 70 + .../jst/pagedesigner/utils/UriAdapterFactory.java | 52 + .../eclipse/jst/pagedesigner/utils/WebAppUtil.java | 64 + .../eclipse/jst/pagedesigner/utils/XMLUtil.java | 100 + .../pagedesigner/validation/caret/ActionData.java | 87 + .../validation/caret/BasicMovementRule.java | 41 + .../validation/caret/BasicPositionRule.java | 95 + .../caret/ContainerMoveInAndOutRule.java | 101 + .../validation/caret/DefaultMovementRule.java | 47 + .../validation/caret/DefaultPositionRule.java | 110 + .../validation/caret/DefaultPositionValidator.java | 234 ++ .../validation/caret/DnDPositionValidator.java | 43 + .../validation/caret/DropActionData.java | 65 + .../validation/caret/HeadDataPositionRule.java | 27 + .../validation/caret/IEPanelgridPositionRule.java | 50 + .../validation/caret/IETablePositionRule.java | 187 ++ .../validation/caret/IMovementMediator.java | 40 + .../validation/caret/IMovementRule.java | 29 + .../validation/caret/IPositionMediator.java | 72 + .../validation/caret/IPositionRule.java | 60 + .../validation/caret/IValidationRule.java | 19 + .../caret/InlineEditingNavigationMediator.java | 190 ++ .../caret/InlineEditingPositionMediator.java | 37 + .../caret/JSFRootContainerPositionRule.java | 157 ++ .../caret/NodeConstructionPositionRule.java | 26 + .../caret/RootContainerPositionRule.java | 118 + .../jst/pagedesigner/validation/caret/Target.java | 111 + .../caret/WhitespacePositionMoveRule.java | 147 + .../viewer/AbstractDropLocationStrategy.java | 80 + .../pagedesigner/viewer/CaretPositionResolver.java | 328 +++ .../jst/pagedesigner/viewer/CaretUpdater.java | 241 ++ .../viewer/DefaultDropLocationStrategy.java | 193 ++ .../jst/pagedesigner/viewer/DesignPosition.java | 203 ++ .../jst/pagedesigner/viewer/DesignRange.java | 87 + .../jst/pagedesigner/viewer/DesignRefPosition.java | 49 + .../viewer/EditPartPositionHelper.java | 678 +++++ .../jst/pagedesigner/viewer/FlowBoxLine.java | 249 ++ .../pagedesigner/viewer/HTMLGraphicalViewer.java | 555 ++++ .../HTMLGraphicalViewerListenenerAdapter.java | 36 + .../pagedesigner/viewer/IDropLocationStrategy.java | 59 + .../pagedesigner/viewer/IHTMLGraphicalViewer.java | 139 + .../viewer/IHTMLGraphicalViewerListener.java | 30 + .../jst/pagedesigner/viewer/LayoutPart.java | 476 ++++ .../jst/pagedesigner/viewer/TextPosition.java | 87 + org.tizen.base.feature/.project | 17 + org.tizen.base.feature/IDE.bat | 17 + org.tizen.base.feature/LICENSE-2.0.htm | 191 ++ org.tizen.base.feature/build.properties | 9 + org.tizen.base.feature/feature.xml | 2957 ++++++++++++++++++++ org.tizen.base.feature/license.html | 22 + .../rootfiles/resources/icons/tizen-sdk-ide.ico | Bin 0 -> 107078 bytes .../rootfiles_for_linux/startup.sh | 41 + .../rootfiles_for_windows/IDE.exe | Bin 0 -> 130048 bytes org.tizen.base.platform/.classpath | 7 + org.tizen.base.platform/.project | 28 + org.tizen.base.platform/META-INF/MANIFEST.MF | 12 + .../OSGI-INF/l10n/bundle.properties | 16 + .../TizenIDE_base_linux.product | 85 + .../TizenIDE_base_windows.product | 85 + org.tizen.base.platform/about.html | 23 + org.tizen.base.platform/about.ini | 31 + org.tizen.base.platform/about.mappings | 9 + org.tizen.base.platform/about.properties | 22 + .../about_files/LICENSE-2.0.htm | 191 ++ org.tizen.base.platform/build.properties | 15 + org.tizen.base.platform/content/home.html | 34 + org.tizen.base.platform/content/home_internal.html | 43 + org.tizen.base.platform/content/icon_01_hover.png | Bin 0 -> 8008 bytes org.tizen.base.platform/content/icon_01_normal.png | Bin 0 -> 8169 bytes org.tizen.base.platform/content/icon_02_hover.png | Bin 0 -> 10822 bytes org.tizen.base.platform/content/icon_02_normal.png | Bin 0 -> 11426 bytes org.tizen.base.platform/content/icon_03_hover.png | Bin 0 -> 10984 bytes org.tizen.base.platform/content/icon_03_normal.png | Bin 0 -> 11602 bytes org.tizen.base.platform/content/icon_04_hover.png | Bin 0 -> 8451 bytes org.tizen.base.platform/content/icon_04_normal.png | Bin 0 -> 8945 bytes org.tizen.base.platform/content/introContent.xml | 4 + org.tizen.base.platform/content/shared.css | 8 + .../content/tizen_sdk_welcome_page_bg.jpg | Bin 0 -> 1255637 bytes .../icons/branding/128_TIZEN_SDK_icon.png | Bin 0 -> 28329 bytes .../icons/branding/16_TIZEN_SDK_icon.png | Bin 0 -> 3554 bytes .../icons/branding/256_TIZEN_SDK_icon.png | Bin 0 -> 106111 bytes .../icons/branding/32_TIZEN_SDK_icon.png | Bin 0 -> 5168 bytes .../icons/branding/48_TIZEN_SDK_icon.png | Bin 0 -> 7461 bytes .../icons/branding/64_TIZEN_SDK_icon.png | Bin 0 -> 10353 bytes .../icons/branding/about_tizen_sdk.png | Bin 0 -> 45492 bytes .../icons/launching/128_TIZEN_SDK_icon.xpm | 148 + .../icons/launching/48_TIZEN_SDK_icon.xpm | 68 + .../icons/launching/TIZEN_SDK_icon.ico | Bin 0 -> 107078 bytes org.tizen.base.platform/p2.inf | 5 + org.tizen.base.platform/plugin.xml | 107 + org.tizen.base.platform/plugin_customization.ini | 17 + org.tizen.base.platform/splash.bmp | Bin 0 -> 471064 bytes .../src/org/tizen/base/platform/Activator.java | 50 + .../org/tizen/base/platform/InitPreferences.java | 13 + package/base-ide-product.install.linux | 26 + package/base-ide-product.install.windows | 16 + package/base-ide-product.remove.linux | 23 + package/base-ide-product.remove.windows | 19 + package/build.linux | 321 +++ package/pkginfo.manifest | 17 + 897 files changed, 118023 insertions(+) create mode 100644 AUTHORS create mode 100644 LICENSE-2.0.htm create mode 100644 NOTICE create mode 100644 builder/build.properties.clean create mode 100644 builder/customTargets.xml create mode 100644 org.eclipse.jst.pagedesigner.patch/.classpath create mode 100644 org.eclipse.jst.pagedesigner.patch/.project create mode 100644 org.eclipse.jst.pagedesigner.patch/.settings/org.eclipse.jdt.core.prefs create mode 100644 org.eclipse.jst.pagedesigner.patch/META-INF/MANIFEST.MF create mode 100644 org.eclipse.jst.pagedesigner.patch/build.properties create mode 100644 org.eclipse.jst.pagedesigner.patch/src/org/eclipse/jst/pagedesigner/converter/html/HTMLConverterFactory.java create mode 100755 org.eclipse.jst.pagedesigner.patch/src/org/eclipse/jst/pagedesigner/properties/AttributePropertySource.java create mode 100755 org.eclipse.jst.pagedesigner/.classpath create mode 100755 org.eclipse.jst.pagedesigner/.cvsignore create mode 100755 org.eclipse.jst.pagedesigner/.options create mode 100755 org.eclipse.jst.pagedesigner/.project create mode 100755 org.eclipse.jst.pagedesigner/.settings/org.eclipse.core.resources.prefs create mode 100755 org.eclipse.jst.pagedesigner/.settings/org.eclipse.jdt.core.prefs create mode 100755 org.eclipse.jst.pagedesigner/.settings/org.eclipse.jdt.ui.prefs create mode 100755 org.eclipse.jst.pagedesigner/.settings/org.eclipse.pde.prefs create mode 100755 org.eclipse.jst.pagedesigner/META-INF/MANIFEST.MF create mode 100755 org.eclipse.jst.pagedesigner/about.html create mode 100755 org.eclipse.jst.pagedesigner/build.properties create mode 100755 org.eclipse.jst.pagedesigner/default.properties create mode 100755 org.eclipse.jst.pagedesigner/icons/LineBreak.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/MoveHandle.png create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Binding.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Binding_disabled.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Plugin.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_bold.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_bold_disabled.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_designer.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_hsplit.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_italic.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_italic_disabled.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_largefont.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_largefont_disabled.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_paragraph.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_smallfont.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_smallfont_disabled.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_source.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_underline.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_underline_disabled.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_Toolbar_vsplit.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/PD_nopic.jpg create mode 100755 org.eclipse.jst.pagedesigner/icons/library_obj.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/newsuade_wiz.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/palette/GENERIC/large/PD_Palette_Default.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Default.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Export.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Export_Disabled.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Export_Hover.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Import.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Import_Disabled.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Import_Hover.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/pin_down.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/pin_up.gif create mode 100755 org.eclipse.jst.pagedesigner/icons/skin.png create mode 100755 org.eclipse.jst.pagedesigner/model/DTInfo.ecore create mode 100755 org.eclipse.jst.pagedesigner/model/DTInfo.genmodel create mode 100755 org.eclipse.jst.pagedesigner/model/QuickEditTabSections.ecore create mode 100755 org.eclipse.jst.pagedesigner/model/QuickEditTabSections.genmodel create mode 100755 org.eclipse.jst.pagedesigner/plugin.properties create mode 100755 org.eclipse.jst.pagedesigner/plugin.xml create mode 100755 org.eclipse.jst.pagedesigner/schema/pageDesignerExtension.exsd create mode 100755 org.eclipse.jst.pagedesigner/schema/popupMenuContributor.exsd create mode 100755 org.eclipse.jst.pagedesigner/schema/propertyContributor.exsd create mode 100755 org.eclipse.jst.pagedesigner/schema/tagProperty.xsd create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/IHTMLConstants.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/IJMTConstants.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/JMTResources.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/PDPlugin.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/PageDesignerTraceOptions.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/container/ContainerActionGroup.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/AbstractLinkCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/CreateLinkWizard.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/ExtensionReader.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/HtmlLinkCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/ILinkCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkWizardPage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/MakeLinkAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/MakeLinkCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/menuextension/CustomedContextMenuActionGroup.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/menuextension/RunAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/AlignSupport.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ChangeStyleAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/DesignerToolBarAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/HTagsInsertGroupAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/InsertTagChangeStyleAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/NoneParagraphStyleAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/NoneStyleAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphStyleAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphSupport.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeActionGroup.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeStyleAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeStyleSupport.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/BorderStyleAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeAttributeAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeStyleAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeStylePropertyAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ColorSupport.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/Messages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectEditPartAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectNodeAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectParentAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SingleElementActionGroup.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/StyleClassSupport.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/StyleSupport.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/messages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/table/TableActionGroup.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/table/TableOperationContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/adapters/IBodyInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/adapters/internal/BodyInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CloneNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CommandResources.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CommandResources.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CopyAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CopyNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CreateItemCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CutAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CutNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DeleteAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DeleteNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignResizeComponentCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignerCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/ICustomizableCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/MoveNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PDDropRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PDRequestConstants.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PaletteDropInsertCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PasteAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PasteNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/SourceViewerCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/SwitchSelectionCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteColumnCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteHeaderFooterCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteRowCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertColumnCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertHeaderFooterCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertRowCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableResizeColumnCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableResizeRowCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/CaretPositionTracker.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/HorizontalMoveCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/ICaretPositionMover.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/VerticalMoveCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ApplyStyleCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/BlockNodeFinder.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ClipboardData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ContentCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CopyCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CopyEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CutCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CutEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DeleteCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DeleteEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DesignEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/IInputSourceProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/InsertCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/InsertEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/KeyboardData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/Paragraph.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphApplyStyleCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphFinder.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphUnapplyStyleCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/PasteCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/RangeModeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/SelectAllCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/UnapplyStyleCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/WorkNode.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/AddSubNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeAttributeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeStyleCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeTagCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/InsertSubNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/RemoveSubNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/SingleNodeCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConvertPosition.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFacRegistryReader.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DefaultUnknownTagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDeepTagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDescriptionTagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HTMLStringTagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter2.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IConverterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IDOMFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ITagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/JSFConverterUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/PreferenceReader.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToDumBlock.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToInlineBlock.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToSpan.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/ATagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/HTMLConverterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/TableTagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/IncludeTagConverterPreview.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/JSPConverterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/package-info.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/CSSTempUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/CSSUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/ICSSStyle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/border/CSSBorder.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/color/CSSColorConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/color/CSSColorDefaults.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/color/CSSColorManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/font/CSSFont.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/font/CSSFontManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/font/ICSSFont.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/font/ICSSFontManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/html4.css create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/BlockBox.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/BlockFlow.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/BlockFlowContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/BlockFlowLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/BoxUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSBlockFlowLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSBrFlowLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSFigure.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSInlineFlowLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSListItemLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSPageFlowLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSTextFigure.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSTextLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CSSWidgetLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/CompositeBox.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/Debug.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/DisplayToLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/FigureUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/FlowBox.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/FlowContainerLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/FlowContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/FlowFigure.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/FlowFigureLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/FlowPage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/FlowUtilities.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/ICSSFigure.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/ICSSLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/ICSSPainter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/ICSSPainter2.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/LineBox.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/MultiLineLabel.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/PageFlowLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/TextFragmentBox.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/TextLayoutSupport.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/WidgetBox.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/CSSTRGroupLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/CSSTRLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/CSSTableCaptionLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/CSSTableCellLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/CSSTableLayout2.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/CachedTableCellLayout.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/TableCaptionInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/TableCellInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/TableInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/TableInfoContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/TableItemInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/TableRowGroupInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/layout/table/TableRowInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/CSSHtmlListStyleData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/CSSMarkerStyleData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/ContentObject.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/CounterHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/CounterValueGenerator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/HTMLListInfoHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/ICounterValueGenerator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/IIndexConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/IncrementObject.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/ListStyleUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/list/ResetObject.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/marker/CounterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/marker/CounterUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/marker/DecimalCounter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/marker/EnumerableCounter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/marker/ICounter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/marker/RomanCounter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/BackgroundColorMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/BackgroundImageMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/BorderCollapseMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/BorderColorMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/BorderSpacingMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/BorderStyleMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/BorderWidthMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/CSSMetaRegistry.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/CSSPropertyMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/ColorPropertyMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/ContentMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/CounterIncrementMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/CounterResetMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/DisplayMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/EmptyCellsMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/FloatInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/FontFamilyMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/FontSizeMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/FontStyleMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/FontWeightMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/HeightMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/HorizontalAlignMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/ICSSPropertyID.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/ICSSPropertyMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/LengthMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/ListStyleImageMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/ListStylePositionMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/ListStyleTypeMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/MarginWidthMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/Messages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/OverflowMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/PaddingWidthMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/PositionMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/PositionOffsetMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/TableUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/TextAlignMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/TextDecorationMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/VerticalAlignMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/VisibilityMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/WhiteSpaceMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/property/WidthMeta.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/provider/DimensionInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/provider/ICSSTextProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/provider/ICSSWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/style/AbstractStyle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/style/DefaultStyle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/style/HiddenElementStyle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/style/IRangeSelectionProxy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/style/ITagEditInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/style/StyleUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/value/Length.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/AbstractWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/BorderUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/ButtonWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/CheckboxWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/ComboWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/HiddenProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/ImageWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/InputFileWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/ListWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/RadioWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/TextAreaWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/widget/TextInputWidgetProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/FeedBackInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/ILocalDropHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/LocalDropRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/DesignerSourceDropTargetListener.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/DesignerSourceMouseTrackAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/DropSelectionWizard.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/LocalDropCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/LocalDropEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/LocalSelectionDropTargetListener.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/Messages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/PDTemplateTransferDropTargetListener.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/RegistryReader.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/ResouceDropTargetListener.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/SimpleWizardSelectionPage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/SourceViewLocalDropCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/SourceViewerDragDropHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/TextEditorDropTargetListenerFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dnd/internal/messages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/CaretMoveIterator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMPosition.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMPositionHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMRange.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMRangeHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMRefPosition.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMRefPosition2.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMStyleUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/DOMUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/EditHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/EditModelQuery.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/EditValidateUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/IDOMPosition.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/IDOMRefPosition.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/ValidatorSupport.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/html/ColStructure.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/html/TableChildElementPosition.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dom/html/TableUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/DTManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/DefaultDTInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/DefaultDTInfoFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/IDTInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/IDTInfoFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/AbstractTagConverterContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/IOutputRenderer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/ITagConverterContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/ITagConverterDecorator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/ITransformOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/ITransformer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/AbstractAttributeValueResolver.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/AttributeValueResolverRegistryReader.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DTHTMLOutputRenderer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DTTagConverter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DTTagConverterContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DTTagConverterDecorator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DTTagConverterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/DefaultTransformer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/internal/IAttributeValueResolver.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/AbstractTransformOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/TransformOperationFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildElementOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildTextFromXPathOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/AppendChildTextOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CheckModeOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/ConvertAttributeToTextOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyAllAttributesOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyAttributeOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyAttributeWithRenameOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CopyChildrenOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateAttributeFromXPathOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateAttributeOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/CreateElementOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IfNotOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IfOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/IterateOverElementsOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/MakeParentElementCurrentOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/RemoveAttributeOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/internal/RenameAttributeOperation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/operations/package-info.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/converter/package-info.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/DTInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/DTInfoFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/DTInfoPackage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/Operation.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/Parameter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/ResolveAttributeValue.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/TagConvertInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/TagDecorateInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/impl/DTInfoFactoryImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/impl/DTInfoImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/impl/DTInfoPackageImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/impl/OperationImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/impl/ParameterImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/impl/ResolveAttributeValueImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/impl/TagConvertInfoImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/impl/TagDecorateInfoImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/util/DTInfoAdapterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/internal/util/DTInfoSwitch.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/dtinfo/package-info.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtmanager/package-info.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtresourceprovider/AbstractDTResourceProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtresourceprovider/AbstractDTSkin.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtresourceprovider/DTResourceProviderFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtresourceprovider/DTSkinManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtresourceprovider/DefaultDTResourceProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtresourceprovider/DefaultDTSkin.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtresourceprovider/IDTResourceProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtresourceprovider/IDTSkin.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/dtresourceprovider/ProviderClassMap.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/AbstractPropertySheetPageFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/DesignerStructuredTextEditorJSP.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/HTMLEditor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/IDesignViewer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/IPropertySheetPageFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/OutlineConfiguration.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/PageDesignerActionConstants.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/SelectionSynchronizer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/SimpleGraphicalEditor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ActionsMessages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ChangeStyleAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DataBindingViewAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignActionBarFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignPageActionContributor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerStyleActionGroup.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/DesignerUndoRedoAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ManageSkinsAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/OutlineViewAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PageDesignerActionBarContributor2.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PaletteViewAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/PropertiesViewAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/RelatedViewActionGroup.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/ShowViewAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SkinsMenuItemBuilder.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/actions/SourcePageActionContributor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/pagedesigner/DelegatingZoomManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/pagedesigner/IPageDesignerConstants.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/pagedesigner/JSPEditorMessages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/pagedesigner/MessageFormater.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/pagedesigner/PageDesignerResources.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/AbstractPaletteFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/DesignerPaletteCustomizationsHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/DesignerPaletteCustomizer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/DesignerPaletteCustomizerDialog.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/DesignerPaletteImages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/DesignerPaletteRoot.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/DesignerPaletteRootFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/DesignerPaletteViewer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/DesignerPaletteViewerProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/IDropSourceData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/IDropSourceDataProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/IEntryChangeListener.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/IPaletteConstants.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/IPaletteContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/IPaletteFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/IPaletteItemManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/ITagDropSourceData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/Messages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/MetadataTagDropSourceData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/ShowAllAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/TagImageManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/TagToolCreationAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/TagToolPaletteEntry.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/impl/PaletteElementTemplateHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/impl/PaletteHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/impl/PaletteItemManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/impl/TaglibPaletteDrawer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/palette/messages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/IPropertyPageDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/internal/EditorValidatorAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/internal/PropertyDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/internal/PropertyDescriptorAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/package-info.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/QuickEditTabSections.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/QuickEditTabSectionsFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/QuickEditTabSectionsPackage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/SECTION_TYPE.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/SectionInfo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/internal/impl/QuickEditTabSectionsFactoryImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/internal/impl/QuickEditTabSectionsImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/internal/impl/QuickEditTabSectionsPackageImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/internal/impl/SectionInfoImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/internal/util/QuickEditTabSectionsAdapterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/internal/util/QuickEditTabSectionsSwitch.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editors/properties/quickedittabsections/package-info.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/AbsolutePointLocator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/BasicLabelToolTip.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/ColumnHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/ColumnResizableEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/CornerRelativeHandleLocator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/DesignerElementEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/DragMoveEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/DropEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/ElementDecoratorSquareHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/ElementMenuBar.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/ElementResizableEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/FragmentCornerHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/FragmentHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/HeadItemCreationEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/IEnhancedSelectionEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/ITableEditAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/JSFDropEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/LinkEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/LocationHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/MouseSelectableChildDecorator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/MoveSupport.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/NonVisualChildDecorator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/NonVisualChildGraphicalEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/PDEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/editpolicies/PolicyHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/AbstractElementEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/AbstractElementEditFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/ElementEditFacRegistryReader.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/ElementEditFactoryRegistry.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/IElementEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/IElementEditFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/html/HTMLElementEditFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/html/HeadElementEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/html/InsertStylesheetLinkAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/html/StylesheetLinkElementEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/html/TableElementEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/jsp/JSPElementEditFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/jsp/TaglibElementEdit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/elementedit/jsp/TaglibURIAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/extensionpoint/IContextMenuItemContributor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/extensionpoint/package-info.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/AbstractFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/BRFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/DefaultFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/FigureFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/HiddenFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/IFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/ImgFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/InputFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/Messages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/ObjectFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/SelectFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/TextareaFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/WidgetFigureHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/figurehandler/messages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/AbstractTagCreationAdvisor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/AbstractTagCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/CreationData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/DefaultTagCreationAdvisor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/ITagCreationAdvisor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/ITagCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/ITagDropOverrider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/ItemCreationEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/ItemCreationRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/ItemCreationTool.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/UserCustomizedTagCreationAdvisor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/command/ContainerCreationCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/command/ElementCustomizationCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/command/SingletonContainerCreationCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/command/TagContainerCreationCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/command/UserCustomizedContainerCreationCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/command/UserCustomizedElementCustomizationCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/customizer/AbstractDropCustomizer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/customizer/AttributeData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/customizer/ChildrenData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/customizer/CustomizationDataImpl.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/customizer/DropCustomizationController.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/customizer/ICustomizationData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/customizer/IDropCustomizer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/customizer/IWritableCustomizationData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/customizer/ParentData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/internal/AbstractCreationCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/internal/DefaultTagCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/internal/ICreationCommand.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/internal/TagCreationFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/internal/TagCreatorFactoryRegistryReader.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/itemcreation/internal/UserCustomizedTagCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/AttributeDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/BindingHandlerDelegate.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/DefaultEditorCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/EditorCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeRuntimeValueType.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IBindingHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/ITagAttributeCellEditorFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFacRegistryReader.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFactoryRegistry.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/CSSStyleAdapterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/DocumentEditPart.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/EditProxyAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/ElementEditPart.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/HTMLEditPartsFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/NodeEditPart.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/NonVisualComponentEditPart.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/Refresher.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/RefresherFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/SubNodeEditPart.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/parts/TextEditPart.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/preview/DefaultELValueResolver.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/preview/IELValueResolver.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/preview/PageExpressionContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/preview/PreviewConvertContext.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/preview/PreviewHandlerNew.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/preview/PreviewResources.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/preview/PreviewResources.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/preview/WindowsIEBrowser.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/AllPropertySection.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/AttributePropertySheetPage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/AttributePropertySource.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/AttributePropertySourceProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/BaseCustomSection.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/DesignerPropertyTool.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/ISectionFilter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/ITabbedPropertiesConstants.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/Messages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/NavigationHiearchyAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/PropertyDescriptorWrapper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/WPETabbedPropertySheetPage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/attrgroup/AttributeGroupMessages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/attrgroup/DialogUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/attrgroup/IElementContextable.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/attrgroup/messages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/AbstractCSSModelAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/CSSDialogCellEditor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/CSSStyleDeclarationFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/CellEditorFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/CellEditorWrapper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/EditableDialogCellEditor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/LabeledComboBoxCellEditor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/LabeledStyleComboCellEditor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/LoadbundleSelectionCellEditor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/ResourceBoundle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/ResourceDialogCellEditor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/StyleComboCellEditor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/TagStyleAttrAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/celleditors/messages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/dialogfields/MDEnabledComboDialogField.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/AllPropertySectionDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/AttributeGroup.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/AttributeGroupSection.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/AttributesTabDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/DefaultPropertyPageDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/MDQuickEditTabSectionDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/Messages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/NullQuickEditTabGroupDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/NullQuickEditTabSection.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/QuickEditTabDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/QuickEditTabManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/QuickEditTabSection.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/QuickEditTabSectionDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/QuickEditTabSectionsDescriptor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/QuickEditTabSectionsManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/WPETabDescriptorProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/WPETabPropertySectionDescriptorProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/internal/messages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/properties/messages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/range/RangeUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/requests/LocationModifierRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/requests/NodeCreationFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/requests/PageDesignerRequestConstants.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/ColumnHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/ColumnResizeHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/DeleteHeaderFooterAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/DeleteHeaderFooterRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/DeleteRowColumnAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/EmptyLocator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/InsertHeaderFooterAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/InsertHeaderFooterRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/InsertRowColumnAction.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/MarqueeRectangleFigure.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/RowHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/RowResizeHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableColumnHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableColumnHandleLocator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableEditAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableEditConst.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableEditHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableHandleKit.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableInsertRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableResizableEditPolicy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableResizeRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableRowColumnDeleteRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableRowColumnRequest.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableRowHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableRowHandleLocator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableSideHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableSideItemDragTracker.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableSideItemHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableSideResizeDragTracker.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tableedit/TableSideResizeHandle.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tools/ExposeHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tools/ObjectModeDragTracker.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tools/RangeDragTracker.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/tools/RangeSelectionTool.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/common/CommonResourceDialog.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/common/PartActivationHandler.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/common/ResourceOnClasspathDialog.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/common/TreeViewerSelectionDialog.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/common/sash/NestedEditorActionBarContributor.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/common/sash/SashEditorPart.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/common/sash/SashEditorSelectionProvider.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/common/sash/SashEditorSite.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogfields/ClasspathResourceButtonDialogField.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogfields/ContextableResourceButtonDialogField.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogfields/DialogFieldWrapper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogfields/ExtendedResourceButtonDialogField.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogfields/StyleButtonDialogField.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/BackgroudPreferenceNode.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/BackgroundPreferencePage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/BlockPreferenceNode.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/BlockPreferencePage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/BorderPreferenceNode.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/BorderPreferencePage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/BoxPreferenceNode.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/BoxPreferencePage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/ColorUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/DialogsMessages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/DialogsMessages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/ExtensionsPreferenceNode.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/ExtensionsPreferencePage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/IStyleConstants.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/ListPreferenceNode.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/ListPreferencePage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/PositioningPreferenceNode.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/PositioningPreferencePage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/StyleCombo.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/StyleDialog.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/TextPreferenceNode.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/TextPreferencePage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/dialogs/WPEPropertyPage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/preferences/PDPreferencePage.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/preferences/PDPreferences.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/preferences/PreferenceMessages.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/ui/preferences/PreferenceMessages.properties create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/BodyHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/CacheManager.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/CommandUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/DOMUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/EditorUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/EntityMap.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/HTMLSpecialCharHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/HTMLUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/ICacheEntryCreator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/IFileAdapterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/IResourceAdapterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/IWorkbenchAdapterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/ImageResolver.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/IntFlexArray.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/JSPUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/JavaUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/NodeLocationComparator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/PreviewUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/ProjectResolver.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/SelectManyHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/SelectionHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/StructuredModelUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/UriAdapterFactory.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/WebAppUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/utils/XMLUtil.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/ActionData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/BasicMovementRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/BasicPositionRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/ContainerMoveInAndOutRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/DefaultMovementRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/DefaultPositionRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/DefaultPositionValidator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/DnDPositionValidator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/DropActionData.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/HeadDataPositionRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/IEPanelgridPositionRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/IETablePositionRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/IMovementMediator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/IMovementRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/IPositionMediator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/IPositionRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/IValidationRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/InlineEditingNavigationMediator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/InlineEditingPositionMediator.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/JSFRootContainerPositionRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/NodeConstructionPositionRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/RootContainerPositionRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/Target.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/validation/caret/WhitespacePositionMoveRule.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/AbstractDropLocationStrategy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/CaretPositionResolver.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/CaretUpdater.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/DefaultDropLocationStrategy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/DesignPosition.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/DesignRange.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/DesignRefPosition.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/EditPartPositionHelper.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/FlowBoxLine.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/HTMLGraphicalViewer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/HTMLGraphicalViewerListenenerAdapter.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/IDropLocationStrategy.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/IHTMLGraphicalViewer.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/IHTMLGraphicalViewerListener.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/LayoutPart.java create mode 100755 org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/viewer/TextPosition.java create mode 100644 org.tizen.base.feature/.project create mode 100644 org.tizen.base.feature/IDE.bat create mode 100644 org.tizen.base.feature/LICENSE-2.0.htm create mode 100644 org.tizen.base.feature/build.properties create mode 100644 org.tizen.base.feature/feature.xml create mode 100644 org.tizen.base.feature/license.html create mode 100644 org.tizen.base.feature/rootfiles/resources/icons/tizen-sdk-ide.ico create mode 100644 org.tizen.base.feature/rootfiles_for_linux/startup.sh create mode 100644 org.tizen.base.feature/rootfiles_for_windows/IDE.exe create mode 100644 org.tizen.base.platform/.classpath create mode 100644 org.tizen.base.platform/.project create mode 100644 org.tizen.base.platform/META-INF/MANIFEST.MF create mode 100644 org.tizen.base.platform/OSGI-INF/l10n/bundle.properties create mode 100644 org.tizen.base.platform/TizenIDE_base_linux.product create mode 100644 org.tizen.base.platform/TizenIDE_base_windows.product create mode 100644 org.tizen.base.platform/about.html create mode 100644 org.tizen.base.platform/about.ini create mode 100644 org.tizen.base.platform/about.mappings create mode 100644 org.tizen.base.platform/about.properties create mode 100644 org.tizen.base.platform/about_files/LICENSE-2.0.htm create mode 100644 org.tizen.base.platform/build.properties create mode 100644 org.tizen.base.platform/content/home.html create mode 100644 org.tizen.base.platform/content/home_internal.html create mode 100644 org.tizen.base.platform/content/icon_01_hover.png create mode 100644 org.tizen.base.platform/content/icon_01_normal.png create mode 100644 org.tizen.base.platform/content/icon_02_hover.png create mode 100644 org.tizen.base.platform/content/icon_02_normal.png create mode 100644 org.tizen.base.platform/content/icon_03_hover.png create mode 100644 org.tizen.base.platform/content/icon_03_normal.png create mode 100644 org.tizen.base.platform/content/icon_04_hover.png create mode 100644 org.tizen.base.platform/content/icon_04_normal.png create mode 100644 org.tizen.base.platform/content/introContent.xml create mode 100644 org.tizen.base.platform/content/shared.css create mode 100644 org.tizen.base.platform/content/tizen_sdk_welcome_page_bg.jpg create mode 100644 org.tizen.base.platform/icons/branding/128_TIZEN_SDK_icon.png create mode 100644 org.tizen.base.platform/icons/branding/16_TIZEN_SDK_icon.png create mode 100644 org.tizen.base.platform/icons/branding/256_TIZEN_SDK_icon.png create mode 100644 org.tizen.base.platform/icons/branding/32_TIZEN_SDK_icon.png create mode 100644 org.tizen.base.platform/icons/branding/48_TIZEN_SDK_icon.png create mode 100644 org.tizen.base.platform/icons/branding/64_TIZEN_SDK_icon.png create mode 100644 org.tizen.base.platform/icons/branding/about_tizen_sdk.png create mode 100644 org.tizen.base.platform/icons/launching/128_TIZEN_SDK_icon.xpm create mode 100644 org.tizen.base.platform/icons/launching/48_TIZEN_SDK_icon.xpm create mode 100644 org.tizen.base.platform/icons/launching/TIZEN_SDK_icon.ico create mode 100644 org.tizen.base.platform/p2.inf create mode 100644 org.tizen.base.platform/plugin.xml create mode 100644 org.tizen.base.platform/plugin_customization.ini create mode 100644 org.tizen.base.platform/splash.bmp create mode 100644 org.tizen.base.platform/src/org/tizen/base/platform/Activator.java create mode 100644 org.tizen.base.platform/src/org/tizen/base/platform/InitPreferences.java create mode 100755 package/base-ide-product.install.linux create mode 100644 package/base-ide-product.install.windows create mode 100755 package/base-ide-product.remove.linux create mode 100644 package/base-ide-product.remove.windows create mode 100755 package/build.linux create mode 100644 package/pkginfo.manifest diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..acaf5c7 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,7 @@ +Kangho Kim +Namkoong Ho +YoonKi Park +Taeyoung Son +Hyunsik Noh +Gun Kim +HyunGoo Kang diff --git a/LICENSE-2.0.htm b/LICENSE-2.0.htm new file mode 100644 index 0000000..3866874 --- /dev/null +++ b/LICENSE-2.0.htm @@ -0,0 +1,388 @@ + + + + Apache License, Version 2.0 + + + + + + + + + + + + + + + + + +
+ + +
+

Apache License

Version 2.0, January 2004

+http://www.apache.org/licenses/

+

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

1. Definitions.

+

"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document.

+

"Licensor" shall mean the copyright owner or entity authorized by the +copyright owner that is granting the License.

+

"Legal Entity" shall mean the union of the acting entity and all other +entities that control, are controlled by, or are under common control with +that entity. For the purposes of this definition, "control" means (i) the +power, direct or indirect, to cause the direction or management of such +entity, whether by contract or otherwise, or (ii) ownership of fifty +percent (50%) or more of the outstanding shares, or (iii) beneficial +ownership of such entity.

+

"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License.

+

"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation source, +and configuration files.

+

"Object" form shall mean any form resulting from mechanical transformation +or translation of a Source form, including but not limited to compiled +object code, generated documentation, and conversions to other media types.

+

"Work" shall mean the work of authorship, whether in Source or Object form, +made available under the License, as indicated by a copyright notice that +is included in or attached to the work (an example is provided in the +Appendix below).

+

"Derivative Works" shall mean any work, whether in Source or Object form, +that is based on (or derived from) the Work and for which the editorial +revisions, annotations, elaborations, or other modifications represent, as +a whole, an original work of authorship. For the purposes of this License, +Derivative Works shall not include works that remain separable from, or +merely link (or bind by name) to the interfaces of, the Work and Derivative +Works thereof.

+

"Contribution" shall mean any work of authorship, including the original +version of the Work and any modifications or additions to that Work or +Derivative Works thereof, that is intentionally submitted to Licensor for +inclusion in the Work by the copyright owner or by an individual or Legal +Entity authorized to submit on behalf of the copyright owner. For the +purposes of this definition, "submitted" means any form of electronic, +verbal, or written communication sent to the Licensor or its +representatives, including but not limited to communication on electronic +mailing lists, source code control systems, and issue tracking systems that +are managed by, or on behalf of, the Licensor for the purpose of discussing +and improving the Work, but excluding communication that is conspicuously +marked or otherwise designated in writing by the copyright owner as "Not a +Contribution."

+

"Contributor" shall mean Licensor and any individual or Legal Entity on +behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work.

+

2. Grant of Copyright License. Subject to the +terms and conditions of this License, each Contributor hereby grants to You +a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, publicly +display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form.

+

3. Grant of Patent License. Subject to the terms +and conditions of this License, each Contributor hereby grants to You a +perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, use, +offer to sell, sell, import, and otherwise transfer the Work, where such +license applies only to those patent claims licensable by such Contributor +that are necessarily infringed by their Contribution(s) alone or by +combination of their Contribution(s) with the Work to which such +Contribution(s) was submitted. If You institute patent litigation against +any entity (including a cross-claim or counterclaim in a lawsuit) alleging +that the Work or a Contribution incorporated within the Work constitutes +direct or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate as of the +date such litigation is filed.

+

4. Redistribution. You may reproduce and +distribute copies of the Work or Derivative Works thereof in any medium, +with or without modifications, and in Source or Object form, provided that +You meet the following conditions:

+
    +
  1. +

    You must give any other recipients of the Work or Derivative Works a +copy of this License; and

    +
  2. +
  3. +

    You must cause any modified files to carry prominent notices stating +that You changed the files; and

    +
  4. +
  5. +

    You must retain, in the Source form of any Derivative Works that You +distribute, all copyright, patent, trademark, and attribution notices from +the Source form of the Work, excluding those notices that do not pertain to +any part of the Derivative Works; and

    +
  6. +
  7. +

    If the Work includes a "NOTICE" text file as part of its distribution, +then any Derivative Works that You distribute must include a readable copy +of the attribution notices contained within such NOTICE file, excluding +those notices that do not pertain to any part of the Derivative Works, in +at least one of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or documentation, +if provided along with the Derivative Works; or, within a display generated +by the Derivative Works, if and wherever such third-party notices normally +appear. The contents of the NOTICE file are for informational purposes only +and do not modify the License. You may add Your own attribution notices +within Derivative Works that You distribute, alongside or as an addendum to +the NOTICE text from the Work, provided that such additional attribution +notices cannot be construed as modifying the License. +You may add Your own copyright statement to Your modifications and may +provide additional or different license terms and conditions for use, +reproduction, or distribution of Your modifications, or for any such +Derivative Works as a whole, provided Your use, reproduction, and +distribution of the Work otherwise complies with the conditions stated in +this License.

    +
  8. +
+

5. Submission of Contributions. Unless You +explicitly state otherwise, any Contribution intentionally submitted for +inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify the +terms of any separate license agreement you may have executed with Licensor +regarding such Contributions.

+

6. Trademarks. This License does not grant +permission to use the trade names, trademarks, service marks, or product +names of the Licensor, except as required for reasonable and customary use +in describing the origin of the Work and reproducing the content of the +NOTICE file.

+

7. Disclaimer of Warranty. Unless required by +applicable law or agreed to in writing, Licensor provides the Work (and +each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, +without limitation, any warranties or conditions of TITLE, +NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You +are solely responsible for determining the appropriateness of using or +redistributing the Work and assume any risks associated with Your exercise +of permissions under this License.

+

8. Limitation of Liability. In no event and +under no legal theory, whether in tort (including negligence), contract, or +otherwise, unless required by applicable law (such as deliberate and +grossly negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a result +of this License or out of the use or inability to use the Work (including +but not limited to damages for loss of goodwill, work stoppage, computer +failure or malfunction, or any and all other commercial damages or losses), +even if such Contributor has been advised of the possibility of such +damages.

+

9. Accepting Warranty or Additional Liability. +While redistributing the Work or Derivative Works thereof, You may choose +to offer, and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this License. +However, in accepting such obligations, You may act only on Your own behalf +and on Your sole responsibility, not on behalf of any other Contributor, +and only if You agree to indemnify, defend, and hold each Contributor +harmless for any liability incurred by, or claims asserted against, such +Contributor by reason of your accepting any such warranty or additional +liability.

+

END OF TERMS AND CONDITIONS

+

APPENDIX: How to apply the Apache License to your work

+

To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included +on the same "printed page" as the copyright notice for easier +identification within third-party archives.

+
   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+
+
+ + + + diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..f085dc6 --- /dev/null +++ b/NOTICE @@ -0,0 +1 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. diff --git a/builder/build.properties.clean b/builder/build.properties.clean new file mode 100644 index 0000000..cd062af --- /dev/null +++ b/builder/build.properties.clean @@ -0,0 +1,259 @@ +############################################################################### +# Copyright (c) 2003, 2006 IBM 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: +# IBM Corporation - initial API and implementation +############################################################################### +##################### +# Parameters describing how and where to execute the build. +# Typical users need only update the following properties: +# baseLocation - where things you are building against are installed +# bootclasspath - The base jars to compile against (typicaly rt.jar) +# configs - the list of {os, ws, arch} configurations to build. +# +# Of course any of the settings here can be overridden by spec'ing +# them on the command line (e.g., -DbaseLocation=d:/eclipse + +#The type of the top level element we are building, generally "feature" +topLevelElementType=feature +#The id of the top level element we are building +topLevelElementId=org.tizen.base.feature + +############# PRODUCT/PACKAGING CONTROL ############# +product=/org.tizen.base.platform/TizenIDE_base.product +runPackager=true + +p2.gathering=true + +#Set the name of the archive that will result from the product build. +#archiveNamePrefix= + +# The prefix that will be used in the generated archive. +archivePrefix="Do not touch here" + +# The location underwhich all of the build output will be collected. +collectingFolder=${archivePrefix} + +# The list of {os, ws, arch} configurations to build. This +# value is a '&' separated list of ',' separate triples. For example, +# configs=win32,win32,x86 & linux,motif,x86 +# By default the value is *,*,* +configs="Do not touch here" +#configs=win32, win32, x86 & \ +# win32,win32,x86_64 & \ +# win32,win32,wpf & \ +# linux, gtk, ppc & \ +# linux, gtk, x86 & \ +# linux, gtk, x86_64 & \ +# linux, motif, x86 & \ +# solaris, motif, sparc & \ +# solaris, gtk, sparc & \ +# aix, motif, ppc & \ +# hpux, motif, ia64_32 & \ +# macosx, carbon, ppc & \ +# macosx, carbon, x86 & \ +# macosx, cocoa, ppc & \ +# macosx, cocoa, x86 & \ +# macosx, cocoa, x86_64 + +# By default PDE creates one archive (result) per entry listed in the configs property. +# Setting this value to true will cause PDE to only create one output containing all +# artifacts for all the platforms listed in the configs property. +# To control the output format for the group, add a "group, group, group - " entry to the +# archivesFormat. +#groupConfigurations=true + +#The format of the archive. By default a zip is created using antZip. +#The list can only contain the configuration for which the desired format is different than zip. +#archivesFormat=win32, win32, x86 - antZip& \ +# linux, gtk, ppc - antZip &\ +# linux, gtk, x86 - antZip& \ +# linux, gtk, x86_64 - antZip& \ +# linux, motif, x86 - antZip& \ +# solaris, motif, sparc - antZip& \ +# solaris, gtk, sparc - antZip& \ +# aix, motif, ppc - antZip& \ +# hpux, motif, PA_RISC - antZip& \ +# macosx, carbon, ppc - antZip + +#Allow cycles involving at most one bundle that needs to be compiled with the rest being binary bundles. +allowBinaryCycles=true + +#Sort bundles depenedencies across all features instead of just within a given feature. +#flattenDependencies = true + +#Parallel compilation, requires flattenedDependencies=true +#parallelCompilation=true +#parallelThreadCount= +#parallelThreadsPerProcessor= + +#Set to true if you want the output to be ready for an update jar (no site.xml generated) +#outputUpdateJars = false + +#Set to true for Jnlp generation +#codebase should be a URL that will be used as the root of all relative URLs in the output. +#generateJnlp=false +#jnlp.codebase= +#jnlp.j2se= +#jnlp.locale= +#jnlp.generateOfflineAllowed=true or false generate attribute in the generated features +#jnlp.configs=${configs} #uncomment to filter the content of the generated jnlp files based on the configuration being built + +#Set to true if you want to sign jars +jarProcessor.unsign=true +signJars=true +#sign.alias= +#sign.keystore= +#sign.storepass= +#sign.keypass= + +#Arguments to send to the zip executable +#zipargs= + +#Arguments to send to the tar executable +#tarargs= + +#Control the creation of a file containing the version included in each configuration - on by default +#generateVersionsLists=false + +############## BUILD NAMING CONTROL ################ +# The directory into which the build elements are fetched and where +# the build takes place. +buildDirectory="Please export NATIVE_IDE__BUILD_PATH(do not touch here)" + +# Type of build. Used in naming the build output. Typically this value is +# one of I, N, M, S, ... +buildType=N + +# ID of the build. Used in naming the build output. +buildId=fresh_ide_build + +# Label for the build. Used in naming the build output +buildLabel=${buildType}.${buildId} + +# Timestamp for the build. Used in naming the build output +timestamp=007 + +#The value to be used for the qualifier of a plugin or feature when you want to override the value computed by pde. +#The value will only be applied to plugin or features indicating build.properties, qualifier = context +#forceContextQualifier= + +#Enable / disable the generation of a suffix for the features that use .qualifier. +#The generated suffix is computed according to the content of the feature +#generateFeatureVersionSuffix=true + +############# BASE CONTROL ############# +# Settings for the base Eclipse components and Java class libraries +# against which you are building. +# Base location for anything the build needs to compile against. For example, +# in most RCP app or a plug-in, the baseLocation should be the location of a previously +# installed Eclipse against which the application or plug-in code will be compiled and the RCP delta pack. + +base="Please export NATIVE_IDE__PARENT_PATH_OF_BASED_ECLIPSE(do not touch here)" +baseLocation="Please export NATIVE_IDE__BASED_ECLIPSE_PATH(do not touch here)" + + +#Folder containing repositories whose content is needed to compile against +#repoBaseLocation=${base}/repos +#Folder where the content of the repositories from ${repoBaseLocation} will be made available as a form suitable to be compiled against +#transformedRepoLocation=${base}/transformedRepos + +#Os/Ws/Arch/nl of the eclipse specified by baseLocation +baseos=linux +basews=gtk +basearch=x86 + +#this property indicates whether you want the set of plug-ins and features to be considered during the build to be limited to the ones reachable from the features / plugins being built +filteredDependencyCheck=false + +#this property indicates whether the resolution should be done in development mode (i.e. ignore multiple bundles with singletons) +resolution.devMode=false + +#pluginPath is a list of locations in which to find plugins and features. This list is separated by the platform file separator (; or :) +#a location is one of: +#- the location of the jar or folder that is the plugin or feature : /path/to/foo.jar or /path/to/foo +#- a directory that contains a /plugins or /features subdirectory +#- the location of a feature.xml, or for 2.1 style plugins, the plugin.xml or fragment.xml +#pluginPath= + +skipBase=true +eclipseURL= +eclipseBuildId= +eclipseBaseURL=${eclipseURL}/eclipse-platform-${eclipseBuildId}-win32.zip + + +############# MAP FILE CONTROL ################ +# This section defines CVS tags to use when fetching the map files from the repository. +# If you want to fetch the map file from repository / location, change the getMapFiles target in the customTargets.xml + +skipMaps=true +mapsRepo=:pserver:anonymous@example.com/path/to/repo +mapsRoot=path/to/maps +mapsCheckoutTag=HEAD + +#tagMaps=true +mapsTagTag=v${buildId} + + +############ REPOSITORY CONTROL ############### +# This section defines properties parameterizing the repositories where plugins, fragments +# bundles and features are being obtained from. + +# The tags to use when fetching elements to build. +# By default thebuilder will use whatever is in the maps. +# This value takes the form of a comma separated list of repository identifier (like used in the map files) and the +# overriding value +# For example fetchTag=CVS=HEAD, SVN=v20050101 +# fetchTag=HEAD +skipFetch=true + + +############# JAVA COMPILER OPTIONS ############## +# The location of the Java jars to compile against. Typically the rt.jar for your JDK/JRE +#bootclasspath=${java.home}/lib/rt.jar + +# specific JRE locations to compile against. These values are used to compile bundles specifying a +# Bundle-RequiredExecutionEnvironment. Uncomment and set values for environments that you support +#CDC-1.0/Foundation-1.0= /path/to/rt.jar +#CDC-1.1/Foundation-1.1= +#OSGi/Minimum-1.0= +#OSGi/Minimum-1.1= +#JRE-1.1= +#J2SE-1.2= +#J2SE-1.3= +#J2SE-1.4= +#J2SE-1.5= +#JavaSE-1.6= +#PersonalJava-1.1= +#PersonalJava-1.2= +#CDC-1.0/PersonalBasis-1.0= +#CDC-1.0/PersonalJava-1.0= +#CDC-1.1/PersonalBasis-1.1= +#CDC-1.1/PersonalJava-1.1= + +# Specify the output format of the compiler log when eclipse jdt is used +logExtension=.log + +# Whether or not to include debug info in the output jars +javacDebugInfo=true + +# Whether or not to fail the build if there are compiler errors +javacFailOnError=true + +# Enable or disable verbose mode of the compiler +javacVerbose=false + +# Extra arguments for the compiler. These are specific to the java compiler being used. +#compilerArg= + +# Default value for the version of the source code. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacSource in build.properties +javacSource=1.6 + +# Default value for the version of the byte code targeted. This value is used when compiling plug-ins that do not set the Bundle-RequiredExecutionEnvironment or set javacTarget in build.properties. +javacTarget=1.6 + + diff --git a/builder/customTargets.xml b/builder/customTargets.xml new file mode 100644 index 0000000..6a42e92 --- /dev/null +++ b/builder/customTargets.xml @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.jst.pagedesigner.patch/.classpath b/org.eclipse.jst.pagedesigner.patch/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/org.eclipse.jst.pagedesigner.patch/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.eclipse.jst.pagedesigner.patch/.project b/org.eclipse.jst.pagedesigner.patch/.project new file mode 100644 index 0000000..d6c4acc --- /dev/null +++ b/org.eclipse.jst.pagedesigner.patch/.project @@ -0,0 +1,28 @@ + + + org.eclipse.jst.pagedesigner.patch + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/org.eclipse.jst.pagedesigner.patch/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jst.pagedesigner.patch/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..951d64b --- /dev/null +++ b/org.eclipse.jst.pagedesigner.patch/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Nov 15 15:18:28 KST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/org.eclipse.jst.pagedesigner.patch/META-INF/MANIFEST.MF b/org.eclipse.jst.pagedesigner.patch/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4cfafd0 --- /dev/null +++ b/org.eclipse.jst.pagedesigner.patch/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: JavaServer Faces Tools - Web Page Editor (Patch) +Bundle-SymbolicName: org.eclipse.jst.pagedesigner.patch +Bundle-Version: 1.0.0.qualifier +Fragment-Host: org.eclipse.jst.pagedesigner +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Eclipse-PatchFragment: true +Bundle-ClassPath: patch.jar, + . +Bundle-Vendor: Samsung + diff --git a/org.eclipse.jst.pagedesigner.patch/build.properties b/org.eclipse.jst.pagedesigner.patch/build.properties new file mode 100644 index 0000000..9bb121e --- /dev/null +++ b/org.eclipse.jst.pagedesigner.patch/build.properties @@ -0,0 +1,4 @@ +bin.includes = META-INF/,\ + patch.jar +jars.compile.order = patch.jar +source.patch.jar = src/ diff --git a/org.eclipse.jst.pagedesigner.patch/src/org/eclipse/jst/pagedesigner/converter/html/HTMLConverterFactory.java b/org.eclipse.jst.pagedesigner.patch/src/org/eclipse/jst/pagedesigner/converter/html/HTMLConverterFactory.java new file mode 100644 index 0000000..9bf7c99 --- /dev/null +++ b/org.eclipse.jst.pagedesigner.patch/src/org/eclipse/jst/pagedesigner/converter/html/HTMLConverterFactory.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter.html; + +import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin; +import org.eclipse.jst.jsf.common.ui.internal.utils.JSFSharedImages; +import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.converter.AbstractTagConverter; +import org.eclipse.jst.pagedesigner.converter.DumDescriptionTagConverter; +import org.eclipse.jst.pagedesigner.converter.DumTagConverter; +import org.eclipse.jst.pagedesigner.converter.HiddenTagConverter2; +import org.eclipse.jst.pagedesigner.converter.IConverterFactory; +import org.eclipse.jst.pagedesigner.converter.ITagConverter; +import org.eclipse.jst.pagedesigner.utils.HTMLUtil; +import org.eclipse.swt.graphics.Image; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class HTMLConverterFactory implements IConverterFactory { + + /** + * the constructor + */ + public HTMLConverterFactory() { + super(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.IConverterFactory#createConverter(org.w3c.dom.Element) + */ + public ITagConverter createConverter(Element element, int mode) { + String tagName = element.getLocalName(); + + if (mode == MODE_PREVIEW) { + return new DumTagConverter(element); + } + if (!HTMLUtil.isVisualHtmlElement(tagName)) { + return new HiddenTagConverter2(element, getUnknownImage()); + } + + AbstractTagConverter c; + if (IHTMLConstants.TAG_TABLE.equalsIgnoreCase(tagName)) { + c = new TableTagConverter(element); + } else if (IHTMLConstants.TAG_A.equalsIgnoreCase(tagName)) { + c = new ATagConverter(element); + } else if (IHTMLConstants.TAG_FORM.equalsIgnoreCase(tagName) + || IHTMLConstants.TAG_DIV.equalsIgnoreCase(tagName)) { + // for those HTML tag that we want to build a border decorator, + // should + // go there. + c = new DumTagConverter(element, true); + } else if (IHTMLConstants.TAG_HTML.equalsIgnoreCase(tagName) + || IHTMLConstants.TAG_BODY.equalsIgnoreCase(tagName)) { + c = new DumDescriptionTagConverter(element); + c.setNeedBorderDecorator(true); + } else { + c = new DumTagConverter(element); + } + c.setMode(mode); + return c; + } + + private static Image getUnknownImage() { + return JSFUICommonPlugin.getDefault().getImage( + JSFSharedImages.DEFAULT_PALETTE_TAG_IMG); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.IConverterFactory#getSupportedURI() + */ + public String getSupportedURI() { + return ITLDConstants.URI_HTML; + } +} diff --git a/org.eclipse.jst.pagedesigner.patch/src/org/eclipse/jst/pagedesigner/properties/AttributePropertySource.java b/org.eclipse.jst.pagedesigner.patch/src/org/eclipse/jst/pagedesigner/properties/AttributePropertySource.java new file mode 100755 index 0000000..f1444b7 --- /dev/null +++ b/org.eclipse.jst.pagedesigner.patch/src/org/eclipse/jst/pagedesigner/properties/AttributePropertySource.java @@ -0,0 +1,259 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.properties; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.gef.commands.Command; +import org.eclipse.jst.jsf.common.metadata.Entity; +import org.eclipse.jst.jsf.common.metadata.internal.IMetaDataDomainContext; +import org.eclipse.jst.jsf.common.metadata.query.internal.MetaDataQueryContextFactory; +import org.eclipse.jst.jsf.common.metadata.query.internal.MetaDataQueryFactory; +import org.eclipse.jst.jsf.common.metadata.query.internal.taglib.ITaglibDomainMetaDataQuery; +import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagAttribute; +import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.ITagElement; +import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; +import org.eclipse.jst.jsf.context.resolver.structureddocument.ITaglibContextResolver; +import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; +import org.eclipse.jst.jsf.context.resolver.structureddocument.internal.IStructuredDocumentContextResolverFactory2; +import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; +import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory; +import org.eclipse.jst.jsf.designtime.internal.resolver.ITagElementResolver; +import org.eclipse.jst.jsf.metadataprocessors.MetaDataEnabledProcessingFactory; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.commands.single.ChangeAttributeCommand; +import org.eclipse.jst.pagedesigner.editors.properties.IPropertyPageDescriptor; +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.IPropertySource; +import org.eclipse.ui.views.properties.PropertyDescriptor; +import org.eclipse.ui.views.properties.TextPropertyDescriptor; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; +import org.w3c.dom.Element; + +/** + * + * @author mengbo + */ +public class AttributePropertySource implements IPropertySource { + private IDOMElement _element; + + private IPropertySource _innerSource; + + private Entity _tagEntity; + + private IStructuredDocumentContext _context; + + private IPropertyDescriptor[] _descriptors; + + private ITaglibDomainMetaDataQuery _query; + + /** + * Constructor + * @param ele + * @param source + */ + public AttributePropertySource(Element ele, IPropertySource source) { + _element = (IDOMElement) ele; + _innerSource = source; + _tagEntity = getTagEntity(); + } + + private Entity getTagEntity() { + _context = + IStructuredDocumentContextFactory.INSTANCE.getContext(_element.getStructuredDocument(), _element); + if (_context == null) + return null; + + IWorkspaceContextResolver wsresolver = + IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(_context); + if (wsresolver == null) + return null; + + ITaglibContextResolver resolver = + IStructuredDocumentContextResolverFactory.INSTANCE.getTaglibContextResolver(_context); + if (resolver == null) return null; + + String uri = resolver.getTagURIForNodeName(_element); + + //TODO: make below better + if (uri == null){ + if (_element.getNamespaceURI() != null && _element.getNamespaceURI().equals("http://java.sun.com/JSP/Page")) //$NON-NLS-1$ + uri = "JSP11"; //$NON-NLS-1$ + else + uri = "HTML"; //$NON-NLS-1$ + } + final IMetaDataDomainContext context = MetaDataQueryContextFactory.getInstance().createTaglibDomainModelContext((IFile)wsresolver.getResource()); + _query = MetaDataQueryFactory.getInstance().createQuery(context); + return _query.getQueryHelper().getEntity(uri, _element.getLocalName()); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue() + */ + public Object getEditableValue() { + return _innerSource.getEditableValue(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object) + */ + public Object getPropertyValue(Object id) { + // CR377844: when the attribute in source is "a>b", we would like to + // display + // "a>b" in cell editor. But _innerSource.getPropertyValue(id) will + // return the source + // of the attribute, so can't use that here. + // read QTS log for detail. + // return _innerSource.getPropertyValue(id); + if (id == null) { + return null; + } + String name = id.toString(); + String value = _element.getAttribute(name); + if (value == null) { + value = ""; //$NON-NLS-1$ + } + return value; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object) + */ + public boolean isPropertySet(Object id) { + return _innerSource.isPropertySet(id); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object) + */ + public void resetPropertyValue(Object id) { + _innerSource.resetPropertyValue(id); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, + * java.lang.Object) + */ + public void setPropertyValue(final Object id, final Object value) { + Object oldValue = getPropertyValue(id); + if (oldValue == value || (oldValue != null && oldValue.equals(value))) { + return; + } + Command c = new ChangeAttributeCommand( + PDPlugin + .getResourceString("AttributePropertySource.CommandLabel.ChangeAttribute"), _element, (String) id, (String) value); //$NON-NLS-1$ + c.execute(); + } + + /** + * the major job of this wrapper is to provide tag attribute property descriptors + */ + public IPropertyDescriptor[] getPropertyDescriptors() { + if (_descriptors == null) { + final List result = new ArrayList(); + + final ITagElementResolver tagregResolver = IStructuredDocumentContextResolverFactory2.INSTANCE + .getResolver(_context, ITagElementResolver.class); + + if (tagregResolver != null) { //relies on getTagEntity() having been called to have setup the _element + final ITagElement tag = tagregResolver.getTagElement(_element); + if (tag != null) { + for (final ITagAttribute attr : tag.getAttributes().values()) { + final IPropertyDescriptor pd = getAttrPropertyDescriptor(attr + .getName()); + if (pd != null) + result.add(new PropertyDescriptorWrapper(_element, + pd));// , + // getStatusLineManager())); + else { + final PropertyDescriptor pd1 = new TextPropertyDescriptor( + attr.getName(), attr.getName()); + pd1.setDescription(attr.getDescription()); + pd1.setCategory(ITabbedPropertiesConstants.OTHER_CATEGORY); + result.add(new PropertyDescriptorWrapper(_element, + pd1));// , + // getStatusLineManager())); + } + + } + } + } + + if (result.size() == 0) {// for JSP and HTML cases + // this is still + // necessary + final IPropertyDescriptor[] descs = _innerSource.getPropertyDescriptors(); + for (int i = 0; i < descs.length; i++) { + final IPropertyDescriptor pd = getAttrPropertyDescriptor((String) descs[i] + .getId()); + if (pd != null) + result.add(new PropertyDescriptorWrapper(_element, pd));// , + // getStatusLineManager())); + else { + if (descs[i] instanceof PropertyDescriptor) + ((PropertyDescriptor) descs[i]) + .setCategory(ITabbedPropertiesConstants.OTHER_CATEGORY); + result.add(new PropertyDescriptorWrapper(_element, + descs[i]));// , + // getStatusLineManager())); + } + + } + } + + _descriptors = new IPropertyDescriptor[result.size()]; + result.toArray(_descriptors); + + } + return _descriptors; + } + +// private IAttributeDescriptor findReferencedAttribute( +// IElementDescriptor elementDescriptor, IPropertyDescriptor desc) { +// return null; +// } + +// private IElementDescriptor getElementDescriptor() { +// ICMRegistry registry = CMRegistry.getInstance(); +// String uri = CMUtil.getElementNamespaceURI(_element); +// return registry.getElementDescriptor(uri, _element.getLocalName()); +// } + + + private IPropertyDescriptor getAttrPropertyDescriptor(String attrName){ + // WPE Properties is throwing NullPointer Exception in Eclipse Indigo Version + // Entity attrEntity = _query.findTagAttributeEntity(_tagEntity, attrName); + Entity attrEntity = org.eclipse.jst.jsf.common.metadata.query.TaglibDomainMetaDataQueryHelper.getEntity(_tagEntity, attrName); + List ppds = MetaDataEnabledProcessingFactory.getInstance().getAttributeValueRuntimeTypeFeatureProcessors(IPropertyPageDescriptor.class, _context, attrEntity); + if (ppds.size() > 0) + return (IPropertyDescriptor)((IPropertyPageDescriptor)ppds.get(0)).getAdapter(IPropertyDescriptor.class); + + return null; + + } + +// private IStatusLineManager getStatusLineManager() { +// _page.getSite().getActionBars().getStatusLineManager(); +// } +} diff --git a/org.eclipse.jst.pagedesigner/.classpath b/org.eclipse.jst.pagedesigner/.classpath new file mode 100755 index 0000000..efdacce --- /dev/null +++ b/org.eclipse.jst.pagedesigner/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.eclipse.jst.pagedesigner/.cvsignore b/org.eclipse.jst.pagedesigner/.cvsignore new file mode 100755 index 0000000..d3e27d6 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/.cvsignore @@ -0,0 +1,3 @@ +build.xml +@dot +javaCompiler...args diff --git a/org.eclipse.jst.pagedesigner/.options b/org.eclipse.jst.pagedesigner/.options new file mode 100755 index 0000000..ac12e74 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/.options @@ -0,0 +1,5 @@ +org.eclipse.jst.pagedesigner/debug=true +org.eclipse.jst.pagedesigner/debug/converter/load=false +org.eclipse.jst.pagedesigner/debug/converter/selection=false +org.eclipse.jst.pagedesigner/debug/elementedit/load=false +org.eclipse.jst.pagedesigner/debug/elementedit/selection=false \ No newline at end of file diff --git a/org.eclipse.jst.pagedesigner/.project b/org.eclipse.jst.pagedesigner/.project new file mode 100755 index 0000000..3c035d7 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/.project @@ -0,0 +1,30 @@ + + + org.eclipse.jst.pagedesigner + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + org.eclipse.jem.beaninfo.BeanInfoNature + + diff --git a/org.eclipse.jst.pagedesigner/.settings/org.eclipse.core.resources.prefs b/org.eclipse.jst.pagedesigner/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 0000000..ef13767 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Sun May 27 16:04:56 EDT 2007 +eclipse.preferences.version=1 +encoding/=ISO-8859-1 diff --git a/org.eclipse.jst.pagedesigner/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jst.pagedesigner/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 0000000..480397b --- /dev/null +++ b/org.eclipse.jst.pagedesigner/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,87 @@ +#Wed Mar 04 15:05:47 PST 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error +org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=error +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=error +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/org.eclipse.jst.pagedesigner/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.jst.pagedesigner/.settings/org.eclipse.jdt.ui.prefs new file mode 100755 index 0000000..7907405 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,3 @@ +#Fri Apr 06 18:25:15 PDT 2007 +eclipse.preferences.version=1 +org.eclipse.jdt.ui.text.custom_code_templates= diff --git a/org.eclipse.jst.pagedesigner/.settings/org.eclipse.pde.prefs b/org.eclipse.jst.pagedesigner/.settings/org.eclipse.pde.prefs new file mode 100755 index 0000000..8bca378 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/.settings/org.eclipse.pde.prefs @@ -0,0 +1,22 @@ +#Fri May 30 11:58:12 PDT 2008 +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=0 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=0 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/org.eclipse.jst.pagedesigner/META-INF/MANIFEST.MF b/org.eclipse.jst.pagedesigner/META-INF/MANIFEST.MF new file mode 100755 index 0000000..01bc5e0 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/META-INF/MANIFEST.MF @@ -0,0 +1,135 @@ +Manifest-Version: 1.0 +Bundle-SymbolicName: org.eclipse.jst.pagedesigner;singleton:=true +Bundle-Name: %pluginName +Bundle-Version: 1.3.103.v201109010833_patch +Bundle-Activator: org.eclipse.jst.pagedesigner.PDPlugin +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", + org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)", + org.eclipse.emf.ecore;bundle-version="[2.2.0,3.0.0)", + org.eclipse.gef;bundle-version="[3.2.0,4.0.0)", + org.eclipse.jface.text;bundle-version="[3.2.0,4.0.0)", + org.eclipse.ui.workbench.texteditor;bundle-version="[3.2.0,4.0.0)", + org.eclipse.wst.common.ui;bundle-version="[1.1.0,1.2.0)", + org.eclipse.wst.common.uriresolver;bundle-version="[1.1.0,1.2.0)", + org.eclipse.wst.sse.ui;bundle-version="[1.0.101,1.4.0)", + org.eclipse.jst.j2ee;bundle-version="[1.1.0,1.2.0)", + org.eclipse.jst.jsp.core;bundle-version="[1.1.0,1.3.0)", + org.eclipse.jst.jsp.ui;bundle-version="[1.1.0,1.3.0)", + org.eclipse.jst.j2ee.web;bundle-version="[1.1.0,1.2.0)", + org.eclipse.jst.pagedesigner.jsp.core;bundle-version="[1.0.0,2.0.0)", + org.eclipse.jst.jsf.common.ui;bundle-version="[1.0.0,2.0.0)", + org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)", + org.eclipse.jdt.ui;bundle-version="[3.2.0,4.0.0)", + org.eclipse.jst.jsf.common;bundle-version="[1.0.0,2.0.0)", + org.eclipse.jst.jsf.core;bundle-version="[1.0.0,2.0.0)", + org.eclipse.jdt.core;bundle-version="[3.2.0,4.0.0)", + org.eclipse.wst.html.ui;bundle-version="[1.0.100,1.1.0)", + org.eclipse.wst.css.core;bundle-version="[1.1.0,1.2.0)", + org.eclipse.wst.html.core;bundle-version="[1.1.0,1.2.0)", + org.eclipse.wst.xml.ui;bundle-version="[1.0.100,1.2.0)", + org.eclipse.wst.xml.core;bundle-version="[1.1.0,1.2.0)", + org.eclipse.wst.sse.core;bundle-version="[1.1.0,1.2.0)", + org.eclipse.ui.views.properties.tabbed;bundle-version="[3.2.0,4.0.0)", + org.eclipse.core.expressions;bundle-version="[3.4.0,3.5.0]", + org.eclipse.jst.jsf.common.runtime;bundle-version="[1.0.201,2.0.0)" +Bundle-ActivationPolicy: lazy +Bundle-ManifestVersion: 2 +Export-Package: org.eclipse.jst.pagedesigner;x-internal:=true, + org.eclipse.jst.pagedesigner.actions.container;x-internal:=true, + org.eclipse.jst.pagedesigner.actions.link;x-internal:=true, + org.eclipse.jst.pagedesigner.actions.menuextension;x-internal:=true, + org.eclipse.jst.pagedesigner.actions.range;x-internal:=true, + org.eclipse.jst.pagedesigner.actions.single;x-internal:=true, + org.eclipse.jst.pagedesigner.actions.table;x-internal:=true, + org.eclipse.jst.pagedesigner.adapters;x-internal:=true, + org.eclipse.jst.pagedesigner.adapters.internal;x-internal:=true, + org.eclipse.jst.pagedesigner.commands;x-internal:=true, + org.eclipse.jst.pagedesigner.commands.html;x-internal:=true, + org.eclipse.jst.pagedesigner.commands.nav;x-internal:=true, + org.eclipse.jst.pagedesigner.commands.range;x-internal:=true, + org.eclipse.jst.pagedesigner.commands.single;x-internal:=true, + org.eclipse.jst.pagedesigner.converter, + org.eclipse.jst.pagedesigner.converter.html;x-internal:=true, + org.eclipse.jst.pagedesigner.converter.jsp;x-internal:=true, + org.eclipse.jst.pagedesigner.css2;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.border;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.color;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.font;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.layout;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.layout.table;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.list;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.marker;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.property;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.provider;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.style;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.value;x-internal:=true, + org.eclipse.jst.pagedesigner.css2.widget;x-internal:=true, + org.eclipse.jst.pagedesigner.dnd;x-internal:=true, + org.eclipse.jst.pagedesigner.dnd.internal;x-internal:=true, + org.eclipse.jst.pagedesigner.dom;x-internal:=true, + org.eclipse.jst.pagedesigner.dom.html;x-internal:=true, + org.eclipse.jst.pagedesigner.dtmanager, + org.eclipse.jst.pagedesigner.dtmanager.converter, + org.eclipse.jst.pagedesigner.dtmanager.converter.internal;x-friends:="org.eclipse.jst.pagedesigner.jsf.ui", + org.eclipse.jst.pagedesigner.dtmanager.converter.operations, + org.eclipse.jst.pagedesigner.dtmanager.converter.operations.internal;x-friends:="org.eclipse.jst.pagedesigner.tests", + org.eclipse.jst.pagedesigner.dtmanager.dtinfo, + org.eclipse.jst.pagedesigner.dtmanager.dtinfo.internal.impl;x-internal:=true, + org.eclipse.jst.pagedesigner.dtmanager.dtinfo.internal.util;x-internal:=true, + org.eclipse.jst.pagedesigner.dtresourceprovider;x-internal:=true, + org.eclipse.jst.pagedesigner.editors;x-internal:=true, + org.eclipse.jst.pagedesigner.editors.actions;x-internal:=true, + org.eclipse.jst.pagedesigner.editors.pagedesigner;x-internal:=true, + org.eclipse.jst.pagedesigner.editors.palette;x-internal:=true, + org.eclipse.jst.pagedesigner.editors.palette.impl;x-internal:=true, + org.eclipse.jst.pagedesigner.editors.properties, + org.eclipse.jst.pagedesigner.editors.properties.internal;x-internal:=true, + org.eclipse.jst.pagedesigner.editors.properties.quickedittabsections, + org.eclipse.jst.pagedesigner.editors.properties.quickedittabsections.internal.impl;x-internal:=true, + org.eclipse.jst.pagedesigner.editors.properties.quickedittabsections.internal.util;x-internal:=true, + org.eclipse.jst.pagedesigner.editpolicies;x-internal:=true, + org.eclipse.jst.pagedesigner.elementedit;x-internal:=true, + org.eclipse.jst.pagedesigner.elementedit.html;x-internal:=true, + org.eclipse.jst.pagedesigner.elementedit.jsp;x-internal:=true, + org.eclipse.jst.pagedesigner.extensionpoint, + org.eclipse.jst.pagedesigner.figurehandler;x-internal:=true, + org.eclipse.jst.pagedesigner.itemcreation;x-internal:=true, + org.eclipse.jst.pagedesigner.itemcreation.command;x-internal:=true, + org.eclipse.jst.pagedesigner.itemcreation.customizer;x-internal:=true, + org.eclipse.jst.pagedesigner.itemcreation.internal;x-internal:=true, + org.eclipse.jst.pagedesigner.meta;x-internal:=true, + org.eclipse.jst.pagedesigner.meta.internal;x-internal:=true, + org.eclipse.jst.pagedesigner.parts;x-internal:=true, + org.eclipse.jst.pagedesigner.preview, + org.eclipse.jst.pagedesigner.properties;x-friends:="org.eclipse.jst.pagedesigner.tests", + org.eclipse.jst.pagedesigner.properties.attrgroup;x-friends:="org.eclipse.jst.pagedesigner.tests", + org.eclipse.jst.pagedesigner.properties.celleditors;x-friends:="org.eclipse.jst.pagedesigner.tests", + org.eclipse.jst.pagedesigner.properties.dialogfields;x-internal:=true, + org.eclipse.jst.pagedesigner.properties.internal;x-friends:="org.eclipse.jst.pagedesigner.tests", + org.eclipse.jst.pagedesigner.range;x-internal:=true, + org.eclipse.jst.pagedesigner.requests;x-internal:=true, + org.eclipse.jst.pagedesigner.tableedit;x-internal:=true, + org.eclipse.jst.pagedesigner.tools;x-internal:=true, + org.eclipse.jst.pagedesigner.ui.common;x-internal:=true, + org.eclipse.jst.pagedesigner.ui.common.sash;x-internal:=true, + org.eclipse.jst.pagedesigner.ui.dialogfields;x-internal:=true, + org.eclipse.jst.pagedesigner.ui.dialogs;x-internal:=true, + org.eclipse.jst.pagedesigner.ui.preferences;x-internal:=true, + org.eclipse.jst.pagedesigner.utils;x-internal:=true, + org.eclipse.jst.pagedesigner.validation.caret;x-internal:=true, + org.eclipse.jst.pagedesigner.viewer;x-internal:=true +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: javax.servlet;version="2.4.0", + javax.servlet.http;version="2.4.0", + javax.servlet.jsp;version="2.0.0", + javax.servlet.jsp.el;version="2.0.0", + javax.servlet.jsp.resources;version="2.0.0", + javax.servlet.jsp.tagext;version="2.0.0", + javax.servlet.resources;version="2.4.0" +Eclipse-ExtensibleAPI: true +Bundle-ClassPath: patch.jar, + . + + diff --git a/org.eclipse.jst.pagedesigner/about.html b/org.eclipse.jst.pagedesigner/about.html new file mode 100755 index 0000000..7d7370c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/about.html @@ -0,0 +1,22 @@ + + + + +About + + +

About This Content

+ +

June, 2008

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content.

+ + + diff --git a/org.eclipse.jst.pagedesigner/build.properties b/org.eclipse.jst.pagedesigner/build.properties new file mode 100755 index 0000000..0aa1687 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/build.properties @@ -0,0 +1,23 @@ +############################################################################### +# Copyright (c) 2001, 2008 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 +############################################################################### +jars.compile.order = . +bin.includes = META-INF/,\ + icons/,\ + plugin.properties,\ + plugin.xml,\ + schema/,\ + about.html,\ + default.properties,\ + .options +javacSource=1.5 +javacTarget=1.5 +source.. = src/ +output.. = bin/ diff --git a/org.eclipse.jst.pagedesigner/default.properties b/org.eclipse.jst.pagedesigner/default.properties new file mode 100755 index 0000000..ba3b436 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/default.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2001, 2007 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 +############################################################################### +# This file contains all the Default Preference Settings + diff --git a/org.eclipse.jst.pagedesigner/icons/LineBreak.gif b/org.eclipse.jst.pagedesigner/icons/LineBreak.gif new file mode 100755 index 0000000000000000000000000000000000000000..b46868549efbe8c9a524483a6295696c9d987f13 GIT binary patch literal 885 zcmZ?wbhEHb6krfw_|CwvG+SV4vA|jol2}_Uu@#6~B(Ci(zILqo-m#wl4FCT>U;6*~ z+W+sj{(pb$|MzqMzhC?R{rUg@@Bfd2(GVE=A)xq^g^_`Qi$RA02tav)fg^}Pltad2 z!-9j&9Ku>690?B(FmN+jga|Y=y0kM(@dQ{TJZ4~*78HtbaA0I)SLN?(acE#*nx-Y` hGQ)DR1JgvKXd#OQ8yK3IgheF`1h%X=+`zzK4FFLc1^@s6 literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/MoveHandle.png b/org.eclipse.jst.pagedesigner/icons/MoveHandle.png new file mode 100755 index 0000000000000000000000000000000000000000..679ef9918973dadac6d59c0d422d2a23bbdc74ec GIT binary patch literal 183 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhY)RhkE)4%caKYZ?lYt_f1s;*b zKvlvZ%*Zfnjs#GUy~NYkmHj%SER%_{n`xOIP{_s8#WAGf*4_z*Tnq*r%+mk=KYy(f zvHHr&nJRNsTo|%7R{MAw-#GZ{Vbk8wtLNe_UKDp=f97)f;@#RSFT{HOwVUpGv4S`J Wx#92Cy&FLeV(@hJb6Mw<&;$S`0X$3q literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Binding.gif b/org.eclipse.jst.pagedesigner/icons/PD_Binding.gif new file mode 100755 index 0000000000000000000000000000000000000000..6638a992e90f560f444d0cb011425071594bc0f0 GIT binary patch literal 133 zcmZ?wbhEHb6krfwFlJy-{K>+|z`((v!vF*zvF3mO|JTRc@2|JNzu*4Njid4Q_V?%8 z|NlQ9qyQUWF%mfGxq7d~Yu(NtOba;=B(gmgSTnzZ(>YOsy+|z`)F)19CDbPcU#8G8hU-crYApU}P~#iQsskz{t*^#3#Zrk+GRa ciovEuLQtu#LqSolCnNAlL%#w$3k!oa0I?=Rd;kCd literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Plugin.gif b/org.eclipse.jst.pagedesigner/icons/PD_Plugin.gif new file mode 100755 index 0000000000000000000000000000000000000000..471b1b56c8024d4e918bace4d4e7eea0e199b20e GIT binary patch literal 605 zcmZ?wbhEHb6krfwc*ekxoH{2eu{tPqX?E$9&tHH4{Pp+8&p$!AYoiL+CReV_F71iR zo$~I}uTLPUKR*pcX?@hl}~fI@6*S3Cf0lO)OyWr zb)DYiwxQo{O^?I!E~n+)PK!F6ADrmFdu8923AR@@Wn9^md24UYz4L3YZp!@s9q6~c zEwP6G!GM8up!k!8k%1wPK?kH26ekSqyBhLRnp>Ll+B@1)_8!cAucGOo|K*%H!+@9L0f@EVZB1a#6&G=DarW@g%T%5%ggiZKg60mF-B$E4sj7D z69WS)|Mo}?xog*)EM4rZZ7nWE$)1!Dwz1C$&2li)%L`Nf@IlqcC)>-z-H<&mTQfBC-&d^VtVURu7Fng{|{sN=I zg~o*ojfxhU)vxlYUuo8`%Dioz1qiLT?Ac`5yUD6&v-PBH)|0o}Oxk7xB&YAP1)>?d z>}Kz^o3q!cVRb~y+Vn}=>Syn*S$eo)+xd!J7ymQ-Z&`J`chi}o zJ#p>Hh5N4_zW@66>yM9Leti1=>*t@p45MH)1ZWuoia%Kx85qDX@&p4%1%p3_ zjK_ur2b($UYd$Qvz{1m_Zk6-Eq0pIAio-bLLcyY=tUQJSK^qbtvUGEar727iP;6r1 z6b^G}d2oP{g+n38A?CsYMotkPu{{nm7#Nuvl>}@YA|4!Q6xI`w;Aot{(8w6UE)dWt X(9poZw5M+ZWZ)F<1it{dI+x literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_bold_disabled.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_bold_disabled.gif new file mode 100755 index 0000000000000000000000000000000000000000..639de4673b1561121f8bb8fd9ff832cfa3f25950 GIT binary patch literal 870 zcmZ?wbhEHb6krfw_|CxapW*+yjoY{G*t_rG(St`$oH}#i=C$)5K7Ri6`Rmtj-+%x9 z!!Qa)LtyxZfZ|UUMv(7xKm;gHFmO0CFmlLvY*=uxnS)s)rh-ASp;bUsC4{4)!HGqf unL%QKf#b1OCK;y~jiM9=W=YmbHXfS}cr~kOZZhe-xbW<33t2W625SJSlryjZ literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_designer.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_designer.gif new file mode 100755 index 0000000000000000000000000000000000000000..fdfcae0abf0fa1875927c7e62f31694a2ec1caf0 GIT binary patch literal 248 zcmZ?wbhEHb6krfwI3maJ;m41P9J31_e%RZ`+sD@@MmjE7u*81;{`vRq?d$jdzi+?a z9>}x*&%p5i|Nr^*_W%Eb6#kEo*9_`;c;LXMP5bA^+t0TLDz@LWe^YR@Lr00#%`=<+ z1GW4IYGP3Q$->CMAjhBsWCLv!U|?V^U7+5V@{%=U)w<;mb{*4Z*G=GWS$n%g;ZEC~ zzHn&?nL~;G2_*{cF7gcGTLQ(pk0%E!^XzL_?ZVV(V`0}UIAOPk6mKh2lBYVO_>V=( v>;Jb&aB%Q&va<^ZHSjdGaSF3em^eX7kf(){SyW9~Qcy5{*6c-ciVW5Ouqa^g literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_hsplit.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_hsplit.gif new file mode 100755 index 0000000000000000000000000000000000000000..4dae95d76dd91b36b12de75bbb60b28bf2c364f8 GIT binary patch literal 119 zcmV--0EqubNk%w1VGsZi0HOu}pT9q*%J6t>Hep#om9^M^pFjWq{{R30A^8LW000I6 zEC2ui01yBW0009#Xu8}cFv|Igy@Tj29{6AujAJK&AwiZN3W%%ezG~c}Fe$q^d-65i ZEwu{la6#X!XEY3+(5Tcwty&ie06PYIExiB$ literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_italic.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_italic.gif new file mode 100755 index 0000000000000000000000000000000000000000..fb765fe7006a2a4090259a0c9fd1be817c8958be GIT binary patch literal 880 zcmZ?wbhEHb6krfw_|CwfmpD}~VVYjzG=sF62HA6L^B0(uE;g-RZr-@svU`*D#BH`y zci7I{Z9iwP-JE@PbN4y5uJxF{D|X`6vN?Mb7avSrd$MZv@&63}yY^pQz5i+|z#z_` z19A~4PcU%!GU#*2cx+g3u$hBBtK!3g#^x4gbAuHOg$iw~a#~zH3l_Av336&=>`7pB qY@aB=H{pWBp@x=;!W;z`EEXML5D>NJU|>*iXq)KJoW;YzU=08s7G-(> literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_italic_disabled.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_italic_disabled.gif new file mode 100755 index 0000000000000000000000000000000000000000..74753155d107c44ed74329685fd6a3fe7f27e3f4 GIT binary patch literal 862 zcmZ?wbhEHb6krfw_|CxapW*+yjoY{G*t=`*p~J^c9Y1yM)R_x6ubuz!@$=VjK>1NH z8Un*P1QdU=FoOK210q0qf`P-DfssSTW5a@j%^d7p90v>>4mGk!*vXu@aKNRJM>xhs j;bYR#ZU&>gHx?5U8z(aI`IuZVIKVK$AUTeQgTWdAkIOK^ literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_largefont.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_largefont.gif new file mode 100755 index 0000000000000000000000000000000000000000..39afd385bad20d24f61fd21ee109f13302b3ca8b GIT binary patch literal 888 zcmZ?wbhEHb6krfwXlDR{1~6^_Qw=~~L&E_exN~6HsSjE~eRgs4?CSQ}&D-~%;XhE} zC>RZap%nuEe}7o8U`azm11R|d6ETjXn1B)FevUi&DL(Nh(i@ N;RsxGuz`WW8UO>d9Z~=Q literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_paragraph.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_paragraph.gif new file mode 100755 index 0000000000000000000000000000000000000000..b129090b1615e536dc798d02fcbd1f72ab3c4d2d GIT binary patch literal 581 zcmZ?wbhEHb6krfwc*el6>-hZ>S6+GNEh=hXt{*wUGHHfY(sY~DSvDy%9n$AGq|bKB zn&+Ccz%6HiXZ|AZ!X>`N%lwL$`IjvBFI^r`x_s^4%j@@F)eh^`3GdU1=+ler|NZy> zo@;McpMACE((66f-uTVA8Z!S{`KEh~+aESm&C*9=-Q5c>cA<9S`>2djIS1|L=ePfByad&CmbufBnDu`Ty&m|KI)k|K`{K*T4S1 z|NZ~-pa0+g{{Q{&|F3`l>zbR|I%+5MmCu|~xNv6n!kIZUCl@ZClkxxme}~T`~pIg6%-Aa zbd^-pG&Hs3AKmSyJqelE@oXlOjge=P0TG_J)F%$ie^s literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_smallfont.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_smallfont.gif new file mode 100755 index 0000000000000000000000000000000000000000..f0b4eba11a9bc4295fa28b5280c6ebacd3945eba GIT binary patch literal 854 zcmZ?wbhEHbEV_zov?0vBQRtV3&2ODlU>CILbWUvMRx(_{= literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_underline.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_underline.gif new file mode 100755 index 0000000000000000000000000000000000000000..b8ac9775a1682f24fcf859e0b5442c91c8aa34fd GIT binary patch literal 916 zcmZ?wbhEHb6krfw_|Cwf6FEUAa-weB6#eAsCTWulGG`m*%{Q%CZe6y>p>nBb@gkqv z6%lnSt@^guOx|ugW4GPxy>@f<+Rxb=*|a9IeSPe-ohhyBGNchm%(x zO<8-gV#Se~EoW=DpRe0{`9H(|riBORZaF)5+qs=5ZY{m|VBg&r`|rIxe&x~C`!BCP zcy;a3o9j>C-gxoh#>1ftuF$hpB gXlat<@Q&aB+S4Y%u~|yxz*Oy~^$AR#Q*>R literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_underline_disabled.gif b/org.eclipse.jst.pagedesigner/icons/PD_Toolbar_underline_disabled.gif new file mode 100755 index 0000000000000000000000000000000000000000..f06517b0f1152aed4dc199b9e7365c7e4a434ad5 GIT binary patch literal 882 zcmZ?wbhEHb6krfw_|CxapW*+yjoXi&ICJXEg`3yTfB5+M)90^WzJB}q4JbJZMnhnj zhk)Ww7DkX4bwC6tPcU%!Gca<^(PF6}rMnOeST|r4lSw=>~TvNxu(8R<9W=16jCP7AKLB{__7~~lk7+FECWn^T40!Aig7FITP4o)s^ zpn|Oe3`~s7%uFoItgI|7K-INCc?K3iRv|@0M>gTWM0TY@5u?V53ptdXHXalWy7)oG zIH{I3zSIJR&kGIVCkMJtH%#xTLhK zyrQzIxuvzOy`!^h(&Q;qr%j(RbJn88OO`HMzGCI7O`ErD-L`$l&RvHNA31vL_=%IJ zE?vHI_1g6tH*Yuqec!9r-=(U9^_Ou4*DRPRCJL`OvU7(>PL{* zz&<0+V@+iF4DK<6ziu(`Ff#%pk6Dnxp5Ys>y5}YPhw>YD?6~}<{_!>QNuG-S@0dJQ z>bBG$RsPQqVE?Dp{m{6QdoHV#_33JTk`!~%I`Jqv?BLgjQ$Ehyw^Q`u zYx|Es=6^j?Z|r(G+^sP4RmZ>N55J#!s^q^}CuE{`reRs-*ljY4yvdqMnMjE{zFKHZV-$3uy>xTG+nn<*t^ns@SD#x}H94RZd!vFkyjA z@!PQd+j9Ri?9_i^e{AdWu#nq@+g9CL^8M@n`#WasdoKLYTi59Ru`=%kFLupso6k10 zWYgZKy+@*#R_2~Keah&KliZVr8828%tIq$aQ~z5mf9C4`x3lZtdH>}9xaRinDZA#z SGBb$Fn_syW%Qm(D|4jfF{FJW% literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/library_obj.gif b/org.eclipse.jst.pagedesigner/icons/library_obj.gif new file mode 100755 index 0000000000000000000000000000000000000000..cb55e33b5ebaed988a88b859aaf3be8b600201cb GIT binary patch literal 338 zcmZ?wbhEHb6krfwxXQpF?q0)?y2Gqyoqoe+jpm&a-A4ubPq9wD%-Z0gH#MPRN6m*5 z8XpcQyx5`e;ef`A4H6F)2t1e}aAShNg${um9Re2`1Wr^4e7LdWLWRJUF7L}--nSMO z?#(bcSY*E~LS>_;$OaFQ4W1(Z|Nm#84N&~a!pOj&#GnH*9^@wmwtR<)1s*z5{T`25 zi#&xCxjTv@8V%YR4>klC$S^Hhs%*qE<9u3TtD>UXy@HC+OCm}lKlU&c&NR_*=4fhe zRubhEb&~Dw>6HzY@RgCCGIgqqxEQ~flAPpxsRfc!a!Rx2D6W)OSfi-0dYRaq;4L1G G4AuZ3a$RKr literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/newsuade_wiz.gif b/org.eclipse.jst.pagedesigner/icons/newsuade_wiz.gif new file mode 100755 index 0000000000000000000000000000000000000000..ecd75f41b8893e5dc11f8c43765d584e61b329b5 GIT binary patch literal 3148 zcmWktXH=61pbZ%$>>wMWMC2(VA~>-)!p5R#TeTde6v2sBiPFkLP&PP=6%~Op0tzo8 z1e775hJb)9*)vEI2pN#QzO3(i_WroP?z#7zd(RCy6zsG2Oc=}`rh>sB2>P}RaD|%E z($dDpMkSyhl|rk$=>-lT)k5D`t4n+}dsV$6)~rgj%w@?UUkyQv>_wg)nt5MhiA|_f1bvL+Wv*4jNqKfe=JjKr?b^bZn%ms;Y5t zf+x}ddPoaG0=06HIWxK{V{jA@q#GZlOBBk=c?f&}w)HV7_(kW!}9Nwi8x z*44MFscwGHQ^~*7oRdfw3TqpC=qxUmou8jCRp=D*rRqxZ>yF-<-tXxW0ARe#aF>di zAPA}T5`k2+#8YbYD|*Fub8v|@DphEBLK(=bo%)!h0u&mZKn?JeI)zBc(Ce1e8lgg` zRw!9YKuV!dCVMMqXO{paf4G0DqN3#U=T9UOi7Qmgr7S=r6UlUPr9vP9xU4}v$mw8; znG4Gh#Gx2u{q+Y4iY~mWc%O{rz2_ehCu2)2jsv6)@16%T{Sx zo7&~FrSA%%6dFuR{qH49=x>~YWrsD|I9D#<*nG;L+ zDs8TJfl%h}NN2za8Xp}oLt$bdp?C$E;=~!G8IeFBDoUWXWf z4Ya0?kb3^M5^&vN6$U*|*7%Vlji`Zdow0ka5M~~~9L(EjtOE=>5!Nqu{_+i%l$RS` zV7?DP{`jPNEX~t|>oG&%eSLAH)cnolVe)bEiRUpv|2Od}wC;y(doNNa-G6B~cOqD! z*^r&l_{V3%huRVI+}Z>Q{j-yjANA3Q_|pb%gG2Pc>FBpxbxK!Orj1uSqAW8vw&&-S z;E%pDf{6a-X6I9Hc0c_$E)YxyiJQAG(q36qZ4Ax%b?d2Y@(Vm^Wt+gh3B5R3^k*|Q z_<~YyytAfIJUtja9`3ofj=2o)u!QW7er#9E*dg@ZkuFTbuFH`l&{>u5z&f3WwW{H0*4D@^DZ0rK-qF10B1t zNp2*}fEnYRD#|&bxTAj^jzTj=ZSSS@n9!mLg9m2LBK!^h$cvr2zVO0r7?p;8X&NhsRS6q@YpaWT+-2F^J_s-?H1Y=o6h2MO>Gk!`Yh!qx8ypH)%*_(;aN$A8|y(6FF&Sf zq`0^Cczlqj9ZX6yu?*CaofGpB2FR^v+lf8v?uTLDvu$-9XjExYzb}2Y9&Kb<`cKft zeEN@X2XWdJV(qDNt?cW83R$m7Yy>3>HSXDvFt%f=hB&@=B{|079MvGiGH9O!X%{&i zo#B|csl55y2{|NaUXZ(0Ja9OFczv+TE9>+jRA}?zZ7wl81n*|{gz2yOJ*a$~jVbQ5 z?BU!%uTR1j=YwB)XDf%k@?SeK26ork$3ED0cl^;KC#yh8P`?%apZ@750S{&4$UpN8 zafYsSI_bb3k#42l=|-YUmVJ7gFc#;XEm}DHbGZ0|#htx=;rW(1GH%tU_8oQY+q0N5 zYnL2_Rk9!LQBM2r_KW>&I=+-uPR@6n!?dg?;RM zxivG0L0bc5hjzI*N^(Q#erCzc`~N$D$WAIaBV1OXaGru&`vXr88Pl>|rlZl(rWN)* zq21dx1oX#5ylK5<&`(!r@YlK2jq(exJ?>eg!g(aeWNOa=jpXlCQ&)@O>fpUxKZ|<| zs(m*h-7W%VSx|to=1==MUww?f(wpX(Nc|F?Bz;n5dd@7Kavzvyn&%v@Ldf?UWLx(>6vhKRojRHGSzG44)&EL;PJhI^N)Sc(tR~cJ9?fEpwj8G|q`4!wH1gy9$?Lr`v95F~f+1xsjTmU!SUodHcUvBa9U_D)q=Le&b zLa=byZ!j*^u>qgeI;*Hn9NZFhsNRASe%U5AzIZ>KIB9r{gp1q7@o2_md#0vYti}3o z$tTS8ol-UwG+yzoWlVV{vM{cgE68Cy(#&x2UDaSl+=-%e>j-A!NqaYH5;n~ficGWQ z=6yag#Qya}BF%~=545W;8@p|Ey-NEeFJ>y|C!2*+(%<)~|^x0wJ3^N0b+3Dlb3k_~kO}t}r%s*%Vw0&9_cf750SVKcb04z*dD{NqW+cNh z6Px4HzT5Cw3KL68l%SrCS()TkrWTpZ1Bd{y|v3A$_(ZX4jCeB3-JFOy=d2wgQ_yH@A}1npgF{MhYEyGcDv=(5Vq_z2-PWe>LuS0X zEaVc%>+f3y#;je0WxM`3{O|w)VRnPk^H$)E4k94t=H2|)a zz2woHZkdAJv%?xseCV$1!Jk#_$iy2MC9t@mN0UaL4<%IIV)BmV{IKKIfj>hc=1ocy z2?x_3pDeA=7E^6=*G6r?SrtU10z-X?1gi3Drs2jj7c=N*2&%C0^E+RvjY3+%<4xpS z_}J#~nXk3V#%8^@uTcP<6QydqS>>K&2V2-&ay7v{ZFSPympKtt+&P94UcZKzZ(Ibf z1l^V%oZ89oKA8CKMv0(7-OdU)nA8Ss5=Hpwr|iPo`%MnW&fiR#^>x-Ze=U(zeo8qV zUOGLG`0YX(^kF&c8o+X91Eg#1()Fd+|z@W{b!vF*zu~r~``10fS6-Na^x_E&otha5&kwaG= z?!Wl>z@>+M>rWKV-RIr5(W`Zxcgx12x%(!pKXLH#?L(Iz`P8pC_~QS8=l>2o|Lk390k+M2!vFvP literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Default.gif b/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Default.gif new file mode 100755 index 0000000000000000000000000000000000000000..5e7fb33399d8a2aefbdb288b65aa988365decfb3 GIT binary patch literal 82 zcmZ?wbhEHb6krfwn8?6z=<*|h(5{0o{sV#HPZmZ724)5w1|R^*GcYO7>0f#JEx#~_ iCWEP~kl53sv2F_t?|jr;=$<#%MKRyyx>+y-gEatR02?y^ literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Export.gif b/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Export.gif new file mode 100755 index 0000000000000000000000000000000000000000..095beb0c4d4779f5ba356b7bafece085accedfdd GIT binary patch literal 958 zcmZ?wbhEHb6krfw_|Cw<@SlMrYK~#?QcKG@mQizngylU;r{bkS*>i%jmj)FtjRKZpzwgbAW2MUR%2N-r8gL_5y{Y_U^5&-n%#IUeug>_xAp0 z`2YWZH4u-2(GVESA)xq^g^__lmO%%Y6@WQHfPsNyHiI?Cn+1tYj=apmd~+5YY(Ct? zC2n@a;Ue>q4q=(R1v?%#G%zp2SE2osHEh;+29L<2)G)gV?NtP0WqVB33KBt~xgJu_&2kBqZjvt`}rC rvpC(r)VziHwo!yaV&mQ26>qPF3M^cIe}BEOf`reG4T&s_j11NQHvbUg literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Export_Disabled.gif b/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Export_Disabled.gif new file mode 100755 index 0000000000000000000000000000000000000000..04800a616ca13f37acb3b9de6068938394f9d97e GIT binary patch literal 956 zcmZ?wbhEHb6krfw_|CwPkdTm?np#p)@}J>+|z`)F)19CDbPcU%IWMJozDNt-W$jvOw*Hhrwe7K2A+^obQkoic5 zpp4yu9}gHB85o7)GF}KcH8M%rw8gAQY--}`}&h7Awi9N5Y& h6yo8qeO>IXV!?nLr?=i%jmj)FtjRKZpzwgbAW2MUR%2N-r8gL_5y{Y_U^5&-n%#IUeug>_xAp0 z`2YWZH4u-2(GVESA)xq^g^__lmO%%Y6@WQHfPsNyHiI?Cn+1tYj=apmd~+5YY(Ct? zC2n@a;Ue>q4q=(R1v?%#G%zp2SE2osHEh;+29L<2)G)gV?NtP0WqVB33KBt~xgJu_&2kBqZjvt`}rC rvpC(r)VziHwo!yaV&mQ26>qPF3M^cIe}BEOf`reG4T&s_j11NQHvbUg literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Import.gif b/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Import.gif new file mode 100755 index 0000000000000000000000000000000000000000..0af6903082a202fa4ed36b1261b4596798063dbb GIT binary patch literal 958 zcmZ?wbhEHb6krfw_|CvkUvF<|Ifo-^j%Cyw!{Vhu*>jvg z?Xi3J@9$?A1*0J_xI;kkCkrD3gD`^*$eEx#!N4(_L7ihx!NR74+|0s!YYG^f4>xg% zn@w>LWOiv~*0NaQFp-IkK~SHiphJ;~g+pFf014BZ>0^g6w)0 qs}q`=wlLq;@>rnQcz1Wj+iR{97Oua)zn))2!e_^ZhfIu&4AubZ6>f(B literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Import_Disabled.gif b/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Import_Disabled.gif new file mode 100755 index 0000000000000000000000000000000000000000..5c828d4727755a150dce7e05202cd6a454bf8de4 GIT binary patch literal 957 zcmZ?wbhEHb6krfw_|CwPkdTm?np#p)@}J>Z@K^g literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Import_Hover.gif b/org.eclipse.jst.pagedesigner/icons/palette/GENERIC/small/PD_Palette_Import_Hover.gif new file mode 100755 index 0000000000000000000000000000000000000000..0af6903082a202fa4ed36b1261b4596798063dbb GIT binary patch literal 958 zcmZ?wbhEHb6krfw_|CvkUvF<|Ifo-^j%Cyw!{Vhu*>jvg z?Xi3J@9$?A1*0J_xI;kkCkrD3gD`^*$eEx#!N4(_L7ihx!NR74+|0s!YYG^f4>xg% zn@w>LWOiv~*0NaQFp-IkK~SHiphJ;~g+pFf014BZ>0^g6w)0 qs}q`=wlLq;@>rnQcz1Wj+iR{97Oua)zn))2!e_^ZhfIu&4AubZ6>f(B literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/pin_down.gif b/org.eclipse.jst.pagedesigner/icons/pin_down.gif new file mode 100755 index 0000000000000000000000000000000000000000..e85fa908db23f2a2467eda73d9504e8a3ab4c798 GIT binary patch literal 133 zcmZ?wbhEHbc)1-ccgPWk;=O0GmS; KhfB2!gEau$qBk)B literal 0 HcmV?d00001 diff --git a/org.eclipse.jst.pagedesigner/icons/pin_up.gif b/org.eclipse.jst.pagedesigner/icons/pin_up.gif new file mode 100755 index 0000000000000000000000000000000000000000..5eeef332dd71f514e906f8f7aad930f2f9199866 GIT binary patch literal 138 zcmZ?wbhEHb;k3LGNE*U0t*@jg5a2-Hc$vQr7?tu zoBdcT!hjKKm9hlN7}!AFuxdia!-iC-&^BFpL}))|!p8h#U3b2k8UNhLx%d9=IluF` z=hh1a$F~IT3PcEPN#b+U;0&Udzc1`j(Ql^1v0cQ=5+z0B}1ocbcM3JMfLiUYrm9T9~CtjDsC9WHy%|sKdi|OZ76(Oetu7FVPr$` zJJ-K_mn@A^h+`BLEM-+}OLc6k=KO?c z(OfEP8>{{P*ILzNqiV8FJ=M@X(bzrNsF_s$Fy7QR-PC9LRy*CUn^BF->Bd1V>(AAX zX3dW+^D|cKlx@MXJZE2iW`DL~UvVx{t4nLE9*+n4=*Zys`C-=lFg;=rhI14#0}KX|{o47r{}4jgV3F6(Q^j=I7wUsK0;%32}(>7c>uh$ z39IuTt1Bq)_Lu{qyxS()`kydp5P~TJN@ME9>j@188}LC4hJ{zXS&MpTCg>W0DHD{& zYh@2|6!*i+00Wb&d;;G5-JPI3Vi3Y1Hg3dDCqiho*7QmddJq2gL>44h00DH_u0m+j zvP=taY?(d{^=YyNFW z?|EPpE%;nguD36y`nx~iXpW?IoA;`EBXg^i`TmL0Z>05mPx$*vyHM-8)9LQ%AS(|B zeAf|6&YUS(P+e_9orVZ?|B`LIrY!0*-)27IjO~0FA^9Y%T(C8N>#5CO+wMmG + + + + +
+
+ + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + diff --git a/org.eclipse.jst.pagedesigner/model/DTInfo.genmodel b/org.eclipse.jst.pagedesigner/model/DTInfo.genmodel new file mode 100755 index 0000000..ab4d29f --- /dev/null +++ b/org.eclipse.jst.pagedesigner/model/DTInfo.genmodel @@ -0,0 +1,48 @@ + + + DTInfo.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.jst.pagedesigner/model/QuickEditTabSections.ecore b/org.eclipse.jst.pagedesigner/model/QuickEditTabSections.ecore new file mode 100755 index 0000000..56ad0c4 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/model/QuickEditTabSections.ecore @@ -0,0 +1,24 @@ + + + + + +
+
+ + + + + + + + + + + + diff --git a/org.eclipse.jst.pagedesigner/model/QuickEditTabSections.genmodel b/org.eclipse.jst.pagedesigner/model/QuickEditTabSections.genmodel new file mode 100755 index 0000000..61d6aae --- /dev/null +++ b/org.eclipse.jst.pagedesigner/model/QuickEditTabSections.genmodel @@ -0,0 +1,28 @@ + + + QuickEditTabSections.ecore + + + + + + + + + + + + + + diff --git a/org.eclipse.jst.pagedesigner/plugin.properties b/org.eclipse.jst.pagedesigner/plugin.properties new file mode 100755 index 0000000..651cbe9 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/plugin.properties @@ -0,0 +1,37 @@ +############################################################################### +# Copyright (c) 2001, 2008 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 +############################################################################### +#################################################### +# Plugin XML information. +#################################################### +pluginName=JavaServer Faces Tools - Web Page Editor +providerName=Eclipse.org + +editor.binding.context.name=Using Web Page Editor +editor.binding.context.description=Key binding context when using the web page editor +# ==================================================================== + + +editor.name.0 = Web Page Editor +category.name.0 = Web Page Editor Layout +command.name.0 = Vertical Layout +command.name.1 = Horizontal Layout +command.name.2 = Graphical Designer +command.name.3 = Source Code + +extension-point.name.0 = Web Page Editor Extension +extension-point.name.1 = property contributor +extension-point.name.2 = popupMenu Contributor +extension-point.name.3 = Content Model Meta Data +propertyTab.label.QuickEdit = Quick Edit +propertyTab.label.Attributes = Attributes + +ext-pt.WPEPropPage.name = Web Page Editor +preferencepage.webPageEditor.name=Web Page Editor \ No newline at end of file diff --git a/org.eclipse.jst.pagedesigner/plugin.xml b/org.eclipse.jst.pagedesigner/plugin.xml new file mode 100755 index 0000000..5de4073 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/plugin.xml @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.eclipse.jst.pagedesigner/schema/pageDesignerExtension.exsd b/org.eclipse.jst.pagedesigner/schema/pageDesignerExtension.exsd new file mode 100755 index 0000000..ada2bd2 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/schema/pageDesignerExtension.exsd @@ -0,0 +1,306 @@ + + + + + + + + + <p><b>This extension point is provisional and subject to change</b></p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + deprecated - use tagAttributeCellEditorFactory + + + + + + + + + + + + + + + + + + + + provides ability for 3rd parties to supply their own cell and dialog field editors for MD enabled tag library attributes in the WPE tabbed property sheets + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + define a tag transformation operation class + + + + + + + The transform operation id. Referencers will use plugin-qualified references. i.e if the plugin extending this was <code>org.foo.bar</code>, then the meta data instance that referenced this operation would specify: + <pre> + <operation id="org.foo.bar.MyTransformId"/> + </pre> + +The exception to this rule is that if the reference is not plugin-qualified, then the reference is assumed to be a <i>core</i> transformation and uses the <code>org.eclipse.jst.pagedesigner</code> prefix. + + + + + + + class extending the <code>org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation</code> + + + + + + + + + + + + + Defines a Design-Time Resource Provider class for a specific ID. + + + + + + + The ID of the Design-Time Resource Provider class. This is used to map usage of each DT Resource Provider class to a specific page neing edited, and so is typically the NS URI of the tag library for which the class provides resources. + + + + + + + Class extending <code>org.eclipse.jst.pagedesigner.dtresourceprovider.AbstractDTResourceProvider</code>. + + + + + + + + + + + + + + + Provisional API. If an extension point is found in the system, the Web Page Editor will use the factory implementation to provide its property page. + + + + + + + + + + + + + + + Provisional API. If an extension point is found in the system, the Web Page Editor will use the factory implementation to provide its paletteViewerPage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + + Copyright 2006 Sybase 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 + + + + diff --git a/org.eclipse.jst.pagedesigner/schema/popupMenuContributor.exsd b/org.eclipse.jst.pagedesigner/schema/popupMenuContributor.exsd new file mode 100755 index 0000000..1a84df4 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/schema/popupMenuContributor.exsd @@ -0,0 +1,83 @@ + + + + + + + + + <p><b>This extension point is provisional and subject to change</b></p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + Copyright 2006 Sybase 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 + + + + diff --git a/org.eclipse.jst.pagedesigner/schema/propertyContributor.exsd b/org.eclipse.jst.pagedesigner/schema/propertyContributor.exsd new file mode 100755 index 0000000..6c13d7f --- /dev/null +++ b/org.eclipse.jst.pagedesigner/schema/propertyContributor.exsd @@ -0,0 +1,89 @@ + + + + + + + + + <p><b>This extension point is unused and deprecated, and will be removed</b></p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.0 + + + + + + + + + + + + Copyright 2006 Sybase 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 + + + + diff --git a/org.eclipse.jst.pagedesigner/schema/tagProperty.xsd b/org.eclipse.jst.pagedesigner/schema/tagProperty.xsd new file mode 100755 index 0000000..f0a70c9 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/schema/tagProperty.xsd @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/IHTMLConstants.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/IHTMLConstants.java new file mode 100755 index 0000000..e567c25 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/IHTMLConstants.java @@ -0,0 +1,1147 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner; + +import org.eclipse.jst.jsf.common.dom.TagIdentifier; +import org.eclipse.jst.jsf.core.internal.tld.TagIdentifierFactory; +import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMDocType; + +/** + * @author mengbo + */ +public class IHTMLConstants { + /** + * anchor tag name + */ + public static final String TAG_A = "a"; //$NON-NLS-1$ + + /** + * abbreviated form (e.g.,WWW, HTTP, etc.) tag name + */ + public static final String TAG_ABBR = "abbr"; // //$NON-NLS-1$ + + /** + * acronym tag name + */ + public static final String TAG_ACRONYM = "acronym"; //$NON-NLS-1$ + + /** + * address tag name + */ + public static final String TAG_ADDRESS = "address"; //$NON-NLS-1$ + + /** + * Java applet tag name + */ + public static final String TAG_APPLET = "applet"; //$NON-NLS-1$ + + /** + * client-side image map tag name + */ + public static final String TAG_AREA = "area"; //$NON-NLS-1$ + + // area + + /** + * bold text style tag name + */ + public static final String TAG_B = "b"; //$NON-NLS-1$ + + /** + * document base URI tag name + */ + public static final String TAG_BASE = "base"; //$NON-NLS-1$ + + /** + * base font size tag name + */ + public static final String TAG_BASEFONT = "basefont"; //$NON-NLS-1$ + + /** + * I18N BiDi over-ride tag name + */ + public static final String TAG_BDO = "bdo"; //$NON-NLS-1$ + + /** + * large text style tag name + */ + public static final String TAG_BIG = "big"; //$NON-NLS-1$ + + /** + * blockquote tag name + */ + public static final String TAG_BLOCKQUOTE = "blockquote"; //$NON-NLS-1$ + + // quotation + + /** + * document body tag name + */ + public static final String TAG_BODY = "body"; //$NON-NLS-1$ + + /** + * forced line break tag name + */ + public static final String TAG_BR = "br"; //$NON-NLS-1$ + + /** + * push button tag name + */ + public static final String TAG_BUTTON = "button"; //$NON-NLS-1$ + + /** + * table caption tag name + */ + public static final String TAG_CAPTION = "caption"; //$NON-NLS-1$ + + /** + * shorthand for DIV align=center tag name + */ + public static final String TAG_CENTER = "center"; //$NON-NLS-1$ + + /** + * citation tag name + */ + public static final String TAG_CITE = "cite"; //$NON-NLS-1$ + + /** + * computer code fragment tag name + */ + public static final String TAG_CODE = "code"; //$NON-NLS-1$ + + /** + * table column tag name + */ + public static final String TAG_COL = "col"; //$NON-NLS-1$ + + /** + * table column group tag name + */ + public static final String TAG_COLGROUP = "colgroup"; //$NON-NLS-1$ + + /** + * definition description tag name + */ + public static final String TAG_DD = "dd"; //$NON-NLS-1$ + + /** + * deleted text tag name + */ + public static final String TAG_DEL = "del"; //$NON-NLS-1$ + + /** + * instance definition tag name + */ + public static final String TAG_DFN = "dfn"; //$NON-NLS-1$ + + /** + * directory list tag name + */ + public static final String TAG_DIR = "dir"; //$NON-NLS-1$ + + /** + * generic language/style container (div) tag name + */ + public static final String TAG_DIV = "div"; //$NON-NLS-1$ + + /** + * definition list tag name + */ + public static final String TAG_DL = "dl"; //$NON-NLS-1$ + + /** + * definition term tag name + */ + public static final String TAG_DT = "dt"; //$NON-NLS-1$ + + /** + * emphasis tag name + */ + public static final String TAG_EM = "em"; //$NON-NLS-1$ + + /** + * fieldset tag name + */ + public static final String TAG_FIELDSET = "fieldset"; //$NON-NLS-1$ + + /** + * local change to font (font) tag name + */ + public static final String TAG_FONT = "font"; //$NON-NLS-1$ + + /** + * form tag name + */ + public static final String TAG_FORM = "form"; //$NON-NLS-1$ + + /** + * frame tag name + */ + public static final String TAG_FRAME = "frame"; //$NON-NLS-1$ + + /** + * frameset tag name + */ + public static final String TAG_FRAMESET = "frameset"; //$NON-NLS-1$ + + /** + * h1 tag name + */ + public static final String TAG_H1 = "h1"; //$NON-NLS-1$ + + /** + * h2 tag name + */ + public static final String TAG_H2 = "h2"; //$NON-NLS-1$ + + /** + * h3 tag name + */ + public static final String TAG_H3 = "h3"; //$NON-NLS-1$ + + /** + * h4 tag name + */ + public static final String TAG_H4 = "h4"; //$NON-NLS-1$ + + /** + * h5 tag name + */ + public static final String TAG_H5 = "h5"; //$NON-NLS-1$ + + /** + * h6 tag name + */ + public static final String TAG_H6 = "h6"; //$NON-NLS-1$ + + /** + * head tag name + */ + public static final String TAG_HEAD = "head"; //$NON-NLS-1$ + + /** + * horizontal rule tag name + */ + public static final String TAG_HR = "hr"; //$NON-NLS-1$ + + /** + * document root element (html) tag name + */ + public static final String TAG_HTML = "html"; //$NON-NLS-1$ + + /** + * italic text style tag name + */ + public static final String TAG_I = "i"; //$NON-NLS-1$ + + /** + * inline subwindow (iframe) tag name + */ + public static final String TAG_IFRAME = "iframe"; //$NON-NLS-1$ + + /** + * Embedded image tag name + */ + public static final String TAG_IMG = "img"; //$NON-NLS-1$ + + /** + * input tag name + */ + public static final String TAG_INPUT = "input"; //$NON-NLS-1$ + + /** + * inserted text tag name + */ + public static final String TAG_INS = "ins"; //$NON-NLS-1$ + + /** + * isindex tag name + */ + public static final String TAG_ISINDEX = "isindex"; //$NON-NLS-1$ + + /** + * text to be entered by the user tag name + */ + public static final String TAG_KBD = "kbd"; //$NON-NLS-1$ + + /** + * form field label text tag name + */ + public static final String TAG_LABEL = "label"; //$NON-NLS-1$ + + /** + * fieldset legend tag name + */ + public static final String TAG_LEGEND = "legend"; //$NON-NLS-1$ + + /** + * list item tag name + */ + public static final String TAG_LI = "li"; //$NON-NLS-1$ + + /** + * media-independent link tag name + */ + public static final String TAG_LINK = "link"; //$NON-NLS-1$ + + /** + * client-side image map tag name + */ + public static final String TAG_MAP = "map"; //$NON-NLS-1$ + + /** + * menu list tag name + */ + public static final String TAG_MENU = "menu"; //$NON-NLS-1$ + + /** + * generic metainformation tag name + */ + public static final String TAG_META = "meta"; //$NON-NLS-1$ + + /** + * noembed tag name + */ + public static final String TAG_NOEMBED = "noembed"; //$NON-NLS-1$ + + /** + * container for non-frame-based + * rendering (noframes) tag name + */ + public static final String TAG_NOFRAMES = "noframes"; //$NON-NLS-1$ + + // + + /** + * container for non-script-based + * rendering (noscript) tag name + */ + public static final String TAG_NOSCRIPT = "noscript"; //$NON-NLS-1$ + + // + + /** + * generic embedded (object) tag name + */ + public static final String TAG_OBJECT = "object"; //$NON-NLS-1$ + + /** + * ordered list tag name + */ + public static final String TAG_OL = "ol"; //$NON-NLS-1$ + + /** + * option group tag name + */ + public static final String TAG_OPTGROUP = "optgroup"; //$NON-NLS-1$ + + /** + * selectable choice tag name + */ + public static final String TAG_OPTION = "option"; //$NON-NLS-1$ + + /** + * paragraph tag name + */ + public static final String TAG_P = "p"; //$NON-NLS-1$ + + /** + * named property value tag name + */ + public static final String TAG_PARAM = "param"; //$NON-NLS-1$ + + /** + * preformatted text tag name + */ + public static final String TAG_PRE = "pre"; //$NON-NLS-1$ + + /** + * short inline quotation tag name + */ + public static final String TAG_Q = "q"; //$NON-NLS-1$ + + /** + * strike-through text style tag name + */ + public static final String TAG_S = "s"; //$NON-NLS-1$ + + /** + * sample program output tag name + */ + public static final String TAG_SAMP = "samp"; //$NON-NLS-1$ + + // scripts, etc. + + /** + * script statements tag name + */ + public static final String TAG_SCRIPT = "script"; //$NON-NLS-1$ + + /** + * option selector tag name + */ + public static final String TAG_SELECT = "select"; //$NON-NLS-1$ + + /** + * small text style tag name + */ + public static final String TAG_SMALL = "small"; //$NON-NLS-1$ + + /** + * generic language/style tag name + */ + public static final String TAG_SPAN = "span"; //$NON-NLS-1$ + + // container + + /** + * strike-through text tag name + */ + public static final String TAG_STRIKE = "strike"; //$NON-NLS-1$ + + /** + * strong emphasis tag name + */ + public static final String TAG_STRONG = "strong"; //$NON-NLS-1$ + + /** + * style info tag name + */ + public static final String TAG_STYLE = "style"; //$NON-NLS-1$ + + /** + * subscript tag name + */ + public static final String TAG_SUB = "sub"; //$NON-NLS-1$ + + /** + * superscript tag name + */ + public static final String TAG_SUP = "sup"; //$NON-NLS-1$ + + /** + * table tag name + */ + public static final String TAG_TABLE = "table"; //$NON-NLS-1$ + + /** + * table body tag name + */ + public static final String TAG_TBODY = "tbody"; //$NON-NLS-1$ + + /** + * table data cell tag name + */ + public static final String TAG_TD = "td"; //$NON-NLS-1$ + + /** + * multi-line text + */ + public static final String TAG_TEXTAREA = "textarea"; //$NON-NLS-1$ + + // field + + /** + * table footer tag name + */ + public static final String TAG_TFOOT = "tfoot"; //$NON-NLS-1$ + + /** + * table header cell tag name + */ + public static final String TAG_TH = "th"; //$NON-NLS-1$ + + /** + * table header tag name + */ + public static final String TAG_THEAD = "thead"; //$NON-NLS-1$ + + /** + * document title tag name + */ + public static final String TAG_TITLE = "title"; //$NON-NLS-1$ + + /** + * table row tag name + */ + public static final String TAG_TR = "tr"; //$NON-NLS-1$ + + /** + * teletype or monospaced text tag name + */ + public static final String TAG_TT = "tt"; //$NON-NLS-1$ + + // style + + /** + * underlined text style tag name + */ + public static final String TAG_U = "u"; //$NON-NLS-1$ + + /** + * unordered list tag name + */ + public static final String TAG_UL = "ul"; //$NON-NLS-1$ + + /** + * instance of a variable tag name + */ + public static final String TAG_VAR = "var"; //$NON-NLS-1$ + + /** + * Tag identifier for an HTML form tag + */ + public static final TagIdentifier TAG_IDENTIFIER_HTML_FORM = + TagIdentifierFactory.createJSPTagWrapper(CMDocType.HTML_DOC_TYPE, TAG_FORM); + + // program argument + + /** + * abbr attribute + */ + public static final String ATTR_ABBR = "abbr"; //$NON-NLS-1$ + + /** + * accept-charset attribute + */ + public static final String ATTR_ACCEPTCHARSET = "accept-charset"; //$NON-NLS-1$ + + /** + * accept attribute + */ + public static final String ATTR_ACCEPT = "accept"; //$NON-NLS-1$ + + /** + * access key attribute + */ + public static final String ATTR_ACCESSKEY = "accesskey"; //$NON-NLS-1$ + + /** + * action attribute + */ + public static final String ATTR_ACTION = "action"; //$NON-NLS-1$ + + /** + * align attribute + */ + public static final String ATTR_ALIGN = "align"; //$NON-NLS-1$ + + /** + * alink attribute + */ + public static final String ATTR_ALINK = "alink"; //$NON-NLS-1$ + + /** + * alt attribute + */ + public static final String ATTR_ALT = "alt"; //$NON-NLS-1$ + + /** + * archive attribute + */ + public static final String ATTR_ARCHIVE = "archive"; //$NON-NLS-1$ + + /** + * axis attribute + */ + public static final String ATTR_AXIS = "axis"; //$NON-NLS-1$ + + /** + * background attribute + */ + public static final String ATTR_BACKGROUND = "background"; //$NON-NLS-1$ + + /** + * bgcolor attribute + */ + public static final String ATTR_BGCOLOR = "bgcolor"; //$NON-NLS-1$ + + /** + * border attribute + */ + public static final String ATTR_BORDER = "border"; //$NON-NLS-1$ + + /** + * cellpadding attribute + */ + public static final String ATTR_CELLPADDING = "cellpadding"; //$NON-NLS-1$ + + /** + * cellspacing attribute + */ + public static final String ATTR_CELLSPACING = "cellspacing"; //$NON-NLS-1$ + + /** + * char attribute + */ + public static final String ATTR_CHAR = "char"; //$NON-NLS-1$ + + /** + * charoff attribute + */ + public static final String ATTR_CHAROFF = "charoff"; //$NON-NLS-1$ + + /** + * charset attribute + */ + public static final String ATTR_CHARSET = "charset"; //$NON-NLS-1$ + + /** + * checked attribute + */ + public static final String ATTR_CHECKED = "checked"; //$NON-NLS-1$ + + /** + * cite attribute + */ + public static final String ATTR_CITE = "cite"; //$NON-NLS-1$ + + /** + * class attribute + */ + public static final String ATTR_CLASS = "class"; //$NON-NLS-1$ + + /** + * classid attribute + */ + public static final String ATTR_CLASSID = "classid"; //$NON-NLS-1$ + + /** + * clear attribute + */ + public static final String ATTR_CLEAR = "clear"; //$NON-NLS-1$ + + /** + * code attribute + */ + public static final String ATTR_CODE = "code"; //$NON-NLS-1$ + + /** + * codebase attribute + */ + public static final String ATTR_CODEBASE = "codebase"; //$NON-NLS-1$ + + /** + * code type attribute + */ + public static final String ATTR_CODETYPE = "codetype"; //$NON-NLS-1$ + + /** + * color attribute + */ + public static final String ATTR_COLOR = "color"; //$NON-NLS-1$ + + /** + * cols attribute + */ + public static final String ATTR_COLS = "cols"; //$NON-NLS-1$ + + /** + * colspan attribute + */ + public static final String ATTR_COLSPAN = "colspan"; //$NON-NLS-1$ + + /** + * compact attribute + */ + public static final String ATTR_COMPACT = "compact"; //$NON-NLS-1$ + + /** + * content attribute + */ + public static final String ATTR_CONTENT = "content"; //$NON-NLS-1$ + + /** + * coords attribute + */ + public static final String ATTR_COORDS = "coords"; //$NON-NLS-1$ + + /** + * data attribute + */ + public static final String ATTR_DATA = "data"; //$NON-NLS-1$ + + /** + * datetime attribute + */ + public static final String ATTR_DATETIME = "datetime"; //$NON-NLS-1$ + + /** + * declare attribute + */ + public static final String ATTR_DECLARE = "declare"; //$NON-NLS-1$ + + /** + * defer attribute + */ + public static final String ATTR_DEFER = "defer"; //$NON-NLS-1$ + + /** + * dir attribute + */ + public static final String ATTR_DIR = "dir"; //$NON-NLS-1$ + + /** + * disabled attribute + */ + public static final String ATTR_DISABLED = "disabled"; //$NON-NLS-1$ + + /** + * enctype attribute + */ + public static final String ATTR_ENCTYPE = "enctype"; //$NON-NLS-1$ + + /** + * face attribute + */ + public static final String ATTR_FACE = "face"; //$NON-NLS-1$ + + /** + * for attribute + */ + public static final String ATTR_FOR = "for"; //$NON-NLS-1$ + + /** + * frame attribute + */ + public static final String ATTR_FRAME = "frame"; //$NON-NLS-1$ + + /** + * frameborder attribute + */ + public static final String ATTR_FRAMEBORDER = "frameborder"; //$NON-NLS-1$ + + /** + * headers attribute + */ + public static final String ATTR_HEADERS = "headers"; //$NON-NLS-1$ + + /** + * height attribute + */ + public static final String ATTR_HEIGHT = "height"; //$NON-NLS-1$ + + /** + * href attribute + */ + public static final String ATTR_HREF = "href"; //$NON-NLS-1$ + + /** + * hreflang attribute + */ + public static final String ATTR_HREFLANG = "hreflang"; //$NON-NLS-1$ + + /** + * hspace attribute + */ + public static final String ATTR_HSPACE = "hspace"; //$NON-NLS-1$ + + /** + * http-equiv attribute + */ + public static final String ATTR_HTTPEQUIV = "http-equiv"; //$NON-NLS-1$ + + /** + * id attribute + */ + public static final String ATTR_ID = "id"; //$NON-NLS-1$ + + /** + * ismap attribute + */ + public static final String ATTR_ISMAP = "ismap"; //$NON-NLS-1$ + + /** + * label attribute + */ + public static final String ATTR_LABEL = "label"; //$NON-NLS-1$ + + /** + * lang attribute + */ + public static final String ATTR_LANG = "lang"; //$NON-NLS-1$ + + /** + * language attribute + */ + public static final String ATTR_LANGUAGE = "language"; //$NON-NLS-1$ + + /** + * link attribute + */ + public static final String ATTR_LINK = "link"; //$NON-NLS-1$ + + /** + * longdesc attribute + */ + public static final String ATTR_LONGDESC = "longdesc"; //$NON-NLS-1$ + + /** + * marginheight attribute + */ + public static final String ATTR_MARGINHEIGHT = "marginheight"; //$NON-NLS-1$ + + /** + * margin width attribute + */ + public static final String ATTR_MARGINWIDTH = "marginwidth"; //$NON-NLS-1$ + + /** + * maxlength attribute + */ + public static final String ATTR_MAXLENGTH = "maxlength"; //$NON-NLS-1$ + + /** + * media attribute + */ + public static final String ATTR_MEDIA = "media"; //$NON-NLS-1$ + + /** + * method attribute + */ + public static final String ATTR_METHOD = "method"; //$NON-NLS-1$ + + /** + * multiple attribute + */ + public static final String ATTR_MULTIPLE = "multiple"; //$NON-NLS-1$ + + /** + * name attribute + */ + public static final String ATTR_NAME = "name"; //$NON-NLS-1$ + + /** + * nohref attribute + */ + public static final String ATTR_NOHREF = "nohref"; //$NON-NLS-1$ + + /** + * noresize attribute + */ + public static final String ATTR_NORESIZE = "noresize"; //$NON-NLS-1$ + + /** + * noshade attribute + */ + public static final String ATTR_NOSHADE = "noshade"; //$NON-NLS-1$ + + /** + * nowrap attribute + */ + public static final String ATTR_NOWRAP = "nowrap"; //$NON-NLS-1$ + + /** + * object attribute + */ + public static final String ATTR_OBJECT = "object"; //$NON-NLS-1$ + + /** + * onblur attribute + */ + public static final String ATTR_ONBLUR = "onblur"; //$NON-NLS-1$ + + /** + * onchange attribute + */ + public static final String ATTR_ONCHANGE = "onchange"; //$NON-NLS-1$ + + /** + * onclick attribute + */ + public static final String ATTR_ONCLICK = "onclick"; //$NON-NLS-1$ + + /** + * ondblclick attribute + */ + public static final String ATTR_ONDBLCLICK = "ondblclick"; //$NON-NLS-1$ + + /** + * onfocus attribute + */ + public static final String ATTR_ONFOCUS = "onfocus"; //$NON-NLS-1$ + + /** + * onkeydown attribute + */ + public static final String ATTR_ONKEYDOWN = "onkeydown"; //$NON-NLS-1$ + + /** + * onkeypress attribute + */ + public static final String ATTR_ONKEYPRESS = "onkeypress"; //$NON-NLS-1$ + + /** + * onkeyup attribute + */ + public static final String ATTR_ONKEYUP = "onkeyup"; //$NON-NLS-1$ + + /** + * onload attribute + */ + public static final String ATTR_ONLOAD = "onload"; //$NON-NLS-1$ + + /** + * onmousedown attribute + */ + public static final String ATTR_ONMOUSEDOWN = "onmousedown"; //$NON-NLS-1$ + + /** + * onmousemove attribute + */ + public static final String ATTR_ONMOUSEMOVE = "onmousemove"; //$NON-NLS-1$ + + /** + * onmouseout attribute + */ + public static final String ATTR_ONMOUSEOUT = "onmouseout"; //$NON-NLS-1$ + + /** + * onmouseover attribute + */ + public static final String ATTR_ONMOUSEOVER = "onmouseover"; //$NON-NLS-1$ + + /** + * onmouseup attribute + */ + public static final String ATTR_ONMOUSEUP = "onmouseup"; //$NON-NLS-1$ + + /** + * onreset attribute + */ + public static final String ATTR_ONRESET = "onreset"; //$NON-NLS-1$ + + /** + * onselect attribute + */ + public static final String ATTR_ONSELECT = "onselect"; //$NON-NLS-1$ + + /** + * onsubmit attribute + */ + public static final String ATTR_ONSUBMIT = "onsubmit"; //$NON-NLS-1$ + + /** + * onunload attribute + */ + public static final String ATTR_ONUNLOAD = "onunload"; //$NON-NLS-1$ + + /** + * profile attribute + */ + public static final String ATTR_PROFILE = "profile"; //$NON-NLS-1$ + + /** + * prompt attribute + */ + public static final String ATTR_PROMPT = "prompt"; //$NON-NLS-1$ + + /** + * readonly attribute + */ + public static final String ATTR_READONLY = "readonly"; //$NON-NLS-1$ + + /** + * rel attribute + */ + public static final String ATTR_REL = "rel"; //$NON-NLS-1$ + + /** + * rev attribute + */ + public static final String ATTR_REV = "rev"; //$NON-NLS-1$ + + /** + * rows attribute + */ + public static final String ATTR_ROWS = "rows"; //$NON-NLS-1$ + + /** + * rowspan attribute + */ + public static final String ATTR_ROWSPAN = "rowspan"; //$NON-NLS-1$ + + /** + * rules attribute + */ + public static final String ATTR_RULES = "rules"; //$NON-NLS-1$ + + /** + * scheme attribute + */ + public static final String ATTR_SCHEME = "scheme"; //$NON-NLS-1$ + + /** + * scope attribute + */ + public static final String ATTR_SCOPE = "scope"; //$NON-NLS-1$ + + /** + * scrolling attribute + */ + public static final String ATTR_SCROLLING = "scrolling"; //$NON-NLS-1$ + + /** + * selected attribute + */ + public static final String ATTR_SELECTED = "selected"; //$NON-NLS-1$ + + /** + * shape attribute + */ + public static final String ATTR_SHAPE = "shape"; //$NON-NLS-1$ + + /** + * size attribute + */ + public static final String ATTR_SIZE = "size"; //$NON-NLS-1$ + + /** + * span attribute + */ + public static final String ATTR_SPAN = "span"; //$NON-NLS-1$ + + /** + * src attribute + */ + public static final String ATTR_SRC = "src"; //$NON-NLS-1$ + + /** + * standby attribute + */ + public static final String ATTR_STANDBY = "standby"; //$NON-NLS-1$ + + /** + * start attribute + */ + public static final String ATTR_START = "start"; //$NON-NLS-1$ + + /** + * style attribute + */ + public static final String ATTR_STYLE = "style"; //$NON-NLS-1$ + + /** + * summary attribute + */ + public static final String ATTR_SUMMARY = "summary"; //$NON-NLS-1$ + + /** + * tabindex attribute + */ + public static final String ATTR_TABINDEX = "tabindex"; //$NON-NLS-1$ + + /** + * target attribute + */ + public static final String ATTR_TARGET = "target"; //$NON-NLS-1$ + + /** + * text attribute + */ + public static final String ATTR_TEXT = "text"; //$NON-NLS-1$ + + /** + * title attribute + */ + public static final String ATTR_TITLE = "title"; //$NON-NLS-1$ + + /** + * type attribute + */ + public static final String ATTR_TYPE = "type"; //$NON-NLS-1$ + + /** + * usemap attribute + */ + public static final String ATTR_USEMAP = "usemap"; //$NON-NLS-1$ + + /** + * valign attribute + */ + public static final String ATTR_VALIGN = "valign"; //$NON-NLS-1$ + + /** + * value attribute + */ + public static final String ATTR_VALUE = "value"; //$NON-NLS-1$ + + /** + * valuetype attribute + */ + public static final String ATTR_VALUETYPE = "valuetype"; //$NON-NLS-1$ + + /** + * version attribute + */ + public static final String ATTR_VERSION = "version"; //$NON-NLS-1$ + + /** + * vlink attribute + */ + public static final String ATTR_VLINK = "vlink"; //$NON-NLS-1$ + + /** + * vspace attribute + */ + public static final String ATTR_VSPACE = "vspace"; //$NON-NLS-1$ + + /** + * width attribute + */ + public static final String ATTR_WIDTH = "width"; //$NON-NLS-1$ + + /** + * submit type + */ + public static final String TYPE_SUBMIT = "submit"; //$NON-NLS-1$ + + /** + * checkbox type + */ + public static final String TYPE_CHECKBOX = "checkbox"; //$NON-NLS-1$ + + /** + * radio type + */ + public static final String TYPE_RADIO = "radio"; //$NON-NLS-1$ + + /** + * image type + */ + public static final String TYPE_IMAGE = "image"; //$NON-NLS-1$ + + /** + * password type + */ + public static final String TYPE_PASSWORD = "password"; //$NON-NLS-1$ + + /** + * text type + */ + public static final String TYPE_TEXT = "text"; //$NON-NLS-1$ + + /** + * hidden type + */ + public static final String TYPE_HIDDEN = "hidden"; //$NON-NLS-1$ + + /** + * submit query label + */ + public static final String SUBMIT_LABEL = "Submit Query"; //$NON-NLS-1$ + + /** + * reset label + */ + public static final String RESET_LABEL = "Reset"; //$NON-NLS-1$ +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/IJMTConstants.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/IJMTConstants.java new file mode 100755 index 0000000..acba1a7 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/IJMTConstants.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner; + +/** + * JMT constants that would be used through the JMT core plugin. + * + * @author mengbo + */ +public interface IJMTConstants { + /** + * bundle file name + */ + public static final String PAGEDESIGNER_RESOURCE_BUNDLE_FILE = "org.eclipse.jst.pagedesigner.editors.pagedesigner.JSPEditorMessages"; //$NON-NLS-1$ + + // Properties contains general properties and defaults to preferences. + /** + * root resource bundle name + */ + public static final String ROOT_RESOURCEBUNDLE = "org.eclipse.jst.pagedesigner.JMTResources"; //$NON-NLS-1$ + + /** + * default property file name + */ + public static final String DEFAULT_PROPERTIES = "default.properties"; //$NON-NLS-1$ + + /** + * default style sheet + */ + public static final String USERAGENT = "html4.css"; //$NON-NLS-1$ + + /** + * html editor id + */ + public static final String EDITORID_HTML = "org.eclipse.jst.pagedesigner.PageDesignerEditor"; //$NON-NLS-1$ + + /** + * show all action preference id + */ + public static final String PREF_PALETTE_SHOW_ALL = "pref.palette.showall"; //$NON-NLS-1$ + + /** + * local name of page designer extension + */ + public static final String EXTENSION_POINT_PAGEDESIGNER = "pageDesignerExtension"; //$NON-NLS-1$ + + /** + * local name of cm registry extension + */ + public static final String EXTENSION_POINT_CMREGISTRY = "cmRegistry"; //$NON-NLS-1$ + + /** + * local name of DT resource provider extension + */ + public static final String DT_RESOURCE_PROVIDER = "dtResourceProvider"; //$NON-NLS-1$ + + /** + * local name of local drop handler extension + */ + public static final String LOCAL_DROP_HANDLER = "localDropHandler"; //$NON-NLS-1$ + + /** + * local name of tag converter factory extension + */ + public static final String TAG_CONVERTER_FACTORY = "tagConverterFactory"; //$NON-NLS-1$ + + /** + * local name of attribute cell editor factory extension + * @deprecated and unused + */ + public static final String ATTRIBUTE_CELLEDITOR_FACTORY = "attributeCellEditorFactory"; //$NON-NLS-1$ + + /** + * local name of tag attribute cell editor factory extension + */ + public static final String TAG_ATTRIBUTE_CELLEDITOR_FACTORY = "tagAttributeCellEditorFactory"; //$NON-NLS-1$ + + /** + * local name of tag transform operation extension + */ + public static final String TAG_TRANSFORM_OPERATION = "tagTransformOperation"; //$NON-NLS-1$ + + /** + * + * local name of element edit factory extension + */ + public static final String ELEMENT_EDIT_FACTORY = "elementEditFactory"; //$NON-NLS-1$ + + /** + * local name of link creator extension + */ + public static final String LINK_CREATOR = "linkCreator"; //$NON-NLS-1$ + + /** + * extension for property page factory + */ + public static final String PROPERTY_PAGE_FACTORY = "propertyPageFactory"; //$NON-NLS-1$ + /** + * extension for palette viewer page factory + */ + public static final String PALETTE_FACTORY = "paletteFactory"; //$NON-NLS-1$ + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/JMTResources.properties b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/JMTResources.properties new file mode 100755 index 0000000..9c99446 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/JMTResources.properties @@ -0,0 +1,258 @@ +############################################################################### +# Copyright (c) 2001, 2008 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 +############################################################################### +#################################################### +# Resource message for Logging +#################################################### +Log.Error.PageDesignerResources.Open=Error occurred getting the source bundle. +Log.Error.MessageFormater.Format0=Error in message format. +Log.Error.ExtensionReader.ReadLinkExtension=can't create linkCreator instance +Log.Error.PreviewResources.ResouceNotFound=resource {0} not found + +Error.StringBufferWriter.Write.0=Error in string buffer writing. +Error.RangeModeCommand.SetSelection=Selection error +Error.SourceViewerCommand.Execution=Error in command execution +Error.PDPlugin.Installation.0=Error starting plug-in. +Error.PDPlugin.Installation.1=Problems starting plug-in Web Application Development. +Error.PDPlugin.Installation.6=Problems starting plug-in Web Application Development. +Error.DesignerPropertyTool.NatureQuerying=Error in project Java nature querying. +Error.PDPlugin.Installation.10=log.PDPlugin.image.error +Error.PDPlugin.Installation.13=log.PDPlugin.image.error +Error.PDPlugin.Installation.15=error in installtion query. +Error.ProjectResolver.GetlocationByURI.0=Error in taglib locating. +Error.ProjectFileDialogContentProvider.0=Core error, you may need to restart the application. +Error.EditValidateUtil.Position = Error in position validation. +Error.EditValidateUtil.Text = Error occurred in text validation. +Error.EditValidateUtil.Node = Error occurred in node validation. +Error.EditValidateUtil.Range = Error occurred in range validation. +Error.EditValidateUtil.StringIndex = Invalid string. +Error.EditValidateUtil.IndexOffset = Invalid index or offset of string. +CSSColorConverter.0=Error in color expression: +CSSColorConverter.1=Error in color expression: +Error.CSSFigure.0=Error in flowContext setting. +Error.CSSUtil.0=Could not cast to CSS style +Error.CSSUtil.1=Could not cast to CSS style +Error.CSSUtil.2=Could not cast to CSS style +Error.CSSUtil.3=Could not cast to CSS style +Error.HTMLEditor.0= +Error.HTMLEditor.1=Error occurred getting storage contents +Error.HTMLEditor.2=Error occurred closing content. +Error.HTMLEditor.3=The core has exception +Error.HTMLEditor.4=Error occurred closing stream. +Error.HTMLEditor.5=Error occurred initializing the editor. +Error.HTMLEditor.6=Error occurred changing the page. +Error.FontSizeMeta.0=Error occurred in tag font attribute calculating. +Error.EditModelQuery.0=Error in position creation: +Error.EditModelQuery.1=Error occurred getting node at indexed position +Error.CommonResourceDialog.0.1=Error in project memeber querying +Error.CommonResourceDialog.0.2=Please refer to error log for details +Error.ImgFileFilter.1=CoreException is thrown, please refer to error log for details +Error.ImgFileFilter.3=CoreException is thrown, please refer to error log for details +Error.ImgFileFilter.0=Error in filtering the tree +Error.ImgFileFilter.2=Error in getting project Nature +Info.FontWeightMeta.0=Error occurred in integer processing. +Warn.PolicyHelper.0=cannot get status line manager +Warn.PolicyHelper.1=viewer is not HTML viewer +HTMLSpecialCharHelper.3=Exception thrown +HTMLSpecialCharHelper.2=Truncated & without ; +HTMLSpecialCharHelper.1=Not an entity and not a &\#XXXX; +HTMLSpecialCharHelper.0=Error in number expression + +#################################################### +# Resource message for RenderingTraverser +#################################################### +RenderingTraverser.Error.FileNotFound = File Not Found +RenderingTraverser.Error.UnsupportedEncoding = Unsupport Encoding +RenderingTraverser.Error.IO = IO exception + +PaletteItemManager.error=error in constructor +PaletteItemManager.initForPluginExtension.error.IOException=IOExcetpion in initForPluginExtension error +PaletteItemManager.initForPluginExtension.error.MalformedURLException=MalformedURLException in initForPluginExtension +PaletteItemManager.initForPluginExtension.error.InstantiationException=InstantiationException in initForPluginExtension +PaletteItemManager.save.error.IOException=IOException when save +ParagraphSupport.CommandLabel.Preformated=Preformated +PaletteItemManager.loadPaletteItemState.error.IOException=IOException in loadPaletteItemState +PaletteItemManager.loadPaletteItemState.error.SAXException=SAXException in loadPaletteItemState +PaletteItemManager.loadPaletteItemState.error.getDocumentBuilderFail=getDocumentBuilder Failed + +PreviewUtil.previewFile.CoreException= CoreException previewing file +PreviewUtil.previewFile.IOException= IOException previewing file + +#context menu +ActionGroup.Submenu.TextStyle=Text Style +ActionGroup.Submenu.Align=Align +ActionGroup.Submenu.ParagraphFormat=Paragraph Format +ActionGroup.Submenu.StyleClasses=Style Classes +ActionGroup.Submenu.BorderStyle=Border Style +ActionGroup.Submenu.Color=Color +ActionGroup.Submenu.BackgroundColor=Background Color +ActionGroup.Submenu.Link=Make Link... +ActionGroup.Submenu.SelectRelative=Select Relative + +TableActionGroup.Submenu.SelectTable=Select Table +TableActionGroup.Submenu.InsertRowBefore=Insert Row Before +TableActionGroup.Submenu.InsertRowAfter=Insert Row After +TableActionGroup.Submenu.InsertColumnBefore=Insert Column Before +TableActionGroup.Submenu.InsertColumnAfter=Insert Column After +TableActionGroup.Submenu.DeleteRow=Delete Row +TableActionGroup.Submenu.DeleteColumn=Delete Column +ElementEdit.Submenu.Table=Table +ElementEdit.Submenu.SelectTable=Select Table +ElementEdit.Submenu.InsertRowBefore=Insert Row Before +ElementEdit.Submenu.InsertRowAfter=Insert Row After +ElementEdit.Submenu.InsertColumnBefore=Insert Column Before +ElementEdit.Submenu.InsertColumnAfter=Insert Column After +ElementEdit.Submenu.DeleteRow=Delete Row +ElementEdit.Submenu.DeleteColumn=Delete Column +ElementEdit.Submenu.InsertHeader=Insert Header +ElementEdit.Submenu.InsertFooter=Insert Footer +ElementEdit.Submenu.DeleteHeader=Delete Header +ElementEdit.Submenu.DeleteFooter=Delete Footer +ElementEdit.Submenu.Taglib=Open Definition File +TableInsertHeaderFooterCommand.ColumnHeader=Column Header +TableInsertHeaderFooterCommand.ColumnFooter=Column Footer + +HeadElementEdit.Submenu.InsertStylesheetLink=Stylesheet Link + +Action.Name.Copy=Copy +Action.Name.Cut=Cut +Action.Name.Paste=Paste + +Message.Warning.Title=Warning +Taglib.OpenFile.ERROR=The file that the URI refers to does not exist. + +MakeLinkAction.Wizard.PageTitle=Please select link type +CreateLinkWizard.Title=Select Link Type +LinkWizardPage.GroupTitle=Link Types +LinkWizardPage.PreviewLabel=Preview + +ItemCreationEditPolicy.CommandLabel.CreateItem=Create Item +MakeLinkCommand.Label.MakeLink=Make Link +AttributePropertySource.CommandLabel.ChangeAttribute=Change Attribute +ChangeAttributeAction.CommandLabel.ChangeStyleClass=Change Style Class +BorderStyleSupport.CommandLabel.Hidden=Hidden +BorderStyleSupport.CommandLabel.Dotted=Dotted +BorderStyleSupport.CommandLabel.Dashed=Dashed +BorderStyleSupport.CommandLabel.Solid=Solid +BorderStyleSupport.CommandLabel.Double=Double +BorderStyleSupport.CommandLabel.Groove=Groove +BorderStyleSupport.CommandLabel.Ridge=Ridge +BorderStyleSupport.CommandLabel.Inset=Inset +BorderStyleSupport.CommandLabel.Outset=Outset +ColorSupport.CommandLabel.Aqua=Aqua +ColorSupport.CommandLabel.Black=Black +ColorSupport.CommandLabel.Blue=Blue +ColorSupport.CommandLabel.Fuchsia=Fuchsia +ColorSupport.CommandLabel.Gray=Gray +ColorSupport.CommandLabel.Green=Green +ColorSupport.CommandLabel.Lime=Lime +ColorSupport.CommandLabel.Maroon=Maroon +ColorSupport.CommandLabel.Navy=Navy +ColorSupport.CommandLabel.Olive=Olive +ColorSupport.CommandLabel.Orange=Orange +ColorSupport.CommandLabel.Purple=Purple +ColorSupport.CommandLabel.Red=Red +ColorSupport.CommandLabel.Silver=Silver +ColorSupport.CommandLabel.Teal=Teal +ColorSupport.CommandLabel.White=White +ColorSupport.CommandLabel.Yellow=Yellow +ColorSupport.CommandLabel.Default=Default +ParagraphSupport.CommandLabel.None=None +ParagraphSupport.CommandLabel.Paragraph=Paragraph +ParagraphSupport.CommandLabel.Heading1=Heading 1 +ParagraphSupport.CommandLabel.Heading2=Heading 2 +ParagraphSupport.CommandLabel.Heading3=Heading 3 +ParagraphSupport.CommandLabel.Heading4=Heading 4 +ParagraphSupport.CommandLabel.Heading5=Heading 5 +ParagraphSupport.CommandLabel.Heading6=Heading 6 +ParagraphSupport.CommandLabel.P=P +ParagraphSupport.CommandLabel.H1=H1 +ParagraphSupport.CommandLabel.H2=H2 +ParagraphSupport.CommandLabel.H3=H3 +ParagraphSupport.CommandLabel.H4=H4 +ParagraphSupport.CommandLabel.H5=H5 +ParagraphSupport.CommandLabel.H6=H6 +ParagraphSupport.CommandLabel.PRE=PRE +HTagsInsertGroupAction.ActionLabel.Hx=Hx +RangeStyleSupport.ActionLabel.Bold=Bold +RangeStyleSupport.ActionLabel.Italic=Italic +RangeStyleSupport.ActionLabel.Underline=Underline +ShowAllAction.ActionLabel.ShowAll=Show All +AlignSupport.ActionLabel.Left=Left +AlignSupport.ActionLabel.Center=Center +AlignSupport.ActionLabel.Right=Right +AlignSupport.ActionLabel.Justify=Justify + +Info.ElementDescReader.ReadPropertyFile=The property file:{0} is not found +Info.ElementDescReader.ReadPropertyFile.Key=The key:{0} is not found in file:{1} +ChangeStyleAction.Text=Edit Style... + +Log.Error.HTMLStringTagConverter.Error=Error +ConverterUtil.Description= Drag and drop Web page content here + +SimpleGraphicalEditor.help.id=org.eclipse.jst.pagedesigner.graphicalEditor +DesignerTabbedPropertySheetPage.help.id=org.eclipse.jst.pagedesigner.QuickEditor +MyPropertySheetPage.help.id=org.eclipse.jst.pagedesigner.Attributes +StyleDialog.help.id=org.eclipse.jst.pagedesigner.styleDialog +DesignerPaletteViewerProvider.help.id=org.eclipse.jst.pagedesigner.palette_help + +StyleClassSupport.Default=Default +XMLUtil.Error.0=Error in create documentBuilder: +XMLUtil.Error.2=Error in object persistance: +PreviewUtil.Error.0=Error occurred processing the resource bundle: +PreviewUtil.Error.3=Error occurred opening the file: +PreviewHandlerNew.Error.0=Error in model release: +PreviewConvertContext.Error.0=Error: +CellEditorFactoryRegistry.Info.2=Error in fields retrieving: +CellEditorFactoryRegistry.Info.3=Error in fields retrieving: +PageExpressionContext.Info.0=Error: +TextLayoutSupport.Info.1=Error in text painting: + +CMRegistry.ReadConfigration=Reading Properties Configurations +CMRegistry.HTMLConfigration=Reading HTML Configuration ... +CMRegistry.JSPConfigration=Reading JSP Configuration ... +CMRegistry.OtherConfigration=Reading Other Configuration ... + +HTMLEditor.Design=Design +HTMLEditor.Source=Source + +LocalSelectionDropTargetListener.MessageDialog.Title=Info +LocalSelectionDropTargetListener.MessageDialog.Message=The page is deleted, save it first. + +LoadBundleTagConverter.convertRefresh.MalformedURLException= MalformedURLException in LoadBundleTagConverter +LoadBundleTagConverter.convertRefresh.IOException= IOException in LoadBundleTagConverter + +Warning.TransformOperationFactory.ExtensionNotFound=ITransformOperation id not found in pageDesigner extension registry ("{0}") +Warning.TransformOperationFactory.CannotLoadOpClass=Unable to load tag transform operation Class for id ("{0}") +Warning.TransformOperationFactory.ClassNotFound=ITransformOperation class specified by name in metadata not found ("{0}") +Warning.TransformOperationFactory.IllegalAccess=ITransformOperation class specified by name in metadata could not be legally accessed ("{0}") +Warning.TransformOperationFactory.Instantiation=ITransformOperation class specified by name in metadata could not be instantiated ("{0}") +Warning.TransformOperationFactory.NotAbstractTransformOperation=ITransformOperation class specified by name in metadata does not extend AbstractTransformOperation ("{0}") +Warning.TransformOperationFactory.UnknownOperationID=Unknown operation ID specified in metadata ("{0}") +Warning.TransformOperationFactory.TooFewParameters=Too few parameters specified in metadata for operation ("{0}") +Warning.TransformOperationFactory.RegistryError=Unable to read "{0}" extension registry + +Warning.DTResourceProviderFactory.RegistryError=Unable to read "{0}" extension registry +Warning.DTResourceProviderFactory.ClassNotFound=DT resource provider class "{0}" specified for id "{1}" could not be found + +Warning.ProviderClassMap.IllegalAccess=DT resource provider class "{0}" specified for id "{1}" could not be legally accessed +Warning.ProviderClassMap.Instantiation=DT resource provider class "{0}" specified for id "{1}" could not be instantiated +Warning.ProviderClassMap.NotIDTResourceProvider=DT resource provider class "{0}" is not correct type (must be IDTResourceProvider) + +Warning.DefaultDTSkin.FailureLoadingStyleSheet=DefaultDTSkin "{0}" failed to load a StyleSheet for the URL "{1}" + +#Errors relating to ITagCreator et al. +Error.TagCreatorMustBeOfType=ITagCreator instances must be of type {0}. +Error.ProblemLoadingExtensionPoint=Problem loading ITagCreatorFactory extension Point +Error.ProblemLoadingTagCreatorFactory=Problem loading tag creator factory: {0} +Error.ProblemLoadingExecutingTagCreator=Problem executing tag creator: {0} + +#Property Sheet +QuickEditTab.no_quick_edit_md=No quick edit properties are available for the current selection \ No newline at end of file diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/PDPlugin.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/PDPlugin.java new file mode 100755 index 0000000..9015a4f --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/PDPlugin.java @@ -0,0 +1,456 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.MissingResourceException; +import java.util.Properties; +import java.util.ResourceBundle; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.ILog; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.jst.jsf.common.ui.internal.guiutils.Alerts; +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The main plugin class to be used in the desktop. + */ +public class PDPlugin extends AbstractUIPlugin { + private static final String ICONS_LIB_PATH = "icons"; //$NON-NLS-1$ + + //private static final boolean ROOT_PLUGIN = false; + + // The shared instance. + private static PDPlugin _plugin; + + private static Logger _log; + + private static Alerts _alerts; + + private ResourceBundle _resourceBundle; + + private Properties _properties; + + private URL _pluginBase; + + /** + * The constructor. + */ + public PDPlugin() { + super(); + _plugin = this; + } + + /** + * This method is called upon plug-in activation + */ + public void start(BundleContext context) throws Exception { + super.start(context); + + try { + // get resource bundle. + _resourceBundle = ResourceBundle + .getBundle(IJMTConstants.ROOT_RESOURCEBUNDLE); + _alerts = new Alerts(this, _resourceBundle); + + // get properties. + _properties = new Properties(); + InputStream input = null; + _pluginBase = getBundle().getEntry("/"); //$NON-NLS-1$ + try { + input = (new URL(_pluginBase, IJMTConstants.DEFAULT_PROPERTIES)) + .openStream(); + _properties.load(input); + } finally { + try { + input.close(); + } catch (IOException ee)// NOPMD + { + // nothing to do when IOException throwed in closing files. + } + } + + // set up logging for this plugin and everthing under it. + _log = new Logger(this.getBundle(), _resourceBundle); + + // NOTE: add in any other plugin code statup HERE!!!! + + // log.CommonPlugin=Web Application Development Common Plugin + // initialized on eclipse version {0}. + + // log.info("log.CommonPlugin", version); + + } catch (Exception ee) { + // only log if the logger was configured correctly. + if (_log != null) { + _log + .error( + "log.msg", //$NON-NLS-1$ + "Problems starting plug-in Web Application Development Common.", //$NON-NLS-1$ + ee); + } + + throw new CoreException( + new Status( + IStatus.ERROR, + getBundle().getSymbolicName(), + IStatus.OK, + "Problems starting plug-in Web Application Development Common", //$NON-NLS-1$ + ee)); + } + } + + /** + * Returns the shared instance. + * @return the default plugin + */ + public static PDPlugin getDefault() { + return _plugin; + } + + /** + * get the alerts objects associated with this plugin for alerting the user. + * + * @return the Alerts object + */ + public static Alerts getAlerts() { + return _alerts; + } + + /** + * Returns a logger for the new class using this plugin for reference. + * @param theClass + * @return the Logger object associated with theClass + */ + public static Logger getLogger(Class theClass) { + if (getDefault() != null && getDefault().getRootLogger() != null) { + return getDefault().getRootLogger(); + } + return null; + } + + /** + * Returns the plugin's root logger + * @return the root logger + */ + public Logger getRootLogger() { + return _log; + } + + /** + * Returns this plugin's unique identifier + * @return the plugin id + */ + public static String getPluginId() { + return getDefault().getBundle().getSymbolicName(); + } + + /** + * @return the plugin's resource bundle + */ + public ResourceBundle getResourceBundle() { + return _resourceBundle; + } + + /** + * @param key + * @return the string from the plugin's resource bundle, or 'key' if not + * found. + */ + public static String getResourceString(String key) { + ResourceBundle bundle = PDPlugin.getDefault().getResourceBundle(); + try { + return (bundle != null) ? bundle.getString(key) : key; + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + /** + * @return the plugin's descriptor's resource bundle, + */ + public ResourceBundle getPluginDecriptorBundle() { + return Platform.getResourceBundle(getDefault().getBundle()); + } + + /** + * @return the plugin's default properties. These are normally used for + * default preferences. + */ + public Properties getProperties() { + return _properties; + } + + /** + * @return the standard display to be used. The method first checks, if the + * thread calling this method has an associated dispaly. If so, this display + * is returned. Otherwise the method returns the default display. + */ + public static Display getStandardDisplay() { + Display display; + display = Display.getCurrent(); + if (display == null) { + display = Display.getDefault(); + } + return display; + } + + /** + * @return the workspace instance. + */ + public static IWorkspace getWorkspace() { + return ResourcesPlugin.getWorkspace(); + } + + /** + * Returns a shared image for the given name. Image must exist in icons folder of pagedesigner plugin. + *

+ * Note: Images returned from this method will be automitically disposed of + * when this plug-in shuts down. Callers must not dispose of these images + * themselves. + *

+ * + * @param name + * the image name found in /icons (with extension) + * @return the image, null on error or not found. + */ + public Image getImage(String name) { + if (name == null) { + return null; + } + + ImageRegistry images = getImageRegistry(); + Image image = images.get(name); + if (image == null) { + getImageDescriptor(name); + image = images.get(name); + } + return image; + } + + /** + * Returns a shared ImageDescriptor for the given name + *

+ * Note: ImageDescriptor returned from this method will be automatically + * disposed of when this plug-in shuts down. Callers must not dispose of + * these ImageDescriptor themselves. + *

+ * + * @param name + * the ImageDescriptor name found in /icons (with extension) + * @return the ImageDescriptor, null on error or not found. + */ + public ImageDescriptor getImageDescriptor(String name) { + if (name == null) { + return null; + } + + ImageRegistry images = getImageRegistry(); + ImageDescriptor id = images.getDescriptor(name); + if (id == null) { + InputStream stream = null; + try {//check existance of file + URL url = new URL(_pluginBase, + ICONS_LIB_PATH + "/" + name); //$NON-NLS-1$ + + //doing the following to check existance... exception will be caught and null descriptor returned + stream = url.openStream(); + stream.close(); + + id = ImageDescriptor.createFromURL(url); + images.put(name, id); + } catch (IOException e1) { + _log.info("Unable to create ImageDescriptor for: "+name, e1); //$NON-NLS-1$ + return null; + } + } + return id; + } + + /** + * Read a file resource. The file should contain any partial path and the + * filename from the plugin base. The caller is responsible for closing the + * file. + * @param file + * @return the input stream for the file + * @throws MalformedURLException + * @throws IOException + */ + public InputStream readFile(String file) throws MalformedURLException, + IOException { + return (new URL(_pluginBase, file)).openStream(); + } + + /** + * @param file + * @return the File associate with the name 'file' + * @throws MalformedURLException + * @throws IOException + */ + public File getFile(String file) throws MalformedURLException, IOException { + return new File((new URL(_pluginBase, file)).getPath()); + } + + /** + * @return the plugin's install location with the leading "/" removed + * and normalized to the the os string. + */ + public static Path getInstallLocation() { + try { + URL url = getDefault().getBundle().getEntry("/"); //$NON-NLS-1$ + String s1 = FileLocator.resolve(url).getFile(); + if (s1.startsWith("/")) //$NON-NLS-1$ + { + s1 = s1.substring(1); + } + s1 = (new Path(s1)).toOSString(); + String s; + if (s1.endsWith(File.separator)) { + s = s1; + } else { + s = s1 + File.separator; + } + return new Path(s); + } catch (Exception exception) { + _log.error("Error.PDPlugin.Installation.15", exception); //$NON-NLS-1$ + return null; + } + } + + /** + * Returns the active workbench window. + * + * @return the active workbench window. this can be null but I've never seen + * it. + */ + public static IWorkbenchWindow getActiveWorkbenchWindow() { + if (getDefault().getWorkbench() == null) { + return null; + } + return getDefault().getWorkbench().getActiveWorkbenchWindow(); + } + + /** + * Returns the active workbench page. Note that the active page may not be + * the one that the user perceives as active in some situations so this + * method of obtaining the activate page should only be used if no other + * method is available. + * + * @return the active workbench page + */ + public static IWorkbenchPage getActivePage() { + IWorkbenchWindow window = getActiveWorkbenchWindow(); + if (window == null) { + return null; + } + return window.getActivePage(); + } + + /** + * Initializes the preference controls to the default values. These values + * are used the first time the preference page is displayed or when the user + * presses the Defaults button in the preferences page. + */ + protected void initializeDefaultPreferences(IPreferenceStore store) { + // initialize any preferences for this plugin. + } + + /** + * @return the active workbench Shell. Used for some funciton need IShell + * Parameter. + */ + public static Shell getActiveWorkbenchShell() { + IWorkbenchWindow window = getActiveWorkbenchWindow(); + if (window != null) { + return window.getShell(); + } + IWorkbenchWindow[] windows = getDefault().getWorkbench() + .getWorkbenchWindows(); + if (windows.length > 0) { + return windows[0].getShell(); + } + return null; + } + + /** + * @return the active display. + */ + public static Display getDisplay() { + Shell shell = getActiveWorkbenchShell(); + if (shell != null) { + return shell.getDisplay(); + } + return Display.getDefault(); + } + + /** + * @return current active project. + */ + public static IProject getCurrentProject() { + IProject curProject = null; + IEditorPart editor = PDPlugin.getDefault().getWorkbench() + .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + IEditorInput input = editor.getEditorInput(); + IFile inputFile = null; + if (input instanceof IFileEditorInput) { + inputFile = ((IFileEditorInput) input).getFile(); + curProject = inputFile.getProject(); + } + return curProject; + } + + /** + * Log status using the default plugin logger + * @param status + */ + public static void log(IStatus status) + { + ILog log = getDefault().getLog(); + log.log(status); + } + + /** + * @param message + * @param excp + */ + public static void log(String message, Throwable excp) + { + Status status = new Status(IStatus.ERROR, getPluginId(), message, excp); + log(status); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/PageDesignerTraceOptions.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/PageDesignerTraceOptions.java new file mode 100755 index 0000000..698d75d --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/PageDesignerTraceOptions.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * Copyright (c) 2001, 2008 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 + *******************************************************************************/ +package org.eclipse.jst.pagedesigner; + +import org.eclipse.osgi.framework.debug.FrameworkDebugOptions; +import org.eclipse.osgi.service.debug.DebugOptions; + +/** + * Defines that standard runtime trace options for debugging. See .options file + * for definitions. + * + * NOT API + * + * @author cbateman + * + */ +public final class PageDesignerTraceOptions +{ + /** + * True if debug tracing is enabled. Other tracing cannot be enabled unless + * this is enabled. + */ + public static final boolean ENABLED; + + /** + * True if tag converter ext load tracing is enabled + */ + public static final boolean TRACE_CONVERTERLOAD; + /** + * True if tag converter selection tracing is enabled + */ + public static final boolean TRACE_CONVERTERSELECT; + /** + * True if tag element edit ext load tracing is enabled + */ + public static final boolean TRACE_ELEMENTEDITLOAD; + /** + * True if tag element edit selection tracing is enabled + */ + public static final boolean TRACE_ELEMENTEDITSELECTION; + + private static final String KEY_DEBUG_ENABLED = "/debug"; //$NON-NLS-1$ + private static final String KEY_CONVERTER = KEY_DEBUG_ENABLED+"/converter"; //$NON-NLS-1$ + private static final String KEY_CONVERTER_LOAD = KEY_CONVERTER + "/load"; //$NON-NLS-1$ + private static final String KEY_CONVERTER_SELECTION = KEY_CONVERTER + "/selection"; //$NON-NLS-1$ + + private static final String KEY_ELEMENTEDIT = KEY_DEBUG_ENABLED+"/elementedit"; //$NON-NLS-1$ + private static final String KEY_ELEMENTEDIT_LOAD = KEY_ELEMENTEDIT + "/load"; //$NON-NLS-1$ + private static final String KEY_ELEMENTEDIT_SELECTION = KEY_ELEMENTEDIT + "/selection"; //$NON-NLS-1$ + + + static + { + final DebugOptions debugOptions = FrameworkDebugOptions.getDefault(); + final String pluginId = PDPlugin.getPluginId(); + ENABLED = debugOptions != null + && debugOptions.getBooleanOption(pluginId + + KEY_DEBUG_ENABLED, false); + + if (ENABLED) + { + TRACE_CONVERTERLOAD = debugOptions.getBooleanOption( + pluginId + KEY_CONVERTER_LOAD, false); + TRACE_CONVERTERSELECT = debugOptions.getBooleanOption( + pluginId + KEY_CONVERTER_SELECTION, false); + TRACE_ELEMENTEDITLOAD = debugOptions.getBooleanOption( + pluginId + KEY_ELEMENTEDIT_LOAD, false); + TRACE_ELEMENTEDITSELECTION = debugOptions.getBooleanOption( + pluginId + KEY_ELEMENTEDIT_SELECTION, false); + } + else + { + TRACE_CONVERTERLOAD = false; + TRACE_CONVERTERSELECT = false; + TRACE_ELEMENTEDITLOAD = false; + TRACE_ELEMENTEDITSELECTION = false; + } + } + + /** + * @param message + */ + public static void log(final String message) + { + System.out.println(message); + } + + /** + * @param msg A short label placed before the trace of t to show the source + * @param t + */ + public static void log(final String msg, final Throwable t) + { + System.out.printf("%s: Exception Trace:\n\n",msg); //$NON-NLS-1$ + t.printStackTrace(System.out); + System.out.print("\n\n\n"); //$NON-NLS-1$ + } + + private PageDesignerTraceOptions() + { + // no instantiation + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/container/ContainerActionGroup.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/container/ContainerActionGroup.java new file mode 100755 index 0000000..df8acb6 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/container/ContainerActionGroup.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.container; + +import org.eclipse.gef.EditPart; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jst.pagedesigner.elementedit.IElementEdit; +import org.eclipse.jst.pagedesigner.parts.ElementEditPart; +import org.eclipse.jst.pagedesigner.parts.NodeEditPart; +import org.eclipse.jst.pagedesigner.range.RangeUtil; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.ui.actions.ActionGroup; +import org.w3c.dom.Text; + +/** + * @author mengbo + * @version 1.5 + */ +public class ContainerActionGroup extends ActionGroup { + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager) + */ + public void fillContextMenu(IMenuManager menu) { + ISelection selection = this.getContext().getSelection(); + + EditPart part = findCommonAncesterPart(selection); + if (!(part instanceof NodeEditPart)) { + return; + } + + NodeEditPart original = (NodeEditPart) part; + // start from the parent of part + while (part.getParent() instanceof ElementEditPart) { + ElementEditPart elementEditPart = (ElementEditPart) part + .getParent(); + + IElementEdit elementEdit = elementEditPart.getElementEdit(); + if (elementEdit != null) { + boolean filled = elementEdit.fillContainerContextMenu(menu, + elementEditPart, original, selection); + if (filled) { + break; + } + } + + part = part.getParent(); + } + } + + /** + * Give a selection, find a single common container node as start for table + * related operations. + * + * @param selection + * @return + */ + private EditPart findCommonAncesterPart(ISelection selection) { + if (selection instanceof IStructuredSelection) { + IStructuredSelection structsel = (IStructuredSelection) selection; + if (structsel.size() != 1) { + return null; + } else if (structsel.getFirstElement() instanceof EditPart) { + return (EditPart) structsel.getFirstElement(); + } else { + return null; + } + } else if (selection instanceof DesignRange) { + DesignRange range = (DesignRange) selection; + if (!range.isValid()) { + return null; + } + if (range.isEmpty()) { + DesignPosition position = range.getStartPosition(); + if (position.getOffset() == 0 + || position.getContainerNode() instanceof Text) { + return position.getContainerPart(); + } + return position.getSiblingEditPart(false); + } + return RangeUtil.findCommonAncestor(range); + } else { + return null; + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/AbstractLinkCreator.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/AbstractLinkCreator.java new file mode 100755 index 0000000..e36fa8c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/AbstractLinkCreator.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExecutableExtension; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; + +/** + * @author mengbo + * @version 1.5 + */ +public abstract class AbstractLinkCreator implements ILinkCreator, + IExecutableExtension { + private String _identifier; + /** + * the link identifier attribute name + */ + private static final String LINK_IDENTIFIER = "linkIdentifier"; //$NON-NLS-1$ + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.actions.link.ILinkCreator#canExcute(org.eclipse.jst.pagedesigner.viewer.DesignRange) + */ + public boolean canExecute(DesignRange range) { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.actions.link.ILinkCreator#getLinkIdentifier() + */ + public String getLinkIdentifier() { + return this._identifier; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, + * java.lang.String, java.lang.Object) + */ + public void setInitializationData(IConfigurationElement config, + String propertyName, Object data) throws CoreException { + this._identifier = config.getAttribute(LINK_IDENTIFIER); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/CreateLinkWizard.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/CreateLinkWizard.java new file mode 100755 index 0000000..869dfdc --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/CreateLinkWizard.java @@ -0,0 +1,109 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import java.util.Map; + +import org.eclipse.gef.EditPart; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; + +/** + * @author mengbo + * @version 1.5 + */ +public class CreateLinkWizard extends Wizard { + private static final String WIZARD_TITLE = PDPlugin + .getResourceString("CreateLinkWizard.Title"); //$NON-NLS-1$ + + private static final String INTIAL_DEFAULT_PAGE_IMAGE = "newsuade_wiz.gif"; //$NON-NLS-1$ + + private static final String PAGE_NAME = "first"; //$NON-NLS-1$ + + private String _pageTitle; + + private EditPart _part; + + private DesignRange _range; + + private Map _linkMap; + + private String _linkType; + + /** + * @param part + * @param range + * @param linkMap + */ + public CreateLinkWizard(EditPart part, DesignRange range, Map linkMap) { + this._part = part; + this._range = range; + this._linkMap = linkMap; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.IWizard#addPages() + */ + public void addPages() { + addPage(new LinkWizardPage(PAGE_NAME, _pageTitle, this._part, + this._range, this._linkMap)); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.IWizard#canFinish() + */ + public boolean canFinish() { + return super.canFinish(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.IWizard#performFinish() + */ + public boolean performFinish() { + LinkWizardPage page = (LinkWizardPage) getPage(PAGE_NAME); + this._linkType = page.getChosenLinkType(); + return true; + } + + /** + * @param pageTitle + */ + public void setPageTitle(String pageTitle) { + _pageTitle = pageTitle; + initializeDefaultPageImageDescriptor(); + } + + /** + * + */ + protected void initializeDefaultPageImageDescriptor() { + ImageDescriptor desc = PDPlugin.getDefault().getImageDescriptor( + INTIAL_DEFAULT_PAGE_IMAGE); + setDefaultPageImageDescriptor(desc); + setWindowTitle(WIZARD_TITLE); + } + + /** + * @return the link type + */ + public String getChosenLinkType() { + return this._linkType; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/ExtensionReader.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/ExtensionReader.java new file mode 100755 index 0000000..1bc22cc --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/ExtensionReader.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.jst.pagedesigner.IJMTConstants; +import org.eclipse.jst.pagedesigner.PDPlugin; + +/** + * @author mengbo + * @version 1.5 + */ +public class ExtensionReader { + private static Logger _log = PDPlugin.getLogger(ExtensionReader.class); + + private static List _handlers = null; + + private static final String ATTR_CLASS = "class"; //$NON-NLS-1$ + + /** + * @return the ext-pts for the link handler + * List is not modifiable + */ + public static synchronized List getAllLinkHandlers() { + if (_handlers == null) { + _handlers = readAllLinkHandlers(); + } + return Collections.unmodifiableList(_handlers); + + } + + private static List readAllLinkHandlers() { + List result = new ArrayList(); + IExtensionPoint extensionPoint = Platform.getExtensionRegistry() + .getExtensionPoint(PDPlugin.getPluginId(), + IJMTConstants.EXTENSION_POINT_PAGEDESIGNER); + IExtension[] extensions = extensionPoint.getExtensions(); + + for (int i = 0; i < extensions.length; i++) { + IExtension ext = extensions[i]; + IConfigurationElement[] linkHandlers = ext + .getConfigurationElements(); + + for (int j = 0; j < linkHandlers.length; j++) { + if (linkHandlers[j].getName() + .equals(IJMTConstants.LINK_CREATOR)) { + linkHandlers[j].getAttribute(ATTR_CLASS); + Object obj; + try { + obj = linkHandlers[j] + .createExecutableExtension(ATTR_CLASS); + + if (obj instanceof ILinkCreator) { + result.add((ILinkCreator)obj); + } + } catch (CoreException e) { + _log + .error("Log.Error.ExtensionReader.ReadLinkExtension"); //$NON-NLS-1$ + } + } + } + } + return result; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/HtmlLinkCreator.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/HtmlLinkCreator.java new file mode 100755 index 0000000..dd79117 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/HtmlLinkCreator.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import org.eclipse.gef.EditPart; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.css2.property.ICSSPropertyID; +import org.eclipse.jst.pagedesigner.parts.TextEditPart; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * @author mengbo + * @version 1.5 + */ +public class HtmlLinkCreator extends AbstractLinkCreator { + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.actions.link.ILinkCreator#makeLinkElement(org.eclipse.gef.EditPart, + * org.eclipse.jst.pagedesigner.viewer.DesignRange) + */ + public Element makeLinkElement(EditPart part, DesignRange range) { + if (part instanceof TextEditPart) { + Text middleNode = LinkUtil.splitDomText(part, range); + EditPart parent = part.getParent(); + Node parentNode = (Node) parent.getModel(); + Document doc = (parentNode instanceof Document) ? (Document) parentNode + : (parentNode.getOwnerDocument()); + + Element htmlLink = doc.createElement(IHTMLConstants.TAG_A); + htmlLink.setAttribute(ICSSPropertyID.ATTR_HREF, ""); //$NON-NLS-1$ + Text text = doc.createTextNode(middleNode.getNodeValue()); + htmlLink.appendChild(text); + parentNode.replaceChild(htmlLink, middleNode); + return htmlLink; + } + + return null; + } + + public String getSourcePreview(EditPart part, DesignRange range) { + if (part instanceof TextEditPart) { + TextEditPart textPart = (TextEditPart) part; + int[] offsets = textPart.getSelectedRange(); + String displayData = textPart.getTextData(); + + String linkExp = displayData.substring(offsets[0], offsets[1]); + StringBuffer sb = new StringBuffer(); + sb.append(""); //$NON-NLS-1$ + sb.append(linkExp); + sb.append(""); //$NON-NLS-1$ + return sb.toString(); + } + return null; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/ILinkCreator.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/ILinkCreator.java new file mode 100755 index 0000000..c761e04 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/ILinkCreator.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import org.eclipse.gef.EditPart; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public interface ILinkCreator { + + /** + * @param part + * @param range + * @return the link element + */ + public Element makeLinkElement(EditPart part, DesignRange range); + + /** + * @return link identifier + */ + public String getLinkIdentifier(); + + /** + * @param range + * @return true if can call makeLinkElement + */ + public boolean canExecute(DesignRange range); + + /** + * @param part + * @param range + * @return a preview string that approximates the result + * of makeLinkElement + */ + public String getSourcePreview(EditPart part, DesignRange range); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkRequest.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkRequest.java new file mode 100755 index 0000000..1b72fd4 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkRequest.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import org.eclipse.gef.Request; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; + +/** + * @author mengbo + * @version 1.5 + */ +public class LinkRequest extends Request { + private final String _identifier; + + private final DesignRange _range; + + /** + * @param identifier + * @param range + */ + public LinkRequest(String identifier, DesignRange range) { + this._identifier = identifier; + this._range = range; + } + + /** + * @return the identifier + */ + public String getIdentifier() { + return this._identifier; + } + + /** + * @return the design range + */ + public DesignRange getDesignRange() { + return this._range; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkUtil.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkUtil.java new file mode 100755 index 0000000..b0a46bd --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkUtil.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import org.eclipse.gef.EditPart; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.DOMRangeHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRefPosition; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.parts.TextEditPart; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * @author mengbo + * @version 1.5 + */ +public class LinkUtil { + /** + * @param part + * @param range + * @return the select text if part is a text node or null. + */ + public static String getSelectedText(EditPart part, DesignRange range) { + if (part instanceof TextEditPart) { + TextEditPart textPart = (TextEditPart) part; + int[] offsets = textPart.getSelectedRange(); + String displayData = textPart.getTextData(); + + String linkExp = displayData.substring(offsets[0], offsets[1]); + return linkExp; + } + return null; + } + + /** + * @param part + * @param range + * @return the text from part split if it is a text node or null + */ + public static Text splitDomText(EditPart part, DesignRange range) { + if (part instanceof TextEditPart) { + Text textNode = (Text) part.getModel(); + + DOMRange domRange = DOMRangeHelper.toDOMRange(range); + IDOMPosition start = domRange.getStartPosition(); + IDOMPosition end = domRange.getEndPosition(); + int domTempStartOffset = computeOffset(start, textNode); + int domTempEndOffset = computeOffset(end, textNode); + + int domStartOffset = Math.min(domTempStartOffset, domTempEndOffset); + int domEndOffset = Math.max(domTempStartOffset, domTempEndOffset); + + Text lastNode = textNode; + if (domStartOffset > 0) { + lastNode = textNode.splitText(domStartOffset); + } + lastNode = lastNode.splitText(domEndOffset - domStartOffset); + Text middleNode = (Text) lastNode.getPreviousSibling(); + return middleNode; + } + return null; + } + + private static int computeOffset(IDOMPosition pos, Text textNode) { + int domOffset = 0; + if (pos instanceof DOMRefPosition) { + DOMRefPosition rep = (DOMRefPosition) pos; + boolean forward = rep.isForward(); + Node refNode = rep.getReferenceNode(); + + if ((refNode != textNode) && forward || (refNode == textNode) + && !forward) { + domOffset = 0; + } else { + domOffset = textNode.getLength(); + } + } else { + domOffset = pos.getOffset(); + } + return domOffset; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkWizardPage.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkWizardPage.java new file mode 100755 index 0000000..e856305 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/LinkWizardPage.java @@ -0,0 +1,168 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import org.eclipse.gef.EditPart; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; + +/** + * @author mengbo + * @version 1.5 + */ +/*package*/ class LinkWizardPage extends WizardPage { + private static final String GROUP_TITLE = PDPlugin + .getResourceString("LinkWizardPage.GroupTitle"); //$NON-NLS-1$ + + private static final String PREVIEW_TAG_LABEL = PDPlugin + .getResourceString("LinkWizardPage.PreviewLabel"); //$NON-NLS-1$ + + private StyledText _text = null; + + private final Map _linkMap; + + private String _linkType = null; + + private final EditPart _part; + + private final DesignRange _range; + + /** + * @param pageName + * @param title + * @param editPart + * @param range + * @param linkMap + */ + public LinkWizardPage(String pageName, String title, EditPart editPart, + DesignRange range, Map linkMap) { + super(pageName, title, null); + this._part = editPart; + this._range = range; + this._linkMap = linkMap; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) + */ + public void createControl(Composite parent) { + GridLayout layout; + GridData data; + + layout = new GridLayout(); + layout.marginWidth = 20; + parent.setLayout(layout); + data = new GridData(GridData.FILL_BOTH | GridData.CENTER); + parent.setLayoutData(data); + + Group group = new Group(parent, SWT.NONE); + group.setText(GROUP_TITLE); + layout = new GridLayout(); + group.setLayout(layout); + data = new GridData(GridData.FILL_HORIZONTAL); + group.setLayoutData(data); + + String defaultLink = ""; //$NON-NLS-1$ + Set set = this._linkMap.keySet(); + int size = set.size(); + String[] keys = new String[size]; + Iterator itr = set.iterator(); + int i = 0; + while (itr.hasNext()) { + String key = itr.next(); + keys[i++] = key; + } + Arrays.sort(keys); + for (int j = 0; j < size; j++) { + Button bt = new Button(group, SWT.RADIO); + data = new GridData(GridData.FILL_HORIZONTAL); + bt.setLayoutData(data); + bt.setText(keys[j]); + if (j == 0) { + bt.setSelection(true); + defaultLink = keys[j]; + } + bt.addSelectionListener(new SelectLinkListener(keys[j])); + } + + Label label = new Label(parent, SWT.NONE); + label.setText(PREVIEW_TAG_LABEL); + + _text = new StyledText(parent, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER); + data = new GridData(GridData.FILL_BOTH); + data.heightHint = 50; + _text.setLayoutData(data); + + ILinkCreator creator = _linkMap.get(defaultLink); + _linkType = creator.getLinkIdentifier(); + String previewText = creator.getSourcePreview(_part, _range); + previewText = previewText == null ? "" : previewText; //$NON-NLS-1$ + _text.setText(previewText); + _text.setEditable(false); + + super.setControl(group); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.IWizardPage#isPageComplete() + */ + public boolean isPageComplete() { + return true; + } + + /** + * @return the link type + */ + public String getChosenLinkType() { + return this._linkType; + } + + class SelectLinkListener extends SelectionAdapter { + private String _key; + + /** + * @param key + */ + public SelectLinkListener(String key) { + this._key = key; + } + + public void widgetSelected(SelectionEvent e) { + ILinkCreator creator = _linkMap.get(this._key); + _linkType = creator.getLinkIdentifier(); + String previewText = creator.getSourcePreview(_part, _range); + previewText = previewText == null ? "" : previewText; //$NON-NLS-1$ + _text.setText(previewText); + super.widgetSelected(e); + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/MakeLinkAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/MakeLinkAction.java new file mode 100755 index 0000000..2fe0795 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/MakeLinkAction.java @@ -0,0 +1,215 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.window.Window; +import org.eclipse.jst.jsf.common.ui.internal.dialogs.CommonWizardDialog; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.parts.TextEditPart; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * @author mengbo + * @version 1.5 + */ +public class MakeLinkAction extends Action { + private final static String MAKE_LINK = PDPlugin + .getResourceString("ActionGroup.Submenu.Link"); //$NON-NLS-1$ + + private final static String WIZARD_PAGE_TITLE = PDPlugin + .getResourceString("MakeLinkAction.Wizard.PageTitle"); //$NON-NLS-1$ + + private EditPart _editPart; + + private DesignRange _range; + + private String _linkType; + + /** + * @param range + */ + public MakeLinkAction(DesignRange range) { + super(MAKE_LINK); + _range = range; + _editPart = convertToEditPart(_range); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.Action#run() + */ + public void run() { + Map map = calAvailableLinkCreator(); + if (map.size() > 1) { + CreateLinkWizard wizard = new CreateLinkWizard(_editPart, _range, + map); + wizard.setPageTitle(WIZARD_PAGE_TITLE); + CommonWizardDialog wizardDialog = new CommonWizardDialog( + getShell(), wizard); + wizardDialog.create(); + if (wizardDialog.open() == Window.OK) { + _linkType = wizard.getChosenLinkType(); + } + } + // else must be html link + else if (map.size() == 1) { + Set> set = map.entrySet(); + Iterator> itr = set.iterator(); + while (itr.hasNext()) { + ILinkCreator creator = itr.next().getValue(); + _linkType = creator.getLinkIdentifier(); + } + } + + if (_linkType != null) { + Request request = new LinkRequest(_linkType, _range); + Command cmd = _editPart.getCommand(request); + if (cmd != null && cmd.canExecute()) { + cmd.execute(); + } + } + + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#isEnabled() + */ + public boolean isEnabled() { + if (_editPart == null) { + return false; + } + return super.isEnabled(); + } + + private EditPart convertToEditPart(DesignRange range) { + DesignPosition startPosition = range.getStartPosition(); + EditPart startPart = startPosition.getContainerPart(); + + DesignPosition endPosition = range.getEndPosition(); + EditPart endPart = endPosition.getContainerPart(); + + if (startPosition == endPosition) { + return null; + } + + if (startPart instanceof TextEditPart + && endPart instanceof TextEditPart) { + if ((startPart == endPart)) { + return startPart; + } + } else if (!(startPart instanceof TextEditPart) + && !(endPart instanceof TextEditPart)) { + Node[] startNodeOptions = null; + startNodeOptions = getSideNodes(startPosition); + Node[] endNodeOptions = null; + endNodeOptions = getSideNodes(endPosition); + Node selectedNode = null; + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + if (startNodeOptions[i] == endNodeOptions[j]) { + selectedNode = startNodeOptions[i]; + break; + } + } + if (selectedNode != null) { + break; + } + } + if (selectedNode != null) { + EditPart part = (EditPart) ((INodeNotifier) selectedNode) + .getAdapterFor(EditPart.class); + return part; + } + } else { + if (startPart instanceof TextEditPart) { + Node[] endNodeOptions = null; + endNodeOptions = getSideNodes(endPosition); + if (startPart.getModel() == endNodeOptions[0] + || startPart.getModel() == endNodeOptions[1]) { + return startPart; + } + } + if (endPart instanceof TextEditPart) { + Node[] startNodeOptions = null; + startNodeOptions = getSideNodes(startPosition); + if (endPart.getModel() == startNodeOptions[0] + || endPart.getModel() == startNodeOptions[1]) { + return endPart; + } + } + } + + return null; + } + + private Node[] getSideNodes(DesignPosition pos) { + Node[] nodes = new Node[2]; + + EditPart part = pos.getContainerPart(); + Node node = (Node) part.getModel(); + NodeList list = node.getChildNodes(); + + if (list.getLength() == pos.getOffset()) { + nodes[0] = list.item(pos.getOffset() - 1); + nodes[1] = list.item(pos.getOffset() - 1); + } else if (pos.getOffset() == 0) { + nodes[0] = list.item(0); + nodes[1] = list.item(0); + } else if (pos.getOffset() > 0 && pos.getOffset() < list.getLength()) { + nodes[0] = list.item(pos.getOffset() - 1); + nodes[1] = list.item(pos.getOffset()); + } + + return nodes; + } + + private Shell getShell() { + if (_editPart != null) { + IHTMLGraphicalViewer viewer = (IHTMLGraphicalViewer) _editPart + .getViewer(); + return viewer.getControl().getShell(); + } + return null; + } + + private Map calAvailableLinkCreator() { + Map map = new HashMap(); + List linkCreators = ExtensionReader.getAllLinkHandlers(); + for (ILinkCreator linkCreator : linkCreators) { + String identifier = linkCreator.getLinkIdentifier(); + boolean canExecute = linkCreator.canExecute(_range); + if (canExecute) { + map.put(identifier, linkCreator); + } + } + return map; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/MakeLinkCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/MakeLinkCommand.java new file mode 100755 index 0000000..3a6b0fa --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/link/MakeLinkCommand.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.link; + +import java.util.List; + +import org.eclipse.gef.EditPart; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * @author mengbo + * @version 1.5 + */ +public class MakeLinkCommand extends DesignerCommand { + private String _identifier = null; + + private EditPart _part = null; + + private DesignRange _range = null; + + private ILinkCreator _linkcreator = null; + + private Element _ele = null; + + /** + * @param identifier + * @param viewer + * @param part + * @param range + */ + public MakeLinkCommand(String identifier, IHTMLGraphicalViewer viewer, + EditPart part, DesignRange range) { + super(identifier, viewer); + setLabel(PDPlugin.getResourceString("MakeLinkCommand.Label.MakeLink"));//$NON-NLS-1$ + this._identifier = identifier; + this._part = part; + this._range = range; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#canExecute() + */ + public boolean canExecute() { + List creators = ExtensionReader.getAllLinkHandlers(); + if (creators != null) { + for (ILinkCreator linkCreator : creators) { + String identifier = linkCreator.getLinkIdentifier(); + if (this._identifier.equalsIgnoreCase(identifier)) { + this._linkcreator = linkCreator; + break; + } + } + } + if (this._linkcreator != null) { + return this._linkcreator.canExecute(_range); + } + + return super.canExecute(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + if (this._linkcreator != null) { + Element ele = this._linkcreator.makeLinkElement(this._part, + this._range); + Node node = (Node) this._part.getModel(); + Node parent = node.getParentNode(); + formatNode(parent); + + this._ele = ele; + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(_ele); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/menuextension/CustomedContextMenuActionGroup.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/menuextension/CustomedContextMenuActionGroup.java new file mode 100755 index 0000000..d916fac --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/menuextension/CustomedContextMenuActionGroup.java @@ -0,0 +1,132 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.menuextension; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jst.pagedesigner.extensionpoint.IContextMenuItemContributor; +import org.eclipse.jst.pagedesigner.utils.JSPUtil; +import org.eclipse.jst.pagedesigner.utils.StructuredModelUtil; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.actions.ActionGroup; +import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; + +/** + * @author mengbo + * @version 1.5 + */ +public class CustomedContextMenuActionGroup extends ActionGroup { + private final static String POPUPMENU_EXTENSION_ID = "org.eclipse.jst.pagedesigner.popupMenuContributor"; //$NON-NLS-1$ + + private List _contributedMenuListener; + + private Control _parentControl; + + private IStructuredModel _model; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager) + */ + public void fillContextMenu(IMenuManager menu) { + populateContributedMenu(menu); + } + + private List getListeners() { + if (_contributedMenuListener == null) { + _contributedMenuListener = computeContributedMenuListener(); + } + return _contributedMenuListener; + } + + private List computeContributedMenuListener() { + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IExtensionPoint extensionPoint = registry + .getExtensionPoint(POPUPMENU_EXTENSION_ID); + IExtension[] extensions = extensionPoint.getExtensions(); + List results = new ArrayList(); + for (int i = 0; i < extensions.length; i++) { + IConfigurationElement[] elements = extensions[i] + .getConfigurationElements(); + for (int j = 0; j < elements.length; j++) { + try { + Object listener = elements[j] + .createExecutableExtension("class");//$NON-NLS-1$ + + if (listener instanceof IContextMenuItemContributor) { + results.add(listener); + ((IContextMenuItemContributor) listener) + .setURI(elements[j].getAttribute("URI"));//$NON-NLS-1$ + } + } catch (CoreException e) { + // ignore + } + } + } + return results; + } + + private void populateContributedMenu(IMenuManager menuMgr) { + List list = getListeners(); + for (int i = 0, n = list.size(); i < n; i++) { + IContextMenuItemContributor contributor = (IContextMenuItemContributor) list + .get(i); + IFile file = StructuredModelUtil.getFileFor(_model); + if (file != null && contributor.getURI() != null) { + if (JSPUtil.supportTaglib(contributor.getURI(), file)) { + contributor.fillContextMenu(menuMgr, getContext() + .getSelection(), _model, _parentControl); + } + } + } + } + + /** + * @return Returns the model. + */ + public IStructuredModel getModel() { + return _model; + } + + /** + * @param model + * The model to set. + */ + public void setModel(IStructuredModel model) { + this._model = model; + } + + /** + * @return Returns the parentControl. + */ + public Control getParentControl() { + return _parentControl; + } + + /** + * @param parentControl + * The parentControl to set. + */ + public void setParentControl(Control parentControl) { + this._parentControl = parentControl; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/menuextension/RunAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/menuextension/RunAction.java new file mode 100755 index 0000000..a4433ba --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/menuextension/RunAction.java @@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.menuextension; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.ui.part.EditorPart; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +/** + * @author mengbo + * @version 1.5 + */ +public class RunAction extends Action { + /** + * constant for debug launch mode + */ + public static final String LAUNCH_MODE_DEBUG = "debug"; //$NON-NLS-1$ + + /** + * constant for run launch mode + */ + public static final String LAUNCH_MODE_RUN = "run"; //$NON-NLS-1$ + + private final String ID = "org.eclipse.jst.pagedesigner.actions.menuextension.RunAction"; //$NON-NLS-1$ + + //private EditorPart _editor; + + private String _mode; + + /** + * @param editor + * @param mode + */ + public RunAction(EditorPart editor, String mode) { + //_editor = editor; + _mode = mode; + } + + public void run() { + PDPlugin.getLogger(getClass()).error("Obsolete. Shouldn't be used", new Throwable()); //$NON-NLS-1$ + // FIXME: we don't support this feature and it seems to depend + // on debugger internal code anyway... + // List allShortCuts = DebugUIPlugin.getDefault() +// .getLaunchConfigurationManager().getLaunchShortcuts(); +// Iterator iter = allShortCuts.iterator(); +// LaunchShortcutExtension ext = null; +// while (iter.hasNext()) { +// ext = (LaunchShortcutExtension) iter.next(); +// try { +// if (ext.getId().equals("org.eclipse.wst.server.launchShortcut")) { +// break; +// } +// } catch (Exception e) { +// // not supported +// } +// } +// if (ext != null) { +// ext.launch(getSelection(), _mode); +// } + } + +// private IStructuredSelection getSelection() { +// IEditorInput input = ((HTMLEditor) _editor).getEditorInput(); +// List elements = new ArrayList(); +// if (input instanceof FileEditorInput) { +// elements.add(((FileEditorInput) input).getFile()); +// } +// return new StructuredSelection(elements); +// } + + public String getId() { + return ID; + } + + public String getText() { + return _mode.substring(0, 1).toUpperCase() + + _mode.substring(1, _mode.length()); + } + + private ImageDescriptor getImageDescriptorForModel(String id) { + IConfigurationElement[] elements = Platform.getExtensionRegistry() + .getConfigurationElementsFor("org.eclipse.ui.actionSets"); //$NON-NLS-1$ + for (int i = 0; i < elements.length; i++) { + if ("actionSet".equals(elements[i].getName())) { //$NON-NLS-1$ + IConfigurationElement[] actions = elements[i] + .getChildren("action"); //$NON-NLS-1$ + for (int j = 0; j < actions.length; j++) { + if (id.equals(actions[j].getAttribute("id"))) { //$NON-NLS-1$ + String iconPath = actions[j].getAttribute("icon"); //$NON-NLS-1$ + if (iconPath != null) { + return AbstractUIPlugin.imageDescriptorFromPlugin( + actions[j].getDeclaringExtension() + .getContributor().getName(), iconPath); + } + return null; + } + } + } + } + return null; + } + + public ImageDescriptor getImageDescriptor() { + if (_mode == LAUNCH_MODE_DEBUG) { + return getImageDescriptorForModel("org.eclipse.debug.internal.ui.actions.DebugDropDownAction"); //$NON-NLS-1$ + } else if (_mode == LAUNCH_MODE_RUN) { + return getImageDescriptorForModel("org.eclipse.debug.internal.ui.actions.RunDropDownAction"); //$NON-NLS-1$ + } else { + return super.getImageDescriptor(); + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/AlignSupport.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/AlignSupport.java new file mode 100755 index 0000000..bbcff29 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/AlignSupport.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class AlignSupport { + + private static final String[] ALIGN_VALUES = new String[] { + PDPlugin.getResourceString("AlignSupport.ActionLabel.Left"), //$NON-NLS-1$ + PDPlugin.getResourceString("AlignSupport.ActionLabel.Center"), //$NON-NLS-1$ + PDPlugin.getResourceString("AlignSupport.ActionLabel.Right"), //$NON-NLS-1$ + PDPlugin.getResourceString("AlignSupport.ActionLabel.Justify") //$NON-NLS-1$ + }; + + private static Element[] _nodes = null; + + /** + * @param menu + * @param viewer + */ + public static void createAlignActions(IMenuManager menu, + IHTMLGraphicalViewer viewer) { + for (int i = 0; i < ALIGN_VALUES.length; i++) { + ParagraphStyleAction action = new ParagraphStyleAction( + ALIGN_VALUES[i], _nodes[i], null, IAction.AS_CHECK_BOX); + action.setViewer(viewer); + menu.add(action); + } + } + + /** + * @param nodes + */ + public static void setAlignNodes(Element[] nodes) { + if (_nodes != nodes) { + _nodes = nodes; + } + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ChangeStyleAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ChangeStyleAction.java new file mode 100755 index 0000000..511977d --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ChangeStyleAction.java @@ -0,0 +1,178 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jst.pagedesigner.commands.range.ApplyStyleCommand; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.DOMRangeHelper; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class ChangeStyleAction extends DesignerToolBarAction { + private final String _expectedTag; + + /** + * @param text + * @param name + * @param image + * @param style + */ + public ChangeStyleAction(String text, String name, ImageDescriptor image, + int style) { + super(text, style); + _expectedTag = name; + this.setImageDescriptor(image); + } + + /** + * @param text + * @param name + * @param enabled + * @param disabled + * @param style + */ + public ChangeStyleAction(String text, String name, ImageDescriptor enabled, + ImageDescriptor disabled, int style) { + super(text, style); + _expectedTag = name; + setImageDescriptor(enabled); + setDisabledImageDescriptor(disabled); + } + + + protected boolean isApplied(DOMRange range) { + if (range == null) { + return false; + } + + boolean ordered = range.isOrdered(); + IDOMPosition start = ordered ? range.getStartPosition() : range + .getEndPosition(); + IDOMPosition end = ordered ? range.getEndPosition() : range + .getStartPosition(); + Node startnode = start.getContainerNode(); + Node endnode = end.getContainerNode(); + if (!EditModelQuery.hasAncestor(startnode, _expectedTag, true)) { + return false; + } + for (Node node = startnode; node != endnode; node = EditModelQuery + .getInstance().getNextLeafNeighbor(node)) { + if (!EditModelQuery.hasAncestor(node, _expectedTag, true)) { + return false; + } + } + if (!EditModelQuery.hasAncestor(endnode, _expectedTag, true)) { + return false; + } + return true; + } + + /** + * @return the expected tag + */ + protected String getExpectedTag() { + return _expectedTag; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.DesignerToolBarAction#getCommand() + */ + protected Command getCommand() { + DesignRange range = getViewer().getRangeSelection(); + DOMRange dRange = DOMRangeHelper.toDOMRange(range); + Command command; + if (isApplied(dRange)) { + // command = new UnapplyStyleCommand(getViewer(), _expectedTag, + // null, null); + // since the un-applystyle is not implemented yet,we do nothing + // here. + command = null; + this.setChecked(true); + } else { + command = new ApplyStyleCommand(getViewer(), _expectedTag, null, + null); + } + return command; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.texteditor.IUpdate#update() + */ + public void update() { + if (canRun(getViewer())) { + setEnabled(true); + } else { + setEnabled(false); + } + updateStatus(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.actions.range.DesignerToolBarAction#updateStatus() + */ + public void updateStatus() { + IHTMLGraphicalViewer viewer = getViewer(); + if (viewer != null && viewer.isInRangeMode() + && viewer.getModel().getDocument().hasChildNodes()) { + DesignRange range = getViewer().getRangeSelection(); + if (range != null && range.isValid()) { + DOMRange domRange = null; + domRange = new DOMRange(DOMPositionHelper.toDOMPosition(range + .getStartPosition()), DOMPositionHelper + .toDOMPosition(range.getEndPosition())); + if (isApplied(domRange)) { + this.setChecked(true); + } else { + this.setChecked(false); + } + return; + } + } + this.setChecked(false); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.actions.range.DesignerToolBarAction#canRun(org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer) + */ + protected boolean canRun(IHTMLGraphicalViewer viewer) { + if (viewer != null && viewer.isInRangeMode() + && viewer.getModel().getDocument().hasChildNodes()) { + DesignRange range = viewer.getRangeSelection(); + if (range != null && range.isValid()) { + DesignPosition startPos = range.getStartPosition(); + DesignPosition endPos = range.getEndPosition(); + if (startPos != endPos) { + return true; + } + } + } + return false; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/DesignerToolBarAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/DesignerToolBarAction.java new file mode 100755 index 0000000..3b1b5a6 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/DesignerToolBarAction.java @@ -0,0 +1,155 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.ui.texteditor.IUpdate; + +/** + * @author mengbo + */ +public abstract class DesignerToolBarAction extends Action implements IUpdate, + ISelectionChangedListener { + private IHTMLGraphicalViewer _viewer; + + /** + * @param text + * @param style + */ + public DesignerToolBarAction(String text, int style) { + super(text, style); + } + + /** + * @param text + * @param image + */ + public DesignerToolBarAction(String text, ImageDescriptor image) { + super(text, image); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) + */ + public void selectionChanged(SelectionChangedEvent event) { + update(); + } + + /** + * + */ + public void update() { + if (canRun(this._viewer)) { + setEnabled(true); + updateStatus(); + } else { + setEnabled(false); + } + } + + /** + * Update the status + */ + protected void updateStatus() { + DesignRange range = _viewer.getRangeSelection(); + DOMRange domRange = null; + if (range != null) { + domRange = new DOMRange(DOMPositionHelper.toDOMPosition(range + .getStartPosition()), DOMPositionHelper.toDOMPosition(range + .getEndPosition())); + if (isApplied(domRange)) { + this.setChecked(true); + } else { + this.setChecked(false); + } + } + } + + /** + * @param range + * @return ?? + */ + protected abstract boolean isApplied(DOMRange range); + + /** + * @param viewer + * @return true if this action can run + */ + protected boolean canRun(IHTMLGraphicalViewer viewer) { + if (viewer != null && viewer.isInRangeMode() + && viewer.getModel().getDocument().hasChildNodes()) { + DesignRange range = viewer.getRangeSelection(); + if (range != null && range.isValid()) { + return true; + } + } + return false; + } + + /** + * @param viewer + */ + public void setViewer(IHTMLGraphicalViewer viewer) { + if (viewer == _viewer) { + return; + } + + if (_viewer != null) { + _viewer.removeSelectionChangedListener(this); + } + _viewer = viewer; + if (_viewer != null) { + _viewer.addSelectionChangedListener(this); + } + update(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + // Assert.isTrue(_viewer != null && _viewer.isInRangeMode()); + DesignRange range = _viewer.getRangeSelection(); + if (range == null || !range.isValid()) { + return; + } + Command command = getCommand(); + if (command != null) { + command.execute(); + } + } + + /** + * @return the command for this action or null + */ + protected abstract Command getCommand(); + + /** + * @return Returns the _viewer. + */ + public IHTMLGraphicalViewer getViewer() { + return _viewer; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/HTagsInsertGroupAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/HTagsInsertGroupAction.java new file mode 100755 index 0000000..a2bcf6e --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/HTagsInsertGroupAction.java @@ -0,0 +1,180 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuCreator; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Menu; + +/** + * @author mengbo + */ +public class HTagsInsertGroupAction extends DesignerToolBarAction implements + IMenuCreator { + private Menu _menu; + + private static Map _actions = new HashMap(); + + /** + * @param image + * @param style + */ + public HTagsInsertGroupAction(ImageDescriptor image, int style) { + super( + PDPlugin + .getResourceString("HTagsInsertGroupAction.ActionLabel.Hx"), IAction.AS_DROP_DOWN_MENU); //$NON-NLS-1$ + this.setImageDescriptor(image); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control) + */ + public Menu getMenu(Control parent) { + if (_menu != null) { + _menu.dispose(); + } + _menu = new Menu(parent); + addActionToMenu(_menu, IHTMLConstants.TAG_H1); + addActionToMenu(_menu, IHTMLConstants.TAG_H2); + addActionToMenu(_menu, IHTMLConstants.TAG_H3); + addActionToMenu(_menu, IHTMLConstants.TAG_H4); + addActionToMenu(_menu, IHTMLConstants.TAG_H5); + addActionToMenu(_menu, IHTMLConstants.TAG_H6); + + return _menu; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu) + */ + public Menu getMenu(Menu parent) { + return null; + } + + /** + * @param parent + * @param name + */ + protected void addActionToMenu(Menu parent, String name) { + DesignerToolBarAction action; + if (_actions.get(name) == null) { + action = new ParagraphStyleAction(name, name, null, + IAction.AS_CHECK_BOX); + _actions.put(name, action); + } else { + action = (ParagraphStyleAction) _actions.get(name); + } + action.setViewer(getViewer()); + action.update(); + ActionContributionItem item = new ActionContributionItem(action); + item.fill(parent, -1); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IMenuCreator#dispose() + */ + public void dispose() { + if (_menu != null) { + _menu.dispose(); + _menu = null; + _actions.clear(); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#getMenuCreator() + */ + public IMenuCreator getMenuCreator() { + return this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.editors.actions.DesignerToolBarAction#canRun(org.eclipse.jst.pagedesigner.dom.DOMRange) + */ + protected boolean isApplied(DOMRange range) { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + return; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.DesignerToolBarAction#getCommand() + */ + protected Command getCommand() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.DesignerToolBarAction#setViewer(org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer) + */ + public void setViewer(IHTMLGraphicalViewer viewer) { + if (_actions != null && _actions.size() > 0) { + Collection values = _actions.values(); + Iterator iterator = values.iterator(); + while (iterator.hasNext()) { + DesignerToolBarAction action = (DesignerToolBarAction) iterator + .next(); + action.setViewer(viewer); + } + } + super.setViewer(viewer); + } + + /* + * The group will delegate update to its children. + */ + public void updateStatus() { + if (_actions != null && _actions.size() > 0) { + Collection values = _actions.values(); + Iterator iterator = values.iterator(); + while (iterator.hasNext()) { + DesignerToolBarAction action = (DesignerToolBarAction) iterator + .next(); + action.updateStatus(); + } + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/InsertTagChangeStyleAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/InsertTagChangeStyleAction.java new file mode 100755 index 0000000..d10059c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/InsertTagChangeStyleAction.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.editors.actions.ChangeStyleAction; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class InsertTagChangeStyleAction extends ChangeStyleAction { + /** + * @param text + * @param tag + * @param image + * @param style + */ + public InsertTagChangeStyleAction(String text, String tag, + ImageDescriptor image, int style) { + super(text, tag, image, style); + } + + protected String getExpectedCSSProperty() { + // TODO Auto-generated method stub + return null; + } + + protected String getExpectedCSSPropertyValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void updateState() + { + setEnabled(getDesignRange()); + } + + /** + * @param range + */ + public void setEnabled(DesignRange range) { + DOMRange domRange = null; + // We didn't deal with undo, so only enable is set. + domRange = new DOMRange(DOMPositionHelper.toDOMPosition(range + .getStartPosition()), DOMPositionHelper.toDOMPosition(range + .getEndPosition())); + if (canRun(domRange)) { + this.setEnabled(true); + } else { + this.setEnabled(false); + } + } + + private boolean canRun(DOMRange range) { + if (range != null) { + if (EditModelQuery.isSame(range)) { + return false; + } + boolean ordered = range.isOrdered(); + IDOMPosition start = ordered ? range.getStartPosition() : range + .getEndPosition(); + IDOMPosition end = ordered ? range.getEndPosition() : range + .getStartPosition(); + Node common = null; + common = EditModelQuery.getInstance().getCommonAncestor(start, end); + if (getExpectedTag() == null + || EditModelQuery.hasAncestor(common, getExpectedTag(), + true)) { + return false; + } + return true; + } + return false; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/NoneParagraphStyleAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/NoneParagraphStyleAction.java new file mode 100755 index 0000000..19691ee --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/NoneParagraphStyleAction.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jst.pagedesigner.commands.range.Paragraph; +import org.eclipse.jst.pagedesigner.commands.range.ParagraphFinder; +import org.eclipse.jst.pagedesigner.commands.range.ParagraphUnapplyStyleCommand; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class NoneParagraphStyleAction extends ParagraphStyleAction { + + private String[] _applyingTags; + + /** + * @param text + * @param tags + * @param image + * @param style + */ + public NoneParagraphStyleAction(String text, String[] tags, + ImageDescriptor image, int style) { + super(text, "", image, style); //$NON-NLS-1$ + _applyingTags = tags; + } + + /** + * @param text + * @param node + * @param image + * @param style + */ + public NoneParagraphStyleAction(String text, Node node, + ImageDescriptor image, int style) { + super(text, node, image, style); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.editors.actions.DesignerToolBarAction#isApplied(org.eclipse.jst.pagedesigner.dom.DOMRange) + */ + protected boolean isApplied(DOMRange range) { + if (range != null) { + boolean ordered = range.isOrdered(); + IDOMPosition start = ordered ? range.getStartPosition() : range + .getEndPosition(); + IDOMPosition end = ordered ? range.getEndPosition() : range + .getStartPosition(); + Node common = null; + if (EditModelQuery.isSame(range)) { + ParagraphFinder finder = new ParagraphFinder(start); + Paragraph p = finder.getParagraph(start); + common = p.getLowestContainer(); + } else { + common = EditModelQuery.getInstance().getCommonAncestor(start, + end); + } + // the lowest common block parent is the container to apply style. + if (EditModelQuery.hasAncestor(common, _applyingTags, true)) { + return false; + } + return true; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.DesignerToolBarAction#getCommand() + */ + protected Command getCommand() { + ParagraphUnapplyStyleCommand command = new ParagraphUnapplyStyleCommand( + getViewer(), _applyingTags, null, null); + return command; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/NoneStyleAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/NoneStyleAction.java new file mode 100755 index 0000000..ae30254 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/NoneStyleAction.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jst.pagedesigner.commands.range.UnapplyStyleCommand; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class NoneStyleAction extends ChangeStyleAction { + private String[] _applyingStyleTags; + + /** + * @param text + * @param names + * @param image + * @param style + */ + public NoneStyleAction(String text, String[] names, ImageDescriptor image, + int style) { + super(text, "", image, style); //$NON-NLS-1$ + _applyingStyleTags = names; + } + + protected boolean isApplied(DOMRange range) { + if (range != null) { + boolean ordered = range.isOrdered(); + IDOMPosition start = ordered ? range.getStartPosition() : range + .getEndPosition(); + IDOMPosition end = ordered ? range.getEndPosition() : range + .getStartPosition(); + Node common = null; + common = EditModelQuery.getInstance().getCommonAncestor(start, end); + if (EditModelQuery.hasAncestor(common, _applyingStyleTags, true)) { + return false; + } + return true; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.DesignerToolBarAction#getCommand() + */ + protected Command getCommand() { + UnapplyStyleCommand command = new UnapplyStyleCommand(getViewer(), + getExpectedTag(), null, null); + return command; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphAction.java new file mode 100755 index 0000000..ce12016 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphAction.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.jface.action.Action; + +/** + * @author mengbo + * @version 1.5 + */ +public class ParagraphAction extends Action { + /** + * @param text + * @param htmlTag + */ + public ParagraphAction(String text, String htmlTag) { + super(text); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphStyleAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphStyleAction.java new file mode 100755 index 0000000..518c0fb --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphStyleAction.java @@ -0,0 +1,153 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jst.pagedesigner.commands.range.Paragraph; +import org.eclipse.jst.pagedesigner.commands.range.ParagraphApplyStyleCommand; +import org.eclipse.jst.pagedesigner.commands.range.ParagraphFinder; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class ParagraphStyleAction extends DesignerToolBarAction { + private String _tagName; + + private Node _applyingNode; + + /** + * @param text + * @param name + * @param image + * @param style + */ + public ParagraphStyleAction(String text, String name, + ImageDescriptor image, int style) { + super(text, style); + _tagName = name; + setImageDescriptor(image); + } + + /** + * @param text + * @param node + * @param image + * @param style + */ + public ParagraphStyleAction(String text, Node node, ImageDescriptor image, + int style) { + super(text, style); + _applyingNode = node; + setImageDescriptor(image); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.editors.actions.DesignerToolBarAction#isApplied(org.eclipse.jst.pagedesigner.dom.DOMRange) + */ + protected boolean isApplied(DOMRange range) { + Assert.isTrue(getExpectedTag() != null); + if (range != null) { + boolean ordered = range.isOrdered(); + IDOMPosition start = ordered ? range.getStartPosition() : range + .getEndPosition(); + IDOMPosition end = ordered ? range.getEndPosition() : range + .getStartPosition(); + Node common = null; + if (EditModelQuery.isSame(range)) { + ParagraphFinder finder = new ParagraphFinder(start); + Paragraph p = finder.getParagraph(start); + common = p.getLowestContainer(); + } else { + common = EditModelQuery.getInstance().getCommonAncestor(start, + end); + } + // the lowest common block parent is the container to apply style. + if (containsTag(common)) { + return true; + } + return false; + } + return false; + } + + /** + * @param common + * @return ??? + */ + protected boolean containsTag(Node common) { + // the lowest common block parent is the container to apply style. + if (_applyingNode == null) { + return common.getNodeName() != null + && getExpectedTag().equalsIgnoreCase( + common.getNodeName().toLowerCase()); + } + + String align = ((Element) _applyingNode).getAttribute("align"); //$NON-NLS-1$ + if (!(common instanceof Element)) { + return false; + } + String cAlign = ((Element) common).getAttribute("align"); //$NON-NLS-1$ + if (align == null || cAlign == null) { + return false; + } + if (align.equals(cAlign)) { + return true; + } + return false; + } + + /** + * @return Returns the _expectedTag. + */ + public String getExpectedTag() { + if (_tagName == null) { + return _applyingNode.getNodeName().toLowerCase(); + } + return _tagName.toLowerCase(); + } + + /** + * @return Returns the _applyingNode. + */ + public Element getApplyingNode() { + if (_applyingNode != null) { + return (Element) _applyingNode; + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.DesignerToolBarAction#getCommand() + */ + protected Command getCommand() { + ParagraphApplyStyleCommand command = null; + if (getApplyingNode() != null) { + command = new ParagraphApplyStyleCommand(getViewer(), + getApplyingNode(), null, null); + } else { + command = new ParagraphApplyStyleCommand(getViewer(), + getExpectedTag(), null, null); + } + return command; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphSupport.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphSupport.java new file mode 100755 index 0000000..f57425f --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/ParagraphSupport.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; + +/** + * @author mengbo + * @version 1.5 + */ +public class ParagraphSupport { + static final String[] labels = new String[] { + PDPlugin.getResourceString("ParagraphSupport.CommandLabel.None"), //$NON-NLS-1$ + PDPlugin + .getResourceString("ParagraphSupport.CommandLabel.Paragraph"), //$NON-NLS-1$ + PDPlugin + .getResourceString("ParagraphSupport.CommandLabel.Heading1"), //$NON-NLS-1$ + PDPlugin + .getResourceString("ParagraphSupport.CommandLabel.Heading2"), //$NON-NLS-1$ + PDPlugin + .getResourceString("ParagraphSupport.CommandLabel.Heading3"), //$NON-NLS-1$ + PDPlugin + .getResourceString("ParagraphSupport.CommandLabel.Heading4"),//$NON-NLS-1$ + PDPlugin + .getResourceString("ParagraphSupport.CommandLabel.Heading5"), //$NON-NLS-1$ + PDPlugin + .getResourceString("ParagraphSupport.CommandLabel.Heading6"), //$NON-NLS-1$ + PDPlugin + .getResourceString("ParagraphSupport.CommandLabel.Preformated") //$NON-NLS-1$ + }; + + static final String[] tags = new String[] { + null, + PDPlugin.getResourceString("ParagraphSupport.CommandLabel.P"), PDPlugin.getResourceString("ParagraphSupport.CommandLabel.H1"), PDPlugin.getResourceString("ParagraphSupport.CommandLabel.H2"), PDPlugin.getResourceString("ParagraphSupport.CommandLabel.H3"), PDPlugin.getResourceString("ParagraphSupport.CommandLabel.H4"), PDPlugin.getResourceString("ParagraphSupport.CommandLabel.H5"), PDPlugin.getResourceString("ParagraphSupport.CommandLabel.H6"), PDPlugin.getResourceString("ParagraphSupport.CommandLabel.PRE") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ + }; + + /** + * @param man + * @param range + * @param viewer + */ + public static void createParagraphActions(IMenuManager man, + DesignRange range, IHTMLGraphicalViewer viewer) { + ParagraphStyleAction action = new NoneParagraphStyleAction( + PDPlugin + .getResourceString("ParagraphSupport.CommandLabel.None"), tags, null, IAction.AS_CHECK_BOX); //$NON-NLS-1$ + action.setViewer(viewer); + action.update(); + man.add(action); + for (int i = 1; i < labels.length; i++) { + action = new ParagraphStyleAction(labels[i], tags[i], null, + IAction.AS_CHECK_BOX); + action.setViewer(viewer); + action.update(); + man.add(action); + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeActionGroup.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeActionGroup.java new file mode 100755 index 0000000..b92c446 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeActionGroup.java @@ -0,0 +1,207 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.actions.link.MakeLinkAction; +import org.eclipse.jst.pagedesigner.editors.PageDesignerActionConstants; +import org.eclipse.jst.pagedesigner.editors.actions.DesignActionBarFactory; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.ui.actions.ActionGroup; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class RangeActionGroup extends ActionGroup { + // TODO: what is this? a separator? + private static final Action action = new Action() { + // Action is abstract but has no abstract methods + // so create a default empty action that does nothing + }; + + /** + * + */ + public RangeActionGroup() { + super(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager) + */ + public void fillContextMenu(IMenuManager contextMenu) + { + DesignRange selection = fixUpSelection(getContext().getSelection()); + if (selection == null) { + return; + } + IContributionItem styleSubMenuItem = + contextMenu.find(PageDesignerActionConstants.STYLE_SUBMENU_ID); + + if (styleSubMenuItem instanceof IMenuManager) + { + final IMenuManager subMenu = (IMenuManager) styleSubMenuItem; + if (getContext().getInput() instanceof IHTMLGraphicalViewer) { + addParagraphFormatMenu(subMenu, selection, + (IHTMLGraphicalViewer) getContext().getInput()); + addHorizontalAlignMenu(subMenu, selection, + (IHTMLGraphicalViewer) getContext().getInput()); + addTextStyleMenu(subMenu, (IHTMLGraphicalViewer) getContext() + .getInput()); + } + // TODO: the (commented out) copy of this method does nothing + //addListModeMenu(menu, selection); + + // TODO: the (commented out) copy of this method does nothing + //addTextFontMenu(menu, selection); + + addLinkMenu(subMenu, selection); + } + } + + /** + * @param selection + * @return + */ + private DesignRange fixUpSelection(ISelection selection) { + if (selection instanceof DesignRange) { + return (DesignRange) selection; + } + return null; + } + + private void addLinkMenu(IMenuManager menu, final DesignRange selection) { + Action action1 = new MakeLinkAction(selection); + menu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE, action1); + } + + private void addTextStyleMenu(IMenuManager menu, + final IHTMLGraphicalViewer viewer) { + final IMenuManager submenu = new MenuManager(PDPlugin + .getResourceString("ActionGroup.Submenu.TextStyle"));//$NON-NLS-1$ + submenu.add(action); + + submenu.setRemoveAllWhenShown(true); + submenu.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager manager) { + DesignerToolBarAction action1 = null; + action1 = DesignActionBarFactory.getInstance().getStyleAction( + IHTMLConstants.TAG_U); + action1.setViewer(viewer); + submenu.add(action1); + + action1 = DesignActionBarFactory.getInstance().getStyleAction( + IHTMLConstants.TAG_B); + action1.setViewer(viewer); + submenu.add(action1); + + action1 = DesignActionBarFactory.getInstance().getStyleAction( + IHTMLConstants.TAG_I); + action1.setViewer(viewer); + submenu.add(action1); + + action1 = DesignActionBarFactory.getInstance().getStyleAction( + IHTMLConstants.TAG_SMALL); + action1.setViewer(viewer); + submenu.add(action1); + + action1 = DesignActionBarFactory.getInstance().getStyleAction( + IHTMLConstants.TAG_BIG); + action1.setViewer(viewer); + submenu.add(action1); + + } + }); + menu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE, submenu); + } + + /** + * @param menu + * @param selection + */ +// private void addTextFontMenu(IMenuManager menu, DesignRange selection) { +// // +// } + + /** + * @param menu + * @param selection + */ + private void addHorizontalAlignMenu(IMenuManager menu, + final DesignRange selection, final IHTMLGraphicalViewer viewer) { + // we have to initialize align nodes here for some refresh problem + Element[] alignNodes = new Element[4]; + final String[] alignValues = new String[] { "left", "center", "right", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "justify" }; //$NON-NLS-1$ + Document document = viewer.getModel().getDocument(); + for (int i = 0; i < 4; i++) { + Element node = document.createElement(IHTMLConstants.TAG_P); + node.setAttribute(IHTMLConstants.ATTR_ALIGN, alignValues[i]); + alignNodes[i] = node; + } + AlignSupport.setAlignNodes(alignNodes); + + final IMenuManager submenu = new MenuManager(PDPlugin + .getResourceString("ActionGroup.Submenu.Align"));//$NON-NLS-1$ + submenu.add(action); + submenu.setRemoveAllWhenShown(true); + submenu.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager manager) { + AlignSupport.createAlignActions(submenu, viewer); + } + }); + menu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE, submenu); + + } + + /** + * @param menu + * @param selection + */ +// private void addListModeMenu(IMenuManager menu, DesignRange selection) { +// } + + /** + * @param menu + * @param selection + */ + private void addParagraphFormatMenu(IMenuManager menu, + final DesignRange selection, final IHTMLGraphicalViewer viewer) { + final IMenuManager submenu = new MenuManager(PDPlugin + .getResourceString("ActionGroup.Submenu.ParagraphFormat"));//$NON-NLS-1$ + submenu.add(action); + // Add the submenu. + + submenu.addMenuListener(new IMenuListener() { + + public void menuAboutToShow(IMenuManager manager) { + submenu.removeAll(); + ParagraphSupport.createParagraphActions(submenu, selection, + viewer); + } + }); + menu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE, submenu); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeStyleAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeStyleAction.java new file mode 100755 index 0000000..01f4aeb --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeStyleAction.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.jface.action.Action; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; + +/** + * @author mengbo + * @version 1.5 + */ +public class RangeStyleAction extends Action { + /** + * @param text + * @param range + * @param htmlTag + * @param cssProperty + * @param cssValue + */ + public RangeStyleAction(String text, DesignRange range, String htmlTag, + String cssProperty, String cssValue) { + super(text); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.Action#run() + */ + public void run() { + if (isChecked()) { + // un-apply the style here + } else { + // apply the style here. + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeStyleSupport.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeStyleSupport.java new file mode 100755 index 0000000..31b2069 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/range/RangeStyleSupport.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.range; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; + +/** + * @author mengbo + * @version 1.5 + */ +public class RangeStyleSupport { + private static final String[] ActionLabel = new String[] { + PDPlugin.getResourceString("RangeStyleSupport.ActionLabel.Bold"),//$NON-NLS-1$ + PDPlugin.getResourceString("RangeStyleSupport.ActionLabel.Italic"),//$NON-NLS-1$ + PDPlugin + .getResourceString("RangeStyleSupport.ActionLabel.Underline"), }; //$NON-NLS-1$ + + private static final String[] HtmlTag = new String[] { "STRONG", "I", "U", }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + private static final String[] CSSProperty = new String[] { + "font-weight", "font-style", "text-decoration", }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + private static final String[] CSSValue = new String[] { "bolder", "italic", //$NON-NLS-1$ //$NON-NLS-2$ + "underline", }; //$NON-NLS-1$ + + /** + * @param menu + * @param range + */ + public static void createRangeStyleActions(IMenuManager menu, + DesignRange range) { + for (int i = 0; i < ActionLabel.length; i++) { + RangeStyleAction action = new RangeStyleAction(ActionLabel[i], + range, HtmlTag[i], CSSProperty[i], CSSValue[i]); + + menu.add(action); + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/BorderStyleAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/BorderStyleAction.java new file mode 100755 index 0000000..659c718 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/BorderStyleAction.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.eclipse.jface.action.Action; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * @author mengbo + * @version 1.5 + */ +public class BorderStyleAction extends Action { + + /** + * @param stylevalue + * @param ele + * @param text + * + */ + public BorderStyleAction(String text, IDOMElement ele, String stylevalue) { + super(text); + // TODO Auto-generated constructor stub + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeAttributeAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeAttributeAction.java new file mode 100755 index 0000000..dbbf99b --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeAttributeAction.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.eclipse.jface.action.Action; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.commands.single.ChangeAttributeCommand; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * @author mengbo + * @version 1.5 + */ +public class ChangeAttributeAction extends Action { + IDOMElement _ele; + + String _attrValue; + + private String _attrName; + + /** + * @param label + * @param ele + * @param attrName + * @param attrValue + */ + public ChangeAttributeAction(String label, IDOMElement ele, + String attrName, String attrValue) { + super(label); + this._ele = ele; + this._attrName = attrName; + this._attrValue = attrValue; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.Action#run() + */ + public void run() { + if (this.isChecked()) { + return; + } + + ChangeAttributeCommand c = new ChangeAttributeCommand( + PDPlugin + .getResourceString("ChangeAttributeAction.CommandLabel.ChangeStyleClass"), _ele, _attrName, _attrValue); //$NON-NLS-1$ + c.execute(); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeStyleAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeStyleAction.java new file mode 100755 index 0000000..84ad00b --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeStyleAction.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.eclipse.gef.EditPartViewer; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.window.Window; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.commands.single.ChangeStyleCommand; +import org.eclipse.jst.pagedesigner.parts.ElementEditPart; +import org.eclipse.jst.pagedesigner.ui.dialogs.StyleDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration; +import org.eclipse.wst.css.core.internal.util.declaration.CSSPropertyContext; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; +import org.w3c.dom.css.ElementCSSInlineStyle; + +/** + * @author mengbo + * @version 1.5 + */ +public class ChangeStyleAction extends Action { + private static final String MY_TEXT = PDPlugin + .getResourceString("ChangeStyleAction.Text"); //$NON-NLS-1$ + + private ElementEditPart _editPart; + + private IDOMElement _element; + + private String _attribute; + + /** + * @param part + * @param ele + */ + public ChangeStyleAction(ElementEditPart part, IDOMElement ele) { + this(part, ele, "style");//$NON-NLS-1$ + } + + /** + * @param part + * @param ele + * @param styleAttributeName + */ + public ChangeStyleAction(ElementEditPart part, IDOMElement ele, String styleAttributeName) { + super(MY_TEXT); + this._editPart = part; + this._element = ele; + this._attribute = styleAttributeName; + } + + public void run() { + ICSSStyleDeclaration styleDeclaration = (ICSSStyleDeclaration) ((ElementCSSInlineStyle) this._element) + .getStyle(); + PreferenceManager manager = new PreferenceManager(); + EditPartViewer viewer = this._editPart.getViewer(); + Shell shell = viewer.getControl().getShell(); + + CSSPropertyContext context = new CSSPropertyContext(styleDeclaration); + StyleDialog dialog = new StyleDialog(shell, manager, _element, context); + if (dialog.open() == Window.OK) { + if (context.isModified()) { + ChangeStyleCommand c = new ChangeStyleCommand(_element, _attribute, context); + c.execute(); + } + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeStylePropertyAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeStylePropertyAction.java new file mode 100755 index 0000000..b1ea13a --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ChangeStylePropertyAction.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.jface.action.Action; +import org.eclipse.jst.pagedesigner.commands.single.ChangeStyleCommand; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * @author mengbo + * @version 1.5 + */ +public class ChangeStylePropertyAction extends Action { + private IDOMElement _ele; + + private String _cssProperty; + + private String _cssValue; + + /** + * @param text + * @param ele + * @param cssProperty + * @param cssValue + */ + public ChangeStylePropertyAction(String text, IDOMElement ele, + String cssProperty, String cssValue) { + super(text); + this._ele = ele; + this._cssProperty = cssProperty; + this._cssValue = cssValue; + } + + public void run() { + if (isChecked()) { + return; + } + + Map map = new HashMap(); + map.put(_cssProperty, _cssValue); + ChangeStyleCommand command = new ChangeStyleCommand(_ele, map); + command.execute(); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ColorSupport.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ColorSupport.java new file mode 100755 index 0000000..b729b06 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/ColorSupport.java @@ -0,0 +1,101 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.dom.DOMStyleUtil; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * @author mengbo + * @version 1.5 + */ +/*package*/ class ColorSupport { + static final String[] COLOR_VALUES = new String[] { + "Aqua", //$NON-NLS-1$ + "Black", //$NON-NLS-1$ + "Blue", //$NON-NLS-1$ + "Fuchsia", //$NON-NLS-1$ + "Gray", //$NON-NLS-1$ + "Green", //$NON-NLS-1$ + "Lime", //$NON-NLS-1$ + "Maroon", //$NON-NLS-1$ + "Navy", //$NON-NLS-1$ + "Olive", //$NON-NLS-1$ + "Orange", //$NON-NLS-1$ + "Purple", //$NON-NLS-1$ + "Red", //$NON-NLS-1$ + "Silver", //$NON-NLS-1$ + "Teal", //$NON-NLS-1$ + "White", //$NON-NLS-1$ + "Yellow" //$NON-NLS-1$ + }; + static final String[] COLOR_MENU_LABELS = new String[] { + PDPlugin.getResourceString("ColorSupport.CommandLabel.Aqua"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Black"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Blue"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Fuchsia"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Gray"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Green"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Lime"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Maroon"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Navy"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Olive"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Orange"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Purple"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Red"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Silver"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Teal"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.White"), //$NON-NLS-1$ + PDPlugin.getResourceString("ColorSupport.CommandLabel.Yellow") //$NON-NLS-1$ +}; + + /** + * + * @param menu + * @param ele + * @param cssProperty + * will be "color" or "background-color" + */ + static void createColorActions(IMenuManager menu, IDOMElement ele, + String cssProperty) { + boolean needAdditional = true; + String currentValue = DOMStyleUtil.getInlineStyleProperty(ele, + cssProperty); + ChangeStylePropertyAction defaultAction = new ChangeStylePropertyAction( + PDPlugin.getResourceString("ColorSupport.CommandLabel.Default"), ele, cssProperty, null); //$NON-NLS-1$ + if (currentValue == null || currentValue.length() == 0) { + defaultAction.setChecked(true); + needAdditional = false; + } + menu.add(defaultAction); + menu.add(new Separator()); + for (int i = 0; i < COLOR_VALUES.length; i++) { + ChangeStylePropertyAction action = new ChangeStylePropertyAction( + COLOR_MENU_LABELS[i], ele, cssProperty, COLOR_VALUES[i]); + if (COLOR_VALUES[i].equalsIgnoreCase(currentValue)) { + action.setChecked(true); + needAdditional = false; + } + menu.add(action); + } + + if (needAdditional) { + ChangeStylePropertyAction action = new ChangeStylePropertyAction( + currentValue, ele, cssProperty, currentValue); + action.setChecked(true); + menu.add(action); + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/Messages.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/Messages.java new file mode 100755 index 0000000..b580f05 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/Messages.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2008 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 + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.eclipse.osgi.util.NLS; + +/** + * String resource handler + * + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.jst.pagedesigner.actions.single.messages"; //$NON-NLS-1$ + + /** + * see messages.properties + */ + public static String SelectParentAction_MenuTextNoParent; + /** + * see messages.properties + */ + public static String SelectParentAction_MenuTextParent; + /** + * see messages.properties + */ + public static String SingleElementActionGroup_ChildrenActionText; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + // + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectEditPartAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectEditPartAction.java new file mode 100755 index 0000000..9c5db58 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectEditPartAction.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.eclipse.gef.EditPart; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.StructuredSelection; + +/** + * @author mengbo + * @version 1.5 + */ +public abstract class SelectEditPartAction extends Action { + + /** + * @param text + * @param forThisPart + * @return a convience object when the edit part that needs selection + * is already known when the action is constructed + */ + public static SelectEditPartAction create(final String text, final EditPart forThisPart) + { + return new SelectEditPartAction(text) + { + protected EditPart getNewSelection() { + return forThisPart; + } + }; + } + + /** + * @param text + */ + protected SelectEditPartAction(String text) { + super(text); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.Action#run() + */ + public void run() { + final EditPart newSelection = getNewSelection(); + newSelection.getViewer().setSelection(new StructuredSelection(newSelection)); + } + + /** + * @return the EditPart onto which selection should be applied. + */ + protected abstract EditPart getNewSelection(); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectNodeAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectNodeAction.java new file mode 100755 index 0000000..ac0c14e --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectNodeAction.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2001, 2007 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 + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.w3c.dom.Node; + +/** + * An edit part selection action that corresponds to a Node selection + */ +public abstract class SelectNodeAction extends SelectEditPartAction +{ + private final Node _node; + + /** + * @param text + * @param curNode + */ + protected SelectNodeAction(String text, Node curNode) { + super(text); + _node = curNode; + } + + /** + * @return the current node + */ + protected Node getNode() { + return _node; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectParentAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectParentAction.java new file mode 100755 index 0000000..59d48a5 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SelectParentAction.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2001, 2007 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 + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.eclipse.gef.EditPart; +import org.eclipse.osgi.util.NLS; +import org.w3c.dom.Node; + +/** + * Given a target node/edit part change selection to its parent + * + * @author cbateman + * + */ +public class SelectParentAction extends SelectNodeAction { + + private final EditPart _editPart; + + /** + * @param node + * @param editPart + * @return an action that will change focus selection to the parent + * part of node/editPart or a disabled one if there is no parent + */ + public static SelectParentAction create(Node node, EditPart editPart) + { + Node parent = node.getParentNode(); + + if (parent != null) + { + final String text = NLS.bind(Messages.SelectParentAction_MenuTextParent, parent.getNodeName()); + return new SelectParentAction(text, node, editPart); + } + SelectParentAction action = new SelectParentAction(Messages.SelectParentAction_MenuTextNoParent, node, editPart); + action.setEnabled(false); + return action; + } + + private SelectParentAction(String text, Node node, EditPart editPart) + { + super(text, node); + _editPart = editPart; + } + + /* (non-Javadoc) + * @see org.eclipse.jst.pagedesigner.actions.single.SelectEditPartAction#getNewSelection() + */ + protected EditPart getNewSelection() + { + return _editPart.getParent(); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SingleElementActionGroup.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SingleElementActionGroup.java new file mode 100755 index 0000000..64eb0bd --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/SingleElementActionGroup.java @@ -0,0 +1,240 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.gef.EditPart; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.css2.property.ICSSPropertyID; +import org.eclipse.jst.pagedesigner.dom.DOMStyleUtil; +import org.eclipse.jst.pagedesigner.editors.PageDesignerActionConstants; +import org.eclipse.jst.pagedesigner.elementedit.IElementEdit; +import org.eclipse.jst.pagedesigner.parts.ElementEditPart; +import org.eclipse.ui.actions.ActionGroup; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; +import org.w3c.dom.Element; + +/** + * Group that constructs context menu items for a single selected element. + * + * @author mengbo + * @version 1.5 + */ +public class SingleElementActionGroup extends ActionGroup { + // TODO: why? + private static final Action action = new Action() { + // create a default instance that does nothing + // Action is abstract but has no abstract methods + // run() on this object is a NOOP + }; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager) + */ + public void fillContextMenu(IMenuManager menu) { + ElementEditPart part = fixUpSelection(getContext().getSelection()); + if (part == null) { + return; + } + IDOMElement ele = (IDOMElement) part.getIDOMNode(); + addPositionRelativeMenu(menu, part, ele); + addStylelMenu(menu, part, ele); + + // next add element special actions + IElementEdit elementEdit = part.getElementEdit(); + if (elementEdit != null) { + elementEdit.fillContextMenu(menu, ele); + } + } + + /** + * @param selection + * @return + */ + private ElementEditPart fixUpSelection(ISelection selection) { + if (selection instanceof IStructuredSelection) { + IStructuredSelection sel = (IStructuredSelection) selection; + if (sel.size() != 1) { + return null; + } + if (sel.getFirstElement() instanceof ElementEditPart) { + return (ElementEditPart) sel.getFirstElement(); + } + } + return null; + } + + /** + * Add menu actions that select relative to the current position + * + * @param menu + * @param part + * @param ele + */ + private void addPositionRelativeMenu(IMenuManager menu, ElementEditPart part, IDOMElement ele) + { + IContributionItem subMenuItem = menu.find(PageDesignerActionConstants.SELECT_SUBMENU_ID); + + if (subMenuItem instanceof IMenuManager) + { + final IMenuManager subMenu = (IMenuManager) subMenuItem; + // final IMenuManager selectMenu = new MenuManager(PDPlugin + // .getResourceString("ActionGroup.Submenu.SelectRelative"));//$NON-NLS-1$ + SelectParentAction selectParentAction = SelectParentAction.create(ele, part); + // Eclipse UI guideline: 6.13 + // even if there is no parent, a disabled action will be returned by + // create and this should be added to the menu + subMenu.add(selectParentAction); + + List children = new ArrayList(); + for (Iterator it = part.getChildren().iterator(); it.hasNext();) + { + EditPart childPart = (EditPart) it.next(); + + // only include selectable element edit part that are modelling + // XML elements in the source doc + if (childPart instanceof ElementEditPart + && ((ElementEditPart)childPart).isSelectable() + && ((ElementEditPart)childPart).getModel() instanceof Element) + { + children.add(SelectNodeAction + .create(((Element)((ElementEditPart)childPart).getModel()).getNodeName(), childPart)); + } + } + + + // don't add the select Children menu unless there are actually children + if (children.size() > 0) + { + MenuManager selectChildMenu = new MenuManager(Messages.SingleElementActionGroup_ChildrenActionText); + subMenu.add(selectChildMenu); + + for (final Iterator it = children.iterator(); it.hasNext();) + { + selectChildMenu.add((Action)it.next()); + } + } + else + { // Eclipse UI guideline 6.13 + // create the child actions even if no children but make it + // a disabled option if no children + Action childrenAction = new Action(Messages.SingleElementActionGroup_ChildrenActionText){/* do nothing*/}; + childrenAction.setEnabled(false); + subMenu.add(childrenAction); + } + } + } + + /** + * @param menu + * @param part + */ + private void addStylelMenu(IMenuManager menu, ElementEditPart part, + IDOMElement ele) { + IContributionItem subMenu = + menu.find(PageDesignerActionConstants.STYLE_SUBMENU_ID); + + if (subMenu instanceof IMenuManager) + { + final IMenuManager subMenuManager = + (IMenuManager) subMenu; + addStyle(subMenuManager, part, ele); + addStyleClassesMenu(subMenuManager, part, ele); + + if (DOMStyleUtil.supportStyleAttribute(ele)) { + // addBorderStyleMenu(stylesub, part, ele); + addColorMenu(subMenuManager, part, ele); + addBackgroundMenu(subMenuManager, part, ele); + } + } + } + + /** + * + * @param menu + * @param part + * @param ele + */ + private void addStyle(IMenuManager subMenu, ElementEditPart part, + IDOMElement ele) { + StyleSupport.createStyleAction(subMenu, part, ele); + } + + /** + * @param stylesub + * @param part + */ + private void addStyleClassesMenu(IMenuManager subMenu, + ElementEditPart part, final IDOMElement ele) { + final IMenuManager classmenu = new MenuManager(PDPlugin + .getResourceString("ActionGroup.Submenu.StyleClasses"));//$NON-NLS-1$ + StyleClassSupport.createStyleClassActions(classmenu, ele); + + subMenu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE, + classmenu); + } + + /** + * @param stylesub + * @param part + */ + private void addColorMenu(IMenuManager subMenu, ElementEditPart part, + final IDOMElement ele) { + final IMenuManager colorSub = new MenuManager(PDPlugin + .getResourceString("ActionGroup.Submenu.Color"));//$NON-NLS-1$ + colorSub.add(action); + colorSub.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager manager) { + colorSub.removeAll(); + ColorSupport.createColorActions(colorSub, ele, + ICSSPropertyID.ATTR_COLOR); + } + }); + subMenu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE, + colorSub); + + } + + /** + * @param stylesub + * @param part + */ + private void addBackgroundMenu(IMenuManager subMenu, ElementEditPart part, + final IDOMElement ele) { + final IMenuManager colorSub = new MenuManager(PDPlugin + .getResourceString("ActionGroup.Submenu.BackgroundColor"));//$NON-NLS-1$ + colorSub.add(action); + colorSub.addMenuListener(new IMenuListener() { + + public void menuAboutToShow(IMenuManager manager) { + colorSub.removeAll(); + ColorSupport.createColorActions(colorSub, ele, + ICSSPropertyID.ATTR_BACKGROUND_COLOR); + } + }); + + subMenu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE, + colorSub); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/StyleClassSupport.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/StyleClassSupport.java new file mode 100755 index 0000000..6877747 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/StyleClassSupport.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jst.jsf.core.internal.tld.CMUtil; +import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.css2.CSSUtil; +import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * @author mengbo + * @version 1.5 + */ +public class StyleClassSupport { + private final static String DEFAULT = PDPlugin + .getResourceString("StyleClassSupport.Default"); //$NON-NLS-1$ + + /** + * @param classmenu + * @param ele + */ + public static void createStyleClassActions(IMenuManager classmenu, + IDOMElement ele) { + String styleClassAttr = getStyleClassAttributeName(ele); + if (styleClassAttr == null) { + return; // don't support style class + } + String styleClass = getStyleClass(ele); + + boolean needAdditional = true; + ChangeAttributeAction action = new ChangeAttributeAction(DEFAULT, ele, + styleClassAttr, null); + if (styleClass == null || styleClass.length() == 0) { + action.setChecked(true); + needAdditional = false; + } + classmenu.add(action); + String[] classes = CSSUtil.getCSSClasses(ele.getOwnerDocument()); + if (classes.length > 0) { + classmenu.add(new Separator()); + } + for (int i = 0; i < classes.length; i++) { + ChangeAttributeAction action2 = new ChangeAttributeAction( + classes[i], ele, styleClassAttr, classes[i]); + if (classes[i].equalsIgnoreCase(styleClass)) { + action2.setChecked(true); + needAdditional = false; + } + classmenu.add(action2); + } + if (needAdditional) { + ChangeAttributeAction action2 = new ChangeAttributeAction( + styleClass, ele, styleClassAttr, styleClass); + action2.setChecked(true); + classmenu.add(action2); + } + } + + /** + * @param ele + * @return the style class for ele or null if none + */ + public static String getStyleClass(IDOMElement ele) { + String styleClassAttr = getStyleClassAttributeName(ele); + if (styleClassAttr != null) { + return ele.getAttribute(styleClassAttr); + } + return null; + } + + /** + * FIXME: This is a temparary impelementation, with everything hard coded. + * In the future, should have some INodeAdapter mechanism for each node to + * tell the style class attribute name. + * + * @param ele + * @return the style class attribute name or null if none applies + */ + public static String getStyleClassAttributeName(IDOMElement ele) { + CMElementDeclaration decl = CMUtil.getElementDeclaration(ele); + if (decl == null) { + return null; + } + String taguri = CMUtil.getTagURI(decl); + if (taguri == null || ITLDConstants.URI_HTML.equals(taguri)) { + if (decl.getAttributes().getNamedItem("class") != null) { //$NON-NLS-1$ + return "class"; //$NON-NLS-1$ + } + return null; + } else if (decl.getAttributes().getNamedItem("styleClass") != null) { //$NON-NLS-1$ + return "styleClass"; //$NON-NLS-1$ + } else if (decl.getAttributes().getNamedItem("class") != null) { //$NON-NLS-1$ + return "class"; //$NON-NLS-1$ + } else { + return null; + } + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/StyleSupport.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/StyleSupport.java new file mode 100755 index 0000000..2673c6d --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/StyleSupport.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.single; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jst.jsf.core.internal.tld.CMUtil; +import org.eclipse.jst.pagedesigner.editors.PageDesignerActionConstants; +import org.eclipse.jst.pagedesigner.parts.ElementEditPart; +import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * @author mengbo + * @version 1.5 + */ +public final class StyleSupport { + /** + * @param menu + * @param part + * @param ele + */ + public static void createStyleAction(IMenuManager menu, + ElementEditPart part, IDOMElement ele) { + if (part == null) { + return; + } + if (hasStyleAttribute(ele)) { + IAction action = new ChangeStyleAction(part, ele); + menu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE, action); + } + } + + private static boolean hasStyleAttribute(IDOMElement ele) { + CMElementDeclaration decl = CMUtil.getElementDeclaration(ele); + if (decl == null) { + return false; + } + if (decl.getAttributes().getNamedItem("style") != null) { //$NON-NLS-1$ + return true; + } + return false; + } + + private StyleSupport() + { + // util class; no instantiation + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/messages.properties b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/messages.properties new file mode 100755 index 0000000..05faf2b --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/single/messages.properties @@ -0,0 +1,3 @@ +SelectParentAction_MenuTextNoParent=Parent +SelectParentAction_MenuTextParent=Parent ({0}) +SingleElementActionGroup_ChildrenActionText=Children diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/table/TableActionGroup.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/table/TableActionGroup.java new file mode 100755 index 0000000..e11de0b --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/table/TableActionGroup.java @@ -0,0 +1,196 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.table; + +import org.eclipse.gef.EditPart; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.actions.single.SelectEditPartAction; +import org.eclipse.jst.pagedesigner.editors.PageDesignerActionConstants; +import org.eclipse.jst.pagedesigner.parts.ElementEditPart; +import org.eclipse.jst.pagedesigner.range.RangeUtil; +import org.eclipse.jst.pagedesigner.tableedit.DeleteRowColumnAction; +import org.eclipse.jst.pagedesigner.tableedit.InsertRowColumnAction; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.ui.actions.ActionGroup; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * + * @author mengbo + * @version 1.5 + */ +/*package*/ class TableActionGroup extends ActionGroup { + // TODO: I think there's a pattern emerging... + private final static Action action = new Action() { + // create an empty no-op + }; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager) + */ + public void fillContextMenu(IMenuManager menu) { + ISelection selection = this.getContext().getSelection(); + + EditPart part = findCommonAncesterPart(selection); + if (part == null) { + return; + } + + TableOperationContext context = TableOperationContext + .getTableOperationContext(part); + if (context == null) { + return; + } + + final ElementEditPart tablePart = context.getTablePart(); + + if (tablePart == null || !supportTableActions(tablePart)) { + return; + } + + final int cellRow = context.getRowIndex(); + final int cellColumn = context.getColumnIndex(); + + String tag = ((IDOMElement) tablePart.getIDOMNode()).getLocalName(); + final IMenuManager tableMenu = new MenuManager(tag); + + // ok, we passed the checking, now let's create the actions. + tableMenu.add(action); + tableMenu.addMenuListener(new IMenuListener() { + + public void menuAboutToShow(IMenuManager manager) { + tableMenu.removeAll(); + fillTableMenu(tablePart, cellRow, cellColumn, tableMenu); + } + }); + menu.appendToGroup(PageDesignerActionConstants.GROUP_CONTAINER, + tableMenu); + } + + /** + * @param tablePart + * @param cellRow + * @param cellColumn + * @param tableMenu + */ + private void fillTableMenu(ElementEditPart tablePart, int cellRow, + int cellColumn, IMenuManager tableMenu) { + SelectEditPartAction action1 = SelectEditPartAction.create( + PDPlugin + .getResourceString("TableActionGroup.Submenu.SelectTable"), tablePart);//$NON-NLS-1$ + tableMenu.add(action1); + + tableMenu.add(new Separator()); + + { + InsertRowColumnAction insertRowBeforeAction = new InsertRowColumnAction( + PDPlugin + .getResourceString("TableActionGroup.Submenu.InsertRowBefore"),//$NON-NLS-1$ + tablePart, cellRow, true, true); + tableMenu.add(insertRowBeforeAction); + + InsertRowColumnAction insertRowAfterAction = new InsertRowColumnAction( + PDPlugin + .getResourceString("TableActionGroup.Submenu.InsertRowAfter"),//$NON-NLS-1$ + tablePart, cellRow, true, false); + tableMenu.add(insertRowAfterAction); + + tableMenu.add(new Separator()); + } + + { + InsertRowColumnAction insertColumnBeforeAction = new InsertRowColumnAction( + PDPlugin + .getResourceString("TableActionGroup.Submenu.InsertColumnBefore"),//$NON-NLS-1$ + tablePart, cellColumn, true, true); + tableMenu.add(insertColumnBeforeAction); + + InsertRowColumnAction insertColumnAfterAction = new InsertRowColumnAction( + PDPlugin + .getResourceString("TableActionGroup.Submenu.InsertColumnAfter"),//$NON-NLS-1$ + tablePart, cellColumn, true, false); + tableMenu.add(insertColumnAfterAction); + + tableMenu.add(new Separator()); + } + + { + DeleteRowColumnAction deleteRowAction = new DeleteRowColumnAction( + PDPlugin + .getResourceString("TableActionGroup.Submenu.DeleteRow"),//$NON-NLS-1$ + tablePart, cellRow, true); + tableMenu.add(deleteRowAction); + + DeleteRowColumnAction deleteColumnAction = new DeleteRowColumnAction( + PDPlugin + .getResourceString("TableActionGroup.Submenu.DeleteColumn"),//$NON-NLS-1$ + tablePart, cellColumn, false); + tableMenu.add(deleteColumnAction); + } + } + + /** + * @param tablePart + * @return + */ + private boolean supportTableActions(ElementEditPart tablePart) { + // TODO: what's the point of this method? + // it's only used in one place and always resolves to the same value.. + return true; + } + + /** + * Give a selection, find a single common container node as start for table + * related operations. + * + * @param selection + * @return + */ + private EditPart findCommonAncesterPart(ISelection selection) { + if (selection instanceof IStructuredSelection) { + IStructuredSelection structsel = (IStructuredSelection) selection; + if (structsel.size() != 1) { + return null; + } else if (structsel.getFirstElement() instanceof EditPart) { + return (EditPart) structsel.getFirstElement(); + } else { + return null; + } + } else if (selection instanceof DesignRange) { + DesignRange range = (DesignRange) selection; + if (!range.isValid()) { + return null; + } + if (range.isEmpty()) { + DesignPosition position = range.getStartPosition(); + if (position.getOffset() == 0) { + return position.getContainerPart(); + } + return position.getSiblingEditPart(true); + } + return RangeUtil.findCommonAncestor(range); + } else { + return null; + } + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/table/TableOperationContext.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/table/TableOperationContext.java new file mode 100755 index 0000000..6473545 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/actions/table/TableOperationContext.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.actions.table; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.jst.pagedesigner.css2.layout.CSSFigure; +import org.eclipse.jst.pagedesigner.css2.layout.table.CSSTableCellLayout; +import org.eclipse.jst.pagedesigner.css2.layout.table.CSSTableLayout2; +import org.eclipse.jst.pagedesigner.css2.layout.table.TableCellInfo; +import org.eclipse.jst.pagedesigner.parts.ElementEditPart; + +/** + * + * @author mengbo + * @version 1.5 + */ +/*package*/ class TableOperationContext { + private ElementEditPart _tablePart; + + private int _rowIndex; + + private int _columnIndex; + + /** + * @param part + * @return the operation context for part + */ + public static TableOperationContext getTableOperationContext(EditPart part) { + EditPart originalPart = part; + ElementEditPart tablePart = null; + CSSTableLayout2 tableLayout = null; + + while (part.getParent() instanceof ElementEditPart) { + part = part.getParent(); + IFigure figure = ((GraphicalEditPart) part).getFigure(); + + if (figure.getLayoutManager() instanceof CSSTableLayout2) { + tableLayout = (CSSTableLayout2) figure.getLayoutManager(); + tablePart = ((ElementEditPart) part); + break; + } + } + if (tablePart == null) { + return null; + } + + part = originalPart; + + IFigure figure = ((GraphicalEditPart) originalPart).getFigure(); + while (figure instanceof CSSFigure) { + if (figure.getLayoutManager() instanceof CSSTableCellLayout) { + CSSTableCellLayout cellLayout = (CSSTableCellLayout) figure + .getLayoutManager(); + if (cellLayout.getTableLayout() == tableLayout) { + // ok, we found. + TableCellInfo cellInfo = cellLayout.getTableCellInfo(); + if (cellInfo == null) { + return null; + } + TableOperationContext context = new TableOperationContext(); + context._tablePart = tablePart; + context._rowIndex = cellInfo.getRowIndex(); + context._columnIndex = cellInfo.getColumnIndex(); + return context; + } + return null; + } + figure = figure.getParent(); + } + return null; + } + + ElementEditPart getTablePart() { + return _tablePart; + } + + int getRowIndex() { + return _rowIndex; + } + + int getColumnIndex() { + return _columnIndex; + } + + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/adapters/IBodyInfo.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/adapters/IBodyInfo.java new file mode 100755 index 0000000..0bcd646 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/adapters/IBodyInfo.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.adapters; + +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; + +/** + * This is an adapter interface. Will be adapted to all the node in the + * document. It provides additional information to support designer. + * + * Basicaly it tells the correspoinding node's body related information. + * + * @author mengbo + */ +// XXX: in the future will use adapter mechanism to support dynamic information +public interface IBodyInfo // extends INodeAdapter +{ + // /** + // * whether this node is runtime visible. + // * + // * @return + // */ + // public boolean isRuntimeVisible(INodeNotifier node); + // + // /** + // * whether this node is design time visible. + // * @return + // */ + // public boolean isDesignTimeVisible(INodeNotifier node); + + // /** + // * whether is HTML tag. + // * @param node + // * @return + // */ + // public boolean isHTML(IDOMNode node); + // + // /** + // * whether is JSP tag. + // * @param node + // * @return + // */ + // public boolean isJSP(IDOMNode node); + // + // /** + // * whether is custom tag. + // * @param node + // * @return + // */ + // public boolean isCustomTag(IDOMNode node); + // + // /** + // * for custom tag, there may have a corresponding HTML tag name. + // * This can be used for content model validation. + // * + // * @param node + // * @return + // */ + // public String getCorrespondingHTMLTag(IDOMNode node); + + /** + * whether this node is body node. We treat the document node and certain + * element node like "HTML", "BODY", "f:view", "f:subview" as body node. At + * design time we may want to move those visual node into the body. + * + * @param node + * @return true if node is a body container + */ + public boolean isBodyContainer(IDOMNode node); + + /** + * this method should only be called isBodyContainer return true; It checks + * whether the uri/localname should belong to the head part of this body + * container. + * + * @param node + * @param uri + * @param localname + * @return true if node is a header + */ + public boolean isBodyHeader(IDOMNode node, String uri, String localname); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/adapters/internal/BodyInfo.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/adapters/internal/BodyInfo.java new file mode 100755 index 0000000..da090aa --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/adapters/internal/BodyInfo.java @@ -0,0 +1,134 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.adapters.internal; + +import org.eclipse.jst.jsf.core.internal.tld.CMUtil; +import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; +import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.adapters.IBodyInfo; +import org.eclipse.jst.pagedesigner.jsp.core.IJSPCoreConstants; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +// XXX: currently hard coded as singleton implementation, +// it is believed in the future will not use singleton, because +// we want to dynamically support other taglibs. +public class BodyInfo implements IBodyInfo { + private static final BodyInfo _instance = new BodyInfo(); + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.adapters.IDesignInfo#isBodyContainer(org.eclipse.wst.sse.core.internal.provisional.INodeNotifier) + */ + public boolean isBodyContainer(IDOMNode node) { + switch (node.getNodeType()) { + case Node.DOCUMENT_FRAGMENT_NODE: + case Node.DOCUMENT_NODE: + return true; + case Node.ELEMENT_NODE: + return isBodyContainerElement((Element) node); + default: + return false; + } + } + + /** + * @param element + * @return + */ + private boolean isBodyContainerElement(Element element) { + String localname = element.getLocalName(); + /* + * String namespaceURI = CMUtil.getElementNamespaceURI(element); if + * (IJMTConstants.URI_HTML.equals(namespaceURI)) { return + * "html".equalsIgnoreCase(localname) || + * "body".equalsIgnoreCase(localname); } if + * (IJMTConstants.URI_JSF_CORE.equals(namespaceURI)) { return + * "view".equals(localname) || "subview".equals(localname); } + */ + return IHTMLConstants.TAG_HTML.equalsIgnoreCase(localname) + || IHTMLConstants.TAG_BODY.equalsIgnoreCase(localname) + || IJSFConstants.TAG_VIEW.equals(localname) + || IJSFConstants.TAG_SUBVIEW.equals(localname); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.adapters.IDesignInfo#isBodyHeader(org.eclipse.wst.sse.core.internal.provisional.INodeNotifier, + * java.lang.String, java.lang.String) + */ + public boolean isBodyHeader(IDOMNode node, String uri, String localname) { + switch (node.getNodeType()) { + case Node.DOCUMENT_FRAGMENT_NODE: + case Node.DOCUMENT_NODE: + return isDocumentHeader(uri, localname); + case Node.ELEMENT_NODE: + return isElementHeader((Element) node, uri, localname); + default: + return false; + } + } + + /** + * @param element + * @param uri + * @param localname + * @return + */ + private boolean isElementHeader(Element element, String uri, + String localname) { + String elelocalname = element.getLocalName(); + String namespaceURI = CMUtil.getElementNamespaceURI(element); + if (ITLDConstants.URI_HTML.equals(namespaceURI) + && IHTMLConstants.TAG_HTML.equalsIgnoreCase(elelocalname)) { + return IHTMLConstants.TAG_HEAD.equalsIgnoreCase(localname); + } + if (ITLDConstants.URI_JSF_CORE.equals(namespaceURI) + && IJSFConstants.TAG_VIEW.equalsIgnoreCase(elelocalname)) { + return IJSFConstants.TAG_LOADBUNDLE.equalsIgnoreCase(localname); + } + return false; + } + + /** + * @param uri + * @param localname + * @return + */ + private boolean isDocumentHeader(String uri, String localname) { + // FIXME: temparary commented out, since the dragged node do not have + // uri information for now. + // if (IJMTConstants.URI_JSP.equals(uri)) + return IJSPCoreConstants.TAG_DIRECTIVE_PAGE.equals(localname) + || IJSPCoreConstants.TAG_DIRECTIVE_TAGLIB.equals(localname); + + } + + /** + * @return the singleton + */ + public static IBodyInfo getInstance() { + return _instance; + } + + private BodyInfo() + { + // no external instantiation + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CloneNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CloneNodeCommand.java new file mode 100755 index 0000000..8eff313 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CloneNodeCommand.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.dom.DOMUtil; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Node; + +/** + * This is when user control+mouse drag. Can also be used in other places. + * + * @author mengbo + * @version 1.5 + */ +public class CloneNodeCommand extends DesignerCommand { + IDOMPosition _insertPosition; + + Node _originalNode; + + Node _resultNode; + + /** + * @param viewer + * @param insertionPoint + * @param originalNode + */ + public CloneNodeCommand(IHTMLGraphicalViewer viewer, + IDOMPosition insertionPoint, Node originalNode) { + super( + CommandResources.getString("CloneNodeCommand.Label.CloneNode"), viewer); //$NON-NLS-1$ + this._insertPosition = insertionPoint; + this._originalNode = originalNode; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + Node newNode = DOMUtil.cloneNodeDeep(this.getDocument(), _originalNode); + DOMUtil.insertNode(_insertPosition, newNode); + _resultNode = newNode; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(_resultNode); + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CommandResources.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CommandResources.java new file mode 100755 index 0000000..bd1685b --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CommandResources.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * @author mengbo + * @version 1.5 + */ +public class CommandResources { + private static final String BUNDLE_NAME = "org.eclipse.jst.pagedesigner.commands.CommandResources"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private CommandResources() { + // no local instantiation + } + + /** + * @param key + * @return the resource value for key or !key! if not foudnd + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CommandResources.properties b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CommandResources.properties new file mode 100755 index 0000000..1e8f646 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CommandResources.properties @@ -0,0 +1,33 @@ +############################################################################### +# Copyright (c) 2001, 2007 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 +############################################################################### +PasteNodeCommand.Label.DeleteNode=Delete Node +CutNodeCommand.Label.CutNode=Cut Node +DeleteNodeCommand.Label.DeleteNode=Delete Node +DeleteAction.CommandLabel.Delete=Delete +TableDeleteColumnCommand.Label.DeleteColumn=Delete Column +TableInsertColumnCommand.Label.InsertColumn=Insert Column +TableResizeColumnCommand.Label.ResizeColumn=Resize Column +TableInsertColumnCommand.Text.Default=Cell +TableResizeRowCommand.Label.ResizeColumn=Resize Column +TableDeleteRowCommand.Label.DeleteRow=Delete Row +TableInsertRowCommand.Label.InsertRow=Insert Row +TableDeleteHeaderFooterCommand.Label.DeleteHeader=Delete Header +TableDeleteHeaderFooterCommand.Label.DeleteFooter=Delete Footer +TableInsertHeaderFooterCommand.Label.InsertHeader=Insert Header +TableInsertHeaderFooterCommand.Label.InsertFooter=Insert Footer +PasteCommand.Label.Paste=Paste +DeleteCommand.Label.Delete=Delete +CutCommand.Label.Cut=Cut +CopyCommand.Label.Copy=Copy +ApplyStyleCommand.Label.ApplyStyle=Apply Style +ChangeStyleCommand.Label.ChangeStyle=Change Style +MoveNodeCommand.Label.MoveNode=Move Node +CloneNodeCommand.Label.CloneNode=Copy Node diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CopyAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CopyAction.java new file mode 100755 index 0000000..0b52aec --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CopyAction.java @@ -0,0 +1,74 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.ui.actions.UpdateAction; +import org.eclipse.gef.ui.parts.GraphicalEditor; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.commands.range.CopyCommand; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; + +/** + * @author mengbo + */ +public class CopyAction extends DesignAction implements UpdateAction { + /** + * @param editor + */ + public CopyAction(GraphicalEditor editor) { + super(editor, PDPlugin.getResourceString("Action.Name.Copy"));//$NON-NLS-1$ + // this.setAccelerator(SWT.CTRL | SWT.INSERT); + // this.setActionDefinitionId(ITextEditorActionDefinitionIds.CUT); + } + + public void perform() { + DesignerCommand command = null; + IHTMLGraphicalViewer viewer = getViewer(); + if (viewer.isInRangeMode()) { + command = new CopyCommand(viewer); + command.execute(); + } else { + Command nodeCopy = new CopyNodeCommand(viewer); + nodeCopy.execute(); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#isEnabled() + */ + public boolean isEnabled() { + IHTMLGraphicalViewer viewer = getViewer(); + if (viewer != null) { + if (viewer.isInRangeMode() + && !EditModelQuery.isSame(viewer.getRangeSelection())) { + return true; + } else if (!viewer.isInRangeMode() + && viewer.getSelectedEditParts().size() > 0) { + return true; + } + } + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.ui.actions.UpdateAction#update() + */ + public void update() { + this.setEnabled(isEnabled()); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CopyNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CopyNodeCommand.java new file mode 100755 index 0000000..3ffa4ca --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CopyNodeCommand.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import java.util.List; +import java.util.Vector; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.dnd.TemplateTransfer; +import org.eclipse.jst.pagedesigner.dom.EditValidateUtil; +import org.eclipse.jst.pagedesigner.utils.DOMUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.w3c.dom.Node; + +/** + * As copy operation won't change anything in the current document, so it is not + * extending from DesignerCommand. + * + * @author mengbo + */ +public class CopyNodeCommand extends Command { + private IHTMLGraphicalViewer _viewer; + + /** + * @param viewer + */ + public CopyNodeCommand(IHTMLGraphicalViewer viewer) { + super(""); //$NON-NLS-1$ + this._viewer = viewer; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + public void execute() { + List parts = _viewer.getSelectedEditParts(); + Vector result = new Vector(); + if (parts.size() > 0) { + for (int i = 0, n = parts.size(); i < n; i++) { + EditPart part = (EditPart) parts.get(i); + Object model = part.getModel(); + if (model instanceof Node) { + EditValidateUtil.validNode((Node) model); + result.add(((Node) model).cloneNode(true)); + } + } + setClipboard(result); + } + } + + private void setClipboard(Vector result) { + Node[] nodes = (Node[]) result.toArray(new Node[result.size()]); + StringBuffer sb = new StringBuffer(); + for (int i = 0, size = nodes.length; i < size; i++) { + DOMUtil.nodeToString(nodes[i], sb); + } + // TemplateTransfer.getInstance().setObject(result); + Clipboard board = new Clipboard(_viewer.getControl().getDisplay()); + board.setContents(new Object[] { result, sb.toString() }, + new Transfer[] { TemplateTransfer.getInstance(), + TextTransfer.getInstance() }); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CreateItemCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CreateItemCommand.java new file mode 100755 index 0000000..be1019c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CreateItemCommand.java @@ -0,0 +1,134 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.editors.palette.IDropSourceData; +import org.eclipse.jst.pagedesigner.utils.CommandUtil; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; +import org.w3c.dom.Element; + +/** + * @author mengbo + */ +public class CreateItemCommand extends DesignerCommand implements ICustomizableCommand +{ + private final IDOMPosition _position; + private final IDropSourceData _creationProvider; + private Element _ele; + private IAdaptable _customizationData; + + /** + * @param label + * @param model + * @param position + * @param creationProvider + */ + public CreateItemCommand(String label, IDOMModel model, + IDOMPosition position, IDropSourceData creationProvider) { + super(label, model.getDocument()); + this._position = position; + this._creationProvider = creationProvider; + } + + /** + * @return the dom position for the drop + */ + public IDOMPosition getPosition() + { + return _position; + } + + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() + { + Element element = CommandUtil.executeInsertion( + _creationProvider, + getModel(), this._position, this._customizationData); + if (element != null) + { + formatNode(element); + } + this._ele = element; + } + + @Override + protected void postPostExecute() + { + // during JUnit testing, we may not have viewer. + // this will cause us not to have undo support, + // but should not effect testing for this command + if (getViewer() != null) + { + super.postPostExecute(); + } + } + + @Override + protected boolean prePreExecute() + { + // during JUnit testing, we may not have viewer. + // this will cause us not to have undo support, + // but should not effect testing for this command + if (getViewer() != null) + { + return super.prePreExecute(); + } + + return true; + } + + /* + * (non-Javadoc) + * + * @seeorg.eclipse.jst.pagedesigner.commands.DesignerCommand# + * getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(_ele); + } + + /** + * @param customizationData + */ + public void setCustomizationData(IAdaptable customizationData) + { + _customizationData = customizationData; + } + + /** + * This method is for test purposes and should generally not be + * used by clients. + * + * @return the customization data + */ + protected final IAdaptable getCustomizationData() + { + return _customizationData; + } + + /** + * @return the result of the command execution + * TODO: add Object getResult() method to DesignerCommand + */ + protected Element getResult() + { + return this._ele; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CutAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CutAction.java new file mode 100755 index 0000000..2b4b723 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CutAction.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.gef.ui.actions.UpdateAction; +import org.eclipse.gef.ui.parts.GraphicalEditor; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.commands.range.CutCommand; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; + +/** + * @author mengbo + */ +public class CutAction extends DesignAction implements UpdateAction { + /** + * @param editor + */ + public CutAction(GraphicalEditor editor) { + super(editor, PDPlugin.getResourceString("Action.Name.Cut"));//$NON-NLS-1$ + } + + public void perform() { + DesignerCommand command = null; + IHTMLGraphicalViewer viewer = getViewer(); + if (viewer.isInRangeMode()) { + command = new CutCommand(viewer); + command.execute(); + } else { + command = new CutNodeCommand(viewer); + command.execute(); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#isEnabled() + */ + public boolean isEnabled() { + IHTMLGraphicalViewer viewer = getViewer(); + if (viewer != null) { + if (viewer.isInRangeMode() + && !EditModelQuery.isSame(viewer.getRangeSelection())) { + return true; + } else if (!viewer.isInRangeMode() + && viewer.getSelectedEditParts().size() > 0) { + return true; + } + } + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.ui.actions.UpdateAction#update() + */ + public void update() { + setEnabled(isEnabled()); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CutNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CutNodeCommand.java new file mode 100755 index 0000000..3cdf8fa --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/CutNodeCommand.java @@ -0,0 +1,81 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import java.util.List; +import java.util.Vector; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.dnd.TemplateTransfer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.dom.EditValidateUtil; +import org.eclipse.jst.pagedesigner.utils.DOMUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class CutNodeCommand extends DesignerCommand { + private static final String COMMAND_LABEL = CommandResources + .getString("CutNodeCommand.Label.CutNode"); //$NON-NLS-1$ + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + List parts = getViewer().getSelectedEditParts(); + Vector result = new Vector(); + if (parts.size() > 0) { + for (int i = 0, n = parts.size(); i < n; i++) { + EditPart part = (EditPart) parts.get(i); + Object model = part.getModel(); + if (model instanceof Node) { + EditValidateUtil.validNode((Node) model); + Node parent = ((Node) model).getParentNode(); + model = parent.removeChild((Node) model); + result.add(model); + } + } + setClipboard(result); + } + } + + protected ISelection getAfterCommandDesignerSelection() { + return null; + } + + /** + * @param viewer + */ + public CutNodeCommand(IHTMLGraphicalViewer viewer) { + super(COMMAND_LABEL, viewer); + } + + private void setClipboard(Vector result) { + Node[] nodes = (Node[]) result.toArray(new Node[result.size()]); + StringBuffer sb = new StringBuffer(); + for (int i = 0, size = nodes.length; i < size; i++) { + DOMUtil.nodeToString(nodes[i], sb); + } + // TemplateTransfer.getInstance().setObject(result); + Clipboard board = new Clipboard(_viewer.getControl().getDisplay()); + board.setContents(new Object[] { result, sb.toString() }, + new Transfer[] { TemplateTransfer.getInstance(), + TextTransfer.getInstance() }); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DeleteAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DeleteAction.java new file mode 100755 index 0000000..157f5d3 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DeleteAction.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.gef.ui.parts.GraphicalEditor; +import org.eclipse.jst.pagedesigner.commands.range.DeleteCommand; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.parts.DocumentEditPart; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; + +/** + * @author mengbo + */ +public class DeleteAction extends DesignAction { + /** + * @param editor + */ + public DeleteAction(GraphicalEditor editor) { + super(editor, CommandResources + .getString("DeleteAction.CommandLabel.Delete")); //$NON-NLS-1$ + } + + public void perform() { + DesignerCommand command = null; + IHTMLGraphicalViewer viewer = getViewer(); + if (viewer.isInRangeMode()) { + command = new DeleteCommand(true, viewer); + command.execute(); + } else { + command = new DeleteNodeCommand(viewer); + command.execute(); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#isEnabled() + */ + public boolean isEnabled() { + IHTMLGraphicalViewer viewer = getViewer(); + if (viewer != null) { + if (viewer.isInRangeMode() + && !EditModelQuery.isSame(viewer.getRangeSelection())) { + return true; + } else if (!viewer.isInRangeMode()) { + int size = viewer.getSelectedEditParts().size(); + if (size > 1) { + return true; + } else if (size == 1 + && !(viewer.getSelectedEditParts().get(0) instanceof DocumentEditPart)) { + return true; + } + } + } + return false; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DeleteNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DeleteNodeCommand.java new file mode 100755 index 0000000..3fbb929 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DeleteNodeCommand.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import java.util.List; + +import org.eclipse.gef.EditPart; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.EditHelper; +import org.eclipse.jst.pagedesigner.dom.EditValidateUtil; +import org.eclipse.jst.pagedesigner.parts.SubNodeEditPart; +import org.eclipse.jst.pagedesigner.validation.caret.ActionData; +import org.eclipse.jst.pagedesigner.validation.caret.IMovementMediator; +import org.eclipse.jst.pagedesigner.validation.caret.InlineEditingNavigationMediator; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.DesignRefPosition; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class DeleteNodeCommand extends DesignerCommand { + private static final String COMMAND_LABEL = CommandResources + .getString("DeleteNodeCommand.Label.DeleteNode"); //$NON-NLS-1$ + + private DesignRange _prevRange; + + /** + * @param viewer + */ + public DeleteNodeCommand(IHTMLGraphicalViewer viewer) { + super(COMMAND_LABEL, viewer); + } + + protected void preExecute() { + _prevRange = _viewer.getRangeSelection(); + DesignPosition position = findObjectModePosition(); + _prevRange = new DesignRange(position, position); + super.preExecute(); + } + + private DesignPosition findObjectModePosition() { + DesignPosition result = null; + IMovementMediator validator = new InlineEditingNavigationMediator( + new ActionData(ActionData.KEYBOARD_NAVAGATION, null)); + DesignPosition position = getCurrentObjectPosition(); + if (position != null) { + if (!validator.isValidPosition(position)) { + result = null; + } else { + result = position; + } + } + return result; + } + + private DesignPosition getCurrentObjectPosition() { + DesignRange result = null; + if (_viewer.isInRangeMode()) { + result = _viewer.getRangeSelection(); + } else { + List parts = _viewer.getSelectedEditParts(); + if (parts.size() > 0) { + EditPart selection = (EditPart) parts.get(0); + if (selection instanceof SubNodeEditPart) { + DesignPosition position = new DesignRefPosition(selection, + false); + position = DOMPositionHelper.toDesignPosition(EditHelper + .ensureDOMPosition(DOMPositionHelper + .toDOMPosition(position))); + result = new DesignRange(position, position); + } + } + } + return result != null && result.isValid() ? result.getEndPosition() + : null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + List parts = getViewer().getSelectedEditParts(); + for (int i = 0, n = parts.size(); i < n; i++) { + EditPart part = (EditPart) parts.get(i); + Object model = part.getModel(); + if (model instanceof Node) { + EditValidateUtil.validNode((Node) model); + Node parent = ((Node) model).getParentNode(); + model = parent.removeChild((Node) model); + } + } + } + + protected ISelection getAfterCommandDesignerSelection() { + if (_prevRange.isValid()) { + return _prevRange; + } + return null; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignAction.java new file mode 100755 index 0000000..99ae417 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignAction.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.gef.ui.actions.UpdateAction; +import org.eclipse.gef.ui.parts.GraphicalEditor; +import org.eclipse.jface.action.Action; +import org.eclipse.jst.pagedesigner.editors.IDesignViewer; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; + +/** + * @author mengbo + */ +public abstract class DesignAction extends Action implements UpdateAction { + private GraphicalEditor _editor; + + /** + * @param editor + * @param text + */ + public DesignAction(GraphicalEditor editor, String text) { + super(text); + _editor = editor; + } + + /** + * @return Returns the _editor. + */ + protected GraphicalEditor getEditor() { + return _editor; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + perform(); + // Since the parameters don't affect, so they could be null, may change + // in the future + _editor.selectionChanged(null, null); + } + + abstract void perform(); + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.ui.actions.UpdateAction#update() + */ + public void update() { + setEnabled(isEnabled()); + } + + /** + * @return the viewer + */ + protected IHTMLGraphicalViewer getViewer() { + return ((IDesignViewer) _editor).getGraphicViewer(); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignResizeComponentCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignResizeComponentCommand.java new file mode 100755 index 0000000..708462e --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignResizeComponentCommand.java @@ -0,0 +1,146 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.DefaultEditDomain; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPartViewer; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editparts.ScalableRootEditPart; +import org.eclipse.jface.text.ITextOperationTarget; +import org.eclipse.jface.text.source.SourceViewer; +import org.eclipse.jst.pagedesigner.css2.property.ICSSPropertyID; +import org.eclipse.jst.pagedesigner.editors.HTMLEditor; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; + +/** + * @author mengbo + */ +public class DesignResizeComponentCommand extends Command { + private EditPart _part; + + private Object _constraint; + + private SourceViewer _viewer; + + /** + * @param child + * @param constraint + */ + public DesignResizeComponentCommand(EditPart child, Object constraint) { + this._part = child; + this._constraint = constraint; + EditPart part = child; + if (part instanceof ScalableRootEditPart) { + // TODO: eh? + // do nothing I guess... + } else { + while (part != null + && !(part.getParent() instanceof ScalableRootEditPart)) { + part = part.getParent(); + } + } + if (part != null) { + EditPartViewer viewer = ((ScalableRootEditPart) part.getParent()) + .getViewer(); + HTMLEditor editor = ((HTMLEditor) ((DefaultEditDomain) ((IHTMLGraphicalViewer) viewer) + .getEditDomain()).getEditorPart()); + _viewer = editor.getTextEditor().getTextViewer(); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#execute() + */ + public void execute() { + Element element = ((Element) _part.getModel()); + String width = element.getAttribute(ICSSPropertyID.ATTR_WIDTH); + // String height = element.getAttribute(ICSSPropertyID.ATTR_HEIGHT); + String originalStyle = element.getAttribute(ICSSPropertyID.ATTR_STYLE); + StringBuffer style; + if (originalStyle != null) { + originalStyle = this.removeOthers(originalStyle, + ICSSPropertyID.ATTR_WIDTH); + originalStyle = this.removeOthers(originalStyle, + ICSSPropertyID.ATTR_HEIGHT); + style = new StringBuffer(originalStyle); + } else { + style = new StringBuffer(50); + } + if (null == width) { + style.append(";").append(ICSSPropertyID.ATTR_WIDTH).append(":") //$NON-NLS-1$ //$NON-NLS-2$ + .append(((Rectangle) _constraint).width).append(";"); //$NON-NLS-1$ + style.append(ICSSPropertyID.ATTR_HEIGHT).append(":").append( //$NON-NLS-1$ + ((Rectangle) _constraint).height).append(""); //$NON-NLS-1$ + } + element.setAttribute(ICSSPropertyID.ATTR_STYLE, style.toString()); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#redo() + */ + public void redo() { + _viewer.doOperation(ITextOperationTarget.REDO); + } + + /** + * @param style + * @param item + * @return ? + */ + public String removeOthers(String style, String item) { + String result = null; + int pos = style.indexOf(item); + if (pos < 0) { + return style; + } + int pos1 = pos; + if (pos > 0) { + if (style.charAt(pos - 1) == ';') { + pos--; + } + } + char ch = style.charAt(pos1); + while (!(ch == ';' || ch == '"' || ch == '\'')) { + pos1++; + if (pos1 >= style.length()) { + break; + } + ch = style.charAt(pos1); + } + if (pos1 < style.length()) { + result = style.substring(0, pos) + + style.substring(pos1 + 1, style.length()); + } else { + result = style.substring(0, pos); + } + if (result.indexOf(item) >= 0) { + return removeOthers(result, item); + } + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#undo() + */ + public void undo() { + _viewer.doOperation(ITextOperationTarget.UNDO); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignerCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignerCommand.java new file mode 100755 index 0000000..bbba047 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/DesignerCommand.java @@ -0,0 +1,409 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.text.ITextSelection; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.EditValidateUtil; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.editors.HTMLEditor; +import org.eclipse.jst.pagedesigner.editors.SimpleGraphicalEditor; +import org.eclipse.jst.pagedesigner.parts.ElementEditPart; +import org.eclipse.jst.pagedesigner.utils.SelectionHelper; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.HTMLGraphicalViewer; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.ui.IEditorPart; +import org.eclipse.wst.html.core.internal.format.HTMLFormatProcessorImpl; +import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; +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.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * This class is intended to be the base class for all designer GEF commands. + * Basically, it will wrap the real command with common actions like handle + * undo/redo, etc. + * + * @author mengbo + */ +public abstract class DesignerCommand extends Command { + private final IDOMModel _model; + + /** + * the graphical viewer + */ + protected IHTMLGraphicalViewer _viewer; + + private static final Logger _log = PDPlugin + .getLogger(DesignerCommand.class); + + /** + * @param label + * @param viewer + */ + public DesignerCommand(String label, IHTMLGraphicalViewer viewer) { + super(label); + this._viewer = viewer; + this._model = viewer.getModel(); + } + + /** + * @param label + * @param node + * the node must be a node in the IHTMLGraphicalViewer. + */ + public DesignerCommand(String label, IDOMNode node) { + this(label, (IDOMDocument) node.getOwnerDocument()); + } + + /** + * @param label + * @param document + */ + public DesignerCommand(String label, IDOMDocument document) + { + super(label); + this._model = document.getModel(); + EditPart part = (EditPart) document.getAdapterFor(EditPart.class); + if (part != null) { + this._viewer = (IHTMLGraphicalViewer) part.getViewer(); + } + } + /** + * @return the GEF viewer this command is targeted for + * + */ + public IHTMLGraphicalViewer getViewer() { + return _viewer; + } + + /** + * @return the DOM model that this command will effect + */ + public IDOMModel getModel() { + return _model; + } + + /** + * @return the dom document for the model this command will effect + */ + public IDOMDocument getDocument() { + return getModel().getDocument(); + } + + /** + * executes the Command. This method should not be called if the Command is + * not executable. + */ + public final void execute() { + boolean ok = prePreExecute(); + if (ok) { + try { + preExecute(); + doExecute(); + postExecute(); + } catch (Exception ex) { + handleException(ex); + } finally { + postPostExecute(); + } + } + } + + /** + * child class can override. + * + * @param ex + */ + protected void handleException(Exception ex) { + ex.printStackTrace(); + } + + /** + * prePreExecute and postPostExecute is a pair. prePreExecute() SHOULD NOT + * throw any exception, if it throw any exception, it should catch itself + * and return false to indicate not continue. + * @return true if execution should continue, false if should not + */ + protected boolean prePreExecute() { + int position = -1; + int length = -1; + ISelection selection = getViewer().getSelection(); + if (selection != null) { + if (getViewer().isInRangeMode()) { + DesignRange range = (DesignRange) selection; + if (range.isValid()) { + IDOMPosition domPos = DOMPositionHelper.toDOMPosition(range + .getStartPosition()); + IDOMPosition domEnd = DOMPositionHelper.toDOMPosition(range + .getEndPosition()); + if (EditValidateUtil.validPosition(domPos) + && EditValidateUtil.validPosition(domEnd)) { + position = EditModelQuery + .getIndexedRegionLocation(domPos); + int end = EditModelQuery + .getIndexedRegionLocation(domEnd); + if (end < position) { + length = position - end; + position = end; + } else { + length = end - position; + } + } + } + } else { + Object object = ((IStructuredSelection) selection) + .getFirstElement(); + if (object instanceof ElementEditPart) { + Node node = ((ElementEditPart) object).getIDOMNode(); + position = EditModelQuery.getNodeStartIndex(node); + length = EditModelQuery.getNodeLenth(node); + } + } + } + if (position >= 0 && length >= 0) { + getModel().beginRecording(this, getLabel(), position, length); + } else { + getModel().beginRecording(this, getLabel()); + } + //Bug 332479 - [WPE] Design page processing still takes place even when design page is hidden + if (!htmlEditorIsInSourceOnlyMode()) { + getViewer().startSelectionChange(); + } + getModel().aboutToChangeModel(); + return true; + } + + /** + * child class can override this method for any pre action. + */ + protected void preExecute() { + // does nothing; children may wish to implement + } + + /** + * child class should override this method for the real action. + */ + protected abstract void doExecute(); + + /** + * child class can override this method for any post action. NOTE: if + * preExecute() or doExecute() throw exception, then this method will NOT be + * called. + */ + protected void postExecute() { + // does nothing; child may wish to implement + } + + /** + * if prePreExecute() return true, then this method will always be called + * even preExecute()/doExecute() and postExecute() fail. + */ + protected void postPostExecute() { + getModel().changedModel(); + + // after "changedModel()" is called, model will fire out batched events + // about model change + // and EditPart will be refreshed. Only at this time, could we use + // EditPart to construct the + // result selection. + + // enforce a validate, so things get layed out, thus all the figures + // will be valid. + + //Bug 332479 - [WPE] Design page processing still takes place even when design page is hidden + if (!htmlEditorIsInSourceOnlyMode()) { + this.getViewer().getViewport().validate(); + } + + ISelection sel = getAfterCommandDesignerSelection(); + if (sel != null) { + ITextSelection textSel = SelectionHelper + .convertFromDesignSelectionToTextSelection(sel); + if (textSel != null) { + getModel().endRecording(this, textSel.getOffset(), + textSel.getLength()); + } else { + getModel().endRecording(this); + } + } else { + getModel().endRecording(this); + } + + //Bug 332479 - [WPE] Design page processing still takes place even when design page is hidden + if (!htmlEditorIsInSourceOnlyMode()) { + if (sel != null) { + getViewer().setSelection(sel); + } else { + getViewer().deselectAll(); + } + if (getViewer() != null) { + getViewer().selectionChanged(); + } + } + } + + /** + * child class should override this method to provide the selection after + * command. This method is called after model changed. So at time of this + * call, the editpart should be valid. Default implementation. + * + * @return the selection + */ + protected abstract ISelection getAfterCommandDesignerSelection(); + + /** + * @param range + * @return a selection that contains the dom range or null if one doesn't exist + */ + protected ISelection toDesignRange(DOMRange range) { + try { + if (range == null) { + return null; + } + IDOMPosition startPos = range.getStartPosition(); + DesignPosition start = DOMPositionHelper.toDesignPosition(startPos); + if (range.isEmpty()) { + return new DesignRange(start, start); + } + IDOMPosition endPos = range.getEndPosition(); + return new DesignRange(start, DOMPositionHelper + .toDesignPosition(endPos)); + } catch (Exception e) { + // "Selection error" + _log.error("Error.RangeModeCommand.SetSelection"); //$NON-NLS-1$ + return null; + } + + } + + /** + * @param node + * @return a selection for the node + */ + protected IStructuredSelection toDesignSelection(Node node) { + if (node instanceof INodeNotifier) { + EditPart part = (EditPart) ((INodeNotifier) node) + .getAdapterFor(EditPart.class); + if (part != null) { + return new StructuredSelection(part); + } + } + return null; + } + + // + // /** + // * set selection to the specified node. Normally called by child class in + // setSelection() implementation. + // * + // * @param node + // */ + // protected final void setSelection(Node node) + // { + // EditPart part = (EditPart) ((INodeNotifier) + // node).getAdapterFor(EditPart.class); + // + // StructuredSelection sel = new StructuredSelection(part); + // getViewer().setSelection(sel); + // } + + /** + * format the specified node in source code. Utility method that can be + * called by child classes + * + * @param node + */ + public void formatNode(Node node) { + // XXX: there should have some other way to get the FormatProcessor. + // currently hardcoded to HTMLFormatProcessorImpl(). + new HTMLFormatProcessorImpl().formatNode(node); + } + + /** + * Re-executes the Command. This method should only be called after + * undo() has been called. + */ + public void redo() { + // this method should in fact never be called, because we have already + // delegate undo + // operations to source view. + getModel().getUndoManager().redo(); + } + + /** + * Undoes the changes performed during execute(). This + * method should only be called after execute has been + * called, and only when canUndo() returns true. + * + * @see #canUndo() + */ + public void undo() { + // this method should in fact never be called, because we have already + // delegate undo + // operations to source view. + getModel().getUndoManager().undo(); + } + + /** + * a utility method. NOTE: this method can ONLY be called BEFORE you change + * anything in the model. + * + * @param ele + * @return the figure info for the element + */ + public IFigure getFigureInfo(Element ele) { + if (ele instanceof IDOMElement) { + EditPart part = (EditPart) ((IDOMElement) ele) + .getAdapterFor(EditPart.class); + if (part instanceof GraphicalEditPart) { + return ((GraphicalEditPart) part).getFigure(); + } + } + return null; + } + + /** + * Returns true if HTMLEditor is in source-only mode. + * @return true if HTMLEditor is in source-only mode, else false. + */ + protected boolean htmlEditorIsInSourceOnlyMode() { + boolean ret = false; + if (_viewer instanceof HTMLGraphicalViewer) { + IEditorPart parent = ((HTMLGraphicalViewer)_viewer).getParent(); + if (parent instanceof SimpleGraphicalEditor) { + HTMLEditor htmlEditor = ((SimpleGraphicalEditor)parent).getHTMLEditor(); + if (htmlEditor != null) { + ret = (htmlEditor.getDesignerMode() == HTMLEditor.MODE_SOURCE); + } + } + } + return ret; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/ICustomizableCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/ICustomizableCommand.java new file mode 100755 index 0000000..0086aef --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/ICustomizableCommand.java @@ -0,0 +1,21 @@ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.core.runtime.IAdaptable; + +/** + * A command that can be customized with drop customizable command + * + * This is not public API. Clients should not use. + * + * @author cbateman + * + */ +public interface ICustomizableCommand +{ + /** + * Sets the customization data + * + * @param customizationData + */ + public void setCustomizationData(IAdaptable customizationData); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/MoveNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/MoveNodeCommand.java new file mode 100755 index 0000000..9e878ee --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/MoveNodeCommand.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.dom.DOMPosition; +import org.eclipse.jst.pagedesigner.dom.DOMUtil; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * Move a node from one place to another place. + * + * @author mengbo + * @version 1.5 + */ +public class MoveNodeCommand extends DesignerCommand { + private IDOMPosition insertPosition; + + private Node originalNode; + + /** + * @param viewer + * @param insertionPoint + * @param originalNode + */ + public MoveNodeCommand(IHTMLGraphicalViewer viewer, + IDOMPosition insertionPoint, Node originalNode) { + super( + CommandResources.getString("MoveNodeCommand.Label.MoveNode"), viewer); //$NON-NLS-1$ + this.insertPosition = insertionPoint; + this.originalNode = originalNode; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + getModel().beginRecording(this); + try { + Node originalParent = originalNode.getParentNode(); + if (originalParent == null) { + return; + } + // when remove the _originalNode, may affect the insertionPosition. + if (originalParent == insertPosition.getContainerNode()) { + // under same parent, may affect it. + int insertIndex = insertPosition.getOffset(); + int nodeIndex = -1; + NodeList list = originalParent.getChildNodes(); + for (int i = 0, length = list.getLength(); i < length; i++) { + if (originalNode == list.item(i)) { + nodeIndex = i; + } + } + if (nodeIndex == -1) { + return; // should not happen. + } + if (insertIndex < nodeIndex) { + insertPosition = new DOMPosition(originalParent, + insertIndex); + } else if (insertIndex == nodeIndex + || insertIndex == nodeIndex + 1) { + // move to same position, do nothing. + return; + } else { + insertPosition = new DOMPosition(originalParent, + insertIndex - 1); + } + } + originalParent.removeChild(originalNode); + DOMUtil.insertNode(insertPosition, originalNode); + } finally { + getModel().endRecording(this); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(originalNode); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PDDropRequest.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PDDropRequest.java new file mode 100755 index 0000000..c5f7ad0 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PDDropRequest.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DropRequest; +import org.eclipse.swt.dnd.DropTargetEvent; + +/** + * @author mengbo + */ +public class PDDropRequest extends Request implements DropRequest { + private Point _location; + + private DropTargetEvent _currentEvent; + + /** + * + */ + public PDDropRequest() { + setType(PDRequestConstants.REQ_DROP); + } + + /** + * Returns the location of the object to be created. + * + * @return the location + */ + public Point getLocation() { + return _location; + } + + /** + * Sets the location where the new object will be placed. + * + * @param location + * the location + */ + public void setLocation(Point location) { + this._location = location; + } + + /** + * @param ev + */ + public void setCurrentEvent(DropTargetEvent ev) { + _currentEvent = ev; + } + + /** + * @return the current drop target event + */ + public DropTargetEvent getCurrentEvent() { + return _currentEvent; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PDRequestConstants.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PDRequestConstants.java new file mode 100755 index 0000000..18ea980 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PDRequestConstants.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +/** + * @author mengbo + */ +public interface PDRequestConstants { + + /** + * TODO: purpose? + */ + String REQ_DROP = "pd drop"; //$NON-NLS-1$ +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PaletteDropInsertCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PaletteDropInsertCommand.java new file mode 100755 index 0000000..1ad7522 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PaletteDropInsertCommand.java @@ -0,0 +1,140 @@ +/******************************************************************************* + * Copyright (c) 2006, 2008 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.dnd.internal.SourceViewerDragDropHelper; +import org.eclipse.jst.pagedesigner.dom.DOMPosition; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.editors.palette.IDropSourceData; +import org.eclipse.jst.pagedesigner.itemcreation.customizer.DropCustomizationController; +import org.eclipse.jst.pagedesigner.utils.CommandUtil; +import org.eclipse.wst.sse.ui.StructuredTextEditor; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * Handles tag creation when dropped onto the WPE source view + * + * @author mengbo + */ +public class PaletteDropInsertCommand extends SourceViewerCommand implements ICustomizableCommand +{ + + private final Logger _log = PDPlugin + .getLogger(PaletteDropInsertCommand.class); + + private IDropSourceData _creationProvider; + + private int _location; + + private Element _element; + + private IAdaptable _customizationData; + + /** + * @param label + * @param editor + * @param creationProvider + * @param location + */ + public PaletteDropInsertCommand(String label, StructuredTextEditor editor, + IDropSourceData creationProvider, int location) { + super(label, editor); + _creationProvider = creationProvider; + _location = location; + } + + public void doExecute() { + Node node; + try { + node = getSourceEditingTextTools().getNode(_location); + } catch (Exception e) { + _log.error("Bad text insertion location", e); //$NON-NLS-1$ + return; + } + IDOMPosition position = null; + if (node != null) { + position = SourceViewerDragDropHelper.getInstance() + .findPosition(_location, node); + } else { + if (getModel().getDocument().getFirstChild() != null) { + //Fix for 224541 - When palette item is dropped to end of file in source view of Web Page Editor, the item is inserted at the top of file + //add inside at end of necessary container + position = SourceViewerDragDropHelper.getInstance() + .findPosition(getModel().getDocument().getEndOffset(), getModel().getDocument().getFirstChild()); + } + else { + // empty file + position = new DOMPosition(getModel().getDocument(), 0); + } + } + + // essentially copied from ItemCreationTool so that DesignView drop and + // SourceViewDrop are same. + // Note that SourceView does NO drop validation checking. This is + // handled by ItemCreationPolicy in DesignView + final IStatus status = performCustomization(getModel().getDocument(), + position); + + if (status.isOK()) + { + final Element element = CommandUtil.executeInsertion( + _creationProvider, getModel() + , position, getCustomizationData()); + if (element != null) { + formatNode(element); + } + this._element = element; + } + } + + /** + * @param domDoc + * @param position + * @return status + */ + protected IStatus performCustomization(final IDOMDocument domDoc, final IDOMPosition position) { + return new DropCustomizationController(this, _creationProvider, domDoc, position).performCustomization(); + } + + /** + * @param customizationData + */ + public void setCustomizationData(IAdaptable customizationData) { + _customizationData = customizationData; + } + + /** + * This method is for test purposes and should generally not be + * used by clients. + * + * @return the customization data + */ + protected final IAdaptable getCustomizationData() { + return _customizationData; + } + + public void setSelection() { + if (_element != null) { + int offset = EditModelQuery.getNodeStartIndex(_element); + int length = EditModelQuery.getNodeEndIndex(_element) - offset; + _editor.getTextViewer().setSelectedRange(offset, length); + } + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PasteAction.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PasteAction.java new file mode 100755 index 0000000..6dc5dc1 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PasteAction.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.gef.dnd.TemplateTransfer; +import org.eclipse.gef.ui.parts.GraphicalEditor; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.commands.range.PasteCommand; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; + +/** + * @author mengbo + */ +public class PasteAction extends DesignAction { + + /** + * @param editor + */ + public PasteAction(GraphicalEditor editor) { + super(editor, PDPlugin.getResourceString("Action.Name.Paste"));//$NON-NLS-1$ + } + + public void perform() { + DesignerCommand command = null; + IHTMLGraphicalViewer viewer = getViewer(); + if (viewer.isInRangeMode()) { + command = new PasteCommand(viewer); + command.execute(); + } else { + return; + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.action.IAction#isEnabled() + */ + public boolean isEnabled() { + IHTMLGraphicalViewer viewer = getViewer(); + if (viewer != null && viewer.isInRangeMode() + && viewer.getRangeSelection().isValid()) { + Clipboard clipboard = new Clipboard(viewer.getControl() + .getDisplay()); + return clipboard.getContents(TemplateTransfer.getInstance()) != null + || clipboard.getContents(TextTransfer.getInstance()) != null; + } + return false; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PasteNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PasteNodeCommand.java new file mode 100755 index 0000000..551546e --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/PasteNodeCommand.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.text.ITextOperationTarget; +import org.eclipse.jface.text.source.SourceViewer; +import org.eclipse.jst.pagedesigner.commands.nav.ICaretPositionMover; +import org.eclipse.wst.html.core.internal.document.ElementStyleImpl; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class PasteNodeCommand extends Command implements ICaretPositionMover { + private static final String COMMAND_LABEL = CommandResources + .getString("PasteNodeCommand.Label.DeleteNode"); //$NON-NLS-1$ + + private Node child; + + private SourceViewer _sourceViewer; + + /** + * @param viewer + */ + public PasteNodeCommand(SourceViewer viewer) { + super(COMMAND_LABEL); + this._sourceViewer = viewer; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#execute() + */ + public void execute() { + _sourceViewer.getTextWidget().setSelection( + ((ElementStyleImpl) child).getStartOffset(), + ((ElementStyleImpl) child).getStartOffset()); + _sourceViewer.doOperation(ITextOperationTarget.PASTE); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#redo() + */ + public void redo() { + _sourceViewer.doOperation(ITextOperationTarget.REDO); + + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#undo() + */ + public void undo() { + _sourceViewer.doOperation(ITextOperationTarget.UNDO); + + } + + /** + * @param child + * The child to set. + */ + public void setChild(Node child) { + this.child = child; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/SourceViewerCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/SourceViewerCommand.java new file mode 100755 index 0000000..e876b60 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/SourceViewerCommand.java @@ -0,0 +1,132 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.text.TextSelection; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.wst.html.core.internal.format.HTMLFormatProcessorImpl; +import org.eclipse.wst.sse.ui.StructuredTextEditor; +import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; +import org.eclipse.wst.xml.ui.internal.provisional.IDOMSourceEditingTextTools; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public abstract class SourceViewerCommand extends Command { + /** + * the structured text editor containing the viewer + */ + protected final StructuredTextEditor _editor; + + private Document _document; + + private Logger _log = PDPlugin.getLogger(SourceViewerCommand.class); + + /** + * @param label + * @param editor + */ + public SourceViewerCommand(String label, StructuredTextEditor editor) { + super(); + _editor = editor; + IDOMSourceEditingTextTools tools = getSourceEditingTextTools(); + _document = tools.getDOMDocument(); + } + + /** + * @return the text tools + */ + protected IDOMSourceEditingTextTools getSourceEditingTextTools() { + IDOMSourceEditingTextTools tools = (IDOMSourceEditingTextTools) _editor + .getAdapter(ISourceEditingTextTools.class); + return tools; + } + + /** + * preExecute and postExecute is a pair. () SHOULD NOT throw any exception, + * if it throw any exception, it should catch itself and return false to + * indicate not continue. + * @return true if preExec succeeded + */ + protected final boolean preExecute() { + int position = 0; + int length = 0; + ISelection selection = _editor.getTextViewer().getSelection(); + if (selection instanceof TextSelection) { + position = ((TextSelection) selection).getOffset(); + length = ((TextSelection) selection).getLength(); + } + getModel().beginRecording(this, getLabel(), position, length); + getModel().aboutToChangeModel(); + return true; + } + + /** + * if preExecute() return true, then this method will always be called even + * preExecute()/doExecute() and postExecute() fail. + */ + protected final void postExecute() { + getModel().changedModel(); + getModel().endRecording(this); + setSelection(); + } + + /** + * format the specified node in source code. Utility method that can be + * called by child classes + * + * @param node + */ + public final void formatNode(Node node) { + new HTMLFormatProcessorImpl().formatNode(node); + } + + /** + * @return the dom model + */ + protected IDOMModel getModel() { + Assert.isTrue(_document != null && _document instanceof IDOMNode); + return ((IDOMNode) _document).getModel(); + } + + public final void execute() { + boolean ok = preExecute(); + if (ok) { + try { + doExecute(); + } catch (Exception ex) { + // "Error in command execution" + _log.error("Error.SourceViewerCommand.Execution", ex); //$NON-NLS-1$ + } finally { + postExecute(); + } + } + } + + /** + * execute + */ + public abstract void doExecute(); + + /** + * set the selection + */ + public abstract void setSelection(); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/SwitchSelectionCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/SwitchSelectionCommand.java new file mode 100755 index 0000000..01f5265 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/SwitchSelectionCommand.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands; + +import java.util.List; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.EditValidateUtil; +import org.eclipse.jst.pagedesigner.parts.DocumentEditPart; +import org.eclipse.jst.pagedesigner.parts.SubNodeEditPart; +import org.eclipse.jst.pagedesigner.validation.caret.Target; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * A command to switch the selection + * + */ +public class SwitchSelectionCommand extends Command { + IHTMLGraphicalViewer _viewer; + + /** + * @param viewer + */ + public SwitchSelectionCommand(IHTMLGraphicalViewer viewer) { + _viewer = viewer; + } + + public void execute() { + if (_viewer.isInRangeMode()) { + ISelection selection = _viewer.getSelection(); + if (selection instanceof DesignRange) { + DesignPosition posStart = ((DesignRange) selection) + .getStartPosition(); + DesignPosition posEnd = ((DesignRange) selection) + .getEndPosition(); + if (EditValidateUtil.validPosition(posStart) + && EditValidateUtil.validPosition(posEnd)) { + Node ancestor = EditModelQuery.getInstance() + .getCommonAncestor(posStart.getContainerNode(), + posEnd.getContainerNode()); + if (ancestor instanceof Text) { + ancestor = ancestor.getParentNode(); + } + if (ancestor instanceof Element) { + EditPart part = Target.resolvePart(ancestor); + if (part instanceof SubNodeEditPart) { + _viewer.select(part); + } + } + } + } + } else { + List parts = _viewer.getSelectedEditParts(); + if (parts.size() > 0) { + EditPart parent = ((EditPart) parts.get(0)).getParent(); + if (!(parent instanceof DocumentEditPart)) { + _viewer.select(parent); + } + } + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteColumnCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteColumnCommand.java new file mode 100755 index 0000000..9f4aa66 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteColumnCommand.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.html; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.dom.html.TableUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class TableDeleteColumnCommand extends DesignerCommand { + private Element _tableEle; + + private int _columnIndex; + + private TableUtil _tableUtil; + + /** + * @param viewer + * @param dataTable + * @param index + */ + public TableDeleteColumnCommand(IHTMLGraphicalViewer viewer, + Element dataTable, int index) { + super( + CommandResources + .getString("TableDeleteColumnCommand.Label.DeleteColumn"), viewer); //$NON-NLS-1$ + this._tableEle = dataTable; + this._columnIndex = index; + this._tableUtil = new TableUtil(this._tableEle); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#canExecute() + */ + public boolean canExecute() { + if (this._columnIndex < 0) { + return false; + } + boolean hasColSpan = _tableUtil.hasColumnSpanElement(this._columnIndex); + boolean isAffectedByColSpan = _tableUtil + .isAffectedByColSpan(this._columnIndex); + if (hasColSpan || isAffectedByColSpan) { + return false; + } + + return super.canExecute(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(_tableEle); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + List trList = new ArrayList(); + TableUtil.getTrElements(this._tableEle, trList); + + List[] lists = _tableUtil.getTrCellLists(); + + for (int i = 0, size = trList.size(); i < size; i++) { + Element tr = (Element) trList.get(i); + List cells = lists[i]; + if (cells.size() <= this._columnIndex) { + continue; + } + Element cell = (Element) cells.get(this._columnIndex); + if (!cell.getTagName().equalsIgnoreCase("fake")) //$NON-NLS-1$ + { + tr.removeChild(cell); + } + } + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteHeaderFooterCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteHeaderFooterCommand.java new file mode 100755 index 0000000..08b3f00 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteHeaderFooterCommand.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.html; + +import java.util.List; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.dom.html.TableUtil; +import org.eclipse.jst.pagedesigner.utils.DOMUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * @author mengbo + * @version 1.5 + */ +public class TableDeleteHeaderFooterCommand extends DesignerCommand { + private Element _table; + + private boolean _isHeader; + + /** + * @param viewer + * @param table + * @param isHeader + */ + public TableDeleteHeaderFooterCommand(IHTMLGraphicalViewer viewer, + Element table, boolean isHeader) { + super( + isHeader ? CommandResources + .getString("TableDeleteHeaderFooterCommand.Label.DeleteHeader") : CommandResources.getString("TableDeleteHeaderFooterCommand.Label.DeleteFooter"), viewer); //$NON-NLS-1$ //$NON-NLS-2$ + this._table = table; + this._isHeader = isHeader; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#canExecute() + */ + public boolean canExecute() { + String sectionName = this._isHeader ? IHTMLConstants.TAG_THEAD + : IHTMLConstants.TAG_TFOOT; + int rows = TableUtil.countSectionRows(this._table, sectionName); + if (rows == 0) { + return false; + } + return super.canExecute(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + String sectionName = this._isHeader ? IHTMLConstants.TAG_THEAD + : IHTMLConstants.TAG_TFOOT; + List list = DOMUtil.getChildElementsByTagIgnoreCase(this._table, + sectionName); + Node delNode = (Node) list.get(0); + this._table.removeChild(delNode); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return this.toDesignSelection(this._table); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteRowCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteRowCommand.java new file mode 100755 index 0000000..2abf463 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableDeleteRowCommand.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.html; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.dom.html.TableUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class TableDeleteRowCommand extends DesignerCommand { + Element _tableEle; + + int _rowIndex; + + /** + * @param viewer + * @param table + * @param index + */ + public TableDeleteRowCommand(IHTMLGraphicalViewer viewer, Element table, + int index) { + super(CommandResources + .getString("TableDeleteRowCommand.Label.DeleteRow"), viewer); //$NON-NLS-1$ + this._tableEle = table; + this._rowIndex = index; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#canExecute() + */ + public boolean canExecute() { + if (this._rowIndex < 0) { + return false; + } + List list = new ArrayList(); + TableUtil.getTrElements(this._tableEle, list); + // int index = TableUtil.countRowIndexInDOMTree(this._tableEle, + // this._rowIndex); + int index = this._rowIndex; + Element tr = (Element) list.get(index); + boolean hasRowSpan = TableUtil.hasRowSpanElement(tr); + boolean isAffectedByRowSpan = TableUtil.isAffectedByRowSpan(list, tr, + index); + if (hasRowSpan || isAffectedByRowSpan) { + return false; + } + + return super.canExecute(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(_tableEle); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + List list = new ArrayList(); + TableUtil.getTrElements(this._tableEle, list); + // int index = TableUtil.countRowIndexInDOMTree(this._tableEle, + // this._rowIndex); + int index = this._rowIndex; + Element tr = (Element) list.get(index); + tr.getParentNode().removeChild(tr); + formatNode(this._tableEle); + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertColumnCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertColumnCommand.java new file mode 100755 index 0000000..2c6ed8e --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertColumnCommand.java @@ -0,0 +1,158 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.html; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.dom.html.TableUtil; +import org.eclipse.jst.pagedesigner.utils.DOMUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * @author mengbo + * @version 1.5 + */ +public class TableInsertColumnCommand extends DesignerCommand { + private Element _tableEle; + + private int _columnIndex; + + private TableUtil _tableUtil; + + /** + * @param viewer + * @param dataTable + * @param index + */ + public TableInsertColumnCommand(IHTMLGraphicalViewer viewer, + Element dataTable, int index) { + super( + CommandResources + .getString("TableInsertColumnCommand.Label.InsertColumn"), viewer); //$NON-NLS-1$ + this._tableEle = dataTable; + this._columnIndex = index; + this._tableUtil = new TableUtil(this._tableEle); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#canExecute() + */ + public boolean canExecute() { + List trList = new ArrayList(); + TableUtil.getTrElements(this._tableEle, trList); + if (trList == null || trList.isEmpty()) { + return false; + } + if (this._columnIndex < 0 && this._columnIndex != -10) { + return false; + } + boolean isAffectedByColSpan = _tableUtil + .isAffectedByColSpan(this._columnIndex); + if (isAffectedByColSpan) { + return false; + } + + return super.canExecute(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(_tableEle); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + List trList = new ArrayList(); + TableUtil.getTrElements(this._tableEle, trList); + + List[] lists = _tableUtil.getTrCellLists(); + int maxColumn = _tableUtil.getColumnCount(); + + boolean isAtLastColumn = false; + if (this._columnIndex >= maxColumn) { + isAtLastColumn = true; + } + + for (int i = 0, size = trList.size(); i < size; i++) { + Element tr = (Element) trList.get(i); + boolean hasTH = (DOMUtil.getChildElementsByTagIgnoreCase(tr, + IHTMLConstants.TAG_TH).size() > 0); + + List cells = lists[i]; + if (isAtLastColumn || (cells.size() <= this._columnIndex)) { + int index = this._columnIndex + 1; + for (int k = cells.size(); k < index; k++) { + tr.appendChild(createDefaultElement(hasTH)); + } + } else { + if (this._columnIndex != -10) { + Element cell = (Element) cells.get(this._columnIndex); + if (!cell.getTagName().equalsIgnoreCase("fake")) //$NON-NLS-1$ + { + tr.insertBefore(createDefaultElement(hasTH), cell); + } else { + boolean hasRealElement = false; + for (int k = _columnIndex + 1; k < cells.size(); k++) { + Element td = (Element) cells.get(k); + if (!td.getTagName().equalsIgnoreCase("fake")) //$NON-NLS-1$ + { + hasRealElement = true; + tr.insertBefore(createDefaultElement(hasTH), td); + break; + } + } + if (!hasRealElement) { + tr.appendChild(createDefaultElement(hasTH)); + } + } + } else { + tr.appendChild(createDefaultElement(hasTH)); + } + } + } + + formatNode(this._tableEle); + } + + private Element createDefaultElement(boolean createTH) { + Document doc = this._tableEle.getOwnerDocument(); + Element td = null; + if (createTH) { + td = doc.createElement(IHTMLConstants.TAG_TH); + } else { + td = doc.createElement(IHTMLConstants.TAG_TD); + } + + Node node = doc.createTextNode( + CommandResources.getString("TableInsertColumnCommand.Text.Default")); //$NON-NLS-1$ + td.appendChild(node); + return td; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertHeaderFooterCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertHeaderFooterCommand.java new file mode 100755 index 0000000..65f6d85 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertHeaderFooterCommand.java @@ -0,0 +1,132 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.html; + +import java.util.List; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.dom.html.TableUtil; +import org.eclipse.jst.pagedesigner.utils.DOMUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * @author mengbo + * @version 1.5 + */ +public class TableInsertHeaderFooterCommand extends DesignerCommand { + private Element _table; + + private Element _headerOrFooter; + + private boolean _isHeader; + + private TableUtil _tableUtil; + + /** + * @param viewer + * @param table + * @param isHeader + */ + public TableInsertHeaderFooterCommand(IHTMLGraphicalViewer viewer, + Element table, boolean isHeader) { + super( + isHeader ? CommandResources + .getString("TableInsertHeaderFooterCommand.Label.InsertHeader") : CommandResources.getString("TableInsertHeaderFooterCommand.Label.InsertFooter"), viewer); //$NON-NLS-1$ //$NON-NLS-2$ + this._table = table; + this._isHeader = isHeader; + this._tableUtil = new TableUtil(this._table); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#canExecute() + */ + public boolean canExecute() { + String sectionName = this._isHeader ? IHTMLConstants.TAG_THEAD + : IHTMLConstants.TAG_TFOOT; + int rows = TableUtil.countSectionRows(this._table, sectionName); + if (rows > 0) { + return false; + } + return super.canExecute(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + String sectionName = this._isHeader ? IHTMLConstants.TAG_THEAD + : IHTMLConstants.TAG_TFOOT; + this._headerOrFooter = this._table.getOwnerDocument().createElement( + sectionName); + Element tr = createDefaultElement(); + this._headerOrFooter.appendChild(tr); + if (this._isHeader) { + Node child = this._table.getFirstChild(); + this._table.insertBefore(this._headerOrFooter, child); + } else { + int headRows = TableUtil.countSectionRows(this._table, + IHTMLConstants.TAG_THEAD); + Node refNode = null; + if (headRows > 0) { + List list = DOMUtil.getChildElementsByTagIgnoreCase( + this._table, IHTMLConstants.TAG_THEAD); + Node header = (Node) list.get(0); + refNode = header.getNextSibling(); + } else { + refNode = this._table.getFirstChild(); + } + this._table.insertBefore(this._headerOrFooter, refNode); + } + formatNode(this._headerOrFooter); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return this.toDesignSelection(this._headerOrFooter); + } + + private Element createDefaultElement() { + String key = this._isHeader ? "TableInsertHeaderFooterCommand.ColumnHeader" //$NON-NLS-1$ + : "TableInsertHeaderFooterCommand.ColumnFooter"; //$NON-NLS-1$ + String name = PDPlugin.getResourceString(key); + Document doc = this._table.getOwnerDocument(); + Element ele = doc.createElement(IHTMLConstants.TAG_TR); + int columnCount = _tableUtil.getColumnCount(); + for (int i = 0; i < columnCount; i++) { + Element td = null; + if (this._isHeader) { + td = doc.createElement(IHTMLConstants.TAG_TH); + } else { + td = doc.createElement(IHTMLConstants.TAG_TD); + } + Node node = doc.createTextNode(name); + td.appendChild(node); + ele.appendChild(td); + } + return ele; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertRowCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertRowCommand.java new file mode 100755 index 0000000..a622783 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableInsertRowCommand.java @@ -0,0 +1,169 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.html; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.dom.html.TableUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * @author mengbo + * @version 1.5 + */ +public class TableInsertRowCommand extends DesignerCommand { + private Element _tableEle; + + private int _rowIndex; + + private boolean _isBefore; + + private TableUtil _tableUtil; + + /** + * @param viewer + * @param table + * @param index + * @param isBefore + */ + public TableInsertRowCommand(IHTMLGraphicalViewer viewer, Element table, + int index, boolean isBefore) { + super(CommandResources + .getString("TableInsertRowCommand.Label.InsertRow"), viewer); //$NON-NLS-1$ + this._tableEle = table; + this._rowIndex = index; + this._isBefore = isBefore; + this._tableUtil = new TableUtil(this._tableEle); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#canExecute() + */ + public boolean canExecute() { + if (this._rowIndex < 0 && this._rowIndex != -10) { + return false; + } + List list = new ArrayList(); + TableUtil.getTrElements(this._tableEle, list); + // if the row neither at the beginning nor the end then count + if (_rowIndex > 0 && _rowIndex < list.size()) { + // int index = TableUtil.countRowIndexInDOMTree(this._tableEle, + // this._rowIndex); + int index = this._rowIndex; + Element tr = (Element) list.get(index); + boolean isAffectedByRowSpan = TableUtil.isAffectedByRowSpan(list, + tr, index); + if (isAffectedByRowSpan) { + return false; + } + + } + + return super.canExecute(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(_tableEle); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + List list = new ArrayList(); + TableUtil.getTrElements(this._tableEle, list); + Element insertElement = createDefaultElement(); + + if (this._rowIndex < list.size()) { + if (this._rowIndex != -10) { + // int index = TableUtil.countRowIndexInDOMTree(this._tableEle, + // this._rowIndex); + int index = this._rowIndex; + Element tr = (Element) list.get(index); + Element nextTr = tr; + + // int headRows = TableUtil.countSectionRows(this._tableEle, + // IHTMLConstants.TAG_THEAD); + // int footRows = TableUtil.countSectionRows(this._tableEle, + // IHTMLConstants.TAG_TFOOT); + if (!_isBefore) { + int parentIndex = index - 1; + /** + * doesn't need any more,since the row index is from model now + * int bodyRows = list.size() - headRows - footRows; boolean + * hasBodyRow = false; boolean hasFootRow = false; if (bodyRows > + * 0) { hasBodyRow = true; } if (footRows > 0) { hasFootRow = + * true; } //last row in THEAD excute insert row after command + * if ((this._rowIndex == headRows) && hasBodyRow && hasFootRow) { + * parentIndex = index - footRows - 1; } //last row in TBODY + * excute insert row after command if ((this._rowIndex == + * (list.size() - footRows)) && hasBodyRow && hasFootRow) { + * parentIndex = list.size() - 1; } + */ + + tr = (Element) list.get(parentIndex); + } + + if (tr.getParentNode() == nextTr.getParentNode()) { + tr.getParentNode().insertBefore(insertElement, nextTr); + } else { + tr.getParentNode().appendChild(insertElement); + } + } else { + //empty table - append first row + _tableEle.appendChild(insertElement); + } + } else { + // int index = TableUtil.countRowIndexInDOMTree(this._tableEle, + // this._rowIndex - 1); + int index = this._rowIndex - 1; + Element tr = (Element) list.get(index); + tr.getParentNode().insertBefore(insertElement, null); + } + formatNode(this._tableEle); + + } + + private Element createDefaultElement() { + Document doc = this._tableEle.getOwnerDocument(); + Element ele = doc.createElement(IHTMLConstants.TAG_TR); + int columnCount = _tableUtil.getColumnCount(); + if (columnCount < 1) { + columnCount = 1; + } + for (int i = 0; i < columnCount; i++) { + Element td = doc.createElement(IHTMLConstants.TAG_TD); + Node node = doc.createTextNode( + CommandResources.getString("TableInsertColumnCommand.Text.Default")); //$NON-NLS-1$ + td.appendChild(node); + ele.appendChild(td); + } + return ele; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableResizeColumnCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableResizeColumnCommand.java new file mode 100755 index 0000000..1b53afe --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableResizeColumnCommand.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.html; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.css2.property.ICSSPropertyID; +import org.eclipse.jst.pagedesigner.dom.DOMStyleUtil; +import org.eclipse.jst.pagedesigner.dom.html.TableUtil; +import org.eclipse.jst.pagedesigner.utils.DOMUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class TableResizeColumnCommand extends DesignerCommand { + private Element _table; + + private TableUtil _tableUtil; + + private int _columnIndex; + + private int _delta; + + /** + * @param viewer + * @param table + * @param columnIndex + * @param delta + */ + public TableResizeColumnCommand(IHTMLGraphicalViewer viewer, Element table, + int columnIndex, int delta) { + super( + CommandResources + .getString("TableResizeColumnCommand.Label.ResizeColumn"), viewer); //$NON-NLS-1$ + this._table = table; + this._columnIndex = columnIndex; + this._delta = delta; + _tableUtil = new TableUtil(this._table); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(_table); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + int index = this._columnIndex - 1; + if (index < 0) { + index = 0; + } + List list = _tableUtil.getColumnCells(index); + Iterator itr = list.iterator(); + Element cell = null; + while (itr.hasNext()) { + Element ele = (Element) itr.next(); + if (ele.getTagName().equalsIgnoreCase("fake") || DOMUtil.getIntAttributeIgnoreCase(ele, IHTMLConstants.ATTR_COLSPAN, 1) > 1) //$NON-NLS-1$ + { + continue; + } + cell = ele; + break; + } + + IFigure cellFigure = getFigureInfo(cell); + int oldColumnWidth = cellFigure.getBounds().width; + int cellPadding = cellFigure.getInsets().getWidth(); + int newWidth = oldColumnWidth + this._delta - cellPadding; + if (this._columnIndex - 1 < 0) { + newWidth = oldColumnWidth - this._delta - cellPadding; + } + Map map = new HashMap(); + if (newWidth > 0) { + map.put(ICSSPropertyID.ATTR_WIDTH, newWidth + "px"); //$NON-NLS-1$ + DOMStyleUtil.insertStyle(cell, map); + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableResizeRowCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableResizeRowCommand.java new file mode 100755 index 0000000..375c56a --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/html/TableResizeRowCommand.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.html; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.css2.property.ICSSPropertyID; +import org.eclipse.jst.pagedesigner.dom.DOMStyleUtil; +import org.eclipse.jst.pagedesigner.dom.html.TableUtil; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class TableResizeRowCommand extends DesignerCommand { + private Element _table; + + private int _rowIndex; + + private int _delta; + + /** + * @param viewer + * @param table + * @param rowIndex + * @param delta + */ + public TableResizeRowCommand(IHTMLGraphicalViewer viewer, Element table, + int rowIndex, int delta) { + super(CommandResources + .getString("TableResizeRowCommand.Label.ResizeColumn"), viewer); //$NON-NLS-1$ + this._table = table; + this._rowIndex = rowIndex; + this._delta = delta; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected ISelection getAfterCommandDesignerSelection() { + return toDesignSelection(this._table); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + int index = this._rowIndex - 1; + if (index < 0) { + index = 0; + } + // int domIndex = TableUtil.countRowIndexInDOMTree(this._table, index); + int domIndex = index; + + List list = new ArrayList(); + TableUtil.getTrElements(this._table, list); + Element tr = (Element) list.get(domIndex); + + IFigure cellFigure = getFigureInfo(tr); + int oldRowHeight = cellFigure.getBounds().height; + int cellPadding = cellFigure.getInsets().getHeight(); + int newHeight = oldRowHeight + this._delta - cellPadding; + if (this._rowIndex - 1 < 0) { + newHeight = oldRowHeight - this._delta - cellPadding; + } + Map map = new HashMap(); + if (newHeight > 0) { + map.put(ICSSPropertyID.ATTR_HEIGHT, newHeight + "px"); //$NON-NLS-1$ + DOMStyleUtil.insertStyle(tr, map); + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/CaretPositionTracker.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/CaretPositionTracker.java new file mode 100755 index 0000000..b3d28f4 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/CaretPositionTracker.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.nav; + +/** + * @author mengbo + */ +public interface CaretPositionTracker { + /** + * @return Returns the xoffset. + */ + public int getXoffset(); + + /** + * @param xoffset + * The xoffset to set. + */ + public void setXoffset(int xoffset); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/HorizontalMoveCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/HorizontalMoveCommand.java new file mode 100755 index 0000000..2674108 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/HorizontalMoveCommand.java @@ -0,0 +1,147 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.nav; + +import java.util.List; + +import org.eclipse.gef.EditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.dom.EditHelper; +import org.eclipse.jst.pagedesigner.parts.SubNodeEditPart; +import org.eclipse.jst.pagedesigner.parts.TextEditPart; +import org.eclipse.jst.pagedesigner.validation.caret.ActionData; +import org.eclipse.jst.pagedesigner.validation.caret.IMovementMediator; +import org.eclipse.jst.pagedesigner.validation.caret.InlineEditingNavigationMediator; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.DesignRefPosition; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; + +/** + * @author mengbo + */ +public class HorizontalMoveCommand extends Command implements + ICaretPositionMover { + private static Logger _log = PDPlugin + .getLogger(HorizontalMoveCommand.class); + + IHTMLGraphicalViewer _viewer; + + boolean _forward; + + boolean _onlyMoveEnd; + + /** + * @param viewer + * @param b + * @param c + */ + public HorizontalMoveCommand(IHTMLGraphicalViewer viewer, boolean b, + boolean c) { + _viewer = viewer; + _forward = b; + _onlyMoveEnd = c; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#execute() + */ + public void execute() { + DesignPosition position = null; + if (_viewer.isInRangeMode()) { + if (_viewer.getRangeSelection() != null + && _viewer.getRangeSelection().isValid()) { + position = _viewer.getRangeSelection().getEndPosition(); + position = performInlineMode(_forward); + } + } else { + position = performObjectMode(); + } + setRange(position); + } + + private DesignPosition performObjectMode() { + DesignPosition result = null; + IMovementMediator validator = new InlineEditingNavigationMediator( + new ActionData(ActionData.KEYBOARD_NAVAGATION, null)); + DesignPosition position = getCurrentObjectPosition(); + if (position != null) { + _viewer.setRange(position, position); + if (!validator.isValidPosition(position)) { + position = performInlineMode(_forward); + if (validator.isValidPosition(position)) { + result = position; + } else { + result = performInlineMode(!_forward); + } + } else { + result = position; + } + } + return result; + } + + private DesignPosition performInlineMode(boolean forward) { + DesignRange range = _viewer.getRangeSelection(); + + if (range == null || !range.isValid()) { + _log.error("invalid range"); //$NON-NLS-1$ + return null; + } + + DesignPosition position = range.getEndPosition(); + if (position.getContainerPart() instanceof TextEditPart) { + int length = ((TextEditPart) position.getContainerPart()) + .getTextData().length(); + int newoffset = position.getOffset() + (_forward ? 1 : -1); + if (newoffset >= 0 && newoffset <= length) { + DesignPosition newposi = new DesignPosition(position + .getContainerPart(), newoffset); + return newposi; + } + } + DesignPosition newpos = EditHelper.moveToNextEditPosition( + ActionData.KEYBOARD_NAVAGATION, position, forward); + return newpos; + } + + private void setRange(DesignPosition newpos) { + if (_onlyMoveEnd) { + _viewer.setRangeEndPosition(newpos); + } else { + _viewer.setRange(newpos, newpos); + } + } + + private DesignPosition getCurrentObjectPosition() { + DesignRange result = null; + if (_viewer.isInRangeMode()) { + result = _viewer.getRangeSelection(); + } else { + List parts = _viewer.getSelectedEditParts(); + if (parts.size() > 0) { + EditPart selection = (EditPart) parts.get(0); + if (selection instanceof SubNodeEditPart) { + DesignPosition position = new DesignRefPosition(selection, + _forward); + result = new DesignRange(position, position); + } + } + } + return result != null && result.isValid() ? result.getEndPosition() + : null; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/ICaretPositionMover.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/ICaretPositionMover.java new file mode 100755 index 0000000..dd5a63c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/ICaretPositionMover.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.nav; + +/** + * Tags commands that care about caret position + * TODO: does presently appear to have a purpose + * + * @author mengbo + * + */ +public interface ICaretPositionMover { + // empty; tagging interface +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/VerticalMoveCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/VerticalMoveCommand.java new file mode 100755 index 0000000..c235a3d --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/nav/VerticalMoveCommand.java @@ -0,0 +1,201 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.nav; + +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.validation.caret.ActionData; +import org.eclipse.jst.pagedesigner.validation.caret.IMovementMediator; +import org.eclipse.jst.pagedesigner.validation.caret.InlineEditingNavigationMediator; +import org.eclipse.jst.pagedesigner.validation.caret.Target; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.EditPartPositionHelper; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.swt.widgets.Caret; + +/** + * @author mengbo + */ +public class VerticalMoveCommand extends Command { + private static Logger _log = PDPlugin + .getLogger(HorizontalMoveCommand.class); + + IHTMLGraphicalViewer _viewer; + + boolean _up; + + boolean _onlyMoveEnd; + + /** + * @param viewer + * @param up + * @param c + */ + public VerticalMoveCommand(IHTMLGraphicalViewer viewer, boolean up, + boolean c) { + _viewer = viewer; + _up = up; + _onlyMoveEnd = c; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#execute() + */ + public void execute() { + int OFFSET = 2; + DesignRange range = _viewer.getRangeSelection(); + if (range == null || !range.isValid()) { + _log.error("invalid range"); //$NON-NLS-1$ + return; + } + IMovementMediator moveMediator = new InlineEditingNavigationMediator( + new ActionData(ActionData.KEYBOARD_NAVAGATION, null)); + DesignPosition position = range.getEndPosition(); + Caret caret = _viewer.getCaret(); + Point point = null; + DesignPosition newPos = position; + EditPart containerpart = null, rootpart1; + if (_up) { + point = new Point(((CaretPositionTracker) _viewer).getXoffset(), + caret.getBounds().y); + } else { + point = new Point(((CaretPositionTracker) _viewer).getXoffset(), + caret.getBounds().y + caret.getBounds().height); + + } + rootpart1 = getRootEditablePart(position.getContainerPart(), + moveMediator);// position.getContainerPart(); + if (rootpart1 == null) { + return; + } + + point = adjustLocation(rootpart1, point); + Rectangle bound = EditPartPositionHelper.getAbsoluteBounds(rootpart1); + // get current according to the point. + // FlowBoxLine line = + // getCurrentLine(moveMediator.getEditableContainer(new + // Target(rootpart)), point, moveMediator); + while (true) { + // try to change offset and then to search for new point. + if (_up) { + point.y -= OFFSET; + if (point.y <= bound.y) { + newPos = position; + break; + } + } else { + point.y += OFFSET; + if (point.y >= bound.y + bound.height) { + newPos = position; + break; + } + } + containerpart = ((InlineEditingNavigationMediator) moveMediator) + .getConstainedEditableContainer(position, point, _viewer); + if (containerpart != null) { + if (!EditModelQuery.isChild(Target.resolveNode(rootpart1), + Target.resolveNode(containerpart))) { + containerpart = rootpart1; + } + bound = EditPartPositionHelper.getAbsoluteBounds(rootpart1); + newPos = EditPartPositionHelper + .findEditPartPositionConstrained(containerpart, point, + moveMediator); + } else { + newPos = position; + break; + } + if (newPos != null) { + if (found(newPos, position)) { + break; + } + } + } + setRange(position, newPos); + } + + private void setRange(DesignPosition position, DesignPosition newPos) { + if (!EditModelQuery.isSame(position, newPos)) { + { + if (_onlyMoveEnd) { + _viewer.setRangeEndPosition(newPos); + } else { + _viewer.setRange(newPos, newPos); + } + } + } + } + + /* + * We should change this, it is too tricky to do in this way. + */ + private Point adjustLocation(EditPart rootPart, Point point) { + Point result = point.getCopy(); + Rectangle bounds = EditPartPositionHelper.getAbsoluteBounds(rootPart); + if (!bounds.contains(point)) { + if (bounds.getLeft().x > point.x) { + result.x = bounds.getLeft().x; + } else if (bounds.getRight().x < point.x) { + result.x = bounds.getRight().x; + } + } + return result; + } + + private EditPart getRootEditablePart(EditPart part, + IMovementMediator moveMediator) { + EditPart rootpart = null; + if ((rootpart = ((InlineEditingNavigationMediator) moveMediator) + .getRootConstainedEditableContainer(new Target(part))) == null) { + rootpart = moveMediator.getEditableContainer(new Target(part)); + } + return rootpart; + } + + private boolean found(DesignPosition newPos, DesignPosition prevPos) { + Rectangle newRec = EditPartPositionHelper + .convertToAbsoluteCaretRect(newPos); + Rectangle prevRec = EditPartPositionHelper + .convertToAbsoluteCaretRect(prevPos); + if (_up) { + return getYDistance(newRec, prevRec, _up) < 0; + } + return getYDistance(newRec, prevRec, _up) > 0; + } + + /** + * Distance from rec1 to rec2 at y coordination, if top, compare top, + * otherwise compare bottom. + * + * @param rec1 + * @param rec2 + * @param up + * @return + */ + private int getYDistance(Rectangle rec1, Rectangle rec2, boolean top) { + if (rec1.getCopy().intersect(rec2).height > 0) { + return 0; + } + if (top) { + return rec1.getTop().y - rec2.getTop().y; + } + return rec1.getBottom().y - rec2.getBottom().y; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ApplyStyleCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ApplyStyleCommand.java new file mode 100755 index 0000000..98e6577 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ApplyStyleCommand.java @@ -0,0 +1,509 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.DOMRefPosition; +import org.eclipse.jst.pagedesigner.dom.DOMUtil; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * @author mengbo + */ +public class ApplyStyleCommand extends RangeModeCommand { + private String _tag; + + private String _cssProperty; + + private String _cssPropertyValue; + + private final Element _applyingNode; + + /** + * @param viewer + * @param tag + * @param property + * @param value + */ + public ApplyStyleCommand(IHTMLGraphicalViewer viewer, String tag, + String property, String value) { + super( + CommandResources + .getString("ApplyStyleCommand.Label.ApplyStyle"), viewer); //$NON-NLS-1$ + this._tag = tag; + this._cssProperty = property; + this._cssPropertyValue = value; + this._applyingNode = null; + } + + /** + * @param viewer + * @param node + * @param property + * @param value + */ + public ApplyStyleCommand(IHTMLGraphicalViewer viewer, Element node, + String property, String value) { + super( + CommandResources + .getString("ApplyStyleCommand.Label.ApplyStyle"), viewer); //$NON-NLS-1$ + this._applyingNode = node; + } + + /** + * @return the applying node (may be null) + */ + protected final Element getApplyingNode() { + return _applyingNode; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected DOMRange doRangeExecute(DOMRange range) { + if (range == null || range.isEmpty()) { + return null; + } + + boolean ordered = range.isOrdered(); + IDOMPosition start = ordered ? range.getStartPosition() : range + .getEndPosition(); + IDOMPosition end = ordered ? range.getEndPosition() : range + .getStartPosition(); + + Node startContainer = start.getContainerNode(); + Node endContainer = end.getContainerNode(); + + Node common = DOMUtil.findCommonAncester(start.getContainerNode(), end + .getContainerNode()); + if (common == null) { + // should not happen. + return null; + } + + if (common instanceof Text) { + // under the same Text scope + range = doTextNodeStyleApply((Text) common, start.getOffset(), end + .getOffset()); + + return range; + } + + if (startContainer instanceof Text) { + // if the start offset is 0,then skip split the Text + if (start.getOffset() > 0) { + startContainer = ((Text) startContainer).splitText(start + .getOffset()); + start = new DOMRefPosition(startContainer, false); + } + } else { + startContainer = start.getNextSiblingNode(); + } + if (endContainer instanceof Text) { + if (end.getOffset() > 0) { + endContainer = ((Text) endContainer).splitText(end + .getOffset()); + endContainer = endContainer.getPreviousSibling(); + } else { + endContainer = endContainer.getPreviousSibling(); + } + } else { + endContainer = end.getPreviousSiblingNode(); + } + + for (Node node = startContainer; node != endContainer; node = EditModelQuery + .getInstance().getNextLeafNeighbor(node)) { + if (EditModelQuery.hasAncestor(node, getTag(), true)) { + continue; + } + Element newnode = createStyleElement(); + node.getParentNode().insertBefore(newnode, node); + newnode.appendChild(node); + } + if (!EditModelQuery.hasAncestor(endContainer, getTag(), true)) { + Element newnode = createStyleElement(); + endContainer.getParentNode() + .insertBefore(newnode, endContainer); + newnode.appendChild(endContainer); + } + + // merge the style tags + + for (Node node = startContainer; node != endContainer; node = EditModelQuery + .getInstance().getNextLeafNeighbor(node)) { + Node stylenode = node; + while (stylenode != null + && !stylenode.getNodeName().equalsIgnoreCase(getTag())) { + stylenode = stylenode.getParentNode(); + } + if (stylenode == null) { + continue; + } + if (stylenode.getNextSibling() != null + && stylenode.getNextSibling().getNodeName() + .equalsIgnoreCase(getTag())) { + Node sibling = stylenode.getNextSibling(); + while (sibling.getFirstChild() != null) { + stylenode.appendChild(sibling.getFirstChild()); + } + stylenode.getParentNode().removeChild(sibling); + node = startContainer; + } + } + + return new DOMRange(start, end); + + /* + * boolean ordered = range.isOrdered(); IDOMPosition start = ordered ? + * range.getStartPosition() : range.getEndPosition(); IDOMPosition end = + * ordered ? range.getEndPosition() : range.getStartPosition(); + * + * Node common = DOMUtil.findCommonAncester(start.getContainerNode(), + * end.getContainerNode()); if (common == null) { // should not happen. + * return null; } + * + * DOMRange result = null; if (common instanceof Text) { result = + * doTextNodeStyleApply((Text) common, start.getOffset(), + * end.getOffset()); } else { IDOMPosition startPosition = start; + * IDOMPosition endPosition = end; Node ancester = common; DOMRange[] + * leftRange = new DOMRange[1]; DOMRange[] rightRange = new DOMRange[1]; + * + * startPosition = partialApply(startPosition, ancester, true, + * leftRange); endPosition = partialApply(endPosition, ancester, false, + * rightRange); DOMRange middle = middleApply(ancester, startPosition, + * endPosition); + * + * IDOMPosition startref = null; if (leftRange[0] != null && + * leftRange[0].getStartPosition() != null) { startref = + * leftRange[0].getStartPosition(); } else if (middle != null && + * middle.getStartPosition() != null) { startref = + * middle.getStartPosition(); } else if (rightRange[0] != null && + * rightRange[0].getStartPosition() != null) { startref = + * rightRange[0].getStartPosition(); } + * + * IDOMPosition endref = null; if (rightRange[0] != null && + * rightRange[0].getEndPosition() != null) { endref = + * rightRange[0].getEndPosition(); } else if (middle != null && + * middle.getEndPosition() != null) { endref = middle.getEndPosition(); } + * else if (leftRange[0] != null && leftRange[0].getEndPosition() != + * null) { endref = leftRange[0].getEndPosition(); } + * + * if (startref == null) { result = null; } else { startref = new + * DOMPosition(EditModelQuery.getInstance().getNextLeafNeighbor(startref.getContainerNode()), + * 0); System.out.println(startref.toString()); endref = new + * DOMPosition(endref.getContainerNode(), 0); result = new + * DOMRange(startref, endref); } } + * + * if (result == null) { return null; } + * + * if (ordered) { return result; } else { return new + * DOMRange(result.getEndPosition(), result.getStartPosition()); } + */ + } + + // TODO: unused code. Dead? +// private DOMRange middleApply(Node ancester, IDOMPosition startPosition, +// IDOMPosition endPosition) { +// startPosition = skip(startPosition, true); +// if (startPosition.getNextSiblingNode() == null +// || startPosition.getOffset() >= endPosition.getOffset()) { +// return null; +// } else { +// List needMove = new ArrayList(); +// Node startNext = startPosition.getNextSiblingNode(); +// Node endNext = endPosition.getNextSiblingNode(); +// while (startNext != null && startNext != endNext) { +// needMove.add(startNext); +// startNext = startNext.getNextSibling(); +// } +// Element newEle = createStyleElement(); +// ancester.insertBefore(newEle, startPosition.getNextSiblingNode()); +// for (int i = 0, n = needMove.size(); i < n; i++) { +// newEle.appendChild((Node) needMove.get(i)); +// } +// return new DOMRange(new DOMRefPosition(newEle, false), +// new DOMRefPosition(newEle, true)); +// } +// } + + // TODO: unused code. Dead? +// private IDOMPosition partialApply(IDOMPosition position, Node ancester, +// boolean forward, DOMRange[] result) { +// IDOMPosition startRef = null, endRef = null; +// +// while (position != null && position.getContainerNode() != ancester) { +// Node container = position.getContainerNode(); +// if (container instanceof Text) { +// // splitText will move the position up one level +// position = splitText(position); +// } else { +// // skip those nodes that can't have the style applied. +// position = skip(position, forward); +// Node sibling = position.getSibling(forward); +// if (sibling != null) { +// List needMove = new ArrayList(); +// while (sibling != null) { +// needMove.add(sibling); +// sibling = forward ? sibling.getNextSibling() : sibling +// .getPreviousSibling(); +// } +// +// // ok, there is nodes that need the style +// Element newEle = createStyleElement(); +// container.insertBefore(newEle, position +// .getNextSiblingNode()); +// for (int i = 0, size = needMove.size(); i < size; i++) { +// newEle.appendChild((Node) needMove.get(i)); +// } +// if (startRef == null) { +// startRef = new DOMRefPosition(newEle, !forward); +// } +// endRef = new DOMRefPosition(newEle, forward); +// } +// // move the position up one level +// position = new DOMRefPosition(container, forward); +// } +// } +// if (startRef == null) { +// result[0] = null; +// } else { +// result[0] = forward ? new DOMRange(startRef, endRef) +// : new DOMRange(endRef, startRef); +// } +// return position; +// } + + /** + * @param position + * @return + */ + // TODO: dead? +// private IDOMPosition splitText(IDOMPosition position) { +// Text text = (Text) position.getContainerNode(); +// int offset = position.getOffset(); +// if (offset <= 0) { +// return new DOMRefPosition(text, false); +// } else if (offset >= text.getData().length()) { +// return new DOMRefPosition(text, true); +// } else { +// text.splitText(offset); +// return new DOMRefPosition(text, true); +// } +// } + + /** + * @param start + * @param end + * @param common + */ + private DOMRange doTextNodeStyleApply(Text textNode, int startOffset, + int endOffset) { + String data = textNode.getData(); + String before = data.substring(0, startOffset); + String middle = data.substring(startOffset, endOffset); + String tail = data.substring(endOffset); + + Text middleText = getModel().getDocument().createTextNode(middle); + + // case 1: normal one + if (!isEmptyString(before) && !isEmptyString(tail)) { + Node parent = textNode.getParentNode(); + parent.insertBefore( + getModel().getDocument().createTextNode(before), textNode); + Element bnode = createStyleElement(); + bnode.appendChild(middleText); + parent.insertBefore(bnode, textNode); + textNode.setNodeValue(tail); + } + + if (isEmptyString(before) && !isEmptyString(tail)) { + Node sibling = textNode.getPreviousSibling(); + if (sibling != null + && sibling.getNodeName().equalsIgnoreCase(getTag())) { + sibling.appendChild(middleText); + } else { + Node parent = textNode.getParentNode(); + parent.insertBefore(getModel().getDocument().createTextNode( + before), textNode); + Element bnode = createStyleElement(); + bnode.appendChild(middleText); + parent.insertBefore(bnode, textNode); + } + textNode.setNodeValue(tail); + } + + if (!isEmptyString(before) && isEmptyString(tail)) { + Node sibling = textNode.getNextSibling(); + textNode.setNodeValue(before); + if (sibling != null + && sibling.getNodeName().equalsIgnoreCase(getTag())) { + sibling.insertBefore(middleText, sibling.getFirstChild()); + } else { + Element bnode = createStyleElement(); + bnode.appendChild(middleText); + textNode.getParentNode().insertBefore(bnode, sibling); + } + } + + if (isEmptyString(before) && isEmptyString(tail)) { + + Node previousSibling = textNode.getPreviousSibling(); + Node nextSibling = textNode.getNextSibling(); + // + if (getTag().equalsIgnoreCase(IHTMLConstants.TAG_P)) { + Element bnode = createStyleElement(); + bnode.appendChild(middleText); + textNode.getParentNode().insertBefore(bnode, textNode); + textNode.getParentNode().removeChild(textNode); + } + // + else { + if (previousSibling != null + && previousSibling.getNodeName().equalsIgnoreCase( + getTag()) && nextSibling != null + && nextSibling.getNodeName().equalsIgnoreCase(getTag())) { + previousSibling.appendChild(middleText); + while (nextSibling.getFirstChild() != null) { + previousSibling + .appendChild(nextSibling.getFirstChild()); + } + nextSibling.getParentNode().removeChild(nextSibling); + } else if (previousSibling != null + && previousSibling.getNodeName().equalsIgnoreCase( + getTag())) { + previousSibling.appendChild(middleText); + } else if (nextSibling != null + && nextSibling.getNodeName().equalsIgnoreCase(getTag())) { + nextSibling.insertBefore(middleText, nextSibling + .getFirstChild()); + } else { + Element bnode = createStyleElement(); + bnode.appendChild(middleText); + textNode.getParentNode().insertBefore(bnode, textNode); + } + textNode.getParentNode().removeChild(textNode); + } + } + + return new DOMRange(new DOMRefPosition(middleText, false), + new DOMRefPosition(middleText, true)); + } + + private boolean isEmptyString(String str) { + if (str == null || str.length() == 0) { + return true; + } + return false; + } + + /** + * @return a style element (cached on create) + */ + protected Element createStyleElement() { + if (_applyingNode != null) { + return _applyingNode; + } + Element element = getModel().getDocument().createElement(getTag()); + if (_cssProperty != null && _cssPropertyValue != null) { + element.setAttribute(_cssProperty, _cssPropertyValue); + } + return element; + } + + /** + * @param position + * @param b + * @return + */ + // TODO: dead? +// private IDOMPosition skip(IDOMPosition position, boolean forward) { +// Node node = position.getSibling(forward); +// +// if (node == null) { +// return position; +// } +// boolean canSkip = false; +// if (node instanceof Text) { +// canSkip = ((IDOMText) node).isElementContentWhitespace(); +// } else if (node instanceof Element) { +// if (getTag().equalsIgnoreCase(((Element) node).getTagName())) { +// canSkip = true; +// } else { +// canSkip = false; +// } +// } else { +// canSkip = true; +// } +// if (canSkip) { +// return new DOMRefPosition(node, forward); +// } else { +// return position; +// } +// } + + /** + * @return Returns the _cssProperty. + */ + public final String getCssProperty() { + return _cssProperty; + } + + /** + * @param property + * The _cssProperty to set. + */ + public final void setCssProperty(String property) { + _cssProperty = property; + } + + /** + * @return Returns the _cssPropertyValue. + */ + public final String getCssPropertyValue() { + return _cssPropertyValue; + } + + /** + * @param propertyValue + * The _cssPropertyValue to set. + */ + public final void setCssPropertyValue(String propertyValue) { + _cssPropertyValue = propertyValue; + } + + /** + * @return Returns the _tag. + */ + public final String getTag() { + if (_tag != null) { + return _tag; + } + return _applyingNode.getNodeName(); + } + + /** + * @param _tag + * The _tag to set. + */ + public final void setTag(String _tag) { + this._tag = _tag; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/BlockNodeFinder.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/BlockNodeFinder.java new file mode 100755 index 0000000..0c3e48d --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/BlockNodeFinder.java @@ -0,0 +1,130 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.dom.DOMPosition; +import org.eclipse.jst.pagedesigner.dom.DOMRefPosition; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class BlockNodeFinder { + private String[] _additionalTags; + + private IDOMPosition _position; + + /** + * @param position + * @param additionalTags + */ + public BlockNodeFinder(IDOMPosition position, String[] additionalTags) { + _position = position; + _additionalTags = additionalTags; + } + + private Node findInlineSiblings(IDOMPosition position, List result, + boolean forward) { + Node container = EditModelQuery.getInstance().getSibling(position, + forward); + if (!forward) { + while (container != null) { + if (EditModelQuery.isInline(container)) { + result.add(container); + } else { + return container; + } + container = container.getPreviousSibling(); + } + } else { + while (container != null) { + if (EditModelQuery.isInline(container)) { + result.add(container); + } else { + return container; + } + container = container.getNextSibling(); + } + } + // the result will be non-zero length. + return null; + } + + private Node getParagraphNodes(IDOMPosition position, List result, + boolean forward) { + Node sResult = findInlineSiblings(position, result, forward); + Node container = position.getContainerNode(); + container = position.isText() ? container.getParentNode() : container; + while (sResult == null) { + // stop at block, special container and H style nodes. + if (EditModelQuery.isBlockNode(container) + || EditModelQuery.isDocument(container) + || (container.getLocalName() != null && (container + .getLocalName().equals(IJSFConstants.TAG_VIEW) || container + .getLocalName().equalsIgnoreCase( + IHTMLConstants.TAG_HTML))) || // + (_additionalTags != null + && Arrays.asList(_additionalTags).contains( + getTagName()) && Arrays.asList( + _additionalTags).contains(container))) { + return container; + } + position = new DOMRefPosition(container, forward); + sResult = findInlineSiblings(position, result, forward); + container = container.getParentNode(); + } + return sResult; + } + + /** + * Search for an area between two block nodes or within a block node, search + * will stop before or under a node which has block display-type, or + * particular container like "html", jsf "view", .etc, two positions (left + * and right) are returned in result. + * + * The searcher will search parent's directly children, if no block node is + * found, then go up the node tree to search again. + * + * @param position + * @param result + */ + public void getParagraphNodes(IDOMPosition position, List result) { + List tempResult = new ArrayList(); + Node r1 = getParagraphNodes(position, tempResult, true); + if (EditModelQuery.isChild(r1, position.getContainerNode())) { + result.add(new DOMPosition(r1, r1.getChildNodes().getLength())); + } else { + result.add(new DOMRefPosition(r1, false)); + } + + Node r2 = getParagraphNodes(position, tempResult, false); + if (EditModelQuery.isChild(r2, position.getContainerNode())) { + result.add(new DOMPosition(r2, 0)); + } else { + result.add(new DOMRefPosition(r2, true)); + } + } + + private String getTagName() { + String name = _position.getContainerNode().getNodeName(); + name = name == null ? "" : name.toLowerCase(); //$NON-NLS-1$ + return name; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ClipboardData.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ClipboardData.java new file mode 100755 index 0000000..29836d1 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ClipboardData.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import java.util.Vector; + +import org.eclipse.gef.dnd.TemplateTransfer; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.widgets.Control; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class ClipboardData implements IInputSourceProvider { + + private Control _control; + + /** + * @param control + */ + public ClipboardData(Control control) { + super(); + _control = control; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.IInputSourceProvider#getNodes() + */ + public Node[] getNodes() { + Object data = getClipboardData(); + if (data instanceof Vector && ((Vector) data).size() > 0) { + return (Node[]) ((Vector) data).toArray(new Node[] {}); + } else if (data instanceof Node[]) { + return (Node[]) data; + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.IInputSourceProvider#getStringData() + */ + public String getStringData() { + Object data = getClipboardData(); + if (data instanceof String) { + return (String) data; + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.IInputSourceProvider#getCharacterData() + */ + public Character getCharacterData() { + return null; + } + + /** + * @return the clip board data + */ + public Object getClipboardData() { + Clipboard clipboard = new Clipboard(_control.getDisplay()); + + final Object cuted = clipboard.getContents(TemplateTransfer.getInstance()); + if (cuted instanceof Node[] || cuted instanceof Vector) { + return cuted; + } + return clipboard.getContents(TextTransfer.getInstance()); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ContentCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ContentCommand.java new file mode 100755 index 0000000..7cc47e8 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ContentCommand.java @@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.dom.DOMPosition; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.DOMRefPosition; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Text; + +/** + * This command can used to handle things like "paste". Or keyboard printable + * ascii key. Note: ENTER key is not handled here. + * + * @author mengbo + */ +// FIXME: \r \n in the content string is not handled. +public class ContentCommand extends RangeModeCommand { + + private String _content; + + /** + * @param viewer + * @param content + */ + public ContentCommand(IHTMLGraphicalViewer viewer, String content) { + super("", viewer); //$NON-NLS-1$ + _content = content; + } + + /** + * @param viewer + * @param c + */ + public ContentCommand(IHTMLGraphicalViewer viewer, char c) { + super("", viewer); //$NON-NLS-1$ + _content = String.valueOf(c); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected DOMRange doRangeExecute(DOMRange range) { + if (range == null) + return null; + + IDOMPosition position = DOMPositionHelper.removeRange(range); + position = doContent(position); + return new DOMRange(position, position); + + } + + /** + * @param position + * @return ?? + */ + protected IDOMPosition doContent(IDOMPosition position) { + position = DOMPositionHelper.mergeIntoText(position); + + if (position.getContainerNode() instanceof Text) { + Text text = (Text) position.getContainerNode(); + String data = text.getData(); + int offset = position.getOffset(); + String newData = data.substring(0, offset) + _content + + data.substring(offset); + text.setData(newData); + return new DOMPosition(text, offset + _content.length()); + } + // we need to create a text node. + Text text = getDocument().createTextNode(_content); + position.getContainerNode().insertBefore(text, + position.getNextSiblingNode()); + return new DOMRefPosition(text, true); + } + + // protected DesignPosition doContent() + // { + // // DesignPosition position = removeRange(); + // DesignPosition position = this.getSelectionRange().getEndPosition(); + // if ('\r' == _content || '\n' == _content) + // { + // Element br = getModel().getDocument().createElement("BR"); + // Node node = RangeUtil.insertElement(position, br); + // + // // we need set the new range to the node. + // // FIXME: temp code, need to reconsider how to do refresh, when those + // editpart + // // are recreated. + // IDOMNode parent = (IDOMNode) node.getParentNode(); + // EditPart parentPart = (EditPart) parent.getAdapterFor(EditPart.class); + // List childParts = parentPart.getChildren(); + // for (int i=0; i EditHelper.IN_MIDDLE + || location2 < EditHelper.IN_MIDDLE) { + return null; + } + if (location1 <= EditHelper.IN_MIDDLE) { + start = node.getQualifiedOffsets()[0]; + } + if (location2 >= EditHelper.IN_MIDDLE) { + end = node.getQualifiedOffsets()[1]; + } + if (start == end) { + return null; + } + + try { + String text = currentNode.getData().substring(start, end); + return EditModelQuery.getDocumentNode(currentNode) + .createTextNode(text); + } catch (DOMException e) { + // TODO: changed this from catching Exception + // DOMException is the only exception that + // anything in the try is threatening to throw + // and even that is Runtime + _log.error("Exception", e); //$NON-NLS-1$ + return null; + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CutCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CutCommand.java new file mode 100755 index 0000000..90821a7 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CutCommand.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; + +/** + * @author mengbo + */ +public class CutCommand extends RangeModeCommand { + /** + * @param viewer + */ + public CutCommand(IHTMLGraphicalViewer viewer) { + super(CommandResources.getString("CutCommand.Label.Cut"), viewer); //$NON-NLS-1$ + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.RangeModeCommand#doRangeExecute(org.eclipse.jst.pagedesigner.dom.DOMRange) + */ + protected DOMRange doRangeExecute(DOMRange selection) { + DesignEdit edit = new CutEdit(selection, getViewer()); + if (EditModelQuery.isSame(selection)) { + return null; + } + if (edit.perform()) { + return new DOMRange(edit.getOperationPosition(), edit + .getOperationPosition()); + } + return selection; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CutEdit.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CutEdit.java new file mode 100755 index 0000000..3f6a456 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/CutEdit.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import java.util.Stack; + +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.jst.pagedesigner.dom.DOMRange; + +/** + * @author mengbo + */ +public class CutEdit extends DeleteEdit { + /** + * @param range + * @param viewer + */ + public CutEdit(DOMRange range, GraphicalViewer viewer) { + super(range, viewer); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.DesignEdit#operate() + */ + protected boolean operate() { + Stack result = deleteRange(); + setClipboard(result); + return true; + } + + /* + * private Text cutText(Text text, int start, int end) { + * EditValidateUtil.validStringIndexOffset(text, start, end - start); String + * content = text.substringData(start, end - start); if (content == null || + * content.length() == 0) { return null; } text.deleteData(start, end - + * start); return _document.createTextNode(content); } + */ +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DeleteCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DeleteCommand.java new file mode 100755 index 0000000..90f5698 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DeleteCommand.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.commands.nav.ICaretPositionMover; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * @author mengbo + */ +public class DeleteCommand extends RangeModeCommand implements + ICaretPositionMover { + private boolean _forward; + + /** + * @param forward + * @param viewer + */ + public DeleteCommand(boolean forward, IHTMLGraphicalViewer viewer) { + super(CommandResources.getString("DeleteCommand.Label.Delete"), viewer); //$NON-NLS-1$ + _forward = forward; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected DOMRange doRangeExecute(DOMRange selection) { + if (selection == null) { + return null; + } + + DesignEdit edit = new DeleteEdit(selection, getViewer(), _forward); + Listener listener = new Listener() { + public void handleEvent(Event event) { + event.type = SWT.NONE; + } + }; + getViewer().getControl().getDisplay() + .addFilter(SWT.Selection, listener); + boolean status = edit.perform(); + getViewer().getControl().getDisplay().removeFilter(SWT.Selection, + listener); + if (status) { + return new DOMRange(edit.getOperationPosition(), edit + .getOperationPosition()); + } + return selection; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DeleteEdit.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DeleteEdit.java new file mode 100755 index 0000000..84f846f --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DeleteEdit.java @@ -0,0 +1,291 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import java.util.Stack; +import java.util.Vector; + +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.dom.DOMPosition; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.DOMRefPosition; +import org.eclipse.jst.pagedesigner.dom.EditHelper; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.validation.caret.ActionData; +import org.eclipse.jst.pagedesigner.validation.caret.IETablePositionRule; +import org.eclipse.jst.pagedesigner.validation.caret.InlineEditingNavigationMediator; +import org.eclipse.jst.pagedesigner.viewer.LayoutPart; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + +/** + * @author mengbo + */ +public class DeleteEdit extends DesignEdit { + private static final Logger _log = PDPlugin.getLogger(DeleteEdit.class); + + private static final boolean INNER_DEBUG = false; + + private boolean _forward; + + Vector deleted = new Vector(); + + /** + * @param range + * @param viewer + * @param forward + */ + public DeleteEdit(DOMRange range, GraphicalViewer viewer, boolean forward) { + super(range, viewer); + _forward = forward; + } + + /** + * @param range + * @param viewer + */ + public DeleteEdit(DOMRange range, GraphicalViewer viewer) { + super(range, viewer); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.DesignEdit#operate() + */ + protected boolean operate() { + try { + boolean result = true; + if (EditModelQuery.isSame(getRange())) { + deleteSingle(); + } else { + deleteRange(); + } + return result; + } catch (Exception e) { + _log.error("Exception", e); //$NON-NLS-1$ + return false; + } + } + + /** + * Delete one node or char at operation position. + */ + private void deleteSingle() { + IDOMPosition opPosition = getOperationPosition(); + opPosition = EditHelper.moveToNextEditPosition(getOperationPosition(), + _forward, new InlineEditingNavigationMediator(new ActionData( + ActionData.INLINE_EDIT, null))); + // for inner debug + if (INNER_DEBUG) { + _log.info("EditHelper, now we are at:" + opPosition); //$NON-NLS-1$ + } + if (EditModelQuery.isSame(opPosition, getOperationPosition())) { + return; + } + setRange(new DOMRange(opPosition, getOperationPosition())); + deleteRange(); + } + + /** + * @return the stack + */ + protected Stack deleteRange() { + WorkNode root = getRootWorkNode(); + Node rootNode = root.getNode(); + Stack result = getProcessedResult(); + collectOtherStyles(rootNode, result); + return result; + } + + private boolean isTableComponents(WorkNode node) { + String name = node.getNode().getNodeName(); + return (IHTMLConstants.TAG_TD.equalsIgnoreCase(name) || // + IHTMLConstants.TAG_TH.equalsIgnoreCase(name) || // + IHTMLConstants.TAG_TR.equalsIgnoreCase(name) || // + IHTMLConstants.TAG_THEAD.equalsIgnoreCase(name) || // + IHTMLConstants.TAG_TBODY.equalsIgnoreCase(name) || // + IHTMLConstants.TAG_TFOOT.equalsIgnoreCase(name)); + } + + private Node processContainerTable(WorkNode node) { + Node result = null; + if ((isTableComponents(node) || IHTMLConstants.TAG_TABLE + .equalsIgnoreCase(node.getNode().getNodeName())) // + && new IETablePositionRule(null).isInValidTable(node + .getNode())) { + result = node.getNode().cloneNode(false); + } + return result; + } + + private Node processContainerStyleNodes(WorkNode node) { + String name = node.getNode().getNodeName(); + Node result = null; + if (IHTMLConstants.TAG_LI.equalsIgnoreCase(name) || // + EditModelQuery.HTML_STYLE_NODES.contains(node.getNode() + .getLocalName())) { + if (node.getNode().hasChildNodes()) { + result = node.getNode().cloneNode(false); + } + } + return result; + } + + private Node processContainerView(WorkNode node) { + Node result = null; + if (IJSFConstants.TAG_VIEW.equalsIgnoreCase(node.getNode() + .getLocalName())) { + result = EditModelQuery.getDocumentNode(node.getNode()) + .createElement(IJSFConstants.TAG_SUBVIEW); + result.setPrefix(node.getNode().getPrefix()); + } else if (IHTMLConstants.TAG_BODY.equalsIgnoreCase(node.getNode() + .getNodeName()) + || IHTMLConstants.TAG_HTML.equalsIgnoreCase(node.getNode() + .getNodeName())) { + result = EditModelQuery.getDocumentNode(node.getNode()) + .createElement(node.getNode().getNodeName()); + } + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.AbstractCopyEdit#processContainer(org.eclipse.jst.pagedesigner.commands.range.WorkNode) + */ + protected Node processContainer(WorkNode node) { + Node result = processContainerView(node); + if (result == null) { + result = processContainerTable(node); + } + if (result == null) { + result = processContainerStyleNodes(node); + } + if (result == null) { + // strip out container + if (LayoutPart.getConcreteNode(node.getNode()) != null) { + Node parent = node.getNode().getParentNode(); + Node refNode = node.getNode(); + Node child = node.getNode().getFirstChild(); + Node first = null, last = null; + int index = 0; + NodeList children = node.getNode().getChildNodes(); + int size = children.getLength(); + while (child != null) { + Node next = child.getNextSibling(); + Node n = EditHelper.deleteNode(child); + parent.insertBefore(n, refNode); + if (index == 0) { + if (refNode != null) { + first = refNode.getPreviousSibling(); + } else { + first = parent.getLastChild(); + } + } + if (index == size - 1) { + if (refNode != null) { + last = refNode.getPreviousSibling(); + } else { + last = parent.getLastChild(); + } + } + index++; + child = next; + } + if (node.getPosOffsets()[0] <= 0) { + setOperationPosition(new DOMRefPosition(first, false)); + } else { + setOperationPosition(new DOMRefPosition(last, true)); + } + } else { + setOperationPosition(new DOMRefPosition(node.getNode(), false)); + } + result = EditHelper.deleteNode(node.getNode()); + } + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.AbstractCopyEdit#processNode(org.w3c.dom.Node, + * int[]) + */ + protected Node processNode(WorkNode node) { + Node result = null; + if (!isTableComponents(node) + || !new IETablePositionRule(null).isInValidTable(node + .getNode())) { + // it's not table components. + setOperationPosition(new DOMRefPosition(node.getNode(), false)); + result = EditHelper.deleteNode(node.getNode()); + } + return result; + + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.AbstractCopyEdit#processText(org.w3c.dom.Text, + * int[]) + */ + protected Text processText(WorkNode node) { + Text currentNode = (Text) node.getNode(); + int[] offsets = node.getPosOffsets(); + Node second = null; + int location1 = EditHelper.getInstance().getLocation(currentNode, + node.getPosOffsets()[0], true); + int location2 = EditHelper.getInstance().getLocation(currentNode, + node.getPosOffsets()[1], true); + // left index + if (currentNode.getData().length() > 0) { + if (location1 == EditHelper.IN_MIDDLE) { + IDOMPosition position = new DOMPosition(currentNode, node + .getPosOffsets()[0]); + setOperationPosition(position); + position = DOMPositionHelper.splitText(position); + Node nnode = position.getNextSiblingNode(); + if (nnode instanceof Text) { + currentNode = (Text) nnode; + offsets[1] -= offsets[0] > 0 ? offsets[0] : 0; + } + } else { + // setOperationPosition(new DOMRefPosition(currentNode, false)); + if (currentNode.getPreviousSibling() != null) { + setOperationPosition(new DOMRefPosition(currentNode + .getPreviousSibling(), true)); + } else { + setOperationPosition(new DOMPosition(currentNode + .getParentNode(), 0)); + } + } + // right index + if (location2 >= EditHelper.IN_MIDDLE) { + IDOMPosition position = new DOMPosition(currentNode, offsets[1]); + position = DOMPositionHelper.splitText(position); + second = position.getPreviousSiblingNode(); + } + return second != null ? (Text) EditHelper.deleteNode(second) : null; + } + setOperationPosition(new DOMRefPosition(currentNode, false)); + return (Text) EditHelper.deleteNode(currentNode); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DesignEdit.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DesignEdit.java new file mode 100755 index 0000000..694e676 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/DesignEdit.java @@ -0,0 +1,480 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import java.util.Stack; +import java.util.Vector; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.gef.dnd.TemplateTransfer; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.css2.CSSUtil; +import org.eclipse.jst.pagedesigner.css2.ICSSStyle; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditHelper; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.EditValidateUtil; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.utils.DOMUtil; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * @author mengbo + */ +public abstract class DesignEdit { + + private Stack _selections; + + private DOMRange _range; + + private GraphicalViewer _viewer; + + private IDOMPosition _operationPosition; + + private final Document _document; + + private Stack _processedResult; + + /** + * @param range + * @param viewer + */ + public DesignEdit(DOMRange range, GraphicalViewer viewer) { + setRange(range); + _viewer = viewer; + _operationPosition = getRange().getStartPosition(); + _document = ((IDOMNode) _operationPosition.getContainerNode()) + .getModel().getDocument(); + } + + + /** + * @return the target document + */ + protected final Document getDocument() { + return _document; + } + + /** + * @return the result + */ + protected abstract boolean operate(); + + /** + * @param node + * @return the text + */ + protected abstract Text processText(WorkNode node); + + /** + * @param node + * @return the node + */ + protected abstract Node processNode(WorkNode node); + + /** + * @param node + * @return the node + */ + protected abstract Node processContainer(WorkNode node); + + /** + * @return the dom range + */ + public DOMRange getRange() { + return _range; + } + + void setRange(DOMRange range) { + range = EditHelper.normal(range); + IDOMPosition start = EditHelper.ensureDOMPosition(range + .getStartPosition()); + IDOMPosition end = EditHelper.ensureDOMPosition(range.getEndPosition()); + _range = new DOMRange(start, end); + EditValidateUtil.validRange(range); + } + + /** + * @return the clipboard + */ + protected Clipboard getClipboard() { + return new Clipboard(_viewer.getControl().getDisplay()); + } + + /** + * @return the position + */ + public IDOMPosition getOperationPosition() { + // try + // { + // Assert.isTrue(_operationPosition != null && + // _operationPosition.getContainerNode() != null && + // _operationPosition.getOffset() > -1); + // if (_operationPosition.isText()) + // { + // int length = ((Text) + // _operationPosition.getContainerNode()).getLength(); + // Assert.isTrue(_operationPosition.getOffset() >= 0 && + // _operationPosition.getOffset() <= length); + // } + // } + // catch (Exception e) + // { + // // "Error", "Error in operation location move" + // PDPlugin.getAlerts().confirm("Alert.DesignEdit.opLocationValidTitle", + // "Alert.DesignEdit.opLocationValidMessage"); //$NON-NLS-1$ + // //$NON-NLS-2$ + // } + + return _operationPosition; + } + + /** + * @param position + */ + protected void setOperationPosition(IDOMPosition position) { + if (!EditValidateUtil.validPosition(position)) { + return; + } + position = EditHelper.ensureDOMPosition(position); + _operationPosition = position; + } + + /** + * @return the result of performing the edit + */ + public boolean perform() { + boolean result = false; + + result = operate(); + return result; + } + + /** + * @return Returns the _viewer. + */ + public GraphicalViewer getViewer() { + return _viewer; + } + + private Stack collectNodes() { + Node node; + Stack result = new Stack(); + IDOMPosition start = getRange().getStartPosition(), end = getRange() + .getEndPosition(); + int pos[] = new int[] { EditModelQuery.getIndexedRegionLocation(start), + EditModelQuery.getIndexedRegionLocation(end), }; + if (!EditModelQuery.isSame(start, end)) { + Node ancestor = EditModelQuery.getInstance().getCommonAncestor( + start, end); + WorkNode rootWorkNode = new WorkNode(ancestor, pos[0], pos[1]); + rootWorkNode.setRoot(true); + result.push(rootWorkNode); + try { + // Loop all the children of the ancestor, and and the result + // will be collected + if (EditModelQuery.isText(ancestor)) { + Stack temp = new Stack(); + EditHelper.getInstance().collectNodes(ancestor, pos[0], + pos[1], ancestor, temp); + WorkNode wNode = (WorkNode) temp.remove(0); + wNode.setParent(rootWorkNode); + result.push(wNode); + } else { + node = ancestor.getFirstChild(); + Stack temp = new Stack(); + while (node != null) { + EditHelper.getInstance().collectNodes(node, pos[0], + pos[1], ancestor, temp); + while (temp.size() > 0) { + WorkNode wNode = (WorkNode) temp.remove(0); + if (wNode.getNode().getParentNode() == ancestor) { + wNode.setParent(rootWorkNode); + } + result.push(wNode); + } + node = node.getNextSibling(); + } + } + } catch (Exception e) { + result.clear(); + } + } + return result; + } + + /** + * @return Returns the result. + */ + public Stack getSelections() { + if (_selections == null) { + _selections = collectNodes(); + } + return _selections; + } + + /** + * @return the result stack + */ + public Stack getProcessedResult() { + if (_processedResult == null) { + _processedResult = new Stack(); + WorkNode rootNode = getRootWorkNode(); + if (rootNode != null) { + processNodes(rootNode, _processedResult); + } + } + return _processedResult; + } + + /** + * @return the root work node + */ + protected final WorkNode getRootWorkNode() { + WorkNode result = null; + if (getSelections().size() > 0) { + WorkNode node = (WorkNode) getSelections().get(0); + while (node.getParent() != null) { + node = node.getParent(); + } + result = node; + Assert.isTrue(node.isRoot()); + } + return result; + } + + /** + * @param node + * @param result + * @return true if node + */ + private final boolean processText(WorkNode node, Stack result) { + boolean done = false; + if (EditModelQuery.isText(node.getNode())) { + Node text = processText(node); + if (text != null) { + result.add(text); + } + getSelections().remove(node); + done = true; + } + return done; + } + + /** + * @param node + * @param result + */ + private final void processContainer(WorkNode node, Stack result) { + processContainer(node); + getSelections().remove(node); + } + + /** + * @param node + * @param result + * @return true if done + */ + private final boolean processChildren(WorkNode node, Stack result) { + boolean done = false; + if (getFirstSelectedChild(node) != null) { + Stack myResult = new Stack(); + { + WorkNode child = null; + while ((child = getFirstSelectedChild(node)) != null) { + { + processNodes(child, myResult); + } + } + Node newParent = processContainer(node); + newParent = toBeParent(newParent, myResult); + result.push(newParent); + } + getSelections().remove(node); + done = true; + } + return done; + } + + /** + * @param node + * @param result + * @return true if done + */ + private final boolean processChildren1(WorkNode node, Stack result) { + boolean done = false; + if (node.getNode().hasChildNodes()) { + Stack myResult = new Stack(); + { + Node childNode = node.getNode().getFirstChild(); + Node next = null; + while (childNode != null) { + next = childNode.getNextSibling(); + int x1 = EditModelQuery.getNodeStartIndex(childNode) - 1; + int x2 = EditModelQuery.getNodeEndIndex(childNode) + 1; + processNodes(new WorkNode(childNode, x1, x2), myResult); + childNode = next; + } + Node newParent = processContainer(node); + newParent = toBeParent(newParent, myResult); + result.push(newParent); + } + getSelections().remove(node); + done = true; + } + return done; + } + + /** + * Process the nodes that are selected, the result is a collection of nodes + * that either are clones or the nodes cuted. + * + * @param node + * @param result + */ + protected final void processNodes(WorkNode node, Stack result) { + WorkNode child = null; + if (node.isRoot()) { + while ((child = getFirstSelectedChild(node)) != null) { + processNodes(child, result); + } + } else { + if (node.isWholeSelected() + || // + (!EditModelQuery.isText(node.getNode()) && EditModelQuery + .getInstance().isSingleRegionNode(node.getNode())) + || // + EditModelQuery.isWidget(node.getNode())) { + Node temp = processNode(node); + if (temp != null) { + result.push(temp); + getSelections().remove(node); + } else { + if (!processText(node, result)) { + if (!processChildren1(node, result)) { + processContainer(node, result); + } + } + } + } else { + if (!processText(node, result)) { + if (!processChildren(node, result)) { + processContainer(node, result); + } + } + } + } + } + + /** + * @param result + */ + protected void setClipboard(Stack result) { + Node[] nodes = (Node[]) result.toArray(new Node[result.size()]); + StringBuffer sb = new StringBuffer(); + for (int i = 0, size = nodes.length; i < size; i++) { + DOMUtil.nodeToString(nodes[i], sb); + } + getClipboard().setContents( + new Object[] { result, sb.toString() }, + new Transfer[] { TemplateTransfer.getInstance(), + TextTransfer.getInstance() }); + } + + private Node toBeParent(Node parent, Stack children) { + while (children.size() > 0) { + parent.appendChild((Node) children.remove(0)); + } + return parent; + } + + private WorkNode getFirstSelectedChild(WorkNode node) { + for (int i = 0, n = getSelections().size(); i < n; i++) { + WorkNode wNode = (WorkNode) getSelections().get(i); + if (wNode.getParent() == node) { + return wNode; + } + } + return null; + } + + /** + * @param rootNode + * @param result + * @return the node + */ + Node collectStyleNodes(Node rootNode, Vector result) { + Element element = null; + if (rootNode instanceof Element) { + element = (Element) rootNode; + } else if (rootNode.getParentNode() != null) { + element = (Element) rootNode.getParentNode(); + } + ICSSStyle style = CSSUtil.getCSSStyle(element); + + Node node = EditModelQuery.getDocumentNode(rootNode).createElement( + "span"); //$NON-NLS-1$ + for (int i = 0, n = result.size(); i < n; i++) { + node.appendChild((Node) result.elementAt(i)); + } + ((Element) node).setAttribute(IHTMLConstants.ATTR_STYLE, CSSUtil + .resolveCSSStyle(style)); + result.removeAllElements(); + result.add(node); + return node; + } + + /** + * @param rootNode + * @param result + * @return the node + */ + protected final Node collectOtherStyles(Node rootNode, Vector result) { + Node cur = rootNode, prev = null, appendPoint = null; + if (EditValidateUtil.validNode(rootNode)) { + while (!EditModelQuery.isDocument(cur)) { + if (!EditValidateUtil.validNode(cur)) { + return null; + } + String name = cur.getNodeName() != null ? cur.getNodeName() + .toLowerCase() : ""; //$NON-NLS-1$ + if (EditModelQuery.HTML_STYLE_NODES.contains(name)) { + if (prev != null) { + Node newone = cur.cloneNode(false); + newone.appendChild(prev); + prev = newone; + } else { + prev = cur.cloneNode(false); + appendPoint = prev; + } + } + cur = cur.getParentNode(); + } + if (appendPoint != null) { + for (int i = 0, n = result.size(); i < n; i++) { + appendPoint.appendChild((Node) result.elementAt(i)); + } + result.removeAllElements(); + result.add(prev); + } + } + return prev; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/IInputSourceProvider.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/IInputSourceProvider.java new file mode 100755 index 0000000..b8c1c00 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/IInputSourceProvider.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public interface IInputSourceProvider { + /** + * @return Returns the _data. + */ + public Node[] getNodes(); + + /** + * @return the string data + */ + public String getStringData(); + + /** + * @return the character data + */ + public Character getCharacterData(); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/InsertCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/InsertCommand.java new file mode 100755 index 0000000..ffc5057 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/InsertCommand.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.commands.nav.ICaretPositionMover; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; + +/** + * @author mengbo + */ +public class InsertCommand extends RangeModeCommand implements + ICaretPositionMover { + + private IInputSourceProvider _data; + + /** + * @param label + * @param viewer + * @param data + */ + public InsertCommand(String label, IHTMLGraphicalViewer viewer, + IInputSourceProvider data) { + super(label, viewer); + _data = data; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.RangeModeCommand#doRangeExecute(org.eclipse.jst.pagedesigner.dom.DOMRange) + */ + protected DOMRange doRangeExecute(DOMRange selection) { + DesignEdit edit = null; + edit = new InsertEdit(selection, getViewer(), _data); + edit.perform(); + selection = new DOMRange(edit.getOperationPosition(), edit + .getOperationPosition()); + return selection; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/InsertEdit.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/InsertEdit.java new file mode 100755 index 0000000..cf86639 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/InsertEdit.java @@ -0,0 +1,196 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; +import org.eclipse.jst.pagedesigner.dom.DOMPosition; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.DOMRefPosition; +import org.eclipse.jst.pagedesigner.dom.DOMUtil; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.jsp.core.IJSPCoreConstants; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * InsertEdit will perform action at a single location, the data souce could be + * clipboard or keyboard. + * + * @author mengbo + */ +public class InsertEdit extends DeleteEdit { + private IInputSourceProvider _data; + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.DesignEdit#operate() + */ + public boolean operate() { + DOMRange range = getRange(); + if (!EditModelQuery.isSame(range.getStartPosition(), range + .getEndPosition())) { + deleteRange(); + range = new DOMRange(getOperationPosition(), getOperationPosition()); + setRange(range); + } + if (insertNodes()) { + return true; + } else if (insertString()) { + return true; + } else { + return insertChar(); + } + } + + /** + * @param range + * @param viewer + * @param data + */ + public InsertEdit(DOMRange range, GraphicalViewer viewer, + IInputSourceProvider data) { + super(range, viewer); + _data = data; + } + + /** + * @param position + * @param viewer + * @param data + */ + public InsertEdit(IDOMPosition position, GraphicalViewer viewer, + IInputSourceProvider data) { + super(new DOMRange(position, position), viewer); + setOperationPosition(position); + _data = data; + } + + /** + * @return ?? + */ + public boolean insertChar() { + if (_data.getStringData() == null) { + return false; + } + IDOMPosition position = getOperationPosition(); + if (position.isText()) { + Text text = EditModelQuery.getInstance().getText(position); + text.insertData(getOperationPosition().getOffset(), _data + .getCharacterData().toString()); + setOperationPosition(new DOMPosition(text, position.getOffset() + 1)); + } else { + Node refNode = position.getNextSiblingNode(); + Text text = getDocument().createTextNode(_data.getCharacterData() + .toString()); + position.getContainerNode().insertBefore(text, refNode); + setOperationPosition(new DOMPosition(text, text.getLength())); + } + return true; + } + + /** + * @return ???? + */ + public boolean insertString() { + String content = _data.getStringData(); + if (content != null) { + IDOMPosition position = getOperationPosition(); + if (position.isText()) { + Text text = EditModelQuery.getInstance().getText(position); + text.insertData(getOperationPosition().getOffset(), content); + setOperationPosition(new DOMPosition(text, position.getOffset() + + content.length())); + } else { + Node refNode = position.getNextSiblingNode(); + Text text = getDocument().createTextNode(content); + position.getContainerNode().insertBefore(text, refNode); + setOperationPosition(new DOMPosition(text, text.getLength())); + } + return true; + } + return false; + } + + private boolean insertNodes() { + Node[] nodes = _data.getNodes(); + if (nodes == null) { + return false; + } + IDOMPosition position = getOperationPosition(); + if (position == null) { + return false; + } + Node refNode = null; + if (position.isText()) { + position = DOMPositionHelper.splitText(position); + } + refNode = position.getNextSiblingNode(); + Node parent = position.getContainerNode(); + Node node = null; + for (int i = 0; i < nodes.length; i++) { + node = DOMUtil.cloneNodeDeep(getDocument(), nodes[i]); + String prefix = node.getPrefix(); + String name = node.getLocalName(); + if (name != null + && ITLDConstants.URI_JSP.equals(prefix) + && (node.getLocalName().startsWith( + IJSPCoreConstants.TAG_LEADING_DIRECTIVE) + || IJSPCoreConstants.TAG_DECLARATION.equals(name) + || IJSPCoreConstants.TAG_EXPRESSION.equals(name) || IJSPCoreConstants.TAG_SCRIPTLET + .equals(name))) { + // it is a jsp tag + ((IDOMElement) node).setJSPTag(true); + } + node = parent.insertBefore(node, refNode); + } + + if (node != null) { + setOperationPosition(new DOMRefPosition(node, true)); + } else if (refNode != null) { + setOperationPosition(new DOMRefPosition(refNode, false)); + } else { + setOperationPosition(new DOMRefPosition(parent.getLastChild(), true)); + } + return true; + } + + // TODO: dead? +// private boolean splitNode() { +// if ((getViewer()).getSelection() instanceof DesignRange +// && _data.getCharacterData() != null +// && _data.getCharacterData().charValue() == '\r') { +// DesignRange range = (DesignRange) (getViewer()).getSelection(); +// Node node = range.getStartPosition().getContainerNode(); +// if (EditModelQuery.isText(node)) { +// node = node.getParentNode(); +// } +// if (EditModelQuery.isListItem(node)) { +// IDOMPosition position = DOMPositionHelper.toDOMPosition(range +// .getStartPosition()); +// // split text and it's parent. +// position = EditHelper.splitNode(position); +// position = EditHelper.splitNode(position); +// position = EditHelper.moveInto(position.getNextSiblingNode(), +// new InlineEditingNavigationMediator(new ActionData( +// ActionData.INLINE_EDIT, null)), true); +// setOperationPosition(position); +// return true; +// } +// } +// return false; +// } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/KeyboardData.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/KeyboardData.java new file mode 100755 index 0000000..1b3589a --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/KeyboardData.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.gef.DefaultEditDomain; +import org.eclipse.gef.EditDomain; +import org.eclipse.gef.GraphicalViewer; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.editors.HTMLEditor; +import org.eclipse.swt.SWT; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class KeyboardData implements IInputSourceProvider { + private Character _keyCode; + + private int _stateMask; + + private GraphicalViewer _viewer; + + /** + * @param code + * @param mask + * @param viewer + */ + public KeyboardData(char code, int mask, GraphicalViewer viewer) { + if ((mask & SWT.SHIFT) != 0) { + _keyCode = new Character(Character.toUpperCase(code)); + } else { + _keyCode = new Character(code); + } + _stateMask = mask; + _viewer = viewer; + } + + /** + * @return Returns the keyCode. + */ + public int getKeyCode() { + return _keyCode.charValue(); + } + + /** + * @param keyCode + * The keyCode to set. + */ + public void setKeyCode(char keyCode) { + this._keyCode = new Character(keyCode); + } + + /** + * @return Returns the stateMask. + */ + public int getStateMask() { + return _stateMask; + } + + /** + * @param stateMask + * The stateMask to set. + */ + public void setStateMask(int stateMask) { + this._stateMask = stateMask; + } + + /** + * @param keyCode + * @return the node or null + */ + public Node getSpecialNode(KeyboardData keyCode) { + Object name; + EditDomain domain = _viewer.getEditDomain(); + Document document = null; + if (domain instanceof DefaultEditDomain) { + document = ((HTMLEditor) (((DefaultEditDomain) domain) + .getEditorPart())).getDOMDocument(); + } + // if ((keyCode.getStateMask() & SWT.SHIFT) != 0) + { + if ((name = EditModelQuery.CHAR_NODE_MAP.get(keyCode + .getCharacterData())) != null) { + return document.createElement((String) name); + } + } + return null; + } + + /** + * @return Returns the _data. + */ + public Node[] getNodes() { + Node node = getSpecialNode(this); + if (node != null) { + return new Node[] { node }; + } + return null; + } + + public String getStringData() { + return _keyCode.toString(); + } + + // public Key + public Character getCharacterData() { + return _keyCode; + } + + /** + * @return the char value of the key code + */ + public char getChar() { + return _keyCode.charValue(); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/Paragraph.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/Paragraph.java new file mode 100755 index 0000000..442d021 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/Paragraph.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class Paragraph { + private DOMRange _range; + + /** + * @param start + * @param end + */ + public Paragraph(IDOMPosition start, IDOMPosition end) { + _range = new DOMRange(start, end); + } + + /** + * @return the lowest container node + */ + public Node getLowestContainer() { + return EditModelQuery.getInstance().getCommonAncestor( + _range.getStartPosition(), _range.getEndPosition()); + } + + /** + * @return Returns the _end. + */ + public final IDOMPosition getStart() { + return _range.isOrdered() ? _range.getStartPosition() : _range + .getEndPosition(); + } + + /** + * @return Returns the _start. + */ + public final IDOMPosition getEnd() { + return _range.isOrdered() ? _range.getEndPosition() : _range + .getStartPosition(); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphApplyStyleCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphApplyStyleCommand.java new file mode 100755 index 0000000..0a8955b --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphApplyStyleCommand.java @@ -0,0 +1,408 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import java.util.Arrays; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.gef.EditPart; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.dom.DOMPosition; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.DOMRefPosition; +import org.eclipse.jst.pagedesigner.dom.DOMUtil; +import org.eclipse.jst.pagedesigner.dom.EditHelper; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.dom.IDOMRefPosition; +import org.eclipse.jst.pagedesigner.parts.TextEditPart; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.Text; + +/** + * @author mengbo + */ +public class ParagraphApplyStyleCommand extends ApplyStyleCommand { + + /** + * the list of possible html heading tags + */ + private static final String[] HH = { "h1", "h2", "h3", "h4", "h5", "h6" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + + /** + * @param viewer + * @param tag + * @param property + * @param value + */ + public ParagraphApplyStyleCommand(IHTMLGraphicalViewer viewer, String tag, + String property, String value) { + super(viewer, tag, property, value); + } + + /** + * @param viewer + * @param node + * @param property + * @param value + */ + public ParagraphApplyStyleCommand(IHTMLGraphicalViewer viewer, + Element node, String property, String value) { + super(viewer, node, property, value); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.RangeModeCommand#doRangeExecute(org.eclipse.jst.pagedesigner.dom.DOMRange) + */ + protected DOMRange doRangeExecute(DOMRange range) { + if (range != null) { + boolean ordered = range.isOrdered(); + IDOMPosition start = ordered ? range.getStartPosition() : range + .getEndPosition(); + IDOMPosition end = ordered ? range.getEndPosition() : range + .getStartPosition(); + Node common = null; + Node container = null; + if (EditModelQuery.isSame(range)) { + container = start.getContainerNode(); + ParagraphFinder finder = new ParagraphFinder(start); + Paragraph p = finder.getParagraph(start); + start = p.getStart(); + end = p.getEnd(); + common = p.getLowestContainer(); + } else { + common = EditModelQuery.getInstance().getCommonAncestor(start, + end); + } + DOMRange rt; + // This code is for h1-h6 only, it may need to be replaced. + if ((rt = replaceExistingH(start, end)) != null) { + return rt; + } + // replace existing p + if (getTag().equalsIgnoreCase(IHTMLConstants.TAG_P)) { + rt = replaceExistingP(start, end); + if (rt != null) { + return rt; + } + } + if (start.getContainerNode() == end.getContainerNode()) { + int offset1 = start.getOffset(); + int offset2 = end.getOffset(); + IDOMPosition old = start; + start = split(start); + // parent is splited + if (start != old) { + container = start.getNextSiblingNode(); + offset2 -= offset1; + end = new DOMPosition(container, offset2); + } + end = split(end); + } else { + start = split(common, start); + end = split(common, end); + } + range = InsertStyleTag(new DOMRange(start, end)); + } + return range; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.gef.commands.Command#canExecute() + */ + public boolean canExecute() { + return true; + } + + /* + * Try to split the node so that we can avoid wrap its children directly. + * Begining from 'position' the split can reach as high as the level of + * 'common'. + */ + private IDOMPosition split(Node common, IDOMPosition position) { + Assert.isTrue(EditModelQuery.isChild(common, position + .getContainerNode())); + Node container = position.getContainerNode(); + String[] styleNodes = new String[EditModelQuery.HTML_STYLE_NODES.size()]; + EditModelQuery.HTML_STYLE_NODES.toArray(styleNodes); + while (EditModelQuery.isText(container) || (container != common && // + EditModelQuery.containItem(styleNodes, container, true))) { + IDOMPosition old = position; + position = EditHelper.splitNode(position); + if (old == position) { + int pos = EditHelper.getLocation(position); + switch (pos) { + case -1: + position = new DOMRefPosition(position.getContainerNode(), + false); + break; + case 1: + position = new DOMRefPosition(position.getContainerNode(), + true); + } + } + Node containerBackup = container; + container = container.getParentNode(); + if (containerBackup.getNodeName().equalsIgnoreCase( + IHTMLConstants.TAG_P)) { + container.removeChild(containerBackup); + } + } + return position; + } + + /* + * Split the position's container node only. + */ + private IDOMPosition split(IDOMPosition position) { + Node container = position.getContainerNode(); + String[] styleNodes = new String[EditModelQuery.HTML_STYLE_NODES.size()]; + EditModelQuery.HTML_STYLE_NODES.toArray(styleNodes); + if (EditModelQuery.isText(container) + || EditModelQuery.containItem(styleNodes, container, true)) { + return EditHelper.splitNode(position); + } + return position; + } + + private DOMRange replaceExistingH(IDOMPosition start, IDOMPosition end) { + Node common = EditModelQuery.getInstance() + .getCommonAncestor(start, end); + // Here we insert some code to avoid creating tags duplicated. but these + // are not the entire cases. + if (Arrays.asList(HH).contains( + getAName(getTag()).toLowerCase()) + && Arrays.asList(HH).contains( + getAName(common.getNodeName()).toLowerCase())) { + // uncheck action menu + if (getAName(getTag()).toLowerCase().equalsIgnoreCase( + getAName(common.getNodeName()).toLowerCase())) { + NodeList nodes = common.getChildNodes(); + + for (int i = 0, size = nodes.getLength(); i < size; i++) { + common.getParentNode().insertBefore(nodes.item(i), common); + } + common.getParentNode().removeChild(common); + return new DOMRange(start, end); + } + start = DOMPositionHelper.toDOMRefPosition(start); + end = DOMPositionHelper.toDOMRefPosition(end); + Node newHNode = EditModelQuery.getDocumentNode(common) + .createElement(getTag()); + EditModelQuery.copyChildren(common, newHNode); + common.getParentNode().replaceChild(newHNode, common); + return new DOMRange(start, end); + } + return null; + } + + private DOMRange replaceExistingP(IDOMPosition start, IDOMPosition end) { + // find the selected startNode,endNode and start node's parent node + Node startNode = start instanceof IDOMRefPosition ? start + .getNextSiblingNode() : start.getContainerNode(); + Node endNode = end instanceof IDOMRefPosition ? end + .getPreviousSiblingNode() : end.getContainerNode(); + Node parentNode = startNode.getParentNode(); + + if (!(start.isText()) && start instanceof DOMPosition) { + startNode = startNode.getChildNodes().item(start.getOffset()); + parentNode = start.getContainerNode(); + } + if (!(end.isText()) && end instanceof DOMPosition) { + // because the offset is based on the position between nodes,so we + // need to reduce one from the offset + // in order to get the correct end node. + endNode = endNode.getChildNodes().item(end.getOffset() - 1); + } + + // compute selected character number in the text or selected element + // number under a node + int len = 0; +// if (start instanceof DOMPosition && end instanceof DOMPosition +// || start instanceof IDOMPosition && end instanceof IDOMPosition) { + // TODO: as written, this will be the only statement run, since + // both start and end are instanceof IDOMPosition by defn. + len = end.getOffset() - start.getOffset(); +// } else { +// IDOMRefPosition startRef = null; +// IDOMRefPosition endRef = null; +// if (!(start.isText()) && start instanceof DOMPosition) { +// startRef = new DOMRefPosition(startNode, false); +// } else if (!(end.isText()) && end instanceof DOMPosition) { +// endRef = new DOMRefPosition(endNode, true); +// } +// len = (endRef != null ? endRef.getOffset() : end.getOffset()) +// - (startRef != null ? startRef.getOffset() : start +// .getOffset()); +// } + + // if a full Text node is selected,and the Text node is the only child + // of its parent + if ((startNode == endNode) && (startNode instanceof Text)) { + TextEditPart part = (TextEditPart) ((INodeNotifier) startNode) + .getAdapterFor(EditPart.class); + boolean condition = false; + if (start instanceof IDOMRefPosition + || (start instanceof DOMPosition && !start.isText())) { + condition = parentNode.getNodeName().equalsIgnoreCase( + IHTMLConstants.TAG_P) + && parentNode.getChildNodes().getLength() == 1; + } else { + condition = parentNode.getNodeName().equalsIgnoreCase( + IHTMLConstants.TAG_P) + && parentNode.getChildNodes().getLength() == 1 + && part.getTextData().length() == len; + } + if (condition) { + // if uncheck the align action + if (this.getApplyingNode() + .getAttribute(IHTMLConstants.ATTR_ALIGN) + .equals( + ((Element) parentNode) + .getAttribute(IHTMLConstants.ATTR_ALIGN))) { + ((Element) parentNode) + .removeAttribute(IHTMLConstants.ATTR_ALIGN); + IDOMPosition startPos = new DOMPosition(parentNode, 0); + IDOMPosition endPos = new DOMRefPosition(endNode, true); + return new DOMRange(startPos, endPos); + } + // else replace the align attribute + /** + * this._applyingNode.appendChild(startNode); + * parentNode.getParentNode().replaceChild(this._applyingNode, + * parentNode); + */ + String align = this.getApplyingNode() + .getAttribute(IHTMLConstants.ATTR_ALIGN); + ((Element) parentNode).setAttribute(IHTMLConstants.ATTR_ALIGN, + align); + + IDOMPosition startPos = new DOMPosition(parentNode, 0); + IDOMPosition endPos = new DOMRefPosition(endNode, true); + return new DOMRange(startPos, endPos); + } + } else { + if (parentNode != null + && parentNode.getNodeName().equalsIgnoreCase( + IHTMLConstants.TAG_P) + && parentNode.getChildNodes().getLength() == len) { + if (this.getApplyingNode() + .getAttribute(IHTMLConstants.ATTR_ALIGN) + .equals( + ((Element) parentNode) + .getAttribute(IHTMLConstants.ATTR_ALIGN))) { + ((Element) parentNode) + .removeAttribute(IHTMLConstants.ATTR_ALIGN); + IDOMPosition startPos = new DOMPosition(parentNode, 0); + IDOMPosition endPos = new DOMRefPosition(endNode, true); + return new DOMRange(startPos, endPos); + } + + /** + * Node sibling = startNode.getNextSibling(); + * this._applyingNode.appendChild(startNode); Node + * endNodeSibling = endNode.getNextSibling(); while (sibling != + * null && startNode != endNode && sibling != endNodeSibling) { + * Node tempNode = sibling.getNextSibling(); + * this._applyingNode.appendChild(sibling); sibling = tempNode; } + * parentNode.getParentNode().replaceChild(this._applyingNode, + * parentNode); + */ + String align = this.getApplyingNode() + .getAttribute(IHTMLConstants.ATTR_ALIGN); + ((Element) parentNode).setAttribute(IHTMLConstants.ATTR_ALIGN, + align); + + IDOMPosition startPos = new DOMPosition(parentNode, 0); + IDOMPosition endPos = new DOMRefPosition(endNode, true); + return new DOMRange(startPos, endPos); + } + } + return null; + } + + private DOMRange InsertStyleTag(DOMRange range) { + if (range == null || range.isEmpty()) { + return null; + } + + boolean ordered = range.isOrdered(); + IDOMPosition start = ordered ? range.getStartPosition() : range + .getEndPosition(); + IDOMPosition end = ordered ? range.getEndPosition() : range + .getStartPosition(); + + Node startContainer = start.getContainerNode(); + Node endContainer = end.getContainerNode(); + + Node common = DOMUtil.findCommonAncester(start.getContainerNode(), end + .getContainerNode()); + if (common == null) { + // should not happen. + return null; + } + if (startContainer instanceof Text) { + // if the start offset is 0,then skip split the Text + if (start.getOffset() > 0) { + startContainer = ((Text) startContainer).splitText(start + .getOffset()); + start = new DOMRefPosition(startContainer, false); + } + } else { + startContainer = start.getNextSiblingNode(); + } + if (endContainer instanceof Text) { + if (end.getOffset() > 0) { + endContainer = ((Text) endContainer).splitText(end + .getOffset()); + endContainer = endContainer.getPreviousSibling(); + } else { + endContainer = endContainer.getPreviousSibling(); + } + } else { + endContainer = end.getPreviousSiblingNode(); + } + + // now the startContainer and the endContainer should share the same + // parent + Element newNode = createStyleElement(); + startContainer.getParentNode() + .insertBefore(newNode, startContainer); + + Node sibling = startContainer.getNextSibling(); + newNode.appendChild(startContainer); + Node endNodeSibling = endContainer.getNextSibling(); + while (sibling != null && startContainer != endContainer + && sibling != endNodeSibling) { + Node tempNode = sibling.getNextSibling(); + newNode.appendChild(sibling); + sibling = tempNode; + } + + IDOMPosition startPos = new DOMPosition(newNode, 0); + IDOMPosition endPos = new DOMRefPosition(endContainer, true); + return new DOMRange(startPos, endPos); + } + + private static String getAName(String name) { + return name == null ? "" : name; //$NON-NLS-1$ + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphFinder.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphFinder.java new file mode 100755 index 0000000..fed2482 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphFinder.java @@ -0,0 +1,124 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jst.jsf.core.internal.tld.IJSFConstants; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.dom.DOMPosition; +import org.eclipse.jst.pagedesigner.dom.DOMRefPosition; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class ParagraphFinder { + private final IDOMPosition _position; + + /** + * @param position + */ + public ParagraphFinder(IDOMPosition position) { + _position = position; + } + + /** + * @return the dom position + */ + public IDOMPosition getPosition() { + return _position; + } + + private Node findInlineSiblings(IDOMPosition position, List result, + boolean forward) { + Node container = EditModelQuery.getInstance().getSibling(position, + forward); + if (!forward) { + while (container != null) { + if (EditModelQuery.isInline(container)) { + result.add(container); + } else { + return container; + } + container = container.getPreviousSibling(); + } + } else { + while (container != null) { + if (EditModelQuery.isInline(container)) { + result.add(container); + } else { + return container; + } + container = container.getNextSibling(); + } + } + // the result will be non-zero length. + return null; + } + + private Node getParagraphNodes(IDOMPosition position, List result, + boolean forward) { + Node sResult = findInlineSiblings(position, result, forward); + Node container = position.getContainerNode(); + container = position.isText() ? container.getParentNode() : container; + while (sResult == null) { + // stop at block, special container and H style nodes. + if (EditModelQuery.isBlockNode(container) + || EditModelQuery.isDocument(container) + || (container.getLocalName() != null && (container + .getLocalName().equals(IJSFConstants.TAG_VIEW) || container + .getLocalName().equalsIgnoreCase( + IHTMLConstants.TAG_HTML)))) { + return container; + } + position = new DOMRefPosition(container, forward); + sResult = findInlineSiblings(position, result, forward); + container = container.getParentNode(); + } + return sResult; + } + + /** + * Search for an area between two block nodes or within a block node, search + * will stop before or under a node which has block display-type, or + * particular container like "html", jsf "view", .etc, two positions (left + * and right) are returned in result. + * + * The searcher will search parent's directly children, if no block node is + * found, then go up the node tree to search again. + * + * @param position + * @return the paragraph + */ + public Paragraph getParagraph(IDOMPosition position) { + List tempResult = new ArrayList(); + IDOMPosition p1, p2; + Node r1 = getParagraphNodes(position, tempResult, true); + if (EditModelQuery.isChild(r1, position.getContainerNode())) { + p1 = new DOMPosition(r1, r1.getChildNodes().getLength()); + } else { + p1 = new DOMRefPosition(r1, false); + } + + Node r2 = getParagraphNodes(position, tempResult, false); + if (EditModelQuery.isChild(r2, position.getContainerNode())) { + p2 = new DOMPosition(r2, 0); + } else { + p2 = new DOMRefPosition(r2, true); + } + return new Paragraph(p1, p2); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphUnapplyStyleCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphUnapplyStyleCommand.java new file mode 100755 index 0000000..7f3afec --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/ParagraphUnapplyStyleCommand.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public class ParagraphUnapplyStyleCommand extends ApplyStyleCommand { + private String _groupTags[]; + + /** + * @param viewer + * @param tags + * @param property + * @param value + */ + public ParagraphUnapplyStyleCommand(IHTMLGraphicalViewer viewer, + String[] tags, String property, String value) { + super(viewer, "", property, value); //$NON-NLS-1$ + _groupTags = tags; + } + + /** + * @param viewer + * @param node + * @param property + * @param value + */ + public ParagraphUnapplyStyleCommand(IHTMLGraphicalViewer viewer, + Element node, String property, String value) { + super(viewer, node, property, value); + } + + private DOMRange removeExistingStyles(IDOMPosition start, IDOMPosition end) { + Node common = null; + if (EditModelQuery.isSame(start, end)) { + ParagraphFinder finder = new ParagraphFinder(start); + Paragraph p = finder.getParagraph(start); + start = p.getStart(); + end = p.getEnd(); + common = p.getLowestContainer(); + } else { + common = EditModelQuery.getInstance().getCommonAncestor(start, end); + } + // Here we insert some code to avoid creating tags duplicated. but these + // are not the entire cases. + // if (Arrays.asList(_groupTags).contains(common.getNodeName())) + if (EditModelQuery.containItem(_groupTags, common, true)) { + start = DOMPositionHelper.toDOMRefPosition(start); + end = DOMPositionHelper.toDOMRefPosition(end); + Node parent = common.getParentNode(); + EditModelQuery.copyChildren(common, parent); + common.getParentNode().removeChild(common); + return new DOMRange(start, end); + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.RangeModeCommand#doRangeExecute(org.eclipse.jst.pagedesigner.dom.DOMRange) + */ + protected DOMRange doRangeExecute(DOMRange range) { + return removeExistingStyles(range.getStartPosition(), range + .getEndPosition()); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/PasteCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/PasteCommand.java new file mode 100755 index 0000000..f75a638 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/PasteCommand.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; + +/** + * @author mengbo + */ +public class PasteCommand extends RangeModeCommand { + + /** + * @param viewer + */ + public PasteCommand(IHTMLGraphicalViewer viewer) { + super(CommandResources.getString("PasteCommand.Label.Paste"), viewer); //$NON-NLS-1$ + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.RangeModeCommand#doRangeExecute(org.eclipse.jst.pagedesigner.dom.DOMRange) + */ + protected DOMRange doRangeExecute(DOMRange selection) { + InsertEdit edit = new InsertEdit(selection, getViewer(), + new ClipboardData(getViewer().getControl())); + if (edit.operate()) { + return new DOMRange(edit.getOperationPosition(), edit + .getOperationPosition()); + } + return selection; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/RangeModeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/RangeModeCommand.java new file mode 100755 index 0000000..b6e302f --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/RangeModeCommand.java @@ -0,0 +1,171 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.EditValidateUtil; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.parts.ElementEditPart; +import org.eclipse.jst.pagedesigner.viewer.DesignPosition; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public abstract class RangeModeCommand extends DesignerCommand { +// private static final Logger _log = PDPlugin +// .getLogger(RangeModeCommand.class); + + DOMRange _resultRange = null; + + /** + * @param label + * @param viewer + */ + public RangeModeCommand(String label, IHTMLGraphicalViewer viewer) { + super(label, viewer); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#prePreExecute() + */ + protected boolean prePreExecute() { + int position = -1; + int length = -1; + ISelection selection = getViewer().getSelection(); + if (selection != null) { + if (getViewer().isInRangeMode()) { + DesignRange range = (DesignRange) selection; + if (range.isValid()) { + IDOMPosition domPos = DOMPositionHelper.toDOMPosition(range + .getStartPosition()); + IDOMPosition domEnd = DOMPositionHelper.toDOMPosition(range + .getEndPosition()); + if (!EditValidateUtil.validPosition(domPos) + || !EditValidateUtil.validPosition(domEnd)) { + return false; + } + position = EditModelQuery.getIndexedRegionLocation(domPos); + int end = EditModelQuery.getIndexedRegionLocation(domEnd); + if (end < position) { + length = position - end; + position = end; + } else { + length = end - position; + } + } + } else { + Object object = ((IStructuredSelection) selection) + .getFirstElement(); + if (object instanceof ElementEditPart) { + Node node = ((ElementEditPart) object).getIDOMNode(); + position = EditModelQuery.getNodeStartIndex(node); + length = EditModelQuery.getNodeLenth(node); + } else { + return false; + } + } + if (position >= 0 && length >= 0) { + getModel().beginRecording(this, getLabel(), position, length); + } else { + getModel().beginRecording(this, getLabel()); + } + getViewer().startSelectionChange(); + getModel().aboutToChangeModel(); + return true; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected final void doExecute() { + DesignRange range = getViewer().getRangeSelection(); + if (range != null && range.isValid()) { + DOMRange domrange = (range == null || !range.isValid()) ? null + : toDOMRange(range); + _resultRange = doRangeExecute(domrange); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected final ISelection getAfterCommandDesignerSelection() { +// try { + if (_resultRange == null) { + return null; + } + IDOMPosition startPos = _resultRange.getStartPosition(); + DesignPosition start = DOMPositionHelper.toDesignPosition(startPos); + if (_resultRange.isEmpty()) { + return new DesignRange(start, start); + } + IDOMPosition endPos = _resultRange.getEndPosition(); + return new DesignRange(start, DOMPositionHelper + .toDesignPosition(endPos)); + // TODO: don't know what this exception catch is for +// } catch (Exception e) { +// // "Selection error" +// _log.error("Error.RangeModeCommand.SetSelection"); //$NON-NLS-1$ +// return null; +// } + } + + /** + * @param range + * @return + */ + private DOMRange toDOMRange(DesignRange range) { + return new DOMRange(DOMPositionHelper.toDOMPosition(range + .getStartPosition()), DOMPositionHelper.toDOMPosition(range + .getEndPosition())); + } + + /** + * In the implementation of this method, should not do anything relating to + * EditPart. (maybe even not ICSSStyle, since not style information not + * refreshed yet) + * @param selection + * + * @return null means no change have been done to the model. In this case, + * system may choose to cancel undo recorrding, etc. + */ + protected abstract DOMRange doRangeExecute(DOMRange selection); + + /** + * @param parent + * @param ref + * @param child + */ + protected static void appendChild(Node parent, Node ref, Node child) { + Node next = ref.getNextSibling(); + if (next == null) + parent.appendChild(child); + else + parent.insertBefore(child, next); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/SelectAllCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/SelectAllCommand.java new file mode 100755 index 0000000..c4d2c8c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/SelectAllCommand.java @@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.gef.commands.Command; +import org.eclipse.jst.pagedesigner.dom.DOMPosition; +import org.eclipse.jst.pagedesigner.dom.DOMPositionHelper; +import org.eclipse.jst.pagedesigner.dom.EditHelper; +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.eclipse.jst.pagedesigner.dom.EditValidateUtil; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.validation.caret.ActionData; +import org.eclipse.jst.pagedesigner.validation.caret.IMovementMediator; +import org.eclipse.jst.pagedesigner.validation.caret.InlineEditingNavigationMediator; +import org.eclipse.jst.pagedesigner.validation.caret.JSFRootContainerPositionRule; +import org.eclipse.jst.pagedesigner.validation.caret.RootContainerPositionRule; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +/** + * Called in response to a Ctrl-A-style select all action + * + */ +public class SelectAllCommand extends Command { + private IHTMLGraphicalViewer _viewer; + + /** + * @param label + * @param viewer + */ + public SelectAllCommand(String label, IHTMLGraphicalViewer viewer) { + super(label); + _viewer = viewer; + } + + public void execute() { + Node document = _viewer.getModel().getDocument(); + IMovementMediator validator = new InlineEditingNavigationMediator( + new ActionData(ActionData.KEYBOARD_NAVAGATION, null)); + Node htmlRoot = RootContainerPositionRule + .getBasicContainer((Document) document); + Node jsfRoot = JSFRootContainerPositionRule + .getBasicContainer((Document) document, 3); + Node root; + if (htmlRoot != null && jsfRoot != null) { + if (EditModelQuery.isChild(htmlRoot, jsfRoot)) { + root = htmlRoot; + } else if (EditModelQuery.isChild(jsfRoot, htmlRoot)) { + root = jsfRoot; + } else { + root = htmlRoot; + } + } else { + if (htmlRoot != null) { + root = htmlRoot; + } else if (jsfRoot != null) { + root = jsfRoot; + } else { + root = document; + } + } + IDOMPosition position1, position2; + // if (root.hasChildNodes()) + // { + // Node first = root.getFirstChild(); + // position1 = new DOMRefPosition(first, false); + // Node last = root.getLastChild(); + // position2 = new DOMRefPosition(last, true); + // } + // else + // { + position1 = new DOMPosition(root, 0); + position2 = new DOMPosition(root, root.getChildNodes().getLength()); + // } + if (!validator.isValidPosition(position1)) { + position1 = EditHelper.moveToNextEditPosition(position1, true, + validator); + } + if (!validator.isValidPosition(position2)) { + position2 = EditHelper.moveToNextEditPosition(position2, false, + validator); + } + if (EditValidateUtil.validPosition(position1) + && EditValidateUtil.validPosition(position2)) { + _viewer.setRange(DOMPositionHelper.toDesignPosition(position1), + DOMPositionHelper.toDesignPosition(position2)); + } + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/UnapplyStyleCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/UnapplyStyleCommand.java new file mode 100755 index 0000000..e52c3b3 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/UnapplyStyleCommand.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.DOMUtil; +import org.eclipse.jst.pagedesigner.dom.IDOMPosition; +import org.eclipse.jst.pagedesigner.viewer.IHTMLGraphicalViewer; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * @author mengbo + */ +public class UnapplyStyleCommand extends ApplyStyleCommand { + /** + * @param viewer + * @param tag + * @param property + * @param value + */ + public UnapplyStyleCommand(IHTMLGraphicalViewer viewer, String tag, + String property, String value) { + super(viewer, tag, property, value); + } + + /** + * @param viewer + * @param node + * @param property + * @param value + */ + public UnapplyStyleCommand(IHTMLGraphicalViewer viewer, Element node, + String property, String value) { + super(viewer, node, property, value); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.range.RangeModeCommand#doRangeExecute(org.eclipse.jst.pagedesigner.dom.DOMRange) + */ + protected DOMRange doRangeExecute(DOMRange range) { + if (range == null || range.isEmpty()) { + return null; + } + + boolean ordered = range.isOrdered(); + IDOMPosition start = ordered ? range.getStartPosition() : range + .getEndPosition(); + IDOMPosition end = ordered ? range.getEndPosition() : range + .getStartPosition(); + + Node common = DOMUtil.findCommonAncester(start.getContainerNode(), end + .getContainerNode()); + if (common == null) { + // should not happen. + return null; + } + + if (common instanceof Text) { + doTextNodeStyleApply((Text) common, start.getOffset(), end + .getOffset()); + } + + return null; + } + + /** + * @param start + * @param end + * @param common + */ + private DOMRange doTextNodeStyleApply(Text textNode, int startOffset, + int endOffset) { + return null; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/WorkNode.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/WorkNode.java new file mode 100755 index 0000000..331438e --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/range/WorkNode.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.range; + +import org.eclipse.jst.pagedesigner.dom.EditModelQuery; +import org.w3c.dom.Node; + +/** + * @author mengbo + */ +public final class WorkNode { + private WorkNode parent; + + private WorkNode previous; + + private WorkNode next; + + private Node node; + + private final int pos[]; + + private boolean isRoot; + + /** + * @param node + * @param pos1 + * @param pos2 + */ + public WorkNode(Node node, final int pos1, final int pos2) { + this.pos = resoveOffsets(node, pos1, pos2); + this.node = node; + } + + /** + * @return Returns the node. + */ + public Node getNode() { + return node; + } + + /** + * @param node + * The node to set. + */ + public void setNode(Node node) { + this.node = node; + } + + /** + * @return the offsets + */ + int[] getQualifiedOffsets() { + int result[] = new int[] { getPosOffsets()[0], getPosOffsets()[1] }; + result[0] = result[0] < 0 ? 0 : result[0]; + int length = EditModelQuery.getNodeLenth(node); + result[0] = result[0] > length ? length : result[0]; + result[1] = result[1] < 0 ? 0 : result[1]; + result[1] = result[1] > length ? length : result[1]; + return result; + } + + /** + * @return Returns the pos. + */ + public int[] getPosOffsets() { + return pos; + } + + /** + * @return Returns the isRoot. + */ + public boolean isRoot() { + return isRoot; + } + + /** + * @param isRoot + * The isRoot to set. + */ + public void setRoot(boolean isRoot) { + this.isRoot = isRoot; + } + + /** + * @return Returns the next. + */ + public WorkNode getNext() { + return next; + } + + /** + * @param next + * The next to set. + */ + public void setNext(WorkNode next) { + this.next = next; + } + + /** + * @return Returns the parent. + */ + public WorkNode getParent() { + return parent; + } + + /** + * @param parent + * The parent to set. + */ + public void setParent(WorkNode parent) { + this.parent = parent; + } + + /** + * @return Returns the previous. + */ + public WorkNode getPrevious() { + return previous; + } + + /** + * @param previous + * The previous to set. + */ + public void setPrevious(WorkNode previous) { + this.previous = previous; + } + + private int[] resoveOffsets(Node node1, int pos1, int pos2) { + int left = EditModelQuery.getNodeStartIndex(node1); + return new int[] { pos1 - left, pos2 - left }; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("Node:").append(node).append(" pos[]:").append(pos); //$NON-NLS-1$ //$NON-NLS-2$ + return sb.toString(); + } + + boolean isWholeSelected() { + int start = EditModelQuery.getNodeStartIndex(node); + int end = EditModelQuery.getNodeEndIndex(node); + return getQualifiedOffsets()[0] <= 0 + && getQualifiedOffsets()[1] >= end - start; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/AddSubNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/AddSubNodeCommand.java new file mode 100755 index 0000000..a7e2f1c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/AddSubNodeCommand.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.single; + +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; +import org.eclipse.jst.pagedesigner.utils.JSPUtil; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * @author mengbo + * @version 1.5 + */ +public class AddSubNodeCommand extends SingleNodeCommand { + private final IDOMElement _parent; + private IDOMElement _child; + + private final String _tagName; + + private final String _url; + + private final Map _attributes; + + /** + * @param label + * @param node + * @param name + * @param url + * @param attributs + */ + public AddSubNodeCommand(String label, IDOMElement node, String name, + String url, Map attributs) { + super(label, node); + this._parent = node; + this._tagName = name; + this._url = url; + this._attributes = attributs; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + String nodeName = null; + if (ITLDConstants.URI_HTML.equals(_url)) { + nodeName = _tagName; + } else { + String prefix = JSPUtil.getOrCreatePrefix(_parent.getModel(), _url, null); + nodeName = prefix + ":" + _tagName; //$NON-NLS-1$ + } + + _child = (IDOMElement) _parent.getOwnerDocument().createElement(nodeName); + + if (_child == null) { + return; + } + + for (Iterator iterator = _attributes.keySet().iterator(); iterator + .hasNext();) { + String key = (String) iterator.next(); + String value = (String) _attributes.get(key); + _child.setAttribute(key, value); + } + + _parent.appendChild(_child); + } + + /** + * @return the child node + */ + public IDOMElement getChildNode() { + return _child; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeAttributeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeAttributeCommand.java new file mode 100755 index 0000000..629f97c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeAttributeCommand.java @@ -0,0 +1,119 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.single; + +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * This command is for change an single attribute of an IDOMElement. Normally + * used by the properties view. + * + * @author mengbo + */ +public class ChangeAttributeCommand extends SingleNodeCommand { + private IDOMElement _element; + + private String _attrValue; + + private String _attrName; + + private Map _attributes; + + private boolean _keepEmptyAttribute = false; + + /** + * + * @param label + * @param node + * @param attrName + * @param attrValue + * if null means remove the specified attribute + */ + public ChangeAttributeCommand(String label, IDOMElement node, + String attrName, String attrValue) { + super(label, node); + _element = node; + _attrName = attrName; + _attrValue = attrValue; + _attributes = null; + } + + /** TODO: can these two constructors be merged? + * @param label + * @param node + * @param attributes + */ + public ChangeAttributeCommand(String label, IDOMElement node, Map attributes) { + super(label, node); + _element = node; + _attributes = attributes; + _attrName = null; + _attrValue = null; + } + + protected void doExecute() { + if (_attrName != null) { + updateElement(_attrName, _attrValue); + } else if (_attributes != null) { + for (Iterator iterator = _attributes.keySet().iterator(); iterator + .hasNext();) { + String name = (String) iterator.next(); + String value = (String) _attributes.get(name); + if (isSameValue(value, _element.getAttribute(name))) { + continue; + } + updateElement(name, value); + } + } + } + + private void updateElement(String name, String value) { + if (_element.hasAttribute(name) && isEmptyString(value) + && !_keepEmptyAttribute) { + _element.removeAttribute(name); + } + if (!isEmptyString(value) || _keepEmptyAttribute) { + _element.setAttribute(name, value); + } + } + + private boolean isSameValue(String value1, String value2) { + value1 = value1 == null ? "" : value1; //$NON-NLS-1$ + value2 = value2 == null ? "" : value2; //$NON-NLS-1$ + return value1.equals(value2); + } + + private boolean isEmptyString(String str) { + if (str == null || str.equals("")) { //$NON-NLS-1$ + return true; + } + return false; + } + + /** + * @return Returns the keepEmptyAttribute. + */ + public boolean isKeepEmptyAttribute() { + return _keepEmptyAttribute; + } + + /** + * @param keepEmptyAttribute + * The keepEmptyAttribute to set. + */ + public void setKeepEmptyAttribute(boolean keepEmptyAttribute) { + this._keepEmptyAttribute = keepEmptyAttribute; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeStyleCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeStyleCommand.java new file mode 100755 index 0000000..171a21b --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeStyleCommand.java @@ -0,0 +1,108 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.single; + +import java.util.Map; + +import org.eclipse.jst.pagedesigner.commands.CommandResources; +import org.eclipse.jst.pagedesigner.dom.DOMStyleUtil; +import org.eclipse.jst.pagedesigner.properties.celleditors.CSSStyleDeclarationFactory; +import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration; +import org.eclipse.wst.css.core.internal.util.declaration.CSSPropertyContext; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; +import org.w3c.dom.css.ElementCSSInlineStyle; + +/** + * @author mengbo + * @version 1.5 + */ +public class ChangeStyleCommand extends SingleNodeCommand { + private Map _styleProperties = null; + + private CSSPropertyContext _context = null; + + private String _styleAttrName; + + /** + * @param node + * @param map + */ + public ChangeStyleCommand(IDOMElement node, Map map) { + super(CommandResources + .getString("ChangeStyleCommand.Label.ChangeStyle"), node); //$NON-NLS-1$ + _styleProperties = map; + _styleAttrName = "style"; //$NON-NLS-1$ + } + + /** + * @param node + * @param styleAttrName + * @param map + */ + public ChangeStyleCommand(IDOMElement node, String styleAttrName, Map map) { + super(CommandResources + .getString("ChangeStyleCommand.Label.ChangeStyle"), node); //$NON-NLS-1$ + _styleProperties = map; + _styleAttrName = styleAttrName; + } + + /** + * @param node + * @param context + * @deprecated + */ + public ChangeStyleCommand(IDOMElement node, CSSPropertyContext context) { + super(CommandResources + .getString("ChangeStyleCommand.Label.ChangeStyle"), node); //$NON-NLS-1$ + _context = context; + _styleAttrName = "style"; //$NON-NLS-1$ + } + + /** + * @param node + * @param styleAttrName + * @param context + */ + public ChangeStyleCommand(IDOMElement node, String styleAttrName, CSSPropertyContext context) { + super(CommandResources + .getString("ChangeStyleCommand.Label.ChangeStyle"), node); //$NON-NLS-1$ + _context = context; + _styleAttrName = styleAttrName; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + getOriginalElement().getModel().beginRecording(this); + try { + if (_styleProperties != null) { + IDOMElement original = this.getOriginalElement(); + DOMStyleUtil.insertStyle(original, _styleAttrName, _styleProperties); + } else if (_context != null) { + ICSSStyleDeclaration styleDeclaration = CSSStyleDeclarationFactory.getInstance().getStyleDeclaration(getOriginalElement(), _styleAttrName); + + if (styleDeclaration == null) { + getOriginalElement().setAttribute(_styleAttrName, + ""); //$NON-NLS-1$ + styleDeclaration = (ICSSStyleDeclaration) ((ElementCSSInlineStyle) getOriginalElement()) + .getStyle(); + } + _context.applyModified(styleDeclaration); + } + } finally { + getOriginalElement().getModel().endRecording(this); + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeTagCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeTagCommand.java new file mode 100755 index 0000000..50061a3 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/ChangeTagCommand.java @@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.single; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; +import org.eclipse.jst.pagedesigner.utils.JSPUtil; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; +import org.w3c.dom.Attr; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * This is for command that changes an element's tagname and some attributes. + * + * @author mengbo + */ +public class ChangeTagCommand extends SingleNodeCommand { + private final IDOMElement _element; + + private final Map _attributes; + + private final boolean _moveContent; + + private String _uri; + + private String _localTag; + + private String _totalTag; + + /** + * @param label + * @param node + * @param totaltag + * @param attributes + * @param movecontent + */ + public ChangeTagCommand(String label, IDOMElement node, String totaltag, + Map attributes, boolean movecontent) { + super(label, node); + this._element = node; + this._totalTag = totaltag; + this._attributes = attributes; + this._moveContent = movecontent; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + String tag = null; + + if (_totalTag != null) { + tag = _totalTag; + } else { + if (ITLDConstants.URI_HTML.equals(_uri)) { + tag = _localTag; + } else if (ITLDConstants.URI_JSP.equals(_uri)) { + tag = "jsp:" + _localTag; //$NON-NLS-1$ + } else { + tag = JSPUtil.getOrCreatePrefix(getModel(), _uri, null) + + _localTag; + } + } + // we need to remove the old element and create a new one with the new + // tag. + IDOMElement replacement = (IDOMElement) _element.getOwnerDocument() + .createElement(tag); + NamedNodeMap attrs = _element.getAttributes(); + for (int i = 0, n = attrs.getLength(); i < n; i++) { + Attr a = (Attr) attrs.item(i); + replacement.setAttribute(a.getName(), a.getValue()); + } + if (_attributes != null) { + for (Iterator iter = _attributes.keySet().iterator(); iter + .hasNext();) { + String name = (String) iter.next(); + String value = (String) _attributes.get(name); + replacement.setAttribute(name, value); + } + } + if (_moveContent) { + NodeList nl = _element.getChildNodes(); + ArrayList list = new ArrayList(); + for (int i = 0, n = nl.getLength(); i < n; i++) { + list.add(nl.item(i)); + + } + for (int i = 0, n = list.size(); i < n; i++) { + replacement.appendChild((Node) list.get(i)); + } + } + _element.getParentNode().replaceChild(replacement, _element); + setReplacedElement(replacement); + } + + /** + * @return the replacemd element + */ + public IDOMElement getNewElement() { + return getReplacedElment(); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/InsertSubNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/InsertSubNodeCommand.java new file mode 100755 index 0000000..d6b069c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/InsertSubNodeCommand.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.single; + +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * @author mengbo + * @version 1.5 + */ +public class InsertSubNodeCommand extends SingleNodeCommand { + private IDOMElement _parent, _child, _refchild; + + /** + * @param label + * @param parent + * @param child + * @param refchild + */ + public InsertSubNodeCommand(String label, IDOMElement parent, + IDOMElement child, IDOMElement refchild) { + super(label, parent); + this._parent = parent; + this._child = child; + this._refchild = refchild; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + _parent.insertBefore(_child, _refchild); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/RemoveSubNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/RemoveSubNodeCommand.java new file mode 100755 index 0000000..d3f67ff --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/RemoveSubNodeCommand.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.single; + +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * @author mengbo + * @version 1.5 + */ +public class RemoveSubNodeCommand extends SingleNodeCommand { + private IDOMElement _parent, _child; + + /** + * @param label + * @param parent + * @param child + */ + public RemoveSubNodeCommand(String label, IDOMElement parent, + IDOMElement child) { + super(label, parent); + _parent = parent; + _child = child; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#doExecute() + */ + protected void doExecute() { + _parent.removeChild(_child); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/SingleNodeCommand.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/SingleNodeCommand.java new file mode 100755 index 0000000..1e34cf9 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/commands/single/SingleNodeCommand.java @@ -0,0 +1,149 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.commands.single; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.gef.EditPart; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jst.pagedesigner.commands.DesignerCommand; +import org.eclipse.jst.pagedesigner.dom.DOMRange; +import org.eclipse.jst.pagedesigner.dom.DOMRangeHelper; +import org.eclipse.jst.pagedesigner.viewer.DesignRange; +import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; + +/** + * This is the super class for those commands that change attribute or tag name + * of a single element. + * + * This base class helps handles selection. As after the command, the editpart + * may totally change, so it tried to remember the selection before command and + * then restore it after the command. + * + * So the limitation to child class of this command is that: the command should + * only change a single element node. It could remove the node and replace with + * a new one, but should not touch other nodes. + * + * @author mengbo + */ +public abstract class SingleNodeCommand extends DesignerCommand { + List _structuredSelectedNodes = null; + + DOMRange _rangeSelection = null; + + IDOMElement _originalElement; + + IDOMElement _replacement; + + /** + * @param label + * @param node + */ + public SingleNodeCommand(String label, IDOMElement node) { + super(label, node); + _originalElement = node; + } + + protected void preExecute() { + super.preExecute(); + // remember current selection + ISelection selection = getViewer().getSelection(); + if (selection instanceof IStructuredSelection) { + Object[] array = ((IStructuredSelection) selection).toArray(); + _structuredSelectedNodes = new ArrayList(); + if (array != null) { + for (int i = 0; i < array.length; i++) { + EditPart part = (EditPart) array[i]; + _structuredSelectedNodes.add(part.getModel()); + } + } + } else if (selection instanceof DesignRange) { + DesignRange range = (DesignRange) selection; + _rangeSelection = DOMRangeHelper.toDOMRange(range); + } + } + + /** + * this method is to be called by child class in the doExecute() method. + * Telling the super class that the original element will be replaced by the + * specified element. + * + * @param ele + */ + protected void setReplacedElement(IDOMElement ele) { + _replacement = ele; + } + + /** + * @return the replacement element + */ + protected IDOMElement getReplacedElment() { + return _replacement; + } + + /** + * @return the original element + */ + protected IDOMElement getOriginalElement() { + return _originalElement; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.commands.DesignerCommand#getAfterCommandDesignerSelection() + */ + protected final ISelection getAfterCommandDesignerSelection() { + if (_structuredSelectedNodes != null) { + // handle replacement fire. + if (_replacement != null && _replacement != _originalElement) { + int index = _structuredSelectedNodes.indexOf(_originalElement); + if (index >= 0) { + _structuredSelectedNodes.set(index, _replacement); + } + } + + // as the editpart may have been refreshed, so recreated the + // selection + List parts = new ArrayList(); + for (int i = 0, size = _structuredSelectedNodes.size(); i < size; i++) { + Object obj = _structuredSelectedNodes.get(i); + if (obj instanceof INodeNotifier) { + EditPart part = (EditPart) ((INodeNotifier) obj) + .getAdapterFor(EditPart.class); + if (part != null) + parts.add(part); + } + } + StructuredSelection sel = new StructuredSelection(parts); + return sel; + } else if (_rangeSelection != null) { + DOMRange newrange = handleReplacement(_rangeSelection, + _originalElement, _replacement); + return DOMRangeHelper.toDesignRange(newrange); + } else { + return null; + } + } + + private DOMRange handleReplacement(DOMRange selection, + IDOMElement original, IDOMElement replacement) { + if (replacement == null || replacement == original) + return selection; + return DOMRangeHelper.handleReplacement(selection, original, + replacement); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java new file mode 100755 index 0000000..1ff6b98 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/AbstractTagConverter.java @@ -0,0 +1,500 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo; +import org.eclipse.jst.pagedesigner.dom.DOMUtil; +import org.eclipse.jst.pagedesigner.preview.PageExpressionContext; +import org.eclipse.swt.graphics.Image; +import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; +import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * This is base class for all non-hidden tag converters. + * + * @author mengbo + * @version 1.5 + */ +public abstract class AbstractTagConverter implements ITagConverter, + ITagEditInfo, INodeAdapter, IDOMFactory { + private IDOMDocument _targetDocument; + + private Element _hostElement; + + private Element _resultElement; + + private List _childNodes = Collections.EMPTY_LIST; + + private Map _childNodePositions = Collections.EMPTY_MAP; + + private int _mode; + + private int _minWidth; + + private int _minHeight; + + private boolean _needBorderDecorator; + + /** + * @param host + * + */ + public AbstractTagConverter(Element host) { + _hostElement = host; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#setTargetDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument) + */ + public void setDestDocument(IDOMDocument document) { + _targetDocument = document; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#convertRefresh(java.lang.Object) + */ + public final void convertRefresh(Object context) { + _resultElement = null; + _childNodes = new ArrayList(); + _childNodePositions = new HashMap(); + + _resultElement = doConvertRefresh(); + if (_resultElement instanceof INodeNotifier) { + ((INodeNotifier) _resultElement).addAdapter(this); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.sse.core.internal.provisional.INodeAdapter#notifyChanged(org.eclipse.wst.sse.core.internal.provisional.INodeNotifier, + * int, java.lang.Object, java.lang.Object, java.lang.Object, int) + */ + public void notifyChanged(INodeNotifier notifier, int eventType, + Object changedFeature, Object oldValue, Object newValue, int pos) { + // do nothing. + } + + /** + * Child class should override this method. The child class should NEVER + * change the host DOM structure. + * + * @return the convert result. Should be an HTML element. + */ + protected abstract Element doConvertRefresh(); + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getHostElement() + */ + public final Element getHostElement() { + return _hostElement; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getResultElement() + */ + public final Element getResultElement() { + return _resultElement; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getChildModeList() + */ + public final List getChildModeList() { + return _childNodes; + } + + + public List getNonVisualChildren() + { + // by default, no non-visual children + return Collections.EMPTY_LIST; + } + + /** + * child class should call this method. + * + * @param childNode + * the childNode of the hostElement that should be futher + * converted. + * @param position + * + */ + protected void addChild(Node childNode, ConvertPosition position) { + _childNodes.add(childNode); + _childNodePositions.put(childNode, position); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getChildVisualPosition(org.w3c.dom.Node) + */ + public final ConvertPosition getChildVisualPosition(Node childModel) { + return (ConvertPosition) _childNodePositions.get(childModel); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#isVisualByHTML() + */ + public boolean isVisualByHTML() { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getVisualImage() + */ + public Image getVisualImage() { + return null; + } + + /* + * (non-Javadoc) + * + * @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 + } + + /** + * @param node + * @return true if the node should be ignored for conversion purposes + */ + protected boolean shouldIgnore(Node node) { + int nodeType = node.getNodeType(); + switch (nodeType) { + case Node.TEXT_NODE: + case Node.CDATA_SECTION_NODE: + case Node.ELEMENT_NODE: + return false; + default: + return true; + } + + } + + /** + * utility method for those converter that only converts the host tag's name + * and directly copy children. + * @param src + * @param dest + * + */ + protected void copyChildren(Element src, Element dest) { + Node node = src.getFirstChild(); + int index = 0; + for (; node != null; node = node.getNextSibling()) { + if (!shouldIgnore(node)) { + addChild(node, new ConvertPosition(dest, index++)); + } + } + } + + /** + * utility method for those converter that directly copy children. + * @param src + * @param dest + * + */ + protected void dumCopyChildren(Element src, Element dest) { + Node node = src.getFirstChild(); + Document destDoc = dest.getOwnerDocument(); + for (; node != null; node = node.getNextSibling()) { + if (!shouldIgnore(node)) { + Node n = DOMUtil.cloneNodeDeepIgnoreError(destDoc, node); + dest.appendChild(n); + } + } + } + + /** + * In the future, the conversion result HTML DOM tree could be in another + * document. + * + * @return the destination document + */ + public IDOMDocument getDestDocument() { + if (this._targetDocument != null) { + return this._targetDocument; + } + return (IDOMDocument) _hostElement.getOwnerDocument(); + } + + /** + * shortcut method. Child class should always use this method to create a + * result element. + * + * @param tagName + * @return a new element named tagName + */ + public Element createElement(String tagName) { + return getDestDocument().createElement(tagName); + } + + /** + * shortcut method. Child class should always use this method to create a + * text node. + * + * @param text + * @return a new text node using text as the value + */ + public Text createText(String text) { + return getDestDocument().createTextNode(text); + } + + /** + * @param original + * @return the mapped String TODO: currently does nothing + */ + protected String mapURL(String original) { + // TODO: how to map URL? such as original url look like: + // getContext().getPath()+... + return original; + } + + // TODO: FIXME: XXX: + // if the value is expression, we may want to do something here!!! + /** + * @param value + * @return value mapped based on EL expression + */ + protected String mapValue(String value) { + if (value == null) { + return null; + } + if (isDesignerMode()) { + // if there has jsf binding expressions + int checkPos = value.indexOf("#{"); //$NON-NLS-1$ + if (checkPos != -1) { + String mapValue = ""; //$NON-NLS-1$ + int preferType = PreferenceReader.getMapValueType(); + switch (preferType) { + case PreferenceReader.FULL_EXPRESSION_TYPE: + mapValue = value; + break; + case PreferenceReader.LAST_EXPRESSION_TYPE: + String strBackup = value; + StringBuffer sb = new StringBuffer(); + while (strBackup.indexOf("#{") != -1) { //$NON-NLS-1$ + int pos = strBackup.indexOf("#{"); //$NON-NLS-1$ + int endBracketPos = strBackup.indexOf("}", pos + 1); //$NON-NLS-1$ + if (endBracketPos != -1) { + sb.append(strBackup.substring(0, pos + 2)); + String exp = strBackup.substring(pos + 2, + endBracketPos); + if (allowTrim(exp)) { + int lastDotPos = exp.lastIndexOf("."); //$NON-NLS-1$ + if (lastDotPos != -1) { + String convertedExp = exp + .substring(lastDotPos + 1); + sb.append(convertedExp); + } else { + sb.append(exp); + } + + } else { + sb.append(exp); + } + sb.append("}"); //$NON-NLS-1$ + } else { + break; + } + if (strBackup.length() > endBracketPos + 1) { + strBackup = strBackup.substring(endBracketPos + 1); + } else { + strBackup = ""; //$NON-NLS-1$ + break; + } + + } + sb.append(strBackup); + mapValue = sb.toString(); + break; + case PreferenceReader.REAL_VALUE_TYPE: + // TODO calculate the expression value + default: + mapValue = value; + break; + } + + return mapValue; + } + } else { + // preview mode. let's try to display the value. + try { + //Bug 319317 - Third-party plug-in providing javax.servlet.jsp.el version 2.1 or greater breaks WPE preview + Map options = new HashMap(); + options.put("ELEMENT", _hostElement); //$NON-NLS-1$ + return (String) PageExpressionContext.getCurrent() + .evaluateExpression(value, String.class, options); + } catch (Exception ex) { + // can't calculate the result. ignore. + // ex.printStackTrace(); + } + } + return value; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#needBorderDecorator() + */ + public boolean needBorderDecorator() { + return this._needBorderDecorator; + } + + /** + * @param b + */ + public void setNeedBorderDecorator(boolean b) { + this._needBorderDecorator = b; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#needTableDecorator() + */ + public boolean needTableDecorator() { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.wst.sse.core.internal.provisional.INodeAdapter#isAdapterForType(java.lang.Object) + */ + public boolean isAdapterForType(Object type) { + if (type == ITagEditInfo.class) { + return true; + } + return false; + } + + /** + * @param mode + */ + public final void setMode(int mode) { + this._mode = mode; + } + + /** + * @return true if the converter mode is preview + */ + public final boolean isPreviewMode() { + return this._mode == IConverterFactory.MODE_PREVIEW; + } + + /** + * @return true if the converter mode is designer + */ + public final boolean isDesignerMode() { + return this._mode == IConverterFactory.MODE_DESIGNER; + } + + /** + * @return the converter mode + */ + public final int getMode() { + return this._mode; + } + + /** + * The method is used to judge whether the value binding and method binding + * expression is allowed to be trimmed.Currently only expression contains + * only letter,digit,and '.' is allowed to be trimmed. + * + * @param expression + * value binding or method binding expression + * @return + */ + private boolean allowTrim(String expression) { + for (int i = 0, size = expression.length(); i < size; i++) { + char ch = expression.charAt(i); + if (!Character.isLetterOrDigit(ch) && (ch != '.') && (ch != '_')) { + return false; + } + } + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#getMinWidth() + */ + public int getMinWidth() { + return this._minWidth; + } + + /** + * @param minWidth + */ + public void setMinWidth(int minWidth) { + this._minWidth = minWidth; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#getMinHeight() + */ + public int getMinHeight() { + return this._minHeight; + } + + /** + * @param minHeight + */ + public void setMinHeight(int minHeight) { + this._minHeight = minHeight; + } + + /** + * @param element + * @param attrname + * @return the attribute on element with the name attrname + */ + public static boolean hasAttribute(Element element, String attrname) { + return element.hasAttribute(attrname); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConvertPosition.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConvertPosition.java new file mode 100755 index 0000000..6b65673 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConvertPosition.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.w3c.dom.Node; + +/** + * This class is used to locate a position for child model nodes. + * + * @author mengbo + * @version 1.5 + */ +public class ConvertPosition { + private final Node _parentNode; + + private final int _index; + + /** + * @param parent \ + * @param index + * + */ + public ConvertPosition(Node parent, int index) { + this._parentNode = parent; + this._index = index; + } + + /** + * @return the parent node + */ + public Node getParentNode() { + return _parentNode; + } + + /** + * @return the index + */ + public int getIndex() { + return _index; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFacRegistryReader.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFacRegistryReader.java new file mode 100755 index 0000000..8f318ad --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFacRegistryReader.java @@ -0,0 +1,117 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jst.pagedesigner.IJMTConstants; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.PageDesignerTraceOptions; + +/** + * @author mengbo + * @version 1.5 + */ +public class ConverterFacRegistryReader { + private static List _handlers = null; + + /** + * @return the list of handlers. The list is not modifiable and will + * throw exceptions if it is attempted. + */ + public static synchronized List getAllHandlers() { + if (_handlers == null) { + _handlers = readAllHandlers(); + } + return Collections.unmodifiableList(_handlers); + + } + + private static List readAllHandlers() + { + final List result = new ArrayList(); + IExtensionPoint extensionPoint = Platform.getExtensionRegistry() + .getExtensionPoint(PDPlugin.getPluginId(), + IJMTConstants.EXTENSION_POINT_PAGEDESIGNER); + IExtension[] extensions = extensionPoint.getExtensions(); + + for (int i = 0; i < extensions.length; i++) + { + IExtension ext = extensions[i]; + IConfigurationElement[] tagConverter = ext + .getConfigurationElements(); + + for (int j = 0; j < tagConverter.length; j++) + { + final IConfigurationElement element = tagConverter[j]; + + if (element.getName().equals( + IJMTConstants.TAG_CONVERTER_FACTORY)) + { + element.getAttribute("class"); //$NON-NLS-1$ + Object obj; + try + { + obj = element.createExecutableExtension("class"); //$NON-NLS-1$ + + if (element.getContributor().getName().startsWith( + "org.eclipse.jst")) //$NON-NLS-1$ + { + if (PageDesignerTraceOptions.TRACE_CONVERTERLOAD) + { + PageDesignerTraceOptions.log("ConverterFacRegistryReader: Appending to list:"+obj.getClass().getName()); //$NON-NLS-1$ + } + // push JSF tools provided ones to the end + result.add((IConverterFactory) obj); + } + // prepend if something outside JSF tools declared it + else + { + if (PageDesignerTraceOptions.TRACE_CONVERTERLOAD) + { + PageDesignerTraceOptions.log("ConverterFacRegistryReader: Prepending to list:"+obj.getClass().getName()); //$NON-NLS-1$ + } + // this way, adopters can put their overrides + // of factories with built-in support like + // JSF HTML/CORE will be used first + result.add(0, (IConverterFactory) obj); + } + + } + catch (CoreException e) + { + PDPlugin.log("Problem loading tag converter extension for "+element.toString(), e); //$NON-NLS-1$ + } + } + } + } + + if (PageDesignerTraceOptions.TRACE_CONVERTERLOAD) + { + PageDesignerTraceOptions.log("\nFinal converterFactory list in order:"); //$NON-NLS-1$ + for (final IConverterFactory factory : result) + { + PageDesignerTraceOptions.log(factory.getClass().getName()); + } + PageDesignerTraceOptions.log("\n"); //$NON-NLS-1$ + } + return result; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java new file mode 100755 index 0000000..3899211 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterFactoryRegistry.java @@ -0,0 +1,231 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin; +import org.eclipse.jst.jsf.common.ui.internal.utils.JSFSharedImages; +import org.eclipse.jst.jsf.core.internal.tld.CMUtil; +import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; +import org.eclipse.jst.pagedesigner.PageDesignerTraceOptions; +import org.eclipse.jst.pagedesigner.converter.html.HTMLConverterFactory; +import org.eclipse.jst.pagedesigner.converter.jsp.JSPConverterFactory; +import org.eclipse.swt.graphics.Image; +import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class ConverterFactoryRegistry +{ + List _factories = new ArrayList(); + + private static ConverterFactoryRegistry _instance; + + /** + * + */ + private ConverterFactoryRegistry() + { + final List facs = ConverterFacRegistryReader + .getAllHandlers(); + if (facs != null) + { + for (final IConverterFactory fac : facs) + { + addFactory(fac); + } + } + _factories.add(new JSPConverterFactory()); + _factories.add(new HTMLConverterFactory()); + + // TODO: this is not ideal, but until we get a better system for + // doing converter factory ordering: + // loop through the list and place the DTManager + } + + /** + * @param fac + */ + public void addFactory(final IConverterFactory fac) + { + _factories.add(fac); + } + + /** + * @param ele + * @param mode + * @param targetDocument + * @return the new btag converter + */ + public ITagConverter createTagConverter(final Element ele, final int mode, + final IDOMDocument targetDocument) + { + final ITagConverter converter = internalCreateTagConverter(ele, mode); + if (converter != null) + { + converter.setDestDocument(targetDocument); + } + return converter; + } + + /** + * @param ele + * @param mode + * @return the new tag converter + */ + protected final ITagConverter internalCreateTagConverter(final Element ele, + final int mode) + { + final String uri = CMUtil.getElementNamespaceURI(ele); + // first round, match uri + for (int i = 0, size = _factories.size(); i < size; i++) + { + final IConverterFactory fac = (IConverterFactory) _factories.get(i); + final String facuri = fac.getSupportedURI(); + if (facuri != null && facuri.equals(uri)) + { + final ITagConverter converter = fac.createConverter(ele, mode); + if (converter != null) + { + if (PageDesignerTraceOptions.TRACE_CONVERTERSELECT) + { + PageDesignerTraceOptions + .log("ConverterFactoryRegistry: first loop, " //$NON-NLS-1$ + + String + .format( + "Selected converter %s for uri=%s, tagname=%s", //$NON-NLS-1$ + converter.getClass() + .getName(), + uri, ele.getLocalName())); + } + return converter; + } + } + } + // second round + for (int i = 0, size = _factories.size(); i < size; i++) + { + final IConverterFactory fac = (IConverterFactory) _factories.get(i); + final String facuri = fac.getSupportedURI(); + if (facuri == null) + { + final ITagConverter converter = fac.createConverter(ele, mode); + if (converter != null) + { + if (PageDesignerTraceOptions.TRACE_CONVERTERSELECT) + { + PageDesignerTraceOptions + .log("ConverterFactoryRegistry: second loop, " //$NON-NLS-1$ + + String + .format( + "Selected converter %s for uri=%s, tagname=%s", //$NON-NLS-1$ + converter.getClass() + .getName(), + uri, ele.getLocalName())); + } + return converter; + } + } + } + + // can't find. We need some default tag converter for it. + // if the tag is empty, show it as icon. + if (uri == null || ITLDConstants.URI_HTML.equals(uri)) + { + if (PageDesignerTraceOptions.TRACE_CONVERTERSELECT) + { + PageDesignerTraceOptions + .log("ConverterFactoryRegistry: factory not found, " //$NON-NLS-1$ + + String + .format( + "Selected DumTagConverter for uri=%s, tagname=%s", //$NON-NLS-1$ + uri, ele.getLocalName())); + } + + // basically, for HTML or non JSP tag, directly renders it. + return new DumTagConverter(ele); + } + final CMElementDeclaration decl = CMUtil.getElementDeclaration(ele); + if (decl == null) + { + if (PageDesignerTraceOptions.TRACE_CONVERTERSELECT) + { + PageDesignerTraceOptions + .log("ConverterFactoryRegistry: factory and decl not found, " //$NON-NLS-1$ + + String + .format( + "Selected DumTagConverter for uri=%s, tagname=%s", //$NON-NLS-1$ + uri, ele.getLocalName())); + } + return new DumTagConverter(ele); + } + final int contentType = decl.getContentType(); + if (contentType == CMElementDeclaration.EMPTY) + { + if (PageDesignerTraceOptions.TRACE_CONVERTERSELECT) + { + PageDesignerTraceOptions + .log("ConverterFactoryRegistry: factory not found, content is EMPTY, " //$NON-NLS-1$ + + String + .format( + "Selected HiddenTagConverter with UnknownImage for uri=%s, tagname=%s", //$NON-NLS-1$ + uri, ele.getLocalName())); + } + + // if the tag is empty, show it as icon. + return new HiddenTagConverter(ele, new LabelProvider() + { + @Override + public Image getImage(final Object element) + { + return getUnknownImage(); + } + }); + } + if (PageDesignerTraceOptions.TRACE_CONVERTERSELECT) + { + PageDesignerTraceOptions + .log("ConverterFactoryRegistry: fall-through to default case, " //$NON-NLS-1$ + + String + .format( + "Selected DefaultUnknownTagConverter with UnknownImage for uri=%s, tagname=%s", //$NON-NLS-1$ + uri, ele.getLocalName())); + } + return new DefaultUnknownTagConverter(ele, mode); + + } + + private static Image getUnknownImage() + { + return JSFUICommonPlugin.getDefault().getImage( + JSFSharedImages.DEFAULT_PALETTE_TAG_IMG); + } + + /** + * @return the singleton instance of the registry + */ + public synchronized static ConverterFactoryRegistry getInstance() + { + if (_instance == null) + { + _instance = new ConverterFactoryRegistry(); + } + return _instance; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterUtil.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterUtil.java new file mode 100755 index 0000000..3d9670f --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ConverterUtil.java @@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import java.util.Set; + +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.dtmanager.DTManager; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * @author mengbo + * @version 1.5 + */ +public class ConverterUtil { + /** + * + * @param source + * @param dest + * @param ignore + */ + public static void copyAllAttributes(Element source, Element dest, + Set ignore) { + NamedNodeMap attrs = source.getAttributes(); + for (int i = 0, size = attrs.getLength(); i < size; i++) { + Attr attr = (Attr) attrs.item(i); + if (ignore == null || !ignore.contains(attr.getName())) { + dest.setAttribute(attr.getName(), attr.getValue()); + } + } + } + + /** + * copy a single attribute (if exist) + * + * @param source + * @param srcattr + * @param dest + * @param destattr + */ + public static void copyAttribute(Element source, String srcattr, + Element dest, String destattr) { + Attr attr = source.getAttributeNode(srcattr); + if (attr != null) { + dest.setAttribute(destattr, attr.getValue()); + } + } + + /** + * @param hostElement + * @return true if hostElement represents an empty container + */ + public static boolean isEmptyContainer(Element hostElement) { + String hostElementString = hostElement.toString(); + if (hostElementString != null && hostElementString.startsWith("/")) { //$NON-NLS-1$ + return false; + } + NodeList nl = hostElement.getChildNodes(); + if (nl == null || nl.getLength() == 0) { + return true; + } + + for (int i = 0, n = nl.getLength(); i < n; i++) { + Node node = nl.item(i); + if (!(node instanceof IDOMText)) { + return false; + } + if (!((IDOMText) node).isElementContentWhitespace()) { + return false; + } + } + return true; + } + + /** + * @param document + * @param text + * @return the description element in the document containing text + */ + public static Element createDescriptionElement(IDOMDocument document, + String text) { + if (document == null) { + return null; + } + Element span = document.createElement(IHTMLConstants.TAG_SPAN); + span.setAttribute( + "style", "color:gray;font-style:italic;font-size:normal;"); //$NON-NLS-1$ //$NON-NLS-2$ + if (text == null) { + span.appendChild(document.createTextNode(PDPlugin + .getResourceString("ConverterUtil.Description"))); //$NON-NLS-1$ + } else { + span.appendChild(document.createTextNode(text)); + } + return span; + } + + /** + * Method to find the resulting converted tag containing a given + * source element. The converted element that will be + * the parent tag is returned so the caller can then determine + * if the parent is part of a table, header, body, footer, row, + * cell, or some other element. + * + * @param srcElem the source element to test. + * @param childElem a child of the source element (used by a + * recursive call to handle special case where + * it was moved up a level to the child model + * list of the grandparent). + * @return a converted element of the type that will contain the + * source element. + */ + static Node findConvertedParentElement(Element srcElem, Element childElem) { + Node parent = srcElem.getParentNode(); + if ((parent == null) || !(parent instanceof Element)) { + return null; + } + + String name = parent.getNodeName(); + if (IHTMLConstants.TAG_HTML.equalsIgnoreCase(name) + || IHTMLConstants.TAG_BODY.equalsIgnoreCase(name)) { + return null; + } + + ITagConverter converter = createTagConverter((Element) parent); + if (!converter.isVisualByHTML()) { + return null; + } + + converter.convertRefresh(null); + ConvertPosition position = null; + if (childElem != null) { + // If a child node (grand child of current parent) was + // passed in, check for its position. It may have been + // moved up a level to child model list of the current + // parent. In JSF this is done with a header or + // footer facet tag in a column tag for a dataTable. + position = converter.getChildVisualPosition(childElem); + } + if (position == null) { + position = converter.getChildVisualPosition(srcElem); + } + if (position != null) { + // return the node that will contain the visual + // child and then the caller can check to see if this + // element is table mark-up. + return position.getParentNode(); + } + + // The current source element is not in the child model + // list for the converted parent so recurse to next + // ancestor and pass source element to see if it has been + // moved up a level as child model of the grandparent. + return findConvertedParentElement((Element) parent, srcElem); + } + + private static ITagConverter createTagConverter(Element ele) { + return DTManager.getInstance().getTagConverter(ele, + IConverterFactory.MODE_DESIGNER, null); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DefaultUnknownTagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DefaultUnknownTagConverter.java new file mode 100755 index 0000000..87e90f4 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DefaultUnknownTagConverter.java @@ -0,0 +1,180 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.utils.DOMUtil; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.Text; + +/** + * This tag converter is for those unsupported jsp tags. + * + * @author mengbo + * @version 1.5 + */ +public class DefaultUnknownTagConverter extends AbstractTagConverter { + + private static final int NO_ELEMENT = 0; + private static final int TABLE_ELEMENT = 1; + private static final int TABLE_ROW_ELEMENT = 2; + + /** + * @param host + * @param mode + */ + public DefaultUnknownTagConverter(Element host, int mode) { + super(host); + setMode(mode); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + Element hostEle = this.getHostElement(); + + // Test to see if the src element is contained in an + // element that renders as a table. If so, render this + // element accordingly as content in the table. + // This is done to address the use case where tags + // (such as JSTL) are used in collaboration within HTML + // tables. The CSS layout for tables does not handle + // invalid HTML so this change tries to produce valid + // HTML. If the table layout code gets updated to handle + // invalid HTML tables, then this code can be removed. + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=253974 + Node containingElement = ConverterUtil.findConvertedParentElement(hostEle, null); + String name = null; + if (containingElement != null) { + name = containingElement.getNodeName(); + } + if (name != null) { + if (IHTMLConstants.TAG_TABLE.equalsIgnoreCase(name) + || IHTMLConstants.TAG_TBODY.equalsIgnoreCase(name) + || IHTMLConstants.TAG_TFOOT.equalsIgnoreCase(name)) { + // this element is contained in a table, tbody or tfoot + return renderAsTableRow(hostEle, false, TABLE_ELEMENT); + } else if (IHTMLConstants.TAG_THEAD.equalsIgnoreCase(name)) { + // this element is contained in a thead + return renderAsTableRow(hostEle, true, TABLE_ELEMENT); + } else if (IHTMLConstants.TAG_TR.equalsIgnoreCase(name)) { + // this element is contained in a tr + return renderAsTableCell(hostEle, false, TABLE_ROW_ELEMENT); + } + } + + // Otherwise, use the default rendering for an unknown tag + return renderDefault(hostEle, NO_ELEMENT); + } + + private Element renderDefault(Element hostEle, int tableElement) { + // rendering for host element not contained in a table + Element divEle = createElement("div"); //$NON-NLS-1$ + String style = DOMUtil.getAttributeIgnoreCase(hostEle, "style"); //$NON-NLS-1$ + if (style == null) { + style = ""; //$NON-NLS-1$ + } + if (style.length() > 0 && !style.endsWith(";")) { //$NON-NLS-1$ + style += ";"; //$NON-NLS-1$ + } + style += "border: none; padding: 0; margin: 0"; //$NON-NLS-1$ + divEle.setAttribute("style", style); //$NON-NLS-1$ + Element div2 = createElement("span"); //$NON-NLS-1$ + String border = isPreviewMode() ? "border-style: solid;border-width: 1px" : "border:none"; //$NON-NLS-1$ //$NON-NLS-2$ + div2.setAttribute("style", "background-color: white;"+border+";color:gray"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Text txt = createText(hostEle.getTagName()); + div2.appendChild(txt); + + divEle.appendChild(div2); + + Element childContainer = null; + switch (tableElement) { + case TABLE_ELEMENT: + childContainer = createElement(IHTMLConstants.TAG_TABLE); + copyChildren(getHostElement(), childContainer); + break; + case TABLE_ROW_ELEMENT: + childContainer = createElement(IHTMLConstants.TAG_TABLE); + Element trElem = createElement(IHTMLConstants.TAG_TR); + childContainer.appendChild(trElem); + copyChildren(getHostElement(), trElem); + break; + case NO_ELEMENT: + default: + childContainer = createElement("div"); //$NON-NLS-1$ + childContainer.setAttribute("style", "margin: 0; padding: 0"); //$NON-NLS-1$ //$NON-NLS-2$ + copyChildren(getHostElement(), childContainer); + break; + } + + divEle.appendChild(childContainer); + + return divEle; + } + + /* + * Creates a table row, and adds either a table cell (data + * or a header depending on the boolean flag). + */ + private Element renderAsTableRow(Element hostEle, boolean isHeader, int tableElement) { + Element trElem = createElement(IHTMLConstants.TAG_TR); + Element tdElem = renderAsTableCell(hostEle, isHeader, tableElement); + trElem.appendChild(tdElem); + return trElem; + } + + /* + * Creates a table cell, as either data or a header depending + * on the boolean flag. + */ + private Element renderAsTableCell(Element hostEle, boolean isHeader, int tableElement) { + Element tdElem = null; + if (isHeader) { + tdElem = createElement(IHTMLConstants.TAG_TH); + } else { + tdElem = createElement(IHTMLConstants.TAG_TD); + } + tdElem.appendChild(renderDefault(hostEle, tableElement)); + return tdElem; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#isWidget() + */ + public boolean isWidget() { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#needBorderDecorator() + */ + public boolean needBorderDecorator() { + return true; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDeepTagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDeepTagConverter.java new file mode 100755 index 0000000..6cc1949 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDeepTagConverter.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.eclipse.jst.pagedesigner.dom.DOMUtil; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class DumDeepTagConverter extends AbstractTagConverter { + + /** + * @param host + */ + public DumDeepTagConverter(Element host) { + super(host); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + return (Element) DOMUtil.cloneNodeDeepIgnoreError(getDestDocument(), + getHostElement()); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return true; + } + + // 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) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#isWidget() + */ + public boolean isWidget() { + return true; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDescriptionTagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDescriptionTagConverter.java new file mode 100755 index 0000000..4ba255c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumDescriptionTagConverter.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class DumDescriptionTagConverter extends AbstractTagConverter { + /** + * @param host + */ + public DumDescriptionTagConverter(Element host) { + super(host); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + Element result = createElement(getHostElement().getTagName()); + ConverterUtil.copyAllAttributes(getHostElement(), result, null); + copyChildren(getHostElement(), result); + + if (!this.isPreviewMode() + && ConverterUtil.isEmptyContainer(getHostElement())) { + result.appendChild(ConverterUtil.createDescriptionElement( + getDestDocument(), null)); + } + + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#isWidget() + */ + public boolean isWidget() { + return false; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java new file mode 100755 index 0000000..eea8dc1 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/DumTagConverter.java @@ -0,0 +1,96 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class DumTagConverter extends AbstractTagConverter { + /** + * @param host + * @param needBorder + */ + public DumTagConverter(Element host, boolean needBorder) { + this(host); + this.setNeedBorderDecorator(needBorder); + } + + /** + * @param host + */ + public DumTagConverter(Element host) { + super(host); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + Element result = createElement(getHostElement().getTagName()); + ConverterUtil.copyAllAttributes(getHostElement(), result, null); + if (!internalIsWidget(result)) { + copyChildren(getHostElement(), result); + } else { + dumCopyChildren(getHostElement(), result); + } + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + if (isWidget()) { + return true; + } + return false; + } + + /** + * @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_OBJECT.equalsIgnoreCase(tagname) + || IHTMLConstants.TAG_HEAD.equalsIgnoreCase(tagname) + || IHTMLConstants.TAG_SCRIPT.equalsIgnoreCase(tagname) + || IHTMLConstants.TAG_LINK.equalsIgnoreCase(tagname) + || IHTMLConstants.TAG_BR.equalsIgnoreCase(tagname) + || IHTMLConstants.TAG_STYLE.equalsIgnoreCase(tagname) + || IHTMLConstants.TAG_HR.equalsIgnoreCase(tagname)) { + return true; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#isWidget() + */ + public boolean isWidget() { + return internalIsWidget(getResultElement()); + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HTMLStringTagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HTMLStringTagConverter.java new file mode 100755 index 0000000..853da6c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HTMLStringTagConverter.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.jst.jsf.common.ui.internal.utils.ResourceUtils; +import org.eclipse.jst.pagedesigner.PDPlugin; +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.xml.core.internal.provisional.document.IDOMModel; +import org.w3c.dom.Element; + +/** + * For some tag, could generate some XML code. + * + * @author mengbo + * @version 1.5 + */ +public abstract class HTMLStringTagConverter extends AbstractTagConverter { + + static Logger _log = PDPlugin.getLogger(HTMLStringTagConverter.class); + + /** + * @param host + */ + public HTMLStringTagConverter(Element host) { + super(host); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + // following are XML implementation. Assume the string is welformed HTML + // try + // { + // String html = getGeneratedHTML(); + // DocumentBuilder builder = + // DocumentBuilderFactory.newInstance().newDocumentBuilder(); + // Element result = builder.parse(new InputSource(new + // StringReader(html))).getDocumentElement(); + // return (Element)DOMUtil.cloneNodeDeep(this.getDestDocument(), + // result); + // } + // catch(Exception ex) + // { + // Element temp = createElement("div"); + // temp.appendChild(createText("ERROR: "+ex.getMessage())); + // return temp; + // } + InputStream stream = null; + try { + String id = "" + System.currentTimeMillis() + ".html"; //$NON-NLS-1$ //$NON-NLS-2$ + IModelManager manager = StructuredModelManager.getModelManager(); + stream = new ByteArrayInputStream(getGeneratedHTML().getBytes()); + IDOMModel model = (IDOMModel) manager.getModelForRead(id, stream, + null); + Element root = model.getDocument().getDocumentElement(); + Element resultEle = (Element) DOMUtil.cloneNodeDeepIgnoreError( + getDestDocument(), root); + model.releaseFromRead(); + return resultEle; + } catch (Exception ex) { + _log.error("Log.Error.HTMLStringTagConverter.Error", ex); //$NON-NLS-1$ + Element temp = createElement("div"); //$NON-NLS-1$ + temp.appendChild(createText("Error loading: " + ex.getMessage())); //$NON-NLS-1$ + return temp; + } finally { + ResourceUtils.ensureClosed(stream); + } + } + + /** + * @return the generated HTML string + * @throws Exception + */ + public abstract String getGeneratedHTML() throws Exception; + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#isWidget() + */ + public boolean isWidget() { + return true; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java new file mode 100755 index 0000000..c799544 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter.java @@ -0,0 +1,168 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.swt.graphics.Image; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * This is for those tags that don't convert to HTML. So they will not display + * anything in preview, and will display a small icon in designer. + * + * @author mengbo + * @version 1.5 + */ +public class HiddenTagConverter implements ITagConverter { + private Element _hostElement; + + private ILabelProvider _labelProvider; + + private int _mode; + + /** + * @param host + * @param labelProvider + * + */ + public HiddenTagConverter(Element host, ILabelProvider labelProvider) { + _hostElement = host; + //_image = image; + _labelProvider = labelProvider; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#setDestDocument(org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument) + */ + public void setDestDocument(IDOMDocument document) { + // do nothing? + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#convertRefresh(java.lang.Object) + */ + public void convertRefresh(Object context) { + // do nothing + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getHostElement() + */ + public Element getHostElement() { + return _hostElement; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#isVisualByHTML() + */ + public boolean isVisualByHTML() { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getVisualImage() + */ + public Image getVisualImage() { + // defer the creation of the image until it is needed + return _labelProvider.getImage(this); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getResultElement() + */ + public Element getResultElement() { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getChildModeList() + */ + public List getChildModeList() { + return Collections.EMPTY_LIST; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#getChildVisualPosition(org.w3c.dom.Node) + */ + public ConvertPosition getChildVisualPosition(Node childModel) { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#isWidget() + */ + public boolean isWidget() { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.visualtag.ITagConverter#dispose() + */ + public void dispose() { + // do nothing + // TODO: dispose of image or Element here? + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#setMode(int) + */ + public void setMode(int mode) { + this._mode = mode; + } + + /** + * @return the mode + */ + public int getMode() { + return _mode; + } + + public List getNonVisualChildren() { + return Collections.EMPTY_LIST; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter2.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter2.java new file mode 100755 index 0000000..b1f05b9 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/HiddenTagConverter2.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.eclipse.jst.pagedesigner.dom.DOMUtil; +import org.eclipse.swt.graphics.Image; +import org.w3c.dom.Element; + +/** + * HiddenTagConverter2 is similiar to HiddenTagConverter, with the following + * difference: + * + *
    + *
  1. HiddenTagConverter2 will copy the DOM sub tree to the destination + * document.
  2. + *
+ * + * TODO: this the wrong way to do this. This should sub-class HiddenTagConverter + * + * @author mengbo + * @version 1.5 + */ +public class HiddenTagConverter2 extends AbstractTagConverter { + + private Image _image; + + /** + * @param host + * @param image + */ + public HiddenTagConverter2(Element host, Image image) { + super(host); + this._image = image; + } + + protected Element doConvertRefresh() { + return (Element) DOMUtil.cloneNodeDeepIgnoreError(getDestDocument(), + getHostElement()); + } + + public boolean isVisualByHTML() { + return false; + } + + public Image getVisualImage() { + return _image; + } + + public boolean isMultiLevel() { + return true; + } + + public boolean isWidget() { + return true; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IConverterFactory.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IConverterFactory.java new file mode 100755 index 0000000..76070fc --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IConverterFactory.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public interface IConverterFactory { + /** + * indicates designer mode + */ + public static final int MODE_DESIGNER = 0; + + /** + * indicates preview mode + */ + public static final int MODE_PREVIEW = 1; + + /** + * + * @param element + * @param mode + * @return null if this factory don't support this element + */ + public ITagConverter createConverter(Element element, int mode); + + /** + * get the URI namespace that this factory support. "null" means this + * factory can be used as default factory. + * + * @return null if this factory don't have a specific URI to support. + */ + public String getSupportedURI(); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IDOMFactory.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IDOMFactory.java new file mode 100755 index 0000000..f114c88 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/IDOMFactory.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.w3c.dom.Element; +import org.w3c.dom.Text; + +/** + * Factory interface. AbstractTagConverter will implement it. + * + * @author mengbo + * @version 1.5 + */ +public interface IDOMFactory { + /** + * create element + * + * @param tag + * @return a new element using tag as its name + */ + public Element createElement(String tag); + + /** + * create text node + * + * @param content + * @return a new text node using content as its body + */ + public Text createText(String content); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ITagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ITagConverter.java new file mode 100755 index 0000000..5d18914 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/ITagConverter.java @@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import java.util.List; + +import org.eclipse.swt.graphics.Image; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * ITagConverter is used to convert a custom tag to a HTML tag. Each + * ITagConverter instance will be dedicated to a single custom tag element. + * + * @author mengbo + * @version 1.5 + */ +public interface ITagConverter { + /** + * Set the target document where the converted node should belong to. + * + * @param document + */ + public void setDestDocument(IDOMDocument document); + + /** + * refresh the internal state of this ITagConverter. This method normally is + * called when the host element change. + * + * @param context + */ + public void convertRefresh(Object context); + + /** + * @return The host element being converted. + */ + public Element getHostElement(); + + /** + * for some tags, they don't convert to HTML. In that case, this method + * should return false for them. And if this method return false, then + * should return an image in getVisualImage() for displaying + * in the designer. + * + * @return true if the tag represents something that will be rendered visually at runtime + */ + public boolean isVisualByHTML(); + + /** + * if isVisualByHTML() return false, then this method should return an image + * to be displayed in designer. + * + * Normally this image will be a shared image for those hidden elements. It + * is this class's responsibility to dispose the image if the image is not a + * shared one. + * + * @return the placeholder image for non-visual tags + */ + public Image getVisualImage(); + + /** + * @return the result element after conversion + */ + public Element getResultElement(); + + /** + * @return the list of children that should be continuely converted. + */ + public List getChildModeList(); + + /** + * @return a list of Element tags that map to non-visual children + * Type should be always be Element. + */ + public List getNonVisualChildren(); + + /** + * For child nodes that need further convert, return their position in the + * converted DOM tree. + * + * @param childModel + * @return the position of child nodes + */ + public ConvertPosition getChildVisualPosition(Node childModel); + + /** + * When the convert result in multi-level element. If this method return + * false, then the caller should not use child nodes of + * getHostElement() + * + * @return true if the host element has convertable children + */ + public boolean isMultiLevel(); + + /** + * + * @return true if the host element is a widget + */ + public boolean isWidget(); + + /** + * API contract needed here + * + */ + public void dispose(); + + /** + * @param mode + */ + public void setMode(int mode); +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/JSFConverterUtil.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/JSFConverterUtil.java new file mode 100755 index 0000000..d66bc05 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/JSFConverterUtil.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; + +/** + * @author mengbo + * @version 1.5 + */ +public class JSFConverterUtil { + private static List NamedBooleanList = Arrays.asList(new String[] { + "disabled", "readonly", "ismap" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + /** + * + * @param source + * @param dest + * @param ignore + */ + public static void copyAllAttributes(Element source, Element dest, + Set ignore) { + NamedNodeMap attrs = source.getAttributes(); + for (int i = 0, size = attrs.getLength(); i < size; i++) { + Attr attr = (Attr) attrs.item(i); + if (ignore == null || !ignore.contains(attr.getName())) { + if (NamedBooleanList.contains(attr.getName()) + && "false".equalsIgnoreCase(attr.getValue())) { //$NON-NLS-1$ + continue; + } + dest.setAttribute(attr.getName(), attr.getValue()); + } + } + } + + /** + * copy a single attribute (if exist) + * + * @param source + * @param srcattr + * @param dest + * @param destattr + */ + public static void copyAttribute(Element source, String srcattr, + Element dest, String destattr) { + Attr attr = source.getAttributeNode(srcattr); + if (attr != null) { + dest.setAttribute(destattr, attr.getValue()); + } + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/PreferenceReader.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/PreferenceReader.java new file mode 100755 index 0000000..4f7c83d --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/PreferenceReader.java @@ -0,0 +1,40 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +/** + * @author mengbo + * @version 1.5 + */ +public class PreferenceReader { + /** + * expression type + */ + public final static int FULL_EXPRESSION_TYPE = 0; + + /** + * expression type + */ + public final static int LAST_EXPRESSION_TYPE = 1; + + /** + * expression type + */ + public final static int REAL_VALUE_TYPE = 2; + + /** + * @return the map value type + */ + public static int getMapValueType() { + return LAST_EXPRESSION_TYPE; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToDumBlock.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToDumBlock.java new file mode 100755 index 0000000..0d049cf --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToDumBlock.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class TagConverterToDumBlock extends AbstractTagConverter { + + /** + * @param host + */ + public TagConverterToDumBlock(Element host) { + super(host); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + Element result = createElement(IHTMLConstants.TAG_DIV); + copyChildren(getHostElement(), result); + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#isWidget() + */ + public boolean isWidget() { + return false; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToInlineBlock.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToInlineBlock.java new file mode 100755 index 0000000..9b3ad0c --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToInlineBlock.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.w3c.dom.Element; + +/** + * This converter can be used simply convert the tag to inline div, and copy all + * the children + * + * NOTE: It behave almost same as "span". In fact, we may remove this later, if + * our css engine support "minWidth"/"minHeight" for inline element. + * + * NOTE: it will not copy attributes! + * + * @author mengbo + * @version 1.5 + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#getMinHeight() + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#getMinWidth() + */ +public class TagConverterToInlineBlock extends AbstractTagConverter { + private int displayMode; + + /** + * @param host + * @param mode + */ + public TagConverterToInlineBlock(Element host, int mode) { + super(host); + this.displayMode = mode; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + Element result = null; + if (displayMode == IConverterFactory.MODE_PREVIEW) { + result = createElement("span"); //$NON-NLS-1$ + copyChildren(getHostElement(), result); + } else { + result = createElement("div"); //$NON-NLS-1$ + result + .setAttribute( + "style", //$NON-NLS-1$ + "display:inline-block; border-width:0; margin:0; min-width:1.2em;min-height:1.2em;"); //$NON-NLS-1$ + copyChildren(getHostElement(), result); + } + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isWidget() + */ + public boolean isWidget() { + return false; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToSpan.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToSpan.java new file mode 100755 index 0000000..c091f7a --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/TagConverterToSpan.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter; + +import org.w3c.dom.Element; + +/** + * This converter can be used simply convert the tag to span, and copy all the + * children + * + * NOTE: it will not copy attributes! + * + * @author mengbo + * @version 1.5 + */ +public class TagConverterToSpan extends AbstractTagConverter { + + /** + * @param host + */ + public TagConverterToSpan(Element host) { + super(host); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + // Register a named facet on the UIComponent associated with the + // closest parent UIComponent custom action. + // we'll render facet as a inline flow figure. so treat it as simple + // here. + Element result = createElement("span"); //$NON-NLS-1$ + copyChildren(getHostElement(), result); + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isWidget() + */ + public boolean isWidget() { + return false; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/ATagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/ATagConverter.java new file mode 100755 index 0000000..a384261 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/ATagConverter.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter.html; + +import org.eclipse.jst.pagedesigner.converter.ConverterUtil; +import org.eclipse.jst.pagedesigner.converter.DumTagConverter; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + +/** + * @author mengbo + * @version 1.5 + */ +public class ATagConverter extends DumTagConverter { + private boolean _emptyContainer = false; + + /** + * @param host + */ + public ATagConverter(Element host) { + super(host); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + _emptyContainer = ConverterUtil.isEmptyContainer(getHostElement()); + if (_emptyContainer) { + Element resultEle = createElement("a"); //$NON-NLS-1$ + ConverterUtil.copyAllAttributes(getHostElement(), resultEle, null); + Text fakedNode = createText("link"); //$NON-NLS-1$ + resultEle.appendChild(fakedNode); + return resultEle; + } + return super.doConvertRefresh(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#needBorderDecorator() + */ + public boolean needBorderDecorator() { + return _emptyContainer; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return _emptyContainer; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#isWidget() + */ + public boolean isWidget() { + return _emptyContainer; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/HTMLConverterFactory.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/HTMLConverterFactory.java new file mode 100755 index 0000000..c9240e3 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/HTMLConverterFactory.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter.html; + +import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin; +import org.eclipse.jst.jsf.common.ui.internal.utils.JSFSharedImages; +import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.converter.AbstractTagConverter; +import org.eclipse.jst.pagedesigner.converter.DumDescriptionTagConverter; +import org.eclipse.jst.pagedesigner.converter.DumTagConverter; +import org.eclipse.jst.pagedesigner.converter.HiddenTagConverter2; +import org.eclipse.jst.pagedesigner.converter.IConverterFactory; +import org.eclipse.jst.pagedesigner.converter.ITagConverter; +import org.eclipse.jst.pagedesigner.utils.HTMLUtil; +import org.eclipse.swt.graphics.Image; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class HTMLConverterFactory implements IConverterFactory { + + /** + * the constructor + */ + public HTMLConverterFactory() { + super(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.IConverterFactory#createConverter(org.w3c.dom.Element) + */ + public ITagConverter createConverter(Element element, int mode) { + String tagName = element.getLocalName(); + + if (mode == MODE_PREVIEW) { + return new DumTagConverter(element); + } + if (!HTMLUtil.isVisualHtmlElement(tagName)) { + return new HiddenTagConverter2(element, getUnknownImage()); + } + + AbstractTagConverter c; + if (IHTMLConstants.TAG_TABLE.equalsIgnoreCase(tagName)) { + c = new TableTagConverter(element); + } else if (IHTMLConstants.TAG_A.equalsIgnoreCase(tagName)) { + c = new ATagConverter(element); + } else if (IHTMLConstants.TAG_FORM.equalsIgnoreCase(tagName)) { + // for those HTML tag that we want to build a border decorator, + // should + // go there. + c = new DumTagConverter(element, true); + } else if (IHTMLConstants.TAG_HTML.equalsIgnoreCase(tagName) + || IHTMLConstants.TAG_BODY.equalsIgnoreCase(tagName)) { + c = new DumDescriptionTagConverter(element); + c.setNeedBorderDecorator(true); + } else { + c = new DumTagConverter(element); + } + c.setMode(mode); + return c; + } + + private static Image getUnknownImage() { + return JSFUICommonPlugin.getDefault().getImage( + JSFSharedImages.DEFAULT_PALETTE_TAG_IMG); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.IConverterFactory#getSupportedURI() + */ + public String getSupportedURI() { + return ITLDConstants.URI_HTML; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/TableTagConverter.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/TableTagConverter.java new file mode 100755 index 0000000..f42ac4e --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/html/TableTagConverter.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter.html; + +import org.eclipse.jst.pagedesigner.converter.AbstractTagConverter; +import org.eclipse.jst.pagedesigner.converter.ConverterUtil; +import org.w3c.dom.Element; + +/** + * @author mengbo + */ +public class TableTagConverter extends AbstractTagConverter { + /** + * @param host + */ + public TableTagConverter(Element host) { + super(host); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + Element result = createElement(getHostElement().getTagName()); + ConverterUtil.copyAllAttributes(getHostElement(), result, null); + copyChildren(getHostElement(), result); + return result; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#isWidget() + */ + public boolean isWidget() { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#needTableDecorator() + */ + public boolean needTableDecorator() { + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#needBorderDecorator() + */ + public boolean needBorderDecorator() { + return false; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/IncludeTagConverterPreview.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/IncludeTagConverterPreview.java new file mode 100755 index 0000000..13edeaf --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/IncludeTagConverterPreview.java @@ -0,0 +1,206 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter.jsp; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jst.jsf.common.ui.internal.logging.Logger; +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.PDPlugin; +import org.eclipse.jst.pagedesigner.converter.AbstractTagConverter; +import org.eclipse.jst.pagedesigner.jsp.core.internal.pagevar.DocumentPageVariableAdapter; +import org.eclipse.jst.pagedesigner.jsp.core.pagevar.adapter.PageVariableAdapterFactory; +import org.eclipse.jst.pagedesigner.preview.PageExpressionContext; +import org.eclipse.jst.pagedesigner.preview.PreviewConvertContext; +import org.eclipse.wst.sse.core.StructuredModelManager; +import org.eclipse.wst.sse.core.internal.util.URIResolver; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * This is the tag converter for preview. + * + * @author mengbo + * @version 1.5 + */ +public class IncludeTagConverterPreview extends AbstractTagConverter { + private static Logger _log = PDPlugin + .getLogger(IncludeTagConverterPreview.class); + + private String _fileAttrName; + + /** + * @param host + * @param fileAttrname + */ + public IncludeTagConverterPreview(Element host, String fileAttrname) { + super(host); + this._fileAttrName = fileAttrname; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.AbstractTagConverter#doConvertRefresh() + */ + protected Element doConvertRefresh() { + String fileName = getResolvedURL(getHostElement(), this._fileAttrName); + if (fileName == null || fileName.length() == 0) { + return null; + } + IPath includedPath = new Path(fileName); + includedPath.makeAbsolute(); + + IFile file = getFile(includedPath); + if (file == null) { + return null; + } + return previewFile(file); + } + + /** + * @param includedPath + * @return the IFile corresponding to the IPath + */ + public IFile getFile(IPath includedPath) { + IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); + IProject[] projects = workspaceRoot.getProjects(); + + for (int i = 0, length = projects.length; i < length; i++) { + IPath path = projects[i].getLocation(); + path = path.makeAbsolute(); + if (path != null && path.isPrefixOf(includedPath)) { + // -1 so we still have the project path + includedPath = includedPath.removeFirstSegments(path + .segmentCount() - 1); + return ResourcesPlugin.getWorkspace().getRoot().getFile( + includedPath); + } + } + return null; + } + + /** + * @param file + * @return the Element + */ + public Element previewFile(IFile file) { + IDOMModel xmlModel = null; + DocumentPageVariableAdapter provider = null; + boolean pushedPageVarProvider = false; + try { + + xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead( + file); + if (xmlModel != null) { + IDOMDocument doc = xmlModel.getDocument(); + + // XXX: need to also register page variable adapters. In the + // future, this should go to some + // SSE system registry mechanism. + xmlModel.getFactoryRegistry().addFactory( + new PageVariableAdapterFactory()); + provider = new DocumentPageVariableAdapter(doc); + doc.addAdapter(provider); + + provider.refresh(); + PageExpressionContext.getCurrent() + .pushPageVarProvider(provider); + + Node child = xmlModel.getDocument().getFirstChild(); + PreviewConvertContext context = new PreviewConvertContext(this + .getDestDocument()); + List results = new ArrayList(); + while (child != null) { + Node node = context.previewConvert(child); + if (node != null) { + results.add(node); + } + child = child.getNextSibling(); + } + + if (results.size() == 0) { + return null; + } else if (results.size() == 1 + && results.get(0) instanceof Element) { + return (Element) results.get(0); + } else { + Element ret = createElement(IHTMLConstants.TAG_SPAN); + for (int i = 0, n = results.size(); i < n; i++) { + ret.appendChild((Node) results.get(i)); + } + return ret; + } + } + } catch (CoreException e) { + _log.error("PreviewUtil.previewFile.CoreException", e); //$NON-NLS-1$ + } catch (IOException e) { + _log.error("PreviewUtil.previewFile.IOException", e); //$NON-NLS-1$ + } catch (Exception ex) { + _log.error("PreviewUtil.previewFile.CoreException", ex); //$NON-NLS-1$ + } finally { + if (pushedPageVarProvider) { + PageExpressionContext.getCurrent().popPageVarProvider(provider); + } + if (xmlModel != null) { + xmlModel.releaseFromRead(); + } + } + return null; + } + + 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) { + return null; + } + String src = element.getAttribute(attrName); + if (src != null && src.length() > 0) { + return resolver.getLocationByURI(src); + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.ITagConverter#isMultiLevel() + */ + public boolean isMultiLevel() { + return false; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.css2.style.ITagEditInfo#isWidget() + */ + public boolean isWidget() { + return false; + } +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/JSPConverterFactory.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/JSPConverterFactory.java new file mode 100755 index 0000000..72350c0 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/jsp/JSPConverterFactory.java @@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.converter.jsp; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jst.jsf.context.resolver.structureddocument.IStructuredDocumentContextResolverFactory; +import org.eclipse.jst.jsf.context.resolver.structureddocument.IWorkspaceContextResolver; +import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContext; +import org.eclipse.jst.jsf.context.structureddocument.IStructuredDocumentContextFactory2; +import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants; +import org.eclipse.jst.pagedesigner.converter.HiddenTagConverter; +import org.eclipse.jst.pagedesigner.converter.IConverterFactory; +import org.eclipse.jst.pagedesigner.converter.ITagConverter; +import org.eclipse.jst.pagedesigner.converter.TagConverterToDumBlock; +import org.eclipse.jst.pagedesigner.editors.palette.TagImageManager; +import org.eclipse.jst.pagedesigner.jsp.core.IJSPCoreConstants; +import org.eclipse.swt.graphics.Image; +import org.w3c.dom.Element; + +/** + * @author mengbo + * @version 1.5 + */ +public class JSPConverterFactory implements IConverterFactory { + private final ILabelProvider _labelProvider; + + /** + * + */ + public JSPConverterFactory() { + _labelProvider = new MyLabelProvider(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.IConverterFactory#createConverter(org.w3c.dom.Element) + */ + public ITagConverter createConverter(Element element, int mode) { + String tagName = element.getLocalName(); + + if (mode == IConverterFactory.MODE_PREVIEW) { + // we want to generate the included page in preview, so + // handle differently + if (IJSPCoreConstants.TAG_INCLUDE.equalsIgnoreCase(tagName)) { + IncludeTagConverterPreview c = new IncludeTagConverterPreview( + element, "page"); //$NON-NLS-1$ + c.setMode(mode); + return c; + } else if (IJSPCoreConstants.TAG_DIRECTIVE_INCLUDE + .equalsIgnoreCase(tagName)) { + IncludeTagConverterPreview c = new IncludeTagConverterPreview( + element, "file"); //$NON-NLS-1$ + c.setMode(mode); + return c; + } else if (IJSPCoreConstants.TAG_ROOT.equalsIgnoreCase(tagName)) { + TagConverterToDumBlock c = new TagConverterToDumBlock(element); + c.setNeedBorderDecorator(true); + c.setMode(mode); + return c; + } else { + return new HiddenTagConverter(element, _labelProvider); + } + } + if (IJSPCoreConstants.TAG_ROOT.equalsIgnoreCase(tagName)) { + TagConverterToDumBlock c = new TagConverterToDumBlock(element); + c.setNeedBorderDecorator(true); + c.setMode(mode); + return c; + } + return new HiddenTagConverter(element, _labelProvider); + } + + private static class MyLabelProvider extends org.eclipse.jface.viewers.LabelProvider + { + + public Image getImage(Object element) + { + if (element instanceof ITagConverter) + { + final Element hostElement = ((ITagConverter)element).getHostElement(); + IStructuredDocumentContext context = IStructuredDocumentContextFactory2.INSTANCE.getContext(hostElement); + if (context != null){ + IWorkspaceContextResolver wsResolver = IStructuredDocumentContextResolverFactory.INSTANCE.getWorkspaceContextResolver(context); + if (wsResolver != null){ + return TagImageManager.getInstance().getSmallIconImage((IFile)wsResolver.getResource(),"JSP11", ITLDConstants.URI_JSP + ":"+hostElement.getLocalName()); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + + return null; + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jst.pagedesigner.converter.IConverterFactory#getSupportedURI() + */ + public String getSupportedURI() { + return ITLDConstants.URI_JSP; + } + +} diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/package-info.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/package-info.java new file mode 100755 index 0000000..18868e0 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/converter/package-info.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2008 Oracle Corporation. + * 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 - initial API and implementation + * + ********************************************************************************/ + +/** + * Tag conversion framework. + * + *

Provisional API - subject to change

+ */ +package org.eclipse.jst.pagedesigner.converter; diff --git a/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/CSSTempUtil.java b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/CSSTempUtil.java new file mode 100755 index 0000000..06c8992 --- /dev/null +++ b/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/css2/CSSTempUtil.java @@ -0,0 +1,156 @@ +/******************************************************************************* + * Copyright (c) 2006 Sybase, Inc. and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sybase, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.pagedesigner.css2; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jst.pagedesigner.IHTMLConstants; +import org.eclipse.jst.pagedesigner.dtresourceprovider.DTSkinManager; +import org.eclipse.jst.pagedesigner.dtresourceprovider.IDTSkin; +import org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetAdapter; +import org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetListAdapter; +import org.eclipse.wst.html.core.internal.provisional.HTML40Namespace; +import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; +import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; +import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.stylesheets.StyleSheet; +import org.w3c.dom.stylesheets.StyleSheetList; + +/** + * @author mengbo + * @version 1.5 + */ +public final class CSSTempUtil { + /** + * the default implementation of (IStyleSheetListAdapter) + * docnotifier.getAdapterFor(IStyleSheetListAdapter.class) will only get + * those style tags under certain tags like "html", "head", etc. + * + * But datawindow is generating style tag and is not putting them into + * "head". So we can't handle them using the default SSE mechanism. + * + * We have another problem: currently the converted element is also using + * the original document, not generating another document, and these + * elements is not really adding into the document, so they can't be reached + * from the document. + * + * @param element + * @return the list + * see org.eclipse.wst.html.core.htmlcss.HTMLDocumentAdapter#addStyleSheet(org.w3c.dom.Element) + */ + public static List getStyleSheets(Element element) { + List styleSheets = new ArrayList(); + INodeNotifier docnotifier = (INodeNotifier) element.getOwnerDocument(); + IStyleSheetListAdapter adapter = (IStyleSheetListAdapter) docnotifier + .getAdapterFor(IStyleSheetListAdapter.class); + + StyleSheetList ssl = (adapter == null ? null : adapter.getStyleSheets()); + + if (ssl != null) { + for (int i = 0, numStyles = ssl.getLength(); i < numStyles; i++) { + // loop for styles (