Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.sse.ui')
-rw-r--r--bundles/org.eclipse.wst.sse.ui/.classpath10
-rw-r--r--bundles/org.eclipse.wst.sse.ui/.cvsignore8
-rw-r--r--bundles/org.eclipse.wst.sse.ui/.options66
-rw-r--r--bundles/org.eclipse.wst.sse.ui/.project27
-rw-r--r--bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.jdt.core.prefs80
-rw-r--r--bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.jdt.ui.prefs3
-rw-r--r--bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.ltk.core.refactoring.prefs3
-rw-r--r--bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.pde.prefs15
-rw-r--r--bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF65
-rw-r--r--bundles/org.eclipse.wst.sse.ui/README.txt2
-rw-r--r--bundles/org.eclipse.wst.sse.ui/about.html34
-rw-r--r--bundles/org.eclipse.wst.sse.ui/build.properties30
-rw-r--r--bundles/org.eclipse.wst.sse.ui/html/maintopic.html13
-rw-r--r--bundles/org.eclipse.wst.sse.ui/html/subtopic.html13
-rw-r--r--bundles/org.eclipse.wst.sse.ui/html/toc.html13
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/ctool16/spellcheck.gifbin370 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/collapseall.gifbin155 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/delete.gifbin221 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/synced.gifbin149 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/dtool16/spellcheck.gifbin243 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/collapseall.gifbin157 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/delete.gifbin351 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/synced.gifbin233 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/etool16/spellcheck.gifbin370 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/obj16/occ_match.gifbin121 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/obj16/preferences.gifbin224 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/full/obj16/prop_ps.gifbin344 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/icons/sourceEditor.gifbin353 -> 0 bytes
-rw-r--r--bundles/org.eclipse.wst.sse.ui/plugin.properties81
-rw-r--r--bundles/org.eclipse.wst.sse.ui/plugin.xml474
-rw-r--r--bundles/org.eclipse.wst.sse.ui/reexport-info.txt4
-rw-r--r--bundles/org.eclipse.wst.sse.ui/schema/editorconfiguration.exsd256
-rw-r--r--bundles/org.eclipse.wst.sse.ui/schema/sourcevalidation.exsd191
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-encoding/org/eclipse/wst/sse/ui/internal/encoding/ui/EncodingPreferencePage.java109
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ConfigurationPointCalculator.java151
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ISelfValidateEditAction.java27
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ISourceEditingTextTools.java50
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IBreakpointConstants.java21
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IBreakpointProvider.java62
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IExtendedStorageEditorInput.java37
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/NodeLocation.java48
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/NullSourceEditingTextTools.java63
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/ExclusionsTab.java373
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/MainTab.java450
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/PropertyPreferencePage.java269
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/TaskTagPreferencePage.java353
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/EditorExecutionContext.java85
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/FoldingActionGroup.java165
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/InformationProvider.java66
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java3436
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java471
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerUndoManager.java200
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/AbstractDropAction.java94
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/CaretMediator.java284
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedConfigurationBuilder.java265
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedEditorActionBuilder.java789
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedEditorDropTargetAdapter.java351
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/FileDropAction.java47
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/FormatProcessorsExtensionReader.java102
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/GotoAnnotationAction.java370
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IActionValidator.java17
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IDropAction.java37
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedContributor.java30
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedEditorAction.java38
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedMarkupEditor.java47
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedSimpleEditor.java33
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IModelProvider.java21
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IPopupMenuContributor.java22
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IReleasable.java20
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ISourceViewerActionBarContributor.java29
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ITemporaryAnnotation.java17
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/Logger.java161
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java74
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ReadOnlyAwareDropTargetAdapter.java50
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java422
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPlugin.java80
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties395
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ShowViewAction.java99
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StorageModelProvider.java681
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredDocumentToTextAdapter.java1332
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredLineChangeHover.java48
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredMarkerAnnotation.java125
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModel.java108
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModelFactory.java49
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextAnnotationHover.java391
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextLineBreakingReader.java114
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextSelectionChangedEvent.java35
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextViewer.java793
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/TextDropAction.java27
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/TransferBuilder.java662
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/UnknownContentTypeDialog.java67
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActionContributor.java377
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActionDefinitionIds.java42
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActiveEditorActionHandler.java286
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/CleanupAction.java85
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/FormatActionDelegate.java228
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ResourceActionDelegate.java75
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/StructuredTextEditorActionConstants.java44
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/CompoundContentAssistProcessor.java422
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/ContentAssistUtils.java92
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/CustomCompletionProposal.java333
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/IRelevanceCompletionProposal.java28
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/IRelevanceConstants.java17
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/StructuredContentAssistant.java143
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/ConfigurableContentOutlinePage.java707
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/IJFaceNodeAdapter.java44
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/IJFaceNodeAdapterFactory.java26
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/PropertyChangeUpdateAction.java80
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/PropertyChangeUpdateActionContributionItem.java85
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ComboList.java287
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ComboListOnPropertyPage.java39
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ContentSettingsPropertyPage.java297
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/ContributedProcessorDescriptor.java35
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/CorrectionAssistantProvider.java31
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickAssistProcessor.java31
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickFixProcessor.java30
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/NoModificationCompletionProposal.java77
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/StructuredCorrectionProcessor.java158
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/BreakpointRulerAction.java304
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/DebugTextEditor.java438
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/EditBreakpointAction.java63
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ManageBreakpointAction.java90
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ToggleBreakpointAction.java200
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ToggleBreakpointsTarget.java189
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTML2TextReader.java304
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTMLTextPresenter.java194
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/LineBreakingReader.java124
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/SingleCharReader.java66
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/SubstitutionTextReader.java158
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/edit/util/SharedEditorPluginImageHelper.java58
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorModelUtil.java77
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorPluginImageHelper.java155
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorPluginImages.java33
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/IHelpContextIds.java58
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/StructuredModelDocumentProvider.java263
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ActionDescriptor.java378
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/BreakpointProviderBuilder.java405
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/DropActionProxy.java150
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ExtendedEditorActionProxy.java149
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ExtendedEditorActionProxyForDelayLoading.java752
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/IExtendedEditorActionProxyForDelayLoading.java22
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ImageUtil.java84
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/RegistryReader.java176
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/format/StructuredFormattingStrategy.java91
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/hyperlink/HighlighterHyperlinkPresenter.java468
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/hyperlink/OpenHyperlinkAction.java66
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/AbstractOpenOn.java267
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/ExternalFileEditorInput.java116
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/IOpenOn.java46
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenFileHyperlinkTracker.java660
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnAction.java74
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnBuilder.java267
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnDefinition.java157
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnProvider.java143
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java86
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/OverlayPreferenceStore.java486
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/TabFolderLayout.java61
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractColorPage.java279
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractPreferencePage.java284
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractPreferenceTab.java266
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorEditor.java142
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorHelper.java147
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorNames.java27
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/EmptyFilePreferencePage.java100
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/FilePreferencePage.java132
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/IPreferenceTab.java29
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StatusInfo.java202
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java451
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StyledTextColorPicker.java948
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/TextHoverPreferenceTab.java453
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/TranslucencyPreferenceTab.java149
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/IStructuredTextFoldingProvider.java45
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/AdapterPropertySheetEntryLabelProvider.java51
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ConfigurablePropertySheetPage.java214
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/CustomPropertyDescriptor.java89
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/RemoveAction.java45
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ShowPropertiesAction.java38
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/preferences/CommonEditorPreferenceNames.java35
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryProvider.java33
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistry.java32
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryExtension.java22
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryImpl.java210
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryReader.java142
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/AbstractLineStyleProvider.java348
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/Highlighter.java906
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/IHighlighter.java34
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/LineStyleProvider.java52
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/LineStyleProviderForNoOp.java48
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/AbstractStructuredTextReconcilingStrategy.java527
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DirtyRegionProcessor.java776
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentAdapter.java43
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentRegionProcessor.java245
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IConfigurableReconciler.java35
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IReconcileAnnotationKey.java35
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IStructuredReconcileStep.java66
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IStructuredReconcilingStrategy.java43
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/ReconcileAnnotationKey.java56
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredReconcileStep.java193
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredRegionProcessor.java351
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredTextReconcilingStrategy.java65
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/TemporaryAnnotation.java230
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/AnnotationInfo.java38
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ISourceValidator.java42
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/IncrementalHelper.java57
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/IncrementalReporter.java111
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ReconcileStepForValidator.java345
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorBuilder.java139
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorMetaData.java241
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorStrategy.java327
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicSearchLabelProvider.java75
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicSearchQuery.java217
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionDelegate.java147
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesProcessor.java121
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesContentProvider.java89
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchQuery.java184
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchResult.java127
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchViewPage.java140
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/SelectionHistory.java117
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectAction.java110
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectHistoryAction.java56
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectActionDelegate.java124
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectHistoryActionDelegate.java83
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java424
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/AbstractHoverProcessor.java83
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/AnnotationHoverProcessor.java204
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/BestMatchHover.java129
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/DebugInfoHoverProcessor.java95
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/ProblemAnnotationHoverProcessor.java51
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/TextHoverManager.java243
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/text/DocumentRegionEdgeMatcher.java118
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ui/OffsetStatusLineContributionItem.java1039
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ui/StructuredTextAnnotationImageProvider.java56
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/Assert.java120
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/EditorUtility.java142
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/PlatformStatusLineUtil.java171
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/RegistryReader.java175
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/Sorter.java77
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/CaretEvent.java52
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/ICaretListener.java20
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/INodeSelectionListener.java22
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/ITextSelectionListener.java20
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/NodeSelectionChangedEvent.java43
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/TextSelectionChangedEvent.java41
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/contentoutline/ContentOutlineConfiguration.java307
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/IPropertySourceExtension.java41
-rw-r--r--bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/PropertySheetConfiguration.java104
-rw-r--r--bundles/org.eclipse.wst.sse.ui/testToc.xml8
-rw-r--r--bundles/org.eclipse.wst.sse.ui/toc.xml13
249 files changed, 0 insertions, 43436 deletions
diff --git a/bundles/org.eclipse.wst.sse.ui/.classpath b/bundles/org.eclipse.wst.sse.ui/.classpath
deleted file mode 100644
index bc5a5650cd..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/"/>
- <classpathentry kind="src" path="src-extensions/"/>
- <classpathentry kind="src" path="src-encoding"/>
- <classpathentry kind="src" path="src-tasktags"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.wst.sse.ui/.cvsignore b/bundles/org.eclipse.wst.sse.ui/.cvsignore
deleted file mode 100644
index 2b6bc40b23..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/.cvsignore
+++ /dev/null
@@ -1,8 +0,0 @@
-bin
-editor.jar
-build.xml
-temp.folder
-org.eclipse.wst.sse.ui_1.0.0.jar
-@dot
-src.zip
-javaCompiler...args
diff --git a/bundles/org.eclipse.wst.sse.ui/.options b/bundles/org.eclipse.wst.sse.ui/.options
deleted file mode 100644
index 32f219471d..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/.options
+++ /dev/null
@@ -1,66 +0,0 @@
-org.eclipse.wst.sse.ui/debug=true
-org.eclipse.wst.sse.ui/debug/tracefilter=
-
-#org.eclipse.wst.sse.ui.edit.util.ActionContributer._showDebugStatus
-org.eclipse.wst.sse.ui/actioncontributor/debugstatusfields=false
-
-
-#org.eclipse.wst.sse.ui.extension.TransferBuilder.debugTime
-org.eclipse.wst.sse.ui/transferbuilder/time=false
-
-org.eclipse.wst.sse.ui/extendedconfigurationbuilder=false
-#org.eclipse.wst.sse.ui.extension.ExtendedConfigurationBuilder.debugTime
-org.eclipse.wst.sse.ui/extendedconfigurationbuilder/time=false
-
-
-org.eclipse.wst.sse.ui/extendededitoractionbuilder=false
-
-#org.eclipse.wst.sse.ui.extension.ExtendedEditorActionBuilder.debugReadTime
-org.eclipse.wst.sse.ui/extendededitoractionbuilder/readtime=false
-
-#org.eclipse.wst.sse.ui.extension.ExtendedEditorActionBuilder.debugContributeTime
-org.eclipse.wst.sse.ui/extendededitoractionbuilder/contributetime=false
-
-
-#org.eclipse.wst.sse.ui.extension.ExtendedEditorActionBuilder.debugMenu
-org.eclipse.wst.sse.ui/extendededitoractionbuilder/debugmenu=false
-
-#org.eclipse.wst.sse.ui.extension.ExtendedEditorActionBuilder.debugPopup
-org.eclipse.wst.sse.ui/extendededitoractionbuilder/debugpopup=false
-
-#org.eclipse.wst.sse.ui.extension.ExtendedEditorActionBuilder.debugToolbar
-org.eclipse.wst.sse.ui/extendededitoractionbuilder/debugtoolbar=false
-
-
-#org.eclipse.wst.sse.ui.FileModelProvider.debugOperations
-org.eclipse.wst.sse.ui/filemodelprovider/operations=false
-
-#org.eclipse.wst.sse.ui.FileModelProvider.debugLifecyclelistener
-org.eclipse.wst.sse.ui/filemodelprovider/lifecyclelistener=false
-
-#org.eclipse.wst.sse.ui.FileModelProvider.debugModelStatelistener
-org.eclipse.wst.sse.ui/filemodelprovider/modelstatelistener=false
-
-
-#org.eclipse.wst.sse.ui.StorageModelProvider.debugOperations
-org.eclipse.wst.sse.ui/storagemodelprovider/operations=false
-
-#org.eclipse.wst.sse.ui.StorageModelProvider.debugElementStatelistener
-org.eclipse.wst.sse.ui/storagemodelprovider/elementstatelistener=false
-
-org.eclipse.wst.sse.ui/contentOutline=false
-org.eclipse.wst.sse.ui/propertySheet=false
-
-#org.eclipse.wst.sse.ui.views.contentoutline.PropertyChangeUpdateActionContributionItem.debug
-org.eclipse.wst.sse.ui/propertyChangeUpdateActionContributionItem=false
-
-org.eclipse.wst.sse.ui/debug/reconcilerjob=false
-
-#org.eclipse.wst.sse.ui.internal.GotoAnnotationAction._debug
-org.eclipse.wst.sse.ui/gotoNextAnnotation=false
-
-org.eclipse.wst.sse.ui/preferences-properties=false
-
-org.eclipse.wst.sse.ui/debug/reconcilerSpelling=false
-
-org.eclipse.wst.sse.ui/debug/reconcilerValidators=false
diff --git a/bundles/org.eclipse.wst.sse.ui/.project b/bundles/org.eclipse.wst.sse.ui/.project
deleted file mode 100644
index 78bd94c674..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/.project
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.sse.ui</name>
- <comment></comment>
- <projects></projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index afa5c91352..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Apr 04 03:36:32 EDT 2006
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 782e417e41..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,80 +0,0 @@
-#Sun Apr 16 17:23:39 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.builder.invalidClasspath=ignore
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-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.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=ignore
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-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=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-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.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index ef2ac6532b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Apr 04 03:36:39 EDT 2006
-eclipse.preferences.version=1
-internal.default.compliance=default
diff --git a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.ltk.core.refactoring.prefs b/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.ltk.core.refactoring.prefs
deleted file mode 100644
index c59368c5e1..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.ltk.core.refactoring.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue Apr 04 03:36:32 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff --git a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index 222372317a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,15 +0,0 @@
-#Sun Apr 16 14:05:29 EDT 2006
-compilers.p.build=0
-compilers.p.deprecated=1
-compilers.p.illegal-att-value=0
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=0
-compilers.p.unknown-element=0
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=0
-compilers.use-project=true
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index a1d3d32b11..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,65 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.wst.sse.ui; singleton:=true
-Bundle-Version: 1.0.204.qualifier
-Bundle-Activator: org.eclipse.wst.sse.ui.internal.SSEUIPlugin
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.wst.sse.ui,
- org.eclipse.wst.sse.ui.internal;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.actions;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.contentassist;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.contentoutline;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.contentproperties.ui;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.correction;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.debug;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.derived;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.edit.util;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.editor;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.encoding.ui;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.extension;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.format;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.hyperlink;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.openon;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.preferences;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.preferences.ui;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.projection;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.properties;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.provisional.extensions;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.provisional.preferences;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.provisional.registry;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.provisional.style;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.reconcile;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.reconcile.validator;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.search;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.selection;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.spelling;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.taginfo;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.text;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.ui;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.util;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.internal.view.events;x-friends:="org.eclipse.wst.dtd.ui,org.eclipse.wst.xml.ui,org.eclipse.wst.xsd.ui",
- org.eclipse.wst.sse.ui.views.contentoutline,
- org.eclipse.wst.sse.ui.views.properties
-Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.jface.text;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.debug.core;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.debug.ui;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.ui.editors;visibility:=reexport;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.search;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.swt;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.jface;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.ui;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.ui.workbench.texteditor;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.ui.workbench;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.ui.views;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.wst.sse.core;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.core.filebuffers;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.core.resources;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.core.runtime;bundle-version="[3.2.0,3.3.0)",
- org.eclipse.wst.validation;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.emf.common;bundle-version="[2.2.0,2.3.0)",
- com.ibm.icu;bundle-version="[3.4.4,3.5.0)"
-Eclipse-LazyStart: true
diff --git a/bundles/org.eclipse.wst.sse.ui/README.txt b/bundles/org.eclipse.wst.sse.ui/README.txt
deleted file mode 100644
index efe452223f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/README.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-The base editor of the sse framework. It provides the hooks for content assist,
-breakpoints, debugging, open-on, quickfix, spell checking and a content outline. \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/about.html b/bundles/org.eclipse.wst.sse.ui/about.html
deleted file mode 100644
index 4ec5989581..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/about.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<HTML>
-
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-
-<BODY lang="EN-US">
-
-<H3>About This Content</H3>
-
-<P>May 2, 2006</P>
-
-<H3>License</H3>
-
-<P>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
-<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
-For purposes of the EPL, "Program" will mean the Content.</P>
-
-<P>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
-and such source code may be obtained at
-<A href="http://www.eclipse.org/">http://www.eclipse.org/</A>.</P>
-
-</BODY>
-</HTML>
diff --git a/bundles/org.eclipse.wst.sse.ui/build.properties b/bundles/org.eclipse.wst.sse.ui/build.properties
deleted file mode 100644
index a5b77bebc1..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/build.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2004 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
-# Jens Lukowski/Innoopract - initial renaming/restructuring
-#
-###############################################################################
-bin.includes = plugin.xml,\
- .options,\
- .,\
- icons/,\
- plugin.properties,\
- META-INF/,\
- about.html
-bin.excludes = bin/**,\
- @dot/**,\
- temp.folder/**
-src.includes = toc.xml,\
- testToc.xml,\
- schema/,\
- html/
-source.. = src/,\
- src-extensions/,\
- src-encoding,\
- src-tasktags/
diff --git a/bundles/org.eclipse.wst.sse.ui/html/maintopic.html b/bundles/org.eclipse.wst.sse.ui/html/maintopic.html
deleted file mode 100644
index a476078ace..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/html/maintopic.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Main Topic</title>
-</head>
-
-<body>
-<h1>Main Topic</h1>
-Please enter your text here.
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/html/subtopic.html b/bundles/org.eclipse.wst.sse.ui/html/subtopic.html
deleted file mode 100644
index 8a61c501d6..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/html/subtopic.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Sub Topic</title>
-</head>
-
-<body>
-<h1>Sub Topic</h1>
-Please enter your text here.
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/html/toc.html b/bundles/org.eclipse.wst.sse.ui/html/toc.html
deleted file mode 100644
index 326f0a9ff3..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/html/toc.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Table of Contents</title>
-</head>
-
-<body>
-<h1>Table of Contents</h1>
-Please enter your text here.
-</body>
-</html> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/ctool16/spellcheck.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/ctool16/spellcheck.gif
deleted file mode 100644
index c71de32fce..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/ctool16/spellcheck.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/collapseall.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/collapseall.gif
deleted file mode 100644
index 7dc0de5130..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/collapseall.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/delete.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/delete.gif
deleted file mode 100644
index 2e197c25e8..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/delete.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/synced.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/synced.gif
deleted file mode 100644
index 4b9e567edd..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/dlcl16/synced.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/dtool16/spellcheck.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/dtool16/spellcheck.gif
deleted file mode 100644
index a4cf55ffe9..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/dtool16/spellcheck.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/collapseall.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/collapseall.gif
deleted file mode 100644
index a2d80a9044..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/collapseall.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/delete.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/delete.gif
deleted file mode 100644
index 0ae6decd03..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/delete.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/synced.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/synced.gif
deleted file mode 100644
index 05cefef687..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/elcl16/synced.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/etool16/spellcheck.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/etool16/spellcheck.gif
deleted file mode 100644
index c71de32fce..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/etool16/spellcheck.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/obj16/occ_match.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/obj16/occ_match.gif
deleted file mode 100644
index 9e033dea5f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/obj16/occ_match.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/obj16/preferences.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/obj16/preferences.gif
deleted file mode 100644
index 4c07fea144..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/obj16/preferences.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/full/obj16/prop_ps.gif b/bundles/org.eclipse.wst.sse.ui/icons/full/obj16/prop_ps.gif
deleted file mode 100644
index 3aec64dbdd..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/full/obj16/prop_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/icons/sourceEditor.gif b/bundles/org.eclipse.wst.sse.ui/icons/sourceEditor.gif
deleted file mode 100644
index 75ebdb8586..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/icons/sourceEditor.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.wst.sse.ui/plugin.properties b/bundles/org.eclipse.wst.sse.ui/plugin.properties
deleted file mode 100644
index dbbb50c62c..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/plugin.properties
+++ /dev/null
@@ -1,81 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2004 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
-# Jens Lukowski/Innoopract - initial renaming/restructuring
-#
-###############################################################################
-providerName=Eclipse.org
-pluginName=Structured Source Editor
-Standalone_Structured_Source_Editor.name=Standalone Structured Source Editor
-# Name on preferences page
-WEB_AND_XML_Files.name=Web and XML
-Structured_Text_Editor.name=Structured Text Editors
-Task_Tags_Preferences.name=Task Tags
-
-#
-sourceEditorFontDefiniton.label=Structured Text Editor Text Font
-sourceEditorFontDefintion.description=The Structured text editor text font is used by Structured text editors.
-
-Adapter_Factory_Description_Extension.name=Adapter Factory Description Extension
-Extended_Editor_Actions_Extension.name=Extended Editor Actions Extension
-Drop_Target_Transfers_Extension.name=Drop Target Transfers Extension
-Extended_Editor_Configuration_Extension.name=Extended Editor Configuration Extension
-##########################################################################
-# These strings are used in Workbench Keys Preferences
-##########################################################################
-scope.structuredTextEditor.name=Editing in Structured Text Editors
-scope.structuredTextEditor.description=Editing in Structured Text Editors
-command.toggle.comment.name=Toggle Comment
-command.toggle.comment.description=Toggle Comment
-command.add.block.comment.name=Add Block Comment
-command.add.block.comment.description=Add Block Comment
-command.remove.block.comment.name=Remove Block Comment
-command.remove.block.comment.description=Remove Block Comment
-command.cleanup.document.name=Cleanup Document
-command.cleanup.document.description=Cleanup document
-command.format.document.name=Format Document
-command.format.document.description=Format document
-command.format.active.elements.name=Format Active Elements
-command.format.active.elements.description=Format active elements
-command.open.file.from.source.name=Open Selection
-command.open.file.from.source.description=Open an editor on the selected link
-command.search.find.occurrences.name=Occurrences in File
-command.search.find.occurrences.description=Find occurrences of the selection in the file
-ActionDefinition.selectEnclosing.name=Select Enclosing Element
-ActionDefinition.selectEnclosing.description=Expand selection to include enclosing element
-ActionDefinition.selectNext.name=Select Next Element
-ActionDefinition.selectNext.description=Expand selection to include next sibling
-ActionDefinition.selectPrevious.name=Select Previous Element
-ActionDefinition.selectPrevious.description=Expand selection to include previous sibling
-ActionDefinition.selectLast.name=Restore Last Selection
-ActionDefinition.selectLast.description=Restore last selection
-ActionDefinition.showJavadoc.name=Show Tooltip Description
-ActionDefinition.showJavadoc.description=Displays the hover help for the selected element
-ActionDefinition.quickFix.name=Quick Fix
-ActionDefinition.quickFix.description=Quick Fix
-
-#
-AddBookmark.label=Add Boo&kmark...
-SelectRuler.label=Select Ruler
-#
-##########################################################################
-# These strings are used in file and container resource popup menu
-##########################################################################
-Source=&Source
-FormatDocument=&Format document
-##
-Breakpoint_Extension_Point.name=Breakpoint Extension Point
-Source_Validation_Extension_Point.name=Reconcile Validator Extension Point
-###############################################################################
-# The following property keys maybe unused. Commented out on 4/12/2005. Uncomment if needed.
-#Bean_Info_Provider_Extension.name=Bean Info Provider Extension
-#SpellCheck_Extension_Point.name=SpellCheck Extension Point
-#Open_On_Extension_Point.name=Open On Extension Point
-#Spell_Check_label=Spell Check
-#Spell_Check_tooltip=Spell Check
diff --git a/bundles/org.eclipse.wst.sse.ui/plugin.xml b/bundles/org.eclipse.wst.sse.ui/plugin.xml
deleted file mode 100644
index 0d1925d42a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/plugin.xml
+++ /dev/null
@@ -1,474 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension-point
- id="adapterFactoryDescription"
- name="%Adapter_Factory_Description_Extension.name" />
- <extension-point
- id="extendedEditorActions"
- name="%Extended_Editor_Actions_Extension.name" />
- <extension-point
- id="dropTargetTransfers"
- name="%Drop_Target_Transfers_Extension.name" />
- <extension-point
- id="editorConfiguration"
- name="%Extended_Editor_Configuration_Extension.name"
- schema="schema/editorconfiguration.exsd" />
-
-
- <!-- Make sure default preference values are set at runtime -->
- <extension point="org.eclipse.core.runtime.preferences">
- <initializer
- class="org.eclipse.wst.sse.ui.internal.PreferenceInitializer" />
- </extension>
-
-
- <!-- reusable extensions -->
- <extension point="org.eclipse.wst.sse.ui.editorConfiguration">
- <sourceViewerConfiguration
- class="org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration"
- target="org.eclipse.wst.sse.ui.StructuredTextEditor" />
- <provisionalDefinition
- type="preferencepages"
- value="org.eclipse.wst.sse.ui.preferences.editor"
- target="org.eclipse.wst.sse.ui.StructuredTextEditor" />
- </extension>
- <!-- associate the NavigateActionSet with various parts of the XML perspective-->
- <extension point="org.eclipse.ui.actionSetPartAssociations">
- <actionSetPartAssociation
- targetID="org.eclipse.ui.edit.text.actionSet.annotationNavigation">
- <part
- id="org.eclipse.wst.sse.ui.StructuredTextEditor">
- </part>
- </actionSetPartAssociation>
- <actionSetPartAssociation
- targetID="org.eclipse.ui.NavigateActionSet">
- <!--
- <part id="org.eclipse.ui.views.ResourceNavigator"/>
- <part id="org.eclipse.ui.views.ContentOutline"/>
- -->
- <!--
- should probably only "force" association of action sets for workbench parts that we own
- or only if the view is focusse in the XMLPerspective
- -->
- <part
- id="org.eclipse.wst.sse.ui.StructuredTextEditor">
- </part>
- </actionSetPartAssociation>
- </extension>
- <extension point="org.eclipse.ui.preferencePages">
- <!-- ROOT PREFERENCE PAGE FOR WEB AND XML FILES -->
- <!-- Comment out for now since this preference page is not used
- <page
- name="%WEB_AND_XML_Files.name"
- class="org.eclipse.wst.sse.ui.internal.preferences.ui.FilePreferencePage"
- id="org.eclipse.wst.sse.ui.internal.provisional.preferences">
- </page>
- -->
- <page
- name="%WEB_AND_XML_Files.name"
- class="org.eclipse.wst.sse.ui.internal.preferences.ui.EmptyFilePreferencePage"
- id="org.eclipse.wst.sse.ui.internal.provisional.preferences">
- </page>
- <!-- "common" task tags preference page -->
- <page
- name="%Task_Tags_Preferences.name"
- category="org.eclipse.wst.sse.ui.internal.provisional.preferences"
- class="org.eclipse.wst.sse.ui.internal.preferences.ui.TaskTagPreferencePage"
- id="org.eclipse.wst.sse.ui.preferences.tasktags">
- </page>
-
- <!-- Source Editor Preference page under Workbench->Editors -->
- <page
- name="%Structured_Text_Editor.name"
- category="org.eclipse.ui.preferencePages.Editors"
- class="org.eclipse.wst.sse.ui.internal.preferences.ui.StructuredTextEditorPreferencePage"
- id="org.eclipse.wst.sse.ui.preferences.editor">
- </page>
- </extension>
- <!-- ================================================================================================ -->
- <!-- common task tags property page -->
- <!-- ================================================================================================ -->
- <extension point="org.eclipse.ui.propertyPages">
- <page
- id="org.eclipse.wst.sse.ui.project.properties.tasktags"
- name="%Task_Tags_Preferences.name"
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true"
- class="org.eclipse.wst.sse.ui.internal.preferences.ui.TaskTagPreferencePage" />
- </extension>
-
- <!--
- <extension-point id="dragSourceTransfers" name="Drag Source Transfers"/>
- -->
- <extension point="org.eclipse.ui.commands">
- <!-- Edit commands -->
- <command
- name="%ActionDefinition.selectEnclosing.name"
- description="%ActionDefinition.selectEnclosing.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.structure.select.enclosing">
- </command>
- <command
- name="%ActionDefinition.selectNext.name"
- description="%ActionDefinition.selectNext.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.structure.select.next">
- </command>
- <command
- name="%ActionDefinition.selectPrevious.name"
- description="%ActionDefinition.selectPrevious.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.structure.select.previous">
- </command>
- <command
- name="%ActionDefinition.selectLast.name"
- description="%ActionDefinition.selectLast.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.structure.select.last">
- </command>
- <command
- name="%ActionDefinition.showJavadoc.name"
- description="%ActionDefinition.showJavadoc.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.show.javadoc">
- </command>
- <command
- name="%ActionDefinition.quickFix.name"
- description="%ActionDefinition.quickFix.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.edit.text.java.correction.assist.proposals">
- </command>
- <!-- Source commands -->
- <command
- name="%command.toggle.comment.name"
- description="%command.toggle.comment.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.toggle.comment">
- </command>
- <command
- name="%command.add.block.comment.name"
- description="%command.add.block.comment.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.add.block.comment">
- </command>
- <command
- name="%command.remove.block.comment.name"
- description="%command.remove.block.comment.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.remove.block.comment">
- </command>
- <command
- name="%command.cleanup.document.name"
- description="%command.cleanup.document.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.cleanup.document">
- </command>
- <command
- name="%command.format.document.name"
- description="%command.format.document.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.format.document">
- </command>
- <command
- name="%command.format.active.elements.name"
- description="%command.format.active.elements.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.format.active.elements">
- </command>
- <!-- Navigate commands -->
- <command
- name="%command.open.file.from.source.name"
- description="%command.open.file.from.source.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.open.file.from.source">
- </command>
- <!-- Find Occurrences -->
- <command
- name="%command.search.find.occurrences.name"
- description="%command.search.find.occurrences.description"
- categoryId="org.eclipse.ui.category.edit"
- id="org.eclipse.wst.sse.ui.search.find.occurrences">
- </command>
- </extension>
- <!-- Keybinding scope for source editor -->
- <extension point="org.eclipse.ui.contexts">
- <context
- name="%scope.structuredTextEditor.name"
- parentId="org.eclipse.ui.textEditorScope"
- description="%scope.structuredTextEditor.description"
- id="org.eclipse.wst.sse.ui.structuredTextEditorScope">
- </context>
- </extension>
- <!-- Keybindings for source editor -->
- <extension point="org.eclipse.ui.bindings">
- <!-- win32: M1=CTRL, M2=SHIFT, M3=ALT -->
- <!-- Edit commands -->
- <key
- sequence="M2+M3+ARROW_UP"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.structure.select.enclosing"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- sequence="M2+M3+ARROW_RIGHT"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.structure.select.next"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- sequence="M2+M3+ARROW_LEFT"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.structure.select.previous"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- sequence="M2+M3+ARROW_DOWN"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.structure.select.last"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- sequence="F2"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.show.javadoc"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- sequence="M1+1"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.edit.text.java.correction.assist.proposals"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <!-- Source commands -->
- <key
- sequence="M1+M2+C"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.toggle.comment"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- sequence="M1+M2+/"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.add.block.comment"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- sequence="M1+M2+\"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.remove.block.comment"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- sequence="M1+M2+F"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.format.document"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <key
- sequence="M1+I"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.format.active.elements"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <!-- Navigate commands -->
- <key
- sequence="F3"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.open.file.from.source"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- <!-- Find Occurrences -->
- <key
- sequence="M1+M2+A"
- contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
- commandId="org.eclipse.wst.sse.ui.search.find.occurrences"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
- </key>
- </extension>
- <!-- Font and colors contributions -->
- <extension point="org.eclipse.ui.themes">
- <themeElementCategory
- label="%Structured_Text_Editor.name"
- id="org.eclipse.wst.sse.ui">
- </themeElementCategory>
- <fontDefinition
- label="%sourceEditorFontDefiniton.label"
- categoryId="org.eclipse.wst.sse.ui"
- defaultsTo="org.eclipse.jface.textfont"
- id="org.eclipse.wst.sse.ui.textfont">
- <description>
- %sourceEditorFontDefintion.description
- </description>
- </fontDefinition>
- </extension>
- <extension point="org.eclipse.wst.sse.ui.dropTargetTransfers">
- <dropTargetContribution
- targetID="org.eclipse.wst.sse.ui.StructuredTextEditor"
- id="org.eclipse.wst.sse.ui.extension.ExtendedTransfers">
- <transfer
- priority="mid"
- singleton="true"
- class="org.eclipse.swt.dnd.FileTransfer"
- method="getInstance"
- id="org.eclipse.swt.dnd.FileTransfer">
- </transfer>
- <dropAction
- class="org.eclipse.wst.sse.ui.internal.FileDropAction"
- transferID="org.eclipse.swt.dnd.FileTransfer"
- id="org.eclipse.wst.sse.ui.internal.FileDropAction">
- </dropAction>
- <transfer
- priority="low"
- singleton="true"
- class="org.eclipse.swt.dnd.TextTransfer"
- method="getInstance"
- id="org.eclipse.swt.dnd.TextTransfer">
- </transfer>
- <dropAction
- class="org.eclipse.wst.sse.ui.internal.TextDropAction"
- transferID="org.eclipse.swt.dnd.TextTransfer"
- id="org.eclipse.wst.sse.ui.internal.TextDropAction">
- </dropAction>
- </dropTargetContribution>
- </extension>
-
- <extension point="org.eclipse.ui.editors.annotationTypes">
- <type
- super="org.eclipse.ui.workbench.texteditor.error"
- markerType="org.eclipse.wst.sse.problem"
- name="org.eclipse.wst.sse.ui.temp.error"
- markerSeverity="2">
- </type>
- <type
- super="org.eclipse.ui.workbench.texteditor.warning"
- markerType="org.eclipse.wst.sse.problem"
- name="org.eclipse.wst.sse.ui.temp.warning"
- markerSeverity="1">
- </type>
-
- <type
- super="org.eclipse.ui.workbench.texteditor.info"
- markerType="org.eclipse.wst.sse.problem"
- name="org.eclipse.wst.sse.ui.temp.info"
- markerSeverity="0">
- </type>
- </extension>
- <extension
- point="org.eclipse.ui.editors.markerAnnotationSpecification">
-
- <!--================================================================================================-->
- <!-- same as eclipse text ui (including preference keys), except for vertical ruler & preference page -->
- <!--================================================================================================-->
- <specification
- annotationType="org.eclipse.wst.sse.ui.temp.error"
- annotationImageProvider="org.eclipse.wst.sse.ui.internal.ui.StructuredTextAnnotationImageProvider"
- verticalRulerPreferenceValue="true"
- verticalRulerPreferenceKey="sseErrorIndicationInVerticalRuler"
- includeOnPreferencePage="false">
- </specification>
- <specification
- annotationType="org.eclipse.wst.sse.ui.temp.warning"
- annotationImageProvider="org.eclipse.wst.sse.ui.internal.ui.StructuredTextAnnotationImageProvider"
- verticalRulerPreferenceValue="false"
- verticalRulerPreferenceKey="sseWarningIndicationInVerticalRuler"
- includeOnPreferencePage="false">
- </specification>
- <specification
- annotationImageProvider="org.eclipse.wst.sse.ui.internal.ui.StructuredTextAnnotationImageProvider"
- annotationType="org.eclipse.wst.sse.ui.temp.info">
- </specification>
- </extension>
- <!-- dynamic content type supporting editor, no supported file extensions by default -->
- <extension point="org.eclipse.ui.editors">
- <editor
- name="%Standalone_Structured_Source_Editor.name"
- icon="$nl$/icons/sourceEditor.gif"
- contributorClass="org.eclipse.wst.sse.ui.internal.actions.ActionContributor"
- class="org.eclipse.wst.sse.ui.StructuredTextEditor"
- symbolicFontName="org.eclipse.wst.sse.ui.textfont"
- id="org.eclipse.wst.sse.ui.StructuredTextEditor">
- </editor>
- </extension>
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.core.resources.IContainer"
- id="org.eclipse.wst.sse.ui.actions.ContainerSourceActions">
- <menu
- label="%Source"
- path="additions"
- id="source">
- <groupMarker name="sourceGroup"></groupMarker>
- </menu>
- <action
- label="%FormatDocument"
- class="org.eclipse.wst.sse.ui.internal.actions.FormatActionDelegate"
- menubarPath="source/sourceGroup"
- enablesFor="+"
- id="org.eclipse.wst.sse.ui.actions.ContainerSourceActions.Format">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IFile"
- id="org.eclipse.wst.sse.ui.actions.FileSourceActions">
- <menu
- label="%Source"
- path="additions"
- id="source">
- <groupMarker name="sourceGroup"></groupMarker>
- </menu>
- <action
- label="%FormatDocument"
- class="org.eclipse.wst.sse.ui.internal.actions.FormatActionDelegate"
- menubarPath="source/sourceGroup"
- enablesFor="+"
- id="org.eclipse.wst.sse.ui.actions.FileSourceActions.Format">
- </action>
- </objectContribution>
- </extension>
- <extension
- point="org.eclipse.ui.editorActions">
- <editorContribution
- targetID="org.eclipse.wst.sse.ui.StructuredTextEditor"
- id="org.eclipse.wst.sse.ui.StructuredTextEditor.ruler.actions">
- <action
- label="%AddBookmark.label"
- helpContextId="org.eclipse.ui.bookmark_action_context"
- class="org.eclipse.ui.texteditor.BookmarkRulerAction"
- actionID="RulerDoubleClick"
- id="org.eclipse.ui.texteditor.BookmarkRulerAction">
- </action>
- <action
- label="%SelectRuler.label"
- class="org.eclipse.ui.texteditor.SelectRulerAction"
- actionID="RulerClick"
- id="org.eclipse.ui.texteditor.SelectRulerAction">
- </action>
- </editorContribution>
- </extension>
-
- <!--================================================================================================-->
- <!-- contribute a SearchResultViewPage for Occurrences in file -->
- <!--================================================================================================-->
- <extension
- id="Occurrences search page"
- point="org.eclipse.search.searchResultViewPages">
- <viewPage
- id="org.eclipse.wst.sse.ui.search.OccurrencesSearchResultPage"
- searchResultClass="org.eclipse.wst.sse.ui.internal.search.OccurrencesSearchResult"
- class="org.eclipse.wst.sse.ui.internal.search.OccurrencesSearchViewPage">
- </viewPage>
- </extension>
-
- <!-- extension point for breakpoint extension -->
- <extension-point
- id="breakpoint"
- name="%Breakpoint_Extension_Point.name" />
- <!-- extension point for source validation -->
- <!-- interfaces for this extension point can be found in org.eclipse.wst.validation -->
- <extension-point
- id="sourcevalidation"
- name="%Source_Validation_Extension_Point.name"
- schema="schema/org.eclipse.wst.sse.editor.sourcevalidation.exsd" />
-</plugin>
diff --git a/bundles/org.eclipse.wst.sse.ui/reexport-info.txt b/bundles/org.eclipse.wst.sse.ui/reexport-info.txt
deleted file mode 100644
index 9c8c7c70da..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/reexport-info.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-we reexport eclipse.ui.editors
-since one of our APIs, StructuredSourceViewerConfiguration
-requires it.
-
diff --git a/bundles/org.eclipse.wst.sse.ui/schema/editorconfiguration.exsd b/bundles/org.eclipse.wst.sse.ui/schema/editorconfiguration.exsd
deleted file mode 100644
index 66e2130ae5..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/schema/editorconfiguration.exsd
+++ /dev/null
@@ -1,256 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.sse.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.sse.ui" id="editorConfiguration" name="Editor Configuration"/>
- </appInfo>
- <documentation>
- The SSE StructuredTextEditor is intended to be as flexible as possible. Much of its design centers around the notion of defining and redefining its behavior and appearance based on the content type of its input. This extension point allows clients to provide an editor configuration to the StructuredTextEditor without having to subclass the editor.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="sourceViewerConfiguration" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="contentOutlineConfiguration" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="propertySheetConfiguration" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="provisionalConfiguration" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="provisionalDefinition" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="sourceViewerConfiguration">
- <annotation>
- <documentation>
- Defines the source viewer configuration, affecting syntax highlighting, content assist, hover help, and more in the current editor.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="target" type="string" use="required">
- <annotation>
- <documentation>
- A string defining when to use this extension, either an editor or content type id. Multiple targets may be given as a comma delimited value.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- Must subclass org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="contentOutlineConfiguration">
- <annotation>
- <documentation>
- Defines how the current editor&apos;s input maps to elements with in a Tree control, as well as selection filtering, toolbar and menu contributions, etc in the Outline view.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="target" type="string" use="required">
- <annotation>
- <documentation>
- A string defining when to use this extension, either an editor or content type id. Multiple targets may be given as a comma delimited value.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- Must subclass org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="propertySheetConfiguration">
- <annotation>
- <documentation>
- Defines how the current editor&apos;s input maps to properties in a Table control, as well as toolbar contributions, etc in the Properties view.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="target" type="string" use="required">
- <annotation>
- <documentation>
- A string defining when to use this extension, either an editor or content type id. Multiple targets may be given as a comma delimited value.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- Must subclass org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="provisionalConfiguration">
- <annotation>
- <documentation>
- Declares a class fulfilling the requirements of a type to be used for the given target(s).
-&lt;br /&gt;Note: this is not API and is only used for provisional configuration types.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="target" type="string" use="required">
- <annotation>
- <documentation>
- A string defining when to use this extension, either an editor or content type id. Multiple targets may be given as a comma delimited value.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- The type of configuration to find.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- Implementation class for this type.
- </documentation>
- <appInfo>
- <meta.attribute kind="java"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="provisionalDefinition">
- <annotation>
- <documentation>
- Defines a value for a type to be used for the given target(s).
-&lt;br /&gt;Note: this is not API and is only used for provisional configuration types.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- The type of definition to find.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string">
- <annotation>
- <documentation>
- The value of this definition.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="target" type="string" use="required">
- <annotation>
- <documentation>
- A string defining when to use this extension, either an editor or content type id. Multiple targets may be given as a comma delimited value.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- &lt;pre&gt;
- &lt;extension
- point=&quot;org.eclipse.wst.sse.ui.editorConfiguration&quot;&gt;
- &lt;!-- associating a source viewer configuration to an input&apos;s content type--&gt;
- &lt;sourceViewerConfiguration
- class=&quot;org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML&quot;
- target=&quot;org.eclipse.wst.html.core.htmlsource&quot;/&gt;
- &lt;!-- associating an outline configuration to an input&apos;s content type --&gt;
- &lt;contentOutlineConfiguration
- class=&quot;org.eclipse.wst.sse.xml.ui.views.contentoutline.XMLContentOutlineConfiguration&quot;
- target=&quot;org.eclipse.core.runtime.xml&quot;/&gt;
- &lt;!-- associating a property sheet configuration to multiple content types --&gt;
- &lt;propertySheetConfiguration
- class=&quot;org.eclipse.wst.xml.ui.views.properties.XMLPropertySheetConfiguration&quot;
- target=&quot;org.eclipse.wst.sse.contenttype.xml, org.eclipse.wst.html.core.htmlsource, org.eclipse.jst.jsp.core.jspsource&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- see &lt;code&gt;org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration&lt;/code&gt;, &lt;code&gt;org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration&lt;/code&gt;, &lt;code&gt;org.eclipse.wst.sse.ui.views.properties.StructuredPropertySheetConfiguration&lt;/code&gt;.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.wst.sse.ui/schema/sourcevalidation.exsd b/bundles/org.eclipse.wst.sse.ui/schema/sourcevalidation.exsd
deleted file mode 100644
index 5250d317c3..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/schema/sourcevalidation.exsd
+++ /dev/null
@@ -1,191 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.wst.sse.ui">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.wst.sse.ui" id="sourcevalidation" name="Source Validation"/>
- </appInfo>
- <documentation>
- This extension point is provided to allow clients to contribute a validator (&lt;code&gt;org.eclipse.wst.validation.internal.provisional.core.IValidator&lt;/code&gt;)
-for as-you-type (source) validation.&lt;br&gt;
-
-If your validator can handle &quot;partial document&quot; validation, it should also implement ISourceValidator. The validate call on ISourceValidator gets passed an IRegion representation of the part of the document that&apos;s dirty.&lt;br&gt;
-
-This should be much more efficient than validating the entire file each time someone types.&lt;br&gt;
-
-The validator is enabled for specific content type/partition combinations.&lt;br&gt;
-
-Required plugins are:&lt;br&gt;
- org.eclipse.wst.sse.ui&lt;br&gt;
- org.eclipse.wst.validation
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="validator"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="validator">
- <complexType>
- <sequence>
- <element ref="contentTypeIdentifier" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="scope" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="partitionType">
- <complexType>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="contentTypeIdentifier">
- <complexType>
- <sequence>
- <element ref="partitionType" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- &lt;b&gt;This extension point is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.&lt;/b&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- Example demonstrating how HTMLValidator contributes to as-you-type validation in the source editor.
-
-&lt;pre&gt;
- &lt;extension
- point=&quot;org.eclipse.wst.sse.ui.extensions.sourcevalidation&quot;&gt;
- &lt;validator
- scope=&quot;total&quot;
- class=&quot;org.eclipse.wst.validation.html.HTMLValidator&quot;
- id=&quot;org.eclipse.wst.validation.htmlsourcevalidator&quot;&gt;
- &lt;contentTypeIdentifier
- id=&quot;org.eclipse.wst.html.core.htmlsource&quot;&gt;
- &lt;partitionType
- id=&quot;org.eclipse.wst.html.HTML_DEFAULT&quot;/&gt;
- &lt;/contentTypeIdentifier&gt;
- &lt;contentTypeIdentifier
- id=&quot;org.eclipse.jst.jsp.core.jspsource&quot;&gt;
- &lt;partitionType
- id=&quot;org.eclipse.wst.html.HTML_DEFAULT&quot;/&gt;
- &lt;/contentTypeIdentifier&gt;
- &lt;/validator&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;p&gt;
-Using ISourceValidator
-&lt;/p&gt;
-&lt;p&gt;
-If your validator can handle &quot;partial document&quot; validation, it should implement ISourceValidator.
-&lt;/p&gt;
-&lt;p&gt;
-The validate call on ISourceValidator gets passed an IRegion of the document which represents just the part that&apos;s dirty. This should be much more efficient than validating the entire file each time someone types.
-&lt;/p&gt;
-&lt;p&gt;
-ISourceValidator has its &quot;connect(IDocument doc)&quot; method called when it&apos;s hooked up to the document (when the editor is opened), and &quot;disconnect(IDocument doc)&quot; called when the editor is closed, where any &quot;unhooking&quot; should take place.
-&lt;/p&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- Currently there is no supplied implementation for IValidator.
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2005 IBM Corporation and others.&lt;br&gt;
-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 &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
diff --git a/bundles/org.eclipse.wst.sse.ui/src-encoding/org/eclipse/wst/sse/ui/internal/encoding/ui/EncodingPreferencePage.java b/bundles/org.eclipse.wst.sse.ui/src-encoding/org/eclipse/wst/sse/ui/internal/encoding/ui/EncodingPreferencePage.java
deleted file mode 100644
index 32cf3dd551..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-encoding/org/eclipse/wst/sse/ui/internal/encoding/ui/EncodingPreferencePage.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.encoding.ui;
-
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
-import org.eclipse.wst.sse.core.internal.encoding.util.CodedResourcePlugin;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-/**
- * @deprecated - this should not be handled by the platform and not WTP
- */
-
-public class EncodingPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- Button fUse3ByteBOMWithUTF8CheckBox = null;
-
- private Button createCheckBox(Composite parent, String label) {
- Button button = new Button(parent, SWT.CHECK | SWT.LEFT | SWT.WRAP);
- button.setText(label);
-
- boolean selection = CodedResourcePlugin.getDefault().getPluginPreferences().getBoolean(CommonEncodingPreferenceNames.USE_3BYTE_BOM_WITH_UTF8);
- button.setSelection(selection);
-
- return button;
- }
-
- private Composite createComposite(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
-
- //GridLayout
- GridLayout layout = new GridLayout(1, true);
- composite.setLayout(layout);
-
- //GridData
- GridData data = new GridData(GridData.FILL_BOTH);
- composite.setLayoutData(data);
-
- return composite;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- Composite composite = createComposite(parent);
-
- String description = SSEUIMessages.EncodingPreferencePage_0; //$NON-NLS-1$
-
- // ISSUE: the following to lines look redundant,
- // not sure what was trying to be accomplished.
- // May be dead code.
- createLabel(composite, description);
- createLabel(composite, ""); //$NON-NLS-1$
-
- String checkBoxLabel = SSEUIMessages.EncodingPreferencePage_1; //$NON-NLS-1$
- fUse3ByteBOMWithUTF8CheckBox = createCheckBox(composite, checkBoxLabel);
-
- return composite;
- }
-
- private Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
-
- return label;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- public void performDefaults() {
- boolean defaultSelection = CodedResourcePlugin.getDefault().getPluginPreferences().getDefaultBoolean(CommonEncodingPreferenceNames.USE_3BYTE_BOM_WITH_UTF8);
- fUse3ByteBOMWithUTF8CheckBox.setSelection(defaultSelection);
- }
-
- public boolean performOk() {
- CodedResourcePlugin.getDefault().getPluginPreferences().setValue(CommonEncodingPreferenceNames.USE_3BYTE_BOM_WITH_UTF8, fUse3ByteBOMWithUTF8CheckBox.getSelection());
- CodedResourcePlugin.getDefault().savePluginPreferences();
-
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ConfigurationPointCalculator.java b/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ConfigurationPointCalculator.java
deleted file mode 100644
index fdb15cbe3d..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ConfigurationPointCalculator.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.extensions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.part.MultiPageEditorSite;
-
-public class ConfigurationPointCalculator {
- public static final String DESIGN = ".design"; //$NON-NLS-1$
- public static final String SOURCE = ".source"; //$NON-NLS-1$
-
- public static String[] getConfigurationPoints(IEditorPart part, String contentType, String subContext, Class rootClass) {
- ConfigurationPointCalculator calculator = new ConfigurationPointCalculator();
- calculator.setContentType(contentType);
- calculator.setPart(part);
- calculator.setRootClass(rootClass);
- calculator.setSubContext(subContext);
- return calculator.getConfigurationPoints();
- }
-
- protected String fContentType = null;
- protected IEditorPart fPart = null;
-
- protected Class fRootClass = null;
- protected String fSubContext = null;
-
- /**
- *
- */
- public ConfigurationPointCalculator() {
- super();
- }
-
- public String[] getConfigurationPoints() {
- List points = new ArrayList(2);
-
- IEditorSite site = fPart.getEditorSite();
- String id = site.getId();
- if (id != null && id.length() > 0 && !id.equals(fRootClass.getName()))
- points.add(id);
-
- if (site instanceof MultiPageEditorSite) {
- String multipageID = ((MultiPageEditorSite) site).getMultiPageEditor().getSite().getId();
- if (!points.contains(multipageID))
- points.add(multipageID);
- String sourcePageID = ((MultiPageEditorSite) site).getMultiPageEditor().getSite().getId() + ".source"; //$NON-NLS-1$
- if (!points.contains(sourcePageID))
- points.add(sourcePageID);
- }
- if (site instanceof MultiPageEditorSite) {
- String multipageClassName = ((MultiPageEditorSite) site).getMultiPageEditor().getClass().getName();
- if (!points.contains(multipageClassName))
- points.add(multipageClassName);
- }
- Class editorClass = fPart.getClass();
- while (editorClass != null && fRootClass != null && !editorClass.equals(fRootClass)) {
- if (!points.contains(editorClass.getName()))
- points.add(editorClass.getName());
- editorClass = editorClass.getSuperclass();
- }
-
- IContentType contentType = Platform.getContentTypeManager().getContentType(fContentType);
- while (contentType != null && !contentType.getId().equals(IContentTypeManager.CT_TEXT)) {
- if (!points.contains(contentType.getId()))
- points.add(contentType.getId());
- contentType = contentType.getBaseType();
- }
-
- if (!points.contains(fRootClass.getName()))
- points.add(fRootClass.getName());
- return (String[]) points.toArray(new String[0]);
- }
-
- /**
- * @return Returns the contentType.
- */
- public String getContentType() {
- return fContentType;
- }
-
- /**
- * @return Returns the part.
- */
- public IEditorPart getPart() {
- return fPart;
- }
-
- /**
- * @return Returns the rootClass.
- */
- public Class getRootClass() {
- return fRootClass;
- }
-
- /**
- * @return Returns the subContext.
- */
- public String getSubContext() {
- return fSubContext;
- }
-
- /**
- * @param contentType
- * The contentType to set.
- */
- public void setContentType(String contentType) {
- fContentType = contentType;
- }
-
- /**
- * @param part
- * The part to set.
- */
- public void setPart(IEditorPart part) {
- fPart = part;
- }
-
- /**
- * @param rootClass
- * The rootClass to set.
- */
- public void setRootClass(Class rootClass) {
- fRootClass = rootClass;
- }
-
- /**
- * @param subContext
- * The subContext to set.
- */
- public void setSubContext(String subContext) {
- fSubContext = subContext;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ISelfValidateEditAction.java b/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ISelfValidateEditAction.java
deleted file mode 100644
index 0dedc21501..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ISelfValidateEditAction.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.extensions;
-
-
-
-/**
- * This is a marker interface to control ValidateEdit call Usually framework
- * calls IExtendedSimpleEditor#validateEdit() before calling
- * IExtendedEditorAction's run() method. However, if the action implements
- * this interface, framework won't call validateEdit() method.
- *
- * The action should call validateEdit() at their own appropriate timing.
- */
-public interface ISelfValidateEditAction {
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ISourceEditingTextTools.java b/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ISourceEditingTextTools.java
deleted file mode 100644
index d30edf232f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/ISourceEditingTextTools.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.extensions;
-
-
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Interface to provide convenient functions for editors that may not be
- * ITextEditors, but need to expose properties usually found in text editors
- */
-public interface ISourceEditingTextTools {
-
- /**
- * @return the document offset at which the Caret is located
- */
- public int getCaretOffset();
-
- /**
- * @return the IDocument being edited. If this editor supports multiple
- * documents, the document currently possessing the caret will be
- * returned.
- */
- public IDocument getDocument();
-
- /**
- * @return The IEditorPart instance for this editor that is known to the
- * workbench.
- */
- public IEditorPart getEditorPart();
-
- /**
- * @return The current selection within the editor. Implementors may
- * support other types of selection.
- */
- public ITextSelection getSelection();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IBreakpointConstants.java b/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IBreakpointConstants.java
deleted file mode 100644
index a78e4482c1..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IBreakpointConstants.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint;
-
-/**
- * @author pavery
- */
-public interface IBreakpointConstants {
- String ATTR_HIDDEN = "hidden"; //$NON-NLS-1$
- String RESOURCE_PATH = "org.eclipse.wst.sse.ui.extensions.breakpoint.path"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IBreakpointProvider.java b/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IBreakpointProvider.java
deleted file mode 100644
index 89855d167c..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IBreakpointProvider.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
-
-/**
- * Interface to provide breakpoint creation
- */
-public interface IBreakpointProvider {
-
- /**
- * Adds breakpoint to specified position
- *
- * @param document
- * IDocument object
- * @param input
- * current editor input, not necessarily an IFileEditorInput or
- * linked to a resource in any way
- * @param lineNumber
- * current line number
- * @param offset
- * current caret offset
- * @throws CoreException
- * @return IStatus the status after being asked to add a breakpoint. The
- * Severity of ERROR should only be used if the location
- * information is both valid for a breakpoint and one could not be
- * added.
- */
- IStatus addBreakpoint(IDocument document, IEditorInput input, int lineNumber, int offset) throws CoreException;
-
- /**
- * Returns corresponding resource from editor input
- *
- * @param input
- * @return IResource
- */
- IResource getResource(IEditorInput input);
-
- /**
- * Set ISourceEditingTextTools object
- *
- * @param tool
- * ISourceEditingTextTools object
- */
- void setSourceEditingTextTools(ISourceEditingTextTools tool);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IExtendedStorageEditorInput.java b/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IExtendedStorageEditorInput.java
deleted file mode 100644
index dc414724e3..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/IExtendedStorageEditorInput.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint;
-
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.texteditor.IElementStateListener;
-
-public interface IExtendedStorageEditorInput extends IStorageEditorInput {
- /**
- * Adds the given element state listener to this input. Has no effect if
- * an identical listener is already registered. Typically used by the
- * IDocumentProvider to register itself for change notification.
- *
- * @param listener
- * the listener
- */
- void addElementStateListener(IElementStateListener listener);
-
- /**
- * Removes the given element state listener from this input. Has no affect
- * if an identical listener is not registered.
- *
- * @param listener
- * the listener
- */
- void removeElementStateListener(IElementStateListener listener);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/NodeLocation.java b/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/NodeLocation.java
deleted file mode 100644
index 7874d98802..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/NodeLocation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint;
-
-
-public interface NodeLocation {
- /**
- * Returns the document end offset of the end tag, -1 of there is no end
- * tag
- *
- * @return
- */
- int getEndTagEndOffset();
-
- /**
- * Returns the document start offset of the end tag, -1 of there is no end
- * tag
- *
- * @return
- */
- int getEndTagStartOffset();
-
- /**
- * Returns the document end offset of the start tag, -1 of there is no
- * start tag
- *
- * @return
- */
- int getStartTagEndOffset();
-
- /**
- * Returns the document start offset of the start tag, -1 of there is no
- * start tag
- *
- * @return
- */
- int getStartTagStartOffset();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/NullSourceEditingTextTools.java b/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/NullSourceEditingTextTools.java
deleted file mode 100644
index 65758a62f8..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-extensions/org/eclipse/wst/sse/ui/internal/provisional/extensions/breakpoint/NullSourceEditingTextTools.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
-
-public class NullSourceEditingTextTools implements ISourceEditingTextTools {
- public static final String ID = "sourceeditingtexttools"; //$NON-NLS-1$
- private ITextEditor fTextEditor;
-
- /**
- * @return
- */
- public synchronized static ISourceEditingTextTools getInstance() {
- return new NullSourceEditingTextTools();
- }
-
- private NullSourceEditingTextTools() {
- super();
- }
-
- public int getCaretOffset() {
- ISelection sel = fTextEditor.getSelectionProvider().getSelection();
- if (sel instanceof ITextSelection) {
- return ((ITextSelection) sel).getOffset();
- }
- return -1;
- }
-
- public IDocument getDocument() {
- return fTextEditor.getDocumentProvider().getDocument(fTextEditor.getEditorInput());
- }
-
- public IEditorPart getEditorPart() {
- return fTextEditor;
- }
-
- public ITextSelection getSelection() {
- if (fTextEditor != null)
- return (ITextSelection) fTextEditor.getSelectionProvider().getSelection();
- return TextSelection.emptySelection();
- }
-
- public void setTextEditor(ITextEditor editor) {
- fTextEditor = editor;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/ExclusionsTab.java b/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/ExclusionsTab.java
deleted file mode 100644
index 03fcdfc7d6..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/ExclusionsTab.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import com.ibm.icu.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.sse.core.internal.SSECorePlugin;
-import org.eclipse.wst.sse.core.internal.tasks.FileTaskScannerRegistryReader;
-import org.eclipse.wst.sse.core.internal.tasks.TaskTagPreferenceKeys;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.util.Sorter;
-
-class ExclusionsTab implements IPreferenceTab {
- private class ArrayTreeContentProvider implements ITreeContentProvider {
- public ArrayTreeContentProvider() {
- super();
- }
-
- public void dispose() {
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Object[])
- return fContentTypeSorter.sort((Object[]) parentElement);
- return new Object[0];
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-
- private class ContentTypeLabelProvider extends LabelProvider {
- public String getText(Object element) {
- if (element != null) {
- Object o = element;
- if (o instanceof String) {
- o = fContentTypeManager.getContentType(o.toString());
- }
- if (o instanceof IContentType) {
- return ((IContentType) o).getName();
- }
- }
- return super.getText(element);
- }
- }
-
- /**
- * A QuickSorter that sorts and returns a IContentType-typed array
- */
- private class ContentTypeSorter extends Sorter {
- private Collator collator = Collator.getInstance(Locale.ENGLISH);
-
- public boolean compare(Object elementOne, Object elementTwo) {
- return (collator.compare(((IContentType) elementOne).getName(), ((IContentType) elementTwo).getName())) < 0;
- }
-
- public Object[] sort(Object[] unSortedCollection) {
- Object[] types = super.sort(unSortedCollection);
- IContentType[] sortedTypes = new IContentType[types.length];
- if (types.length > 0) {
- System.arraycopy(types, 0, sortedTypes, 0, sortedTypes.length);
- }
- return sortedTypes;
- }
- }
-
- private class ContentTypeTreeProvider implements ITreeContentProvider {
- public ContentTypeTreeProvider() {
- super();
- }
-
- public void dispose() {
- }
-
- boolean equals(Object left, Object right) {
- return left == null ? right == null : ((right != null) && left.equals(right));
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Object[]) {
- return (Object[]) parentElement;
- }
- if (parentElement instanceof IContentType) {
- List elements = new ArrayList(0);
- IContentType[] allTypes = fContentTypeManager.getAllContentTypes();
- for (int i = 0; i < allTypes.length; i++) {
- if (!fSupportedContentTypes.contains(allTypes[i]) && equals(allTypes[i].getBaseType(), parentElement)) {
- elements.add(allTypes[i]);
- }
- }
- return fContentTypeSorter.sort(elements.toArray());
- }
- return new Object[0];
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public Object getParent(Object element) {
- Object parent = null;
- if (element instanceof IContentType) {
- parent = ((IContentType) element).getBaseType();
- }
- return parent;
- }
-
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-
- /**
- * A QuickSorter that sorts and returns a String-typed array
- */
- private class StringSorter extends Sorter {
- Collator collator = Collator.getInstance(Locale.ENGLISH);
-
- public boolean compare(Object elementOne, Object elementTwo) {
- return (collator.compare(elementOne.toString(), elementTwo.toString()) < 0);
- }
-
- public Object[] sort(Object[] unSortedCollection) {
- Object[] sortedCollection = super.sort(unSortedCollection);
- String[] strings = new String[sortedCollection.length];
- // copy the array so can return a new sorted collection
- if (strings.length > 0) {
- System.arraycopy(sortedCollection, 0, strings, 0, strings.length);
- }
- return strings;
- }
- }
-
- private static final boolean _debugPreferences = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/preferences")); //$NON-NLS-1$ //$NON-NLS-2$
-
- private CheckboxTreeViewer fContentTypeList;
-
- private IContentTypeManager fContentTypeManager = null;
-
- ContentTypeSorter fContentTypeSorter = new ContentTypeSorter();
-
- private IContentType[] fIgnoreContentTypes = null;
-
- private IContentType[] fOriginalIgnoreContentTypes = null;
-
- private TaskTagPreferencePage fOwner = null;
-
- private IScopeContext[] fPreferencesLookupOrder = null;
-
- private IPreferencesService fPreferencesService = null;
-
- private List fSupportedContentTypes = null;
-
- public ExclusionsTab(TaskTagPreferencePage parent, IPreferencesService preferencesService, IScopeContext[] lookupOrder) {
- super();
- fOwner = parent;
- fPreferencesLookupOrder = lookupOrder;
- fPreferencesService = preferencesService;
- fContentTypeManager = Platform.getContentTypeManager();
-
- String[] supportedContentTypeIDs = FileTaskScannerRegistryReader.getInstance().getSupportedContentTypeIds();
- fSupportedContentTypes = new ArrayList(supportedContentTypeIDs.length);
- for (int i = 0; i < supportedContentTypeIDs.length; i++) {
- IContentType type = fContentTypeManager.getContentType(supportedContentTypeIDs[i]);
- if (type != null) {
- fSupportedContentTypes.add(type);
- }
- }
- String[] ignoreContentTypes = StringUtils.unpack(fPreferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, SSECorePlugin.getDefault().getPluginPreferences().getDefaultString(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED), fPreferencesLookupOrder));
- List contentTypes = new ArrayList();
- for (int i = 0; i < ignoreContentTypes.length; i++) {
- IContentType type = fContentTypeManager.getContentType(ignoreContentTypes[i]);
- if (type != null) {
- contentTypes.add(type);
- }
- }
- fOriginalIgnoreContentTypes = fIgnoreContentTypes = (IContentType[]) contentTypes.toArray(new IContentType[contentTypes.size()]);
- }
-
- public Control createContents(Composite tabFolder) {
- Composite composite = new Composite(tabFolder, SWT.NONE);
- composite.setLayout(new GridLayout(2, true));
- Text description = new Text(composite, SWT.READ_ONLY);
- description.setText(SSEUIMessages.TaskTagExclusionTab_02);
- description.setBackground(composite.getBackground());
-
- fContentTypeList = new CheckboxTreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
- fContentTypeList.setLabelProvider(new ContentTypeLabelProvider());
- fContentTypeList.setContentProvider(new ArrayTreeContentProvider());
-
- fContentTypeList.setInput(fSupportedContentTypes.toArray());
- fContentTypeList.setCheckedElements(fSupportedContentTypes.toArray());
- fContentTypeList.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
- for (int i = 0; i < fIgnoreContentTypes.length; i++) {
- fContentTypeList.setChecked(fIgnoreContentTypes[i], false);
- }
-
- Button selectAll = new Button(composite, SWT.PUSH);
- selectAll.setText(SSEUIMessages.TaskTagPreferenceTab_17);
- selectAll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
- selectAll.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fContentTypeList.setCheckedElements(fSupportedContentTypes.toArray());
- }
- });
-
- Button selectNone = new Button(composite, SWT.PUSH);
- selectNone.setText(SSEUIMessages.TaskTagPreferenceTab_18);
- selectNone.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
- selectNone.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fContentTypeList.setCheckedElements(new Object[0]);
- }
- });
-
- new Label(composite, SWT.NONE).setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
-
- Text affectedTypesLabel = new Text(composite, SWT.READ_ONLY);
- affectedTypesLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
- affectedTypesLabel.setBackground(composite.getBackground());
- affectedTypesLabel.setText(SSEUIMessages.TaskTagExclusionTab_03);
-
- final TreeViewer contentTypeTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
- contentTypeTreeViewer.setLabelProvider(new ContentTypeLabelProvider());
- contentTypeTreeViewer.setContentProvider(new ContentTypeTreeProvider());
- contentTypeTreeViewer.setInput(new Object[0]);
- contentTypeTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
-
- fContentTypeList.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelection() instanceof IStructuredSelection) {
- Object[] o = ((IStructuredSelection) event.getSelection()).toArray();
- contentTypeTreeViewer.setInput(o);
- contentTypeTreeViewer.expandAll();
- if (o.length > 0) {
- contentTypeTreeViewer.reveal(o[0]);
- }
- }
- }
- });
-
- return composite;
- }
-
- public String getTitle() {
- return SSEUIMessages.TaskTagExclusionTab_01;
- }
-
- public void performApply() {
- save();
- }
-
- public void performDefaults() {
- if (_debugPreferences) {
- System.out.println("Loading defaults in " + getClass().getName()); //$NON-NLS-1$
- }
- IEclipsePreferences[] defaultPreferences = new IEclipsePreferences[fPreferencesLookupOrder.length - 1];
- for (int i = 1; i < defaultPreferences.length; i++) {
- defaultPreferences[i - 1] = fPreferencesLookupOrder[i].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE);
- }
- String[] defaultIgnoreTypes = StringUtils.unpack(fPreferencesService.get(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, null, defaultPreferences)); //$NON-NLS-1$
-
- List contentTypes = new ArrayList();
- for (int i = 0; i < defaultIgnoreTypes.length; i++) {
- IContentType type = fContentTypeManager.getContentType(defaultIgnoreTypes[i]);
- if (type != null) {
- contentTypes.add(type);
- }
- }
- fIgnoreContentTypes = (IContentType[]) contentTypes.toArray(new IContentType[contentTypes.size()]);
- fContentTypeList.setCheckedElements(fContentTypeManager.getAllContentTypes());
- for (int i = 0; i < fIgnoreContentTypes.length; i++) {
- fContentTypeList.setChecked(fIgnoreContentTypes[i], false);
- }
- }
-
- public void performOk() {
- List ignoredIds = save();
- String[] ignoreIDs = (String[]) new StringSorter().sort(ignoredIds.toArray());
- fIgnoreContentTypes = new IContentType[ignoreIDs.length];
- for (int i = 0; i < ignoreIDs.length; i++) {
- fIgnoreContentTypes[i] = fContentTypeManager.getContentType(ignoreIDs[i]);
- }
-
- if (!Arrays.equals(fOriginalIgnoreContentTypes, fIgnoreContentTypes)) {
- fOwner.requestRedetection();
- }
- fOriginalIgnoreContentTypes = fIgnoreContentTypes;
- }
-
- private List save() {
- List ignoredIds = new ArrayList();
- List checked = Arrays.asList(fContentTypeList.getCheckedElements());
- for (int i = 0; i < fSupportedContentTypes.size(); i++) {
- if (!checked.contains(fSupportedContentTypes.get(i))) {
- ignoredIds.add(((IContentType) fSupportedContentTypes.get(i)).getId());
- }
- }
- IEclipsePreferences[] defaultPreferences = new IEclipsePreferences[fPreferencesLookupOrder.length - 1];
- for (int i = 1; i < defaultPreferences.length; i++) {
- defaultPreferences[i - 1] = fPreferencesLookupOrder[i].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE);
- }
-
- String defaultIgnoredContentTypeIds = StringUtils.pack((String[]) new StringSorter().sort(StringUtils.unpack(fPreferencesService.get(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, "", defaultPreferences)))); //$NON-NLS-1$
- String ignoredContentTypeIds = StringUtils.pack((String[]) new StringSorter().sort(ignoredIds.toArray()));
- if (ignoredContentTypeIds.equals(defaultIgnoredContentTypeIds)) {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED + " from scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).remove(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED);
- }
- else {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " setting " + TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED + " \"" + ignoredContentTypeIds + "\" in scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).put(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, ignoredContentTypeIds);
- }
- return ignoredIds;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/MainTab.java b/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/MainTab.java
deleted file mode 100644
index a04565ebdd..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/MainTab.java
+++ /dev/null
@@ -1,450 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.sse.core.internal.provisional.tasks.TaskTag;
-import org.eclipse.wst.sse.core.internal.tasks.TaskTagPreferenceKeys;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-class MainTab implements IPreferenceTab {
- public class TaskTagDialog extends Dialog {
- public TaskTag taskTag = null;
-
- Combo priorityCombo = null;
- Text tagText = null;
-
- public TaskTagDialog(Shell parentShell) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(SSEUIMessages.TaskTagPreferenceTab_5); //$NON-NLS-1$
- }
-
- protected Control createButtonBar(Composite parent) {
- Control c = super.createButtonBar(parent);
- getButton(IDialogConstants.OK_ID).setEnabled(taskTag == null || taskTag.getTag().length() > 0);
- return c;
- }
-
- protected Control createDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
- GridData gridData = new GridData(GridData.FILL_BOTH);
- gridData.widthHint = parent.getDisplay().getClientArea().width / 5;
- composite.setLayoutData(gridData);
- Label label = new Label(composite, SWT.NONE);
- label.setText(SSEUIMessages.TaskTagPreferenceTab_6); //$NON-NLS-1$
- label.setLayoutData(new GridData());
- tagText = new Text(composite, SWT.NONE);
- tagText.setText(taskTag != null ? taskTag.getTag() : ""); //$NON-NLS-1$
- tagText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- tagText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- String testTag = tagText.getText();
- String[] tags = new String[fTaskTags.length];
- for (int i = 0; i < tags.length; i++) {
- tags[i] = fTaskTags[i].getTag();
- }
- getButton(IDialogConstants.OK_ID).setEnabled(tagText.getText().length() > 0 && !Arrays.asList(tags).contains(testTag));
- taskTag = new TaskTag(tagText.getText(), priorityCombo.getSelectionIndex());
- }
- });
-
- label = new Label(composite, SWT.NONE);
- label.setText(SSEUIMessages.TaskTagPreferenceTab_7); //$NON-NLS-1$
- label.setLayoutData(new GridData());
- priorityCombo = new Combo(composite, SWT.READ_ONLY | SWT.SINGLE);
- priorityCombo.setItems(new String[]{SSEUIMessages.TaskTagPreferenceTab_0, SSEUIMessages.TaskTagPreferenceTab_1, SSEUIMessages.TaskTagPreferenceTab_2});
- priorityCombo.select(taskTag != null ? taskTag.getPriority() : TaskTag.PRIORITY_NORMAL);
- priorityCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- priorityCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- taskTag = new TaskTag(taskTag.getTag(), priorityCombo.getSelectionIndex());
- }
- });
- return composite;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- protected void okPressed() {
- taskTag = new TaskTag(tagText.getText(), priorityCombo.getSelectionIndex());
- super.okPressed();
- }
- }
-
- public class TaskTagTableLabelProvider extends LabelProvider implements ITableLabelProvider {
- public TaskTagTableLabelProvider() {
- super();
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (columnIndex < 1)
- return ((TaskTag) element).getTag();
- for (int i = 0; i < fTaskTags.length; i++) {
- if (fTaskTags[i].equals(element)) {
- if (fTaskTags[i].getPriority() == IMarker.PRIORITY_LOW) {
- return SSEUIMessages.TaskTagPreferenceTab_0; //$NON-NLS-1$
- }
- else if (fTaskTags[i].getPriority() == IMarker.PRIORITY_HIGH) {
- return SSEUIMessages.TaskTagPreferenceTab_2; //$NON-NLS-1$
- }
- else {
- return SSEUIMessages.TaskTagPreferenceTab_1; //$NON-NLS-1$
- }
- }
- }
- return SSEUIMessages.TaskTagPreferenceTab_3; //$NON-NLS-1$
- }
- }
-
- private static final boolean _debugPreferences = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/preferences")); //$NON-NLS-1$ //$NON-NLS-2$
-
- private Control fControl;
-
- private TaskTag[] fOriginalTaskTags;
- private TaskTagPreferencePage fOwner = null;
- private IScopeContext[] fPreferencesLookupOrder = null;
-
- private IPreferencesService fPreferencesService = null;
-
- private TaskTag[] fTaskTags;
-
- private TableViewer valueTable = null;
-
-
- public MainTab(TaskTagPreferencePage parent, IPreferencesService preferencesService, IScopeContext[] lookupOrder) {
- super();
- fOwner = parent;
- fPreferencesLookupOrder = lookupOrder;
- fPreferencesService = preferencesService;
- }
-
-
- private void addTag() {
- TaskTagDialog dlg = new TaskTagDialog(fControl.getShell());
- int result = dlg.open();
- if (result == Window.OK) {
- TaskTag newTag = dlg.taskTag;
- List newTags = new ArrayList(Arrays.asList(fTaskTags));
- newTags.add(newTag);
- fTaskTags = (TaskTag[]) newTags.toArray(new TaskTag[newTags.size()]);
- valueTable.setInput(fTaskTags);
- valueTable.getTable().setSelection(fTaskTags.length - 1);
- }
- }
-
- public Control createContents(Composite tabFolder) {
- loadPreferenceValues();
- fOriginalTaskTags = fTaskTags;
-
- Composite composite = new Composite(tabFolder, SWT.NONE);
- composite.setLayout(new GridLayout(2, false));
- fControl = composite;
-
- Text description = new Text(composite, SWT.READ_ONLY | SWT.SINGLE);
- description.setText(SSEUIMessages.TaskTagPreferenceTab_33); //$NON-NLS-1$
- description.setBackground(composite.getBackground());
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=104403
- Point sizeHint = description.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- gd.widthHint = sizeHint.x;
- description.setLayoutData(gd);
-
- valueTable = new TableViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
- valueTable.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
- TableColumn textColumn = new TableColumn(valueTable.getTable(), SWT.NONE, 0);
- textColumn.setText(SSEUIMessages.TaskTagPreferenceTab_12); //$NON-NLS-1$
- TableColumn priorityColumn = new TableColumn(valueTable.getTable(), SWT.NONE, 1);
- priorityColumn.setText(SSEUIMessages.TaskTagPreferenceTab_13); //$NON-NLS-1$
- valueTable.setContentProvider(new ArrayContentProvider());
- valueTable.setLabelProvider(new TaskTagTableLabelProvider());
- valueTable.getTable().setLinesVisible(true);
- valueTable.getTable().setHeaderVisible(true);
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(1, 140, true));
- layout.addColumnData(new ColumnWeightData(1, 140, true));
- valueTable.getTable().setLayout(layout);
-
- Composite buttons = new Composite(composite, SWT.NONE);
- buttons.setLayout(new GridLayout());
- buttons.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-
- final Button addButton = new Button(buttons, SWT.PUSH);
- addButton.setText(SSEUIMessages.TaskTagPreferenceTab_14); //$NON-NLS-1$
- addButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- final Button editButton = new Button(buttons, SWT.PUSH);
- editButton.setText(SSEUIMessages.TaskTagPreferenceTab_15); //$NON-NLS-1$
- editButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- final Button removeButton = new Button(buttons, SWT.PUSH);
- removeButton.setText(SSEUIMessages.TaskTagPreferenceTab_16); //$NON-NLS-1$
- removeButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- editButton.setEnabled(false);
- removeButton.setEnabled(false);
-
- Label warning = new Label(composite, SWT.NONE);
- warning.setLayoutData(new GridData());
- warning.setText(SSEUIMessages.TaskTagPreferenceTab_19); //$NON-NLS-1$
-
- final ISelectionChangedListener selectionChangedListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- boolean enabledForSelection = !valueTable.getSelection().isEmpty();
- editButton.setEnabled(enabledForSelection);
- removeButton.setEnabled(enabledForSelection);
- }
- };
- valueTable.addPostSelectionChangedListener(selectionChangedListener);
- addButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- addTag();
- valueTable.getTable().setSelection(fTaskTags.length - 1);
- selectionChangedListener.selectionChanged(null);
- }
- });
- editButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int i = valueTable.getTable().getSelectionIndex();
- editTag(i);
- if (i >= 0) {
- valueTable.getTable().setSelection(i);
- selectionChangedListener.selectionChanged(null);
- }
- }
- });
- removeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int i = valueTable.getTable().getSelectionIndex();
- removeTag(valueTable.getTable().getSelectionIndex());
- if (i >= 0 && i < fTaskTags.length) {
- valueTable.getTable().setSelection(i);
- }
- }
- });
- valueTable.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- int i = valueTable.getTable().getSelectionIndex();
- editTag(i);
- if (i >= 0) {
- valueTable.getTable().setSelection(i);
- selectionChangedListener.selectionChanged(null);
- }
- }
- });
-
- valueTable.setInput(fTaskTags);
-
- return composite;
- }
-
- /**
- * @param selection
- */
- private void editTag(int i) {
- if (i < 0) {
- return;
- }
-
- int selection = valueTable.getTable().getSelectionIndex();
- TaskTagDialog dlg = new TaskTagDialog(fControl.getShell());
- dlg.taskTag = fTaskTags[selection];
- int result = dlg.open();
- if (result == Window.OK) {
- fTaskTags[selection] = dlg.taskTag;
- valueTable.refresh();
- }
- }
-
- public String getTitle() {
- return SSEUIMessages.TaskTagPreferenceTab_20;
- }
-
- private void loadPreferenceValues() {
- String tags = fPreferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_TAGS, "", fPreferencesLookupOrder); //$NON-NLS-1$
- String priorities = fPreferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_PRIORITIES, "", fPreferencesLookupOrder); //$NON-NLS-1$
- loadTagsAndPrioritiesFrom(tags, priorities);
- }
-
- /**
- * @param tags
- * @param priorities
- */
- private void loadTagsAndPrioritiesFrom(String tagString, String priorityString) {
- String[] tags = StringUtils.unpack(tagString);
-
- StringTokenizer toker = null;
- List list = new ArrayList();
-
- toker = new StringTokenizer(priorityString, ","); //$NON-NLS-1$
- while (toker.hasMoreTokens()) {
- Integer number = null;
- try {
- number = Integer.valueOf(toker.nextToken());
- }
- catch (NumberFormatException e) {
- number = new Integer(IMarker.PRIORITY_NORMAL);
- }
- list.add(number);
- }
- Integer[] priorities = (Integer[]) list.toArray(new Integer[0]);
-
- fTaskTags = new TaskTag[Math.min(tags.length, priorities.length)];
- for (int i = 0; i < fTaskTags.length; i++) {
- fTaskTags[i] = new TaskTag(tags[i], priorities[i].intValue());
- }
- }
-
- public void performApply() {
- save();
-
- if (!Arrays.equals(fOriginalTaskTags, fTaskTags)) {
- fOwner.requestRedetection();
- }
- fOriginalTaskTags = fTaskTags;
- }
-
- public void performDefaults() {
- if (_debugPreferences) {
- System.out.println("Loading defaults in " + getClass().getName()); //$NON-NLS-1$
- }
- IEclipsePreferences[] preferences = new IEclipsePreferences[fPreferencesLookupOrder.length];
- for (int i = 0; i < preferences.length; i++) {
- preferences[i] = fPreferencesLookupOrder[i].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE);
- }
- String tags = fPreferencesService.get(TaskTagPreferenceKeys.TASK_TAG_TAGS, null, preferences);
- String priorities = fPreferencesService.get(TaskTagPreferenceKeys.TASK_TAG_PRIORITIES, null, preferences);
- loadTagsAndPrioritiesFrom(tags, priorities);
- int selection = valueTable.getTable().getSelectionIndex();
- valueTable.setInput(fTaskTags);
- valueTable.getTable().setSelection(selection);
- }
-
- public void performOk() {
- performApply();
- }
-
- /**
- * @param selection
- */
- private void removeTag(int i) {
- if (i < 0) {
- return;
- }
- List taskTags = new ArrayList(Arrays.asList(fTaskTags));
- taskTags.remove(i);
- fTaskTags = (TaskTag[]) taskTags.toArray(new TaskTag[taskTags.size()]);
- valueTable.setInput(fTaskTags);
- }
-
- private void save() {
- IEclipsePreferences defaultPreferences = new DefaultScope().getNode(TaskTagPreferenceKeys.TASK_TAG_NODE);
- String defaultTags = defaultPreferences.get(TaskTagPreferenceKeys.TASK_TAG_TAGS, null);
- String defaultPriorities = defaultPreferences.get(TaskTagPreferenceKeys.TASK_TAG_PRIORITIES, null);
-
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < fTaskTags.length; i++) {
- if (i > 0) {
- buf.append(","); //$NON-NLS-1$
- }
- buf.append(fTaskTags[i].getTag());
- }
- String currentTags = buf.toString();
- if (currentTags.equals(defaultTags) && !fPreferencesLookupOrder[0].getName().equals(DefaultScope.SCOPE)) {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_TAGS + " from scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).remove(TaskTagPreferenceKeys.TASK_TAG_TAGS);
- }
- else {
- fOwner.requestRedetection();
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " setting " + TaskTagPreferenceKeys.TASK_TAG_TAGS + " \"" + currentTags + "\" in scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).put(TaskTagPreferenceKeys.TASK_TAG_TAGS, currentTags);
- }
-
- StringBuffer buf2 = new StringBuffer();
- for (int i = 0; i < fTaskTags.length; i++) {
- if (i > 0) {
- buf2.append(","); //$NON-NLS-1$
- }
- buf2.append(String.valueOf(fTaskTags[i].getPriority()));
- }
- String priorities = buf2.toString();
-
- if (priorities.equals(defaultPriorities) && !fPreferencesLookupOrder[0].getName().equals(DefaultScope.SCOPE)) {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_PRIORITIES + " from scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).remove(TaskTagPreferenceKeys.TASK_TAG_PRIORITIES);
- }
- else {
- fOwner.requestRedetection();
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " setting " + TaskTagPreferenceKeys.TASK_TAG_PRIORITIES + " \"" + priorities + "\" in scope " + fPreferencesLookupOrder[0].getName() + ":" + fPreferencesLookupOrder[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- fPreferencesLookupOrder[0].getNode(TaskTagPreferenceKeys.TASK_TAG_NODE).put(TaskTagPreferenceKeys.TASK_TAG_PRIORITIES, priorities);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/PropertyPreferencePage.java b/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/PropertyPreferencePage.java
deleted file mode 100644
index d390958239..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/PropertyPreferencePage.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.dialogs.ControlEnableState;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.dialogs.ListDialog;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-import org.eclipse.wst.sse.core.internal.tasks.TaskTagPreferenceKeys;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-
-abstract class PropertyPreferencePage extends PropertyPage implements IWorkbenchPreferencePage {
- private static final boolean _debugPreferences = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/preferences-properties")); //$NON-NLS-1$ //$NON-NLS-2$
- /*
- * Disable link data, prevents the display of a "workspace" or "project"
- * settings link to prevent recursive dialog launching
- */
- private static final Object DISABLE_LINK = "DISABLE_LINK"; //$NON-NLS-1$
-
- private Map fData = null;
-
- private Button fEnableProjectSettings;
-
- private Link fProjectSettingsLink;
-
- public PropertyPreferencePage() {
- super();
- }
-
- public final void applyData(Object data) {
- super.applyData(data);
- if (data instanceof Map) {
- fData = (Map) data;
- updateLinkEnablement();
- }
- }
-
- protected abstract Control createCommonContents(Composite composite);
-
- public final Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- composite.setLayoutData(data);
-
- Composite checkLinkComposite = new Composite(composite, SWT.NONE);
- checkLinkComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- checkLinkComposite.setLayout(new GridLayout(2, false));
-
- if (getProject() != null) {
- fEnableProjectSettings = new Button(checkLinkComposite, SWT.CHECK);
- fEnableProjectSettings.setText(SSEUIMessages.EnableProjectSettings); //$NON-NLS-1$//$NON-NLS-2$
- fEnableProjectSettings.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
- boolean enabledForProject = createPreferenceScopes()[0].getNode(getPreferenceNodeQualifier()).getBoolean(getProjectSettingsKey(), false);
- fEnableProjectSettings.setSelection(enabledForProject);
- }
- else {
- Label spacer = new Label(checkLinkComposite, SWT.CHECK);
- spacer.setLayoutData(new GridData());
- }
-
- fProjectSettingsLink = new Link(checkLinkComposite, SWT.NONE);
- fProjectSettingsLink.setLayoutData(new GridData(SWT.END, SWT.BEGINNING, true, false));
-
- /*
- * "element" should be a project, if null, link to per-project
- * properties
- */
- if (getProject() != null) {
- fProjectSettingsLink.setText("<a>" + SSEUIMessages.ConfigureWorkspaceSettings + "</a>"); //$NON-NLS-1$//$NON-NLS-2$
- }
- else {
- fProjectSettingsLink.setText("<a>" + SSEUIMessages.ConfigureProjectSettings + "</a>"); //$NON-NLS-1$//$NON-NLS-2$
- }
-
- updateLinkEnablement();
-
- fProjectSettingsLink.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (getProject() == null) {
- openProjectSettings();
- }
- else {
- openWorkspaceSettings();
- }
- }
-
- });
-
- if (getProject() != null) {
- Label line = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- line.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- }
-
- final Control common = createCommonContents(composite);
- common.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- if (fEnableProjectSettings != null) {
- SelectionAdapter selectionAdapter = new SelectionAdapter() {
- ControlEnableState enablements = null;
-
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- if (fEnableProjectSettings.getSelection()) {
- if (enablements != null) {
- enablements.restore();
- enablements = null;
- }
- }
- else {
- enablements = ControlEnableState.disable(common);
- }
- }
- };
- selectionAdapter.widgetSelected(null);
- fEnableProjectSettings.addSelectionListener(selectionAdapter);
- }
-
- applyDialogFont(composite);
- return composite;
- }
-
- public void createControl(Composite parent) {
- if (getProject() != null) {
- noDefaultAndApplyButton();
- }
- super.createControl(parent);
- }
-
- protected IScopeContext[] createPreferenceScopes() {
- IProject project = getProject();
- if (project != null) {
- return new IScopeContext[]{new ProjectScope(project), new InstanceScope(), new DefaultScope()};
- }
- return new IScopeContext[]{new InstanceScope(), new DefaultScope()};
- }
-
- protected abstract String getPreferenceNodeQualifier();
-
- protected abstract String getPreferencePageID();
-
- protected IProject getProject() {
- if (getElement() != null && getElement() instanceof IProject) {
- return (IProject) getElement();
- }
- return null;
- }
-
- protected abstract String getProjectSettingsKey();
-
- protected abstract String getPropertyPageID();
-
- protected boolean isElementSettingsEnabled() {
- return fEnableProjectSettings != null && fEnableProjectSettings.getSelection();
- }
-
- void openProjectSettings() {
- ListDialog dialog = new ListDialog(getShell()) {
-
- protected Control createDialogArea(Composite container) {
- Control area = super.createDialogArea(container);
- getTableViewer().setSorter(new ResourceSorter(ResourceSorter.NAME));
- return area;
- }
- };
- dialog.setMessage(SSEUIMessages.PropertyPreferencePage_02);
- dialog.setContentProvider(new IStructuredContentProvider() {
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- return ((IWorkspace) inputElement).getRoot().getProjects();
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- });
- dialog.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(), SSEUIPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
- dialog.setInput(ResourcesPlugin.getWorkspace());
- dialog.setTitle(SSEUIMessages.PropertyPreferencePage_01);
- if (dialog.open() == Window.OK) {
- Object[] result = dialog.getResult();
- if (result.length > 0) {
- IProject project = (IProject) dialog.getResult()[0];
- Map data = new HashMap();
- data.put(DISABLE_LINK, Boolean.TRUE);
- PreferencesUtil.createPropertyDialogOn(getShell(), project, getPropertyPageID(), new String[]{getPropertyPageID()}, data).open();
- }
- }
- }
-
- void openWorkspaceSettings() {
- Map data = new HashMap();
- data.put(DISABLE_LINK, Boolean.TRUE);
- PreferencesUtil.createPreferenceDialogOn(getShell(), getPreferencePageID(), new String[]{getPreferencePageID()}, data).open();
- }
-
- public boolean performOk() {
- boolean ok = super.performOk();
- IScopeContext[] preferenceScopes = createPreferenceScopes();
- if (getProject() != null) {
- if (isElementSettingsEnabled()) {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " setting " + TaskTagPreferenceKeys.TASK_TAG_PER_PROJECT + " (" + true + ") in scope " + preferenceScopes[0].getName() + ":" + preferenceScopes[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- preferenceScopes[0].getNode(getPreferenceNodeQualifier()).putBoolean(getProjectSettingsKey(), fEnableProjectSettings.getSelection());
- }
- else {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_PER_PROJECT + " from scope " + preferenceScopes[0].getName() + ":" + preferenceScopes[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- preferenceScopes[0].getNode(getPreferenceNodeQualifier()).remove(getProjectSettingsKey());
- }
- }
- return ok;
- }
-
- private void updateLinkEnablement() {
- if (fData != null && fProjectSettingsLink != null) {
- fProjectSettingsLink.setEnabled(!Boolean.TRUE.equals(fData.get(DISABLE_LINK)));
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/TaskTagPreferencePage.java b/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/TaskTagPreferencePage.java
deleted file mode 100644
index 3f05cc2254..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src-tasktags/org/eclipse/wst/sse/ui/internal/preferences/ui/TaskTagPreferencePage.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IPreferencesService;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.jface.dialogs.ControlEnableState;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.sse.core.internal.tasks.TaskScanningScheduler;
-import org.eclipse.wst.sse.core.internal.tasks.TaskTagPreferenceKeys;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout;
-import org.osgi.service.prefs.BackingStoreException;
-
-public class TaskTagPreferencePage extends PropertyPreferencePage {
-
- private static final boolean _debugPreferences = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.core/tasks/preferences")); //$NON-NLS-1$ //$NON-NLS-2$
- // Remember the last displayed tab for convenience
- private static final String TASK_TAG_LAST_TAB = "task-tag-last-tab"; //$NON-NLS-1$
-
- private int detectionRequested = 0;
-
- private Button fEnableCheckbox = null;
-
- private boolean fEnableTaskTags = true;
-
- private boolean fOriginalEnableTaskTags = true;
-
- private IPreferencesService fPreferencesService = null;
-
- private Button fRedetectButton;
-
- private SelectionListener fTabEnablementListener;
-
- private TabFolder fTabFolder;
- private IPreferenceTab[] fTabs = null;
-
- public TaskTagPreferencePage() {
- super();
- fPreferencesService = Platform.getPreferencesService();
- }
-
- protected void contributeButtons(Composite parent) {
- if (getElement() == null) {
- ((GridLayout) parent.getLayout()).numColumns += 2;
- fRedetectButton = new Button(parent, SWT.PUSH);
- fRedetectButton.setText(SSEUIMessages.TaskTagPreferencePage_32); //$NON-NLS-1$
- fRedetectButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL));
- fRedetectButton.setEnabled(true);
- fRedetectButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Job redetectJob = new Job(SSEUIMessages.TaskTagPreferenceTab_27) { //$NON-NLS-1$
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- TaskScanningScheduler.refresh();
- return Status.OK_STATUS;
- }
- };
- redetectJob.schedule();
- }
- });
- Label spacer = new Label(parent, SWT.NONE);
- spacer.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER));
- }
- super.contributeButtons(parent);
- }
-
- protected Control createCommonContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout compositeLayout = new GridLayout();
- compositeLayout.marginLeft = 0;
- compositeLayout.marginRight = 0;
- composite.setLayout(compositeLayout);
-
- IScopeContext[] preferenceScopes = createPreferenceScopes();
- fOriginalEnableTaskTags = fEnableTaskTags = fPreferencesService.getBoolean(getPreferenceNodeQualifier(), TaskTagPreferenceKeys.TASK_TAG_ENABLE, false, preferenceScopes);
- fEnableCheckbox = new Button(composite, SWT.CHECK);
- fEnableCheckbox.setSelection(fEnableTaskTags);
- fEnableCheckbox.setText(SSEUIMessages.TaskTagPreferenceTab_31); //$NON-NLS-1$
- fEnableCheckbox.setSelection(fEnableTaskTags);
- fEnableCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_END, false, false, 1, 1));
-
- fTabFolder = new TabFolder(composite, SWT.NONE);
- fTabFolder.setLayout(new TabFolderLayout());
- fTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
-
- TabItem taskItem = new TabItem(fTabFolder, SWT.NONE);
- MainTab mainTab = new MainTab(this, fPreferencesService, preferenceScopes);
- taskItem.setText(mainTab.getTitle());
- final Control taskTagsControl = mainTab.createContents(fTabFolder);
- taskItem.setControl(taskTagsControl);
-
- TabItem exclusionItem = new TabItem(fTabFolder, SWT.NONE);
- ExclusionsTab exclusionsTab = new ExclusionsTab(this, fPreferencesService, preferenceScopes);
- exclusionItem.setText(exclusionsTab.getTitle());
- final Control exclusionControl = exclusionsTab.createContents(fTabFolder);
- exclusionItem.setControl(exclusionControl);
-
- fTabs = new IPreferenceTab[]{mainTab, exclusionsTab};
-
- fTabEnablementListener = new SelectionAdapter() {
- ControlEnableState[] lastEnableStates = null;
-
- public void widgetSelected(SelectionEvent e) {
- fEnableTaskTags = fEnableCheckbox.getSelection();
- if (fEnableTaskTags) {
- if (lastEnableStates != null) {
- for (int i = 0; i < lastEnableStates.length; i++) {
- if (lastEnableStates[i] != null) {
- lastEnableStates[i].restore();
- }
- }
- lastEnableStates = null;
- fTabFolder.redraw();
- }
- }
- else if (lastEnableStates == null) {
- lastEnableStates = new ControlEnableState[fTabs.length + 1];
- lastEnableStates[0] = ControlEnableState.disable(taskTagsControl);
- lastEnableStates[1] = ControlEnableState.disable(exclusionControl);
- if (fRedetectButton != null) {
- lastEnableStates[2] = ControlEnableState.disable(fRedetectButton);
- }
- }
- }
- };
- fTabEnablementListener.widgetSelected(null);
- fEnableCheckbox.addSelectionListener(fTabEnablementListener);
-
- // restore last selected tab
- int activeTab = new DefaultScope().getNode(getPreferenceNodeQualifier()).getInt(TASK_TAG_LAST_TAB, 0);
- if (activeTab > 0) {
- fTabFolder.setSelection(activeTab);
- }
-
- SSEUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.PREFWEBX_TASKTAGS_HELPID);
- return composite;
- }
-
- protected String getPreferenceNodeQualifier() {
- return TaskTagPreferenceKeys.TASK_TAG_NODE;
- }
-
- protected String getPreferencePageID() {
- return "org.eclipse.wst.sse.ui.preferences.tasktags";//$NON-NLS-1$
-
- }
-
- protected String getProjectSettingsKey() {
- return TaskTagPreferenceKeys.TASK_TAG_PER_PROJECT;
- }
-
- protected String getPropertyPageID() {
- return "org.eclipse.wst.sse.ui.project.properties.tasktags";//$NON-NLS-1$
- }
-
- public String getTitle() {
- return SSEUIMessages.TaskTagPreferenceTab_20; //$NON-NLS-1$
- }
-
- public void init(IWorkbench workbench) {
- }
-
- public void performApply() {
- super.performApply();
- save();
-
- for (int i = 0; i < fTabs.length; i++) {
- fTabs[i].performApply();
- }
-
- promptForRedetectIfNecessary();
- }
-
- public void performDefaults() {
- super.performDefaults();
- IEclipsePreferences defaultPreferences = createPreferenceScopes()[1].getNode(getPreferenceNodeQualifier());
- fEnableTaskTags = defaultPreferences.getBoolean(TaskTagPreferenceKeys.TASK_TAG_ENABLE, false);
- fEnableCheckbox.setSelection(fEnableTaskTags);
- for (int i = 0; i < fTabs.length; i++) {
- fTabs[i].performDefaults();
- }
- fTabEnablementListener.widgetSelected(null);
- if (_debugPreferences) {
- System.out.println("Loading defaults in " + getClass().getName()); //$NON-NLS-1$
- }
- }
-
- public boolean performOk() {
- boolean ok = super.performOk();
- save();
-
- for (int i = 0; i < fTabs.length; i++) {
- fTabs[i].performOk();
- }
-
- promptForRedetectIfNecessary();
-
- // save last tab (use Default scope since it won't be persisted)
- new DefaultScope().getNode(getPreferenceNodeQualifier()).putInt(TASK_TAG_LAST_TAB, fTabFolder.getSelectionIndex());
-
- IScopeContext[] contexts = createPreferenceScopes();
- // remove project-specific information if it's not enabled
- if (getProject() != null && !isElementSettingsEnabled()) {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_PER_PROJECT + " (" + true + ") in scope " + contexts[0].getName() + ":" + contexts[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- contexts[0].getNode(getPreferenceNodeQualifier()).remove(TaskTagPreferenceKeys.TASK_TAG_PER_PROJECT);
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED + " (" + true + ") in scope " + contexts[0].getName() + ":" + contexts[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- contexts[0].getNode(getPreferenceNodeQualifier()).remove(TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED);
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_PRIORITIES + " (" + true + ") in scope " + contexts[0].getName() + ":" + contexts[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- contexts[0].getNode(getPreferenceNodeQualifier()).remove(TaskTagPreferenceKeys.TASK_TAG_PRIORITIES);
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_TAGS + " (" + true + ") in scope " + contexts[0].getName() + ":" + contexts[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- contexts[0].getNode(getPreferenceNodeQualifier()).remove(TaskTagPreferenceKeys.TASK_TAG_TAGS);
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_ENABLE + " (" + true + ") in scope " + contexts[0].getName() + ":" + contexts[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- contexts[0].getNode(getPreferenceNodeQualifier()).remove(TaskTagPreferenceKeys.TASK_TAG_ENABLE);
- }
- for (int i = 0; i < contexts.length; i++) {
- try {
- contexts[i].getNode(getPreferenceNodeQualifier()).flush();
- }
- catch (BackingStoreException e) {
- Logger.logException("problem saving preference settings to scope " + contexts[i].getName(), e); //$NON-NLS-1$
- }
- }
-
- return ok;
- }
-
-
- private void promptForRedetectIfNecessary() {
- if (detectionRequested > 0) {
- MessageDialog dialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SSEUIMessages.TaskTagPreferenceTab_22, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getImage(), SSEUIMessages.TaskTagPreferenceTab_23, MessageDialog.QUESTION, new String[]{SSEUIMessages.TaskTagPreferenceTab_24, SSEUIMessages.TaskTagPreferenceTab_25, SSEUIMessages.TaskTagPreferenceTab_26}, 2); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- int button = dialog.open();
- if (button == 0) {
- Job redetectJob = new Job(SSEUIMessages.TaskTagPreferenceTab_27) { //$NON-NLS-1$
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- if (getProject() == null) {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + ": rescanning all"); //$NON-NLS-1$
- }
- TaskScanningScheduler.refresh();
- }
- else {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + ": rescanning " + getProject()); //$NON-NLS-1$
- }
- TaskScanningScheduler.refresh(getProject());
- }
- return Status.OK_STATUS;
- }
- };
- redetectJob.schedule(500);
- }
- detectionRequested = 0;
- }
- }
-
- void requestRedetection() {
- detectionRequested++;
- }
-
- private void save() {
- if (fEnableTaskTags != fOriginalEnableTaskTags) {
- requestRedetection();
- }
- fOriginalEnableTaskTags = fEnableTaskTags;
-
- IScopeContext[] preferenceScopes = createPreferenceScopes();
- IEclipsePreferences defaultPreferences = preferenceScopes[1].getNode(getPreferenceNodeQualifier());
- boolean defaultEnable = defaultPreferences.getBoolean(TaskTagPreferenceKeys.TASK_TAG_ENABLE, false);
- if (fEnableTaskTags == defaultEnable) {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_ENABLE + " from scope " + preferenceScopes[0].getName() + ":" + preferenceScopes[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- preferenceScopes[0].getNode(getPreferenceNodeQualifier()).remove(TaskTagPreferenceKeys.TASK_TAG_ENABLE);
- }
- else {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " setting " + TaskTagPreferenceKeys.TASK_TAG_ENABLE + " \"" + fEnableTaskTags + "\" in scope " + preferenceScopes[0].getName() + ":" + preferenceScopes[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- preferenceScopes[0].getNode(getPreferenceNodeQualifier()).putBoolean(TaskTagPreferenceKeys.TASK_TAG_ENABLE, fEnableTaskTags);
- }
- if (getProject() != null && isElementSettingsEnabled()) {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " setting " + TaskTagPreferenceKeys.TASK_TAG_PER_PROJECT + " (" + true + ") in scope " + preferenceScopes[0].getName() + ":" + preferenceScopes[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- preferenceScopes[0].getNode(getPreferenceNodeQualifier()).putBoolean(TaskTagPreferenceKeys.TASK_TAG_PER_PROJECT, true);
- }
- else {
- if (_debugPreferences) {
- System.out.println(getClass().getName() + " removing " + TaskTagPreferenceKeys.TASK_TAG_PER_PROJECT + " from scope " + preferenceScopes[0].getName() + ":" + preferenceScopes[0].getLocation()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- preferenceScopes[0].getNode(getPreferenceNodeQualifier()).remove(TaskTagPreferenceKeys.TASK_TAG_PER_PROJECT);
- }
- try {
- fPreferencesService.getRootNode().flush();
- }
- catch (BackingStoreException e) {
- // log it, there is no recovery
- Logger.logException(e);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/EditorExecutionContext.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/EditorExecutionContext.java
deleted file mode 100644
index 388a27d741..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/EditorExecutionContext.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui;
-
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.sse.core.internal.IExecutionDelegate;
-
-
-
-class EditorExecutionContext implements IExecutionDelegate {
-
-
- StructuredTextEditor fEditor;
-
- public EditorExecutionContext(StructuredTextEditor editor) {
- super();
- fEditor = editor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.core.internal.document.IExecutionDelegate#execute(java.lang.Runnable)
- */
- public void execute(final Runnable runnable) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- final Display display = workbench.getDisplay();
- if (display.getThread() == Thread.currentThread()) {
- // if already in display thread, we can simply run, "as usual"
- runnable.run();
- } else {
- // this is the part that's really new, that
- // accomidate's a change in a document
- // from background thread, by forcing it on
- // the display thread.
- final StructuredTextEditor editor = fEditor;
- // if not in display thread, we "force" to run on display thread.
- // see editors begin/end background job for other
- // activities to best accomidate (for example, there
- // is a "timed delay" before the editor itself leaves
- // background-update mode).
- // NOTE: this execute method itself is always called from
- // inside of an ILock block, so another
- // block is not not needed here for all these sycnExec's
- display.syncExec(new Runnable() {
- public void run() {
- if (display != null && !display.isDisposed()) {
- editor.beginBackgroundOperation();
- try {
- // here's where the document update/modification
- // occurs
- runnable.run();
-
- // for future, possibly explore solutions such as
- // this
- // IWorkbenchSiteProgressService jobService =
- // (IWorkbenchSiteProgressService)
- // editor.getEditorPart().getSite().getAdapter(IWorkbenchSiteProgressService.class);
- // jobService.runInUI(xxxxx)
- } finally {
- // this 'end' is just a signal to editor that this
- // particular update is done. Its up to the editor
- // to decide exactly when to leave its "background
- // mode"
- editor.endBackgroundOperation();
- }
- }
- }
- });
- }
- }
-}
-
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/FoldingActionGroup.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/FoldingActionGroup.java
deleted file mode 100644
index c442ac7741..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/FoldingActionGroup.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- *******************************************************************************/
-package org.eclipse.wst.sse.ui;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.source.projection.IProjectionListener;
-import org.eclipse.jface.text.source.projection.ProjectionViewer;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.editors.text.IFoldingCommandIds;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.ui.texteditor.ResourceAction;
-import org.eclipse.ui.texteditor.TextOperationAction;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.projection.IStructuredTextFoldingProvider;
-
-class FoldingActionGroup extends ActionGroup {
- private static abstract class PreferenceAction extends ResourceAction implements IUpdate {
- PreferenceAction(ResourceBundle bundle, String prefix, int style) {
- super(bundle, prefix, style);
- }
- }
-
- private ProjectionViewer fViewer;
-
- private final PreferenceAction fToggle;
- private final TextOperationAction fExpandAll;
- private final IProjectionListener fProjectionListener;
- private final TextOperationAction fCollapseAll;
-
-
- /**
- * Creates a new projection action group for <code>editor</code>. If
- * the supplied viewer is not an instance of <code>ProjectionViewer</code>,
- * the action group is disabled.
- *
- * @param editor
- * the text editor to operate on
- * @param viewer
- * the viewer of the editor
- */
- public FoldingActionGroup(final ITextEditor editor, ITextViewer viewer) {
- if (!(viewer instanceof ProjectionViewer)) {
- fToggle = null;
- fExpandAll = null;
- fCollapseAll = null;
- fProjectionListener = null;
- return;
- }
-
- fViewer = (ProjectionViewer) viewer;
-
- fProjectionListener = new IProjectionListener() {
-
- public void projectionEnabled() {
- update();
- }
-
- public void projectionDisabled() {
- update();
- }
- };
-
- fViewer.addProjectionListener(fProjectionListener);
-
- fToggle = new PreferenceAction(SSEUIMessages.getResourceBundle(), "Projection_Toggle_", IAction.AS_CHECK_BOX) { //$NON-NLS-1$
- public void run() {
- IPreferenceStore store = SSEUIPlugin.getDefault().getPreferenceStore();
- boolean current = store.getBoolean(IStructuredTextFoldingProvider.FOLDING_ENABLED);
- store.setValue(IStructuredTextFoldingProvider.FOLDING_ENABLED, !current);
- }
-
- public void update() {
- ITextOperationTarget target = (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
-
- boolean isEnabled = (target != null && target.canDoOperation(ProjectionViewer.TOGGLE));
- setEnabled(isEnabled);
- }
- };
- fToggle.setChecked(true);
- fToggle.setActionDefinitionId(IFoldingCommandIds.FOLDING_TOGGLE);
- editor.setAction("FoldingToggle", fToggle); //$NON-NLS-1$
-
- fExpandAll = new TextOperationAction(SSEUIMessages.getResourceBundle(), "Projection_ExpandAll_", editor, ProjectionViewer.EXPAND_ALL, true); //$NON-NLS-1$
- fExpandAll.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL);
- editor.setAction("FoldingExpandAll", fExpandAll); //$NON-NLS-1$
-
- fCollapseAll = new TextOperationAction(SSEUIMessages.getResourceBundle(), "Projection_CollapseAll_", editor, ProjectionViewer.COLLAPSE_ALL, true); //$NON-NLS-1$
- fCollapseAll.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE_ALL);
- editor.setAction("FoldingCollapseAll", fCollapseAll); //$NON-NLS-1$
- }
-
- /**
- * Returns <code>true</code> if the group is enabled.
- *
- * <pre>
- * Invariant: isEnabled() &lt;=&gt; fViewer and all actions are != null.
- * </pre>
- *
- * @return <code>true</code> if the group is enabled
- */
- protected boolean isEnabled() {
- return fViewer != null;
- }
-
- /*
- * @see org.eclipse.ui.actions.ActionGroup#dispose()
- */
- public void dispose() {
- if (isEnabled()) {
- fViewer.removeProjectionListener(fProjectionListener);
- fViewer = null;
- }
- super.dispose();
- }
-
- /**
- * Updates the actions.
- */
- protected void update() {
- if (isEnabled()) {
- fToggle.update();
- fToggle.setChecked(fViewer.isProjectionMode());
- fExpandAll.update();
- fCollapseAll.update();
- }
- }
-
- /**
- * Fills the menu with all folding actions.
- *
- * @param manager
- * the menu manager for the folding submenu
- */
- public void fillMenu(IMenuManager manager) {
- if (isEnabled()) {
- update();
- manager.add(fToggle);
- manager.add(fExpandAll);
- manager.add(fCollapseAll);
- }
- }
-
- /*
- * @see org.eclipse.ui.actions.ActionGroup#updateActionBars()
- */
- public void updateActionBars() {
- update();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/InformationProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/InformationProvider.java
deleted file mode 100644
index 8f84759ce5..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/InformationProvider.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui;
-
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.information.IInformationProvider;
-import org.eclipse.jface.text.information.IInformationProviderExtension;
-import org.eclipse.jface.text.information.IInformationProviderExtension2;
-
-/**
- * Information provider used to present the information.
- *
- * @see org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#InformationDispatchAction
- * @see org.eclipse.wst.sse.ui.StructuredTextEditor#InformationDispatchAction
- */
-class InformationProvider implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2 {
-
- private IRegion fHoverRegion;
- private String fHoverInfo;
- private IInformationControlCreator fControlCreator;
-
- InformationProvider(IRegion hoverRegion, String hoverInfo, IInformationControlCreator controlCreator) {
- fHoverRegion = hoverRegion;
- fHoverInfo = hoverInfo;
- fControlCreator = controlCreator;
- }
-
- /*
- * @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer,
- * int)
- */
- public IRegion getSubject(ITextViewer textViewer, int invocationOffset) {
- return fHoverRegion;
- }
-
- /*
- * @see org.eclipse.jface.text.information.IInformationProvider#getInformation(org.eclipse.jface.text.ITextViewer,
- * org.eclipse.jface.text.IRegion)
- */
- public String getInformation(ITextViewer textViewer, IRegion subject) {
- return (String) getInformation2(textViewer, subject);
- }
-
- public Object getInformation2(ITextViewer textViewer, IRegion subject) {
- return fHoverInfo;
- }
-
- /*
- * @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator()
- * @since 3.0
- */
- public IInformationControlCreator getInformationPresenterControlCreator() {
- return fControlCreator;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
deleted file mode 100644
index efe4d957b6..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
+++ /dev/null
@@ -1,3436 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui;
-
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Method;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ResourceBundle;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ISelectionValidator;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension;
-import org.eclipse.jface.text.ITextViewerExtension2;
-import org.eclipse.jface.text.ITextViewerExtension4;
-import org.eclipse.jface.text.ITextViewerExtension5;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.information.IInformationProvider;
-import org.eclipse.jface.text.information.IInformationProviderExtension2;
-import org.eclipse.jface.text.information.InformationPresenter;
-import org.eclipse.jface.text.source.ICharacterPairMatcher;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.LineChangeHover;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.jface.text.source.projection.ProjectionSupport;
-import org.eclipse.jface.text.source.projection.ProjectionViewer;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IPostSelectionProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTarget;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.MouseTrackAdapter;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPathEditorInput;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.editors.text.ITextEditorHelpContextIds;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.texteditor.ChainedPreferenceStore;
-import org.eclipse.ui.texteditor.DefaultRangeIndicator;
-import org.eclipse.ui.texteditor.IAbstractTextEditorHelpContextIds;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.IStatusField;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
-import org.eclipse.ui.texteditor.TextEditorAction;
-import org.eclipse.ui.texteditor.TextOperationAction;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.document.IDocumentCharsetDetector;
-import org.eclipse.wst.sse.core.internal.encoding.EncodingMemento;
-import org.eclipse.wst.sse.core.internal.provisional.IModelStateListener;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitioning;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.text.IExecutionDelegatable;
-import org.eclipse.wst.sse.core.internal.undo.IStructuredTextUndoManager;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
-import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder;
-import org.eclipse.wst.sse.ui.internal.ExtendedEditorDropTargetAdapter;
-import org.eclipse.wst.sse.ui.internal.IExtendedContributor;
-import org.eclipse.wst.sse.ui.internal.IModelProvider;
-import org.eclipse.wst.sse.ui.internal.IPopupMenuContributor;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.ReadOnlyAwareDropTargetAdapter;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.StorageModelProvider;
-import org.eclipse.wst.sse.ui.internal.StructuredLineChangeHover;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.eclipse.wst.sse.ui.internal.UnknownContentTypeDialog;
-import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
-import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
-import org.eclipse.wst.sse.ui.internal.contentoutline.ConfigurableContentOutlinePage;
-import org.eclipse.wst.sse.ui.internal.correction.CorrectionAssistantProvider;
-import org.eclipse.wst.sse.ui.internal.debug.BreakpointRulerAction;
-import org.eclipse.wst.sse.ui.internal.debug.EditBreakpointAction;
-import org.eclipse.wst.sse.ui.internal.debug.ManageBreakpointAction;
-import org.eclipse.wst.sse.ui.internal.debug.ToggleBreakpointAction;
-import org.eclipse.wst.sse.ui.internal.debug.ToggleBreakpointsTarget;
-import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
-import org.eclipse.wst.sse.ui.internal.editor.EditorModelUtil;
-import org.eclipse.wst.sse.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.sse.ui.internal.editor.StructuredModelDocumentProvider;
-import org.eclipse.wst.sse.ui.internal.extension.BreakpointProviderBuilder;
-import org.eclipse.wst.sse.ui.internal.hyperlink.OpenHyperlinkAction;
-import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
-import org.eclipse.wst.sse.ui.internal.projection.IStructuredTextFoldingProvider;
-import org.eclipse.wst.sse.ui.internal.properties.ConfigurablePropertySheetPage;
-import org.eclipse.wst.sse.ui.internal.properties.ShowPropertiesAction;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ConfigurationPointCalculator;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.NullSourceEditingTextTools;
-import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
-import org.eclipse.wst.sse.ui.internal.text.DocumentRegionEdgeMatcher;
-import org.eclipse.wst.sse.ui.internal.util.Assert;
-import org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration;
-import org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration;
-
-/**
- * A Text Editor for editing structured models and structured documents.
- * <p>
- * This class is not meant to be subclassed.<br />
- * New content types may associate source viewer, content outline, and
- * property sheet configurations to extend the existing functionality.
- * </p>
- *
- * @see org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration
- * @see org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration
- *
- * @since 1.0
- */
-
-public class StructuredTextEditor extends TextEditor {
-
-
- // ISSUE: This use case is not clear to me.
- // Is this listner and dance with dirty state for non-editor driven
- // updates?
- class InternalDocumentListener implements IDocumentListener {
- // This is for the IDocumentListener interface
- public void documentAboutToBeChanged(DocumentEvent event) {
- fDirtyBeforeDocumentEvent = isDirty();
- }
-
- // This is for the IDocumentListener interface
- public void documentChanged(DocumentEvent event) {
- if (isEditorInputReadOnly()) {
- // stop listening to document event
- // caused by the undo after validateEdit
- final int offset = event.getOffset() + event.getLength();
- final IStructuredModel internalModel = getInternalModel();
- fCurrentRunnable = new Runnable() {
- public void run() {
- if (!fEditorDisposed) {
- boolean status = validateEditorInputState();
- if (!status) {
- if (internalModel != null) {
- internalModel.getUndoManager().undo();
- getSourceViewer().setSelectedRange(offset, 0);
- if (!fDirtyBeforeDocumentEvent) {
- // reset dirty state if
- // model not dirty before
- // document event
- internalModel.setDirtyState(false);
- }
- }
- }
- }
- fCurrentRunnable = null;
- }
- };
- /*
- * We need to ensure that this is run via 'asyncExec' since
- * these notifications can come from a non-ui thread.
- *
- * The non-ui thread call would occur when creating a new file
- * under ClearCase (or other library) control. The creation of
- * the new file would trigger a validateEdit call, on another
- * thread, that would prompt the user to add the new file to
- * version control.
- */
- Display display = getDisplay();
- if (display != null) {
- if (Thread.currentThread() != display.getThread())
- // future_TODO: there's probably a better
- // way than relying on asycnExec
- display.asyncExec(fCurrentRunnable);
- else
- fCurrentRunnable.run();
- }
- }
- }
- }
-
- private class InternalModelStateListener implements IModelStateListener {
- public void modelAboutToBeChanged(IStructuredModel model) {
- if (getTextViewer() != null) {
- // getTextViewer().setRedraw(false);
- }
- }
-
- public void modelAboutToBeReinitialized(IStructuredModel structuredModel) {
- if (getTextViewer() != null) {
- // getTextViewer().setRedraw(false);
- getTextViewer().unconfigure();
- }
- }
-
- public void modelChanged(IStructuredModel model) {
- if (getTextViewer() != null) {
- // getTextViewer().setRedraw(true);
- // Since the model can be changed on a background
- // thread, we will update menus on display thread,
- // if we are not already on display thread,
- // and if there is not an update already pending.
- // (we can get lots of 'modelChanged' events in rapid
- // succession, so only need to do one.
- if (!fUpdateMenuTextPending) {
- runOnDisplayThreadIfNeededed(new Runnable() {
- public void run() {
- updateMenuText();
- fUpdateMenuTextPending = false;
- }
- });
- }
-
- }
- }
-
- public void modelDirtyStateChanged(IStructuredModel model, boolean isDirty) {
- // do nothing
- }
-
- public void modelReinitialized(IStructuredModel structuredModel) {
- try {
- if (getSourceViewer() != null) {
- SourceViewerConfiguration cfg = getSourceViewerConfiguration();
- getSourceViewer().configure(cfg);
- }
- }
- catch (Exception e) {
- // https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=1166
- // investigate each error case post beta
- Logger.logException("problem trying to configure after model change", e); //$NON-NLS-1$
- }
- finally {
- // so we don't freeze workbench (eg. during page language or
- // content type change)
- ((ITextViewerExtension) getSourceViewer()).setRedraw(true);
- }
- }
-
- // Note: this one should probably be used to
- // control viewer
- // instead of viewer having its own listener
- public void modelResourceDeleted(IStructuredModel model) {
- // do nothing
- }
-
- public void modelResourceMoved(IStructuredModel originalmodel, IStructuredModel movedmodel) {
- // do nothing
- }
-
- /**
- * This 'Runnable' should be very brief, and should not "call out" to
- * other code especially if it depends on the state of the model.
- *
- * @param r
- */
- private void runOnDisplayThreadIfNeededed(Runnable r) {
- // if there is no Display at all (that is, running headless),
- // or if we are already running on the display thread, then
- // simply execute the runnable.
- if (getDisplay() == null || (Thread.currentThread() == getDisplay().getThread())) {
- r.run();
- }
- else {
- // otherwise force the runnable to run on the display thread.
- getDisplay().asyncExec(r);
- }
- }
- }
-
- class MouseTracker extends MouseTrackAdapter implements MouseMoveListener {
- /** The tracker's subject control. */
- private Control fSubjectControl;
-
- /**
- * Creates a new mouse tracker.
- */
- public MouseTracker() {
- // do nothing
- }
-
- public void mouseHover(MouseEvent event) {
- // System.out.println("hover: "+event.x + "x" + event.y);
- hoverX = event.x;
- hoverY = event.y;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseMove(MouseEvent e) {
- hoverX = e.x;
- hoverY = e.y;
- }
-
- /**
- * Starts this mouse tracker. The given control becomes this tracker's
- * subject control. Installs itself as mouse track listener on the
- * subject control.
- *
- * @param subjectControl
- * the subject control
- */
- public void start(Control subjectControl) {
- fSubjectControl = subjectControl;
- if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
- fSubjectControl.addMouseMoveListener(this);
- fSubjectControl.addMouseTrackListener(this);
- fSubjectControl.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- stop();
- }
- });
- }
- }
-
- /**
- * Stops this mouse tracker. Removes itself as mouse track, mouse
- * move, and shell listener from the subject control.
- */
- public void stop() {
- if (fSubjectControl != null && !fSubjectControl.isDisposed()) {
- fSubjectControl.removeMouseMoveListener(this);
- fSubjectControl.removeMouseTrackListener(this);
- fSubjectControl = null;
- }
- }
- }
-
- /**
- * Listens to double-click and selection from the outline page
- */
- private class OutlinePageListener implements IDoubleClickListener, ISelectionChangedListener {
- public void doubleClick(DoubleClickEvent event) {
- if (event.getSelection().isEmpty())
- return;
-
- int start = -1;
- int length = 0;
- if (event.getSelection() instanceof IStructuredSelection) {
- ISelection currentSelection = getSelectionProvider().getSelection();
- if (currentSelection instanceof IStructuredSelection) {
- Object current = ((IStructuredSelection) currentSelection).toArray();
- Object newSelection = ((IStructuredSelection) event.getSelection()).toArray();
- if (!current.equals(newSelection)) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object o = selection.getFirstElement();
- if (o instanceof IndexedRegion) {
- start = ((IndexedRegion) o).getStartOffset();
- length = ((IndexedRegion) o).getEndOffset() - start;
- }
- else if (o instanceof ITextRegion) {
- start = ((ITextRegion) o).getStart();
- length = ((ITextRegion) o).getEnd() - start;
- }
- else if (o instanceof IRegion) {
- start = ((ITextRegion) o).getStart();
- length = ((ITextRegion) o).getLength();
- }
- }
- }
- }
- else if (event.getSelection() instanceof ITextSelection) {
- start = ((ITextSelection) event.getSelection()).getOffset();
- length = ((ITextSelection) event.getSelection()).getLength();
- }
- if (start > -1) {
- getSourceViewer().setRangeIndication(start, length, false);
- selectAndReveal(start, length);
- }
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- /*
- * Do not allow selection from other parts to affect selection in
- * the text widget if it has focus, or if we're still firing a
- * change of selection. Selection events "bouncing" off of other
- * parts are all that we can receive if we have focus (since we
- * forwarded our selection to the service just a moment ago), and
- * only the user should affect selection if we have focus.
- */
-
- /* The isFiringSelection check only works if a selection listener */
- if (event.getSelection().isEmpty() || fStructuredSelectionProvider.isFiringSelection())
- return;
-
- if (getSourceViewer() != null && getSourceViewer().getTextWidget() != null && !getSourceViewer().getTextWidget().isDisposed() && !getSourceViewer().getTextWidget().isFocusControl()) {
- int start = -1;
- int length = 0;
- if (event.getSelection() instanceof IStructuredSelection) {
- ISelection current = getSelectionProvider().getSelection();
- if (current instanceof IStructuredSelection) {
- Object[] currentSelection = ((IStructuredSelection) current).toArray();
- Object[] newSelection = ((IStructuredSelection) event.getSelection()).toArray();
- if (!Arrays.equals(currentSelection, newSelection)) {
- if (newSelection.length > 0) {
- /*
- * No ordering is guaranteed for multiple
- * selection
- */
- Object o = newSelection[0];
- if (o instanceof IndexedRegion) {
- start = ((IndexedRegion) o).getStartOffset();
- int end = ((IndexedRegion) o).getEndOffset();
- if (newSelection.length > 1) {
- for (int i = 1; i < newSelection.length; i++) {
- start = Math.min(start, ((IndexedRegion) newSelection[i]).getStartOffset());
- end = Math.max(end, ((IndexedRegion) newSelection[i]).getEndOffset());
- }
- length = end - start;
- }
- }
- else if (o instanceof ITextRegion) {
- start = ((ITextRegion) o).getStart();
- int end = ((ITextRegion) o).getEnd();
- if (newSelection.length > 1) {
- for (int i = 1; i < newSelection.length; i++) {
- start = Math.min(start, ((ITextRegion) newSelection[i]).getStart());
- end = Math.max(end, ((ITextRegion) newSelection[i]).getEnd());
- }
- length = end - start;
- }
- }
- else if (o instanceof IRegion) {
- start = ((IRegion) o).getOffset();
- int end = start + ((IRegion) o).getLength();
- if (newSelection.length > 1) {
- for (int i = 1; i < newSelection.length; i++) {
- start = Math.min(start, ((IRegion) newSelection[i]).getOffset());
- end = Math.max(end, ((IRegion) newSelection[i]).getOffset() + ((IRegion) newSelection[i]).getLength());
- }
- length = end - start;
- }
- }
- }
- }
- }
- }
- else if (event.getSelection() instanceof ITextSelection) {
- start = ((ITextSelection) event.getSelection()).getOffset();
- }
- if (start > -1) {
- updateRangeIndication(event.getSelection());
- selectAndReveal(start, length);
- }
- }
- }
- }
-
- private class ShowInTargetListAdapter implements IShowInTargetList {
- /**
- * Array of ID Strings that define the default show in targets for
- * this editor.
- *
- * @see org.eclipse.ui.part.IShowInTargetList#getShowInTargetIds()
- * @return the array of ID Strings that define the default show in
- * targets for this editor.
- */
- public String[] getShowInTargetIds() {
- return fShowInTargetIds;
- }
- }
-
- /**
- * A post selection provider that wraps the provider implemented in
- * AbstractTextEditor to provide a StructuredTextSelection to post
- * selection listeners. Listens to selection changes from the source
- * viewer.
- */
- private static class StructuredSelectionProvider implements IPostSelectionProvider, ISelectionValidator {
- /**
- * A "hybrid" text and structured selection class. Converts the source
- * viewer text selection to a generic "getIndexedRegion"-derived
- * structured selection, allowing selection changed listeners to
- * possibly not need to reference the model directly.
- */
- private static class StructuredTextSelection extends TextSelection implements IStructuredSelection, ITextSelection {
- private WeakReference weakSelectedStructured;
- private InternalTextSelection fInternalTextSelection;
-
- StructuredTextSelection(ITextSelection selection, IDocument document, IStructuredModel model) {
- // note: we do not currently use super class at all, but, only
- // subclass TextSelection,
- // because some infrastructure code uses "instanceof
- // TextSelection" instead of ITextSelection.
- super(selection.getOffset(), selection.getLength());
- fInternalTextSelection = new InternalTextSelection(document, selection.getOffset(), selection.getLength());
- weakSelectedStructured = new WeakReference(initializeInferredSelectedObjects(selection, model));
- }
-
- StructuredTextSelection(ITextSelection selection, Object[] selectedObjects, IDocument document) {
- super(selection.getOffset(), selection.getLength());
- fInternalTextSelection = new InternalTextSelection(document, selection.getOffset(), selection.getLength());
- weakSelectedStructured = new WeakReference(selectedObjects);
- }
-
- StructuredTextSelection(IDocument document, int offset, int length, Object[] selectedObjects) {
- super(offset, length);
- fInternalTextSelection = new InternalTextSelection(document, offset, length);
- weakSelectedStructured = new WeakReference(selectedObjects);
- }
-
- public Object getFirstElement() {
- Object[] selectedStructures = getSelectedStructures();
- return selectedStructures.length > 0 ? selectedStructures[0] : null;
- }
-
- private Object[] getSelectedStructures() {
- Object[] selectedStructures = (Object[]) weakSelectedStructured.get();
- if (selectedStructures == null) {
- selectedStructures = new Object[0];
- }
- return selectedStructures;
- }
-
- private Object[] initializeInferredSelectedObjects(ITextSelection selection, IStructuredModel model) {
- Object[] localSelectedStructures = null;
- if (model != null) {
- IndexedRegion region = model.getIndexedRegion(selection.getOffset());
- int end = selection.getOffset() + selection.getLength();
- if (region != null) {
- if (end <= region.getEndOffset()) {
- // single selection
- localSelectedStructures = new Object[1];
- localSelectedStructures[0] = region;
- }
- else {
- // multiple selection
- int maxLength = model.getStructuredDocument().getLength();
- List structures = new ArrayList(2);
- while (region != null && region.getEndOffset() <= end && region.getEndOffset() < maxLength) {
- structures.add(region);
- region = model.getIndexedRegion(region.getEndOffset() + 1);
- }
- localSelectedStructures = structures.toArray();
- }
- }
- }
- if (localSelectedStructures == null) {
- localSelectedStructures = new Object[0];
- }
- return localSelectedStructures;
- }
-
- public boolean isEmpty() {
- return fInternalTextSelection.isEmpty() && getSelectedStructures().length == 0;
- }
-
- public Iterator iterator() {
- return toList().iterator();
- }
-
- public int size() {
- return getSelectedStructures().length;
- }
-
- public Object[] toArray() {
- return getSelectedStructures();
- }
-
- public List toList() {
- return Arrays.asList(getSelectedStructures());
- }
-
- public String toString() {
- return fInternalTextSelection.getOffset() + ":" + fInternalTextSelection.getLength() + "@" + getSelectedStructures(); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- private static class InternalTextSelection implements ITextSelection {
-
-
- private WeakReference weakDocument;
-
- /** Offset of the selection */
- private int fOffset;
- /** Length of the selection */
- private int fLength;
-
-
- /**
- * Creates an empty text selection.
- */
- private InternalTextSelection() {
- this(null, -1, -1);
- }
-
- /**
- * Creates a text selection for the given range. This
- * selection object describes generically a text range and is
- * intended to be an argument for the
- * <code>setSelection</code> method of selection providers.
- *
- * @param offset
- * the offset of the range
- * @param length
- * the length of the range
- */
- InternalTextSelection(int offset, int length) {
- this(null, offset, length);
- }
-
- /**
- * Creates a text selection for the given range of the given
- * document. This selection object is created by selection
- * providers in responds <code>getSelection</code>.
- *
- * @param document
- * the document whose text range is selected in a
- * viewer
- * @param offset
- * the offset of the selected range
- * @param length
- * the length of the selected range
- */
- InternalTextSelection(IDocument document, int offset, int length) {
- weakDocument = new WeakReference(document);
- fOffset = offset;
- fLength = length;
- }
-
- /**
- *
- * Returns true if the offset and length are smaller than 0. A
- * selection of length 0, is a valid text selection as it
- * describes, e.g., the cursor position in a viewer.
- *
- * @return <code>true</code> if this selection is empty
- * @see org.eclipse.jface.viewers.ISelection#isEmpty()
- */
- public boolean isEmpty() {
- return fOffset < 0 || fLength < 0;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextSelection#getOffset()
- */
- public int getOffset() {
- return fOffset;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextSelection#getLength()
- */
- public int getLength() {
- return fLength;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextSelection#getStartLine()
- */
- public int getStartLine() {
-
- IDocument document = (IDocument) weakDocument.get();
- try {
- if (document != null)
- return document.getLineOfOffset(fOffset);
- }
- catch (BadLocationException x) {
- }
-
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextSelection#getEndLine()
- */
- public int getEndLine() {
- IDocument document = (IDocument) weakDocument.get();
- try {
- if (document != null) {
- int endOffset = fOffset + fLength;
- if (fLength != 0)
- endOffset--;
- return document.getLineOfOffset(endOffset);
- }
- }
- catch (BadLocationException x) {
- }
-
- return -1;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextSelection#getText()
- */
- public String getText() {
- IDocument document = (IDocument) weakDocument.get();
- try {
- if (document != null)
- return document.get(fOffset, fLength);
- }
- catch (BadLocationException x) {
- }
-
- return null;
- }
-
- /*
- * @see java.lang.Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (obj == this)
- return true;
-
- if (obj == null || getClass() != obj.getClass())
- return false;
-
- InternalTextSelection s = (InternalTextSelection) obj;
- boolean sameRange = (s.fOffset == fOffset && s.fLength == fLength);
- if (sameRange) {
-
- IDocument document = (IDocument) weakDocument.get();
- IDocument sDocument = s.getDocument();
-
- // ISSUE: why does not IDocument .equals suffice?
- if (sDocument == null && document == null)
- return true;
- if (sDocument == null || document == null)
- return false;
-
- try {
- // ISSUE: pricey! (a cached hash might be in order, if this
- // was ever really ever used very often.
- String sContent = sDocument.get(fOffset, fLength);
- String content = document.get(fOffset, fLength);
- return sContent.equals(content);
- }
- catch (BadLocationException x) {
- // return false, can not be equal
- }
- }
-
- return false;
- }
-
- /*
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- IDocument document = (IDocument) weakDocument.get();
- int low = document != null ? document.hashCode() : 0;
- return (fOffset << 24) | (fLength << 16) | low;
- }
-
- private IDocument getDocument() {
- if (weakDocument == null)
- return null;
- return (IDocument) weakDocument.get();
- }
- }
-
- public int getOffset() {
- return fInternalTextSelection.getOffset();
- }
-
-
- public int getLength() {
- return fInternalTextSelection.getLength();
- }
-
- public int getStartLine() {
- return fInternalTextSelection.getStartLine();
- }
-
- public int getEndLine() {
- return fInternalTextSelection.getEndLine();
- }
-
- public String getText() {
- return fInternalTextSelection.getText();
- }
- }
-
- private WeakReference weakDocument;
- private ISelectionProvider fParentProvider = null;
- private boolean isFiringSelection = false;
- private ListenerList listeners = new ListenerList();
- private ListenerList postListeners = new ListenerList();
- private ISelection fLastSelection = null;
- private ISelectionProvider fLastSelectionProvider = null;
- private SelectionChangedEvent fLastUpdatedSelectionChangedEvent = null;
- private WeakReference weakEditor;
-
-
- StructuredSelectionProvider(ISelectionProvider parentProvider, StructuredTextEditor structuredTextEditor) {
- fParentProvider = parentProvider;
- weakEditor = new WeakReference(structuredTextEditor);
- IDocument document = structuredTextEditor.getDocumentProvider().getDocument(structuredTextEditor.getEditorInput());
- if (document != null) {
- setDocument(document);
- }
- fParentProvider.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged(event);
- }
- });
- if (fParentProvider instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider) fParentProvider).addPostSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handlePostSelectionChanged(event);
- }
- });
- }
- }
-
- public void addPostSelectionChangedListener(ISelectionChangedListener listener) {
- postListeners.add(listener);
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- listeners.add(listener);
- }
-
- private void fireSelectionChanged(final SelectionChangedEvent event, ListenerList listenerList) {
- Object[] listeners = listenerList.getListeners();
- isFiringSelection = true;
- for (int i = 0; i < listeners.length; ++i) {
- final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
- SafeRunner.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(event);
- }
- });
- }
- isFiringSelection = false;
- }
-
- private ISelectionProvider getParentProvider() {
- return fParentProvider;
- }
-
- public ISelection getSelection() {
- fLastSelection = null;
- fLastSelectionProvider = null;
- fLastUpdatedSelectionChangedEvent = null;
-
- /*
- * When a client explicitly asks for selection, provide the hybrid
- * result.
- */
- ISelection selection = getParentProvider().getSelection();
- if (!(selection instanceof IStructuredSelection) && selection instanceof ITextSelection) {
- IStructuredModel model = null;
- StructuredTextEditor localEditor = getStructuredTextEditor();
- if (localEditor != null) {
- model = localEditor.getModel();
- selection = new StructuredTextSelection((ITextSelection) selection, getDocument(), model);
- }
- else {
- selection = new StructuredTextSelection((ITextSelection) selection, getDocument(), null);
- }
- }
- return selection;
- }
-
- private StructuredTextEditor getStructuredTextEditor() {
- StructuredTextEditor editor = null;
- if (weakEditor != null) {
- editor = (StructuredTextEditor) weakEditor.get();
- }
- return editor;
- }
-
- void handlePostSelectionChanged(SelectionChangedEvent event) {
- SelectionChangedEvent updatedEvent = null;
- if (fLastSelection == event.getSelection() && fLastSelectionProvider == event.getSelectionProvider()) {
- updatedEvent = fLastUpdatedSelectionChangedEvent;
- }
- else {
- updatedEvent = updateEvent(event);
- }
- // only update the range indicator on post selection
- StructuredTextEditor localEditor = (StructuredTextEditor) weakEditor.get();
-
- if (localEditor != null) {
- localEditor.updateRangeIndication(updatedEvent.getSelection());
- fireSelectionChanged(updatedEvent, postListeners);
- }
- }
-
- void handleSelectionChanged(SelectionChangedEvent event) {
- SelectionChangedEvent updatedEvent = event;
- if (fLastSelection != event.getSelection() || fLastSelectionProvider != event.getSelectionProvider()) {
- fLastSelection = event.getSelection();
- fLastSelectionProvider = event.getSelectionProvider();
- fLastUpdatedSelectionChangedEvent = updatedEvent = updateEvent(event);
- }
- fireSelectionChanged(updatedEvent, listeners);
- }
-
- IDocument getDocument() {
- IDocument document = null;
- if (weakDocument != null) {
- document = (IDocument) weakDocument.get();
- }
- return document;
- }
-
-
- boolean isFiringSelection() {
- return isFiringSelection;
- }
-
- public boolean isValid(ISelection selection) {
- // ISSUE: is not clear default behavior should be true?
- // But not clear is this default would apply for our editor.
- boolean result = true;
- // if editor is "gone", can not be valid
- StructuredTextEditor e = getStructuredTextEditor();
- if (e == null || e.fEditorDisposed) {
- result = false;
- }
- // else defer to parent
- else if (getParentProvider() instanceof ISelectionValidator) {
- result = ((ISelectionValidator) getParentProvider()).isValid(selection);
- }
- return result;
- }
-
- public void removePostSelectionChangedListener(ISelectionChangedListener listener) {
- postListeners.remove(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- listeners.remove(listener);
- }
-
- public void setSelection(ISelection selection) {
- if (isFiringSelection()) {
- return;
- }
-
- fLastSelection = null;
- fLastSelectionProvider = null;
- fLastUpdatedSelectionChangedEvent = null;
-
- ISelection textSelection = updateSelection(selection);
- getParentProvider().setSelection(textSelection);
- StructuredTextEditor localEditor = getStructuredTextEditor();
- if (localEditor != null) {
- localEditor.updateRangeIndication(textSelection);
- }
- }
-
- /**
- * Create a corresponding event that contains a
- * StructuredTextselection
- *
- * @param event
- * @return
- */
- private SelectionChangedEvent updateEvent(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof ITextSelection && !(selection instanceof IStructuredSelection)) {
- IStructuredModel structuredModel = null;
- StructuredTextEditor localEditor = getStructuredTextEditor();
- if (localEditor != null) {
- structuredModel = localEditor.getInternalModel();
- }
- selection = new StructuredTextSelection((ITextSelection) event.getSelection(), getDocument(), structuredModel);
- }
- SelectionChangedEvent newEvent = new SelectionChangedEvent(event.getSelectionProvider(), selection);
- return newEvent;
- }
-
- /**
- * Create a corresponding StructuredTextselection
- *
- * @param selection
- * @return
- */
- private ISelection updateSelection(ISelection selection) {
- ISelection updated = selection;
- if (selection instanceof IStructuredSelection && !(selection instanceof ITextSelection) && !selection.isEmpty()) {
- Object[] selectedObjects = ((IStructuredSelection) selection).toArray();
- if (selectedObjects.length > 0) {
- int start = -1;
- int length = 0;
-
- // no ordering is guaranteed for multiple selection
- Object o = selectedObjects[0];
- if (o instanceof IndexedRegion) {
- start = ((IndexedRegion) o).getStartOffset();
- int end = ((IndexedRegion) o).getEndOffset();
- if (selectedObjects.length > 1) {
- for (int i = 1; i < selectedObjects.length; i++) {
- start = Math.min(start, ((IndexedRegion) selectedObjects[i]).getStartOffset());
- end = Math.max(end, ((IndexedRegion) selectedObjects[i]).getEndOffset());
- }
- length = end - start;
- }
- }
- else if (o instanceof ITextRegion) {
- start = ((ITextRegion) o).getStart();
- int end = ((ITextRegion) o).getEnd();
- if (selectedObjects.length > 1) {
- for (int i = 1; i < selectedObjects.length; i++) {
- start = Math.min(start, ((ITextRegion) selectedObjects[i]).getStart());
- end = Math.max(end, ((ITextRegion) selectedObjects[i]).getEnd());
- }
- length = end - start;
- }
- }
-
- if (start > -1) {
- updated = new StructuredTextSelection(getDocument(), start, length, selectedObjects);
- }
- }
- }
- return updated;
- }
-
- public void setDocument(IDocument document) {
- weakDocument = new WeakReference(document);
- }
- }
-
- class TimeOutExpired extends TimerTask {
- public void run() {
- getDisplay().syncExec(new Runnable() {
- public void run() {
- if (getDisplay() != null && !getDisplay().isDisposed())
- endBusyStateInternal();
- }
- });
- }
-
- }
-
- private class ConfigurationAndTarget {
- private String fTargetId;
- private StructuredTextViewerConfiguration fConfiguration;
-
- public ConfigurationAndTarget(String targetId, StructuredTextViewerConfiguration config) {
- fTargetId = targetId;
- fConfiguration = config;
- }
-
- public String getTargetId() {
- return fTargetId;
- }
-
- public StructuredTextViewerConfiguration getConfiguration() {
- return fConfiguration;
- }
- }
-
- /**
- * This action behaves in two different ways: If there is no current text
- * hover, the javadoc is displayed using information presenter. If there
- * is a current text hover, it is converted into a information presenter
- * in order to make it sticky.
- *
- * @see org.eclipse.jdt.internal.ui.javaeditor.JavaEditor#InformationDispatchAction
- */
- class InformationDispatchAction extends TextEditorAction {
-
- /** The wrapped text operation action. */
- private final TextOperationAction fTextOperationAction;
-
- /**
- * Creates a dispatch action.
- *
- * @param resourceBundle
- * the resource bundle
- * @param prefix
- * the prefix
- * @param textOperationAction
- * the text operation action
- */
- public InformationDispatchAction(ResourceBundle resourceBundle, String prefix, final TextOperationAction textOperationAction) {
- super(resourceBundle, prefix, StructuredTextEditor.this);
- if (textOperationAction == null)
- throw new IllegalArgumentException();
- fTextOperationAction = textOperationAction;
- }
-
- /*
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- ISourceViewer sourceViewer = getSourceViewer();
- if (sourceViewer == null) {
- fTextOperationAction.run();
- return;
- }
-
- if (sourceViewer instanceof ITextViewerExtension4) {
- ITextViewerExtension4 extension4 = (ITextViewerExtension4) sourceViewer;
- if (extension4.moveFocusToWidgetToken())
- return;
- }
-
- if (!(sourceViewer instanceof ITextViewerExtension2)) {
- fTextOperationAction.run();
- return;
- }
-
- ITextViewerExtension2 textViewerExtension2 = (ITextViewerExtension2) sourceViewer;
-
- // does a text hover exist?
- ITextHover textHover = textViewerExtension2.getCurrentTextHover();
- if (textHover == null) {
- fTextOperationAction.run();
- return;
- }
-
- Point hoverEventLocation = textViewerExtension2.getHoverEventLocation();
- int offset = computeOffsetAtLocation(sourceViewer, hoverEventLocation.x, hoverEventLocation.y);
- if (offset == -1) {
- fTextOperationAction.run();
- return;
- }
-
- try {
- // get the text hover content
- String contentType = TextUtilities.getContentType(sourceViewer.getDocument(), IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, offset, true);
-
- IRegion hoverRegion = textHover.getHoverRegion(sourceViewer, offset);
- if (hoverRegion == null)
- return;
-
- String hoverInfo = textHover.getHoverInfo(sourceViewer, hoverRegion);
-
- IInformationControlCreator controlCreator = null;
- if (textHover instanceof IInformationProviderExtension2)
- controlCreator = ((IInformationProviderExtension2) textHover).getInformationPresenterControlCreator();
-
- IInformationProvider informationProvider = new InformationProvider(hoverRegion, hoverInfo, controlCreator);
-
- fInformationPresenter.setOffset(offset);
- fInformationPresenter.setDocumentPartitioning(IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING);
- fInformationPresenter.setInformationProvider(informationProvider, contentType);
- fInformationPresenter.showInformation();
-
- }
- catch (BadLocationException e) {
- // No good information to display
- }
- }
-
- // modified version from TextViewer
- private int computeOffsetAtLocation(ITextViewer textViewer, int x, int y) {
-
- StyledText styledText = textViewer.getTextWidget();
- IDocument document = textViewer.getDocument();
-
- if (document == null)
- return -1;
-
- try {
- int widgetLocation = styledText.getOffsetAtLocation(new Point(x, y));
- if (textViewer instanceof ITextViewerExtension5) {
- ITextViewerExtension5 extension = (ITextViewerExtension5) textViewer;
- return extension.widgetOffset2ModelOffset(widgetLocation);
- }
- else {
- IRegion visibleRegion = textViewer.getVisibleRegion();
- return widgetLocation + visibleRegion.getOffset();
- }
- }
- catch (IllegalArgumentException e) {
- return -1;
- }
-
- }
- }
-
- /**
- * Not API. May be removed in the future.
- */
- protected final static char[] BRACKETS = {'{', '}', '(', ')', '[', ']'};
-
- private static final long BUSY_STATE_DELAY = 1000;
- /**
- * Not API. May be removed in the future.
- */
- protected static final String DOT = "."; //$NON-NLS-1$
- private static final String EDITOR_CONTEXT_MENU_ID = "org.eclipse.wst.sse.ui.StructuredTextEditor.EditorContext"; //$NON-NLS-1$
- private static final String EDITOR_CONTEXT_MENU_SUFFIX = ".source.EditorContext"; //$NON-NLS-1$
- /** Non-NLS strings */
- private static final String EDITOR_KEYBINDING_SCOPE_ID = "org.eclipse.wst.sse.ui.structuredTextEditorScope"; //$NON-NLS-1$
- /**
- * Not API. May be removed in the future.
- */
- public static final String GROUP_NAME_ADDITIONS = "additions"; //$NON-NLS-1$
- /**
- * Not API. May be removed in the future.
- */
- public static final String GROUP_NAME_FORMAT = "Format"; //$NON-NLS-1$
- /**
- * Not API. May be removed in the future.
- */
- public static final String GROUP_NAME_FORMAT_EXT = "Format.ext"; //$NON-NLS-1$
-
- private static final String REDO_ACTION_DESC = SSEUIMessages.Redo___0___UI_; //$NON-NLS-1$ = "Redo: {0}."
- private static final String REDO_ACTION_DESC_DEFAULT = SSEUIMessages.Redo_Text_Change__UI_; //$NON-NLS-1$ = "Redo Text Change."
- private static final String REDO_ACTION_TEXT = SSEUIMessages._Redo__0___Ctrl_Y_UI_; //$NON-NLS-1$ = "&Redo {0} @Ctrl+Y"
- private static final String REDO_ACTION_TEXT_DEFAULT = SSEUIMessages._Redo_Text_Change__Ctrl_Y_UI_; //$NON-NLS-1$ = "&Redo Text Change @Ctrl+Y"
- private static final String RULER_CONTEXT_MENU_ID = "org.eclipse.wst.sse.ui.StructuredTextEditor.RulerContext"; //$NON-NLS-1$
- private static final String RULER_CONTEXT_MENU_SUFFIX = ".source.RulerContext"; //$NON-NLS-1$
-
- private final static String UNDERSCORE = "_"; //$NON-NLS-1$
- /** Translatable strings */
- private static final String UNDO_ACTION_DESC = SSEUIMessages.Undo___0___UI_; //$NON-NLS-1$ = "Undo: {0}."
-
- private static final String UNDO_ACTION_DESC_DEFAULT = SSEUIMessages.Undo_Text_Change__UI_; //$NON-NLS-1$ = "Undo Text Change."
- private static final String UNDO_ACTION_TEXT = SSEUIMessages._Undo__0___Ctrl_Z_UI_; //$NON-NLS-1$ = "&Undo {0} @Ctrl+Z"
- private static final String UNDO_ACTION_TEXT_DEFAULT = SSEUIMessages._Undo_Text_Change__Ctrl_Z_UI_; //$NON-NLS-1$ = "&Undo Text Change @Ctrl+Z"
- // development time/debug variables only
- private int adapterRequests;
-
- private long adapterTime;
- private boolean fBackgroundJobEnded;
- private boolean fBusyState;
- private Timer fBusyTimer;
- Runnable fCurrentRunnable = null;
- boolean fDirtyBeforeDocumentEvent = false;
- private ExtendedEditorDropTargetAdapter fDropAdapter;
- private DropTarget fDropTarget;
- boolean fEditorDisposed = false;
- private IEditorPart fEditorPart;
- private IDocumentListener fInternalDocumentListener;
- private InternalModelStateListener fInternalModelStateListener;
- private MouseTracker fMouseTracker;
- private IContentOutlinePage fOutlinePage;
-
- private OutlinePageListener fOutlinePageListener = null;
- /** This editor's projection model updater */
- private IStructuredTextFoldingProvider fProjectionModelUpdater;
- /** This editor's projection support */
- private ProjectionSupport fProjectionSupport;
- private IPropertySheetPage fPropertySheetPage;
- private String fRememberTitle;
- /** The ruler context menu to be disposed. */
- private Menu fRulerContextMenu;
- /** The ruler context menu manager to be disposed. */
- private MenuManager fRulerContextMenuManager;
-
- String[] fShowInTargetIds = new String[]{IPageLayout.ID_RES_NAV};
-
- private IAction fShowPropertiesAction = null;
- private IStructuredModel fStructuredModel;
- StructuredSelectionProvider fStructuredSelectionProvider = null;
- /** The text context menu to be disposed. */
- private Menu fTextContextMenu;
- /** The text context menu manager to be disposed. */
- private MenuManager fTextContextMenuManager;
- private String fViewerConfigurationTargetId;
- /** The selection history of the editor */
- private SelectionHistory fSelectionHistory;
- /** The information presenter. */
- private InformationPresenter fInformationPresenter;
- private boolean fUpdateMenuTextPending;
- int hoverX = -1;
- int hoverY = -1;
-
- private boolean shouldClose = false;
- private long startPerfTime;
- private boolean fisReleased;
- /**
- * The action group for folding.
- */
- private FoldingActionGroup fFoldingGroup;
-
- /**
- * Creates a new Structured Text Editor.
- */
- public StructuredTextEditor() {
- super();
- initializeDocumentProvider(null);
- }
-
- private void aboutToSaveModel() {
- if (getInternalModel() != null) {
- getInternalModel().aboutToChangeModel();
- }
- }
-
- private void abstractTextEditorContextMenuAboutToShow(IMenuManager menu) {
- menu.add(new Separator(ITextEditorActionConstants.GROUP_UNDO));
- menu.add(new GroupMarker(ITextEditorActionConstants.GROUP_SAVE));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_COPY));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_PRINT));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_FIND));
- menu.add(new Separator(IWorkbenchActionConstants.GROUP_ADD));
- menu.add(new Separator(ITextEditorActionConstants.GROUP_REST));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- if (isEditable()) {
- addAction(menu, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.UNDO);
- addAction(menu, ITextEditorActionConstants.GROUP_UNDO, ITextEditorActionConstants.REVERT_TO_SAVED);
- addAction(menu, ITextEditorActionConstants.GROUP_SAVE, ITextEditorActionConstants.SAVE);
- addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.CUT);
- addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY);
- addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.PASTE);
- }
- else {
- addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY);
- }
-
- // from AbstractDecoratedTextEditor
- IAction preferencesAction = getAction(ITextEditorActionConstants.CONTEXT_PREFERENCES);
- menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator(ITextEditorActionConstants.GROUP_SETTINGS));
- menu.appendToGroup(ITextEditorActionConstants.GROUP_SETTINGS, preferencesAction);
- }
-
- protected void addContextMenuActions(IMenuManager menu) {
- // Only offer actions that affect the text if the viewer allows
- // modification and supports any of these operations
- IAction formatAll = getAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT);
- IAction formatSelection = getAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS);
- IAction cleanupAll = getAction(StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT);
- boolean enableFormatMenu = (formatAll != null && formatAll.isEnabled()) || (formatSelection != null && formatSelection.isEnabled()) || (cleanupAll != null && cleanupAll.isEnabled());
-
- if (getSourceViewer().isEditable() && enableFormatMenu) {
- String label = SSEUIMessages.FormatMenu_label; //$NON-NLS-1$ = "Format"
- MenuManager subMenu = new MenuManager(label, GROUP_NAME_FORMAT);
- subMenu.add(new GroupMarker(GROUP_NAME_FORMAT_EXT));
- addAction(subMenu, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT);
- addAction(subMenu, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS);
- subMenu.add(new GroupMarker(GROUP_NAME_ADDITIONS));
- addAction(menu, ITextEditorActionConstants.GROUP_EDIT, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT);
- menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, subMenu);
- }
-
- // Some Design editors (DTD) rely on this view for their own uses
- menu.appendToGroup(IWorkbenchActionConstants.GROUP_ADD, fShowPropertiesAction);
- }
-
- private void addExtendedContextMenuActions(IMenuManager menu) {
- IEditorActionBarContributor c = getEditorSite().getActionBarContributor();
- if (c instanceof IPopupMenuContributor) {
- ((IPopupMenuContributor) c).contributeToPopupMenu(menu);
- }
- else {
- ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder();
- IExtendedContributor pmc = builder.readActionExtensions(getConfigurationPoints());
- if (pmc != null) {
- pmc.setActiveEditor(this);
- pmc.contributeToPopupMenu(menu);
- }
- }
- }
-
- protected void addExtendedRulerContextMenuActions(IMenuManager menu) {
- // none at this level
- }
-
-
-
- /**
- * Starts background mode.
- * <p>
- * Not API. May be removed in the future.
- * </p>
- */
- void beginBackgroundOperation() {
- fBackgroundJobEnded = false;
- // if already in busy state, no need to do anything
- // and, we only start, or reset, the timed busy
- // state when we get the "endBackgroundOperation" call.
- if (!inBusyState()) {
- beginBusyStateInternal();
- }
- }
-
- private void beginBusyStateInternal() {
-
- fBusyState = true;
- startBusyTimer();
-
- ISourceViewer viewer = getSourceViewer();
- if (viewer instanceof StructuredTextViewer) {
- ((StructuredTextViewer) viewer).beginBackgroundUpdate();
-
- }
- showBusy(true);
- }
-
- // private void addFindOccurrencesAction(String matchType, String
- // matchText, IMenuManager menu) {
- //
- // AbstractFindOccurrencesAction action = new
- // AbstractFindOccurrencesAction(getFileInEditor(), new
- // SearchUIConfiguration(), (IStructuredDocument) getDocument(),
- // matchType, matchText, getProgressMonitor());
- // action.setText("Occurrences of \"" + matchText + "\" in File");
- // menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, action);
- // }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.ITextEditor#close(boolean)
- */
- public void close(final boolean save) {
- /*
- * Instead of us closing directly, we have to close with our
- * containing (multipage) editor, if it exists.
- */
- if (getSite() == null) {
- // if site hasn't been set yet, then we're not
- // completely open
- // so set a flag not to open
- shouldClose = true;
- }
- else {
- if (getEditorPart() != null) {
- Display display = getSite().getShell().getDisplay();
- display.asyncExec(new Runnable() {
-
- public void run() {
- getSite().getPage().closeEditor(getEditorPart(), save);
- }
- });
- }
- else {
- super.close(save);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#collectContextMenuPreferencePages()
- */
- protected String[] collectContextMenuPreferencePages() {
- List allIds = new ArrayList(0);
-
- // get contributed preference pages
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- String[] configurationIds = getConfigurationPoints();
- for (int i = 0; i < configurationIds.length; i++) {
- String[] definitions = builder.getDefinitions("preferencepages", configurationIds[i]); //$NON-NLS-1$
- for (int j = 0; j < definitions.length; j++) {
- String someIds = definitions[j];
- if (someIds != null && someIds.length() > 0) {
- // supports multiple comma-delimited page IDs in one
- // element
- String[] ids = StringUtils.unpack(someIds);
- for (int k = 0; k < ids.length; k++) {
- // trim, just to keep things clean
- String id = ids[k].trim();
- if (!allIds.contains(id)) {
- allIds.add(id);
- }
- }
- }
- }
- }
-
- // add pages contributed by super
- String[] superPages = super.collectContextMenuPreferencePages();
- for (int m = 0; m < superPages.length; m++) {
- // trim, just to keep things clean
- String id = superPages[m].trim();
- if (!allIds.contains(id)) {
- allIds.add(id);
- }
- }
-
- return (String[]) allIds.toArray(new String[0]);
- }
-
- /**
- * Compute and set double-click action for the vertical ruler
- */
- private void computeAndSetDoubleClickAction() {
- /*
- * Make double-clicking on the ruler toggle a breakpoint instead of
- * toggling a bookmark. For lines where a breakpoint won't be created,
- * create a bookmark through the contributed RulerDoubleClick action.
- */
- setAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK, new ToggleBreakpointAction(this, getVerticalRuler(), getAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK)));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.ExtendedTextEditor#configureSourceViewerDecorationSupport(org.eclipse.ui.texteditor.SourceViewerDecorationSupport)
- */
- protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
- support.setCharacterPairMatcher(createCharacterPairMatcher());
- support.setMatchingCharacterPainterPreferenceKeys(EditorPreferenceNames.MATCHING_BRACKETS, EditorPreferenceNames.MATCHING_BRACKETS_COLOR);
-
- super.configureSourceViewerDecorationSupport(support);
- }
-
- protected void createActions() {
- super.createActions();
- ResourceBundle resourceBundle = SSEUIMessages.getResourceBundle();
- IWorkbenchHelpSystem helpSystem = SSEUIPlugin.getDefault().getWorkbench().getHelpSystem();
- // TextView Action - moving the selected text to
- // the clipboard
- // override the cut/paste/delete action to make
- // them run on read-only
- // files
- Action action = new TextOperationAction(resourceBundle, "Editor_Cut_", this, ITextOperationTarget.CUT, true); //$NON-NLS-1$
- action.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT);
- setAction(ITextEditorActionConstants.CUT, action);
- helpSystem.setHelp(action, IAbstractTextEditorHelpContextIds.CUT_ACTION);
- // TextView Action - inserting the clipboard
- // content at the current
- // position
- // override the cut/paste/delete action to make
- // them run on read-only
- // files
- action = new TextOperationAction(resourceBundle, "Editor_Paste_", this, ITextOperationTarget.PASTE, true); //$NON-NLS-1$
- action.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE);
- setAction(ITextEditorActionConstants.PASTE, action);
- helpSystem.setHelp(action, IAbstractTextEditorHelpContextIds.PASTE_ACTION);
- // TextView Action - deleting the selected text or
- // if selection is
- // empty the character at the right of the current
- // position
- // override the cut/paste/delete action to make
- // them run on read-only
- // files
- action = new TextOperationAction(resourceBundle, "Editor_Delete_", this, ITextOperationTarget.DELETE, true); //$NON-NLS-1$
- action.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE);
- setAction(ITextEditorActionConstants.DELETE, action);
- helpSystem.setHelp(action, IAbstractTextEditorHelpContextIds.DELETE_ACTION);
- // SourceView Action - requesting information at
- // the current insertion
- // position
- action = new TextOperationAction(SSEUIMessages.getResourceBundle(), StructuredTextEditorActionConstants.ACTION_NAME_INFORMATION + UNDERSCORE, this, ISourceViewer.INFORMATION, true);
- action = new InformationDispatchAction(SSEUIMessages.getResourceBundle(), StructuredTextEditorActionConstants.ACTION_NAME_INFORMATION + UNDERSCORE, (TextOperationAction) action);
- action.setActionDefinitionId(ActionDefinitionIds.INFORMATION);
- setAction(StructuredTextEditorActionConstants.ACTION_NAME_INFORMATION, action);
- markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_INFORMATION, true);
- // SourceView Action - requesting content assist to
- // show completetion
- // proposals for the current insert position
- action = new TextOperationAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS + UNDERSCORE, this, ISourceViewer.CONTENTASSIST_PROPOSALS, true);
- helpSystem.setHelp(action, IHelpContextIds.CONTMNU_CONTENTASSIST_HELPID);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
- setAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS, action);
- markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS, true);
- // SourceView Action - requesting content assist to
- // show the content
- // information for the current insert position
- action = new TextOperationAction(SSEUIMessages.getResourceBundle(), StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_CONTEXT_INFORMATION + UNDERSCORE, this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION);
- action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
- setAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_CONTEXT_INFORMATION, action);
- markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_CONTEXT_INFORMATION, true);
- // StructuredTextViewer Action - requesting
- // correction assist to show
- // correction proposals for the current position
- action = new TextOperationAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_QUICK_FIX + UNDERSCORE, this, StructuredTextViewer.QUICK_FIX, true);
- action.setActionDefinitionId(ActionDefinitionIds.QUICK_FIX);
- setAction(StructuredTextEditorActionConstants.ACTION_NAME_QUICK_FIX, action);
- markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_QUICK_FIX, true);
- // StructuredTextViewer Action - requesting format
- // of the whole
- // document
- action = new TextOperationAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT + UNDERSCORE, this, StructuredTextViewer.FORMAT_DOCUMENT);
- helpSystem.setHelp(action, IHelpContextIds.CONTMNU_FORMAT_DOC_HELPID);
- action.setActionDefinitionId(ActionDefinitionIds.FORMAT_DOCUMENT);
- setAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT, action);
- markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT, true);
- markAsSelectionDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT, true);
- // StructuredTextViewer Action - requesting format
- // of the active
- // elements
- action = new TextOperationAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS + UNDERSCORE, this, StructuredTextViewer.FORMAT_ACTIVE_ELEMENTS);
- helpSystem.setHelp(action, IHelpContextIds.CONTMNU_FORMAT_ELEMENTS_HELPID);
- action.setActionDefinitionId(ActionDefinitionIds.FORMAT_ACTIVE_ELEMENTS);
- setAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS, action);
- markAsStateDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS, true);
- markAsSelectionDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS, true);
-
- // StructuredTextEditor Action - add breakpoints (falling back to the
- // current double-click if they can't be added)
- action = new ToggleBreakpointAction(this, getVerticalRuler());
- setAction(ActionDefinitionIds.TOGGLE_BREAKPOINTS, action);
- // StructuredTextEditor Action - manage breakpoints
- action = new ManageBreakpointAction(this, getVerticalRuler());
- setAction(ActionDefinitionIds.MANAGE_BREAKPOINTS, action);
- // StructuredTextEditor Action - edit breakpoints
- action = new EditBreakpointAction(this, getVerticalRuler());
- setAction(ActionDefinitionIds.EDIT_BREAKPOINTS, action);
- // StructuredTextViewer Action - open file on selection
- action = new OpenHyperlinkAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE + UNDERSCORE, this, getSourceViewer());
- action.setActionDefinitionId(ActionDefinitionIds.OPEN_FILE);
- setAction(StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE, action);
-
- computeAndSetDoubleClickAction();
-
- fShowPropertiesAction = new ShowPropertiesAction();
- fFoldingGroup = new FoldingActionGroup(this, getSourceViewer());
- }
-
- protected LineChangeHover createChangeHover() {
- return new StructuredLineChangeHover();
- }
-
- protected ICharacterPairMatcher createCharacterPairMatcher() {
- ICharacterPairMatcher matcher = null;
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- String[] ids = getConfigurationPoints();
- for (int i = 0; matcher == null && i < ids.length; i++) {
- matcher = (ICharacterPairMatcher) builder.getConfiguration(DocumentRegionEdgeMatcher.ID, ids[i]);
- }
- if (matcher == null) {
- matcher = new ICharacterPairMatcher() {
-
- public void clear() {
- }
-
- public void dispose() {
- }
-
- public int getAnchor() {
- return ICharacterPairMatcher.LEFT;
- }
-
- public IRegion match(IDocument iDocument, int i) {
- return null;
- }
- };
- }
- return matcher;
- }
-
- /**
- * Create a preference store that combines the source editor preferences
- * with the base editor's preferences.
- *
- * @return IPreferenceStore
- */
- private IPreferenceStore createCombinedPreferenceStore() {
- IPreferenceStore sseEditorPrefs = SSEUIPlugin.getDefault().getPreferenceStore();
- IPreferenceStore baseEditorPrefs = EditorsUI.getPreferenceStore();
- return new ChainedPreferenceStore(new IPreferenceStore[]{sseEditorPrefs, baseEditorPrefs});
- }
-
- private ContentOutlineConfiguration createContentOutlineConfiguration() {
- ContentOutlineConfiguration cfg = null;
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- String[] ids = getConfigurationPoints();
- for (int i = 0; cfg == null && i < ids.length; i++) {
- cfg = (ContentOutlineConfiguration) builder.getConfiguration(ExtendedConfigurationBuilder.CONTENTOUTLINECONFIGURATION, ids[i]);
- }
- return cfg;
- }
-
- /**
- * Only gets the correction assistant associted with the current source
- * viewer configuration.
- *
- * @return IContentAssistant or null
- */
- private IContentAssistant createCorrectionAssistant() {
- IContentAssistant assist = null;
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- CorrectionAssistantProvider provider = (CorrectionAssistantProvider) builder.getConfiguration("correctionassistant", fViewerConfigurationTargetId); //$NON-NLS-1$
- if (provider != null) {
- assist = provider.getCorrectionAssistant(getSourceViewer());
- }
- return assist;
- }
-
- protected void createModelDependentFields() {
- // none at this level
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * Use StructuredTextViewerConfiguration if a viewerconfiguration has not
- * already been set. Also initialize StructuredTextViewer.
- * </p>
- *
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- if (getSourceViewerConfiguration() == null) {
- ConfigurationAndTarget cat = createSourceViewerConfiguration();
- fViewerConfigurationTargetId = cat.getTargetId();
- StructuredTextViewerConfiguration newViewerConfiguration = cat.getConfiguration();
- setSourceViewerConfiguration(newViewerConfiguration);
- }
-
- super.createPartControl(parent);
-
- // instead of calling setInput twice, use initializeSourceViewer() to
- // handle source viewer initialization previously handled by setInput
- initializeSourceViewer();
-
- // update editor context menu, vertical ruler context menu, infopop
- if (getInternalModel() != null) {
- updateEditorControlsForContentType(getInternalModel().getContentTypeIdentifier());
- }
- else {
- updateEditorControlsForContentType(null);
- }
-
- // used for Show Tooltip Description
- IInformationControlCreator informationControlCreator = new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell shell) {
- boolean cutDown = false;
- int style = cutDown ? SWT.NONE : (SWT.V_SCROLL | SWT.H_SCROLL);
- return new DefaultInformationControl(shell, SWT.RESIZE | SWT.TOOL, style, new HTMLTextPresenter(cutDown));
- }
- };
-
- fInformationPresenter = new InformationPresenter(informationControlCreator);
- fInformationPresenter.setSizeConstraints(60, 10, true, true);
- fInformationPresenter.install(getSourceViewer());
- }
-
- protected PropertySheetConfiguration createPropertySheetConfiguration() {
- PropertySheetConfiguration cfg = null;
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- String[] ids = getConfigurationPoints();
- for (int i = 0; cfg == null && i < ids.length; i++) {
- cfg = (PropertySheetConfiguration) builder.getConfiguration(ExtendedConfigurationBuilder.PROPERTYSHEETCONFIGURATION, ids[i]);
- }
- return cfg;
- }
-
- /**
- * Loads the Show In Target IDs from the Extended Configuration extension
- * point.
- *
- * @return
- */
- private String[] createShowInTargetIds() {
- List allIds = new ArrayList(0);
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- String[] configurationIds = getConfigurationPoints();
- for (int i = 0; i < configurationIds.length; i++) {
- String[] definitions = builder.getDefinitions("showintarget", configurationIds[i]); //$NON-NLS-1$
- for (int j = 0; j < definitions.length; j++) {
- String someIds = definitions[j];
- if (someIds != null && someIds.length() > 0) {
- String[] ids = StringUtils.unpack(someIds);
- for (int k = 0; k < ids.length; k++) {
- // trim, just to keep things clean
- String id = ids[k].trim();
- if (!allIds.contains(id)) {
- allIds.add(id);
- }
- }
- }
- }
- }
-
- if (!allIds.contains(IPageLayout.ID_RES_NAV)) {
- allIds.add(IPageLayout.ID_RES_NAV);
- }
- if (!allIds.contains(IPageLayout.ID_OUTLINE)) {
- allIds.add(IPageLayout.ID_OUTLINE);
- }
- return (String[]) allIds.toArray(new String[0]);
- }
-
- /**
- * @return
- */
- private ISourceEditingTextTools createSourceEditingTextTools() {
- ISourceEditingTextTools tools = null;
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- String[] ids = getConfigurationPoints();
- for (int i = 0; tools == null && i < ids.length; i++) {
- tools = (ISourceEditingTextTools) builder.getConfiguration(NullSourceEditingTextTools.ID, ids[i]);
- }
- if (tools == null) {
- tools = NullSourceEditingTextTools.getInstance();
- ((NullSourceEditingTextTools) tools).setTextEditor(this);
- }
- Method method = null; //$NON-NLS-1$
- try {
- method = tools.getClass().getMethod("setTextEditor", new Class[]{StructuredTextEditor.class}); //$NON-NLS-1$
- }
- catch (NoSuchMethodException e) {
- }
- if (method == null) {
- try {
- method = tools.getClass().getMethod("setTextEditor", new Class[]{ITextEditor.class}); //$NON-NLS-1$
- }
- catch (NoSuchMethodException e) {
- }
- }
- if (method == null) {
- try {
- method = tools.getClass().getMethod("setTextEditor", new Class[]{IEditorPart.class}); //$NON-NLS-1$
- }
- catch (NoSuchMethodException e) {
- }
- }
- if (method != null) {
- if (!method.isAccessible()) {
- method.setAccessible(true);
- }
- try {
- method.invoke(tools, new Object[]{this});
- }
- catch (Exception e) {
- Logger.logException("Problem creating ISourceEditingTextTools implementation", e); //$NON-NLS-1$
- }
- }
-
- return tools;
- }
-
- /**
- * Creates the source viewer to be used by this editor
- */
- protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler verticalRuler, int styles) {
- fAnnotationAccess = createAnnotationAccess();
- fOverviewRuler = createOverviewRuler(getSharedColors());
- StructuredTextViewer sourceViewer = createStructedTextViewer(parent, verticalRuler, styles);
- initSourceViewer(sourceViewer);
- return sourceViewer;
- }
-
- private ConfigurationAndTarget createSourceViewerConfiguration() {
- ConfigurationAndTarget cat = null;
- StructuredTextViewerConfiguration cfg = null;
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- String[] ids = getConfigurationPoints();
- for (int i = 0; cfg == null && i < ids.length; i++) {
- cfg = (StructuredTextViewerConfiguration) builder.getConfiguration(ExtendedConfigurationBuilder.SOURCEVIEWERCONFIGURATION, ids[i]);
- cat = new ConfigurationAndTarget(ids[i], cfg);
- }
- if (cfg == null) {
- cfg = new StructuredTextViewerConfiguration();
- String targetid = getClass().getName() + "#default"; //$NON-NLS-1$
- cat = new ConfigurationAndTarget(targetid, cfg);
- }
- return cat;
- }
-
- protected StructuredTextViewer createStructedTextViewer(Composite parent, IVerticalRuler verticalRuler, int styles) {
- return new StructuredTextViewer(parent, verticalRuler, getOverviewRuler(), isOverviewRulerVisible(), styles);
- }
-
- protected void createUndoRedoActions() {
- // overridden to add icons to actions
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=111877
- super.createUndoRedoActions();
- IAction action = getAction(ITextEditorActionConstants.UNDO);
- if (action != null) {
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- }
-
- action = getAction(ITextEditorActionConstants.REDO);
- if (action != null) {
- action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- Logger.trace("Source Editor", "StructuredTextEditor::dispose entry"); //$NON-NLS-1$ //$NON-NLS-2$
- if (org.eclipse.wst.sse.core.internal.util.Debug.perfTestAdapterClassLoading) {
- System.out.println("Total calls to getAdapter: " + adapterRequests); //$NON-NLS-1$
- System.out.println("Total time in getAdapter: " + adapterTime); //$NON-NLS-1$
- System.out.println("Average time per call: " + (adapterTime / adapterRequests)); //$NON-NLS-1$
- }
-
- // dispose of information presenter
- if (fInformationPresenter != null) {
- fInformationPresenter.dispose();
- fInformationPresenter = null;
- }
-
- // dispose of selection history
- if (fSelectionHistory != null) {
- fSelectionHistory.dispose();
- fSelectionHistory = null;
- }
-
- // dispose of document folding support
- if (fProjectionModelUpdater != null) {
- fProjectionModelUpdater.uninstall();
- fProjectionModelUpdater = null;
- }
-
- if (fProjectionSupport != null) {
- fProjectionSupport.dispose();
- fProjectionSupport = null;
- }
-
- if (fFoldingGroup != null) {
- fFoldingGroup.dispose();
- fFoldingGroup = null;
- }
-
- // subclass may not have mouse tracker created
- // need to check for null before stopping
- if (fMouseTracker != null) {
- fMouseTracker.stop();
- fMouseTracker = null;
- }
-
- // dispose of menus that were being tracked
- if (fTextContextMenu != null) {
- fTextContextMenu.dispose();
- }
- if (fRulerContextMenu != null) {
- fRulerContextMenu.dispose();
- }
- if (fTextContextMenuManager != null) {
- fTextContextMenuManager.removeMenuListener(getContextMenuListener());
- fTextContextMenuManager.removeAll();
- fTextContextMenuManager.dispose();
- }
- if (fRulerContextMenuManager != null) {
- fRulerContextMenuManager.removeMenuListener(getContextMenuListener());
- fRulerContextMenuManager.removeAll();
- fRulerContextMenuManager.dispose();
- }
-
- // added this 2/20/2004 based on probe results --
- // seems should be handled by setModel(null), but
- // that's a more radical change.
- // and, technically speaking, should not be needed,
- // but makes a memory leak
- // less severe.
- if (fStructuredModel != null) {
- if (fStructuredModel.getStructuredDocument() != null) {
- fStructuredModel.getStructuredDocument().removeDocumentListener(getInternalDocumentListener());
- }
- fStructuredModel.removeModelStateListener(getInternalModelStateListener());
- }
-
- // BUG155335 - if there was no document provider, there was nothing added
- // to document, so nothing to remove
- if (getDocumentProvider() != null) {
- IDocument doc = getDocumentProvider().getDocument(getEditorInput());
- if (doc != null) {
- doc.removeDocumentListener(getInternalDocumentListener());
- if (doc instanceof IExecutionDelegatable) {
- ((IExecutionDelegatable) doc).setExecutionDelegate(null);
- }
- }
- }
-
- // some things in the configuration need to clean
- // up after themselves
- if (fOutlinePage != null) {
- if (fOutlinePage instanceof ConfigurableContentOutlinePage && fOutlinePageListener != null) {
- ((ConfigurableContentOutlinePage) fOutlinePage).removeDoubleClickListener(fOutlinePageListener);
- }
- if (fOutlinePageListener != null) {
- fOutlinePage.removeSelectionChangedListener(fOutlinePageListener);
- }
- }
-
- fEditorDisposed = true;
- disposeModelDependentFields();
-
- if (fDropTarget != null)
- fDropTarget.dispose();
-
- setPreferenceStore(null);
-
- // strictly speaking, but following null outs
- // should not be needed,
- // but in the event of a memory leak, they make the
- // memory leak less
- // severe
- fDropAdapter = null;
- fDropTarget = null;
-
- super.dispose();
-
- Logger.trace("Source Editor", "StructuredTextEditor::dispose exit"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#disposeDocumentProvider()
- */
- protected void disposeDocumentProvider() {
- if (fStructuredModel != null && !fisReleased && !(getDocumentProvider() instanceof IModelProvider)) {
- fStructuredModel.releaseFromEdit();
- fisReleased = true;
- }
- super.disposeDocumentProvider();
- }
-
- /**
- * Disposes model specific editor helpers such as statusLineHelper.
- * Basically any code repeated in update() & dispose() should be placed
- * here.
- */
- private void disposeModelDependentFields() {
- // none at this level
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.ITextEditor#doRevertToSaved()
- */
- public void doRevertToSaved() {
- super.doRevertToSaved();
- if (fOutlinePage != null && fOutlinePage instanceof IUpdate) {
- ((IUpdate) fOutlinePage).update();
- }
- // reset undo
- IDocument doc = getDocumentProvider().getDocument(getEditorInput());
- if (doc instanceof IStructuredDocument) {
- ((IStructuredDocument) doc).getUndoManager().getCommandStack().flush();
- }
-
- // update menu text
- updateMenuText();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void doSave(IProgressMonitor progressMonitor) {
- try {
- aboutToSaveModel();
- updateEncodingMemento();
- super.doSave(progressMonitor);
- }
- finally {
- savedModel();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#doSetInput(org.eclipse.ui.IEditorInput)
- */
- protected void doSetInput(IEditorInput input) throws CoreException {
- // TODO: if opened in more than one editor, this will cause
- // problems.
- IEditorInput oldInput = getEditorInput();
- if (oldInput != null) {
- IDocument olddoc = getDocumentProvider().getDocument(oldInput);
- if (olddoc != null && olddoc instanceof IExecutionDelegatable) {
- ((IExecutionDelegatable) olddoc).setExecutionDelegate(null);
- }
- }
-
- if (fStructuredModel != null && !(getDocumentProvider() instanceof IModelProvider)) {
- fStructuredModel.releaseFromEdit();
- }
-
- super.doSetInput(input);
-
- IDocument newDocument = getDocumentProvider().getDocument(input);
- if (newDocument instanceof IExecutionDelegatable) {
- ((IExecutionDelegatable) newDocument).setExecutionDelegate(new EditorExecutionContext(this));
- }
-
- IStructuredModel model = null;
- // if we have a Model provider, get the model from it
- if (getDocumentProvider() instanceof IModelProvider) {
- model = ((IModelProvider) getDocumentProvider()).getModel(getEditorInput());
- if (!model.isShared()) {
- EditorModelUtil.addFactoriesTo(model);
- }
- }
- else {
- if (newDocument instanceof IStructuredDocument) {
- // corresponding releaseFromEdit occurs in
- // dispose()
- model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument) newDocument);
- EditorModelUtil.addFactoriesTo(model);
- }
-
- else {
- logUnexpectedDocumentKind(input);
- }
- }
-
- if (fStructuredModel != null || model != null) {
- setModel(model);
- }
-
- if (getInternalModel() != null) {
- updateEditorControlsForContentType(getInternalModel().getContentTypeIdentifier());
- }
- else {
- updateEditorControlsForContentType(null);
- }
-
- if (fProjectionModelUpdater != null)
- fProjectionModelUpdater.initialize();
-
- // start editor with smart insert mode
- setInsertMode(SMART_INSERT);
- }
-
- /**
- * Sets up this editor's context menu before it is made visible.
- * <p>
- * Not API. May be reduced to protected method in the future.
- * </p>
- *
- * @param menu
- * the menu
- */
- public void editorContextMenuAboutToShow(IMenuManager menu) {
- // To be consistant with the Java Editor, we want
- // to remove
- // ShiftRight and ShiftLeft from the context menu.
- //
- // ShiftRight and ShiftLeft were added in the super
- // implemenation of
- // this method. We want to skip it and call
- // AbstractTextEditor's
- // implementation directly. The easiest way is to
- // copy the method here.
-
- // super.editorContextMenuAboutToShow(menu);
- abstractTextEditorContextMenuAboutToShow(menu);
-
- addContextMenuActions(menu);
- addExtendedContextMenuActions(menu);
- }
-
- /**
- * End background mode.
- * <p>
- * Not API. May be removed in the future.
- * </p>
- */
- void endBackgroundOperation() {
- fBackgroundJobEnded = true;
- // note, we don't immediately end our 'internal busy' state,
- // since we may get many calls in a short period of
- // time. We always wait for the time out.
- resetBusyState();
- }
-
- /**
- * Note this method can be called indirectly from background job operation
- * ... but expected to be gaurded there with ILock, plus, can be called
- * directly from timer thread, so the timer's run method guards with ILock
- * too.
- */
- private void endBusyStateInternal() {
- if (fBackgroundJobEnded) {
- fBusyTimer.cancel();
- showBusy(false);
-
- ISourceViewer viewer = getSourceViewer();
- if (viewer instanceof StructuredTextViewer) {
- ((StructuredTextViewer) viewer).endBackgroundUpdate();
- }
- fBusyState = false;
- }
- else {
- // we will only be in this branch for a back ground job that is
- // taking
- // longer than our normal time-out period (meaning we got notified
- // of
- // the timeout "inbetween" calls to 'begin' and
- // 'endBackgroundOperation'.
- // (which, remember, can only happen since there are many calls to
- // begin/end in a short period of time, and we only "reset" on the
- // 'ends').
- // In this event, there's really nothing to do, we're still in
- // "busy state"
- // and should start a new reset cycle once endBackgroundjob is
- // called.
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class required) {
- if (org.eclipse.wst.sse.core.internal.util.Debug.perfTestAdapterClassLoading) {
- startPerfTime = System.currentTimeMillis();
- }
- Object result = null;
- // text editor
- IStructuredModel internalModel = getInternalModel();
- if (ITextEditor.class.equals(required)) {
- result = this;
- }
- else if (IWorkbenchSiteProgressService.class.equals(required)) {
- return getEditorPart().getSite().getAdapter(IWorkbenchSiteProgressService.class);
- }
- // content outline page
- else if (IContentOutlinePage.class.equals(required)) {
- if (fOutlinePage == null || fOutlinePage.getControl() == null || fOutlinePage.getControl().isDisposed()) {
- ContentOutlineConfiguration cfg = createContentOutlineConfiguration();
- if (cfg != null) {
- ConfigurableContentOutlinePage outlinePage = new ConfigurableContentOutlinePage();
- outlinePage.setConfiguration(cfg);
- if (internalModel != null) {
- outlinePage.setInputContentTypeIdentifier(internalModel.getContentTypeIdentifier());
- outlinePage.setInput(internalModel);
- }
-
- if (fOutlinePageListener == null) {
- fOutlinePageListener = new OutlinePageListener();
- }
-
- outlinePage.addSelectionChangedListener(fOutlinePageListener);
- outlinePage.addDoubleClickListener(fOutlinePageListener);
-
- fOutlinePage = outlinePage;
- }
- }
- result = fOutlinePage;
- }
- // property sheet page, but only if the input's editable
- else if (IPropertySheetPage.class.equals(required) && isEditable()) {
- if (fPropertySheetPage == null || fPropertySheetPage.getControl() == null || fPropertySheetPage.getControl().isDisposed()) {
- PropertySheetConfiguration cfg = createPropertySheetConfiguration();
- if (cfg != null) {
- ConfigurablePropertySheetPage propertySheetPage = new ConfigurablePropertySheetPage();
- propertySheetPage.setConfiguration(cfg);
- fPropertySheetPage = propertySheetPage;
- }
- }
- result = fPropertySheetPage;
- }
- else if (IDocument.class.equals(required)) {
- result = getDocumentProvider().getDocument(getEditorInput());
- }
- else if (ISourceEditingTextTools.class.equals(required)) {
- result = createSourceEditingTextTools();
- }
- else if (IToggleBreakpointsTarget.class.equals(required)) {
- result = ToggleBreakpointsTarget.getInstance();
- }
- else if (IShowInTargetList.class.equals(required)) {
- return new ShowInTargetListAdapter();
- }
- else if (SelectionHistory.class.equals(required)) {
- if (fSelectionHistory == null)
- fSelectionHistory = new SelectionHistory(this);
- return fSelectionHistory;
- }
- else {
- if (result == null && internalModel != null) {
- result = internalModel.getAdapter(required);
- }
- // others
- if (result == null)
- result = super.getAdapter(required);
- }
- if (org.eclipse.wst.sse.core.internal.util.Debug.perfTestAdapterClassLoading) {
- long stop = System.currentTimeMillis();
- adapterRequests++;
- adapterTime += (stop - startPerfTime);
- }
- if (org.eclipse.wst.sse.core.internal.util.Debug.perfTestAdapterClassLoading) {
- System.out.println("Total calls to getAdapter: " + adapterRequests); //$NON-NLS-1$
- System.out.println("Total time in getAdapter: " + adapterTime); //$NON-NLS-1$
- System.out.println("Average time per call: " + (adapterTime / adapterRequests)); //$NON-NLS-1$
- }
- return result;
- }
-
- private String[] getConfigurationPoints() {
- String contentTypeIdentifierID = null;
- if (getInternalModel() != null) {
- contentTypeIdentifierID = getInternalModel().getContentTypeIdentifier();
- }
- return ConfigurationPointCalculator.getConfigurationPoints(this, contentTypeIdentifierID, ConfigurationPointCalculator.SOURCE, StructuredTextEditor.class);
- }
-
- /**
- * added checks to overcome bug such that if we are shutting down in an
- * error condition, then viewer will have already been disposed.
- */
- protected String getCursorPosition() {
- String result = null;
- // this may be too expensive in terms of
- // performance, to do this check
- // every time, just to gaurd against error
- // condition.
- // perhaps there's a better way?
- if (getSourceViewer() != null && getSourceViewer().getTextWidget() != null && !getSourceViewer().getTextWidget().isDisposed()) {
- result = super.getCursorPosition();
- }
- else {
- result = "0:0"; //$NON-NLS-1$
- }
- return result;
- }
-
-
- Display getDisplay() {
- return PlatformUI.getWorkbench().getDisplay();
- }
-
- /**
- * Returns this editor part.
- * <p>
- * Not API. May be removed in the future.
- * </p>
- *
- * @return this editor part
- */
- public IEditorPart getEditorPart() {
- if (fEditorPart == null)
- return this;
- return fEditorPart;
- }
-
- private IDocumentListener getInternalDocumentListener() {
- if (fInternalDocumentListener == null) {
- fInternalDocumentListener = new InternalDocumentListener();
- }
- return fInternalDocumentListener;
- }
-
- IStructuredModel getInternalModel() {
- return fStructuredModel;
- }
-
- private InternalModelStateListener getInternalModelStateListener() {
- if (fInternalModelStateListener == null) {
- fInternalModelStateListener = new InternalModelStateListener();
- }
- return fInternalModelStateListener;
- }
-
- /**
- * Returns this editor's StructuredModel.
- * <p>
- * Not API. Will be removed in the future.
- * </p>
- *
- * @return returns this editor's IStructuredModel
- * @deprecated - This method allowed for uncontrolled access to the model
- * instance and will be removed in the future. It is
- * recommended that the current document provider be asked for
- * the current document and the IModelManager then asked for
- * the corresponding model with
- * getExistingModelFor*(IDocument).
- */
- public IStructuredModel getModel() {
- if (getDocumentProvider() == null) {
- // this indicated an error in startup sequence
- Logger.trace(getClass().getName(), "Program Info Only: document provider was null when model requested"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- boolean initialModelNull = false;
- if (fStructuredModel == null)
- initialModelNull = true;
- if (fStructuredModel == null) {
- // lazily set the model instance, although this is an ABNORMAL
- // CODE PATH
- if (getDocumentProvider() instanceof IModelProvider) {
- fStructuredModel = ((IModelProvider) getDocumentProvider()).getModel(getEditorInput());
- fisReleased = false;
- }
- else {
- IDocument doc = getDocumentProvider().getDocument(getEditorInput());
- if (doc instanceof IStructuredDocument) {
- IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(doc);
- if (model == null) {
- model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument) doc);
- }
- fStructuredModel = model;
- fisReleased = false;
- }
- }
-
- // ISSUE: this looks bad ... edit-time factories not initialized
- // unless someone calls getModel?
- // factories will not be re-added if already exists
- EditorModelUtil.addFactoriesTo(fStructuredModel);
-
- if (initialModelNull && fStructuredModel != null) {
- /*
- * DMW: 9/1/2002 -- why is update called here? No change has
- * been indicated? I'd like to remove, but will leave for now
- * to avoid breaking this hack. Should measure/breakpoint to
- * see how large the problem is. May cause performance
- * problems.
- *
- * DMW: 9/8/2002 -- not sure why this was here initially, but
- * the intent/hack must have been to call update if this was
- * the first time fStructuredModel was set. So, I added the
- * logic to check for that "first time" case. It would appear
- * we don't really need. may remove in future when can test
- * more.
- */
- update();
- }
- }
- return fStructuredModel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.IWorkbenchPartOrientation#getOrientation()
- */
- public int getOrientation() {
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=88714
- return SWT.LEFT_TO_RIGHT;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.ITextEditor#getSelectionProvider()
- */
- public ISelectionProvider getSelectionProvider() {
- if (fStructuredSelectionProvider == null) {
- ISelectionProvider parentProvider = super.getSelectionProvider();
- if (parentProvider != null) {
- fStructuredSelectionProvider = new StructuredSelectionProvider(parentProvider, this);
- }
- }
- if (fStructuredSelectionProvider == null) {
- return super.getSelectionProvider();
- }
- return fStructuredSelectionProvider;
- }
-
- /**
- * Returns the editor's source viewer. This method was created to expose
- * the protected final getSourceViewer() method.
- * <p>
- * Not API. May be removed in the future.
- * </p>
- *
- * @return the editor's source viewer
- */
- public StructuredTextViewer getTextViewer() {
- return (StructuredTextViewer) getSourceViewer();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#handleCursorPositionChanged()
- */
- protected void handleCursorPositionChanged() {
- super.handleCursorPositionChanged();
- updateStatusField(StructuredTextEditorActionConstants.STATUS_CATEGORY_OFFSET);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent)
- */
- protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
- String property = event.getProperty();
-
- if (EditorPreferenceNames.EDITOR_TEXT_HOVER_MODIFIERS.equals(property)) {
- updateHoverBehavior();
- }
-
- if (IStructuredTextFoldingProvider.FOLDING_ENABLED.equals(property)) {
- if (getSourceViewer() instanceof ProjectionViewer) {
- // install projection support if it has not even been
- // installed yet
- if (isFoldingEnabled() && (fProjectionSupport == null) && (fProjectionModelUpdater == null)) {
- installProjectionSupport();
- }
- ProjectionViewer pv = (ProjectionViewer) getSourceViewer();
- if (pv.isProjectionMode() != isFoldingEnabled()) {
- if (pv.canDoOperation(ProjectionViewer.TOGGLE))
- pv.doOperation(ProjectionViewer.TOGGLE);
- }
- }
- return;
- }
- super.handlePreferenceStoreChanged(event);
- }
-
- private boolean inBusyState() {
- return fBusyState;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IEditorPart#init(org.eclipse.ui.IEditorSite,
- * org.eclipse.ui.IEditorInput)
- */
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- // if we've gotten an error elsewhere, before
- // we've actually opened, then don't open.
- if (shouldClose) {
- setSite(site);
- close(false);
- }
- else {
- super.init(site, input);
- }
- }
-
- /**
- * Set the document provider for this editor.
- * <p>
- * Not API. May be removed in the future.
- * </p>
- *
- * @param documentProvider
- * documentProvider to initialize
- */
- public void initializeDocumentProvider(IDocumentProvider documentProvider) {
- if (documentProvider != null) {
- setDocumentProvider(documentProvider);
- }
- }
-
- protected void initializeDrop(ITextViewer textViewer) {
- int operations = DND.DROP_COPY | DND.DROP_MOVE;
- fDropTarget = new DropTarget(textViewer.getTextWidget(), operations);
- fDropAdapter = new ReadOnlyAwareDropTargetAdapter(true);
- fDropAdapter.setTargetEditor(this);
- fDropAdapter.setTargetIDs(getConfigurationPoints());
- fDropAdapter.setTextViewer(textViewer);
- fDropTarget.setTransfer(fDropAdapter.getTransfers());
- fDropTarget.addDropListener(fDropAdapter);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
- */
- protected void initializeEditor() {
- super.initializeEditor();
- // FIXME: here's where to add back in our custom encoding support
- fEncodingSupport = null;
- setPreferenceStore(createCombinedPreferenceStore());
-
- setRangeIndicator(new DefaultRangeIndicator());
- setEditorContextMenuId(EDITOR_CONTEXT_MENU_ID);
- initializeDocumentProvider(null);
- // set the infopop for source viewer
- String helpId = getHelpContextId();
- // no infopop set or using default text editor help, use default
- if (helpId == null || ITextEditorHelpContextIds.TEXT_EDITOR.equals(helpId))
- helpId = IHelpContextIds.XML_SOURCE_VIEW_HELPID;
- setHelpContextId(helpId);
- // defect 203158 - disable ruler context menu for
- // beta
- // setRulerContextMenuId(RULER_CONTEXT_MENU_ID);
- configureInsertMode(SMART_INSERT, true);
-
- // enable the base source editor activity when editor opens
- try {
- // FIXME: - commented out to avoid minor dependancy during
- // transition to org.eclipse
- // WTPActivityBridge.getInstance().enableActivity(CORE_SSE_ACTIVITY_ID,
- // true);
- }
- catch (Exception t) {
- // if something goes wrong with enabling activity, just log the
- // error but dont
- // have it break the editor
- Logger.log(Logger.WARNING_DEBUG, t.getMessage(), t);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.editors.text.TextEditor#initializeKeyBindingScopes()
- */
- protected void initializeKeyBindingScopes() {
- setKeyBindingScopes(new String[]{EDITOR_KEYBINDING_SCOPE_ID});
- }
-
- /**
- * Initializes the editor's source viewer and other items that were source
- * viewer-dependent.
- */
- private void initializeSourceViewer() {
- IAction contentAssistAction = getAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS);
- if (contentAssistAction instanceof IUpdate) {
- ((IUpdate) contentAssistAction).update();
- }
- IAction openHyperlinkAction = getAction(StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE);
- if (openHyperlinkAction instanceof OpenHyperlinkAction) {
- ((OpenHyperlinkAction) openHyperlinkAction).setHyperlinkDetectors(getSourceViewerConfiguration().getHyperlinkDetectors(getSourceViewer()));
- }
-
- // do not even install projection support until folding is actually
- // enabled
- if (isFoldingEnabled()) {
- installProjectionSupport();
- }
-
- // initialize source viewer's correction assistant
- IContentAssistant correctionAssistant = createCorrectionAssistant();
- getTextViewer().setCorrectionAssistant(correctionAssistant);
- }
-
- protected void initSourceViewer(StructuredTextViewer sourceViewer) {
- // ensure decoration support is configured
- getSourceViewerDecorationSupport(sourceViewer);
- fMouseTracker = new MouseTracker();
- fMouseTracker.start(sourceViewer.getTextWidget());
- initializeDrop(sourceViewer);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.editors.text.TextEditor#installEncodingSupport()
- */
- protected void installEncodingSupport() {
- // TODO: install our custom support that can
- // update document appropriately
- // super.installEncodingSupport();
- }
-
- /**
- * Install everything necessary to get document folding working and enable
- * document folding
- */
- private void installProjectionSupport() {
- ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
-
- fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors());
- fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$
- fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$
- fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- });
- fProjectionSupport.install();
-
- IStructuredTextFoldingProvider updater = null;
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- String[] ids = getConfigurationPoints();
- for (int i = 0; updater == null && i < ids.length; i++) {
- updater = (IStructuredTextFoldingProvider) builder.getConfiguration(IStructuredTextFoldingProvider.ID, ids[i]);
- }
-
- fProjectionModelUpdater = updater;
- if (fProjectionModelUpdater != null)
- fProjectionModelUpdater.install(projectionViewer);
-
- if (isFoldingEnabled())
- projectionViewer.doOperation(ProjectionViewer.TOGGLE);
- }
-
- /**
- * Return whether document folding should be enabled according to the
- * preference store settings.
- *
- * @return <code>true</code> if document folding should be enabled
- */
- private boolean isFoldingEnabled() {
- IPreferenceStore store = getPreferenceStore();
- // check both preference store and vm argument
- return (store.getBoolean(IStructuredTextFoldingProvider.FOLDING_ENABLED));
- }
-
- private void logUnexpectedDocumentKind(IEditorInput input) {
- // display a dialog informing user of uknown content type
- if (SSEUIPlugin.getDefault().getPreferenceStore().getBoolean(EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG)) {
- Job job = new UIJob(SSEUIMessages.StructuredTextEditor_0) {
- public IStatus runInUIThread(IProgressMonitor monitor) {
- UnknownContentTypeDialog dialog = new UnknownContentTypeDialog(getSite().getShell(), SSEUIPlugin.getDefault().getPreferenceStore(), EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG);
- dialog.open();
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
-
- Logger.log(Logger.WARNING, "StructuredTextEditor being used without StructuredDocument"); //$NON-NLS-1$
- String name = null;
- if (input != null) {
- name = input.getName();
- }
- else {
- name = "input was null"; //$NON-NLS-1$
- }
- Logger.log(Logger.WARNING, " Input Name: " + name); //$NON-NLS-1$
- String implClass = null;
- IDocument document = getDocumentProvider().getDocument(input);
- if (document != null) {
- implClass = document.getClass().getName();
- }
- else {
- implClass = "document was null"; //$NON-NLS-1$
- }
- Logger.log(Logger.WARNING, " Unexpected IDocumentProvider implementation: " + getDocumentProvider().getClass().getName()); //$NON-NLS-1$
- Logger.log(Logger.WARNING, " Unexpected IDocument implementation: " + implClass); //$NON-NLS-1$
- }
-
- /*
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert()
- */
- protected void performRevert() {
- ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
- projectionViewer.setRedraw(false);
- try {
-
- boolean projectionMode = projectionViewer.isProjectionMode();
- if (projectionMode) {
- projectionViewer.disableProjection();
- if (fProjectionModelUpdater != null)
- fProjectionModelUpdater.uninstall();
- }
-
- super.performRevert();
-
- if (projectionMode) {
- if (fProjectionModelUpdater != null)
- fProjectionModelUpdater.install(projectionViewer);
- projectionViewer.enableProjection();
- }
-
- }
- finally {
- projectionViewer.setRedraw(true);
- }
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * Not API. May be reduced to protected method in the future.
- * </p>
- */
- public void rememberSelection() {
- /*
- * This method was made public for use by editors that use
- * StructuredTextEditor (like some clients)
- */
- super.rememberSelection();
- }
-
-
- /**
- * both starts and resets the busy state timer
- */
- private void resetBusyState() {
- // reset the "busy" timeout
- if (fBusyTimer != null) {
- fBusyTimer.cancel();
- }
- startBusyTimer();
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * Not API. May be reduced to protected method in the future.
- * </p>
- */
- public void restoreSelection() {
- /*
- * This method was made public for use by editors that use
- * StructuredTextEditor (like some clients)
- */
- // catch odd case where source viewer has no text
- // widget (defect
- // 227670)
- if ((getSourceViewer() != null) && (getSourceViewer().getTextWidget() != null))
- super.restoreSelection();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#rulerContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
- */
- protected void rulerContextMenuAboutToShow(IMenuManager menu) {
- super.rulerContextMenuAboutToShow(menu);
-
- IMenuManager foldingMenu = new MenuManager(SSEUIMessages.Folding, "projection"); //$NON-NLS-1$
- menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, foldingMenu);
-
- IAction action = getAction("FoldingToggle"); //$NON-NLS-1$
- foldingMenu.add(action);
- action = getAction("FoldingExpandAll"); //$NON-NLS-1$
- foldingMenu.add(action);
- action = getAction("FoldingCollapseAll"); //$NON-NLS-1$
- foldingMenu.add(action);
-
- IStructuredModel internalModel = getInternalModel();
- if (internalModel != null) {
- boolean debuggingAvailable = BreakpointProviderBuilder.getInstance().isAvailable(internalModel.getContentTypeIdentifier(), BreakpointRulerAction.getFileExtension(getEditorInput()));
- if (debuggingAvailable) {
- // append actions to "debug" group (created in
- // AbstractDecoratedTextEditor.rulerContextMenuAboutToShow(IMenuManager)
- menu.appendToGroup("debug", getAction(ActionDefinitionIds.TOGGLE_BREAKPOINTS)); //$NON-NLS-1$
- menu.appendToGroup("debug", getAction(ActionDefinitionIds.MANAGE_BREAKPOINTS)); //$NON-NLS-1$
- menu.appendToGroup("debug", getAction(ActionDefinitionIds.EDIT_BREAKPOINTS)); //$NON-NLS-1$
- }
- addExtendedRulerContextMenuActions(menu);
- }
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * Overridden to expose part activation handling for multi-page editors.
- * </p>
- * <p>
- * Not API. May be reduced to protected method in the future.
- * </p>
- *
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#safelySanityCheckState(org.eclipse.ui.IEditorInput)
- */
- public void safelySanityCheckState(IEditorInput input) {
- super.safelySanityCheckState(input);
- }
-
- private void savedModel() {
- if (getInternalModel() != null) {
- getInternalModel().changedModel();
- }
- }
-
- /**
- * Ensure that the correct IDocumentProvider is used. For direct models, a
- * special provider is used. For StorageEditorInputs, use a custom
- * provider that creates a usable ResourceAnnotationModel. For everything
- * else, use the base support.
- *
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#setDocumentProvider(org.eclipse.ui.IEditorInput)
- */
- protected void setDocumentProvider(IEditorInput input) {
- if (input instanceof IStructuredModel) {
- // largely untested
- setDocumentProvider(StructuredModelDocumentProvider.getInstance());
- }
- else if (input instanceof IStorageEditorInput && !(input instanceof IFileEditorInput) && !(input instanceof IPathEditorInput)) {
- setDocumentProvider(StorageModelProvider.getInstance());
- }
- else {
- super.setDocumentProvider(input);
- }
- }
-
- /**
- * Set editor part associated with this editor.
- * <p>
- * Not API. May be removed in the future.
- * </p>
- *
- * @param editorPart
- * editor part associated with this editor
- */
- public void setEditorPart(IEditorPart editorPart) {
- fEditorPart = editorPart;
- }
-
- /**
- * Sets the model field within this editor.
- *
- * @deprecated - can eventually be eliminated
- */
- private void setModel(IStructuredModel newModel) {
- Assert.isNotNull(getDocumentProvider(), "document provider can not be null when setting model"); //$NON-NLS-1$
- if (fStructuredModel != null) {
- if (fStructuredModel.getStructuredDocument() != null) {
- fStructuredModel.getStructuredDocument().removeDocumentListener(getInternalDocumentListener());
- }
- fStructuredModel.removeModelStateListener(getInternalModelStateListener());
- }
- fStructuredModel = newModel;
- if (fStructuredModel != null) {
- if (fStructuredModel.getStructuredDocument() != null) {
- fStructuredModel.getStructuredDocument().addDocumentListener(getInternalDocumentListener());
- }
- fStructuredModel.addModelStateListener(getInternalModelStateListener());
- }
- // update() should be called whenever the model is
- // set or changed
- update();
- }
-
- /**
- * Sets the editor's source viewer configuration which it uses to
- * configure it's internal source viewer. This method was overwritten so
- * that viewer configuration could be set after editor part was created.
- */
- protected void setSourceViewerConfiguration(SourceViewerConfiguration config) {
- super.setSourceViewerConfiguration(config);
- StructuredTextViewer stv = getTextViewer();
- if (stv != null) {
- // there should be no need to unconfigure
- // before configure because
- // configure will
- // also unconfigure before configuring
- stv.unconfigure();
- stv.configure(config);
-
- // update source viewer's correction assistant as well
- IContentAssistant correctionAssistant = createCorrectionAssistant();
- stv.setCorrectionAssistant(correctionAssistant);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.WorkbenchPart#showBusy(boolean)
- */
- public void showBusy(boolean busy) {
- if (busy) {
- fRememberTitle = getPartName();
- // update title and/or fonts and/or background
- //
- // temp solution, for testing, uses "busy"
- setPartName(SSEUIMessages.busy); //$NON-NLS-1$
- }
- else {
- // reset to what it was
- setPartName(fRememberTitle);
- }
- }
-
- private void startBusyTimer() {
- // TODO: we need a resettable timer, so not so
- // many are created
- fBusyTimer = new Timer(true);
- fBusyTimer.schedule(new TimeOutExpired(), BUSY_STATE_DELAY);
- }
-
- /**
- * Update should be called whenever the model is set or changed (as in
- * swapped)
- * <p>
- * Not API. May be removed in the future.
- * </p>
- */
- public void update() {
- if (fOutlinePage != null && fOutlinePage instanceof ConfigurableContentOutlinePage) {
- ContentOutlineConfiguration cfg = createContentOutlineConfiguration();
- ((ConfigurableContentOutlinePage) fOutlinePage).setConfiguration(cfg);
- IStructuredModel internalModel = getInternalModel();
- ((ConfigurableContentOutlinePage) fOutlinePage).setInputContentTypeIdentifier(internalModel.getContentTypeIdentifier());
- ((ConfigurableContentOutlinePage) fOutlinePage).setInput(internalModel);
- }
- if (fPropertySheetPage != null && fPropertySheetPage instanceof ConfigurablePropertySheetPage) {
- PropertySheetConfiguration cfg = createPropertySheetConfiguration();
- ((ConfigurablePropertySheetPage) fPropertySheetPage).setConfiguration(cfg);
- }
- disposeModelDependentFields();
-
- fShowInTargetIds = createShowInTargetIds();
-
- updateSourceViewerConfiguration();
-
- if (fStructuredSelectionProvider != null) {
- fStructuredSelectionProvider.setDocument(getInternalModel().getStructuredDocument());
- }
-
- createModelDependentFields();
- }
-
- /**
- * Updates all content dependent actions.
- */
- protected void updateContentDependentActions() {
- super.updateContentDependentActions();
- // super.updateContentDependentActions only updates
- // the enable/disable
- // state of all
- // the content dependent actions.
- // StructuredTextEditor's undo and redo actions
- // have a detail label and
- // description.
- // They needed to be updated.
- if (!fEditorDisposed)
- updateMenuText();
- }
-
-
- /**
- * Updates the editor context menu by creating a new context menu with the
- * given menu id
- *
- * @param contextMenuId
- * Cannot be null
- */
- private void updateEditorContextMenuId(String contextMenuId) {
- // update editor context menu id if updating to a new id or if context
- // menu is not already set up
- if (!contextMenuId.equals(getEditorContextMenuId()) || (fTextContextMenu == null)) {
- setEditorContextMenuId(contextMenuId);
-
- if (getSourceViewer() != null) {
- StyledText styledText = getSourceViewer().getTextWidget();
- if (styledText != null) {
- // dispose of previous context menu
- if (fTextContextMenu != null) {
- fTextContextMenu.dispose();
- }
- if (fTextContextMenuManager != null) {
- fTextContextMenuManager.removeMenuListener(getContextMenuListener());
- fTextContextMenuManager.removeAll();
- fTextContextMenuManager.dispose();
- }
-
- fTextContextMenuManager = new MenuManager(getEditorContextMenuId(), getEditorContextMenuId());
- fTextContextMenuManager.setRemoveAllWhenShown(true);
- fTextContextMenuManager.addMenuListener(getContextMenuListener());
-
- fTextContextMenu = fTextContextMenuManager.createContextMenu(styledText);
- styledText.setMenu(fTextContextMenu);
-
- getSite().registerContextMenu(getEditorContextMenuId(), fTextContextMenuManager, getSelectionProvider());
-
- // also register this menu for source page part and
- // structured text editor ids
- String partId = getSite().getId();
- if (partId != null) {
- getSite().registerContextMenu(partId + EDITOR_CONTEXT_MENU_SUFFIX, fTextContextMenuManager, getSelectionProvider());
- }
- getSite().registerContextMenu(EDITOR_CONTEXT_MENU_ID, fTextContextMenuManager, getSelectionProvider());
- }
- }
- }
- }
-
- /**
- * Updates editor context menu, vertical ruler menu, help context id for
- * new content type
- *
- * @param contentType
- */
- private void updateEditorControlsForContentType(String contentType) {
- if (contentType == null) {
- updateEditorContextMenuId(EDITOR_CONTEXT_MENU_ID);
- updateRulerContextMenuId(RULER_CONTEXT_MENU_ID);
- updateHelpContextId(ITextEditorHelpContextIds.TEXT_EDITOR);
- }
- else {
- updateEditorContextMenuId(contentType + EDITOR_CONTEXT_MENU_SUFFIX);
- updateRulerContextMenuId(contentType + RULER_CONTEXT_MENU_SUFFIX);
- updateHelpContextId(contentType + "_source_HelpId"); //$NON-NLS-1$
- }
- }
-
- private void updateEncodingMemento() {
- boolean failed = false;
- IStructuredModel internalModel = getInternalModel();
- if (internalModel != null) {
- IStructuredDocument doc = internalModel.getStructuredDocument();
- EncodingMemento memento = doc.getEncodingMemento();
- IDocumentCharsetDetector detector = internalModel.getModelHandler().getEncodingDetector();
- if (memento != null && detector != null)
- detector.set(doc);
- try {
- detector.getEncoding();
- }
- catch (IOException e) {
- failed = true;
- }
- // be sure to use the new instance
- // but only if no exception occurred.
- // (we may find cases we need to do more error recover there)
- // should be near impossible to get IOException from processing
- // the
- // *document*
- if (!failed) {
- doc.setEncodingMemento(memento);
- }
- }
- }
-
- /**
- * Updates the help context of the editor with the given help context id
- *
- * @param helpContextId
- * Cannot be null
- */
- private void updateHelpContextId(String helpContextId) {
- if (!helpContextId.equals(getHelpContextId())) {
- setHelpContextId(helpContextId);
-
- if (getSourceViewer() != null) {
- StyledText styledText = getSourceViewer().getTextWidget();
- if (styledText != null) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- helpSystem.setHelp(styledText, getHelpContextId());
- }
- }
- }
- }
-
- /*
- * Update the hovering behavior depending on the preferences.
- */
- private void updateHoverBehavior() {
- SourceViewerConfiguration configuration = getSourceViewerConfiguration();
- String[] types = configuration.getConfiguredContentTypes(getSourceViewer());
-
- for (int i = 0; i < types.length; i++) {
-
- String t = types[i];
-
- ISourceViewer sourceViewer = getSourceViewer();
- if (sourceViewer instanceof ITextViewerExtension2) {
- // Remove existing hovers
- ((ITextViewerExtension2) sourceViewer).removeTextHovers(t);
-
- int[] stateMasks = configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);
-
- if (stateMasks != null) {
- for (int j = 0; j < stateMasks.length; j++) {
- int stateMask = stateMasks[j];
- ITextHover textHover = configuration.getTextHover(sourceViewer, t, stateMask);
- ((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, stateMask);
- }
- }
- else {
- ITextHover textHover = configuration.getTextHover(sourceViewer, t);
- ((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
- }
- }
- else
- sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
- }
- }
-
- private void updateMenuText() {
- if (fStructuredModel != null && !fStructuredModel.isModelStateChanging() && getTextViewer().getTextWidget() != null) {
- // performance: don't force an update of the action bars unless
- // required as it is expensive
- String previousUndoText = null;
- String previousUndoDesc = null;
- String previousRedoText = null;
- String previousRedoDesc = null;
- boolean updateActions = false;
- IAction undoAction = getAction(ITextEditorActionConstants.UNDO);
- IAction redoAction = getAction(ITextEditorActionConstants.REDO);
- if (undoAction != null) {
- previousUndoText = undoAction.getText();
- previousUndoDesc = undoAction.getDescription();
- updateActions = updateActions || previousUndoText == null || previousUndoDesc == null;
- undoAction.setText(UNDO_ACTION_TEXT_DEFAULT);
- undoAction.setDescription(UNDO_ACTION_DESC_DEFAULT);
- }
- if (redoAction != null) {
- previousRedoText = redoAction.getText();
- previousRedoDesc = redoAction.getDescription();
- updateActions = updateActions || previousRedoText == null || previousRedoDesc == null;
- redoAction.setText(REDO_ACTION_TEXT_DEFAULT);
- redoAction.setDescription(REDO_ACTION_DESC_DEFAULT);
- }
- if (fStructuredModel.getUndoManager() != null) {
- IStructuredTextUndoManager undoManager = fStructuredModel.getUndoManager();
- // get undo command
- Command undoCommand = undoManager.getUndoCommand();
- // set undo label and description
- undoAction.setEnabled(undoManager.undoable());
- if (undoCommand != null) {
- String label = undoCommand.getLabel();
- if (label != null) {
- String customText = MessageFormat.format(UNDO_ACTION_TEXT, new String[]{label});
- updateActions = updateActions || customText == null || previousUndoText == null || !customText.equals(previousUndoText);
- undoAction.setText(customText);
- }
- String desc = undoCommand.getDescription();
- if (desc != null) {
- String customDesc = MessageFormat.format(UNDO_ACTION_DESC, new String[]{desc});
- updateActions = updateActions || customDesc == null || previousRedoDesc == null || !customDesc.equals(previousUndoDesc);
- undoAction.setDescription(customDesc);
- }
- }
- // get redo command
- Command redoCommand = undoManager.getRedoCommand();
- // set redo label and description
- redoAction.setEnabled(undoManager.redoable());
- if (redoCommand != null) {
- String label = redoCommand.getLabel();
- if (label != null) {
- String customText = MessageFormat.format(REDO_ACTION_TEXT, new String[]{label});
- updateActions = updateActions || customText == null || previousRedoText == null || !customText.equals(previousRedoText);
- redoAction.setText(customText);
- }
- String desc = redoCommand.getDescription();
- if (desc != null) {
- String customDesc = MessageFormat.format(REDO_ACTION_DESC, new String[]{desc});
- updateActions = updateActions || customDesc == null || previousRedoDesc == null || !customDesc.equals(previousRedoDesc);
- redoAction.setDescription(customDesc);
- }
- }
- }
- // tell the action bars to update
- if (updateActions) {
- if (getEditorSite().getActionBars() != null) {
- getEditorSite().getActionBars().updateActionBars();
- }
- else if (getEditorPart() != null && getEditorPart().getEditorSite().getActionBars() != null) {
- getEditorPart().getEditorSite().getActionBars().updateActionBars();
- }
- }
- }
- }
-
- void updateRangeIndication(ISelection selection) {
- boolean rangeUpdated = false;
- if (selection instanceof IStructuredSelection && !((IStructuredSelection) selection).isEmpty()) {
- Object[] objects = ((IStructuredSelection) selection).toArray();
- if (objects.length > 0 && objects[0] instanceof IndexedRegion) {
- int start = ((IndexedRegion) objects[0]).getStartOffset();
- int end = ((IndexedRegion) objects[0]).getEndOffset();
- if (objects.length > 1) {
- for (int i = 1; i < objects.length; i++) {
- start = Math.min(start, ((IndexedRegion) objects[i]).getStartOffset());
- end = Math.max(end, ((IndexedRegion) objects[i]).getEndOffset());
- }
- }
- getSourceViewer().setRangeIndication(start, end - start, false);
- rangeUpdated = true;
- }
- }
- if (!rangeUpdated) {
- if (selection instanceof ITextSelection) {
- getSourceViewer().setRangeIndication(((ITextSelection) selection).getOffset(), ((ITextSelection) selection).getLength(), false);
- }
- else {
- getSourceViewer().removeRangeIndication();
- }
- }
- }
-
-
- /**
- * Updates the editor vertical ruler menu by creating a new vertical ruler
- * context menu with the given menu id
- *
- * @param rulerMenuId
- * Cannot be null
- */
- private void updateRulerContextMenuId(String rulerMenuId) {
- // update ruler context menu id if updating to a new id or if context
- // menu is not already set up
- if (!rulerMenuId.equals(getRulerContextMenuId()) || (fRulerContextMenu == null)) {
- setRulerContextMenuId(rulerMenuId);
-
- if (getVerticalRuler() != null) {
- // dispose of previous ruler context menu
- if (fRulerContextMenu != null) {
- fRulerContextMenu.dispose();
- }
- if (fRulerContextMenuManager != null) {
- fRulerContextMenuManager.removeMenuListener(getContextMenuListener());
- fRulerContextMenuManager.removeAll();
- fRulerContextMenuManager.dispose();
- }
-
- fRulerContextMenuManager = new MenuManager(getRulerContextMenuId(), getRulerContextMenuId());
- fRulerContextMenuManager.setRemoveAllWhenShown(true);
- fRulerContextMenuManager.addMenuListener(getContextMenuListener());
-
- Control rulerControl = getVerticalRuler().getControl();
- fRulerContextMenu = fRulerContextMenuManager.createContextMenu(rulerControl);
- rulerControl.setMenu(fRulerContextMenu);
-
- getSite().registerContextMenu(getRulerContextMenuId(), fRulerContextMenuManager, getSelectionProvider());
-
- // also register this menu for source page part and structured
- // text editor ids
- String partId = getSite().getId();
- if (partId != null) {
- getSite().registerContextMenu(partId + RULER_CONTEXT_MENU_SUFFIX, fRulerContextMenuManager, getSelectionProvider());
- }
- getSite().registerContextMenu(RULER_CONTEXT_MENU_ID, fRulerContextMenuManager, getSelectionProvider());
- }
- }
- }
-
- private void updateSourceViewerConfiguration() {
- SourceViewerConfiguration configuration = getSourceViewerConfiguration();
- // no need to update source viewer configuration if one does not exist
- // yet
- if (configuration == null) {
- return;
- }
- // do not configure source viewer configuration twice
- boolean configured = false;
-
- // structuredtextviewer only works with
- // structuredtextviewerconfiguration
- if (!(configuration instanceof StructuredTextViewerConfiguration)) {
- ConfigurationAndTarget cat = createSourceViewerConfiguration();
- fViewerConfigurationTargetId = cat.getTargetId();
- configuration = cat.getConfiguration();
- setSourceViewerConfiguration(configuration);
- configured = true;
- }
- else {
- ConfigurationAndTarget cat = createSourceViewerConfiguration();
- StructuredTextViewerConfiguration newViewerConfiguration = cat.getConfiguration();
- if (!(cat.getTargetId().equals(fViewerConfigurationTargetId))) {
- // d282894 use newViewerConfiguration
- fViewerConfigurationTargetId = cat.getTargetId();
- configuration = newViewerConfiguration;
- setSourceViewerConfiguration(configuration);
- configured = true;
- }
- }
-
- if (getSourceViewer() != null) {
- // not sure if really need to reconfigure when input changes
- // (maybe only need to reset viewerconfig's document)
- if (!configured)
- getSourceViewer().configure(configuration);
- IAction contentAssistAction = getAction(StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS);
- if (contentAssistAction instanceof IUpdate) {
- ((IUpdate) contentAssistAction).update();
- }
- IAction openHyperlinkAction = getAction(StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE);
- if (openHyperlinkAction instanceof OpenHyperlinkAction) {
- ((OpenHyperlinkAction) openHyperlinkAction).setHyperlinkDetectors(getSourceViewerConfiguration().getHyperlinkDetectors(getSourceViewer()));
- }
- }
- }
-
- protected void updateStatusField(String category) {
- super.updateStatusField(category);
-
- if (category == null)
- return;
-
- if (StructuredTextEditorActionConstants.STATUS_CATEGORY_OFFSET.equals(category)) {
- IStatusField field = getStatusField(category);
- if (field != null) {
- Point selection = getTextViewer().getTextWidget().getSelection();
- int offset1 = widgetOffset2ModelOffset(getSourceViewer(), selection.x);
- int offset2 = widgetOffset2ModelOffset(getSourceViewer(), selection.y);
- String text = null;
- if (offset1 != offset2)
- text = "[" + offset1 + "-" + offset2 + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- else
- text = "[ " + offset1 + " ]"; //$NON-NLS-1$ //$NON-NLS-2$
- field.setText(text == null ? fErrorLabel : text);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
deleted file mode 100644
index 5ca2617520..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerConfiguration.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.IUndoManager;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.formatter.IContentFormatter;
-import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter;
-import org.eclipse.jface.text.information.IInformationPresenter;
-import org.eclipse.jface.text.information.IInformationProvider;
-import org.eclipse.jface.text.information.InformationPresenter;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.reconciler.IReconciler;
-import org.eclipse.jface.text.source.IAnnotationHover;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
-import org.eclipse.ui.texteditor.ChainedPreferenceStore;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitioning;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.StructuredTextAnnotationHover;
-import org.eclipse.wst.sse.ui.internal.contentassist.StructuredContentAssistant;
-import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
-import org.eclipse.wst.sse.ui.internal.hyperlink.HighlighterHyperlinkPresenter;
-import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames;
-import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
-import org.eclipse.wst.sse.ui.internal.reconcile.StructuredRegionProcessor;
-import org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor;
-import org.eclipse.wst.sse.ui.internal.taginfo.BestMatchHover;
-import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
-import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
-
-
-/**
- * Configuration for the source viewer used by StructuredTextEditor.<br />
- * Note: While ISourceViewer is passed in for each get configuration, clients
- * should create a new viewer configuration instance for each instance of
- * source viewer as some methods return the same instance of an object,
- * regardless of the sourceviewer.
- * <p>
- * Clients should subclass and override just those methods which must be
- * specific to their needs.
- * </p>
- *
- * @see org.eclipse.wst.sse.ui.StructuredTextEditor
- * @see org.eclipse.wst.sse.ui.internal.StructuredTextViewer
- * @since 1.0
- */
-public class StructuredTextViewerConfiguration extends TextSourceViewerConfiguration {
- /*
- * One instance per configuration because creating a second assistant that
- * is added to a viewer can cause odd key-eating by the wrong one.
- */
- private StructuredContentAssistant fContentAssistant = null;
- /*
- * One instance per configuration
- */
- private IReconciler fReconciler;
-
-
- /**
- * Creates a structured text viewer configuration.
- */
- public StructuredTextViewerConfiguration() {
- super();
- // initialize fPreferenceStore with same preference store used in
- // StructuredTextEditor
- fPreferenceStore = createCombinedPreferenceStore();
- }
-
- /**
- * Create a preference store that combines the source editor preferences
- * with the base editor's preferences.
- *
- * @return IPreferenceStore
- */
- private IPreferenceStore createCombinedPreferenceStore() {
- IPreferenceStore sseEditorPrefs = SSEUIPlugin.getDefault().getPreferenceStore();
- IPreferenceStore baseEditorPrefs = EditorsUI.getPreferenceStore();
- return new ChainedPreferenceStore(new IPreferenceStore[]{sseEditorPrefs, baseEditorPrefs});
- }
-
- /**
- * Returns the annotation hover which will provide the information to be
- * shown in a hover popup window when requested for the given source
- * viewer.<br />
- * Note: Clients cannot override this method because this method returns a
- * specially configured Annotation Hover for the StructuredTextViewer.
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return an annotation hover specially configured for
- * StructuredTextViewer
- */
- final public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
- /*
- * This implmentation returns an annotation hover that works with
- * StructuredTextViewer and breakpoints. Important! must remember to
- * release it when done with it (during viewer.unconfigure)
- */
- return new StructuredTextAnnotationHover();
- }
-
- /**
- * Returns the configured partitioning for the given source viewer. The
- * partitioning is used when the querying content types from the source
- * viewer's input document.<br />
- * Note: Clients cannot override this method at this time.
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return the configured partitioning
- * @see #getConfiguredContentTypes(ISourceViewer)
- */
- final public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
- /*
- * This implementation returns default structured text partitioning
- */
- return IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING;
- }
-
- public int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType) {
- /*
- * This implementation returns configured text hover state masks for
- * StructuredTextViewers
- */
- TextHoverManager.TextHoverDescriptor[] hoverDescs = SSEUIPlugin.getDefault().getTextHoverManager().getTextHovers();
- int stateMasks[] = new int[hoverDescs.length];
- int stateMasksLength = 0;
- for (int i = 0; i < hoverDescs.length; i++) {
- if (hoverDescs[i].isEnabled()) {
- int j = 0;
- int stateMask = computeStateMask(hoverDescs[i].getModifierString());
- while (j < stateMasksLength) {
- if (stateMasks[j] == stateMask)
- break;
- j++;
- }
- if (j == stateMasksLength)
- stateMasks[stateMasksLength++] = stateMask;
- }
- }
- if (stateMasksLength == hoverDescs.length)
- return stateMasks;
-
- int[] shortenedStateMasks = new int[stateMasksLength];
- System.arraycopy(stateMasks, 0, shortenedStateMasks, 0, stateMasksLength);
- return shortenedStateMasks;
- }
-
- /**
- * Returns the content assistant ready to be used with the given source
- * viewer.<br />
- * Note: The same instance of IContentAssistant is returned regardless of
- * the source viewer passed in.
- * <p>
- * Clients cannot override this method. Instead, clients wanting to add
- * their own processors should override
- * <code>getContentAssistProcessors(ISourceViewer, String)</code>
- * </p>
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return a content assistant
- * @see #getContentAssistProcessors(ISourceViewer, String)
- */
- final public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- /*
- * Note: This method was made final so that StructuredContentAssist is
- * always used and content assist extension point always works.
- */
- if (fContentAssistant == null) {
- fContentAssistant = new StructuredContentAssistant();
-
- // content assistant configurations
- fContentAssistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
- fContentAssistant.enableAutoActivation(true);
- fContentAssistant.setAutoActivationDelay(500);
- fContentAssistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
- fContentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
- fContentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
-
- // add content assist processors for each partition type
- String[] types = getConfiguredContentTypes(sourceViewer);
- for (int i = 0; i < types.length; i++) {
- String type = types[i];
-
- // add all content assist processors for current partiton type
- IContentAssistProcessor[] processors = getContentAssistProcessors(sourceViewer, type);
- if (processors != null) {
- for (int j = 0; j < processors.length; j++) {
- fContentAssistant.setContentAssistProcessor(processors[j], type);
- }
- }
- }
- }
- return fContentAssistant;
- }
-
- /**
- * Returns the content assist processors that will be used for content
- * assist in the given source viewer and for the given partition type.
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @param partitionType
- * the partition type for which the content assist processors
- * are applicable
- * @return IContentAssistProcessors or null if should not be supported
- */
- protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
- return null;
- }
-
- /**
- * Returns the content formatter ready to be used with the given source
- * viewer.
- * <p>
- * It is not recommended that clients override this method as it may
- * become <code>final</code> in the future and replaced by an extensible
- * framework.
- * </p>
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return a content formatter or <code>null</code> if formatting should
- * not be supported
- */
- public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
- return null;
- }
-
- /**
- * Returns the hyperlink presenter for the given source viewer.<br />
- * Note: Clients cannot override this method because this method returns a
- * specially configured hyperlink presenter for the StructuredTextViewer.
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return a hyperlink presenter specially configured for
- * StructuredTextViewer
- */
- final public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer) {
- /*
- * This implementation returns a hyperlink presenter that uses
- * Highlither instead of PresentationReconciler
- */
- if (fPreferenceStore == null) {
- return super.getHyperlinkPresenter(sourceViewer);
- }
- return new HighlighterHyperlinkPresenter(fPreferenceStore);
- }
-
- /**
- * Returns the information control creator. The creator is a factory
- * creating information controls for the given source viewer.<br />
- * Note: Clients cannot override this method at this time.
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return the information control creator
- */
- final public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
- // used by hover help
- return new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, SWT.NONE, new HTMLTextPresenter(true));
- }
- };
- }
-
- /**
- * Returns the information presenter ready to be used with the given
- * source viewer.
- * <p>
- * Clients cannot override this method. Instead, clients wanting to add
- * their own information providers should override
- * <code>getInformationProvider(ISourceViewer, String)</code>
- * </p>
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return a content assistant
- * @see #getInformationProvider(ISourceViewer, String)
- */
- final public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer) {
- InformationPresenter presenter = new InformationPresenter(getInformationPresenterControlCreator(sourceViewer));
-
- // information presenter configurations
- presenter.setSizeConstraints(60, 10, true, true);
- presenter.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
-
- // add information providers for each partition type
- String[] types = getConfiguredContentTypes(sourceViewer);
- for (int i = 0; i < types.length; i++) {
- String type = types[i];
-
- IInformationProvider provider = getInformationProvider(sourceViewer, type);
- if (provider != null) {
- presenter.setInformationProvider(provider, type);
- }
- }
-
- return presenter;
- }
-
- /**
- * Returns the information provider that will be used for information
- * presentation in the given source viewer and for the given partition
- * type.
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @param partitionType
- * the partition type for which the information provider is
- * applicable
- * @return IInformationProvider or null if should not be supported
- */
- protected IInformationProvider getInformationProvider(ISourceViewer sourceViewer, String partitionType) {
- return null;
- }
-
- /**
- * Returns the information presenter control creator. The creator is a
- * factory creating the presenter controls for the given source viewer.
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return an information control creator
- */
- private IInformationControlCreator getInformationPresenterControlCreator(ISourceViewer sourceViewer) {
- return new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- int shellStyle = SWT.RESIZE | SWT.TOOL;
- int style = SWT.V_SCROLL | SWT.H_SCROLL;
- return new DefaultInformationControl(parent, shellStyle, style, new HTMLTextPresenter(false));
- }
- };
- }
-
- /**
- * Returns the line style providers that will be used for syntax
- * highlighting in the given source viewer.
- * <p>
- * Not fully API since return type LineStyleProvider is not API.
- * </p>
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @param partitionType
- * the partition type for which the lineStyleProviders are
- * applicable
- * @return LineStyleProvders or null if should not be supported
- */
- public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
- return null;
- }
-
- /**
- * StructuredTextViewer currently does not support presentation
- * reconciler, so clients cannot override this method to provide their own
- * presentation reconciler. <br />
- * See <code>getLineStyleProviders(ISourceViewer, String)</code> for
- * alternative way to provide highlighting information.
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return always returns null
- * @see #getLineStyleProviders(ISourceViewer, String)
- */
- final public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
- /*
- * This implementation returns null because StructuredTextViewer does
- * not use presentation reconciler
- */
- return null;
- }
-
- /**
- * Returns the reconciler ready to be used with the given source viewer.<br />
- * Note: The same instance of IReconciler is returned regardless of the
- * source viewer passed in.
- * <p>
- * Clients cannot override this method. Instead, clients wanting to add
- * their own reconciling strategy should use the
- * <code>org.eclipse.wst.sse.ui.extensions.sourcevalidation</code>
- * extension point.
- * </p>
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return a reconciler
- */
- final public IReconciler getReconciler(ISourceViewer sourceViewer) {
- boolean reconcilingEnabled = fPreferenceStore.getBoolean(CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS);
- if (sourceViewer == null || !reconcilingEnabled)
- return null;
-
- /*
- * Only create reconciler if sourceviewer is present
- */
- if (fReconciler == null && sourceViewer != null) {
- StructuredRegionProcessor reconciler = new StructuredRegionProcessor();
-
- // reconciler configurations
- reconciler.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
-
- fReconciler = reconciler;
- }
- return fReconciler;
- }
-
- public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
- ITextHover textHover = null;
-
- /*
- * Returns a default problem, annotation, and best match hover
- * depending on stateMask
- */
- TextHoverManager.TextHoverDescriptor[] hoverDescs = SSEUIPlugin.getDefault().getTextHoverManager().getTextHovers();
- int i = 0;
- while (i < hoverDescs.length && textHover == null) {
- if (hoverDescs[i].isEnabled() && computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
- String hoverType = hoverDescs[i].getId();
- if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
- textHover = new ProblemAnnotationHoverProcessor();
- else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType))
- textHover = new AnnotationHoverProcessor();
- else if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType))
- textHover = new BestMatchHover(null);
- }
- i++;
- }
- return textHover;
- }
-
- /**
- * Returns the undo manager for the given source viewer.<br />
- * Note: Clients cannot override this method because this method returns a
- * specially configured undo manager for the StructuredTextViewer.
- *
- * @param sourceViewer
- * the source viewer to be configured by this configuration
- * @return an undo manager specially configured for StructuredTextViewer
- */
- final public IUndoManager getUndoManager(ISourceViewer sourceViewer) {
- /*
- * This implementation returns an UndoManager that is used exclusively
- * in StructuredTextViewer
- */
- return new StructuredTextViewerUndoManager();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerUndoManager.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerUndoManager.java
deleted file mode 100644
index 33797c519c..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextViewerUndoManager.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.IUndoManager;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.undo.IStructuredTextUndoManager;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-
-
-/**
- * Undo manager exclusively for StructuredTextViewers ONLY. This undo manager
- * is aware that structured documents have their own undo manager. This
- * handles communication between IUndoManager and IStructuredTextUndoManager.
- */
-class StructuredTextViewerUndoManager implements IUndoManager {
- class UndoNotifier implements ISelectionChangedListener {
- public void selectionChanged(SelectionChangedEvent event) {
- if ((fUndoManager != null) && (event != null)) {
- if (event.getSelection() instanceof ITextSelection) {
- fUndoManager.forceEndOfPendingCommand(this, ((ITextSelection) event.getSelection()).getOffset(), ((ITextSelection) event.getSelection()).getLength());
- }
- }
- }
-
- }
-
- private StructuredTextViewer fTextViewer = null;
- private IStructuredTextUndoManager fUndoManager = null;
- private ISelectionChangedListener fUndoNotifier = new UndoNotifier();
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IUndoManager#beginCompoundChange()
- */
- public void beginCompoundChange() {
- // forward the request to the model-based undo manager
- if (fUndoManager != null)
- fUndoManager.beginRecording(fTextViewer);
- }
-
- /**
- * Associates a viewer to this undo manager and also attempts to get the
- * correct document-specific undo manager.
- *
- * @param viewer -
- * Assumes viewer instanceof StructuredTextViewer
- */
- public void connect(ITextViewer viewer) {
- // future_TODO could probably optimize this to check if already
- // connected to same viewer/undo manager, dont do anything
-
- // disconnect from any old manager/viewer
- disconnect();
-
- // connect to new viewer/undo manager
- fTextViewer = (StructuredTextViewer) viewer;
- IDocument doc = fTextViewer.getDocument();
- if (doc instanceof IStructuredDocument) {
- IStructuredDocument structuredDocument = (IStructuredDocument) doc;
- setDocument(structuredDocument);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IUndoManager#disconnect()
- */
- public void disconnect() {
- // disconnect the viewer from the undo manager
- if (fUndoManager != null) {
- fTextViewer.removeSelectionChangedListener(fUndoNotifier);
- fUndoManager.disconnect(fTextViewer);
- }
-
- // null out the viewer and undo manager
- fTextViewer = null;
- fUndoManager = null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IUndoManager#endCompoundChange()
- */
- public void endCompoundChange() {
- // forward the request to the model-based undo manager
- if (fUndoManager != null)
- fUndoManager.endRecording(fTextViewer);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IUndoManager#redo()
- */
- public void redo() {
- // forward the request to the model-based undo manager
- if (fUndoManager != null)
- fUndoManager.redo(fTextViewer);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IUndoManager#redoable()
- */
- public boolean redoable() {
- boolean canRedo = false;
-
- // forward the request to the model-based undo manager
- if (fUndoManager != null)
- canRedo = fUndoManager.redoable();
-
- return canRedo;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IUndoManager#reset()
- */
- public void reset() {
- // cannot really reset model-based undo manager because other clients
- // will be affected
- }
-
- /**
- * Disconnect from the old undo manager and connect to the undo manager
- * associated with the new document.
- *
- * @param document -
- * assumes document is not null
- */
- public void setDocument(IStructuredDocument document) {
- if (fUndoManager != null) {
- fTextViewer.removeSelectionChangedListener(fUndoNotifier);
- fUndoManager.disconnect(fTextViewer);
- }
-
- fUndoManager = document.getUndoManager();
- if (fUndoManager != null) {
- fUndoManager.connect(fTextViewer);
- fTextViewer.addSelectionChangedListener(fUndoNotifier);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IUndoManager#setMaximalUndoLevel(int)
- */
- public void setMaximalUndoLevel(int undoLevel) {
- // cannot really set maximal undo level on model-based undo manager
- // because other clients will be affected
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IUndoManager#undo()
- */
- public void undo() {
- // forward the request to the model-based undo manager
- if (fUndoManager != null)
- fUndoManager.undo(fTextViewer);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.IUndoManager#undoable()
- */
- public boolean undoable() {
- boolean canUndo = false;
-
- // forward the request to the model-based undo manager
- if (fUndoManager != null)
- canUndo = fUndoManager.undoable();
-
- return canUndo;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/AbstractDropAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/AbstractDropAction.java
deleted file mode 100644
index d1771aad77..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/AbstractDropAction.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
-
-/**
- */
-public abstract class AbstractDropAction implements IDropAction {
-
- /*
- * Replaces targetEditor's current selection by "text"
- */
- protected boolean insert(String text, IEditorPart targetEditor) {
- if (text == null || text.length() == 0) {
- return true;
- }
-
- ITextSelection textSelection = null;
- IDocument doc = null;
- ISelection selection = null;
-
- ISourceEditingTextTools tools = (ISourceEditingTextTools) targetEditor.getAdapter(ISourceEditingTextTools.class);
- if (tools != null) {
- doc = tools.getDocument();
- selection = tools.getSelection();
- }
-
- ITextEditor textEditor = null;
- if (targetEditor instanceof ITextEditor) {
- textEditor = (ITextEditor) targetEditor;
- }
- if (textEditor == null) {
- textEditor = (ITextEditor) ((IAdaptable) targetEditor).getAdapter(ITextEditor.class);
- }
- if (textEditor == null && tools != null && tools.getEditorPart() instanceof ITextEditor) {
- textEditor = (ITextEditor) tools.getEditorPart();
- }
- if (textEditor == null && tools != null && tools.getEditorPart() != null) {
- textEditor = (ITextEditor) tools.getEditorPart().getAdapter(ITextEditor.class);
- }
-
- if (selection == null && textEditor != null) {
- selection = textEditor.getSelectionProvider().getSelection();
- }
- if (doc == null && textEditor != null) {
- doc = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
- }
-
- if (selection instanceof ITextSelection) {
- textSelection = (ITextSelection) selection;
- try {
- doc.replace(textSelection.getOffset(), textSelection.getLength(), text);
- }
- catch (BadLocationException e) {
- return false;
- }
- }
- if (textEditor != null && textSelection != null) {
- ISelectionProvider sp = textEditor.getSelectionProvider();
- ITextSelection sel = new TextSelection(textSelection.getOffset(), text.length());
- sp.setSelection(sel);
- textEditor.selectAndReveal(sel.getOffset(), sel.getLength());
- }
-
- return true;
- }
-
- public boolean isSupportedData(Object data) {
- return true;
- }
-
- public abstract boolean run(DropTargetEvent event, IEditorPart targetEditor);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/CaretMediator.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/CaretMediator.java
deleted file mode 100644
index e78d4678a8..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/CaretMediator.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.wst.sse.core.internal.util.Debug;
-import org.eclipse.wst.sse.core.internal.util.Utilities;
-import org.eclipse.wst.sse.ui.internal.view.events.CaretEvent;
-import org.eclipse.wst.sse.ui.internal.view.events.ICaretListener;
-
-/**
- * Has the responsibility of listening for key events, and mouse events,
- * deciding if the caret has moved (without a text change), and if so, will
- * notify CaretListeners that the caret has moved. Objects which are
- * interested in ALL caret postion changes will also have to listen for
- * textChanged events.
- *
- * @deprecated - use base selection notification
- */
-public class CaretMediator implements Listener {
-
- class CaretMediatorListener implements KeyListener, MouseListener {
- public void keyPressed(KeyEvent e) {
- internalKeyPressed(e);
- }
-
- public void keyReleased(KeyEvent e) {
- internalKeyReleased(e);
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
- internalMouseDown(e);
- }
-
- public void mouseUp(MouseEvent e) {
- internalMouseUp(e);
- }
- }
-
- class RefreshDelayJob extends Job {
- private int fDelay = 0;
- RefreshDelayJob(int delay) {
- super(SSEUIMessages.caret_update); //$NON-NLS-1$
- setSystem(true);
- fDelay = delay;
- }
-
- /**
- * Setup a delayed CaretEvent firing
- */
- void touch() {
- cancel();
- schedule(fDelay);
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- handleEvent(null);
- return Status.OK_STATUS;
- }
- }
-
- RefreshDelayJob fDelayer = null;
- private static final int DELAY = 300;
-
- /** used just for debug print outs */
- private long endTime;
- private long startTime;
-
- protected ICaretListener[] fCaretListeners;
- protected CaretMediatorListener internalListener;
- protected StyledText textWidget;
-
- /**
- * CaretMediator constructor comment.
- */
- public CaretMediator() {
- super();
- }
-
- /**
- * CaretMediator constructor comment. Must always provide the widget its
- * supposed to listen to.
- */
- public CaretMediator(StyledText styledTextWidget) {
- this();
- setTextWidget(styledTextWidget);
- }
-
- public synchronized void addCaretListener(ICaretListener listener) {
- if (Debug.debugStructuredDocument) {
- System.out.println("CaretMediator::addCaretListener. Request to add an instance of " + listener.getClass() + " as a listener on caretlistner.");//$NON-NLS-2$//$NON-NLS-1$
- }
- // make sure listener is not already in listening array
- // (and if it is, print a warning to aid debugging, if needed)
-
- if (Utilities.contains(fCaretListeners, listener)) {
- if (Debug.displayWarnings) {
- System.out.println("CaretMediator::addCaretListener. listener " + listener + " was added more than once. ");//$NON-NLS-2$//$NON-NLS-1$
- }
- } else {
- if (Debug.debugStructuredDocument) {
- System.out.println("CaretMediator::addCaretListener. Adding an instance of " + listener.getClass() + " as a listener on caret mediator.");//$NON-NLS-2$//$NON-NLS-1$
- }
- int oldSize = 0;
- if (fCaretListeners != null) {
- // normally won't be null, but we need to be sure, for first
- // time through
- oldSize = fCaretListeners.length;
- }
- int newSize = oldSize + 1;
- ICaretListener[] newListeners = new ICaretListener[newSize];
- if (fCaretListeners != null) {
- System.arraycopy(fCaretListeners, 0, newListeners, 0, oldSize);
- }
- // add listener to last position
- newListeners[newSize - 1] = listener;
- //
- // now switch new for old
- fCaretListeners = newListeners;
-
- }
- }
-
- protected void fireCaretEvent(CaretEvent event) {
- if (fCaretListeners != null) {
- // we must assign listeners to local variable to be thread safe,
- // since the add and remove listner methods
- // can change this object's actual instance of the listener array
- // from another thread
- // (and since object assignment is atomic, we don't need to
- // synchronize
- ICaretListener[] holdListeners = fCaretListeners;
- //
- for (int i = 0; i < holdListeners.length; i++) {
- holdListeners[i].caretMoved(event);
- }
- }
- }
-
- public void handleEvent(Event e) {
- Display display = null;
-
- if (Debug.debugCaretMediator) {
- endTime = System.currentTimeMillis();
- System.out.println("Timer fired: " + (endTime - startTime)); //$NON-NLS-1$
- }
-
- // check if 'okToUse'
- if (textWidget != null && !textWidget.isDisposed()) {
- display = textWidget.getDisplay();
- if ((display != null) && (!display.isDisposed())) {
- display.asyncExec(new Runnable() {
- public void run() {
- if (textWidget != null && !textWidget.isDisposed()) {
- fireCaretEvent(new CaretEvent(textWidget, textWidget.getCaretOffset()));
- }
- }
- });
- }
- }
- }
-
- protected void internalKeyPressed(KeyEvent e) {
- fDelayer.cancel();
- }
-
- protected void internalKeyReleased(KeyEvent e) {
- switch (e.keyCode) {
- case SWT.ARROW_DOWN :
- case SWT.ARROW_UP :
- case SWT.ARROW_LEFT :
- case SWT.ARROW_RIGHT :
- case SWT.HOME :
- case SWT.END :
- case SWT.PAGE_DOWN :
- case SWT.PAGE_UP : {
- fDelayer.touch();
- break;
- }
- default : {
- // always update cursor postion, even during normal typing
- // (the logic may look funny, since we always to the same
- // thing, but we haven't always done the same thing, so I
- // wanted to leave that fact documented via code.)
- fDelayer.touch();
- }
- }
- }
-
- protected void internalMouseDown(MouseEvent e) {
- fDelayer.cancel();
- }
-
- protected void internalMouseUp(MouseEvent e) {
- // Note, even during a swipe select, when the mouse button goes up,
- // and the widget is
- // queried for the current caret postion, it always returns the
- // beginning of the selection,
- // which is desirable (at least for the known use of this feature,
- // which is to signal
- // that the property sheet can update itself.
- fDelayer.touch();
- }
-
- public void release() {
- fDelayer.cancel();
- if (textWidget != null && !textWidget.isDisposed()) {
- textWidget.removeKeyListener(internalListener);
- textWidget.removeMouseListener(internalListener);
- textWidget = null;
- }
- }
-
- public synchronized void removeCaretListener(ICaretListener listener) {
- if ((fCaretListeners != null) && (listener != null)) {
- // if its not in the listeners, we'll ignore the request
- if (Utilities.contains(fCaretListeners, listener)) {
- int oldSize = fCaretListeners.length;
- int newSize = oldSize - 1;
- ICaretListener[] newListeners = new ICaretListener[newSize];
- int index = 0;
- for (int i = 0; i < oldSize; i++) {
- if (fCaretListeners[i] == listener) { // ignore
- } else {
- // copy old to new if its not the one we are removing
- newListeners[index++] = fCaretListeners[i];
- }
- }
- // now that we have a new array, let's switch it for the old
- // one
- fCaretListeners = newListeners;
- }
- }
- }
-
- public void setTextWidget(StyledText newTextWidget) {
- if(fDelayer == null) {
- fDelayer = new RefreshDelayJob(DELAY);
- }
-
- // unhook from previous, if any
- if (this.textWidget != null) {
- fDelayer.cancel();
- this.textWidget.removeKeyListener(internalListener);
- this.textWidget.removeMouseListener(internalListener);
- }
-
- this.textWidget = newTextWidget;
-
- if (internalListener == null) {
- internalListener = new CaretMediatorListener();
- }
-
- if (this.textWidget != null) {
- this.textWidget.addKeyListener(internalListener);
- this.textWidget.addMouseListener(internalListener);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedConfigurationBuilder.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedConfigurationBuilder.java
deleted file mode 100644
index e28996bfeb..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedConfigurationBuilder.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.sse.ui.internal.extension.RegistryReader;
-import org.osgi.framework.Bundle;
-
-
-/**
- * Simple generic ID to class to mapping. Loads a specified class defined in a
- * configuration element with the matching type and target ID. Example
- * plugin.xml section:
- *
- * &lt;extension
- * point=&quot;org.eclipse.wst.sse.ui.editorConfiguration&quot;&gt;contentoutlineconfiguration
- * target=&quot;org.eclipse.wst.sse.dtd.core.dtdsource&quot;
- * class=&quot;org.eclipse.wst.sse.ui.dtd.views.contentoutline.DTDContentOutlineConfiguration&quot;/&gt;
- * &lt;/extension&gt;
- *
- * Used in code by getConfiguration(&quot;contentoutlineconfiguration&quot;,
- * &quot;org.eclipse.wst.dtd.ui.StructuredTextEditorDTD&quot;);
- *
- */
-public class ExtendedConfigurationBuilder extends RegistryReader {
- /**
- * Extension type to pass into getConfigurations to get content outline
- * configuration
- */
- public static final String CONTENTOUTLINECONFIGURATION = "contentOutlineConfiguration"; //$NON-NLS-1$
- /**
- * Extension type to pass into getConfigurations to get property sheet
- * configuration
- */
- public static final String PROPERTYSHEETCONFIGURATION = "propertySheetConfiguration"; //$NON-NLS-1$
- /**
- * Extension type to pass into getConfigurations to get source viewer
- * configuration
- */
- public static final String SOURCEVIEWERCONFIGURATION = "sourceViewerConfiguration"; //$NON-NLS-1$
-
- private static final String ATT_CLASS = "class"; //$NON-NLS-1$
- private static final String ATT_TARGET = "target"; //$NON-NLS-1$
- private static final String ATT_TYPE = "type"; //$NON-NLS-1$
- private static final String CONFIGURATION = "provisionalConfiguration"; //$NON-NLS-1$
- private static Map configurationMap = null;
- private final static boolean debugTime = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/extendedconfigurationbuilder/time")); //$NON-NLS-1$ //$NON-NLS-2$
- private static final String DEFINITION = "provisionalDefinition"; //$NON-NLS-1$
- private static final String EP_EXTENDEDCONFIGURATION = "editorConfiguration"; //$NON-NLS-1$
- private static ExtendedConfigurationBuilder instance = null;
- public static final String VALUE = "value"; //$NON-NLS-1$
-
- /**
- * Creates an extension. If the extension plugin has not been loaded a
- * busy cursor will be activated during the duration of the load.
- *
- * @param element
- * the config element defining the extension
- * @param classAttribute
- * the name of the attribute carrying the class
- * @returns the extension object if successful. If an error occurs when
- * createing executable extension, the exception is logged, and
- * null returned.
- */
- static Object createExtension(final IConfigurationElement element, final String classAttribute, final String targetID) {
- final Object[] result = new Object[1];
- String pluginId = element.getDeclaringExtension().getNamespace();
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle.getState() == Bundle.ACTIVE) {
- try {
- result[0] = element.createExecutableExtension(classAttribute);
- }
- catch (Exception e) {
- // catch and log ANY exception while creating the extension
- Logger.logException("error loading class " + classAttribute + " for " + targetID, e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = element.createExecutableExtension(classAttribute);
- }
- catch (Exception e) {
- // catch and log ANY exception from extension point
- Logger.logException("error loading class " + classAttribute + " for " + targetID, e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- });
- }
- return result[0];
- }
-
- public synchronized static ExtendedConfigurationBuilder getInstance() {
- if (instance == null)
- instance = new ExtendedConfigurationBuilder();
- return instance;
- }
-
- long time0 = 0;
-
- private ExtendedConfigurationBuilder() {
- super();
- }
-
- private List createConfigurations(List configurations, String extensionType, String targetID) {
- if (configurations == null)
- return new ArrayList(0);
- List result = new ArrayList(1);
- for (int i = 0; i < configurations.size(); i++) {
- IConfigurationElement element = (IConfigurationElement) configurations.get(i);
- if ((element.getName().equals(extensionType) || (element.getName().equals(CONFIGURATION) && extensionType.equals(element.getAttribute(ATT_TYPE))))) {
- String[] targets = StringUtils.unpack(element.getAttribute(ATT_TARGET));
- for (int j = 0; j < targets.length; j++) {
- if (targetID.equals(targets[j].trim())) {
- Object o = createExtension(element, ATT_CLASS, targetID);
- if (o != null) {
- result.add(o);
- }
- }
- }
- }
- }
- return result;
- }
-
- private IConfigurationElement[] findConfigurationElements(List configurations, String extensionType, String targetID) {
- if (configurations == null)
- return new IConfigurationElement[0];
- List result = new ArrayList(1);
- for (int i = 0; i < configurations.size(); i++) {
- IConfigurationElement element = (IConfigurationElement) configurations.get(i);
- if ((element.getName().equals(extensionType) || (element.getName().equals(DEFINITION) && extensionType.equals(element.getAttribute(ATT_TYPE))))) {
- String[] targets = StringUtils.unpack(element.getAttribute(ATT_TARGET));
- for (int j = 0; j < targets.length; j++) {
- if (targetID.equals(targets[j].trim())) {
- result.add(element);
- }
- }
- }
- }
- return (IConfigurationElement[]) result.toArray(new IConfigurationElement[0]);
- }
-
- /**
- * Returns a configuration for the given extensionType matching the
- * targetID, if one is available. If more than one configuration is
- * defined, the first one found is returned.
- *
- * @param extensionType
- * @param targetID
- * @return a configuration object, if one was defined
- */
- public Object getConfiguration(String extensionType, String targetID) {
- if (targetID == null || targetID.length() == 0)
- return null;
- List configurations = getConfigurations(extensionType, targetID);
- if (configurations.isEmpty())
- return null;
- return configurations.get(0);
- }
-
- /**
- * Returns all configurations for the given extensionType matching the
- * targetID, if any are available.
- *
- * @param extensionType
- * @param targetID
- * @return a List of configuration objects, which may or may not be empty
- */
- public List getConfigurations(String extensionType, String targetID) {
- if (targetID == null || targetID.length() == 0)
- return new ArrayList(0);
- if (configurationMap == null) {
- configurationMap = new HashMap(0);
- synchronized (configurationMap) {
- readRegistry(Platform.getExtensionRegistry(), SSEUIPlugin.ID, EP_EXTENDEDCONFIGURATION);
- if (debugTime) {
- System.out.println(getClass().getName() + "#readRegistry(): " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- time0 = System.currentTimeMillis();
- }
- }
- }
- List extensions = (List) configurationMap.get(extensionType);
- List configurations = createConfigurations(extensions, extensionType, targetID);
- if (debugTime) {
- if (!configurations.isEmpty())
- System.out.println(getClass().getName() + "#getConfiguration(" + extensionType + ", " + targetID + "): configurations loaded in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- else
- System.out.println(getClass().getName() + "#getConfiguration(" + extensionType + ", " + targetID + "): ran in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- return configurations;
- }
-
- /**
- * Returns all declared definitions for the given extensionType matching
- * the targetID, if any are available.
- *
- * @param extensionType
- * @param targetID
- * @return An array containing the definitions, empty if none were
- * declared
- */
- public String[] getDefinitions(String extensionType, String targetID) {
- if (targetID == null || targetID.length() == 0)
- return new String[0];
- if (debugTime) {
- time0 = System.currentTimeMillis();
- }
- if (configurationMap == null) {
- configurationMap = new HashMap(0);
- synchronized (configurationMap) {
- readRegistry(Platform.getExtensionRegistry(), SSEUIPlugin.ID, EP_EXTENDEDCONFIGURATION);
- if (debugTime) {
- System.out.println(getClass().getName() + "#readRegistry(): " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- time0 = System.currentTimeMillis();
- }
- }
- }
- List definitions = (List) configurationMap.get(extensionType);
- IConfigurationElement[] elements = findConfigurationElements(definitions, extensionType, targetID);
- String[] values = new String[elements.length];
- for (int i = 0; i < values.length; i++) {
- values[i] = elements[i].getAttribute(VALUE);
- }
- if (debugTime) {
- if (values.length > 0)
- System.out.println(getClass().getName() + "#getDefinitions(" + extensionType + ", " + targetID + "): definition loaded in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- else
- System.out.println(getClass().getName() + "#getDefinitions(" + extensionType + ", " + targetID + "): ran in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- return values;
- }
-
- protected boolean readElement(IConfigurationElement element) {
- String name = element.getName();
- if (name.equals(CONFIGURATION) || name.equals(DEFINITION))
- name = element.getAttribute(ATT_TYPE);
- List configurations = (List) configurationMap.get(name);
- if (configurations == null) {
- configurations = new ArrayList(1);
- configurationMap.put(name, configurations);
- }
- configurations.add(element);
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedEditorActionBuilder.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedEditorActionBuilder.java
deleted file mode 100644
index ef7f7455cb..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedEditorActionBuilder.java
+++ /dev/null
@@ -1,789 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.part.MultiPageEditorSite;
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.wst.sse.ui.internal.extension.ActionDescriptor;
-import org.eclipse.wst.sse.ui.internal.extension.IExtendedEditorActionProxyForDelayLoading;
-import org.eclipse.wst.sse.ui.internal.extension.RegistryReader;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
-
-
-/**
- * This class reads the registry for extensions that plug into 'editorActions'
- * extension point.
- */
-
-public class ExtendedEditorActionBuilder extends RegistryReader {
-
- public class ExtendedContributor implements IExtendedContributor, IMenuListener {
- private IExtendedSimpleEditor activeExtendedEditor = null;
-
- private List cache;
- private Map map = new HashMap();
- private IMenuManager menuBar = null;
-
- private Set menus = new HashSet();
-
- public ExtendedContributor(List cache) {
- this.cache = cache;
- }
-
- private IExtendedSimpleEditor computeExtendedEditor(final IEditorPart editor) {
- IExtendedSimpleEditor simpleEditor = null;
- if (editor instanceof IExtendedSimpleEditor) {
- simpleEditor = (IExtendedSimpleEditor) editor;
- }
- if (editor != null && simpleEditor == null) {
- final ISourceEditingTextTools tools = (ISourceEditingTextTools) editor.getAdapter(ISourceEditingTextTools.class);
- if (tools != null) {
- simpleEditor = new IExtendedSimpleEditor() {
- public int getCaretPosition() {
- return tools.getCaretOffset();
- }
-
- public IDocument getDocument() {
- return tools.getDocument();
- }
-
- public IEditorPart getEditorPart() {
- return tools.getEditorPart();
- }
-
- public Point getSelectionRange() {
- ITextSelection selection = tools.getSelection();
- return new Point(selection.getOffset(), selection.getOffset() + selection.getLength());
- }
-
- };
- }
- }
- return simpleEditor;
- }
-
- public void contributeToMenu(IMenuManager menu) {
- menuBar = menu;
- long time0 = System.currentTimeMillis();
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof IConfigurationElement) {
- IConfigurationElement menuElement = (IConfigurationElement) obj;
- if ((menuElement.getName()).equals(TAG_MENU)) {
- contributeMenu(menuElement, menu, true);
- if (debugMenu)
- System.out.println(getClass().getName() + "#contributeToMenu() added: " + menuElement.getAttribute(ATT_ID)); //$NON-NLS-1$
- }
- }
- else if (obj instanceof ActionDescriptor) {
- try {
- ActionDescriptor ad = (ActionDescriptor) obj;
- IMenuManager mm = contributeMenuAction(ad, menu, true, false);
- if (mm != null) {
- map.put(ad.getContributionItem(), mm);
- mm.addMenuListener(this);
- menus.add(mm);
- if (debugMenu)
- System.out.println(getClass().getName() + "#contributeToMenu() added: " + ad.getId()); //$NON-NLS-1$
- }
- }
- catch (Exception e) {
- Logger.logException("contributing to menu", e); //$NON-NLS-1$
- }
- }
- }
- if (debugContributeTime)
- System.out.println(getClass().getName() + "#contributeToMenu(): ran in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void contributeToPopupMenu(IMenuManager menu) {
- long time0 = System.currentTimeMillis();
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof IConfigurationElement) {
- IConfigurationElement menuElement = (IConfigurationElement) obj;
- if ((menuElement.getName()).equals(TAG_POPUPMENU)) {
- contributeMenu(menuElement, menu, true);
- }
- }
- else if (obj instanceof ActionDescriptor) {
- try {
- ActionDescriptor ad = (ActionDescriptor) obj;
- IAction a = ad.getAction();
- if (a instanceof IExtendedEditorAction) {
- // uncaught exceptions could cause the menu to not
- // be shown
- try {
- if (((ad.getPopupMenuPath() != null) || (ad.getPopupMenuGroup() != null)) && (a instanceof IExtendedEditorActionProxyForDelayLoading)) {
- ((IExtendedEditorActionProxyForDelayLoading)a).realize();
- }
-
- IExtendedEditorAction eea = (IExtendedEditorAction) a;
- eea.setActiveExtendedEditor(activeExtendedEditor);
- eea.update();
- if (eea.isVisible()) {
- IMenuManager parent = contributeMenuAction(ad, menu, true, true);
- if (debugPopup && parent != null)
- System.out.println(getClass().getName() + "#contributeToPopupMenu() added: " + ad.getId()); //$NON-NLS-1$
- }
- }
- catch (Exception e) {
- Logger.logException(e);
- }
-
- }
- else {
- IMenuManager parent = contributeMenuAction(ad, menu, true, true);
- if (debugPopup && parent != null)
- System.out.println(getClass().getName() + "#contributeToPopupMenu() added: " + ad.getId()); //$NON-NLS-1$
- }
- }
- catch (Exception e) {
- Logger.logException("contributing to popup", e); //$NON-NLS-1$
- }
- }
- }
- if (debugContributeTime)
- System.out.println(getClass().getName() + "#contributeToPopupMenu(): ran in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void contributeToStatusLine(IStatusLineManager manager) {
- // nothing from here
- }
-
- public void contributeToToolBar(IToolBarManager manager) {
- long time0 = System.currentTimeMillis();
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof ActionDescriptor) {
- try {
- ActionDescriptor ad = (ActionDescriptor) obj;
- IAction a = ad.getAction();
- if (a instanceof IExtendedEditorAction) {
- if (((ad.getToolbarPath() != null) || (ad.getToolbarGroup() != null)) && (a instanceof IExtendedEditorActionProxyForDelayLoading)) {
- ((IExtendedEditorActionProxyForDelayLoading)a).realize();
- }
- IExtendedEditorAction eea = (IExtendedEditorAction) a;
- eea.setActiveExtendedEditor(activeExtendedEditor);
- eea.update();
- if (eea.isVisible()) {
- boolean contributed = contributeToolbarAction(ad, manager, true);
- if (debugToolbar && contributed)
- System.out.println(getClass().getName() + "#contributeToToolBar() added: " + ad.getId()); //$NON-NLS-1$
- }
- else {
- if (debugToolbar)
- System.out.println(getClass().getName() + "#contributeToToolBar(): [skipped] " + ad.getId()); //$NON-NLS-1$
- }
- }
- else {
- boolean contributed = contributeToolbarAction(ad, manager, true);
- if (debugToolbar && contributed)
- System.out.println(getClass().getName() + "#contributeToToolBar() added: " + ad.getId()); //$NON-NLS-1$
- }
- }
- catch (Exception e) {
- Logger.logException("contributing to toolbar", e); //$NON-NLS-1$
- }
- }
- }
- if (debugContributeTime)
- System.out.println(getClass().getName() + "#contributeToToolBar(): ran in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public void dispose() {
- Iterator it = menus.iterator();
- while (it.hasNext()) {
- Object o = it.next();
- if (o instanceof IMenuManager) {
- ((IMenuManager) o).removeMenuListener(this);
- }
- }
- }
-
- public void init(IActionBars bars, IWorkbenchPage page) {
- // nothing from here
- }
-
- public void menuAboutToShow(IMenuManager menu) {
- // slows down the menu and interferes with it for other editors;
- // optimize on visibility
- IEditorSite site = null;
- boolean activeEditorIsVisible = false;
-
- if (activeExtendedEditor != null && activeExtendedEditor.getEditorPart() != null)
- site = activeExtendedEditor.getEditorPart().getEditorSite();
- if (site == null)
- return;
-
- // Eclipse bug 48784 - [MPE] ClassCast exception Workbench page
- // isPartVisiable for MultiPageSite
- if (site instanceof MultiPageEditorSite) {
- Object multiPageEditor = ((MultiPageEditorSite) site).getMultiPageEditor();
- activeEditorIsVisible = multiPageEditor.equals(site.getPage().getActiveEditor()) || multiPageEditor.equals(site.getPage().getActivePart());
- }
- else {
- activeEditorIsVisible = site.getWorkbenchWindow().getPartService().getActivePart().equals(activeExtendedEditor.getEditorPart());
- }
- // due to a delay class loading, don't return now
-// if (!activeEditorIsVisible)
-// return;
-
- IContributionItem[] items = menu.getItems();
- if (items == null || items.length == 0)
- return;
-
- for (int i = 0; i < items.length; ++i) {
- // add menu listener to submenu
- if (items[i] instanceof IMenuManager) {
- ((IMenuManager) items[i]).addMenuListener(this);
- menus.add(items[i]);
- }
- }
-
- Set keys = map.keySet();
- Iterator it = keys.iterator();
- boolean needActionContributionItemUpdate = false;
- while (it.hasNext()) {
- IContributionItem item = (IContributionItem) it.next();
- IMenuManager mm = (IMenuManager) map.get(item);
- if (menu.getId() != null && menu.getId().equals(mm.getId()) && item instanceof ActionContributionItem) {
- try {
- IAction action = ((ActionContributionItem) item).getAction();
-
- if (action instanceof IExtendedEditorActionProxyForDelayLoading) {
- IExtendedEditorActionProxyForDelayLoading eea = (IExtendedEditorActionProxyForDelayLoading)action;
- if (eea.isRealized() == false) {
- eea.realize();
- needActionContributionItemUpdate = true;
- }
- }
-
- if (activeEditorIsVisible || needActionContributionItemUpdate) {
- if (action instanceof IUpdate) {
- ((IUpdate) action).update();
- }
- }
-
- if (activeEditorIsVisible || needActionContributionItemUpdate) {
- boolean visible = true;
- if (action instanceof IExtendedEditorAction) {
- visible = ((IExtendedEditorAction) action).isVisible();
- }
- item.setVisible(visible);
- }
-
- if (needActionContributionItemUpdate) {
- ((ActionContributionItem)item).update();
- }
-
- }
- catch (Exception e) {
- Logger.logException("updating actions", e); //$NON-NLS-1$
- }
- }
- }
- if (activeEditorIsVisible || needActionContributionItemUpdate) {
- if (needActionContributionItemUpdate) {
- // the action is realized so that need to update the menu w/
- // force set to true
- menu.update(true);
- } else {
- menu.update(false);
- }
- }
- }
-
- public void setActiveEditor(IEditorPart editor) {
- activeExtendedEditor = computeExtendedEditor(editor);
- IKeyBindingService svc = (editor != null) ? editor.getEditorSite().getKeyBindingService() : null;
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof ActionDescriptor) {
- ActionDescriptor ad = (ActionDescriptor) obj;
- try {
- IAction action = ad.getAction();
- if (action instanceof IExtendedEditorAction) {
- ((IExtendedEditorAction) action).setActiveExtendedEditor(activeExtendedEditor);
- ((IExtendedEditorAction) action).update();
- // update visibility right now so that the menu
- // will show/hide properly
- if (!((IExtendedEditorAction) action).isVisible() && ad.getContributionItem() != null)
- ad.getContributionItem().setVisible(false);
- if (svc != null && action.getActionDefinitionId() != null) {
- svc.registerAction(action);
- }
- }
- }
- catch (Exception e) {
- Logger.logException("setting active editor on actions", e); //$NON-NLS-1$
- }
- }
- }
-
- if (menuBar != null && editor != null) {
- // Class clz = editor.getClass();
- // while (clz != null) {
- // if (clz.getName().equals(targetID)) {
- // contributeToMenu(menuBar);
- // break;
- // }
- // clz = clz.getSuperclass();
- // }
- if (targetIDs.contains(editor.getEditorSite().getId())) {
- contributeToMenu(menuBar);
- }
- }
-
- updateToolbarActions();
- }
-
- public void updateToolbarActions() {
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof ActionDescriptor) {
- try {
- ActionDescriptor ad = (ActionDescriptor) obj;
- if (ad.getToolbarPath() != null) {
- IAction action = ad.getAction();
- if (action instanceof IUpdate) {
- ((IUpdate) action).update();
- }
- }
- }
- catch (Exception e) {
- Logger.logException("updating toolbar actions", e); //$NON-NLS-1$
- }
- }
- }
- }
- }
-
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- public static final String ATT_LABEL = "label"; //$NON-NLS-1$
- public static final String ATT_NAME = "name"; //$NON-NLS-1$
- public static final String ATT_PATH = "path"; //$NON-NLS-1$
-
- public static final String ATT_TARGET_ID = "targetID"; //$NON-NLS-1$
- protected final static boolean debugContributeTime = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/extendededitoractionbuilder/contributetime")); //$NON-NLS-1$ //$NON-NLS-2$
-
- protected final static boolean debugMenu = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/extendededitoractionbuilder/debugmenu")); //$NON-NLS-1$ //$NON-NLS-2$;
- protected final static boolean debugPopup = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/extendededitoractionbuilder/debugpopup")); //$NON-NLS-1$ //$NON-NLS-2$;
- protected final static boolean debugReadTime = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/extendededitoractionbuilder/readtime")); //$NON-NLS-1$ //$NON-NLS-2$
- protected final static boolean debugToolbar = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/extendededitoractionbuilder/debugtoolbar")); //$NON-NLS-1$ //$NON-NLS-2$;
-
- private static final String EXTENDED_EDITOR = "extendedEditor"; //$NON-NLS-1$
-
- public static final String PL_EXTENDED_EDITOR_ACTIONS = "extendedEditorActions"; //$NON-NLS-1$
-
- public static final String PLUGIN_ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
- public static final String TAG_ACTION = "action"; //$NON-NLS-1$
-
- public static final String TAG_CONTRIBUTION_TYPE = "editorContribution"; //$NON-NLS-1$
-
- public static final String TAG_MENU = "menu"; //$NON-NLS-1$
- public static final String TAG_POPUPMENU = "popupmenu"; //$NON-NLS-1$
- public static final String TAG_RULERMENU = "rulermenu"; //$NON-NLS-1$
- public static final String TAG_SEPARATOR = "separator"; //$NON-NLS-1$
-
- protected List readingCache;
-
- protected String targetContributionTag;
- protected List targetIDs;
-
- /**
- * The constructor.
- */
- public ExtendedEditorActionBuilder() {
- super();
- }
-
- /**
- * Creates a menu from the information in the menu configuration element
- * and adds it into the provided menu manager. If 'appendIfMissing' is
- * true, and menu path slot is not found, it will be created and menu will
- * be added into it. Otherwise, add operation will fail.
- */
- protected void contributeMenu(IConfigurationElement menuElement, IMenuManager mng, boolean appendIfMissing) {
- // Get config data.
- String id = menuElement.getAttribute(ATT_ID);
- String label = menuElement.getAttribute(ATT_LABEL);
- String path = menuElement.getAttribute(ATT_PATH);
- if (label == null) {
- Logger.log(Logger.ERROR, "Invalid Menu Extension (label == null): " + id); //$NON-NLS-1$
- return;
- }
-
- // Calculate menu path and group.
- String group = null;
- if (path != null) {
- int loc = path.lastIndexOf('/');
- if (loc != -1) {
- group = path.substring(loc + 1);
- path = path.substring(0, loc);
- }
- else {
- // assume that path represents a slot
- // so actual path portion should be null
- group = path;
- path = null;
- }
- }
-
- // Find parent menu.
- IMenuManager parent = mng;
- if (path != null) {
- parent = mng.findMenuUsingPath(path);
- if (parent == null) {
- // Logger.log("Invalid Menu Extension (Path is invalid): " +
- // id);//$NON-NLS-1$
- return;
- }
- // IMenuManager.findMenuUsingPath() returns invisible menu item if
- // the manager can't find
- // the specified path and create new MenuManager for it.
- // I don't know this is a specification or bug.
- // Anyway, to ensure the menu can be visible, setVisible(true)
- // needs to be called.
- parent.setVisible(true);
- }
-
- // Find reference group.
- if (group == null)
- group = IWorkbenchActionConstants.MB_ADDITIONS;
- IContributionItem sep = parent.find(group);
- if (sep == null) {
- if (appendIfMissing)
- parent.add(new Separator(group));
- else {
- Logger.log(Logger.ERROR, "Invalid Menu Extension (Group is invalid): " + id); //$NON-NLS-1$
- return;
- }
- }
-
- // If the menu does not exist create it.
- IMenuManager newMenu = parent.findMenuUsingPath(id);
- if (newMenu == null)
- newMenu = new MenuManager(label, id);
-
- // Create separators.
- IConfigurationElement[] children = menuElement.getChildren(TAG_SEPARATOR);
- for (int i = 0; i < children.length; i++) {
- contributeSeparator(newMenu, children[i]);
- }
-
- // Add new menu
- try {
- parent.insertAfter(group, newMenu);
- }
- catch (IllegalArgumentException e) {
- Logger.log(Logger.ERROR, "Invalid Menu Extension (Group is missing): " + id); //$NON-NLS-1$
- }
- }
-
- /**
- * Contributes action from action descriptor into the provided menu
- * manager.
- */
- protected IMenuManager contributeMenuAction(ActionDescriptor ad, IMenuManager menu, boolean appendIfMissing, boolean popupmenu) {
- if (ad.getContributionItem() == null || ad.getAction() == null)
- return null;
-
- // Get config data.
- String mpath = popupmenu ? ad.getPopupMenuPath() : ad.getMenuPath();
- String mgroup = popupmenu ? ad.getPopupMenuGroup() : ad.getMenuGroup();
- if (mpath == null && mgroup == null)
- return null;
-
- // Find parent menu.
- IMenuManager parent = menu;
- if (mpath != null) {
- parent = parent.findMenuUsingPath(mpath);
- if (parent == null) {
- // Logger.log("Invalid Menu Extension (Path is invalid): " +
- // ad.getId()); //$NON-NLS-1$
- return null;
- }
- // IMenuManager.findMenuUsingPath() returns invisible menu item if
- // the manager can't find
- // the specified path and create new MenuManager for it.
- // I don't know this is a specification or bug.
- // Anyway, to ensure the menu can be visible, setVisible(true)
- // needs to be called.
- parent.setVisible(true);
- }
-
- // First remove existing menu item
- IContributionItem item = parent.find(ad.getId());
- if (item != null) {
- parent.remove(ad.getId());
- }
-
- // Find reference group.
- if (mgroup == null)
- mgroup = IWorkbenchActionConstants.MB_ADDITIONS;
- IContributionItem sep = parent.find(mgroup);
- if (sep == null) {
- if (appendIfMissing)
- parent.add(sep = new Separator(mgroup));
- else {
- Logger.log(Logger.ERROR, "Invalid Menu Extension (Group is invalid): " + ad.getId()); //$NON-NLS-1$
- return null;
- }
- }
-
- // Add action.
- try {
- if (popupmenu) {
- // Context menu need a newly created contribution item
- if (sep != null && sep.isGroupMarker())
- parent.appendToGroup(sep.getId(), ad.getAction());
- else
- parent.insertAfter(mgroup, ad.getAction());
- }
- else {
- // Normal menu need to add existing contribution item to
- // remove it from menu listener
- if (sep != null && sep.isGroupMarker())
- parent.appendToGroup(sep.getId(), ad.getContributionItem());
- else
- parent.insertAfter(mgroup, ad.getContributionItem());
- }
- }
- catch (IllegalArgumentException e) {
- Logger.log(Logger.ERROR, "Invalid Menu Extension (Group is missing): " + ad.getId()); //$NON-NLS-1$
- parent = null;
- }
-
- return parent;
- }
-
- /**
- * Creates a named menu separator from the information in the
- * configuration element. If the separator already exists do not create a
- * second.
- */
- protected boolean contributeSeparator(IMenuManager menu, IConfigurationElement element) {
- String id = element.getAttribute(ATT_NAME);
- if (id == null || id.length() <= 0)
- return false;
- IContributionItem sep = menu.find(id);
- if (sep != null)
- return false;
- menu.add(new Separator(id));
- return true;
- }
-
- /**
- * Contributes action from the action descriptor into the provided tool
- * bar manager.
- */
- protected boolean contributeToolbarAction(ActionDescriptor ad, IToolBarManager toolbar, boolean appendIfMissing) {
- if (ad.getContributionItem() == null || ad.getAction() == null)
- return false;
-
- // Get config data.
- String tpath = ad.getToolbarPath();
- String tgroup = ad.getToolbarGroup();
- if (tpath == null && tgroup == null)
- return false;
-
- // First remove existing toolbar item
- IContributionItem item = toolbar.find(ad.getId());
- if (item != null) {
- toolbar.remove(ad.getId());
- }
-
- // Find reference group.
- if (tgroup == null)
- tgroup = IWorkbenchActionConstants.MB_ADDITIONS;
- IContributionItem sep = toolbar.find(tgroup);
- if (sep == null) {
- if (appendIfMissing)
- toolbar.add(new Separator(tgroup));
- else {
- Logger.log(Logger.ERROR, "Invalid Toolbar Extension (Group is invalid): " + ad.getId()); //$NON-NLS-1$
- return false;
- }
- }
-
- // Add action to tool bar.
- try {
- if (sep != null && sep.isGroupMarker())
- toolbar.appendToGroup(sep.getId(), ad.getAction());
- else
- toolbar.insertAfter(tgroup, ad.getAction());
- }
- catch (IllegalArgumentException e) {
- Logger.log(Logger.ERROR, "Invalid Toolbar Extension (Group is missing): " + ad.getId()); //$NON-NLS-1$
- return false;
- }
- return true;
- }
-
- /**
- * This factory method returns a new ActionDescriptor for the
- * configuration element. It should be implemented by subclasses.
- */
- protected ActionDescriptor createActionDescriptor(IConfigurationElement element) {
- ActionDescriptor ad = null;
- try {
- ad = new ActionDescriptor(element);
- // these cases like "class not found" are handled
- // at lower level, so no action if formed. In that
- // case, we also don't want to form an action descriptor.
- if ((ad != null) && (ad.getAction() == null)) {
- ad = null;
- }
- }
- catch (Exception e) {
- Logger.traceException(EXTENDED_EDITOR, e);
- ad = null;
- }
- return ad;
- }
-
- /**
- * Returns the name of the part ID attribute that is expected in the
- * target extension.
- */
- protected String getTargetID(IConfigurationElement element) {
- String value = element.getAttribute(ATT_TARGET_ID);
- return value != null ? value : "???"; //$NON-NLS-1$
- }
-
- /**
- * Reads editor contributor if specified directly in the 'editor'
- * extension point, and all external contributions for this editor's ID
- * registered in 'editorActions' extension point.
- */
- public IExtendedContributor readActionExtensions(String editorId) {
- return readActionExtensions(new String[]{editorId});
- }
-
- /**
- * Reads editor contributor if specified directly in the 'editor'
- * extension point, and all external contributions for this editor's ID
- * registered in 'editorActions' extension point.
- */
- public IExtendedContributor readActionExtensions(String[] ids) {
- long time0 = System.currentTimeMillis();
- ExtendedContributor ext = null;
- readContributions(ids, TAG_CONTRIBUTION_TYPE, PL_EXTENDED_EDITOR_ACTIONS);
- if (debugReadTime) {
- String idlist = ""; //$NON-NLS-1$
- if (ids.length > 0) {
- for (int i = 0; i < ids.length; i++) {
- idlist += ids[i];
- if (i < ids.length - 1)
- idlist += ","; //$NON-NLS-1$
- }
- }
- System.out.println(getClass().getName() + "#readActionExtensions(" + idlist + "): read in " + (System.currentTimeMillis() - time0) + "ms [" + (readingCache != null ? readingCache.size() : 0) + " contributions]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- if (readingCache != null) {
- ext = new ExtendedContributor(readingCache);
- readingCache = null;
- }
- return ext;
- }
-
- /**
- * Reads the contributions from the registry for the provided workbench
- * part and the provided extension point IDs.
- */
- protected void readContributions(String[] ids, String tag, String extensionPoint) {
- readingCache = null;
- targetIDs = Arrays.asList(ids);
- targetContributionTag = tag;
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, PLUGIN_ID, extensionPoint);
- }
-
- /**
- * Implements abstract method to handle the provided XML element in the
- * registry.
- */
- protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
- if (tag.equals(targetContributionTag)) {
- String id = getTargetID(element);
- if (id == null || !targetIDs.contains(id)) {
- // This is not of interest to us - don't go deeper
- return true;
- }
- }
- else if (tag.equals(TAG_MENU)) {
- if (readingCache == null)
- readingCache = new ArrayList();
- readingCache.add(element);
- return true; // just cache the element - don't go into it
- }
- else if (tag.equals(TAG_POPUPMENU)) {
- if (readingCache == null)
- readingCache = new ArrayList();
- readingCache.add(element);
- return true; // just cache the element - don't go into it
- }
- else if (tag.equals(TAG_RULERMENU)) {
- if (readingCache == null)
- readingCache = new ArrayList();
- readingCache.add(element);
- return true; // just cache the element - don't go into it
- }
- else if (tag.equals(TAG_ACTION)) {
- if (readingCache == null)
- readingCache = new ArrayList();
- ActionDescriptor ad = createActionDescriptor(element);
- if (ad != null)
- readingCache.add(ad);
- return true; // just cache the action - don't go into
- }
- else {
- return false;
- }
-
- readElementChildren(element);
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedEditorDropTargetAdapter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedEditorDropTargetAdapter.java
deleted file mode 100644
index a425c2e2c3..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ExtendedEditorDropTargetAdapter.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension5;
-import org.eclipse.swt.custom.ST;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Caret;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.sse.ui.internal.TransferBuilder.TransferProxyForDelayLoading;
-
-/**
- * ExtendedEditorDropTargetAdapter
- */
-public class ExtendedEditorDropTargetAdapter extends DropTargetAdapter {
-
- private Point caret = null;
- private String[] editorIds;
- private int orgOffset = 0;
- private IEditorPart targetEditor = null;
- private ITextViewer textViewer = null;
-
- private Transfer[] transfers = null;
-
- private boolean useProxy;
-
- /**
- * @deprecated use ExtendedEditorDropTargetAdapter(boolean useProxy) for
- * the performance
- */
- public ExtendedEditorDropTargetAdapter() {
- this(false);
- }
-
- public ExtendedEditorDropTargetAdapter(boolean useProxy) {
- super();
- this.useProxy = useProxy;
- }
-
- protected boolean doDrop(Transfer transfer, DropTargetEvent event) {
- TransferBuilder tb = new TransferBuilder(useProxy);
-
- IDropAction[] as = null;
- if (editorIds != null && editorIds.length > 0)
- as = tb.getDropActions(editorIds, transfer);
- else
- as = tb.getDropActions(getTargetEditor().getClass().getName(), transfer);
-
- for (int i = 0; i < as.length; ++i) {
- IDropAction da = as[i];
- Transfer actualTransfer;
- if (transfer instanceof TransferProxyForDelayLoading) {
- actualTransfer = ((TransferProxyForDelayLoading) transfer).getTransferClass();
- }
- else {
- actualTransfer = transfer;
- }
- if (actualTransfer instanceof FileTransfer) {
- if (event.data == null) {
- Logger.log(Logger.ERROR, "No data in DropTargetEvent from " + event.widget); //$NON-NLS-1$
- return false;
- }
- String[] strs = (String[]) event.data;
- boolean[] bs = new boolean[strs.length];
- int c = 0;
- for (int j = 0; j < strs.length; ++j) {
- bs[j] = false;
- if (da.isSupportedData(strs[j])) {
- event.data = new String[]{strs[j]};
- if (!da.run(event, targetEditor)) {
- bs[j] = true;
- c++;
- }
- }
- else {
- bs[j] = true;
- c++;
- }
- }
- if (c == 0) {
- return true;
- }
-
- int k = 0;
- String[] rests = new String[c];
- for (int j = 0; j < strs.length; ++j) {
- if (bs[j])
- rests[k++] = strs[j];
- }
- event.data = rests;
- }
- else if (da.isSupportedData(event.data)) {
- if (da.run(event, targetEditor)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- */
- public void dragEnter(DropTargetEvent event) {
- caret = null;
- TransferData data = null;
- Transfer[] ts = getTransfers();
- for (int i = 0; i < ts.length; i++) {
- for (int j = 0; j < event.dataTypes.length; j++) {
- if (ts[i].isSupportedType(event.dataTypes[j])) {
- data = event.dataTypes[j];
- break;
- }
- }
- if (data != null) {
- event.currentDataType = data;
- break;
- }
- }
-
- if (textViewer != null) {
- orgOffset = textViewer.getTextWidget().getCaretOffset();
- }
- }
-
- public void dragLeave(DropTargetEvent event) {
- if (textViewer != null) {
- StyledText st = textViewer.getTextWidget();
- st.setCaretOffset(orgOffset);
- st.redraw();
- st.update();
- }
- }
-
- /**
- */
- public void dragOver(DropTargetEvent event) {
- event.operations &= ~DND.DROP_MOVE;
- event.detail = DND.DROP_COPY;
-
- if (textViewer != null) {
- Point pt = toControl(new Point(event.x, event.y));
- StyledText st = textViewer.getTextWidget();
-
- // auto scroll
- Rectangle ca = st.getClientArea();
- int margin = st.getLineHeight();
-
- if (pt.y < margin) { // up
- st.invokeAction(ST.LINE_UP);
- }
- else if (pt.y > ca.height - margin) { // down
- st.invokeAction(ST.LINE_DOWN);
- }
-
- // draw insertion point
- int offset = getDropOffset(st, pt);
- if (offset != st.getCaretOffset()) {
- st.setCaretOffset(offset);
- st.setSelection(offset);
- }
-
- Point newCaret = st.getLocationAtOffset(offset);
- if (newCaret.equals(caret))
- return;
-
- Caret ct = st.getCaret();
- Point size = ct.getSize();
-
- GC gc = new GC(st);
- gc.setLineWidth(size.x);
-
- // erase old caret
- if (caret != null) {
- Color originalForeground = gc.getForeground();
- gc.setForeground(st.getBackground());
- gc.drawRectangle(caret.x, caret.y, size.x, size.y);
- gc.setForeground(originalForeground);
- }
-
- st.redraw();
- st.update();
-
- // draw new caret
- caret = newCaret;
- if (ct.getImage() != null)
- gc.drawImage(ct.getImage(), caret.x, caret.y);
- else {
- gc.drawLine(caret.x, caret.y, caret.x, caret.y + size.y);
- }
-
- gc.dispose();
- }
- }
-
- /**
- */
- public void drop(DropTargetEvent event) {
- if (event.operations == DND.DROP_NONE)
- return;
-
- if (textViewer != null) {
- Point pt = toControl(new Point(event.x, event.y));
- StyledText st = textViewer.getTextWidget();
-
- int offset = getDropOffset(st, pt);
- if (offset != st.getCaretOffset()) {
- st.setCaretOffset(offset);
- }
-
- // ISelectionProvider sp = textViewer.getSelectionProvider();
- // ISelection sel = new TextSelection(offset, 0);
- // sp.setSelection(sel);
- // BUG145392 - need to account for folded regions
- if (textViewer instanceof ITextViewerExtension5) {
- offset = ((ITextViewerExtension5) textViewer).widgetOffset2ModelOffset(offset);
- }
- textViewer.setSelectedRange(offset, 0);
- }
-
- Transfer[] ts = getTransfers();
- for (int i = 0; i < ts.length; i++) {
- if (ts[i].isSupportedType(event.currentDataType)) {
- if (doDrop(ts[i], event)) {
- break;
- }
- }
- }
- }
-
- protected int getDropOffset(DropTargetEvent event) {
- Point pt = getTextViewer().getTextWidget().toControl(new Point(event.x, event.y));
- StyledText st = textViewer.getTextWidget();
- return getDropOffset(st, pt);
- }
-
- private int getDropOffset(StyledText st, Point pt) {
- int offset = st.getCaretOffset();
- try {
- offset = st.getOffsetAtLocation(pt);
- }
- catch (IllegalArgumentException e) {
- // This is normal case if mouse cursor is on outside of valid
- // text.
- boolean found = false;
- Point p = new Point((pt.x > 0 ? pt.x : 0), pt.y);
- // search nearest character
- for (; p.x > -1; p.x--) {
- try {
- offset = st.getOffsetAtLocation(p);
-
- /*
- * Now that a valid offset has been found, try to place at
- * the end of the line
- */
- /*
- * partial line folding invalidates any "move to EOL"
- * action we might take
- */
- // if (textViewer != null && textViewer.getDocument() !=
- // null) {
- // IRegion lineInfo = null;
- // try {
- // if (textViewer instanceof ITextViewerExtension5) {
- // lineInfo =
- // textViewer.getDocument().getLineInformationOfOffset(((ITextViewerExtension5)textViewer).widgetOffset2ModelOffset(offset));
- // }
- // else {
- // lineInfo =
- // textViewer.getDocument().getLineInformationOfOffset(offset);
- // }
- // } catch (BadLocationException e1) {
- // }
- // if (lineInfo != null)
- // offset = lineInfo.getOffset() + lineInfo.getLength();
- // }
- found = true;
- break;
- }
- catch (IllegalArgumentException ex) {
- }
- }
-
- if (!found) {
- offset = st.getCharCount();
- }
- }
- return offset;
- }
-
- public IEditorPart getTargetEditor() {
- return targetEditor;
- }
-
- public ITextViewer getTextViewer() {
- return textViewer;
- }
-
- /**
- * @return org.eclipse.swt.dnd.Transfer[]
- */
- public Transfer[] getTransfers() {
- if (transfers == null) {
- TransferBuilder tb = new TransferBuilder(useProxy);
- if (editorIds == null || editorIds.length == 0)
- transfers = tb.getDropTargetTransfers(getTargetEditor().getClass().getName());
- else
- transfers = tb.getDropTargetTransfers(editorIds);
- }
- return transfers;
- }
-
- /**
- */
- public void setTargetEditor(IEditorPart targetEditor) {
- this.targetEditor = targetEditor;
- }
-
- public void setTargetIDs(String[] ids) {
- editorIds = ids;
- }
-
- public void setTextViewer(ITextViewer textViewer) {
- this.textViewer = textViewer;
- }
-
- private Point toControl(Point point) {
- return (textViewer != null ? textViewer.getTextWidget().toControl(point) : point);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/FileDropAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/FileDropAction.java
deleted file mode 100644
index c8a3b31e52..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/FileDropAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Action for file drop
- */
-public class FileDropAction extends AbstractDropAction {
- public boolean run(DropTargetEvent event, IEditorPart targetEditor) {
- String[] strs = (String[]) event.data;
- if (strs == null || strs.length == 0) {
- return false;
- }
-
- String str = ""; //$NON-NLS-1$
- for (int i = 0; i < strs.length; ++i) {
- IPath path = new Path(strs[i]);
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IFile file = root.getFileForLocation(path);
- if (file != null) {
- path = file.getProjectRelativePath();
- }
-
- str += "\"" + path.toString() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- return insert(str, targetEditor);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/FormatProcessorsExtensionReader.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/FormatProcessorsExtensionReader.java
deleted file mode 100644
index 78badf8e51..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/FormatProcessorsExtensionReader.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.wst.sse.core.internal.format.IStructuredFormatProcessor;
-import org.eclipse.wst.sse.ui.internal.extension.RegistryReader;
-import org.osgi.framework.Bundle;
-
-public class FormatProcessorsExtensionReader extends RegistryReader {
- private static FormatProcessorsExtensionReader instance;
-
- public synchronized static FormatProcessorsExtensionReader getInstance() {
- if (instance == null) {
- instance = new FormatProcessorsExtensionReader();
-
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- instance.readRegistry(registry, "org.eclipse.wst.sse.core", "formatProcessors"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return instance;
- }
-
- private Map map = new HashMap();
-// TODO: private field never read locally
- String processorClassName;
-
- public IStructuredFormatProcessor getFormatProcessor(String contentTypeId) {
- if (contentTypeId == null)
- return null;
-
- IStructuredFormatProcessor formatProcessor = null;
- if (map.containsKey(contentTypeId)) {
- formatProcessor = (IStructuredFormatProcessor) map.get(contentTypeId);
- } else {
- IContentTypeManager manager = Platform.getContentTypeManager();
- IContentType queryContentType = manager.getContentType(contentTypeId);
- boolean found = false;
- for (Iterator iter = map.keySet().iterator(); iter.hasNext();) {
- String elementContentTypeId = (String) iter.next();
- IContentType elementContentType = manager.getContentType(elementContentTypeId);
- if (queryContentType.isKindOf(elementContentType)) {
- formatProcessor = (IStructuredFormatProcessor) map.get(elementContentTypeId);
- map.put(contentTypeId, formatProcessor);
- found = true;
- break;
- }
- }
-
- if (!found)
- map.put(contentTypeId, null);
- }
-
- return formatProcessor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.internal.extension.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals("processor")) { //$NON-NLS-1$
- String contentTypeId = element.getAttribute("contentTypeId"); //$NON-NLS-1$
- String processorClassName = element.getAttribute("class"); //$NON-NLS-1$
- String pluginID = element.getDeclaringExtension().getNamespace();
- Bundle bundle = Platform.getBundle(pluginID);
-
- try {
- IStructuredFormatProcessor processor = (IStructuredFormatProcessor)bundle.loadClass(processorClassName).newInstance();
- map.put(contentTypeId, processor);
-
- return true;
- } catch (InstantiationException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- }
-
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/GotoAnnotationAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/GotoAnnotationAction.java
deleted file mode 100644
index e3eded857a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/GotoAnnotationAction.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.part.EditorActionBarContributor;
-import org.eclipse.ui.texteditor.AnnotationPreference;
-import org.eclipse.ui.texteditor.IEditorStatusLine;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
-import org.eclipse.ui.texteditor.TextEditorAction;
-
-/**
- * Based on org.eclipse.jdt.internal.ui.javaeditor.GotoAnnotationAction and
- * the org.eclipse.jdt.internal.ui.JavaEditor's gotoError() method. Rewritten
- * based on 3.0M7 version to operate generically.
- *
- * @deprecated - use org.eclipse.ui.texteditor.GotoAnnotationAction
- *
- */
-public class GotoAnnotationAction extends TextEditorAction {
-
- private static final boolean _debug = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/gotoNextAnnotation")); //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Clears the status line on selection changed.
- */
- protected class StatusLineClearer implements ISelectionChangedListener {
- IStatusLineManager fStatusLineManager = null;
-
- protected StatusLineClearer(IStatusLineManager mgr) {
- super();
- fStatusLineManager = mgr;
- }
-
- /*
- * @see ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- getTextEditor().getSelectionProvider().removeSelectionChangedListener(StatusLineClearer.this);
-
- fStatusLineManager.setErrorMessage(null, null);
- fStatusLineManager.setMessage(null, null);
- }
- }
-
- private boolean fForward;
- private String fLabel;
-
- private String fPrefix;
-
- /**
- * @param prefix
- * @param editor
- */
- public GotoAnnotationAction(String prefix, boolean forward) {
- super(SSEUIMessages.getResourceBundle(), prefix, null);
- fForward = forward;
- fPrefix = prefix;
- fLabel = SSEUIMessages.getResourceBundle().getString(fPrefix);
- }
-
- /*
- * This is the default label used for description
- */
- public String getDefaultLabel() {
- return fLabel;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.Action#getDescription()
- */
- public String getDescription() {
- return getDefaultLabel();
- }
-
- /**
- * Returns the annotation closest to the given range respecting the given
- * direction. If an annotation is found, the annotations current position
- * is copied into the provided annotation position.
- *
- * @param offset
- * the region offset
- * @param length
- * the region length
- * @param forward
- * <code>true</code> for forwards, <code>false</code> for
- * backward
- * @param annotationPosition
- * the position of the found annotation
- * @return the found annotation
- */
- protected Annotation getNextAnnotation(final int offset, final int length, boolean forward, Position annotationPosition) {
- Annotation nextAnnotation = null;
- Position nextAnnotationPosition = null;
- Annotation containingAnnotation = null;
- Position containingAnnotationPosition = null;
- boolean currentAnnotation = false;
-
- IDocument document = getTextEditor().getDocumentProvider().getDocument(getTextEditor().getEditorInput());
- int endOfDocument = document.getLength();
- int distance = Integer.MAX_VALUE;
-
- IAnnotationModel model = getTextEditor().getDocumentProvider().getAnnotationModel(getTextEditor().getEditorInput());
- // external files may not have an annotation model
- if (model != null) {
- Iterator e = model.getAnnotationIterator();
- while (e.hasNext()) {
- Annotation a = (Annotation) e.next();
- if (!isNavigationTarget(a))
- continue;
-
- Position p = model.getPosition(a);
- if (p == null)
- continue;
-
- if (forward && p.offset == offset || !forward && p.offset + p.getLength() == offset + length) {
- if (containingAnnotation == null || (forward && p.length >= containingAnnotationPosition.length || !forward && p.length >= containingAnnotationPosition.length)) {
- containingAnnotation = a;
- containingAnnotationPosition = p;
- currentAnnotation = p.length == length;
- }
- }
- else {
- int currentDistance = 0;
-
- if (forward) {
- currentDistance = p.getOffset() - offset;
- if (currentDistance < 0) {
- currentDistance = endOfDocument + currentDistance;
- }
-
- if (currentDistance < distance || currentDistance == distance && p.length < nextAnnotationPosition.length) {
- distance = currentDistance;
- nextAnnotation = a;
- nextAnnotationPosition = p;
- }
- }
- else {
- currentDistance = offset + length - (p.getOffset() + p.length);
- if (currentDistance < 0)
- currentDistance = endOfDocument + currentDistance;
-
- if (currentDistance < distance || currentDistance == distance && p.length < nextAnnotationPosition.length) {
- distance = currentDistance;
- nextAnnotation = a;
- nextAnnotationPosition = p;
- }
- }
- }
- }
- }
- if (containingAnnotationPosition != null && (!currentAnnotation || nextAnnotation == null)) {
- annotationPosition.setOffset(containingAnnotationPosition.getOffset());
- annotationPosition.setLength(containingAnnotationPosition.getLength());
- return containingAnnotation;
- }
- if (nextAnnotationPosition != null) {
- annotationPosition.setOffset(nextAnnotationPosition.getOffset());
- annotationPosition.setLength(nextAnnotationPosition.getLength());
- }
-
- return nextAnnotation;
- }
-
- private IStatusLineManager getStatusLineManager() {
- // The original JavaEditor M7 implementation made use of an adapter,
- // but that approach
- // fails with a MultiPageEditorSite
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return null;
- IWorkbenchPage page = window.getActivePage();
- if (page == null)
- return null;
- IEditorPart editor = page.getActiveEditor();
- if (editor == null)
- return null;
- IEditorActionBarContributor contributor = editor.getEditorSite().getActionBarContributor();
- if (contributor instanceof EditorActionBarContributor) {
- return ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager();
- }
- return null;
- }
-
- public String getText() {
- return getDefaultLabel();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.Action#getToolTipText()
- */
- public String getToolTipText() {
- return getDefaultLabel();
- }
-
- /**
- * Jumps to the error next according to the given direction based off
- * JavaEditor#gotoAnnotation()
- *
- * @param forward
- * is the direction
- */
- public void gotoAnnotation(boolean forward) {
- ITextSelection selection = (ITextSelection) getTextEditor().getSelectionProvider().getSelection();
- Position position = new Position(0, 0);
- if (false /* delayed - see bug 18316 */) {
- getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
- getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
- }
- else /* no delay - see bug 18316 */{
- Annotation annotation = getNextAnnotation(selection.getOffset(), selection.getLength(), forward, position);
- IEditorStatusLine editorStatusLine = (IEditorStatusLine) getTextEditor().getAdapter(IEditorStatusLine.class);
- if (editorStatusLine != null) {
- editorStatusLine.setMessage(true, null, null);
- editorStatusLine.setMessage(false, null, null);
- }
- else {
- IStatusLineManager mgr = getStatusLineManager();
- if (mgr != null) {
- mgr.setErrorMessage(null);
- mgr.setMessage(null, null);
- }
- }
- if (annotation != null) {
- updateAnnotationViews(annotation);
- if (_debug) {
- System.out.println("select and reveal " + annotation.getType() + "@" + position.getOffset() + ":" + position.getLength()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- getTextEditor().selectAndReveal(position.getOffset(), position.getLength());
- if (editorStatusLine != null) {
- editorStatusLine.setMessage(true, null, null);
- editorStatusLine.setMessage(false, annotation.getText(), null);
- }
- else {
- IStatusLineManager mgr = getStatusLineManager();
- if (mgr != null) {
- mgr.setErrorMessage(null);
- mgr.setMessage(null, annotation.getText());
- }
- getTextEditor().getSelectionProvider().addSelectionChangedListener(new StatusLineClearer(mgr));
- }
- }
- }
- }
-
- /**
- * Returns whether the given annotation is configured as a target for the
- * "Go to Next/Previous Annotation" actions
- *
- * @param annotation
- * the annotation
- * @return <code>true</code> if this is a target, <code>false</code>
- * otherwise
- * @see Eclipse 3.0
- */
- protected boolean isNavigationTarget(Annotation annotation) {
- Preferences preferences = EditorsUI.getPluginPreferences();
- AnnotationPreference preference = EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
- // See bug 41689
- // String key= forward ? preference.getIsGoToNextNavigationTargetKey()
- // : preference.getIsGoToPreviousNavigationTargetKey();
- String key = preference == null ? null : preference.getIsGoToNextNavigationTargetKey();
- return (key != null && preferences.getBoolean(key));
- }
-
- public void run() {
- gotoAnnotation(fForward);
- }
-
- public void setEditor(ITextEditor editor) {
- super.setEditor(editor);
- update();
- }
-
- /**
- * Updates the annotation views that show the given annotation.
- *
- * @param annotation
- * the annotation
- */
- protected void updateAnnotationViews(Annotation annotation) {
- IMarker marker = null;
- if (annotation instanceof MarkerAnnotation)
- marker = ((MarkerAnnotation) annotation).getMarker();
-
- if (marker != null) {
- try {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IViewPart view = null;
- if (marker.isSubtypeOf(IMarker.PROBLEM)) {
- view = page.findView(IPageLayout.ID_PROBLEM_VIEW);
- }
- else if (marker.isSubtypeOf(IMarker.TASK)) {
- view = page.findView(IPageLayout.ID_TASK_LIST);
- }
- else if (marker.isSubtypeOf(IMarker.BOOKMARK)) {
- view = page.findView(IPageLayout.ID_BOOKMARKS);
- }
- // If the view isn't open on this perspective, don't
- // interact with it
- if (view != null) {
- Method method = view.getClass().getMethod("setSelection", new Class[]{IStructuredSelection.class, boolean.class}); //$NON-NLS-1$
- if (method != null) {
- method.invoke(view, new Object[]{new StructuredSelection(marker), Boolean.TRUE});
- page.bringToTop(view);
- }
- }
- }
- }
- }
- // ignore exceptions, don't update any of the lists, just set
- // statusline
- catch (CoreException x) {
- //
- }
- catch (NoSuchMethodException x) {
- //
- }
- catch (IllegalAccessException x) {
- //
- }
- catch (InvocationTargetException x) {
- //
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IActionValidator.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IActionValidator.java
deleted file mode 100644
index 81d6eaa666..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IActionValidator.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-public interface IActionValidator {
- boolean isValidAction();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IDropAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IDropAction.java
deleted file mode 100644
index ac2a70bd35..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IDropAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.ui.IEditorPart;
-
-/**
- */
-public interface IDropAction {
-
-
- /**
- * @param data
- * DropTargetEvent.data will be passed.
- * @return boolean true for supported data type
- */
- public boolean isSupportedData(Object data);
-
- /**
- * @return boolean true for the action is actually processed false for the
- * action is not processed.
- */
- public boolean run(DropTargetEvent event, IEditorPart targetEditor);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedContributor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedContributor.java
deleted file mode 100644
index 6839ff1702..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedContributor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.ui.IEditorActionBarContributor;
-
-public interface IExtendedContributor extends IEditorActionBarContributor, IPopupMenuContributor {
- public void contributeToMenu(IMenuManager menu);
-
- public void contributeToStatusLine(IStatusLineManager manager);
-
- public void contributeToToolBar(IToolBarManager manager);
-
- public void updateToolbarActions();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedEditorAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedEditorAction.java
deleted file mode 100644
index 7347734b4a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedEditorAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import org.eclipse.ui.texteditor.IUpdate;
-
-public interface IExtendedEditorAction extends IUpdate {
-
- /**
- * Returns whether this action item is visible
- *
- * @return <code>true</code> if this item is visible, and
- * <code>false</code> otherwise
- */
- public boolean isVisible();
-
- /**
- * Sets the active editor for the action. Implementors should disconnect
- * from the old editor, connect to the new editor, and update the action
- * to reflect the new editor.
- *
- * @param targetEditor
- * the new editor target
- */
- public void setActiveExtendedEditor(IExtendedSimpleEditor targetEditor);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedMarkupEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedMarkupEditor.java
deleted file mode 100644
index e35eaa5eaf..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedMarkupEditor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import java.util.List;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * IExtendedMarkupEditor
- *
- * @deprecated use the editor's ISourceEditingTextTools adapter and cast to
- * IDOMSourceEditingTextTools when appropriate
- */
-public interface IExtendedMarkupEditor {
-
- /**
- * @deprecated - use the IDOMSourceEditingTextTools.getNode(int) method
- * with ISourceEditingTextTools.getCaretOffset()
- * @return
- */
- public Node getCaretNode();
-
- /**
- * @deprecated - use method on IDOMSourceEditingTextTools
- */
- public Document getDOMDocument();
-
- /**
- * @deprecated - some editors will provide the list of selected nodes as
- * part of ISourceEditingTextTools.getSelection()
- */
- public List getSelectedNodes();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedSimpleEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedSimpleEditor.java
deleted file mode 100644
index d93ad56abf..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IExtendedSimpleEditor.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-/**
- * @deprecated, obtain a ISourceEditingTextTools adapter from the editor part
- */
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.IEditorPart;
-
-public interface IExtendedSimpleEditor {
-
- public int getCaretPosition();
-
- public IDocument getDocument();
-
- public IEditorPart getEditorPart();
-
- public Point getSelectionRange();
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IModelProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IModelProvider.java
deleted file mode 100644
index 5a7d73986b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IModelProvider.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-
-
-public interface IModelProvider extends IDocumentProvider {
- IStructuredModel getModel(Object element);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IPopupMenuContributor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IPopupMenuContributor.java
deleted file mode 100644
index dfe5190805..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IPopupMenuContributor.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import org.eclipse.jface.action.IMenuManager;
-
-public interface IPopupMenuContributor {
-
- public void contributeToPopupMenu(IMenuManager menu);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IReleasable.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IReleasable.java
deleted file mode 100644
index 5806815fcc..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/IReleasable.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-public interface IReleasable {
- /**
- * Generic catch-all for releasing resources and other references
- */
- void release();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ISourceViewerActionBarContributor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ISourceViewerActionBarContributor.java
deleted file mode 100644
index 04255823c7..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ISourceViewerActionBarContributor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import org.eclipse.ui.IEditorActionBarContributor;
-
-public interface ISourceViewerActionBarContributor extends IEditorActionBarContributor {
-
- /**
- * Enables disables actions that are specific to the source viewer (and
- * should only work when the source viewer is enabled)
- *
- * @param enabled
- * true if source viewer is currently enabled, false otherwise
- */
- public void setViewerSpecificContributionsEnabled(boolean enabled);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ITemporaryAnnotation.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ITemporaryAnnotation.java
deleted file mode 100644
index fc256319cf..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ITemporaryAnnotation.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-public interface ITemporaryAnnotation {
- Object getKey();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/Logger.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/Logger.java
deleted file mode 100644
index 06265e4e63..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/Logger.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.Bundle;
-
-/**
- * Small convenience class to log messages to plugin's log file and also, if
- * desired, the console. This class should only be used by classes in this
- * plugin. Other plugins should make their own copy, with appropriate ID.
- */
-public class Logger {
- private static final String PLUGIN_ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
-
- public static final int ERROR = IStatus.ERROR; // 4
- public static final int ERROR_DEBUG = 200 + ERROR;
- public static final int INFO = IStatus.INFO; // 1
- public static final int INFO_DEBUG = 200 + INFO;
-
- public static final int OK = IStatus.OK; // 0
-
- public static final int OK_DEBUG = 200 + OK;
-
- private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
- public static final int WARNING = IStatus.WARNING; // 2
- public static final int WARNING_DEBUG = 200 + WARNING;
-
- /**
- * Adds message to log.
- *
- * @param level
- * severity level of the message (OK, INFO, WARNING, ERROR,
- * OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG)
- * @param message
- * text to add to the log
- * @param exception
- * exception thrown
- */
- protected static void _log(int level, String message, Throwable exception) {
- if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) {
- if (!isDebugging())
- return;
- }
-
- int severity = IStatus.OK;
- switch (level) {
- case INFO_DEBUG :
- case INFO :
- severity = IStatus.INFO;
- break;
- case WARNING_DEBUG :
- case WARNING :
- severity = IStatus.WARNING;
- break;
- case ERROR_DEBUG :
- case ERROR :
- severity = IStatus.ERROR;
- }
- message = (message != null) ? message : "null"; //$NON-NLS-1$
- Status statusObj = new Status(severity, PLUGIN_ID, severity, message, exception);
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- if (bundle != null)
- Platform.getLog(bundle).log(statusObj);
-
- }
-
- /**
- * Prints message to log if category matches /debug/tracefilter option.
- *
- * @param message
- * text to print
- * @param category
- * category of the message, to be compared with
- * /debug/tracefilter
- */
- protected static void _trace(String category, String message, Throwable exception) {
- if (isTracing(category)) {
- message = (message != null) ? message : "null"; //$NON-NLS-1$
- Status statusObj = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK, message, exception);
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- if (bundle != null)
- Platform.getLog(bundle).log(statusObj);
-
- }
- }
-
- /**
- * @return true if the platform is debugging
- */
- public static boolean isDebugging() {
- return Platform.inDebugMode();
- }
-
- /**
- * Determines if currently tracing a category
- *
- * @param category
- * @return true if tracing category, false otherwise
- */
- public static boolean isTracing(String category) {
- if (!isDebugging())
- return false;
-
- String traceFilter = Platform.getDebugOption(PLUGIN_ID + TRACEFILTER_LOCATION);
- if (traceFilter != null) {
- StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String cat = tokenizer.nextToken().trim();
- if (category.equals(cat)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public static void log(int level, String message) {
- _log(level, message, null);
- }
-
- public static void log(int level, String message, Throwable exception) {
- _log(level, message, exception);
- }
-
- public static void logException(String message, Throwable exception) {
- _log(ERROR, message, exception);
- }
-
- public static void logException(Throwable exception) {
- _log(ERROR, exception.getMessage(), exception);
- }
-
- public static void trace(String category, String message) {
- _trace(category, message, null);
- }
-
- public static void traceException(String category, String message, Throwable exception) {
- _trace(category, message, exception);
- }
-
- public static void traceException(String category, Throwable exception) {
- _trace(category, exception.getMessage(), exception);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java
deleted file mode 100644
index 61b56d9265..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/PreferenceInitializer.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
-import org.eclipse.wst.sse.ui.internal.projection.IStructuredTextFoldingProvider;
-import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames;
-
-
-public class PreferenceInitializer extends AbstractPreferenceInitializer {
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- public void initializeDefaultPreferences() {
- IPreferenceStore store = SSEUIPlugin.getDefault().getPreferenceStore();
-
- // use the base annotation & quick diff preference page
- EditorsUI.useAnnotationsPreferencePage(store);
- EditorsUI.useQuickDiffPreferencePage(store);
-
- // let annotations show up in the vertical ruler if that's what the
- // preference is
- // // these annotation preferences have a different default value than
- // the one the base provides
- // store.setDefault("errorIndicationInVerticalRuler", false);
- // //$NON-NLS-1$
- // store.setDefault("warningIndicationInVerticalRuler", false);
- // //$NON-NLS-1$
-
- // these annotation preferences are not part of base text editor
- // preference
- store.setDefault(CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS, true);
-
- setMatchingBracketsPreferences(store);
-
- // hover help preferences are not part of base text editor preference
- String mod2Name = Action.findModifierString(SWT.MOD2); // SWT.COMMAND
- // on Mac;
- // SWT.CONTROL
- // elsewhere
- store.setDefault(EditorPreferenceNames.EDITOR_TEXT_HOVER_MODIFIERS, "combinationHover|true|0;problemHover|false|0;documentationHover|false|0;annotationHover|true|" + mod2Name); //$NON-NLS-1$
-
- // set default read-only foreground color scale value
- store.setDefault(EditorPreferenceNames.READ_ONLY_FOREGROUND_SCALE, 30);
-
- // set default enable folding value
- store.setDefault(IStructuredTextFoldingProvider.FOLDING_ENABLED, false);
-
- // set default for show message dialog when unknown content type in editor
- store.setDefault(EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG, true);
- }
-
- private void setMatchingBracketsPreferences(IPreferenceStore store) {
- // matching brackets is not part of base text editor preference
- store.setDefault(EditorPreferenceNames.MATCHING_BRACKETS, true);
- PreferenceConverter.setDefault(store, EditorPreferenceNames.MATCHING_BRACKETS_COLOR, new RGB(192, 192, 192));
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ReadOnlyAwareDropTargetAdapter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ReadOnlyAwareDropTargetAdapter.java
deleted file mode 100644
index 1fb0b9dbcf..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ReadOnlyAwareDropTargetAdapter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-
-
-public class ReadOnlyAwareDropTargetAdapter extends ExtendedEditorDropTargetAdapter {
-
- /**
- * @deprecated - use ReadOnlyAwareDropTargetAdapter(boolean useProxy) for
- * the performance
- */
- public ReadOnlyAwareDropTargetAdapter() {
- super();
- }
-
- public ReadOnlyAwareDropTargetAdapter(boolean useProxy) {
- super(useProxy);
- }
-
- public void drop(DropTargetEvent event) {
- IDocument document = getTextViewer().getDocument();
- if (document instanceof IStructuredDocument) {
- if (((IStructuredDocument) document).containsReadOnly(getDropOffset(event), 0)) {
- event.operations = DND.DROP_NONE;
- event.detail = DND.DROP_NONE;
- getTextViewer().getTextWidget().redraw();
- getTextViewer().getTextWidget().update();
- getTextViewer().getTextWidget().getDisplay().beep();
- }
- }
- super.drop(event);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java
deleted file mode 100644
index 88809b7ca2..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIMessages.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005, 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 - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Strings used by SSE UI
- *
- * @plannedfor 1.0
- */
-public class SSEUIMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.wst.sse.ui.internal.SSEUIPluginResources";//$NON-NLS-1$
- private static ResourceBundle fResourceBundle;
-
- public static ResourceBundle getResourceBundle() {
- try {
- if (fResourceBundle == null)
- fResourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
- }
- catch (MissingResourceException x) {
- fResourceBundle = null;
- }
- return fResourceBundle;
- }
-
- private SSEUIMessages() {
- // cannot create new instance
- }
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, SSEUIMessages.class);
- }
-
- public static String Error_opening_file_UI_;
- public static String _UI_File_is_read_only;
- public static String _32concat_EXC_;
- public static String Multiple_errors;
- public static String _Undo_Text_Change__Ctrl_Z_UI_;
- public static String Undo_Text_Change__UI_;
- public static String _Undo__0___Ctrl_Z_UI_;
- public static String Undo___0___UI_;
- public static String _Redo_Text_Change__Ctrl_Y_UI_;
- public static String Redo_Text_Change__UI_;
- public static String _Redo__0___Ctrl_Y_UI_;
- public static String Redo___0___UI_;
- public static String FormatMenu_label;
- public static String Format_Document_UI_;
- public static String Format_Active_Elements_UI_;
- public static String Text_Cut_UI_;
- public static String Text_Paste_UI_;
-
- public static String Cleanup_Document_UI_;
-
- public static String Editor_Cut_label;
- public static String Editor_Cut_tooltip;
- public static String Editor_Cut_image;
- public static String Editor_Cut_description;
- public static String Editor_Copy_label;
- public static String Editor_Copy_tooltip;
- public static String Editor_Copy_image;
- public static String Editor_Copy_description;
- public static String Editor_Paste_label;
- public static String Editor_Paste_tooltip;
- public static String Editor_Paste_image;
- public static String Editor_Paste_description;
- public static String Editor_Delete_label;
- public static String Editor_Delete_tooltip;
- public static String Editor_Delete_image;
- public static String Editor_Delete_description;
-
- public static String ContentAssistProposals_label;
- public static String ContentAssistProposals_tooltip;
- public static String ContentAssistProposals_description;
- public static String QuickFix_label;
- public static String QuickFix_tooltip;
- public static String QuickFix_image;
- public static String QuickFix_description;
- public static String ToggleComment_label;
- public static String ToggleComment_tooltip;
- public static String ToggleComment_image;
- public static String ToggleComment_description;
- public static String AddBlockComment_label;
- public static String AddBlockComment_tooltip;
- public static String AddBlockComment_image;
- public static String AddBlockComment_description;
- public static String RemoveBlockComment_label;
- public static String RemoveBlockComment_tooltip;
- public static String RemoveBlockComment_image;
- public static String RemoveBlockComment_description;
- public static String CleanupDocument_label;
- public static String CleanupDocument_tooltip;
- public static String CleanupDocument_image;
- public static String CleanupDocument_description;
- public static String FormatDocument_label;
- public static String FormatDocument_tooltip;
- public static String FormatDocument_image;
- public static String FormatDocument_description;
- public static String FormatActiveElements_label;
- public static String FormatActiveElements_tooltip;
- public static String FormatActiveElements_image;
- public static String FormatActiveElements_description;
- public static String OpenFileFromSource_label;
- public static String OpenFileFromSource_tooltip;
- public static String OpenFileFromSource_image;
- public static String OpenFileFromSource_description;
- public static String ShowTooltipDesc_label;
- public static String ShowTooltipDesc_tooltip;
- public static String ShowTooltipDesc_image;
- public static String ShowTooltipDesc_description;
- public static String StructureSelectEnclosing_label;
- public static String StructureSelectEnclosing_tooltip;
- public static String StructureSelectEnclosing_description;
- public static String StructureSelectNext_label;
- public static String StructureSelectNext_tooltip;
- public static String StructureSelectNext_description;
- public static String StructureSelectPrevious_label;
- public static String StructureSelectPrevious_tooltip;
- public static String StructureSelectPrevious_description;
- public static String StructureSelectHistory_label;
- public static String StructureSelectHistory_tooltip;
- public static String StructureSelectHistory_description;
- public static String Text_Shift_Right_UI_;
- public static String Text_Shift_Left_UI_;
-
- public static String _4concat;
- public static String Content_type__UI_;
- public static String Foreground_UI_;
- public static String Background_UI_;
- public static String Bold_UI_;
- public static String Italics_UI;
- public static String Restore_Default_UI_;
- public static String Sample_text__UI_;
-
- public static String AddBreakpoint_label;
- public static String AddBreakpoint_tooltip;
- public static String AddBreakpoint_description;
- public static String AddBreakpoint_error_dialog_title;
- public static String AddBreakpoint_error_dialog_message;
- public static String ToggleBreakpoint_label;
- public static String ToggleBreakpoint_tooltip;
- public static String ToggleBreakpoint_description;
- public static String EnableBreakpoint_label;
- public static String EnableBreakpoint_tooltip;
- public static String EnableBreakpoint_description;
- public static String DisableBreakpoint_label;
- public static String DisableBreakpoint_tooltip;
- public static String DisableBreakpoint_description;
- public static String ManageBreakpoints_add_label;
- public static String ManageBreakpoints_remove_label;
- public static String ManageBreakpoints_tooltip;
- public static String ManageBreakpoints_error_adding_title1;
- public static String ManageBreakpoints_error_adding_message1;
-
- public static String AbstractColorPageDescription;
- public static String EditorModelUtil_0;
- public static String EditorModelUtil_1;
-
- // TODO: These should be removed when ContentSettingsPropertyPage is
- // deleted
- // web content settings
- public static String UI_Default_HTML_DOCTYPE_ID___1;
- public static String UI_CSS_profile___2;
- public static String UI_Target_Device___3;
-
- public static String Editor_ToggleInsertMode_label;
-
- //
- // These strings are used in Workbench menu bar
- //
- public static String ExpandSelectionToMenu_label;
- public static String SourceMenu_label;
-
- public static String FindOccurrencesActionProvider_0;
- public static String RemoveAction_0;
- public static String ShowPropertiesAction_0;
- public static String ContentOutlineConfiguration_0;
- public static String ContentOutlineConfiguration_1;
- public static String AbstractOpenOn_0;
- public static String FormatActionDelegate_jobName;
- public static String FormatActionDelegate_errorStatusMessage;
- public static String FormatActionDelegate_3;
- public static String FormatActionDelegate_4;
- public static String FormatActionDelegate_5;
-
- public static String TranslucencyPreferenceTab_0;
- public static String TranslucencyPreferenceTab_1;
- public static String StructuredTextEditorPreferencePage_2;
- public static String StructuredTextEditorPreferencePage_6;
- public static String StructuredTextEditorPreferencePage_20;
- public static String StructuredTextEditorPreferencePage_23;
- public static String StructuredTextEditorPreferencePage_24;
- public static String StructuredTextEditorPreferencePage_30;
- public static String StructuredTextEditorPreferencePage_37;
- public static String StructuredTextEditorPreferencePage_38;
- public static String StructuredTextEditorPreferencePage_40;
- public static String TaskTagPreferenceTab_0;
- public static String TaskTagPreferenceTab_1;
- public static String TaskTagPreferenceTab_2;
- public static String TaskTagPreferenceTab_3;
- public static String TaskTagPreferenceTab_5;
- public static String TaskTagPreferenceTab_6;
- public static String TaskTagPreferenceTab_7;
- public static String TaskTagPreferenceTab_12;
- public static String TaskTagPreferenceTab_13;
- public static String TaskTagPreferenceTab_14;
- public static String TaskTagPreferenceTab_15;
- public static String TaskTagPreferenceTab_16;
- public static String TaskTagPreferenceTab_17;
- public static String TaskTagPreferenceTab_18;
- public static String TaskTagPreferenceTab_19;
- public static String TaskTagPreferenceTab_20;
- public static String TaskTagPreferenceTab_22;
- public static String TaskTagPreferenceTab_23;
- public static String TaskTagPreferenceTab_24;
- public static String TaskTagPreferenceTab_25;
- public static String TaskTagPreferenceTab_26;
- public static String TaskTagPreferenceTab_27;
- public static String TaskTagPreferenceTab_28;
- public static String TaskTagPreferenceTab_29;
- public static String TaskTagPreferenceTab_30;
- public static String TaskTagPreferenceTab_31;
- public static String TaskTagPreferencePage_32;
- public static String TaskTagPreferenceTab_33;
- public static String TaskTagExclusionTab_01;
- public static String TaskTagExclusionTab_02;
- public static String TaskTagExclusionTab_03;
-
- public static String PropertyPreferencePage_01;
- public static String PropertyPreferencePage_02;
-
- public static String FilePreferencePage_0;
- public static String NoModificationCompletionProposal_0;
- public static String ToggleBreakpointAction_0;
- public static String ManageBreakpointAction_0;
- public static String ManageBreakpointAction_1;
- public static String EditBreakpointAction_0;
- // Used in Structured Text Editor Preference Page / Hovers Tab
- public static String TextHoverPreferenceTab_title;
- public static String TextHoverPreferenceTab_hoverPreferences;
- public static String TextHoverPreferenceTab_keyModifier;
- public static String TextHoverPreferenceTab_description;
- public static String TextHoverPreferenceTab_modifierIsNotValid;
- public static String TextHoverPreferenceTab_modifierIsNotValidForHover;
- public static String TextHoverPreferenceTab_duplicateModifier;
- public static String TextHoverPreferenceTab_nameColumnTitle;
- public static String TextHoverPreferenceTab_modifierColumnTitle;
- public static String TextHoverPreferenceTab_delimiter;
- public static String TextHoverPreferenceTab_insertDelimiterAndModifierAndDelimiter;
- public static String TextHoverPreferenceTab_insertModifierAndDelimiter;
- public static String TextHoverPreferenceTab_insertDelimiterAndModifier;
-
- // used dynamically
- public static String combinationHover_label;
- public static String combinationHover_desc;
- public static String problemHover_label;
- public static String problemHover_desc;
- public static String documentationHover_label;
- public static String documentationHover_desc;
- public static String annotationHover_label;
- public static String annotationHover_desc;
-
- public static String EditStructuredTextEditorPreferencesAction_0;
- public static String StructuredTextEditorPreferencePage_0;
- public static String PreferenceManager_0;
-
- public static String OccurrencesSearchQuery_0;
- public static String OccurrencesSearchQuery_2;
- public static String ShowView_errorTitle;
- public static String proc_dirty_regions_0;
-
- public static String textHoverMakeStickyHint;
-
- // Encoding
- public static String EncodingPreferencePage_0;
- public static String EncodingPreferencePage_1;
-
- public static String busy;
- public static String caret_update;
- public static String EmptyFilePreferencePage_0;
-
- public static String OffsetStatusLineContributionItem_0;
- public static String OffsetStatusLineContributionItem_2;
- public static String OffsetStatusLineContributionItem_3;
- public static String OffsetStatusLineContributionItem_4;
- public static String OffsetStatusLineContributionItem_5;
- public static String OffsetStatusLineContributionItem_6;
- public static String OffsetStatusLineContributionItem_7;
- public static String OffsetStatusLineContributionItem_8;
- public static String OffsetStatusLineContributionItem_9;
- public static String OffsetStatusLineContributionItem_10;
- public static String OffsetStatusLineContributionItem_11;
- public static String OffsetStatusLineContributionItem_12;
- public static String OffsetStatusLineContributionItem_13;
- public static String OffsetStatusLineContributionItem_14;
- public static String OffsetStatusLineContributionItem_15;
- public static String OffsetStatusLineContributionItem_16;
- public static String OffsetStatusLineContributionItem_17;
- public static String OffsetStatusLineContributionItem_18;
- public static String OffsetStatusLineContributionItem_19;
-
- /*
- * *****Below are possibly unused strings that may be removed *****
- */
- public static String Save_label;
- public static String An_error_has_occurred_when_ERROR_;
- public static String Problems_During_Save_As_UI_;
- public static String Save_could_not_be_complete_UI_;
- public static String ManageBreakpoints_error_removing_title1;
- public static String ManageBreakpoints_error_removing_message1;
- public static String ManageBreakpoints_error_retrieving_message;
- public static String JSPSourcePreferencePageDescription;
- public static String Editor_error_save_message;
- public static String Editor_error_save_title;
- public static String Editor_warning_save_delete;
-
- public static String Previous_annotation;
- public static String Next_annotation;
-
- public static String AnnotationTypes_Errors;
- public static String AnnotationTypes_Warnings;
- public static String AnnotationTypes_Tasks;
- public static String AnnotationTypes_SearchResults;
- public static String AnnotationTypes_Bookmarks;
- public static String AnnotationTypes_Others;
-
- public static String Editor_ConvertToWindows_label;
- public static String Editor_ConvertToWindows_tooltip;
- public static String Editor_ConvertToWindows_image;
- public static String Editor_ConvertToWindows_description;
-
- public static String Editor_ConvertToUNIX_label;
- public static String Editor_ConvertToUNIX_tooltip;
- public static String Editor_ConvertToUNIX_image;
- public static String Editor_ConvertToUNIX_description;
-
- public static String Editor_ConvertToMac_label;
- public static String Editor_ConvertToMac_tooltip;
- public static String Editor_ConvertToMac_image;
- public static String Editor_ConvertToMac_description;
- public static String ConvertLineDelimitersMenu_label;
- public static String FindOccurrences_label;
-
- public static String ConvertLineDelimitersToCRLFActionDelegate_jobName;
- public static String ConvertLineDelimitersToCRLFActionDelegate_errorStatusMessage;
- public static String ConvertLineDelimitersToCRLFActionDelegate_3;
- public static String ConvertLineDelimitersToCRLFActionDelegate_4;
-
- public static String TextHoverPreferenceTab_annotationRollover;
- public static String TextHoverPreferenceTab_showAffordance;
- public static String TextHoverPreferenceTab_enabled;
-
- public static String BasicFindOccurrencesAction_0;
- public static String BasicSearchLabelProvider_0;
- public static String NavigationPreferenceTab_0;
- public static String OccurrencesSearchQuery_1;
- public static String FileModelProvider_0;
- public static String JFaceNodeAdapter_0;
-
- public static String ConfigureProjectSettings;
- public static String ConfigureWorkspaceSettings;
- public static String EnableProjectSettings;
-
- public static String LoadingReferencedGrammars;
-
- public static String Folding;
- public static String StructuredTextEditorPreferencePage_3;
- public static String Projection_Toggle_label;
- public static String Projection_Toggle_tooltip;
- public static String Projection_Toggle_description;
- public static String Projection_Toggle_image;
- public static String Projection_ExpandAll_label;
- public static String Projection_ExpandAll_tooltip;
- public static String Projection_ExpandAll_description;
- public static String Projection_ExpandAll_image;
- public static String Projection_CollapseAll_label;
- public static String Projection_CollapseAll_tooltip;
- public static String Projection_CollapseAll_description;
- public static String Projection_CollapseAll_image;
-
- // These strings are accessed using resource bundle and in properties
- // file, need to use '.' instead of '_' in some keys
- public static String Editor_ManageBookmarks_tooltip;
- public static String Editor_ManageBookmarks_image;
- public static String Editor_ManageBookmarks_description;
- public static String Editor_ManageBookmarks_add_label;
- public static String Editor_ManageBookmarks_remove_label;
- public static String Editor_ManageBookmarks_add_dialog_title;
- public static String Editor_ManageBookmarks_add_dialog_message;
- public static String Editor_ManageBookmarks_error_dialog_title;
- public static String Editor_ManageBookmarks_error_dialog_message;
- public static String Editor_ManageTasks_tooltip;
- public static String Editor_ManageTasks_image;
- public static String Editor_ManageTasks_description;
- public static String Editor_ManageTasks_add_label;
- public static String Editor_ManageTasks_remove_label;
- public static String Editor_ManageTasks_add_dialog_title;
- public static String Editor_ManageTasks_add_dialog_message;
- public static String Editor_ManageTasks_error_dialog_title;
- public static String Editor_ManageTasks_error_dialog_message;
- /*
- * *****Above are possibly unused strings that may be removed*****
- */
-
- public static String StructuredTextEditorPreferencePage_39;
- public static String StructuredTextEditor_0;
- public static String UnknownContentTypeDialog_0;
- public static String UnknownContentTypeDialog_1;
- public static String UnknownContentTypeDialog_2;
- public static String StyledTextColorPicker_0;
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPlugin.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPlugin.java
deleted file mode 100644
index 50783e74f9..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPlugin.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.sse.core.internal.tasks.TaskScanningScheduler;
-import org.eclipse.wst.sse.ui.internal.provisional.registry.AdapterFactoryRegistry;
-import org.eclipse.wst.sse.ui.internal.provisional.registry.AdapterFactoryRegistryImpl;
-import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
-import org.osgi.framework.BundleContext;
-
-
-public class SSEUIPlugin extends AbstractUIPlugin {
-
- public final static String ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
-
- static SSEUIPlugin instance = null;
-
- public static SSEUIPlugin getDefault() {
- return instance;
- }
-
- public synchronized static SSEUIPlugin getInstance() {
- return instance;
- }
-
- private TextHoverManager fTextHoverManager;
-
- public SSEUIPlugin() {
- super();
- instance = this;
- }
-
- public AdapterFactoryRegistry getAdapterFactoryRegistry() {
- return AdapterFactoryRegistryImpl.getInstance();
-
- }
-
- /**
- * Return text hover manager
- *
- * @return TextHoverManager
- */
- public TextHoverManager getTextHoverManager() {
- if (fTextHoverManager == null) {
- fTextHoverManager = new TextHoverManager();
- }
- return fTextHoverManager;
- }
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- /**
- * If the user starts the workbench with
- * -Dorg.eclipse.wst.sse.core.taskscanner=off, the scanner should be
- * disabled
- */
- String scan = System.getProperty("org.eclipse.wst.sse.core.taskscanner"); //$NON-NLS-1$
- if (scan == null || !scan.equalsIgnoreCase("off")) { //$NON-NLS-1$
- TaskScanningScheduler.startup();
- }
- }
-
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- TaskScanningScheduler.shutdown();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties
deleted file mode 100644
index 8fe20c0811..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/SSEUIPluginResources.properties
+++ /dev/null
@@ -1,395 +0,0 @@
-###############################################################################
-# Copyright (c) 2001, 2004 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
-# Jens Lukowski/Innoopract - initial renaming/restructuring
-#
-###############################################################################
-Error_opening_file_UI_=Error opening file
-_UI_File_is_read_only=File {0} is read-only.
-_32concat_EXC_=Editor could not be open on {0}
-Multiple_errors=Multiple annotations found at this line:
-_Undo_Text_Change__Ctrl_Z_UI_=&Undo Text Change @Ctrl+Z
-Undo_Text_Change__UI_=Undo Text Change.
-_Undo__0___Ctrl_Z_UI_=&Undo {0} @Ctrl+Z
-Undo___0___UI_=Undo: {0}.
-_Redo_Text_Change__Ctrl_Y_UI_=&Redo Text Change @Ctrl+Y
-Redo_Text_Change__UI_=Redo Text Change.
-_Redo__0___Ctrl_Y_UI_=&Redo {0} @Ctrl+Y
-Redo___0___UI_=Redo: {0}.
-FormatMenu_label=F&ormat
-Format_Document_UI_=Format Document
-Format_Active_Elements_UI_=Format Active Elements
-Text_Cut_UI_=Text Cut
-Text_Paste_UI_=Text Paste
-###############################################################################
-Cleanup_Document_UI_=Cleanup Document
-
-Editor_Cut_label=Cu&t@Ctrl+X
-Editor_Cut_tooltip=Cut
-Editor_Cut_image=
-Editor_Cut_description=Cut
-
-Editor_Copy_label=&Copy@Ctrl+C
-Editor_Copy_tooltip=Copy
-Editor_Copy_image=
-Editor_Copy_description=Copy
-
-Editor_Paste_label=&Paste@Ctrl+V
-Editor_Paste_tooltip=Paste
-Editor_Paste_image=
-Editor_Paste_description=Paste
-
-Editor_Delete_label=&Delete@Delete
-Editor_Delete_tooltip=Delete
-Editor_Delete_image=
-Editor_Delete_description=Delete
-
-ContentAssistProposals_label=Con&tent Assist
-ContentAssistProposals_tooltip=Content Assist
-ContentAssistProposals_description=Content Assist
-
-QuickFix_label=&Quick Fix
-QuickFix_tooltip=Quick Fix
-QuickFix_image=
-QuickFix_description=Quick Fix
-
-ToggleComment_label=Togg&le Comment
-ToggleComment_tooltip=Toggle Comment
-ToggleComment_image=
-ToggleComment_description=Toggle Comment
-AddBlockComment_label=Add &Block Comment
-AddBlockComment_tooltip=Add Block Comment
-AddBlockComment_image=
-AddBlockComment_description=Add Block Comment
-RemoveBlockComment_label=Remove Bloc&k Comment
-RemoveBlockComment_tooltip=Remove Block Comment
-RemoveBlockComment_image=
-RemoveBlockComment_description=Remove Block Comment
-CleanupDocument_label=C&leanup Document...
-CleanupDocument_tooltip=Cleanup Document
-CleanupDocument_image=
-CleanupDocument_description=Cleanup Document
-FormatDocument_label=&Document
-FormatDocument_tooltip=Format Document
-FormatDocument_image=
-FormatDocument_description=Format Document
-FormatActiveElements_label=Act&ive Elements
-FormatActiveElements_tooltip=Format Active Elements
-FormatActiveElements_image=
-FormatActiveElements_description=Format Active Elements
-OpenFileFromSource_label=Op&en Selection
-OpenFileFromSource_tooltip=Open an editor on the selected link
-OpenFileFromSource_image=
-OpenFileFromSource_description=Open an editor on the selected link
-ShowTooltipDesc_label=Show &Tooltip Description
-ShowTooltipDesc_tooltip=Displays the hover help for the selected element
-ShowTooltipDesc_image=
-ShowTooltipDesc_description=Displays the hover help for the selected element
-StructureSelectEnclosing_label=&Enclosing Element
-StructureSelectEnclosing_tooltip=Expand selection to include enclosing element
-StructureSelectEnclosing_description=Expand selection to include enclosing element
-StructureSelectNext_label=&Next Element
-StructureSelectNext_tooltip=Expand selection to include next sibling
-StructureSelectNext_description=Expand selection to include next sibling
-StructureSelectPrevious_label=&Previous Element
-StructureSelectPrevious_tooltip=Expand selection to include previous sibling
-StructureSelectPrevious_description=Expand selection to include previous sibling
-StructureSelectHistory_label=&Restore Last Selection
-StructureSelectHistory_tooltip=Restore last selection
-StructureSelectHistory_description=Restore last selection
-Text_Shift_Right_UI_=Text Shift Right
-Text_Shift_Left_UI_=Text Shift Left
-
-_4concat=''{0}'' is not a valid input
-## The following strings are for "XML->XML Source->XML Style" Preferences, "Web Tools->Source->HTML Style" Preferences, and "Web Tools->Source->JavaScript Style" Preferences
-Content_type__UI_=Co&ntent type:
-Foreground_UI_=&Foreground:
-Background_UI_=&Background:
-Bold_UI_=B&old
-Italics_UI=Italics
-Restore_Default_UI_=&Restore Default
-Sample_text__UI_=&Sample text:
-##
-AddBreakpoint_label=Add &Breakpoint
-AddBreakpoint_tooltip=Add Breakpoint
-AddBreakpoint_description=Add Breakpoint
-AddBreakpoint_error_dialog_title=Add Breakpoint
-AddBreakpoint_error_dialog_message=Cannot add breakpoint
-##
-ToggleBreakpoint_label=Toggle Breakpoint
-ToggleBreakpoint_tooltip=Toggle Breakpoint
-ToggleBreakpoint_description=Toggle Breakpoint
-##
-EnableBreakpoint_label=Enable Breakpoint
-EnableBreakpoint_tooltip=Enable Breakpoint
-EnableBreakpoint_description=Enable Breakpoint
-##
-DisableBreakpoint_label=Disable Breakpoint
-DisableBreakpoint_tooltip=Disable Breakpoint
-DisableBreakpoint_description=Disable Breakpoint
-##
-ManageBreakpoints_add_label=Add &Breakpoint
-ManageBreakpoints_remove_label=Remove Breakpoint
-ManageBreakpoints_tooltip=Add/Remove Breakpoint
-ManageBreakpoints_error_adding_title1=Add Breakpoint
-ManageBreakpoints_error_adding_message1=Cannot add breakpoint
-
-AbstractColorPageDescription=Customize the syntax highlighting by selecting the type of text whose style you want to customize from either the combo box or the sample text area
-##
-EditorModelUtil_0=model in invalid state
-EditorModelUtil_1=There was a problem adding adapter factories
-
-# web content settings
-UI_Default_HTML_DOCTYPE_ID___1=&Document type:
-UI_CSS_profile___2=&CSS profile:
-UI_Target_Device___3=&Target device:
-
-Editor_ToggleInsertMode_label=Sma&rt Insert Mode
-
-##########################################################################
-# These strings are used in Workbench menu bar
-##########################################################################
-ExpandSelectionToMenu_label=E&xpand Selection To
-SourceMenu_label=&Source
-#
-FindOccurrencesActionProvider_0=Current selection does not resolve to a searchable element
-RemoveAction_0=Remove Property
-ShowPropertiesAction_0=P&roperties
-ContentOutlineConfiguration_0=Collapse All
-ContentOutlineConfiguration_1=Link with Editor
-AbstractOpenOn_0=Current text selection does not resolve to a file
-FormatActionDelegate_jobName=Formatting documents
-FormatActionDelegate_errorStatusMessage=Exceptions occurred while formatting documents
-FormatActionDelegate_3=Formatting {0}
-FormatActionDelegate_4=Exception occurred while formatting document {0}
-FormatActionDelegate_5=MalformedInputException occurred while formatting document {0}
-TranslucencyPreferenceTab_0=Read-Only text style
-TranslucencyPreferenceTab_1=Read-Only contrast percentage:
-StructuredTextEditorPreferencePage_2=Matching brackets highlight
-StructuredTextEditorPreferencePage_6=The following preferences apply to the HTML, JSP, XML, and other source editors.
-StructuredTextEditorPreferencePage_20=Highlight &matching brackets
-StructuredTextEditorPreferencePage_23=Appearance co&lor options:
-StructuredTextEditorPreferencePage_24=C&olor:
-StructuredTextEditorPreferencePage_30=&Report problems as you type
-StructuredTextEditorPreferencePage_37=Empty input
-StructuredTextEditorPreferencePage_38=is not a valid input.
-StructuredTextEditorPreferencePage_39=Inform when unsupported content type is in editor
-StructuredTextEditorPreferencePage_40=Also see the <a>''{0}''</a> preferences.
-TaskTagPreferenceTab_0=Low
-TaskTagPreferenceTab_1=Normal
-TaskTagPreferenceTab_2=High
-TaskTagPreferenceTab_3=N/A
-TaskTagPreferenceTab_5=Task Tag
-TaskTagPreferenceTab_6=Tag:
-TaskTagPreferenceTab_7=Priority:
-TaskTagPreferenceTab_12=Tag
-TaskTagPreferenceTab_13=Priority
-TaskTagPreferenceTab_14=New...
-TaskTagPreferenceTab_15=Edit...
-TaskTagPreferenceTab_16=Remove
-TaskTagPreferenceTab_17=Select All
-TaskTagPreferenceTab_18=Deselect All
-TaskTagPreferenceTab_19=Note: tags are case insensitive
-TaskTagPreferenceTab_20=Task Tags
-TaskTagPreferenceTab_22=Task Tags Settings Changed
-TaskTagPreferenceTab_23=The task tags settings have changed. Make these changes effective now?
-TaskTagPreferenceTab_24=Yes
-TaskTagPreferenceTab_25=No
-TaskTagPreferenceTab_26=Cancel
-TaskTagPreferenceTab_27=Scanning files for tasks
-TaskTagPreferenceTab_28=detection aborted
-TaskTagPreferenceTab_29=detection completed
-TaskTagPreferenceTab_30=detection encountered errors
-TaskTagPreferenceTab_31=Enable searching for Task Tags
-TaskTagPreferencePage_32=Clean and redetect Tasks
-TaskTagPreferenceTab_33=Tags in comments indicating Tasks:
-TaskTagExclusionTab_01=Filters
-TaskTagExclusionTab_02=Scan the selected Content Types:
-TaskTagExclusionTab_03=Affected Content Types:
-
-PropertyPreferencePage_01=Project Specific Configuration
-PropertyPreferencePage_02=Select the project to configure:
-
-FilePreferencePage_0=Expand the tree to edit preferences for a specific content type.
-NoModificationCompletionProposal_0=No corrections available
-ToggleBreakpointAction_0=Toggle &Breakpoints
-ManageBreakpointAction_0=&Enable Breakpoints
-ManageBreakpointAction_1=&Disable Breakpoints
-EditBreakpointAction_0=Breakpoint &Properties...
-## Used in Structured Text Editor Preference Page / Hovers Tab
-TextHoverPreferenceTab_title=Hovers
-TextHoverPreferenceTab_hoverPreferences=Text &Hover key modifier preferences:
-TextHoverPreferenceTab_keyModifier=Pressed key &modifier while hovering:
-TextHoverPreferenceTab_description=Description:
-TextHoverPreferenceTab_modifierIsNotValid=Modifier ''{0}'' is not valid.
-TextHoverPreferenceTab_modifierIsNotValidForHover=Modifier ''{0}'' for ''{1}'' hover is not valid.
-TextHoverPreferenceTab_duplicateModifier=''{0}'' hover uses the same modifier as ''{1}'' hover.
-TextHoverPreferenceTab_nameColumnTitle=Text Hover Name
-TextHoverPreferenceTab_modifierColumnTitle=Pressed Key Modifier While Hovering
-TextHoverPreferenceTab_delimiter=+
-TextHoverPreferenceTab_insertDelimiterAndModifierAndDelimiter=\ + {0} +
-TextHoverPreferenceTab_insertModifierAndDelimiter=\ {0} +
-TextHoverPreferenceTab_insertDelimiterAndModifier=\ + {0}
-combinationHover_label=Combined Hover
-combinationHover_desc=Tries the hovers in the sequence listed in the table below this one and uses the one which fits best for the selected element and the current context.
-problemHover_label=Problem Description
-problemHover_desc=Shows the description of the selected problem.
-documentationHover_label=Documentation Description
-documentationHover_desc=Shows the documentation of the selected element.
-annotationHover_label=Annotation Description
-annotationHover_desc=Shows the description of the selected annotation.
-EditStructuredTextEditorPreferencesAction_0=Editor Preferences
-StructuredTextEditorPreferencePage_0=Appearance
-PreferenceManager_0=Original Error:
-
-OccurrencesSearchQuery_0={0} - {1} Occurrences in {2}
-OccurrencesSearchQuery_2=file
-ShowView_errorTitle=Problems Showing View
-proc_dirty_regions_0 = Processing Dirty Regions
-
-textHoverMakeStickyHint=Press ''{0}'' for focus.
-
-## Encoding
-EncodingPreferencePage_0=Encoding settings for Web and XML files:
-EncodingPreferencePage_1=Use 3 byte BOM (Byte Order Mark) when saving UTF-8 encoded files
-busy=busy
-caret_update=caret update
-EmptyFilePreferencePage_0=Expand the tree to edit preferences for a specific content type.
-OffsetStatusLineContributionItem_0=Selection Information:
-OffsetStatusLineContributionItem_2=Partitions
-OffsetStatusLineContributionItem_3=ITextRegions
-OffsetStatusLineContributionItem_4=Structured Model Content-Type:
-OffsetStatusLineContributionItem_5=Model Handler:
-OffsetStatusLineContributionItem_6=Document Class:
-OffsetStatusLineContributionItem_7=Document Provider Class:
-OffsetStatusLineContributionItem_8=Partitionings:
-OffsetStatusLineContributionItem_9=Start
-OffsetStatusLineContributionItem_10=Length
-OffsetStatusLineContributionItem_11=Type
-OffsetStatusLineContributionItem_12=Input Type:
-OffsetStatusLineContributionItem_13=Partitioner:
-OffsetStatusLineContributionItem_14=Selection
-OffsetStatusLineContributionItem_15=Start
-OffsetStatusLineContributionItem_16=Length
-OffsetStatusLineContributionItem_17=Text Length
-OffsetStatusLineContributionItem_18=Context
-OffsetStatusLineContributionItem_19=Workbench Selection
-
-StructuredTextEditor_0=Unsupported content type warning
-UnknownContentTypeDialog_0=Unsupported Content Type
-UnknownContentTypeDialog_1=Do not show this message again
-UnknownContentTypeDialog_2=Unsupported content type in editor.\nTo associate file extension with a supported content type,\nplease see <a>Content Types Preference Page</a>
-
-################################################################################
-## Below are possibly unused strings that may be removed
-################################################################################
-Save_label=&Save
-An_error_has_occurred_when_ERROR_=An error has occurred when retrieving resources for the source editor. The Eclipse Workbench installation may have been corrupted.
-## save as problems (next two) should match what is in workbench
-Problems_During_Save_As_UI_=Problems During Save As...
-Save_could_not_be_complete_UI_=Save could not be completed.
-ManageBreakpoints_error_removing_title1=Remove Breakpoint
-ManageBreakpoints_error_removing_message1=Cannot remove breakpoint
-ManageBreakpoints_error_retrieving_message=Retrieving markers failed:
-JSPSourcePreferencePageDescription=Embedded content type\'s source preferences will be used. Select the file type for customization
-# The following lines copied from org\eclipse\ui\editors\text\TextEditorMessages.properties in org.eclipse.ui plugin
-Editor_error_save_message=Save could not be completed. {0}
-Editor_error_save_title=Problems During Save As...
-Editor_warning_save_delete=The original file ''{0}'' has been deleted.
-
-# actions
-Previous_annotation=Previous Annotation
-Next_annotation=Next Annotation
-# Annotation Types
-AnnotationTypes_Errors=Errors
-AnnotationTypes_Warnings=Warnings
-AnnotationTypes_Tasks=Tasks
-AnnotationTypes_SearchResults=Search Results
-AnnotationTypes_Bookmarks=Bookmarks
-AnnotationTypes_Others=Others
-
-Editor_ConvertToWindows_label=&Windows
-Editor_ConvertToWindows_tooltip=Converts line delimiters to Windows
-Editor_ConvertToWindows_image=
-Editor_ConvertToWindows_description=Converts line delimiters to Windows
-
-Editor_ConvertToUNIX_label=&UNIX
-Editor_ConvertToUNIX_tooltip=Converts line delimiters to UNIX
-Editor_ConvertToUNIX_image=
-Editor_ConvertToUNIX_description=Converts line delimiters to UNIX
-
-Editor_ConvertToMac_label=&Mac
-Editor_ConvertToMac_tooltip=Converts line delimiters to Mac
-Editor_ConvertToMac_image=
-Editor_ConvertToMac_description=Converts line delimiters to Mac
-ConvertLineDelimitersMenu_label=Co&nvert Line Delimiters to
-FindOccurrences_label=O&ccurrences in File
-
-ConvertLineDelimitersToCRLFActionDelegate_jobName=Converting line delimiters
-ConvertLineDelimitersToCRLFActionDelegate_errorStatusMessage=Exceptions occurred while converting line delimiters
-ConvertLineDelimitersToCRLFActionDelegate_3=Converting line delimiters for {0}
-ConvertLineDelimitersToCRLFActionDelegate_4=Exception occurred while converting line delimiters for document {0}
-TextHoverPreferenceTab_annotationRollover=&Enable annotation roll-over (on new editors)
-TextHoverPreferenceTab_showAffordance=&Show affordance in hover on how to make it sticky
-TextHoverPreferenceTab_enabled=&Enabled
-
-BasicFindOccurrencesAction_0=region match:
-BasicSearchLabelProvider_0=line
-NavigationPreferenceTab_0=Modifier ''{0}'' is not valid.
-OccurrencesSearchQuery_1={0} - 1 Occurrence in {1}
-FileModelProvider_0=Error reloading {0}
-JFaceNodeAdapter_0=Update Outline
-
-ConfigureProjectSettings=Configure Project Specific Settings...
-ConfigureWorkspaceSettings=Configure Workspace Settings...
-EnableProjectSettings=Enable project specific settings
-
-LoadingReferencedGrammars=Loading referenced grammars
-
-## Folding
-Folding=Folding
-StructuredTextEditorPreferencePage_3=Enable &folding
-Projection_Toggle_label= &Enable Folding
-Projection_Toggle_tooltip= Toggles Folding
-Projection_Toggle_description= Toggles folding for the current editor
-Projection_Toggle_image=
-Projection_ExpandAll_label= Expand &All
-Projection_ExpandAll_tooltip= Expands All Collapsed Regions
-Projection_ExpandAll_description= Expands any collapsed regions in the current editor
-Projection_ExpandAll_image=
-Projection_CollapseAll_label= Collapse A&ll
-Projection_CollapseAll_tooltip= Collapses All Expanded Regions
-Projection_CollapseAll_description= Collapse any expanded regions in the current editor
-Projection_CollapseAll_image=
-
-## These are copied from org.eclipse.ui.texteditor.EditorMessages.properties
-## They are needed temporarily until CMVC defect 203158 / Bugzilla defect 20054 is fixed
-Editor_ManageBookmarks_tooltip=Adds and Removes Bookmarks
-Editor_ManageBookmarks_image=
-Editor_ManageBookmarks_description=Adds and removes Bookmarks
-Editor_ManageBookmarks_add_label=Add Boo&kmark...
-Editor_ManageBookmarks_remove_label=Remove Boo&kmark
-Editor_ManageBookmarks_add_dialog_title=Add Bookmark
-Editor_ManageBookmarks_add_dialog_message=Enter Bookmark name
-Editor_ManageBookmarks_error_dialog_title=Managing Bookmarks
-Editor_ManageBookmarks_error_dialog_message=Problems managing bookmarks
-
-Editor_ManageTasks_tooltip=Adds and Removes Tasks
-Editor_ManageTasks_image=
-Editor_ManageTasks_description=Adds and removes Tasks
-Editor_ManageTasks_add_label=Add &Task...
-Editor_ManageTasks_remove_label=Remove &Task
-Editor_ManageTasks_add_dialog_title=Add Task
-Editor_ManageTasks_add_dialog_message=Enter Task description
-Editor_ManageTasks_error_dialog_title=Managing Tasks
-Editor_ManageTasks_error_dialog_message=Problems managing tasks
-################################################################################
-## Above are possibly unused strings that may be removed
-###############################################################################
-StyledTextColorPicker_0=Pick a color
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ShowViewAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ShowViewAction.java
deleted file mode 100644
index 6e43f030c9..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ShowViewAction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-
-/**
- * Surfaces a View.
- *
- * @author Nitin Dahyabhai
- */
-public abstract class ShowViewAction extends Action {
- /**
- *
- */
- public ShowViewAction() {
- super();
- }
-
- /**
- * @param text
- */
- public ShowViewAction(String text) {
- super(text);
- }
-
- /**
- * @param text
- * @param image
- */
- public ShowViewAction(String text, ImageDescriptor image) {
- super(text, image);
- }
-
- /**
- * @param text
- * @param style
- */
- public ShowViewAction(String text, int style) {
- super(text, style);
- }
-
- /**
- * @return
- */
- protected abstract String getViewID();
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- super.run();
- showView();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event)
- */
- public void runWithEvent(Event event) {
- super.runWithEvent(event);
- showView();
- }
-
- /**
- *
- */
- private void showView() {
- IWorkbenchWindow window = SSEUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- try {
- page.showView(getViewID());
- } catch (PartInitException e) {
- ErrorDialog.openError(window.getShell(), SSEUIMessages.ShowView_errorTitle, //$NON-NLS-1$
- e.getMessage(), e.getStatus());
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StorageModelProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StorageModelProvider.java
deleted file mode 100644
index 576cc07c7e..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StorageModelProvider.java
+++ /dev/null
@@ -1,681 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.AnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.editors.text.FileDocumentProvider;
-import org.eclipse.ui.editors.text.StorageDocumentProvider;
-import org.eclipse.ui.texteditor.IElementStateListener;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.encoding.CodedReaderCreator;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.util.Utilities;
-import org.eclipse.wst.sse.ui.internal.debug.BreakpointRulerAction;
-import org.eclipse.wst.sse.ui.internal.editor.EditorModelUtil;
-import org.eclipse.wst.sse.ui.internal.extension.BreakpointProviderBuilder;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IExtendedStorageEditorInput;
-
-/**
- * A StorageDocumentProvider that is IStructuredModel aware
- */
-public class StorageModelProvider extends StorageDocumentProvider implements IModelProvider {
-
- private class InternalElementStateListener implements IElementStateListener {
- public void elementContentAboutToBeReplaced(Object element) {
- if (debugElementStatelistener) {
- System.out.println("StorageModelProvider: elementContentAboutToBeReplaced: " + ((IEditorInput) element).getName()); //$NON-NLS-1$
- }
- // we just forward the event
- StorageModelProvider.this.fireElementContentAboutToBeReplaced(element);
- }
-
- public void elementContentReplaced(Object element) {
- if (debugElementStatelistener) {
- System.out.println("StorageModelProvider: elementContentReplaced: " + ((IEditorInput) element).getName()); //$NON-NLS-1$
- }
-
- StorageInfo info = (StorageInfo) getElementInfo(element);
-
- /**
- * Force a reload of the markers into annotations since their
- * previous Positions have been deleted. Disconnecting and
- * reconnecting forces a call to the private catchupWithMarkers
- * method.
- */
- if (info != null && info.fModel != null) {
- info.fModel.disconnect(info.fDocument);
- }
-
- Reader reader = null;
- IStructuredDocument innerdocument = null;
- try {
- // update document from input's contents
- CodedReaderCreator codedReaderCreator = new CodedReaderCreator(calculateID((IStorageEditorInput) element), Utilities.getMarkSupportedStream(((IStorageEditorInput) element).getStorage().getContents()));
- reader = codedReaderCreator.getCodedReader();
-
- innerdocument = (IStructuredDocument) info.fDocument;
-
- int originalLengthToReplace = innerdocument.getLength();
-
- StringBuffer stringBuffer = new StringBuffer();
- int bufferSize = 2048;
- char[] buffer = new char[bufferSize];
- int nRead = 0;
- boolean eof = false;
- while (!eof) {
- nRead = reader.read(buffer, 0, bufferSize);
- if (nRead == -1) {
- eof = true;
- }
- else {
- stringBuffer.append(buffer, 0, nRead);
- }
- }
- innerdocument.replaceText(this, 0, originalLengthToReplace, stringBuffer.toString(), true);
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- catch (IOException e) {
- Logger.logException(e);
- }
- finally {
- if (reader != null) {
- try {
- reader.close();
- }
- catch (IOException e1) {
- // would be highly unusual
- Logger.logException(e1);
- }
- }
- }
-
- // forward the event
- if (info.fCanBeSaved) {
- info.fCanBeSaved = false;
- addUnchangedElementListeners(element, info);
- }
- fireElementContentReplaced(element);
- fireElementDirtyStateChanged(element, false);
-
- if (info != null && info.fModel != null) {
- info.fModel.connect(info.fDocument);
- }
- }
-
- public void elementDeleted(Object element) {
- if (debugElementStatelistener) {
- System.out.println("StorageModelProvider: elementDeleted: " + ((IEditorInput) element).getName()); //$NON-NLS-1$
- }
- // we just forward the event
- StorageModelProvider.this.fireElementDeleted(element);
- }
-
- public void elementDirtyStateChanged(Object element, boolean isDirty) {
- if (debugElementStatelistener) {
- System.out.println("StorageModelProvider: elementDirtyStateChanged: " + ((IEditorInput) element).getName() + " (" + isDirty + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- // we just forward the event
- StorageModelProvider.this.fireElementDirtyStateChanged(element, isDirty);
- }
-
- public void elementMoved(Object originalElement, Object movedElement) {
- if (debugElementStatelistener) {
- System.out.println("StorageModelProvider: elementMoved " + originalElement + " --> " + movedElement); //$NON-NLS-1$ //$NON-NLS-2$
- }
- // we just forward the event
- StorageModelProvider.this.fireElementMoved(originalElement, movedElement);
- }
- }
-
- /**
- * Collection of info that goes with a model.
- */
- private class ModelInfo {
- public IEditorInput fElement;
- public boolean fShouldReleaseOnInfoDispose;
- public IStructuredModel fStructuredModel;
-
- public ModelInfo(IStructuredModel structuredModel, IEditorInput element, boolean selfCreated) {
- fElement = element;
- fStructuredModel = structuredModel;
- fShouldReleaseOnInfoDispose = selfCreated;
- }
- }
-
- static final boolean debugElementStatelistener = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/storagemodelprovider/elementstatelistener")); //$NON-NLS-1$ //$NON-NLS-2$
- static final boolean debugOperations = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/storagemodelprovider/operations")); //$NON-NLS-1$ //$NON-NLS-2$
-
- private static StorageModelProvider fInstance = null;
-
- public synchronized static StorageModelProvider getInstance() {
- if (fInstance == null)
- fInstance = new StorageModelProvider();
- return fInstance;
- }
-
- private IElementStateListener fInternalListener;
- /** IStructuredModel information of all connected elements */
- private Map fModelInfoMap = new HashMap();
- private boolean fReuseModelDocument = true;
-
- private StorageModelProvider() {
- super();
- fInternalListener = new InternalElementStateListener();
- }
-
- String calculateBaseLocation(IStorageEditorInput input) {
- String location = null;
- try {
- IStorage storage = input.getStorage();
- if (storage != null) {
- IPath storagePath = storage.getFullPath();
- String name = storage.getName();
- if (storagePath != null) {
- // If they are different, the IStorage contract is not
- // being honored
- // (https://bugs.eclipse.org/bugs/show_bug.cgi?id=73098).
- // Favor the name.
- if (!storagePath.lastSegment().equals(name)) {
- IPath workingPath = storagePath.addTrailingSeparator();
- location = workingPath.append(name).toString();
- }
- else {
- location = storagePath.makeAbsolute().toString();
- }
- }
- if (location == null)
- location = name;
- }
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- finally {
- if (location == null)
- location = input.getName();
- }
- return location;
- }
-
- String calculateID(IStorageEditorInput input) {
- /**
- * Typically CVS will return a path of "filename.ext" and the input's
- * name will be "filename.ext version". The path must be used to load
- * the model so that the suffix will be available to compute the
- * contentType properly. The editor input name can then be set as the
- * base location for display on the editor title bar.
- *
- */
- String path = null;
- boolean addHash = false;
- try {
- IStorage storage = input.getStorage();
- if (storage != null) {
- IPath storagePath = storage.getFullPath();
- String name = storage.getName();
- // if either the name or storage path are null or they are
- // identical, add a hash to it to guarantee uniqueness
- addHash = storagePath == null || storagePath.toString().equals(name);
- if (storagePath != null) {
- // If they are different, the IStorage contract is not
- // being honored
- // (https://bugs.eclipse.org/bugs/show_bug.cgi?id=73098).
- // Favor the name.
- if (!storagePath.lastSegment().equals(name)) {
- IPath workingPath = storagePath.addTrailingSeparator();
- path = workingPath.append(name).toString();
- }
- else {
- path = storagePath.makeAbsolute().toString();
- }
- }
- if (path == null)
- path = name;
- }
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- finally {
- if (path == null)
- path = ""; //$NON-NLS-1$
- }
- if (addHash)
- path = input.hashCode() + path;
- return path;
- }
-
- // public boolean canSaveDocument(Object element) {
- // return false;
- // }
-
- protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
- IAnnotationModel model = null;
- if (debugOperations) {
- if (element instanceof IStorageEditorInput)
- System.out.println("StorageModelProvider: createAnnotationModel for " + ((IStorageEditorInput) element).getStorage().getFullPath()); //$NON-NLS-1$
- else
- System.out.println("StorageModelProvider: createAnnotationModel for " + element); //$NON-NLS-1$
- }
- if (element instanceof IStorageEditorInput) {
- IStorageEditorInput input = (IStorageEditorInput) element;
- String contentType = (getModel(input) != null ? getModel(input).getContentTypeIdentifier() : null);
- String ext = BreakpointRulerAction.getFileExtension((IEditorInput) element);
- IResource res = BreakpointProviderBuilder.getInstance().getResource(input, contentType, ext);
- String id = input.getName();
- if (input.getStorage() != null && input.getStorage().getFullPath() != null) {
- id = input.getStorage().getFullPath().toString();
- }
- // we can only create a resource marker annotationmodel off of a
- // valid resource
- if (res != null)
- model = new StructuredResourceMarkerAnnotationModel(res, id);
- else
- model = new AnnotationModel();
- }
- if (model == null) {
- model = super.createAnnotationModel(element);
- }
- return model;
- }
-
- protected IDocument createDocument(Object element) {
- if (debugOperations) {
- if (element instanceof IStorageEditorInput)
- try {
- System.out.println("StorageModelProvider: createDocument for " + ((IStorageEditorInput) element).getStorage().getFullPath()); //$NON-NLS-1$
- }
- catch (CoreException e) {
- System.out.println("StorageModelProvider: createDocument for " + element + "(exception caught)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else {
- System.out.println("StorageModelProvider: createDocument for " + element); //$NON-NLS-1$
- }
- }
-
- // The following is largely copied from FileModelProvider
-
- IDocument document = null;
- if (element instanceof IEditorInput) {
- // create a new IDocument for the element; should always reflect
- // the contents of the resource
- ModelInfo info = getModelInfoFor((IEditorInput) element);
- if (info == null) {
- throw new IllegalArgumentException("no corresponding model info found"); //$NON-NLS-1$
- }
- IStructuredModel model = info.fStructuredModel;
- if (model != null) {
- if (!fReuseModelDocument && element instanceof IStorageEditorInput) {
- Reader reader = null;
- IStructuredDocument innerdocument = null;
- try {
- // update document from input's contents
-
- CodedReaderCreator codedReaderCreator = new CodedReaderCreator(calculateID((IStorageEditorInput) element), Utilities.getMarkSupportedStream(((IStorageEditorInput) element).getStorage().getContents()));
- reader = codedReaderCreator.getCodedReader();
-
- innerdocument = model.getStructuredDocument();
-
- int originalLengthToReplace = innerdocument.getLength();
-
- /*
- * TODO_future: we could implement with sequential
- * rewrite, if we don't pickup automatically from
- * FileBuffer support, so not so much has to be pulled
- * into memory (as an extra big string), but we need
- * to carry that API through so that StructuredModel
- * is not notified until done.
- */
-
- // innerdocument.startSequentialRewrite(true);
- // innerdocument.replaceText(this, 0,
- // innerdocument.getLength(), "");
- StringBuffer stringBuffer = new StringBuffer();
- int bufferSize = 2048;
- char[] buffer = new char[bufferSize];
- int nRead = 0;
- boolean eof = false;
- while (!eof) {
- nRead = reader.read(buffer, 0, bufferSize);
- if (nRead == -1) {
- eof = true;
- }
- else {
- stringBuffer.append(buffer, 0, nRead);
- // innerdocument.replaceText(this,
- // innerdocument.getLength(), 0, new
- // String(buffer, 0, nRead));
- }
- }
- // ignore read-only settings if reverting whole
- // document
- innerdocument.replaceText(this, 0, originalLengthToReplace, stringBuffer.toString(), true);
- model.setDirtyState(false);
-
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- catch (IOException e) {
- Logger.logException(e);
- }
- finally {
- if (reader != null) {
- try {
- reader.close();
- }
- catch (IOException e1) {
- // would be highly unusual
- Logger.logException(e1);
- }
- }
- // if (innerdocument != null) {
- // innerdocument.stopSequentialRewrite();
- // }
- }
-
- }
- if (document == null) {
- document = model.getStructuredDocument();
- }
- }
- }
- return document;
- }
-
- /**
- * Also create ModelInfo - extra resource synchronization classes should
- * be stored within the ModelInfo
- */
- protected ElementInfo createElementInfo(Object element) throws CoreException {
- // create the corresponding ModelInfo if necessary
- if (debugOperations) {
- if (element instanceof IStorageEditorInput)
- try {
- System.out.println("StorageModelProvider: createElementInfo for " + ((IStorageEditorInput) element).getStorage().getFullPath()); //$NON-NLS-1$
- }
- catch (CoreException e) {
- System.out.println("StorageModelProvider: createElementInfo for " + element + "(exception caught)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else
- System.out.println("storageModelProvider: createElementInfo for " + element); //$NON-NLS-1$
- }
-
- if (getModelInfoFor((IEditorInput) element) == null) {
- createModelInfo((IEditorInput) element);
- }
-
- ElementInfo info = super.createElementInfo(element);
- return info;
- }
-
- public void createModelInfo(IEditorInput input) {
- if (getModelInfoFor(input) == null) {
- IStructuredModel structuredModel = selfCreateModel(input);
- if (structuredModel != null) {
- createModelInfo(input, structuredModel, true);
- }
- }
- }
-
- /**
- * To be used when model is provided to us, ensures that when setInput is
- * used on this input, the given model will be used.
- */
- public void createModelInfo(IEditorInput input, IStructuredModel structuredModel, boolean releaseModelOnDisconnect) {
- // we have to make sure factories are added, whether we created or
- // not.
- if (getModelInfoFor(input) != null || getModelInfoFor(structuredModel) != null) {
- if (debugOperations) {
- if (input instanceof IStorageEditorInput) {
-
- try {
- System.out.println("StorageModelProvider: DUPLICATE createModelInfo for " + ((IStorageEditorInput) input).getStorage().getFullPath()); //$NON-NLS-1$
- }
- catch (CoreException e) {
- System.out.println("StorageModelProvider: DUPLICATE createModelInfo for " + input + "(exception caught)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else {
- System.out.println("storageModelProvider: DUPLICATE createModelInfo for " + input); //$NON-NLS-1$
- }
- }
- return;
- }
-
- if (debugOperations) {
- if (input instanceof IStorageEditorInput) {
- try {
- System.out.println("StorageModelProvider: createModelInfo for " + ((IStorageEditorInput) input).getStorage().getFullPath()); //$NON-NLS-1$
- }
- catch (CoreException e) {
- System.out.println("StorageModelProvider: createModelInfo for " + input + "(exception caught)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else {
- System.out.println("StorageModelProvider: createModelInfo for " + input); //$NON-NLS-1$
- }
- }
-
-
- if (input instanceof IExtendedStorageEditorInput) {
- ((IExtendedStorageEditorInput) input).addElementStateListener(fInternalListener);
- }
-
- EditorModelUtil.addFactoriesTo(structuredModel);
-
- ModelInfo modelInfo = new ModelInfo(structuredModel, input, releaseModelOnDisconnect);
- fModelInfoMap.put(input, modelInfo);
- }
-
- protected void disposeElementInfo(Object element, ElementInfo info) {
- if (debugOperations) {
- if (element instanceof IStorageEditorInput) {
- try {
- System.out.println("StorageModelProvider: disposeElementInfo for " + ((IStorageEditorInput) element).getStorage().getFullPath()); //$NON-NLS-1$
- }
- catch (CoreException e) {
- System.out.println("StorageModelProvider: disposeElementInfo for " + element + "(exception caught)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else {
- System.out.println("StorageModelProvider: disposeElementInfo for " + element); //$NON-NLS-1$
- }
- }
-
- if (element instanceof IEditorInput) {
- IEditorInput input = (IEditorInput) element;
- ModelInfo modelInfo = getModelInfoFor(input);
- disposeModelInfo(modelInfo);
- }
- super.disposeElementInfo(element, info);
- }
-
- /**
- * disconnect from this model info
- *
- * @param info
- */
- public void disposeModelInfo(ModelInfo info) {
- if (debugOperations) {
- if (info.fElement instanceof IStorageEditorInput) {
- try {
- System.out.println("StorageModelProvider: disposeModelInfo for " + ((IStorageEditorInput) info.fElement).getStorage().getFullPath()); //$NON-NLS-1$
- }
- catch (CoreException e) {
- System.out.println("StorageModelProvider: disposeModelInfo for " + info.fElement + "(exception caught)"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- else {
- System.out.println("StorageModelProvider: disposeModelInfo for " + info.fElement); //$NON-NLS-1$
- }
- }
-
- if (info.fElement instanceof IStorageEditorInput) {
- if (info.fElement instanceof IExtendedStorageEditorInput) {
- ((IExtendedStorageEditorInput) info.fElement).removeElementStateListener(fInternalListener);
- }
- if (info.fShouldReleaseOnInfoDispose) {
- info.fStructuredModel.releaseFromEdit();
- }
- }
- fModelInfoMap.remove(info.fElement);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#doResetDocument(java.lang.Object,
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- protected void doResetDocument(Object element, IProgressMonitor monitor) throws CoreException {
- fReuseModelDocument = false;
- super.doResetDocument(element, monitor);
- fReuseModelDocument = true;
- }
-
- /**
- * @see org.eclipse.ui.texteditor.AbstractDocumentProvider#doSaveDocument(org.eclipse.core.runtime.IProgressMonitor,
- * java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
- */
- protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
- new FileDocumentProvider().saveDocument(monitor, element, document, overwrite);
- }
-
- public IStructuredModel getModel(IEditorInput element) {
- IStructuredModel result = null;
- ModelInfo info = getModelInfoFor(element);
- if (info != null) {
- result = info.fStructuredModel;
- }
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.IModelProvider#getModel(java.lang.Object)
- */
- public IStructuredModel getModel(Object element) {
- if (element instanceof IEditorInput)
- return getModel((IEditorInput) element);
- return null;
- }
-
- private ModelInfo getModelInfoFor(IEditorInput element) {
- ModelInfo result = (ModelInfo) fModelInfoMap.get(element);
- return result;
- }
-
- private ModelInfo getModelInfoFor(IStructuredModel structuredModel) {
- ModelInfo result = null;
- if (structuredModel != null) {
- ModelInfo[] modelInfos = (ModelInfo[]) fModelInfoMap.values().toArray(new ModelInfo[0]);
- for (int i = 0; i < modelInfos.length; i++) {
- ModelInfo info = modelInfos[i];
- if (structuredModel.equals(info.fStructuredModel)) {
- result = info;
- break;
- }
- }
- }
- return result;
- }
-
- /**
- * Method loadModel.
- *
- * @param input
- * @return IStructuredModel
- */
- public IStructuredModel loadModel(IStorageEditorInput input) {
- return loadModel(input, false);
- }
-
- /**
- * Method loadModel.
- *
- * @param input
- * @param logExceptions
- * @return IStructuredModel
- */
- public IStructuredModel loadModel(IStorageEditorInput input, boolean logExceptions) {
- String id = calculateID(input);
- if (id == null) {
- return null;
- }
-
- InputStream contents = null;
- try {
- contents = input.getStorage().getContents();
- }
- catch (CoreException noStorageExc) {
- if (logExceptions)
- Logger.logException(NLS.bind(SSEUIMessages._32concat_EXC_, new Object[]{input.getName()}), noStorageExc);
- }
-
- IStructuredModel model = null;
- try {
- // first parameter must be unique
- model = StructuredModelManager.getModelManager().getModelForEdit(id, contents, null);
- model.setBaseLocation(calculateBaseLocation(input));
- }
- catch (IOException e) {
- if (logExceptions)
- Logger.logException(NLS.bind(SSEUIMessages._32concat_EXC_, new Object[]{input}), e);
- }
- finally {
- if (contents != null) {
- try {
- contents.close();
- }
- catch (IOException e) {
- // nothing
- }
- catch (Exception e) {
- Logger.logException(e);
- }
- }
- }
- return model;
- }
-
- /**
- * @param input
- * @return
- */
- private IStructuredModel selfCreateModel(IEditorInput input) {
- return loadModel((IStorageEditorInput) input);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredDocumentToTextAdapter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredDocumentToTextAdapter.java
deleted file mode 100644
index 58993f920f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredDocumentToTextAdapter.java
+++ /dev/null
@@ -1,1332 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.jface.text.AbstractDocument;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.ConfigurableLineTracker;
-import org.eclipse.jface.text.DefaultLineTracker;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentAdapter;
-import org.eclipse.jface.text.IDocumentAdapterExtension;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.IRepairableDocument;
-import org.eclipse.jface.text.ITextStore;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.projection.ProjectionDocument;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.TextChangeListener;
-import org.eclipse.swt.custom.TextChangedEvent;
-import org.eclipse.swt.custom.TextChangingEvent;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.sse.core.internal.ILockable;
-import org.eclipse.wst.sse.core.internal.provisional.events.IStructuredDocumentListener;
-import org.eclipse.wst.sse.core.internal.provisional.events.NewDocumentEvent;
-import org.eclipse.wst.sse.core.internal.provisional.events.NoChangeEvent;
-import org.eclipse.wst.sse.core.internal.provisional.events.RegionChangedEvent;
-import org.eclipse.wst.sse.core.internal.provisional.events.RegionsReplacedEvent;
-import org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentEvent;
-import org.eclipse.wst.sse.core.internal.provisional.events.StructuredDocumentRegionsReplacedEvent;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegionList;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.sse.core.internal.util.Debug;
-import org.eclipse.wst.sse.core.internal.util.Utilities;
-import org.eclipse.wst.sse.ui.internal.util.Assert;
-
-
-/**
- * Adapts IStructuredDocument events and methods to StyledTextContent events
- * and methods
- */
-public class StructuredDocumentToTextAdapter implements IDocumentAdapter, IDocumentAdapterExtension {
-
- private class DocumentClone extends AbstractDocument {
-
-
- /**
- * Creates a new document clone with the given content.
- *
- * @param content
- * the content
- * @param lineDelimiters
- * the line delimiters
- */
- public DocumentClone(String content, String[] lineDelimiters) {
- super();
- setTextStore(new StringTextStore(content));
- ConfigurableLineTracker tracker = new ConfigurableLineTracker(lineDelimiters);
- setLineTracker(tracker);
- getTracker().set(content);
- completeInitialization();
- }
- }
-
- // A pre-notification listener for the viewer's Document
- class DocumentListener implements IDocumentListener {
- protected boolean allTextChanged = false;
-
- protected DocumentEvent currentEvent;
-
- synchronized public void documentAboutToBeChanged(DocumentEvent event) {
- if (isStoppedForwardingChanges())
- return;
-
- pendingDocumentChangedEvent = true;
- allTextChanged = event.getOffset() <= 0 && event.getLength() >= StructuredDocumentToTextAdapter.this.getDocument().getLength();
- currentEvent = event;
-
- StructuredDocumentToTextAdapter.this.relayTextChanging(event.getOffset(), event.getLength(), event.getText());
- }
-
- synchronized public void documentChanged(DocumentEvent event) {
- if (isStoppedForwardingChanges())
- return;
-
- if (currentEvent != null && event == currentEvent) {
- if (allTextChanged) {
- StructuredDocumentToTextAdapter.this.relayTextSet();
- }
- else {
- // temp work around for immediate thread
- // problem.
- // should have more general solution
- // soon. 'syncExec' are rumored to be
- // prone to hang.
- StructuredDocumentToTextAdapter.this.relayTextChanged();
- }
- }
-
- currentEvent = null;
- pendingDocumentChangedEvent = false;
- handlePendingEvents();
- lastEvent = null;
-
- }
- }
-
- private static class StringTextStore implements ITextStore {
-
- private String fContent;
-
- /**
- * Creates a new string text store with the given content.
- *
- * @param content
- * the content
- */
- public StringTextStore(String content) {
- Assert.isNotNull(content, "content can not be null when setting text store"); //$NON-NLS-1$
- fContent = content;
- }
-
- /*
- * @see org.eclipse.jface.text.ITextStore#get(int)
- */
- public char get(int offset) {
- return fContent.charAt(offset);
- }
-
- /*
- * @see org.eclipse.jface.text.ITextStore#get(int, int)
- */
- public String get(int offset, int length) {
- return fContent.substring(offset, offset + length);
- }
-
- /*
- * @see org.eclipse.jface.text.ITextStore#getLength()
- */
- public int getLength() {
- return fContent.length();
- }
-
- /*
- * @see org.eclipse.jface.text.ITextStore#replace(int, int,
- * java.lang.String)
- */
- public void replace(int offset, int length, String text) {
- }
-
- /*
- * @see org.eclipse.jface.text.ITextStore#set(java.lang.String)
- */
- public void set(String text) {
- }
-
- }
-
- /**
- * Changes to the Document/IStructuredDocument can extend beyond the text
- * change area and require more redrawing to keep the hilighting correct.
- * The event must be saved so that the redraw is only sent after a
- * textChanged event is received.
- */
- class StructuredDocumentListener implements IStructuredDocumentListener {
-
- public void newModel(NewDocumentEvent structuredDocumentEvent) {
-
- if (isStoppedForwardingChanges()) {
- // if
- // (StructuredDocumentToTextAdapter.this.fStopRelayingChanges)
- // {
- if (Debug.debugStructuredDocument) {
- System.out.println("skipped relaying StructuredDocumentEvent " + structuredDocumentEvent.getClass().getName()); //$NON-NLS-1$
- }
- return;
- }
- // should use textSet when all contents have
- // changed
- // otherwise need to use the pair of
- // textChanging and
- // textChanged.
- StructuredDocumentToTextAdapter.this.lastEvent = structuredDocumentEvent;
- }
-
- public void noChange(final NoChangeEvent structuredDocumentEvent) {
-
- if (Debug.debugStructuredDocument) {
- System.out.println("skipped relaying StructuredDocumentEvent " + structuredDocumentEvent.getClass().getName()); //$NON-NLS-1$
- }
- if (structuredDocumentEvent.reason == NoChangeEvent.READ_ONLY_STATE_CHANGE) {
- if (pendingDocumentChangedEvent) {
- if (lastEventQueue == null) {
- lastEventQueue = new ArrayList();
- }
- lastEventQueue.add(structuredDocumentEvent);
- }
- else {
- StructuredDocumentToTextAdapter.this.lastEvent = structuredDocumentEvent;
- }
- }
- }
-
- public void nodesReplaced(StructuredDocumentRegionsReplacedEvent structuredDocumentEvent) {
-
- if (isStoppedForwardingChanges()) {
- // if
- // (StructuredDocumentToTextAdapter.this.fStopRelayingChanges)
- // {
- if (Debug.debugStructuredDocument) {
- System.out.println("not relaying StructuredDocumentEvent " + structuredDocumentEvent.getClass().getName()); //$NON-NLS-1$
- }
- return;
- }
- if (Debug.debugStructuredDocument) {
- System.out.println("saving StructuredDocumentEvent " + structuredDocumentEvent.getClass().getName()); //$NON-NLS-1$
- }
- StructuredDocumentToTextAdapter.this.lastEvent = structuredDocumentEvent;
- }
-
- public void regionChanged(RegionChangedEvent structuredDocumentEvent) {
-
- if (isStoppedForwardingChanges()) {
- // if
- // (StructuredDocumentToTextAdapter.this.fStopRelayingChanges)
- // {
- if (Debug.debugStructuredDocument) {
- System.out.println("not relaying StructuredDocumentEvent " + structuredDocumentEvent.getClass().getName()); //$NON-NLS-1$
- }
- return;
- }
- if (Debug.debugStructuredDocument) {
- System.out.println("saving StructuredDocumentEvent " + structuredDocumentEvent.getClass().getName()); //$NON-NLS-1$
- }
- StructuredDocumentToTextAdapter.this.lastEvent = structuredDocumentEvent;
- }
-
- public void regionsReplaced(RegionsReplacedEvent structuredDocumentEvent) {
-
- if (isStoppedForwardingChanges()) {
- // if
- // (StructuredDocumentToTextAdapter.this.fStopRelayingChanges)
- // {
- if (Debug.debugStructuredDocument) {
- System.out.println("not relaying StructuredDocumentEvent " + structuredDocumentEvent.getClass().getName()); //$NON-NLS-1$
- }
- return;
- }
- if (Debug.debugStructuredDocument) {
- System.out.println("saving StructuredDocumentEvent " + structuredDocumentEvent.getClass().getName()); //$NON-NLS-1$
- }
- StructuredDocumentToTextAdapter.this.lastEvent = structuredDocumentEvent;
- }
- }
-
- private static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
- private final static boolean redrawBackground = true;
-
- /** The visible child document. */
- private ProjectionDocument fChildDocument;
-
- /** The master document */
- private IDocument fDocument;
- /** The document clone for the non-forwarding case. */
- private IDocument fDocumentClone;
-
- // only use this temp work around if on GTK
- // it causes funny "cursor blinking" if used on windows
- private final boolean forceRedrawOnRegionChanged = Platform.getWS().equals("gtk"); //$NON-NLS-1$
- /** The original content */
- private String fOriginalContent;
- /** The original line delimiters */
- private String[] fOriginalLineDelimiters;
-
- private int fStopRelayingChangesRequests = 0;
-
- private StyledText fStyledTextWidget;
-
- /** The registered text changed listeners */
- TextChangeListener[] fTextChangeListeners;
- protected DocumentListener internalDocumentListener;
-
- // The listeners for relaying DocumentEvents and
- // requesting repaints
- // after modification
- private IStructuredDocumentListener internalStructuredDocumentListener;
-
- protected StructuredDocumentEvent lastEvent = null;
- List lastEventQueue;
- boolean pendingDocumentChangedEvent;
-
- private static final boolean DEBUG = false;
-
- /**
- * TEST ONLY - TEST ONLY - TEST ONLY NOT API use this constructor only for
- * tests. Creates a new document adapter which is initiallly not connected
- * to any document.
- */
- public StructuredDocumentToTextAdapter() {
-
- internalStructuredDocumentListener = new StructuredDocumentListener();
- internalDocumentListener = new DocumentListener();
- // for testing only
- // setDocument(getModelManager().createStructuredDocumentFor(ContentTypeIdentifierForXML.ContentTypeID_XML));
- }
-
- /**
- * Creates a new document adapter which is initiallly not connected to any
- * document.
- */
- public StructuredDocumentToTextAdapter(StyledText styledTextWidget) {
-
- // do not use 'this()' in this case
- super();
- internalStructuredDocumentListener = new StructuredDocumentListener();
- internalDocumentListener = new DocumentListener();
- fStyledTextWidget = styledTextWidget;
- }
-
- private void _setDocument(IDocument newDoc) {
- if (fDocument instanceof IStructuredDocument) {
- ((IStructuredDocument) fDocument).removeDocumentChangedListener(internalStructuredDocumentListener);
- }
- fDocument = newDoc;
- if (!isStoppedForwardingChanges()) {
- fDocumentClone = null;
- fOriginalContent = getDocument() != null ? getDocument().get() : null;
- fOriginalLineDelimiters = getDocument() != null ? getDocument().getLegalLineDelimiters() : null;
- }
-
- if (DEBUG && fDocument != null && !(fDocument instanceof ILockable)) {
-
- System.out.println("Warning: non ILockable document used in StructuredDocumentToTextAdapter"); //$NON-NLS-1$
- System.out.println(" document updates on non-display thread will not be safe if editor open"); //$NON-NLS-1$
- }
- if (fDocument instanceof IStructuredDocument) {
- ((IStructuredDocument) fDocument).addDocumentChangedListener(internalStructuredDocumentListener);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.custom.StyledTextContent#addTextChangeListener(org.eclipse.swt.custom.TextChangeListener)
- */
- public synchronized void addTextChangeListener(TextChangeListener listener) {
-
- // make sure listener is not already in listening
- // (and if it is, print a warning to aid debugging,
- // if needed)
-
- if (Utilities.contains(fTextChangeListeners, listener)) {
- if (Debug.displayWarnings) {
- System.out.println("StructuredDocumentToTextAdapter::addTextChangedListeners. listener " + listener + " was added more than once. "); //$NON-NLS-2$//$NON-NLS-1$
- }
- }
- else {
- if (Debug.debugStructuredDocument) {
- System.out.println("StructuredDocumentToTextAdapter::addTextChangedListeners. Adding an instance of " + listener.getClass() + " as a listener on text adapter."); //$NON-NLS-2$//$NON-NLS-1$
- }
- int oldSize = 0;
- if (fTextChangeListeners != null) {
- // normally won't be null, but we need to be
- // sure, for first time through
- oldSize = fTextChangeListeners.length;
- }
- int newSize = oldSize + 1;
- TextChangeListener[] newListeners = new TextChangeListener[newSize];
- if (fTextChangeListeners != null) {
- System.arraycopy(fTextChangeListeners, 0, newListeners, 0, oldSize);
- }
- // add listener to last position
- newListeners[newSize - 1] = listener;
- //
- // now switch new for old
- fTextChangeListeners = newListeners;
- //
- }
- }
-
- /*
- * @see org.eclipse.swt.custom.StyledTextContent#getCharCount()
- */
- public int getCharCount() {
-
- // getDocument can sometimes be null during startup
- // and dispose
- int result = 0;
- IDocument doc = getDocument();
- if (doc != null) {
- result = getSafeDocument().getLength();
- }
- return result;
- }
-
- private IDocument getClonedDocument() {
- if (fDocumentClone == null) {
- String content = fOriginalContent == null ? "" : fOriginalContent; //$NON-NLS-1$
- String[] delims = fOriginalLineDelimiters == null ? DefaultLineTracker.DELIMITERS : fOriginalLineDelimiters;
- fDocumentClone = new DocumentClone(content, delims);
- }
- return fDocumentClone;
- }
-
- Display getDisplay() {
-
- // Note: the workbench should always have a display
- // (unless running headless), whereas Display.getCurrent()
- // only returns the display if the currently executing thread
- // has one.
- if (PlatformUI.isWorkbenchRunning())
- return PlatformUI.getWorkbench().getDisplay();
- else
- return null;
- }
-
- /**
- * Returns the visible document.
- *
- * @return IDocument
- */
- protected IDocument getDocument() {
-
- if (fChildDocument == null)
- return fDocument;
- return fChildDocument;
- }
-
- /**
- * Returns region in master document of given region (should be region in
- * projection document)
- *
- * @return region if no projection document exists, region of master
- * document if possible, null otherwise
- */
- private IRegion getProjectionToMasterRegion(IRegion region) {
- IRegion originalRegion = region;
- if (fChildDocument != null) {
- try {
- originalRegion = fChildDocument.getProjectionMapping().toOriginRegion(region);
- }
- catch (BadLocationException e) {
- Logger.logException(e);
- }
- }
-
- return originalRegion;
- }
-
- /**
- * Returns offset in projection document of given offset (should be offset
- * in master document)
- *
- * @return offset if no projection document exists, offset of projection
- * document if possible, -1 otherwise
- */
- private int getMasterToProjectionOffset(int offset) {
- int originalOffset = offset;
- if (fChildDocument != null) {
- try {
- originalOffset = fChildDocument.getProjectionMapping().toImageOffset(offset);
- }
- catch (BadLocationException e) {
- Logger.logException(e);
- }
- }
-
- return originalOffset;
- }
-
- /**
- * Return the line at the given character offset without delimiters.
- * <p>
- *
- * @param offset
- * offset of the line to return. Does not include delimiters of
- * preceeding lines. Offset 0 is the first character of the
- * document.
- * @return the line text without delimiters
- */
- public java.lang.String getLine(int lineNumber) {
-
- String result = null;
- if (lineNumber >= getLineCount()) {
- if (Debug.displayWarnings) {
- System.out.println("Development Debug: IStructuredDocument:getLine() error. lineNumber requested (" + lineNumber + ") was greater than number of lines(" + getLineCount() + "). EmptyString returned"); //$NON-NLS-1$//$NON-NLS-3$//$NON-NLS-2$
- }
- result = EMPTY_STRING;
- }
- else {
- IDocument doc = getSafeDocument();
- if (doc == null) {
- result = EMPTY_STRING;
- }
- else {
- try {
- IRegion r = doc.getLineInformation(lineNumber);
- if (r.getLength() > 0) {
- result = doc.get(r.getOffset(), r.getLength());
- }
- else {
- result = EMPTY_STRING;
- }
- }
- catch (BadLocationException e) {
- result = EMPTY_STRING;
- }
- }
- }
- return result;
- }
-
- /**
- * Tries to repair the line information.
- *
- * @param document
- * the document
- * @see IRepairableDocument#repairLineInformation()
- * @see Eclipse 3.0
- */
- private void repairLineInformation(IDocument document) {
- if (document instanceof IRepairableDocument) {
- IRepairableDocument repairable = (IRepairableDocument) document;
- repairable.repairLineInformation();
- }
- }
-
- /**
- * Return the line index at the given character offset.
- * <p>
- *
- * @param offset
- * offset of the line to return. The first character of the
- * document is at offset 0. An offset of getLength() is valid
- * and should answer the number of lines.
- * @return the line index. The first line is at index 0. If the character
- * at offset is a delimiter character, answer the line index of
- * the line that is delimited. For example, text = "\r\n\r\n",
- * delimiter = "\r\n", then: getLineAtOffset(0) == 0
- * getLineAtOffset(1) == 0 getLineAtOffset(2) == 1
- * getLineAtOffset(3) == 1 getLineAtOffset(4) == 2
- */
- public int getLineAtOffset(int offset) {
-
- int result = 0;
- IDocument doc = getSafeDocument();
- if (doc != null) {
- try {
- result = doc.getLineOfOffset(offset);
- }
- catch (BadLocationException x) {
- repairLineInformation(doc);
- try {
- result = doc.getLineOfOffset(offset);
- }
- catch (BadLocationException x2) {
- // should not occur, but seems to for projection
- // documents, related to repainting overview ruler
- result = 0;
- }
- }
- }
- return result;
- }
-
- public int getLineCount() {
- int result = 0;
- IDocument doc = getSafeDocument();
- if (doc != null) {
- result = doc.getNumberOfLines();
- }
- return result;
- }
-
- /*
- * @see org.eclipse.swt.custom.StyledTextContent#getLineDelimiter
- */
- public String getLineDelimiter() {
- String result = null;
- if (getParentDocument() instanceof IStructuredDocument) {
- result = ((IStructuredDocument) getParentDocument()).getLineDelimiter();
- }
- else {
- IDocument doc = getSafeDocument();
- result = TextUtilities.getDefaultLineDelimiter(doc);
- }
- return result;
- }
-
- /**
- * Return the character offset of the first character of the given line.
- * <p>
- *
- * @param lineIndex
- * index of the line. The first line is at index 0.
- * @return offset offset of the first character of the line. The first
- * character of the document is at offset 0. The return value
- * should include line delimiters. For example, text =
- * "\r\ntest\r\n", delimiter = "\r\n", then: getOffsetAtLine(0) ==
- * 0 getOffsetAtLine(1) == 2 getOffsetAtLine(2) == 8 NOTE: When
- * there is no text (i.e., no lines), getOffsetAtLine(0) is a
- * valid call that should return 0.
- */
- public int getOffsetAtLine(int lineIndex) {
-
- int result = 0;
- IDocument doc = getSafeDocument();
- if (doc != null) {
- try {
- result = doc.getLineOffset(lineIndex);
- }
- catch (BadLocationException e) {
- result = 0;
- }
- }
- return result;
- }
-
- /**
- * Returns the parent document
- *
- * @return the parent document
- */
- private IDocument getParentDocument() {
- return fDocument;
- }
-
- /**
- * This is the document to use for request from the StyledText widget. Its
- * either the live documnet or a clone of it, depending on stop/resume
- * state.
- */
- private IDocument getSafeDocument() {
- IDocument result = null;
- if (isStoppedForwardingChanges()) {
- result = getClonedDocument();
- }
- else {
- // note, this document can be normal structured text document,
- // or the projection/child document
- result = getDocument();
- }
- return result;
- }
-
- /**
- * @return org.eclipse.swt.custom.StyledText
- */
- StyledText getStyledTextWidget() {
- return fStyledTextWidget;
- }
-
- /**
- * Returns a string representing the content at the given range.
- * <p>
- *
- * @param start
- * the start offset of the text to return. Offset 0 is the
- * first character of the document.
- * @param length
- * the length of the text to return
- * @return the text at the given range
- */
- public String getTextRange(int start, int length) {
- String result = null;
- try {
- IDocument doc = getSafeDocument();
- result = doc.get(start, length);
- }
- catch (BadLocationException e) {
- result = EMPTY_STRING;
- }
- return result;
- }
-
- /**
- * assume only for "no change" events, for now
- */
- protected void handlePendingEvents() {
-
- if (lastEventQueue == null)
- return;
-
- Iterator iterator = lastEventQueue.iterator();
- while (iterator.hasNext()) {
- NoChangeEvent noChangeEvent = (NoChangeEvent) iterator.next();
- redrawNoChange(noChangeEvent);
- }
-
- lastEventQueue = null;
- lastEvent = null;
- }
-
- boolean isStoppedForwardingChanges() {
- return fStopRelayingChangesRequests > 0;
- }
-
- /**
- * this method is assumed to be called only for read only region changes.
- */
- protected void redrawNoChange(NoChangeEvent structuredDocumentEvent) {
-
- if (isStoppedForwardingChanges())
- return;
- if (Debug.debugStructuredDocument) {
- System.out.println("maybe redraw stuff"); //$NON-NLS-1$
- }
-
- int startOffset = structuredDocumentEvent.getOffset();
- int length = structuredDocumentEvent.getLength();
- redrawRangeWithLength(startOffset, length);
-
- }
-
- /**
- * Request a redraw of the text range occupied by the given
- * StructuredDocumentRegionsReplacedEvent
- *
- * @param structuredDocumentEvent
- */
- protected void redrawNodesReplaced(StructuredDocumentRegionsReplacedEvent structuredDocumentEvent) {
-
- if (isStoppedForwardingChanges())
- return;
- if (Debug.debugStructuredDocument) {
- System.out.println("maybe redraw stuff"); //$NON-NLS-1$
- }
- // just the new stuff
- IStructuredDocumentRegionList newStructuredDocumentRegions = structuredDocumentEvent.getNewStructuredDocumentRegions();
-
- int nNewNodes = newStructuredDocumentRegions.getLength();
- if (nNewNodes > 0) {
- IStructuredDocumentRegion firstNode = newStructuredDocumentRegions.item(0);
- IStructuredDocumentRegion lastNode = newStructuredDocumentRegions.item(nNewNodes - 1);
- redrawRange(firstNode.getStartOffset(), lastNode.getEndOffset());
- }
- }
-
- /**
- * Redraws the give offsets in terms of the StructuredDocument. If only
- * part of the model is visible, ensures that only the visible portion of
- * the given range is redrawn.
- *
- * @param startModelOffset
- * @param endModelOffset
- */
- private void redrawRange(final int startModelOffset, final int endModelOffset) {
-
- if (getDocument() == null)
- return;
- if (Debug.debugStructuredDocument) {
- System.out.println("redraw stuff: " + startModelOffset + "-" + endModelOffset); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (fChildDocument == null) {
- Runnable runnable = new Runnable() {
- public void run() {
- getStyledTextWidget().redrawRange(startModelOffset, endModelOffset - startModelOffset, redrawBackground);
- }
- };
- runOnDisplayThreadIfNeedede(runnable);
-
- }
- else {
- int high = getDocument().getLength();
- int startOffset = getMasterToProjectionOffset(startModelOffset);
-
- int endOffset = getMasterToProjectionOffset(endModelOffset);
-
- // if offsets were not visible, just try to redraw everything in
- // the child document
- // // not visible
- // if (endOffset < 0 || startOffset > high)
- // return;
- // restrict lower bound
- if (startOffset < 0) {
- startOffset = 0;
- }
- // restrict upper bound
- // if (endOffset > high) {
- // endOffset = high;
- // }
- if (endOffset < 0) {
- endOffset = high;
- }
-
- int length = endOffset - startOffset;
- // redrawBackground with false would be faster
- // but assumes background (or font) is not
- // changing
- final int finalStartOffset = startOffset;
- final int finallength = length;
-
- Runnable runnable = new Runnable() {
- public void run() {
- getStyledTextWidget().redrawRange(finalStartOffset, finallength, redrawBackground);
- }
- };
- runOnDisplayThreadIfNeedede(runnable);
-
- }
- }
-
- /**
- * Redraws the give offsets in terms of the Flat Node model. If only part
- * of the model is visible, ensures that only the visible portion of the
- * given range is redrawn.
- *
- * @param startModelOffset
- * @param endModelOffset
- */
- private void redrawRangeWithLength(final int startModelOffset, final int length) {
-
- if (getDocument() == null)
- return;
- if (Debug.debugStructuredDocument) {
- System.out.println("redraw stuff: " + startModelOffset + "-" + length); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (fChildDocument == null) {
- Runnable runnable = new Runnable() {
- public void run() {
- getStyledTextWidget().redrawRange(startModelOffset, length, redrawBackground);
- }
- };
- runOnDisplayThreadIfNeedede(runnable);
- }
- else {
- int high = getDocument().getLength();
- // TODO need to take into account segmented visible regions
- int startOffset = getMasterToProjectionOffset(startModelOffset);
- // not visible
- if (startOffset > high || length < 1)
- return;
- // restrict lower bound
- if (startOffset < 0) {
- startOffset = 0;
- }
- int endOffset = startOffset + length - 1;
- // restrict upper bound
- if (endOffset > high) {
- endOffset = high;
- }
-
- // note: length of the child documnet should be
- // updated,
- // need to investigate why its not at this
- // point, but is
- // probably just because the document event
- // handling is not
- // completely finished.
- int newLength = endOffset - startOffset; // d283007
-
- // redrawBackground with false would be faster
- // but assumes background (or font) is not
- // changing
- final int finalStartOffset = startOffset;
- final int finalNewLength = newLength;
- Runnable runnable = new Runnable() {
- public void run() {
- getStyledTextWidget().redrawRange(finalStartOffset, finalNewLength, redrawBackground);
- }
- };
- runOnDisplayThreadIfNeedede(runnable);
- }
- }
-
- /**
- * Request a redraw of the text range occupied by the given
- * RegionChangedEvent for certain (not all) ITextRegion contexts
- *
- * @param structuredDocumentEvent
- */
- protected void redrawRegionChanged(RegionChangedEvent structuredDocumentEvent) {
-
- if (isStoppedForwardingChanges()) {
- return;
- }
- if (Debug.debugStructuredDocument) {
- System.out.println("maybe redraw stuff"); //$NON-NLS-1$
- }
-
-
- // (nsd) TODO: try to make this reliable somehow
- // without being directly content dependent
- // if ((region instanceof ITextRegionContainer) ||
- // (type == XMLJSPRegionContexts.BLOCK_TEXT) ||
- // (type == XMLJSPRegionContexts.JSP_CONTENT)) {
- // IStructuredDocumentRegion flatNode =
- // structuredDocumentEvent.getStructuredDocumentRegion();
- // // redraw background of false is faster,
- // // but assumes background (or font) is not
- // changing
- // redrawRange(flatNode.getStartOffset(region),
- // flatNode.getEndOffset(region));
- // }
- if (forceRedrawOnRegionChanged) {
- // workaround for redrawing problems on Linux-GTK
- int startOffset = structuredDocumentEvent.getOffset();
- int endOffset = structuredDocumentEvent.getOffset() + structuredDocumentEvent.getLength();
- try {
- IRegion startLine = structuredDocumentEvent.fDocument.getLineInformationOfOffset(startOffset);
- IRegion endLine = structuredDocumentEvent.fDocument.getLineInformationOfOffset(endOffset);
- if (startLine != null && endLine != null) {
- redrawRange(startLine.getOffset(), endLine.getOffset() + endLine.getLength());
- }
- }
- catch (BadLocationException e) {
- // nothing for now
- }
- }
- }
-
- /**
- * Request a redraw of the text range occupied by the given
- * RegionsReplacedEvent
- *
- * @param structuredDocumentEvent
- */
- protected void redrawRegionsReplaced(RegionsReplacedEvent structuredDocumentEvent) {
-
- if (isStoppedForwardingChanges())
- return;
- if (Debug.debugStructuredDocument) {
- System.out.println("maybe redraw stuff"); //$NON-NLS-1$
- }
- ITextRegionList newRegions = structuredDocumentEvent.getNewRegions();
- int nRegions = newRegions.size();
- if (nRegions > 0) {
- ITextRegion firstRegion = newRegions.get(0);
- ITextRegion lastRegion = newRegions.get(nRegions - 1);
- IStructuredDocumentRegion flatNode = structuredDocumentEvent.getStructuredDocumentRegion();
- redrawRange(flatNode.getStartOffset(firstRegion), flatNode.getEndOffset(lastRegion));
- }
- }
-
- protected void redrawTextChanged() {
-
- if (lastEvent != null) {
- // update display, since some cases can effect
- // highlighting beyond the changed text area.
- if (lastEvent instanceof StructuredDocumentRegionsReplacedEvent)
- redrawNodesReplaced((StructuredDocumentRegionsReplacedEvent) lastEvent);
- if (lastEvent instanceof RegionsReplacedEvent)
- redrawRegionsReplaced((RegionsReplacedEvent) lastEvent);
- if (lastEvent instanceof RegionChangedEvent)
- redrawRegionChanged((RegionChangedEvent) lastEvent);
- // moved following line to 'document changed' so
- // the "last event" can be
- // re-drawn after pending re-draws
- // lastEvent = null;
- }
- }
-
- /**
- * Sends a text replace event to all registered listeners.
- */
- protected void relayTextChanged() {
-
- if (isStoppedForwardingChanges()) {
- if (Debug.debugStructuredDocument && getDocument() != null) {
- System.out.println("NOT relaying text changed (" + getDocument().getLength() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return;
- }
- if (Debug.debugStructuredDocument && getDocument() != null) {
- System.out.println("relaying text changed (" + getDocument().getLength() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- final TextChangedEvent textChangedEvent = new TextChangedEvent(this);
-
- // we must assign listeners to local variable, since
- // the add and remove listener
- // methods can change the actual instance of the
- // listener array from another thread
-
- Runnable runnable = new Runnable() {
- public void run() {
- if (fTextChangeListeners != null) {
- Object[] holdListeners = fTextChangeListeners;
- for (int i = 0; i < holdListeners.length; i++) {
- // this is a safe cast, since addListeners
- // requires a IStructuredDocumentListener
- ((TextChangeListener) holdListeners[i]).textChanged(textChangedEvent);
- }
- }
- }
- };
- runOnDisplayThreadIfNeedede(runnable);
- redrawTextChanged();
- }
-
- /**
- * Sends a text change to all registered listeners
- */
- protected void relayTextChanging(int requestedStart, int requestedLength, String requestedChange) {
-
- if (getDocument() == null)
- return;
- if (isStoppedForwardingChanges()) {
- if (Debug.debugStructuredDocument && getDocument() != null) {
- System.out.println("NOT relaying text changing: " + requestedStart + ":" + getDocument().getLength()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return;
- }
- if (Debug.debugStructuredDocument && getDocument() != null) {
- System.out.println("relaying text changing: " + requestedStart + ":" + getDocument().getLength()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- lastEvent = null;
- try {
- final TextChangingEvent textChangingEvent = new TextChangingEvent(this);
-
- textChangingEvent.start = requestedStart;
- textChangingEvent.replaceCharCount = requestedLength;
- textChangingEvent.newCharCount = (requestedChange == null ? 0 : requestedChange.length());
- textChangingEvent.replaceLineCount = getDocument().getNumberOfLines(requestedStart, requestedLength) - 1;
- textChangingEvent.newText = requestedChange;
- textChangingEvent.newLineCount = (requestedChange == null ? 0 : getDocument().computeNumberOfLines(requestedChange));
-
- // we must assign listeners to local variable,
- // since the add and remove listner
- // methods can change the actual instance of the
- // listener array from another thread
- Runnable runnable = new Runnable() {
- public void run() {
- if (fTextChangeListeners != null) {
- TextChangeListener[] holdListeners = fTextChangeListeners;
- for (int i = 0; i < holdListeners.length; i++) {
- // this is a safe cast, since
- // addListeners requires a
- // IStructuredDocumentListener
- holdListeners[i].textChanging(textChangingEvent);
- }
- }
- }
- };
- runOnDisplayThreadIfNeedede(runnable);
- }
- catch (BadLocationException e) {
- // log for now, unless we find reason not to
- Logger.log(Logger.INFO, e.getMessage());
- }
- }
-
- /**
- * Sends a text set event to all registered listeners. Widget should
- * redraw itself automatically.
- */
- protected void relayTextSet() {
-
- if (isStoppedForwardingChanges()) {
- if (Debug.debugStructuredDocument && getDocument() != null) {
- System.out.println("NOT relaying text set (" + getDocument().getLength() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return;
- }
- if (Debug.debugStructuredDocument && getDocument() != null) {
- System.out.println("relaying text set (" + getDocument().getLength() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- lastEvent = null;
- final TextChangedEvent textChangedEvent = new TextChangedEvent(this);
-
- // we must assign listeners to local variable, since
- // the add and remove listner
- // methods can change the actual instance of the
- // listener array from another thread
- Runnable runnable = new Runnable() {
- public void run() {
- if (fTextChangeListeners != null) {
- TextChangeListener[] holdListeners = fTextChangeListeners;
- for (int i = 0; i < holdListeners.length; i++) {
- holdListeners[i].textSet(textChangedEvent);
- }
- }
- }
- };
- runOnDisplayThreadIfNeedede(runnable);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.custom.StyledTextContent#removeTextChangeListener(org.eclipse.swt.custom.TextChangeListener)
- */
- public synchronized void removeTextChangeListener(final TextChangeListener listener) {
-
- if ((fTextChangeListeners != null) && (listener != null)) {
- // if its not in the listeners, we'll ignore the
- // request
- if (!Utilities.contains(fTextChangeListeners, listener)) {
- if (Debug.displayWarnings) {
- System.out.println("StructuredDocumentToTextAdapter::removeTextChangedListeners. listener " + listener + " was not present. "); //$NON-NLS-2$//$NON-NLS-1$
- }
- }
- else {
- if (Debug.debugStructuredDocument) {
- System.out.println("StructuredDocumentToTextAdapter::addTextChangedListeners. Removing an instance of " + listener.getClass() + " as a listener on text adapter."); //$NON-NLS-2$//$NON-NLS-1$
- }
- final int oldSize = fTextChangeListeners.length;
- int newSize = oldSize - 1;
- final TextChangeListener[] newListeners = new TextChangeListener[newSize];
-
- Runnable runnable = new Runnable() {
- public void run() {
- int index = 0;
- for (int i = 0; i < oldSize; i++) {
- if (fTextChangeListeners[i] != listener) {
- // copy old to new if its not the
- // one we are removing
- newListeners[index++] = fTextChangeListeners[i];
- }
- }
- }
- };
- runOnDisplayThreadIfNeedede(runnable);
- // now that we have a new array, let's
- // switch it for the old one
- fTextChangeListeners = newListeners;
- }
- }
- }
-
- /**
- * Replace the text with "newText" starting at position "start" for a
- * length of "replaceLength".
- * <p>
- * Implementors have to notify TextChanged listeners after the content has
- * been updated. The TextChangedEvent should be set as follows:
- * <ul>
- * <li>event.type = SWT.TextReplaced
- * <li>event.start = start of the replaced text
- * <li>event.numReplacedLines = number of replaced lines
- * <li>event.numNewLines = number of new lines
- * <li>event.replacedLength = length of the replaced text
- * <li>event.newLength = length of the new text
- * </ul>
- * <b>NOTE: </b> numNewLines is the number of inserted lines and
- * numReplacedLines is the number of deleted lines based on the change
- * that occurs visually. For example:
- * <ul>
- * <li>(replacedText, newText) ==> (numReplacedLines, numNewLines)
- * <li>("", "\n") ==> (0, 1)
- * <li>("\n\n", "a") ==> (2, 0)
- * <li>("a", "\n\n") ==> (0, 2)
- * <li>("\n", "") ==> (1, 0)
- * </ul>
- * </p>
- *
- * @param start
- * start offset of text to replace, none of the offsets include
- * delimiters of preceeding lines, offset 0 is the first
- * character of the document
- * @param replaceLength
- * start offset of text to replace
- * @param newText
- * start offset of text to replace
- */
- public void replaceTextRange(int start, int replaceLength, String text) {
-
- if (getParentDocument() instanceof IStructuredDocument) {
- // the structuredDocument initiates the "changing"
- // and "changed" events.
- // they are both fired by the time this method
- // returns.
- IRegion region = getProjectionToMasterRegion(new Region(start, replaceLength));
- if (region != null) {
- ((IStructuredDocument) getParentDocument()).replaceText(this, region.getOffset(), region.getLength(), text);
- return;
- }
- }
- // default is to just try and replace text range in current document
- try {
- getDocument().replace(start, replaceLength, text);
- }
- catch (BadLocationException e) {
- // log for now, unless we find reason not to
- Logger.log(Logger.INFO, e.getMessage());
- }
- }
-
- /**
- * @see org.eclipse.jface.text.IDocumentAdapterExtension#resumeForwardingDocumentChanges()
- */
- public void resumeForwardingDocumentChanges() {
-
- // from re-reading the textSet API in StyledText, we
- // must call
- // textSet if all the contents changed. If all the
- // contents did
- // not change, we need to call the pair of APIs,
- // textChanging and
- // textChanged. So, if we ever keep careful track of
- // changes
- // during stop forwarding and resume forwarding, we
- // can
- // investigate change make use of the pair of APIs.
- fStopRelayingChangesRequests--;
- if (fStopRelayingChangesRequests == 0) {
- // fIsForwarding= true;
- fDocumentClone = null;
- fOriginalContent = null;
- fOriginalLineDelimiters = null;
- // fireTextSet();
- relayTextSet();
- }
- }
-
- /**
- * This 'Runnable' should be very brief, and should not "call out" to
- * other code which itself might call syncExec, or deadlock might occur.
- *
- * @param r
- */
- private void runOnDisplayThreadIfNeedede(Runnable r) {
- // if there is no Display at all (that is, running headless),
- // or if we are already running on the display thread, then
- // simply execute the runnable.
- if (getDisplay() == null || (Thread.currentThread() == getDisplay().getThread())) {
- r.run();
- }
- else {
- // otherwise force the runnable to run on the display thread.
- //
- // Its unclear if we need this at all, once
- // we "force" document update to always take place on display
- // thread.
- IDocument doc = getDocument();
- if (doc instanceof ILockable) {
-
- ILock lock = null;
- try {
- lock = ((ILockable) doc).getLockObject();
- lock.acquire();
- getDisplay().syncExec(r);
- }
- finally {
- if (lock != null) {
- lock.release();
- }
- }
- }
- else {
- // else, ignore!, since risk of deadlock
- throw new IllegalStateException("non lockable document used for structuredDocumentToTextAdapter"); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * @param newModel
- */
- public void setDocument(IDocument document) {
-
- if (getDocument() != null) {
- getDocument().removePrenotifiedDocumentListener(internalDocumentListener);
- }
- lastEvent = null;
- if (document instanceof ProjectionDocument) {
- fChildDocument = (ProjectionDocument) document;
- _setDocument(fChildDocument.getMasterDocument());
- }
- else {
- fChildDocument = null;
- _setDocument(document);
- }
- if (getDocument() != null) {
- getDocument().addPrenotifiedDocumentListener(internalDocumentListener);
- }
- }
-
- /**
- * @see IDocument#setText
- */
- public void setText(String string) {
-
- if (isStoppedForwardingChanges()) {
- fDocumentClone = null;
- fOriginalContent = getDocument().get();
- fOriginalLineDelimiters = getDocument().getLegalLineDelimiters();
- }
- else if (getParentDocument() instanceof IStructuredDocument) {
- ((IStructuredDocument) getDocument()).setText(this, string);
- }
- else {
- getDocument().set(string);
- }
- relayTextSet();
- }
-
- /**
- * This method was added to make testing easier. Normally, the widget is
- * specified on the constructor.
- */
- public void setWidget(StyledText widget) {
-
- fStyledTextWidget = widget;
- }
-
- /**
- * @see org.eclipse.jface.text.IDocumentAdapterExtension#stopForwardingDocumentChanges()
- */
- public void stopForwardingDocumentChanges() {
-
- fStopRelayingChangesRequests++;
- // only need to take snapshot on first request
- if (fStopRelayingChangesRequests == 1) {
- fDocumentClone = null;
- fOriginalContent = getDocument().get();
- fOriginalLineDelimiters = getDocument().getLegalLineDelimiters();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredLineChangeHover.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredLineChangeHover.java
deleted file mode 100644
index fa5dc3366a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredLineChangeHover.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.source.LineChangeHover;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Escapes diff hover presentation text (converts < to &lt; > to &gt; etc...)
- * so that html in the diff file (displayed in hover) isn't presented as style
- * (bold, italic, colors, etc...)
- *
- * @author pavery
- */
-public class StructuredLineChangeHover extends LineChangeHover {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.source.IAnnotationHoverExtension#getHoverControlCreator()
- */
- public IInformationControlCreator getHoverControlCreator() {
- // use the default information control creator that just displays text
- // as text, not html content
- // because there is no special html that should be presented when just
- // showing diff
- // in the future, sourceviewer should be used instead of this plain
- // text control like java uses
- // SourceViewerInformationControl
- return new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent);
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredMarkerAnnotation.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredMarkerAnnotation.java
deleted file mode 100644
index 197bb5abbf..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredMarkerAnnotation.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.source.IAnnotationPresentation;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
-import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
-
-
-/**
- * This is overridden to get around the problem of being registered as a
- * org.eclipse.wst.validation.core.problemmarker rather than a
- * org.eclipse.core.resource.problemmarker causing all problems to be skipped
- * in the OverviewRuler
- */
-public class StructuredMarkerAnnotation extends MarkerAnnotation implements IAnnotationPresentation {
- // controls if icon should be painted gray
- private boolean fIsGrayed = false;
- String fAnnotationType = null;
-
- StructuredMarkerAnnotation(IMarker marker) {
- super(marker);
- }
-
- public final String getAnnotationType() {
- return fAnnotationType;
- }
-
- /**
- * Eventually will have to use IAnnotationPresentation &
- * IAnnotationExtension
- *
- * @see org.eclipse.ui.texteditor.MarkerAnnotation#getImage(org.eclipse.swt.widgets.Display)
- */
- protected Image getImage(Display display) {
- Image image = null;
- if (fAnnotationType == TemporaryAnnotation.ANNOT_ERROR) {
- image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
- }
- else if (fAnnotationType == TemporaryAnnotation.ANNOT_WARNING) {
- image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
- }
- else if (fAnnotationType == TemporaryAnnotation.ANNOT_INFO) {
- image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
- }
-
- if (image != null && isGrayed())
- setImage(getGrayImage(display, image));
- else
- setImage(image);
-
- return super.getImage(display);
- }
-
- private Image getGrayImage(Display display, Image image) {
- if (image != null) {
- String key = Integer.toString(image.hashCode());
- // make sure we cache the gray image
- Image grayImage = JFaceResources.getImageRegistry().get(key);
- if (grayImage == null) {
- grayImage = new Image(display, image, SWT.IMAGE_GRAY);
- JFaceResources.getImageRegistry().put(key, grayImage);
- }
- image = grayImage;
- }
- return image;
- }
-
- public final boolean isGrayed() {
- return fIsGrayed;
- }
-
- public final void setGrayed(boolean grayed) {
- fIsGrayed = grayed;
- }
-
- /**
- * Initializes the annotation's icon representation and its drawing layer
- * based upon the properties of the underlying marker.
- */
- protected void initAnnotationType() {
-
- IMarker marker = getMarker();
- fAnnotationType = TemporaryAnnotation.ANNOT_UNKNOWN;
- try {
- if (marker.isSubtypeOf(IMarker.PROBLEM)) {
- int severity = marker.getAttribute(IMarker.SEVERITY, -1);
- switch (severity) {
- case IMarker.SEVERITY_ERROR :
- fAnnotationType = TemporaryAnnotation.ANNOT_ERROR;
- break;
- case IMarker.SEVERITY_WARNING :
- fAnnotationType = TemporaryAnnotation.ANNOT_WARNING;
- break;
- case IMarker.SEVERITY_INFO :
- fAnnotationType = TemporaryAnnotation.ANNOT_INFO;
- break;
- }
- }
-
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModel.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModel.java
deleted file mode 100644
index c6af5e5596..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModel.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.Position;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IBreakpointConstants;
-
-
-/**
- * Source editor resource marker annotation model implementation
- */
-public class StructuredResourceMarkerAnnotationModel extends ResourceMarkerAnnotationModel {
- public final static String SECONDARY_ID_KEY = IBreakpointConstants.RESOURCE_PATH;
- protected IResource fMarkerResource;
- protected String fSecondaryMarkerAttributeValue;
-
- /**
- * Constructor
- *
- * @param resource
- */
- public StructuredResourceMarkerAnnotationModel(IResource resource) {
- super(resource);
- fMarkerResource = resource;
- }
-
- public StructuredResourceMarkerAnnotationModel(IResource resource, String secondaryID) {
- super(resource);
- fMarkerResource = resource;
- fSecondaryMarkerAttributeValue = secondaryID;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#createMarkerAnnotation(org.eclipse.core.resources.IMarker)
- */
- protected MarkerAnnotation createMarkerAnnotation(IMarker marker) {
- /*
- * We need to do some special processing if marker is a validation
- * (aka problem) marker or if marker is a breakpoint marker so create
- * a special marker annotation for those markers. Otherwise, use
- * default.
- */
- if (MarkerUtilities.isMarkerType(marker, IMarker.PROBLEM)) {
- return new StructuredMarkerAnnotation(marker);
- }
- return super.createMarkerAnnotation(marker);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#getMarkerPosition(org.eclipse.core.resources.IMarker)
- */
- public Position getMarkerPosition(IMarker marker) {
- Position pos = super.getMarkerPosition(marker);
-
- // if ((pos == null || pos.getLength() == 0) && marker.getType() ==
- // IInternalDebugUIConstants.ANN_INSTR_POINTER_CURRENT) {
- if (pos == null || pos.getLength() == 0) {
- // We probably should create position from marker if marker
- // attributes specify a valid position
- pos = createPositionFromMarker(marker);
- }
-
- return pos;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#isAcceptable(org.eclipse.core.resources.IMarker)
- */
- protected boolean isAcceptable(IMarker marker) {
- try {
- Object attr = marker.getAttribute(IBreakpointConstants.ATTR_HIDDEN);
- if (attr != null && ((Boolean) attr).equals(Boolean.TRUE))
- return false;
- }
- catch (CoreException e) {
- // ignore
- }
-
- if (fSecondaryMarkerAttributeValue == null)
- return super.isAcceptable(marker);
- String markerSecondaryMarkerAttributeValue = marker.getAttribute(SECONDARY_ID_KEY, ""); //$NON-NLS-1$
- boolean isSameFile = fSecondaryMarkerAttributeValue.equalsIgnoreCase(markerSecondaryMarkerAttributeValue);
- return super.isAcceptable(marker) && isSameFile;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModelFactory.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModelFactory.java
deleted file mode 100644
index 4844776495..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredResourceMarkerAnnotationModelFactory.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModelFactory;
-
-/**
- *
- * @author nsd
- *
- * Used by the org.eclipse.core.filebuffers.annotationModelCreation extension
- * point
- */
-public class StructuredResourceMarkerAnnotationModelFactory extends ResourceMarkerAnnotationModelFactory {
-
- public StructuredResourceMarkerAnnotationModelFactory() {
- super();
- }
-
- /*
- * @see org.eclipse.core.filebuffers.IAnnotationModelFactory#createAnnotationModel(org.eclipse.core.runtime.IPath)
- */
- public IAnnotationModel createAnnotationModel(IPath location) {
- IAnnotationModel model = null;
- IFile file = FileBuffers.getWorkspaceFileAtLocation(location);
- if (file != null) {
- model = new StructuredResourceMarkerAnnotationModel(file);
- }
- else {
- model = new StructuredResourceMarkerAnnotationModel(ResourcesPlugin.getWorkspace().getRoot(), location.toString());
- }
- return model;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextAnnotationHover.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextAnnotationHover.java
deleted file mode 100644
index d2d3e3398b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextAnnotationHover.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugModelPresentation;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationHover;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-
-public class StructuredTextAnnotationHover implements IAnnotationHover {
-
- /**
- * Provides a set of convenience methods for creating HTML pages. Taken
- * from org.eclipse.jdt.internal.ui.text.HTMLPrinter
- */
- class HTMLPrinter {
-
- HTMLPrinter() {
- }
-
- void addBullet(StringBuffer buffer, String bullet) {
- if (bullet != null) {
- buffer.append("<li>"); //$NON-NLS-1$
- buffer.append(bullet);
- buffer.append("</li>"); //$NON-NLS-1$
- }
- }
-
- void addPageEpilog(StringBuffer buffer) {
- buffer.append("</font></body></html>"); //$NON-NLS-1$
- }
-
- void addPageProlog(StringBuffer buffer) {
- insertPageProlog(buffer, buffer.length());
- }
-
- void addParagraph(StringBuffer buffer, Reader paragraphReader) {
- if (paragraphReader != null)
- addParagraph(buffer, read(paragraphReader));
- }
-
- void addParagraph(StringBuffer buffer, String paragraph) {
- if (paragraph != null) {
- buffer.append("<p>"); //$NON-NLS-1$
- buffer.append(paragraph);
- }
- }
-
- void addSmallHeader(StringBuffer buffer, String header) {
- if (header != null) {
- buffer.append("<h5>"); //$NON-NLS-1$
- buffer.append(header);
- buffer.append("</h5>"); //$NON-NLS-1$
- }
- }
-
- String convertToHTMLContent(String content) {
- content = replace(content, '<', "&lt;"); //$NON-NLS-1$
- return replace(content, '>', "&gt;"); //$NON-NLS-1$
- }
-
- void endBulletList(StringBuffer buffer) {
- buffer.append("</ul>"); //$NON-NLS-1$
- }
-
- void insertPageProlog(StringBuffer buffer, int position) {
- buffer.insert(position, "<html><body text=\"#000000\" bgcolor=\"#FFFF88\"><font size=-1>"); //$NON-NLS-1$
- }
-
- String read(Reader rd) {
-
- StringBuffer buffer = new StringBuffer();
- char[] readBuffer = new char[2048];
-
- try {
- int n = rd.read(readBuffer);
- while (n > 0) {
- buffer.append(readBuffer, 0, n);
- n = rd.read(readBuffer);
- }
- return buffer.toString();
- }
- catch (IOException x) {
- }
-
- return null;
- }
-
- private String replace(String text, char c, String s) {
-
- int previous = 0;
- int current = text.indexOf(c, previous);
-
- if (current == -1)
- return text;
-
- StringBuffer buffer = new StringBuffer();
- while (current > -1) {
- buffer.append(text.substring(previous, current));
- buffer.append(s);
- previous = current + 1;
- current = text.indexOf(c, previous);
- }
- buffer.append(text.substring(previous));
-
- return buffer.toString();
- }
-
- void startBulletList(StringBuffer buffer) {
- buffer.append("<ul>"); //$NON-NLS-1$
- }
- }
-
- private IDebugModelPresentation fDebugModelPresentation;
-
- private HTMLPrinter printer = new HTMLPrinter();
-
- /**
- * Returns the distance to the ruler line.
- */
- private int compareRulerLine(Position position, IDocument document, int line) {
-
- if (position.getOffset() > -1 && position.getLength() > -1) {
- try {
- int markerLine = document.getLineOfOffset(position.getOffset());
- if (line == markerLine)
- return 1;
- if (markerLine <= line && line <= document.getLineOfOffset(position.getOffset() + position.getLength()))
- return 2;
- }
- catch (BadLocationException x) {
- }
- }
-
- return 0;
- }
-
- /*
- * Formats the message of this hover to fit onto the screen.
- */
- private String formatHoverText(String text, ISourceViewer sourceViewer) {
- String result = null;
- String lineDelim = new String();
- try {
- lineDelim = sourceViewer.getDocument().getLineDelimiter(0);
- }
- catch (org.eclipse.jface.text.BadLocationException exception) {
- // skip, just use default
- }
- Display display = sourceViewer.getTextWidget().getDisplay();
-
- // replace special characters in text with html entity (like <, >, &
- // to &lt;, &gt;, &&;)
- text = StringUtils.convertToHTMLContent(text);
-
- Reader textReader = new StringReader(text);
- GC gc = new GC(display);
- try {
- StringBuffer buf = new StringBuffer();
-
- StructuredTextLineBreakingReader reader = new StructuredTextLineBreakingReader(textReader, gc, getHoverWidth(display));
- String line = reader.readLine();
- while (line != null) {
- if (buf.length() != 0) {
- buf.append(lineDelim);
- }
- buf.append(line);
- line = reader.readLine();
- }
- result = buf.toString();
- }
- catch (IOException exception) {
- Logger.logException(exception);
- }
- finally {
- gc.dispose();
- }
- return result;
- }
-
- /*
- * Formats several message as HTML text.
- */
- private String formatMultipleHoverText(List messages) {
-
- StringBuffer buffer = new StringBuffer();
- printer.addPageProlog(buffer);
- printer.addParagraph(buffer, SSEUIMessages.Multiple_errors); //$NON-NLS-1$
-
- printer.startBulletList(buffer);
- Iterator e = messages.iterator();
- while (e.hasNext())
- printer.addBullet(buffer, printer.convertToHTMLContent((String) e.next()));
- printer.endBulletList(buffer);
-
- printer.addPageEpilog(buffer);
- return buffer.toString();
- }
-
- /**
- * @see IVerticalRulerHover#getHoverInfo(ISourceViewer, int)
- */
- public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
- IMarker marker = getMarker(sourceViewer, lineNumber);
- List messages = new ArrayList(marker == null ? 0 : 1);
- if (marker != null) {
- String text = marker.getAttribute(IMarker.MESSAGE, (String) null);
- if (text != null) {
- messages.add(text);
- }
- else {
- try {
- if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) {
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = manager.getBreakpoints();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- if (breakpoint.getMarker().equals(marker)) {
- if (fDebugModelPresentation == null) {
- fDebugModelPresentation = DebugUITools.newDebugModelPresentation();
- }
- text = fDebugModelPresentation.getText(breakpoint);
- if (text != null) {
- messages.add(text);
- }
- }
- }
- }
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- }
- }
- List temporaryAnnotations = getTemporaryAnnotationsForLine(sourceViewer, lineNumber);
- for (int i = 0; i < temporaryAnnotations.size(); i++) {
- String message = ((Annotation) temporaryAnnotations.get(i)).getText();
- if (message != null) {
- boolean duplicated = false;
- for (int j = 0; j < messages.size(); j++)
- duplicated = duplicated || messages.get(j).equals(message);
- if (!duplicated) {
- messages.add(message);
- }
-
- }
- else
- messages.add(((ITemporaryAnnotation) temporaryAnnotations.get(i)).toString());
- }
- if (messages.size() > 1)
- return formatMultipleHoverText(messages);
- else if (messages.size() > 0)
- return formatHoverText(messages.get(0).toString(), sourceViewer);
- else
- return null;
- }
-
- private int getHoverWidth(Display display) {
- Rectangle displayBounds = display.getBounds();
- int hoverWidth = displayBounds.width - (display.getCursorLocation().x - displayBounds.x);
- hoverWidth -= 12; // XXX: Add some space to the border, Revisit
- if (hoverWidth < 200) {
- hoverWidth = 200;
- }
- return hoverWidth;
- }
-
- /**
- * Returns one marker which includes the ruler's line of activity.
- */
- private IMarker getMarker(ISourceViewer viewer, int line) {
-
- IDocument document = viewer.getDocument();
- IAnnotationModel model = viewer.getAnnotationModel();
-
- if (model == null)
- return null;
-
- List exact = new ArrayList();
- List including = new ArrayList();
-
- Iterator e = model.getAnnotationIterator();
- while (e.hasNext()) {
- Object o = e.next();
- if (o instanceof MarkerAnnotation) {
- MarkerAnnotation a = (MarkerAnnotation) o;
- switch (compareRulerLine(model.getPosition(a), document, line)) {
- case 1 :
- exact.add(a.getMarker());
- break;
- case 2 :
- including.add(a.getMarker());
- break;
- }
- }
- }
-
- return select(exact, including);
- }
-
- /**
- * Returns one marker which includes the ruler's line of activity.
- */
- private List getTemporaryAnnotationsForLine(ISourceViewer viewer, int line) {
-
- IDocument document = viewer.getDocument();
- IAnnotationModel model = viewer.getAnnotationModel();
-
- if (model == null)
- return null;
-
- List exact = new ArrayList();
- List including = new ArrayList();
-
- Iterator e = model.getAnnotationIterator();
- while (e.hasNext()) {
- Object o = e.next();
- if (o instanceof ITemporaryAnnotation) {
- ITemporaryAnnotation a = (ITemporaryAnnotation) o;
- Position position = model.getPosition((Annotation) a);
- if (position == null)
- continue;
-
- switch (compareRulerLine(position, document, line)) {
- case 1 :
- exact.add(a);
- break;
- case 2 :
- including.add(a);
- break;
- }
- }
- }
-
- return exact;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.IReleasable#release()
- */
- public void release() {
- if (fDebugModelPresentation != null) {
- fDebugModelPresentation.dispose();
- }
- }
-
- /**
- * Selects one marker from the two lists.
- */
- private IMarker select(List firstChoice, List secondChoice) {
- if (!firstChoice.isEmpty())
- return (IMarker) firstChoice.get(0);
- if (!secondChoice.isEmpty())
- return (IMarker) secondChoice.get(0);
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextLineBreakingReader.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextLineBreakingReader.java
deleted file mode 100644
index 1140fab5e1..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextLineBreakingReader.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-
-import org.eclipse.swt.graphics.GC;
-
-/*
- * Not a real reader. Could change if requested
- */
-public class StructuredTextLineBreakingReader {
- private GC fGC;
- private int fIndex;
- private String fLine;
- private int fMaxWidth;
-
- private BufferedReader fReader;
-
- /**
- * Creates a reader that breaks an input text to fit in a given width.
- *
- * @param reader
- * Reader of the input text
- * @param gc
- * The graphic context that defines the currently used font
- * sizes
- * @param maxLineWidth
- * The max width (pixes) where the text has to fit in
- */
- public StructuredTextLineBreakingReader(Reader reader, GC gc, int maxLineWidth) {
- fReader = new BufferedReader(reader);
- fGC = gc;
- fMaxWidth = maxLineWidth;
- fLine = null;
- fIndex = 0;
- }
-
- private int findNextBreakIndex(int currIndex) {
- int currWidth = 0;
- int lineLength = fLine.length();
-
- while (currIndex < lineLength) {
- char ch = fLine.charAt(currIndex);
- int nextIndex = currIndex + 1;
- // leading whitespaces are counted to the following word
- if (Character.isWhitespace(ch)) {
- while (nextIndex < lineLength && Character.isWhitespace(fLine.charAt(nextIndex))) {
- nextIndex++;
- }
- }
- while (nextIndex < lineLength && !Character.isWhitespace(fLine.charAt(nextIndex))) {
- nextIndex++;
- }
- String word = fLine.substring(currIndex, nextIndex);
- int wordWidth = fGC.textExtent(word).x;
- int nextWidth = wordWidth + currWidth;
- if (nextWidth > fMaxWidth && wordWidth < fMaxWidth) {
- return currIndex;
- }
- currWidth = nextWidth;
- currIndex = nextIndex;
- }
- return currIndex;
- }
-
- private int findWordBegin(int idx) {
- while (idx < fLine.length() && Character.isWhitespace(fLine.charAt(idx))) {
- idx++;
- }
- return idx;
- }
-
- /**
- * Reads the next line. The lengths of the line will not exceed the gived
- * maximum width.
- */
- public String readLine() throws IOException {
- if (fLine == null) {
- String line = fReader.readLine();
- if (line == null) {
- return null;
- }
- int lineLen = fGC.textExtent(line).x;
- if (lineLen < fMaxWidth) {
- return line;
- }
- fLine = line;
- fIndex = 0;
- }
- int breakIdx = findNextBreakIndex(fIndex);
- String res = fLine.substring(fIndex, breakIdx);
- if (breakIdx < fLine.length()) {
- fIndex = findWordBegin(breakIdx);
- } else {
- fLine = null;
- }
- return res;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextSelectionChangedEvent.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextSelectionChangedEvent.java
deleted file mode 100644
index 1b1dfe03c4..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextSelectionChangedEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-/**
- * This event is used by the SourceEditorTreeViewer to tell the
- * ViewerSelectionManager that the selection really came from a user click on
- * the content outliner, instead of being set programatically.
- */
-public class StructuredTextSelectionChangedEvent extends org.eclipse.jface.viewers.SelectionChangedEvent {
-
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 1L;
-
- public StructuredTextSelectionChangedEvent(ISelectionProvider source, ISelection selection) {
- super(source, selection);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextViewer.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextViewer.java
deleted file mode 100644
index 17f9a23d3f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextViewer.java
+++ /dev/null
@@ -1,793 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentAdapter;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewerExtension2;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.formatter.FormattingContext;
-import org.eclipse.jface.text.formatter.FormattingContextProperties;
-import org.eclipse.jface.text.formatter.IContentFormatterExtension;
-import org.eclipse.jface.text.formatter.IFormattingContext;
-import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.jface.text.information.IInformationPresenter;
-import org.eclipse.jface.text.projection.ProjectionDocument;
-import org.eclipse.jface.text.reconciler.IReconciler;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IOverviewRuler;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.jface.text.source.projection.ProjectionViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.IEditorStatusLine;
-import org.eclipse.wst.sse.core.internal.cleanup.StructuredContentCleanupHandler;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.undo.IDocumentSelectionMediator;
-import org.eclipse.wst.sse.core.internal.undo.IStructuredTextUndoManager;
-import org.eclipse.wst.sse.core.internal.undo.UndoDocumentEvent;
-import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
-import org.eclipse.wst.sse.ui.internal.provisional.style.Highlighter;
-import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
-import org.eclipse.wst.sse.ui.internal.reconcile.StructuredRegionProcessor;
-import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil;
-
-public class StructuredTextViewer extends ProjectionViewer implements IDocumentSelectionMediator {
- /** Text operation codes */
- private static final int BASE = ProjectionViewer.COLLAPSE_ALL; // see
- // ProjectionViewer.COLLAPSE_ALL
- private static final int CLEANUP_DOCUMENT = BASE + 1;
- public static final int FORMAT_ACTIVE_ELEMENTS = BASE + 3;
-
- private static final String FORMAT_ACTIVE_ELEMENTS_TEXT = SSEUIMessages.Format_Active_Elements_UI_; //$NON-NLS-1$
- public static final int FORMAT_DOCUMENT = BASE + 2;
- private static final String FORMAT_DOCUMENT_TEXT = SSEUIMessages.Format_Document_UI_; //$NON-NLS-1$
- public static final int QUICK_FIX = BASE + 4;
- private static final String TEXT_CUT = SSEUIMessages.Text_Cut_UI_; //$NON-NLS-1$
- private static final String TEXT_PASTE = SSEUIMessages.Text_Paste_UI_; //$NON-NLS-1$
- private static final String TEXT_SHIFT_LEFT = SSEUIMessages.Text_Shift_Left_UI_; //$NON-NLS-1$ = "Text Shift Left"
- private static final String TEXT_SHIFT_RIGHT = SSEUIMessages.Text_Shift_Right_UI_; //$NON-NLS-1$ = "Text Shift Right"
- private static final boolean TRACE_EXCEPTIONS = true;
-
- private boolean fBackgroundupdateInProgress;
- private StructuredContentCleanupHandler fContentCleanupHandler = null;
- private IContentAssistant fCorrectionAssistant;
- private boolean fCorrectionAssistantInstalled;
- private IDocumentAdapter fDocAdapter;
-
- private Highlighter fHighlighter;
-
- // private ViewerSelectionManager fViewerSelectionManager;
- private SourceViewerConfiguration fConfiguration;
-
- /**
- * @see org.eclipse.jface.text.source.SourceViewer#SourceViewer(Composite,
- * IVerticalRuler, IOverviewRuler, boolean, int)
- */
- public StructuredTextViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles) {
- super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, styles);
- }
-
- /**
- *
- */
- private void beep() {
- getTextWidget().getDisplay().beep();
- }
-
- public void beginBackgroundUpdate() {
- fBackgroundupdateInProgress = true;
- setRedraw(false);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.ITextOperationTarget#canDoOperation(int)
- */
- public boolean canDoOperation(int operation) {
- if (fBackgroundupdateInProgress) {
- return false;
- }
- switch (operation) {
- case CONTENTASSIST_PROPOSALS : {
- // (pa) if position isn't READ_ONLY (containsReadOnly()
- // returns false),
- // Otherwise, you DO want content assist (return true)
- IDocument doc = getDocument();
- if (doc != null && doc instanceof IStructuredDocument) {
- return isEditable() && (!((IStructuredDocument) doc).containsReadOnly(getSelectedRange().x, 0));
- }
- break;
- }
- case QUICK_FIX : {
- return isEditable();
- }
- case CLEANUP_DOCUMENT : {
- return (fContentCleanupHandler != null && isEditable());
- }
- case FORMAT_DOCUMENT :
- case FORMAT_ACTIVE_ELEMENTS : {
- return (fContentFormatter != null && isEditable());
- }
- }
- return super.canDoOperation(operation);
- }
-
- /**
- * Should be identical to superclass version. Plus, we get our own special
- * Highlighter. Plus we uninstall before installing.
- */
- public void configure(SourceViewerConfiguration configuration) {
-
- if (getTextWidget() == null)
- return;
-
- setDocumentPartitioning(configuration.getConfiguredDocumentPartitioning(this));
-
- // always uninstall highlighter and null it out on new configuration
- if (fHighlighter != null) {
- fHighlighter.uninstall();
- fHighlighter = null;
- }
-
- // install content type independent plugins
- if (fPresentationReconciler != null)
- fPresentationReconciler.uninstall();
- fPresentationReconciler = configuration.getPresentationReconciler(this);
- if (fPresentationReconciler != null)
- fPresentationReconciler.install(this);
-
- IReconciler newReconciler = configuration.getReconciler(this);
-
- if (newReconciler != fReconciler || newReconciler == null || fReconciler == null) {
-
- if (fReconciler != null) {
- fReconciler.uninstall();
- }
-
- fReconciler = newReconciler;
-
- if (fReconciler != null) {
- fReconciler.install(this);
- // https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=3858
- // still need set document on the reconciler (strategies)
- ((StructuredRegionProcessor) fReconciler).setDocument(getDocument());
- }
- }
-
- IContentAssistant newAssistant = configuration.getContentAssistant(this);
- if (newAssistant != fContentAssistant || newAssistant == null || fContentAssistant == null) {
- if (fContentAssistant != null)
- fContentAssistant.uninstall();
-
- fContentAssistant = newAssistant;
-
- if (fContentAssistant != null) {
- fContentAssistant.install(this);
- fContentAssistantInstalled = true;
- }
- else {
- // 248036
- // disable the content assist operation if no content
- // assistant
- enableOperation(CONTENTASSIST_PROPOSALS, false);
- }
- }
-
- fContentFormatter = configuration.getContentFormatter(this);
-
- // do not uninstall old information presenter if it's the same
- IInformationPresenter newInformationPresenter = configuration.getInformationPresenter(this);
- if (newInformationPresenter == null || fInformationPresenter == null || !(newInformationPresenter.equals(fInformationPresenter))) {
- if (fInformationPresenter != null)
- fInformationPresenter.uninstall();
- fInformationPresenter = newInformationPresenter;
- if (fInformationPresenter != null)
- fInformationPresenter.install(this);
- }
-
- // disconnect from the old undo manager before setting the new one
- if (fUndoManager != null) {
- fUndoManager.disconnect();
- }
- setUndoManager(configuration.getUndoManager(this));
-
- // release old annotation hover before setting new one
- if (fAnnotationHover instanceof StructuredTextAnnotationHover) {
- ((StructuredTextAnnotationHover) fAnnotationHover).release();
- }
- setAnnotationHover(configuration.getAnnotationHover(this));
-
- // release old annotation hover before setting new one
- if (fOverviewRulerAnnotationHover instanceof StructuredTextAnnotationHover) {
- ((StructuredTextAnnotationHover) fOverviewRulerAnnotationHover).release();
- }
- setOverviewRulerAnnotationHover(configuration.getAnnotationHover(this));
-
- getTextWidget().setTabs(configuration.getTabWidth(this));
- setHoverControlCreator(configuration.getInformationControlCreator(this));
-
- // if hyperlink manager has already been created, uninstall it
- if (fHyperlinkManager != null) {
- setHyperlinkDetectors(null, SWT.NONE);
- }
- setHyperlinkPresenter(configuration.getHyperlinkPresenter(this));
- IHyperlinkDetector[] hyperlinkDetectors = configuration.getHyperlinkDetectors(this);
- int eventStateMask = configuration.getHyperlinkStateMask(this);
- setHyperlinkDetectors(hyperlinkDetectors, eventStateMask);
-
- // install content type specific plugins
- String[] types = configuration.getConfiguredContentTypes(this);
-
- // clear autoindent/autoedit strategies
- fAutoIndentStrategies = null;
- for (int i = 0; i < types.length; i++) {
- String t = types[i];
- setAutoEditStrategies(configuration.getAutoEditStrategies(this, t), t);
- setTextDoubleClickStrategy(configuration.getDoubleClickStrategy(this, t), t);
-
- int[] stateMasks = configuration.getConfiguredTextHoverStateMasks(this, t);
- if (stateMasks != null) {
- for (int j = 0; j < stateMasks.length; j++) {
- int stateMask = stateMasks[j];
- setTextHover(configuration.getTextHover(this, t, stateMask), t, stateMask);
- }
- }
- else {
- setTextHover(configuration.getTextHover(this, t), t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
- }
-
- String[] prefixes = configuration.getIndentPrefixes(this, t);
- if (prefixes != null && prefixes.length > 0)
- setIndentPrefixes(prefixes, t);
-
- prefixes = configuration.getDefaultPrefixes(this, t);
- if (prefixes != null && prefixes.length > 0)
- setDefaultPrefixes(prefixes, t);
-
- // add highlighter/linestyleprovider
- // BUG139753 - only create Highlighter if we have a valid document
- if (configuration instanceof StructuredTextViewerConfiguration && getDocument() instanceof IStructuredDocument) {
- LineStyleProvider[] providers = ((StructuredTextViewerConfiguration) configuration).getLineStyleProviders(this, t);
- if (providers != null) {
- for (int j = 0; j < providers.length; ++j) {
- // delay creation of highlighter till
- // linestyleprovider needs to be added
- if (fHighlighter == null)
- fHighlighter = new Highlighter();
- fHighlighter.addProvider(t, providers[j]);
- }
- }
- }
- }
-
- // initialize highlighter after linestyleproviders were added
- if (fHighlighter != null) {
- fHighlighter.setDocumentPartitioning(configuration.getConfiguredDocumentPartitioning(this));
- fHighlighter.setDocument((IStructuredDocument) getDocument());
- fHighlighter.install(this);
- }
-
- activatePlugins();
-
- fConfiguration = configuration;
- }
-
- /**
- * @param document
- * @param startOffset
- * @param endOffset
- * @return
- */
- private boolean containsReadOnly(IDocument document, int startOffset, int endOffset) {
-
- int start = startOffset;
- int end = endOffset;
- IStructuredDocument structuredDocument = null;
- if (document instanceof IStructuredDocument) {
- structuredDocument = (IStructuredDocument) document;
- }
- else {
- if (document instanceof ProjectionDocument) {
- IDocument doc = ((ProjectionDocument) document).getMasterDocument();
- if (doc instanceof IStructuredDocument) {
- structuredDocument = (IStructuredDocument) doc;
- int adjust = ((ProjectionDocument) document).getProjectionMapping().getCoverage().getOffset();
- start = adjust + start;
- end = adjust + end;
- }
- }
- }
- if (structuredDocument == null) {
- return false;
- }
- else {
- int length = end - start;
- return structuredDocument.containsReadOnly(start, length);
- }
- }
-
- protected IDocumentAdapter createDocumentAdapter() {
-
- fDocAdapter = new StructuredDocumentToTextAdapter(getTextWidget());
- return fDocAdapter;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.ITextOperationTarget#doOperation(int)
- */
- public void doOperation(int operation) {
-
- Point selection = getTextWidget().getSelection();
- int cursorPosition = selection.x;
- int selectionLength = selection.y - selection.x;
- switch (operation) {
- case CUT :
- beginRecording(TEXT_CUT, TEXT_CUT, cursorPosition, selectionLength);
- super.doOperation(operation);
- selection = getTextWidget().getSelection();
- cursorPosition = selection.x;
- selectionLength = selection.y - selection.x;
- endRecording(cursorPosition, selectionLength);
- break;
- case PASTE :
- beginRecording(TEXT_PASTE, TEXT_PASTE, cursorPosition, selectionLength);
- super.doOperation(operation);
- selection = getTextWidget().getSelection();
- cursorPosition = selection.x;
- selectionLength = selection.y - selection.x;
- endRecording(cursorPosition, selectionLength);
- break;
- case CONTENTASSIST_PROPOSALS :
- // maybe not configured?
- if (fContentAssistant != null && isEditable()) {
- // CMVC 263269
- // need an explicit check here because the
- // contentAssistAction is no longer being updated on
- // cursor
- // position
- if (canDoOperation(CONTENTASSIST_PROPOSALS)) {
- String err = fContentAssistant.showPossibleCompletions();
- if (err != null) {
- // don't wanna beep if there is no error
- PlatformStatusLineUtil.displayErrorMessage(err);
- }
- PlatformStatusLineUtil.addOneTimeClearListener();
- }
- else
- beep();
- }
- break;
- case CONTENTASSIST_CONTEXT_INFORMATION :
- if (fContentAssistant != null) {
- String err = fContentAssistant.showContextInformation();
- PlatformStatusLineUtil.displayErrorMessage(err);
- PlatformStatusLineUtil.addOneTimeClearListener();
- // setErrorMessage(err);
- // new OneTimeListener(getTextWidget(), new
- // ClearErrorMessage());
- }
- break;
- case QUICK_FIX :
- if (isEditable() && fCorrectionAssistant != null && fCorrectionAssistantInstalled) {
- String msg = fCorrectionAssistant.showPossibleCompletions();
- setErrorMessage(msg);
- }
- break;
- case SHIFT_RIGHT :
- beginRecording(TEXT_SHIFT_RIGHT, TEXT_SHIFT_RIGHT, cursorPosition, selectionLength);
- updateIndentationPrefixes();
- super.doOperation(SHIFT_RIGHT);
- selection = getTextWidget().getSelection();
- cursorPosition = selection.x;
- selectionLength = selection.y - selection.x;
- endRecording(cursorPosition, selectionLength);
- break;
- case SHIFT_LEFT :
- beginRecording(TEXT_SHIFT_LEFT, TEXT_SHIFT_LEFT, cursorPosition, selectionLength);
- updateIndentationPrefixes();
- super.doOperation(SHIFT_LEFT);
- selection = getTextWidget().getSelection();
- cursorPosition = selection.x;
- selectionLength = selection.y - selection.x;
- endRecording(cursorPosition, selectionLength);
- break;
- case FORMAT_DOCUMENT :
- try {
- // begin recording
- beginRecording(FORMAT_DOCUMENT_TEXT, FORMAT_DOCUMENT_TEXT, cursorPosition, selectionLength);
-
- // format
- IRegion region = getModelCoverage();
- if (fContentFormatter instanceof IContentFormatterExtension) {
- IContentFormatterExtension extension = (IContentFormatterExtension) fContentFormatter;
- IFormattingContext context = new FormattingContext();
- context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.TRUE);
- context.setProperty(FormattingContextProperties.CONTEXT_REGION, region);
- extension.format(getDocument(), context);
- }
- else {
- fContentFormatter.format(getDocument(), region);
- }
- }
- finally {
- // end recording
- selection = getTextWidget().getSelection();
- cursorPosition = selection.x;
- selectionLength = selection.y - selection.x;
- endRecording(cursorPosition, selectionLength);
- }
- break;
- case FORMAT_ACTIVE_ELEMENTS :
- try {
- // begin recording
- beginRecording(FORMAT_ACTIVE_ELEMENTS_TEXT, FORMAT_ACTIVE_ELEMENTS_TEXT, cursorPosition, selectionLength);
-
- // format
- Point s = getSelectedRange();
- IRegion region = new Region(s.x, s.y);
- fContentFormatter.format(getDocument(), region);
- }
- finally {
- // end recording
- selection = getTextWidget().getSelection();
- cursorPosition = selection.x;
- selectionLength = selection.y - selection.x;
- endRecording(cursorPosition, selectionLength);
- }
- break;
- default :
- super.doOperation(operation);
- }
- }
-
- private void endRecording(int cursorPosition, int selectionLength) {
- IDocument doc = getDocument();
- if (doc instanceof IStructuredDocument) {
- IStructuredDocument structuredDocument = (IStructuredDocument) doc;
- IStructuredTextUndoManager undoManager = structuredDocument.getUndoManager();
- undoManager.endRecording(this, cursorPosition, selectionLength);
- }
- else {
- // TODO: how to handle other document types?
- }
- }
-
- private void beginRecording(String label, String description, int cursorPosition, int selectionLength) {
- IDocument doc = getDocument();
- if (doc instanceof IStructuredDocument) {
- IStructuredDocument structuredDocument = (IStructuredDocument) doc;
- IStructuredTextUndoManager undoManager = structuredDocument.getUndoManager();
- undoManager.beginRecording(this, label, description, cursorPosition, selectionLength);
- }
- else {
- // TODO: how to handle other document types?
- }
- }
-
- public void endBackgroundUpdate() {
- fBackgroundupdateInProgress = false;
- setRedraw(true);
- }
-
- protected void handleDispose() {
- Logger.trace("Source Editor", "StructuredTextViewer::handleDispose entry"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // before we dispose, we set a special "empty" selection, to prevent
- // the "leak one document" that
- // otherwise occurs when editor closed (since last selection stays in
- // SelectedResourceManager.
- // the occurance of the "leak" isn't so bad, but makes debugging other
- // leaks very hard.
- setSelection(TextSelection.emptySelection());
-
- if (fHighlighter != null) {
- fHighlighter.uninstall();
- fHighlighter = null;
- }
- super.handleDispose();
-
- Logger.trace("Source Editor", "StructuredTextViewer::handleDispose exit"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * Overridden for special support of background update and read-only
- * regions
- */
- protected void handleVerifyEvent(VerifyEvent e) {
- IRegion modelRange = event2ModelRange(e);
- if (exposeModelRange(modelRange)) {
- e.doit = false;
- return;
- }
-
- if (fEventConsumer != null) {
- fEventConsumer.processEvent(e);
- if (!e.doit)
- return;
- }
- if (fBackgroundupdateInProgress) {
- e.doit = false;
- beep();
- return;
- }
- // for read-only support
- if (containsReadOnly(getVisibleDocument(), e.start, e.end)) {
- e.doit = false;
- beep();
- return;
- }
-
- try {
- super.handleVerifyEvent(e);
- }
- catch (Exception x) {
- // note, we catch and log any exception,
- // since an otherwise can actually prevent typing!
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=111318
-
- if (TRACE_EXCEPTIONS)
- Logger.logException("StructuredTextViewer.exception.verifyText", x); //$NON-NLS-1$
-
- }
- }
-
- public int modelLine2WidgetLine(int modelLine) {
- /**
- * need to override this method as a workaround for Bug 85709
- */
- if (fInformationMapping == null) {
- IDocument document = getDocument();
- if (document != null) {
- try {
- IRegion modelLineRegion = getDocument().getLineInformation(modelLine);
- IRegion region = getModelCoverage();
- if (modelLineRegion != null && region != null) {
- int modelEnd = modelLineRegion.getOffset() + modelLineRegion.getLength();
- int regionEnd = region.getOffset() + region.getLength();
- // returns -1 if modelLine is invalid
- if ((modelLineRegion.getOffset() < region.getOffset()) || (modelEnd > regionEnd))
- return -1;
- }
- }
- catch (BadLocationException e) {
- // returns -1 if modelLine is invalid
- return -1;
- }
- }
- }
- return super.modelLine2WidgetLine(modelLine);
- }
-
- public int modelOffset2WidgetOffset(int modelOffset) {
- /**
- * need to override this method as a workaround for Bug 85709
- */
- if (fInformationMapping == null) {
- IRegion region = getModelCoverage();
- if (region != null) {
- // returns -1 if modelOffset is invalid
- if (modelOffset < region.getOffset() || modelOffset > (region.getOffset() + region.getLength()))
- return -1;
- }
- }
- return super.modelOffset2WidgetOffset(modelOffset);
- }
-
- public IRegion modelRange2WidgetRange(IRegion modelRange) {
- // need to override this method as workaround for Bug85709
- if (fInformationMapping == null) {
- IRegion region = getModelCoverage();
- if (region != null && modelRange != null) {
- int modelEnd = modelRange.getOffset() + modelRange.getLength();
- int regionEnd = region.getOffset() + region.getLength();
- // returns null if modelRange is invalid
- if ((modelRange.getOffset() < region.getOffset()) || (modelEnd > regionEnd))
- return null;
- }
- }
- return super.modelRange2WidgetRange(modelRange);
- }
-
- /**
- * Sets the correction assistant for the viewer. This method is temporary
- * workaround until the base adds a generic way to add
- * quickfix/quickassist.
- *
- * @param correctionAssistant
- */
- public void setCorrectionAssistant(IContentAssistant correctionAssistant) {
- // correction assistant
- if (fCorrectionAssistant != null)
- fCorrectionAssistant.uninstall();
- fCorrectionAssistant = correctionAssistant;
- if (fCorrectionAssistant != null) {
- // configuration
- if (fCorrectionAssistant instanceof ContentAssistant) {
- ((ContentAssistant) fCorrectionAssistant).setDocumentPartitioning(getDocumentPartitioning());
- }
-
- fCorrectionAssistant.install(this);
- fCorrectionAssistantInstalled = true;
- }
- else {
- // disable the correction assist operation if no correction
- // assistant
- enableOperation(QUICK_FIX, false);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.source.ISourceViewer#setDocument(org.eclipse.jface.text.IDocument,
- * org.eclipse.jface.text.source.IAnnotationModel, int, int)
- */
- public void setDocument(IDocument document, IAnnotationModel annotationModel, int modelRangeOffset, int modelRangeLength) {
- // partial fix for:
- // https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=1970
- // when our document is set, especially to null during close,
- // immediately uninstall the reconciler.
- // this is to avoid an unnecessary final "reconcile"
- // that blocks display thread
- if (document == null) {
- if (fReconciler != null) {
- fReconciler.uninstall();
- }
- }
-
- super.setDocument(document, annotationModel, modelRangeOffset, modelRangeLength);
-
- if (document instanceof IStructuredDocument) {
- IStructuredDocument structuredDocument = (IStructuredDocument) document;
-
- // notify highlighter
- updateHighlighter(structuredDocument);
-
- // set document in the viewer-based undo manager
- if (fUndoManager != null) {
- fUndoManager.disconnect();
- fUndoManager.connect(this);
- }
- // CaretEvent is not sent to ViewerSelectionManager after Save As.
- // Need to notify ViewerSelectionManager here.
- // notifyViewerSelectionManager(getSelectedRange().x,
- // getSelectedRange().y);
- }
- }
-
- /**
- * Use the active editor to set a status line message
- *
- * @param msg
- */
- private void setErrorMessage(String msg) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IEditorPart editor = page.getActiveEditor();
- if (editor != null) {
- IEditorStatusLine statusLine = (IEditorStatusLine) editor.getAdapter(IEditorStatusLine.class);
- if (statusLine != null)
- statusLine.setMessage(true, msg, null);
- }
- }
- }
- }
-
- /**
- * Uninstalls anything that was installed by configure
- */
- public void unconfigure() {
- Logger.trace("Source Editor", "StructuredTextViewer::unconfigure entry"); //$NON-NLS-1$ //$NON-NLS-2$
- if (fHighlighter != null) {
- fHighlighter.uninstall();
- fHighlighter = null;
- }
- if (fCorrectionAssistant != null) {
- fCorrectionAssistant.uninstall();
- }
-
- if (fAnnotationHover instanceof StructuredTextAnnotationHover) {
- ((StructuredTextAnnotationHover) fAnnotationHover).release();
- }
-
- if (fOverviewRulerAnnotationHover instanceof StructuredTextAnnotationHover) {
- ((StructuredTextAnnotationHover) fOverviewRulerAnnotationHover).release();
- }
-
- // doesn't seem to be handled elsewhere, so we'll be sure error
- // messages's are cleared.
- setErrorMessage(null);
-
- super.unconfigure();
- fConfiguration = null;
- Logger.trace("Source Editor", "StructuredTextViewer::unconfigure exit"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.core.undo.IDocumentSelectionMediator#undoOperationSelectionChanged(org.eclipse.wst.sse.core.undo.UndoDocumentEvent)
- */
- public void undoOperationSelectionChanged(UndoDocumentEvent event) {
- if (event.getRequester() != null && event.getRequester().equals(this) && event.getDocument().equals(getDocument())) {
- // BUG107687: Undo/redo do not scroll editor
- ITextSelection selection = new TextSelection(event.getOffset(), event.getLength());
- setSelection(selection, true);
- }
- }
-
- private void updateHighlighter(IStructuredDocument document) {
- // if highlighter has not been created yet, initialize and install it
- if (fHighlighter == null && fConfiguration instanceof StructuredTextViewerConfiguration) {
- String[] types = fConfiguration.getConfiguredContentTypes(this);
- for (int i = 0; i < types.length; i++) {
- String t = types[i];
-
- // add highlighter/linestyleprovider
- LineStyleProvider[] providers = ((StructuredTextViewerConfiguration) fConfiguration).getLineStyleProviders(this, t);
- if (providers != null) {
- for (int j = 0; j < providers.length; ++j) {
- // delay creation of highlighter till
- // linestyleprovider needs to be added
- // do not create highlighter if no valid document
- if (fHighlighter == null)
- fHighlighter = new Highlighter();
- fHighlighter.addProvider(t, providers[j]);
- }
- }
- }
-
- // initialize highlighter after linestyleproviders were added
- if (fHighlighter != null) {
- fHighlighter.setDocumentPartitioning(fConfiguration.getConfiguredDocumentPartitioning(this));
- fHighlighter.install(this);
- }
- }
- if (fHighlighter != null)
- fHighlighter.setDocument(document);
- }
-
- /**
- * Make sure indentation is correct before using.
- */
- private void updateIndentationPrefixes() {
- SourceViewerConfiguration configuration = fConfiguration;
- if (fConfiguration != null) {
- String[] types = configuration.getConfiguredContentTypes(this);
- for (int i = 0; i < types.length; i++) {
- String[] prefixes = configuration.getIndentPrefixes(this, types[i]);
- if (prefixes != null && prefixes.length > 0)
- setIndentPrefixes(prefixes, types[i]);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/TextDropAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/TextDropAction.java
deleted file mode 100644
index 27d196e33d..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/TextDropAction.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * TextDropAction
- */
-public class TextDropAction extends AbstractDropAction {
- public boolean run(DropTargetEvent event, IEditorPart targetEditor) {
- return insert((String) event.data, targetEditor);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/TransferBuilder.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/TransferBuilder.java
deleted file mode 100644
index 4d089d8d89..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/TransferBuilder.java
+++ /dev/null
@@ -1,662 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal;
-
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.wst.sse.ui.internal.extension.DropActionProxy;
-import org.eclipse.wst.sse.ui.internal.extension.RegistryReader;
-import org.osgi.framework.Bundle;
-
-
-/**
- * Builds drop target transfers, drag source transfers, and drop actions
- */
-public class TransferBuilder extends RegistryReader {
-
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- public static final String ATT_METHOD = "method"; //$NON-NLS-1$
- public static final String ATT_PRIORITY = "priority"; //$NON-NLS-1$
- public static final String ATT_SINGLETON = "singleton"; //$NON-NLS-1$
- public static final String ATT_TARGET_ID = "targetID"; //$NON-NLS-1$
- public static final String ATT_TRANSFER_ID = "transferID"; //$NON-NLS-1$
-
- private final static boolean debugTime = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/transferbuilder/time")); //$NON-NLS-1$ //$NON-NLS-2$
-
- public static final String PL_DRAG_SOURCE_TRANSFERS = "dragSourceTransfers"; //$NON-NLS-1$
- public static final String PL_DROP_TARGET_TRANSFERS = "dropTargetTransfers"; //$NON-NLS-1$
-
- public static final String PLUGIN_ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
-
- public static final String[] PRIORITIES = {"highest", "high", "mid", "low", "lowest"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-
- public static final String TAG_DRAG_SOURCE_CONTRIBUTION = "dragSourceContribution"; //$NON-NLS-1$
- public static final String TAG_DROP_ACTION = "dropAction"; //$NON-NLS-1$
- public static final String TAG_DROP_TARGET_CONTRIBUTION = "dropTargetContribution"; //$NON-NLS-1$
-
- public static final String TAG_TRANSFER = "transfer"; //$NON-NLS-1$
-
- public static final String TRUE = "true"; //$NON-NLS-1$
-
- private boolean useProxy;
-
- class TransferProxyForDelayLoading extends Transfer {
- private IConfigurationElement element;
- private String classAttribute;
- private Transfer proxy;
- private Method getTypeIdsMethod, getTypeNamesMethod, javaToNativeMethod, nativeToJavaMethod;
-
- TransferProxyForDelayLoading() {
- super();
- }
-
- TransferProxyForDelayLoading(IConfigurationElement elm, String clsAttr) {
- super();
- this.element = elm;
- this.classAttribute = clsAttr;
- }
-
- private Transfer newInstance() {
- if ((element != null) && (classAttribute != null)) {
- Object o = createExtension(element, classAttribute);
- if (o instanceof Transfer) {
- element = null;
- classAttribute = null;
- return (Transfer)o;
- }
- }
- return null;
- }
-
- public TransferData[] getSupportedTypes() {
- if (proxy == null) {
- proxy = newInstance();
- }
- if (proxy != null) {
- return proxy.getSupportedTypes();
- }
- return new TransferData[0];
- }
- protected int[] getTypeIds() {
- if (proxy == null) {
- proxy = newInstance();
- }
- if (proxy != null) {
- if (getTypeIdsMethod == null) {
- Class runtimeClass = proxy.getClass();
- NoSuchMethodException e = null;
- while (runtimeClass != null) {
- try {
- getTypeIdsMethod = runtimeClass.getDeclaredMethod("getTypeIds", new Class[0]);//$NON-NLS-1$
- getTypeIdsMethod.setAccessible(true);
- break;
- } catch (NoSuchMethodException e1) {
- e = e1;
- runtimeClass = runtimeClass.getSuperclass();
- } catch (SecurityException e2) {
- runtimeClass = runtimeClass.getSuperclass();
- }
- }
- if ((getTypeIdsMethod == null) && (e != null)) {
- Logger.logException(e);
- }
- }
- if (getTypeIdsMethod != null) {
- try {
- // changed Integer[] return type to int[]
- int[] r = (int[])getTypeIdsMethod.invoke(proxy, new Object[0]);
- if ((r != null) && (r.length > 0)) {
- int[] ret = new int[r.length];
- for(int i = 0; i < r.length; i++) {
- ret[i] = r[i];
- }
- return ret;
- }
- } catch (IllegalAccessException e2) {
- Logger.logException(e2);
- } catch (InvocationTargetException e3) {
- Logger.logException(e3);
- }
- }
- }
- return new int[0];
- }
- protected String[] getTypeNames() {
- if (proxy == null) {
- proxy = newInstance();
- }
- if (proxy != null) {
- if (getTypeNamesMethod == null) {
- Class runtimeClass = proxy.getClass();
- NoSuchMethodException e = null;
- while (runtimeClass != null) {
- try {
- getTypeNamesMethod = runtimeClass.getDeclaredMethod("getTypeNames", new Class[0]);//$NON-NLS-1$
- getTypeNamesMethod.setAccessible(true);
- break;
- } catch (NoSuchMethodException e1) {
- e = e1;
- runtimeClass = runtimeClass.getSuperclass();
- } catch (SecurityException e2) {
- runtimeClass = runtimeClass.getSuperclass();
- }
- }
- if ((getTypeNamesMethod == null) && (e != null)) {
- Logger.logException(e);
- }
- }
- if (getTypeNamesMethod != null) {
- try {
- return (String[])getTypeNamesMethod.invoke(proxy, new Object[0]);
- } catch (IllegalAccessException e2) {
- Logger.logException(e2);
- } catch (InvocationTargetException e3) {
- Logger.logException(e3);
- }
- }
- }
- return new String[0];
- }
- public boolean isSupportedType(TransferData transferData) {
- if (proxy == null) {
- proxy = newInstance();
- }
- if (proxy != null) {
- return proxy.isSupportedType(transferData);
- }
- return false;
- }
- protected void javaToNative(Object object, TransferData transferData) {
- if (proxy == null) {
- proxy = newInstance();
- }
- if (proxy != null) {
- if (javaToNativeMethod == null) {
- Class runtimeClass = proxy.getClass();
- NoSuchMethodException e = null;
- while (runtimeClass != null) {
- try {
- javaToNativeMethod = runtimeClass.getDeclaredMethod("javaToNative", new Class[]{object.getClass(), transferData.getClass()});//$NON-NLS-1$
- javaToNativeMethod.setAccessible(true);
- break;
- } catch (NoSuchMethodException e1) {
- e = e1;
- runtimeClass = runtimeClass.getSuperclass();
- } catch (SecurityException e2) {
- runtimeClass = runtimeClass.getSuperclass();
- }
- }
- if ((javaToNativeMethod == null) && (e != null)) {
- Logger.logException(e);
- }
- }
- if (javaToNativeMethod != null) {
- try {
- javaToNativeMethod.invoke(proxy, new Object[]{object, transferData});
- } catch (IllegalAccessException e2) {
- Logger.logException(e2);
- } catch (InvocationTargetException e3) {
- Logger.logException(e3);
- }
- }
- }
- }
- protected Object nativeToJava(TransferData transferData) {
- if (proxy == null) {
- proxy = newInstance();
- }
- if (proxy != null) {
- if (nativeToJavaMethod == null) {
- Class runtimeClass = proxy.getClass();
- NoSuchMethodException e = null;
- while (runtimeClass != null) {
- try {
- nativeToJavaMethod = runtimeClass.getDeclaredMethod("nativeToJava", new Class[]{transferData.getClass()});//$NON-NLS-1$
- nativeToJavaMethod.setAccessible(true);
- break;
- } catch (NoSuchMethodException e1) {
- e = e1;
- runtimeClass = runtimeClass.getSuperclass();
- } catch (SecurityException e2) {
- runtimeClass = runtimeClass.getSuperclass();
- }
- }
- if ((nativeToJavaMethod == null) && (e != null)) {
- Logger.logException(e);
- }
- }
- if (nativeToJavaMethod != null) {
- try {
- return nativeToJavaMethod.invoke(proxy, new Object[]{transferData});
- } catch (IllegalAccessException e2) {
- Logger.logException(e2);
- } catch (InvocationTargetException e3) {
- Logger.logException(e3);
- }
- }
- }
- return new Object();
- }
- Transfer getTransferClass() {
- if (proxy == null) {
- proxy = newInstance();
- }
- return proxy;
- }
- }
- /**
- * @param element
- * @param classAttribute
- * @return Object
- * @throws CoreException
- */
- static Object createExecutableExtension(final IConfigurationElement element, final String classAttribute) throws CoreException {
-
- Object obj = null;
-
- String singleton = element.getAttribute(ATT_SINGLETON);
- String method = element.getAttribute(ATT_METHOD);
- if (TRUE.equalsIgnoreCase(singleton) && method != null) {
- try {
- String name = element.getAttribute(ATT_CLASS);
- String pluginId = element.getDeclaringExtension().getNamespace();
- Class cls = Platform.getBundle(pluginId).loadClass(name);
- Method mtd = cls.getMethod(method, new Class[]{});
-
- obj = mtd.invoke(null, null);
- } catch (ClassNotFoundException e) {
- obj = null;
- } catch (NoSuchMethodException e) {
- obj = null;
- } catch (IllegalAccessException e) {
- obj = null;
- } catch (InvocationTargetException e) {
- obj = null;
- }
- } else {
- obj = element.createExecutableExtension(classAttribute);
- }
-
- return obj;
- }
-
- /**
- * Creates an extension. If the extension plugin has not been loaded a
- * busy cursor will be activated during the duration of the load.
- *
- * @param element
- * @param classAttribute
- * @return Object
- * @throws CoreException
- */
- public static Object createExtension(final IConfigurationElement element, final String classAttribute) {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- final Object[] result = new Object[1];
- String pluginId = element.getDeclaringExtension().getNamespace();
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle.getState() == Bundle.ACTIVE) {
- try {
- return createExecutableExtension(element, classAttribute);
- } catch (CoreException e) {
- handleCreateExecutableException(result, e);
- }
- } else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = createExecutableExtension(element, classAttribute);
- } catch (Exception e) {
- handleCreateExecutableException(result, e);
- }
- }
- });
- }
- return result[0];
- }
-
- /**
- * @param result
- * @param e
- */
- protected static void handleCreateExecutableException(Object[] result, Throwable e) {
- Logger.logException(e);
- result[0] = null;
-
- }
-
- protected List cache;
- protected String targetContributionTag;
-
- protected List targetIDs;
-
- /**
- * @param element
- * @return IDropAction
- */
- protected IDropAction createDropAction(IConfigurationElement element) {
- Object obj = null;
- obj = createExtension(element, ATT_CLASS);
- if (obj == null)
- return null;
- return (obj instanceof IDropAction) ? (IDropAction) DropActionProxy.newInstance(obj) : null;
- }
-
- /**
- * @param transferId
- * @return IDropAction[]
- */
- protected IDropAction[] createDropActions(String transferId) {
- if (cache == null)
- return new IDropAction[0];
-
- final int num = cache.size();
- if (num == 0)
- return new IDropAction[0];
-
- IDropAction[] as = new IDropAction[num];
- int j = 0;
- for (int p = 0; p < PRIORITIES.length; p++) {
- for (int i = 0; i < num; i++) {
- Object obj = cache.get(i);
- if (!(obj instanceof IConfigurationElement))
- continue;
-
- IConfigurationElement element = (IConfigurationElement) obj;
- if (!(TAG_DROP_ACTION.equals(element.getName())) || !(transferId.equals(element.getAttribute(ATT_TRANSFER_ID))))
- continue;
-
- if (PRIORITIES[p].equals(element.getAttribute(ATT_PRIORITY)) || (p == 2 && element.getAttribute(ATT_PRIORITY) == null)) {
- IDropAction a = createDropAction(element);
- if (a != null) {
- as[j] = a;
- j++;
- }
- }
- }
- }
-
- if (num == j)
- return as;
-
- IDropAction[] as2 = new IDropAction[j];
- for (int i = 0; i < j; i++) {
- as2[i] = as[i];
- }
-
- return as2;
- }
-
- /**
- * @param element
- * @return Transfer
- */
- protected Transfer createTransfer(IConfigurationElement element) {
- Object obj = null;
- if (useProxy) {
- obj = new TransferProxyForDelayLoading(element, ATT_CLASS);
- } else {
- obj = createExtension(element, ATT_CLASS);
- }
- if (obj == null)
- return null;
- return (obj instanceof Transfer) ? (Transfer) obj : null;
- }
-
- /**
- * @return Transfer[]
- */
- protected Transfer[] createTransfers() {
- if (cache == null)
- return new Transfer[0];
-
- final int num = cache.size();
- if (num == 0)
- return new Transfer[0];
-
- Transfer[] ts = new Transfer[num];
- int j = 0;
- for (int p = 0; p < PRIORITIES.length; p++) {
- for (int i = 0; i < num; i++) {
- Object obj = cache.get(i);
- if (!(obj instanceof IConfigurationElement))
- continue;
-
- IConfigurationElement element = (IConfigurationElement) obj;
- if (!TAG_TRANSFER.equals(element.getName()))
- continue;
-
- if (PRIORITIES[p].equals(element.getAttribute(ATT_PRIORITY)) || (p == 2 && element.getAttribute(ATT_PRIORITY) == null)) {
- Transfer t = createTransfer(element);
- if (t != null) {
- ts[j] = t;
- j++;
- }
- }
- }
- }
-
- if (num == j)
- return ts;
-
- Transfer[] ts2 = new Transfer[j];
- for (int i = 0; i < j; i++) {
- ts2[i] = ts[i];
- }
-
- return ts2;
- }
-
- /**
- * @param editorId
- * @return Transfer[]
- */
- public Transfer[] getDragSourceTransfers(String editorId) {
- return getDragSourceTransfers(new String[]{editorId});
- }
-
- /**
- * @param editorIds
- * @return Transfer[]
- */
- public Transfer[] getDragSourceTransfers(String[] editorIds) {
- long time0 = System.currentTimeMillis();
- readContributions(editorIds, TAG_DRAG_SOURCE_CONTRIBUTION, PL_DRAG_SOURCE_TRANSFERS);
- Transfer[] transfers = createTransfers();
- if (debugTime)
- System.out.println(getClass().getName() + "#getDragSourceTransfers(" + editorIds + "): " + transfers.length + " transfers created in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- return transfers;
- }
-
- /**
- * @deprecated use getDropActions(String editorId, Transfer transfer) for the performance
- * @param editorId
- * @param className
- * @return IDropAction[]
- */
- public IDropAction[] getDropActions(String editorId, String transferClassName) {
- return getDropActions(new String[]{editorId}, transferClassName);
- }
-
- /**
- * @param editorId
- * @param class
- * @return IDropAction[]
- */
- public IDropAction[] getDropActions(String editorId, Transfer transfer) {
- return getDropActions(new String[]{editorId}, transfer);
- }
- /**
- * @deprecated use getDropActions(String[] editorIds, Transfer transfer) for the performance
- * @param editorId
- * @param className
- * @return IDropAction[]
- */
- public IDropAction[] getDropActions(String[] editorIds, String transferClassName) {
- long time0 = System.currentTimeMillis();
- readContributions(editorIds, TAG_DROP_TARGET_CONTRIBUTION, PL_DROP_TARGET_TRANSFERS);
- String transferId = getTransferIdOfClassName(transferClassName);
- IDropAction[] actions = createDropActions(transferId);
- if (debugTime)
- System.out.println(getClass().getName() + "#getDropActions(" + editorIds + "): " + actions.length + " drop actions created in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- return actions;
- }
-
- /**
- * @param editorId
- * @param class
- * @return IDropAction[]
- */
- public IDropAction[] getDropActions(String[] editorIds, Transfer transfer) {
- String transferClassName;
- if (transfer instanceof TransferProxyForDelayLoading) {
- transferClassName = ((TransferProxyForDelayLoading)transfer).getTransferClass().getClass().getName();
- } else {
- transferClassName = transfer.getClass().getName();
- }
- return getDropActions(editorIds, transferClassName);
- }
- /**
- * @param editorId
- * @return Transfer[]
- */
- public Transfer[] getDropTargetTransfers(String editorId) {
- return getDropTargetTransfers(new String[]{editorId});
- }
-
- /**
- * @param editorIds
- * @return Transfer[]
- */
- public Transfer[] getDropTargetTransfers(String[] editorIds) {
- long time0 = System.currentTimeMillis();
- readContributions(editorIds, TAG_DROP_TARGET_CONTRIBUTION, PL_DROP_TARGET_TRANSFERS);
- Transfer[] transfers = createTransfers();
- if (debugTime) {
- String idlist = ""; //$NON-NLS-1$
- if (editorIds.length > 0) {
- for (int i = 0; i < editorIds.length; i++) {
- idlist += editorIds[i];
- if (i < editorIds.length - 1)
- idlist += ","; //$NON-NLS-1$
- }
- }
- System.out.println(getClass().getName() + "#getDropTargetTransfers(" + idlist + "): " + transfers.length + " transfers created in " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- return transfers;
- }
-
- /**
- * Returns the name of the part ID attribute that is expected in the
- * target extension.
- *
- * @param element
- * @return String
- */
- protected String getTargetID(IConfigurationElement element) {
- String value = element.getAttribute(ATT_TARGET_ID);
- return value != null ? value : "???"; //$NON-NLS-1$
- }
-
- /**
- * @param className
- * @return String
- */
- private String getTransferIdOfClassName(String className) {
- String id = ""; //$NON-NLS-1$
- final int num = cache.size();
- if (className == null || cache == null || num == 0)
- return id;
-
- for (int i = 0; i < num; i++) {
- Object obj = cache.get(i);
- if (obj instanceof IConfigurationElement) {
- IConfigurationElement element = (IConfigurationElement) obj;
- if (className.equals(element.getAttribute(ATT_CLASS))) {
- id = element.getAttribute(ATT_ID);
- break;
- }
- }
- }
-
- return (id.length() != 0 ? id : className);
- }
-
- /**
- * Reads the contributions from the registry for the provided workbench
- * part and the provided extension point ID.
- *
- * @param id
- * @param tag
- * @param extensionPoint
- */
- protected void readContributions(String[] ids, String tag, String extensionPoint) {
- cache = null;
- targetIDs = Arrays.asList(ids);
- targetContributionTag = tag;
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, PLUGIN_ID, extensionPoint);
- }
-
- protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
- if (tag.equals(targetContributionTag)) {
- String id = getTargetID(element);
- if (id == null || !targetIDs.contains(id)) {
- // This is not of interest to us - don't go deeper
- return true;
- }
- } else if (tag.equals(TAG_TRANSFER)) {
- if (cache == null)
- cache = new ArrayList();
- cache.add(element);
- return true; // just cache the element - don't go into it
- } else if (tag.equals(TAG_DROP_ACTION)) {
- if (cache == null)
- cache = new ArrayList();
- //cache.add(createActionDescriptor(element));
- cache.add(element);
- return true; // just cache the action - don't go into
- } else {
- return false;
- }
-
- readElementChildren(element);
- return true;
- }
- /**
- * @deprecated - use TransferBuilder(boolean useProxy) for the performance
- */
- public TransferBuilder() {
- this(false);
- }
-
- public TransferBuilder(boolean useProxy) {
- super();
- this.useProxy = useProxy;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/UnknownContentTypeDialog.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/UnknownContentTypeDialog.java
deleted file mode 100644
index 9bd2f8982f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/UnknownContentTypeDialog.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.wst.sse.ui.internal;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-
-/**
- * Message dialog informing user that an editor was open on unsupported
- * content type
- */
-public class UnknownContentTypeDialog extends MessageDialogWithToggle {
-
- public UnknownContentTypeDialog(Shell parent, IPreferenceStore store, String key) {
- // set message to null in super so that message does not appear twice
- super(parent, SSEUIMessages.UnknownContentTypeDialog_0, null, null, INFORMATION, new String[]{IDialogConstants.OK_LABEL}, 0, SSEUIMessages.UnknownContentTypeDialog_1, false);
- setPrefStore(store);
- setPrefKey(key);
- }
-
- protected void buttonPressed(int buttonId) {
- super.buttonPressed(buttonId);
-
- // overwritten so that value stored is boolean, not string
- if (buttonId != IDialogConstants.CANCEL_ID && getToggleState() && getPrefStore() != null && getPrefKey() != null) {
- switch (buttonId) {
- case IDialogConstants.YES_ID :
- case IDialogConstants.YES_TO_ALL_ID :
- case IDialogConstants.PROCEED_ID :
- case IDialogConstants.OK_ID :
- getPrefStore().setValue(getPrefKey(), false);
- break;
- case IDialogConstants.NO_ID :
- case IDialogConstants.NO_TO_ALL_ID :
- getPrefStore().setValue(getPrefKey(), true);
- break;
- }
- }
-
- }
-
- protected Control createMessageArea(Composite composite) {
- super.createMessageArea(composite);
- Link messageLink = new Link(composite, SWT.NONE);
- messageLink.setText(SSEUIMessages.UnknownContentTypeDialog_2);
- messageLink.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- linkClicked();
- }
- });
- return composite;
- }
-
- private void linkClicked() {
- String pageId = "org.eclipse.ui.preferencePages.ContentTypes"; //$NON-NLS-1$
- PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), pageId, new String[]{pageId}, null);
- dialog.open();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActionContributor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActionContributor.java
deleted file mode 100644
index b34e301d0b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActionContributor.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.actions;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.editors.text.TextEditorActionContributor;
-import org.eclipse.ui.ide.IDEActionFactory;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.texteditor.ITextEditorExtension;
-import org.eclipse.ui.texteditor.RetargetTextEditorAction;
-import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder;
-import org.eclipse.wst.sse.ui.internal.GotoAnnotationAction;
-import org.eclipse.wst.sse.ui.internal.IExtendedContributor;
-import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.ui.OffsetStatusLineContributionItem;
-
-/**
- * This class should not be used inside multi page editor's
- * ActionBarContributor, since cascaded init() call from the
- * ActionBarContributor will causes exception and it leads to lose whole
- * toolbars.
- *
- * Instead, use SourcePageActionContributor for source page contributor of
- * multi page editor.
- *
- * Note that this class is still valid for single page editor
- */
-public class ActionContributor extends TextEditorActionContributor implements ISourceViewerActionBarContributor, IExtendedContributor {
-
- public static final boolean _showDebugStatus = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/actioncontributor/debugstatusfields")); //$NON-NLS-1$ //$NON-NLS-2$
-
- private static final String[] EDITOR_IDS = {"org.eclipse.wst.sse.ui.StructuredTextEditor"}; //$NON-NLS-1$
-
- protected IExtendedContributor extendedContributor;
- protected RetargetTextEditorAction fAddBlockComment = null;
-
- protected Separator fCommandsSeparator = null;
-
- private OffsetStatusLineContributionItem fDebugStatusOffset = null;
- protected MenuManager fExpandSelectionToMenu = null;
- protected GroupMarker fMenuAdditionsGroupMarker = null;
- protected GotoAnnotationAction fNextAnnotation = null;
-
- protected GotoAnnotationAction fPreviousAnnotation = null;
- protected RetargetTextEditorAction fRemoveBlockComment = null;
- protected RetargetTextEditorAction fShiftLeft = null;
- protected RetargetTextEditorAction fShiftRight = null;
- protected RetargetTextEditorAction fStructureSelectEnclosingAction = null;
- protected RetargetTextEditorAction fStructureSelectHistoryAction = null;
- protected RetargetTextEditorAction fStructureSelectNextAction = null;
- protected RetargetTextEditorAction fStructureSelectPreviousAction = null;
-
- protected RetargetTextEditorAction fToggleComment = null;
- protected RetargetTextEditorAction fToggleInsertModeAction;
- protected GroupMarker fToolbarAdditionsGroupMarker = null;
- protected Separator fToolbarSeparator = null;
-
- public ActionContributor() {
- super();
-
- ResourceBundle resourceBundle = SSEUIMessages.getResourceBundle();
-
- fCommandsSeparator = new Separator();
-
- // edit commands
- fStructureSelectEnclosingAction = new RetargetTextEditorAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_ENCLOSING + StructuredTextEditorActionConstants.DOT);
- fStructureSelectEnclosingAction.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_ENCLOSING);
-
- fStructureSelectNextAction = new RetargetTextEditorAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_NEXT + StructuredTextEditorActionConstants.DOT);
- fStructureSelectNextAction.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_NEXT);
-
- fStructureSelectPreviousAction = new RetargetTextEditorAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_PREVIOUS + StructuredTextEditorActionConstants.DOT);
- fStructureSelectPreviousAction.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_PREVIOUS);
-
- fStructureSelectHistoryAction = new RetargetTextEditorAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_HISTORY + StructuredTextEditorActionConstants.DOT);
- fStructureSelectHistoryAction.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_HISTORY);
-
- fExpandSelectionToMenu = new MenuManager(SSEUIMessages.ExpandSelectionToMenu_label); //$NON-NLS-1$
- fExpandSelectionToMenu.add(fStructureSelectEnclosingAction);
- fExpandSelectionToMenu.add(fStructureSelectNextAction);
- fExpandSelectionToMenu.add(fStructureSelectPreviousAction);
- fExpandSelectionToMenu.add(fStructureSelectHistoryAction);
-
- // source commands
- fShiftRight = new RetargetTextEditorAction(resourceBundle, ITextEditorActionConstants.SHIFT_RIGHT + StructuredTextEditorActionConstants.DOT);
- fShiftRight.setActionDefinitionId(ITextEditorActionDefinitionIds.SHIFT_RIGHT);
-
- fShiftLeft = new RetargetTextEditorAction(resourceBundle, ITextEditorActionConstants.SHIFT_LEFT + StructuredTextEditorActionConstants.DOT);
- fShiftLeft.setActionDefinitionId(ITextEditorActionDefinitionIds.SHIFT_LEFT);
-
- fToggleComment = new RetargetTextEditorAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT + StructuredTextEditorActionConstants.DOT);
- fToggleComment.setActionDefinitionId(ActionDefinitionIds.TOGGLE_COMMENT);
-
- fAddBlockComment = new RetargetTextEditorAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT + StructuredTextEditorActionConstants.DOT);
- fAddBlockComment.setActionDefinitionId(ActionDefinitionIds.ADD_BLOCK_COMMENT);
-
- fRemoveBlockComment = new RetargetTextEditorAction(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT + StructuredTextEditorActionConstants.DOT);
- fRemoveBlockComment.setActionDefinitionId(ActionDefinitionIds.REMOVE_BLOCK_COMMENT);
-
- // goto prev/next error
- // CMVC 249017 for JavaEditor consistancy
- fPreviousAnnotation = new GotoAnnotationAction("Previous_annotation", false); //$NON-NLS-1$
- fPreviousAnnotation.setActionDefinitionId("org.eclipse.ui.navigate.previous"); //$NON-NLS-1$
-
- fNextAnnotation = new GotoAnnotationAction("Next_annotation", true); //$NON-NLS-1$
- fNextAnnotation.setActionDefinitionId("org.eclipse.ui.navigate.next"); //$NON-NLS-1$
-
- // Read action extensions.
- ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder();
- extendedContributor = builder.readActionExtensions(getExtensionIDs());
-
- fMenuAdditionsGroupMarker = new GroupMarker(StructuredTextEditorActionConstants.GROUP_NAME_MENU_ADDITIONS);
- fToolbarSeparator = new Separator();
- fToolbarAdditionsGroupMarker = new GroupMarker(StructuredTextEditorActionConstants.GROUP_NAME_TOOLBAR_ADDITIONS);
-
- fToggleInsertModeAction = new RetargetTextEditorAction(resourceBundle, "Editor.ToggleInsertMode.", IAction.AS_CHECK_BOX); //$NON-NLS-1$
- fToggleInsertModeAction.setActionDefinitionId(ITextEditorActionDefinitionIds.TOGGLE_INSERT_MODE);
-
- if (_showDebugStatus) {
- fDebugStatusOffset = new OffsetStatusLineContributionItem(StructuredTextEditorActionConstants.STATUS_CATEGORY_OFFSET, true, 20);
- }
- }
-
- protected void addToMenu(IMenuManager menu) {
- // edit commands
- IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
- if (editMenu != null) {
- editMenu.add(fCommandsSeparator);
- editMenu.add(fToggleInsertModeAction);
- editMenu.add(fCommandsSeparator);
- editMenu.add(fExpandSelectionToMenu);
- editMenu.add(fCommandsSeparator);
- editMenu.add(fMenuAdditionsGroupMarker);
- }
-
- // source commands
- String sourceMenuLabel = SSEUIMessages.SourceMenu_label; //$NON-NLS-1$
- String sourceMenuId = "sourceMenuId"; // This is just a menu id. No //$NON-NLS-1$
- // need to translate.
- // //$NON-NLS-1$
- IMenuManager sourceMenu = new MenuManager(sourceMenuLabel, sourceMenuId);
- menu.insertAfter(IWorkbenchActionConstants.M_EDIT, sourceMenu);
- if (sourceMenu != null) {
- sourceMenu.add(fCommandsSeparator);
- sourceMenu.add(fToggleComment);
- sourceMenu.add(fAddBlockComment);
- sourceMenu.add(fRemoveBlockComment);
- sourceMenu.add(fShiftRight);
- sourceMenu.add(fShiftLeft);
- }
- }
-
- protected void addToPopupMenu(IMenuManager menu) {
- // add nothing
- }
-
- protected void addToStatusLine(IStatusLineManager manager) {
- if (_showDebugStatus) {
- manager.add(fDebugStatusOffset);
- }
- }
-
- protected void addToToolBar(IToolBarManager toolBarManager) {
- toolBarManager.add(fToolbarSeparator);
- toolBarManager.add(fToolbarAdditionsGroupMarker);
- }
-
- /**
- * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(IMenuManager)
- */
- public void contributeToMenu(IMenuManager menu) {
- super.contributeToMenu(menu);
-
- addToMenu(menu);
-
- if (extendedContributor != null) {
- extendedContributor.contributeToMenu(menu);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.extension.IPopupMenuContributor#contributeToPopupMenu(org.eclipse.jface.action.IMenuManager)
- */
- public void contributeToPopupMenu(IMenuManager menu) {
-
- addToPopupMenu(menu);
-
- if (extendedContributor != null) {
- extendedContributor.contributeToPopupMenu(menu);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToStatusLine(org.eclipse.jface.action.IStatusLineManager)
- */
- public void contributeToStatusLine(IStatusLineManager manager) {
- super.contributeToStatusLine(manager);
-
- addToStatusLine(manager);
-
- if (extendedContributor != null) {
- extendedContributor.contributeToStatusLine(manager);
- }
- }
-
- /**
- * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(IToolBarManager)
- */
- public void contributeToToolBar(IToolBarManager toolBarManager) {
- super.contributeToToolBar(toolBarManager);
-
- addToToolBar(toolBarManager);
-
- if (extendedContributor != null) {
- extendedContributor.contributeToToolBar(toolBarManager);
- }
- }
-
- /**
- * @see org.eclipse.ui.part.EditorActionBarContributor#dispose()
- */
- public void dispose() {
- // need to call setActiveEditor before super.dispose because in both
- // setActiveEditor & super.setActiveEditor if getEditorPart ==
- // activeEditor,
- // the method is just returned. so to get both methods to run,
- // setActiveEditor
- // needs to be called so that it correctly calls super.setActiveEditor
- setActiveEditor(null);
-
- super.dispose();
-
- if (extendedContributor != null)
- extendedContributor.dispose();
- }
-
- protected String[] getExtensionIDs() {
- return EDITOR_IDS;
- }
-
- /**
- * @param editor
- * @return
- */
- protected ITextEditor getTextEditor(IEditorPart editor) {
- ITextEditor textEditor = null;
- if (editor instanceof ITextEditor)
- textEditor = (ITextEditor) editor;
- if (textEditor == null && editor != null)
- textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
- return textEditor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IEditorActionBarContributor#init(org.eclipse.ui.IActionBars,
- * org.eclipse.ui.IWorkbenchPage)
- */
- public void init(IActionBars bars, IWorkbenchPage page) {
- super.init(bars, page);
- }
-
- /**
- * @see org.eclipse.ui.IEditorActionBarContributor#setActiveEditor(IEditorPart)
- */
- public void setActiveEditor(IEditorPart activeEditor) {
- if (getActiveEditorPart() == activeEditor)
- return;
- super.setActiveEditor(activeEditor);
-
- ITextEditor textEditor = getTextEditor(activeEditor);
-
- IActionBars actionBars = getActionBars();
- if (actionBars != null) {
- actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, fNextAnnotation);
- actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, fPreviousAnnotation);
- actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fPreviousAnnotation);
- actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fNextAnnotation);
-
- if (textEditor != null) {
- actionBars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(), getAction(textEditor, IDEActionFactory.ADD_TASK.getId()));
- actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(textEditor, IDEActionFactory.BOOKMARK.getId()));
- }
- }
-
- fStructureSelectEnclosingAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_ENCLOSING));
- fStructureSelectNextAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_NEXT));
- fStructureSelectPreviousAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_PREVIOUS));
- fStructureSelectHistoryAction.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_HISTORY));
-
- fShiftRight.setAction(getAction(textEditor, ITextEditorActionConstants.SHIFT_RIGHT));
- fShiftLeft.setAction(getAction(textEditor, ITextEditorActionConstants.SHIFT_LEFT));
-
- fToggleComment.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT));
- fAddBlockComment.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT));
- fRemoveBlockComment.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT));
-
- // go to prev/next error
- // CMVC 249017 for JavaEditor consistancy
- fPreviousAnnotation.setEditor(textEditor);
- fNextAnnotation.setEditor(textEditor);
-
- fToggleInsertModeAction.setAction(getAction(textEditor, ITextEditorActionConstants.TOGGLE_INSERT_MODE));
-
- if (extendedContributor != null) {
- extendedContributor.setActiveEditor(activeEditor);
- }
-
- if (_showDebugStatus && textEditor instanceof ITextEditorExtension) {
- ((ITextEditorExtension) textEditor).setStatusField(fDebugStatusOffset, StructuredTextEditorActionConstants.STATUS_CATEGORY_OFFSET);
- fDebugStatusOffset.setActiveEditor(textEditor);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.ISourceViewerActionBarContributor#setViewerSpecificContributionsEnabled(boolean)
- */
- public void setViewerSpecificContributionsEnabled(boolean enabled) {
- fShiftRight.setEnabled(enabled);
- fShiftLeft.setEnabled(enabled);
- fNextAnnotation.setEnabled(enabled);
- fPreviousAnnotation.setEnabled(enabled);
-
- /*
- * fComment.setEnabled(enabled); fUncomment.setEnabled(enabled);
- */
- fToggleComment.setEnabled(enabled);
- fAddBlockComment.setEnabled(enabled);
- fRemoveBlockComment.setEnabled(enabled);
- // convert line delimiters are not source viewer-specific
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.extension.IExtendedContributor#updateToolbarActions()
- */
- public void updateToolbarActions() {
- if (extendedContributor != null) {
- extendedContributor.updateToolbarActions();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActionDefinitionIds.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActionDefinitionIds.java
deleted file mode 100644
index b26dae1cf0..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActionDefinitionIds.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.actions;
-
-
-
-/**
- * Defines the definitions ids for editor actions.
- */
-public interface ActionDefinitionIds {
- //TODO: Can these be better defined with a "plugin prefix" to be more portable?
- public final static String ADD_BLOCK_COMMENT = "org.eclipse.wst.sse.ui.add.block.comment";//$NON-NLS-1$
-
- public final static String CLEANUP_DOCUMENT = "org.eclipse.wst.sse.ui.cleanup.document";//$NON-NLS-1$
- public final static String COMMENT = "org.eclipse.wst.sse.ui.comment";//$NON-NLS-1$
- public final static String EDIT_BREAKPOINTS = "org.eclipse.wst.sse.ui.breakpoints.edit";//$NON-NLS-1$
- public final static String FIND_OCCURRENCES = "org.eclipse.wst.sse.ui.search.find.occurrences";//$NON-NLS-1$
- public final static String FORMAT_ACTIVE_ELEMENTS = "org.eclipse.wst.sse.ui.format.active.elements";//$NON-NLS-1$
- public final static String FORMAT_DOCUMENT = "org.eclipse.wst.sse.ui.format.document";//$NON-NLS-1$
- public final static String INFORMATION = "org.eclipse.wst.sse.ui.show.javadoc";//$NON-NLS-1$
- public final static String MANAGE_BREAKPOINTS = "org.eclipse.wst.sse.ui.breakpoints.manage";//$NON-NLS-1$
- public final static String OPEN_FILE = "org.eclipse.wst.sse.ui.open.file.from.source";//$NON-NLS-1$
- public final static String QUICK_FIX = "org.eclipse.wst.sse.ui.edit.text.java.correction.assist.proposals";//$NON-NLS-1$
- public final static String REMOVE_BLOCK_COMMENT = "org.eclipse.wst.sse.ui.remove.block.comment";//$NON-NLS-1$
- public final static String STRUCTURE_SELECT_ENCLOSING = "org.eclipse.wst.sse.ui.structure.select.enclosing";//$NON-NLS-1$
- public final static String STRUCTURE_SELECT_HISTORY = "org.eclipse.wst.sse.ui.structure.select.last";//$NON-NLS-1$
- public final static String STRUCTURE_SELECT_NEXT = "org.eclipse.wst.sse.ui.structure.select.next";//$NON-NLS-1$
- public final static String STRUCTURE_SELECT_PREVIOUS = "org.eclipse.wst.sse.ui.structure.select.previous";//$NON-NLS-1$
- public final static String TOGGLE_COMMENT = "org.eclipse.wst.sse.ui.toggle.comment";//$NON-NLS-1$
- public final static String TOGGLE_BREAKPOINTS = "org.eclipse.wst.sse.ui.breakpoints.toggle";//$NON-NLS-1$
- public final static String UNCOMMENT = "org.eclipse.wst.sse.ui.uncomment";//$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActiveEditorActionHandler.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActiveEditorActionHandler.java
deleted file mode 100644
index 5595d63512..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActiveEditorActionHandler.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * @deprecated actions are not properly activated with this handler so do not
- * use
- */
-public class ActiveEditorActionHandler implements IAction {
-
- private String fActionId;
- private IWorkbenchSite fSite;
- private IAction fTargetAction;
-
- public ActiveEditorActionHandler(IWorkbenchSite site, String id) {
- super();
- fActionId = id;
- fSite = site;
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getAccelerator()
- */
- public int getAccelerator() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.getAccelerator() : 0);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getActionDefinitionId()
- */
- public String getActionDefinitionId() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.getActionDefinitionId() : null);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getDescription()
- */
- public String getDescription() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.getDescription() : null);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getDisabledImageDescriptor()
- */
- public ImageDescriptor getDisabledImageDescriptor() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.getDisabledImageDescriptor() : null);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getHelpListener()
- */
- public HelpListener getHelpListener() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.getHelpListener() : null);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getHoverImageDescriptor()
- */
- public ImageDescriptor getHoverImageDescriptor() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.getHoverImageDescriptor() : null);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getId()
- */
- public String getId() {
- return getClass().getName() + hashCode();
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.getImageDescriptor() : null);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getMenuCreator()
- */
- public IMenuCreator getMenuCreator() {
- return null;
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getStyle()
- */
- public int getStyle() {
- return IAction.AS_PUSH_BUTTON;
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getText()
- */
- public String getText() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.getText() : null);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#getToolTipText()
- */
- public String getToolTipText() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.getToolTipText() : null);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#isChecked()
- */
- public boolean isChecked() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.isChecked() : true);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#isEnabled()
- */
- public boolean isEnabled() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.isEnabled() : false);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#isHandled()
- */
- public boolean isHandled() {
- updateTargetAction();
- return (fTargetAction != null ? fTargetAction.isHandled() : false);
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- updateTargetAction();
- if (fTargetAction != null)
- fTargetAction.run();
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event)
- */
- public void runWithEvent(Event event) {
- updateTargetAction();
- if (fTargetAction != null)
- fTargetAction.runWithEvent(event);
- }
-
- /**
- * NOT SUPPORTED
- *
- * @see org.eclipse.jface.action.IAction#setAccelerator(int)
- */
- public void setAccelerator(int keycode) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setActionDefinitionId(java.lang.String)
- */
- public void setActionDefinitionId(String id) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setChecked(boolean)
- */
- public void setChecked(boolean checked) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setDescription(java.lang.String)
- */
- public void setDescription(String text) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setDisabledImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
- */
- public void setDisabledImageDescriptor(ImageDescriptor newImage) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setEnabled(boolean)
- */
- public void setEnabled(boolean enabled) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setHelpListener(org.eclipse.swt.events.HelpListener)
- */
- public void setHelpListener(HelpListener listener) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setHoverImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
- */
- public void setHoverImageDescriptor(ImageDescriptor newImage) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setId(java.lang.String)
- */
- public void setId(String id) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
- */
- public void setImageDescriptor(ImageDescriptor newImage) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setMenuCreator(org.eclipse.jface.action.IMenuCreator)
- */
- public void setMenuCreator(IMenuCreator creator) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setText(java.lang.String)
- */
- public void setText(String text) {
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#setToolTipText(java.lang.String)
- */
- public void setToolTipText(String text) {
- }
-
- private void updateTargetAction() {
- if (fSite != null && fSite.getWorkbenchWindow() != null && fSite.getWorkbenchWindow().getActivePage() != null) {
- IEditorPart part = fSite.getWorkbenchWindow().getActivePage().getActiveEditor();
- ITextEditor editor = null;
- if (part instanceof ITextEditor)
- editor = (ITextEditor) part;
- else
- editor = (ITextEditor) (part != null ? part.getAdapter(ITextEditor.class) : null);
- if (editor != null) {
- fTargetAction = editor.getAction(fActionId);
- } else {
- fTargetAction = null;
- }
- } else
- fTargetAction = null;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/CleanupAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/CleanupAction.java
deleted file mode 100644
index d015667134..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/CleanupAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.actions;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-public abstract class CleanupAction extends TextEditorAction {
- protected Dialog fCleanupDialog;
-
- public CleanupAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix, editor);
- }
-
- protected abstract Dialog getCleanupDialog(Shell shell);
-
- protected abstract IStructuredCleanupProcessor getCleanupProcessor();
-
- public void run() {
- if (getTextEditor() instanceof StructuredTextEditor) {
- final StructuredTextEditor editor = (StructuredTextEditor) getTextEditor();
- Dialog cleanupDialog = getCleanupDialog(editor.getSite().getShell());
- if (cleanupDialog != null) {
- if (cleanupDialog.open() == Window.OK) {
- // setup runnable
- Runnable runnable = new Runnable() {
- public void run() {
- IStructuredCleanupProcessor cleanupProcessor = getCleanupProcessor();
- if (cleanupProcessor != null)
- cleanupProcessor.cleanupModel(editor.getModel());
- }
- };
-
- // TODO: make independent of 'model'.
- IStructuredModel model = editor.getModel();
- if (model != null) {
- try {
- // begin recording
- ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
- model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength()); //$NON-NLS-1$ //$NON-NLS-2$
-
- // tell the model that we are about to make a big
- // model change
- model.aboutToChangeModel();
-
- // run
- BusyIndicator.showWhile(editor.getTextViewer().getControl().getDisplay(), runnable);
- } finally {
- // tell the model that we are done with the big
- // model
- // change
- model.changedModel();
-
- // end recording
- ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
- model.endRecording(this, selection.getOffset(), selection.getLength());
- }
- }
- }
-
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/FormatActionDelegate.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/FormatActionDelegate.java
deleted file mode 100644
index 5b6c61c78b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/FormatActionDelegate.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.actions;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.sse.core.internal.exceptions.MalformedInputExceptionWithDetail;
-import org.eclipse.wst.sse.core.internal.format.IStructuredFormatProcessor;
-import org.eclipse.wst.sse.ui.internal.FormatProcessorsExtensionReader;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-
-public class FormatActionDelegate extends ResourceActionDelegate {
-
- class FormatJob extends Job {
-
- public FormatJob(String name) {
- super(name);
- }
-
- /**
- * @param container
- * @return
- */
- private int getResourceCount(IResource[] members) {
- int count = 0;
-
- for (int i = 0; i < members.length; i++) {
- if (members[i] instanceof IContainer) {
- IContainer container = (IContainer) members[i];
- try {
- count += getResourceCount(container.members());
- } catch (CoreException e) {
- // skip counting
- }
- } else
- count++;
- }
-
- return count;
- }
-
- /**
- * @param elements
- * @return
- */
- private int getResourceCount(Object[] elements) {
- int count = 0;
-
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] instanceof IContainer) {
- IContainer container = (IContainer) elements[i];
- try {
- count += getResourceCount(container.members());
- } catch (CoreException e) {
- // skip counting
- }
- } else
- count++;
- }
-
- return count;
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
-
- Object[] elements = fSelection.toArray();
- int resourceCount = getResourceCount(elements);
- monitor.beginTask("", resourceCount); //$NON-NLS-1$
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] instanceof IResource) {
- process(monitor, (IResource) elements[i]);
- monitor.worked(1);
- }
- }
- monitor.done();
-
- if (fErrorStatus.getChildren().length > 0) {
- status = fErrorStatus;
- fErrorStatus = new MultiStatus(SSEUIPlugin.ID, IStatus.ERROR, SSEUIMessages.FormatActionDelegate_errorStatusMessage, null); //$NON-NLS-1$
- }
-
- return status;
- }
-
- }
-
- private MultiStatus fErrorStatus = new MultiStatus(SSEUIPlugin.ID, IStatus.ERROR, SSEUIMessages.FormatActionDelegate_errorStatusMessage, null); //$NON-NLS-1$
-
- protected void format(IProgressMonitor monitor, IFile file) {
- try {
- monitor.worked(1);
- IContentDescription contentDescription = file.getContentDescription();
- if (contentDescription == null)
- return;
-
- IContentType contentType = contentDescription.getContentType();
- IStructuredFormatProcessor formatProcessor = getFormatProcessor(contentType.getId());
- if (formatProcessor != null && (monitor == null || !monitor.isCanceled())) {
- String message = NLS.bind(SSEUIMessages.FormatActionDelegate_3, new String[]{file.getFullPath().toString()});
- monitor.subTask(message);
- formatProcessor.setProgressMonitor(monitor);
- formatProcessor.formatFile(file);
- }
- } catch (MalformedInputExceptionWithDetail e) {
- String message = NLS.bind(SSEUIMessages.FormatActionDelegate_5, new String[]{file.getFullPath().toString()});
- fErrorStatus.add(new Status(IStatus.ERROR, SSEUIPlugin.ID, IStatus.ERROR, message, e));
- } catch (IOException e) {
- String message = NLS.bind(SSEUIMessages.FormatActionDelegate_4, new String[]{file.getFullPath().toString()});
- fErrorStatus.add(new Status(IStatus.ERROR, SSEUIPlugin.ID, IStatus.ERROR, message, e));
- } catch (CoreException e) {
- String message = NLS.bind(SSEUIMessages.FormatActionDelegate_4, new String[]{file.getFullPath().toString()});
- fErrorStatus.add(new Status(IStatus.ERROR, SSEUIPlugin.ID, IStatus.ERROR, message, e));
- }
- }
-
- protected void format(IProgressMonitor monitor, IResource resource) {
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
-
- if (monitor == null || !monitor.isCanceled())
- format(monitor, file);
- } else if (resource instanceof IContainer) {
- IContainer container = (IContainer) resource;
-
- try {
- IResource[] members = container.members();
- for (int i = 0; i < members.length; i++) {
- if (monitor == null || !monitor.isCanceled())
- format(monitor, members[i]);
- }
- } catch (CoreException e) {
- String message = NLS.bind(SSEUIMessages.FormatActionDelegate_4, new String[]{resource.getFullPath().toString()});
- fErrorStatus.add(new Status(IStatus.ERROR, SSEUIPlugin.ID, IStatus.ERROR, message, e));
- }
- }
- }
-
- protected IStructuredFormatProcessor getFormatProcessor(String contentTypeId) {
- return FormatProcessorsExtensionReader.getInstance().getFormatProcessor(contentTypeId);
- }
-
- protected Job getJob() {
- return new FormatJob(SSEUIMessages.FormatActionDelegate_jobName); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.edit.util.ResourceActionDelegate#process(org.eclipse.core.runtime.IProgressMonitor,
- * org.eclipse.core.resources.IResource)
- */
- protected void process(IProgressMonitor monitor, IResource resource) {
- format(monitor, resource);
-
- try {
- resource.refreshLocal(IResource.DEPTH_INFINITE, null);
- } catch (CoreException e) {
- String message = NLS.bind(SSEUIMessages.FormatActionDelegate_4, new String[]{resource.getFullPath().toString()});
- fErrorStatus.add(new Status(IStatus.ERROR, SSEUIPlugin.ID, IStatus.ERROR, message, e));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.sse.ui.internal.actions.ResourceActionDelegate#processorAvailable(org.eclipse.core.resources.IResource)
- */
- protected boolean processorAvailable(IResource resource) {
- boolean result = false;
- if (resource.isAccessible()) {
- try {
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
-
- IStructuredFormatProcessor formatProcessor = null;
- IContentDescription contentDescription = file.getContentDescription();
- if (contentDescription != null) {
- IContentType contentType = contentDescription.getContentType();
- formatProcessor = getFormatProcessor(contentType.getId());
- }
- if (formatProcessor != null)
- result = true;
- }
- else if (resource instanceof IContainer) {
- IContainer container = (IContainer) resource;
- IResource[] members;
- members = container.members();
- for (int i = 0; i < members.length; i++) {
- boolean available = processorAvailable(members[i]);
-
- if (available) {
- result = true;
- break;
- }
- }
- }
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- }
-
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ResourceActionDelegate.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ResourceActionDelegate.java
deleted file mode 100644
index 3e2686a313..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ResourceActionDelegate.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.actions;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IActionDelegate;
-
-public class ResourceActionDelegate implements IActionDelegate {
- protected IStructuredSelection fSelection;
-
- protected Job getJob() {
- // ResourceActionDelegate does not create background job
- // subclass creates the background job for the action
- return null;
- }
-
- protected boolean processorAvailable(IResource resource) {
- // ResourceActionDelegate returns false by default
- // subclass returns true if processor is available; false otherwise
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- if (fSelection != null && !fSelection.isEmpty()) {
- Job job = getJob();
- if (job != null)
- job.schedule();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
- * org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- fSelection = (IStructuredSelection) selection;
- boolean available = false;
-
- Object[] elements = fSelection.toArray();
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] instanceof IResource) {
- available = processorAvailable((IResource) elements[i]);
-
- if (available)
- break;
- }
- }
-
- action.setEnabled(available);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/StructuredTextEditorActionConstants.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/StructuredTextEditorActionConstants.java
deleted file mode 100644
index 8d411b1484..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/StructuredTextEditorActionConstants.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.actions;
-
-
-
-public interface StructuredTextEditorActionConstants {
- public final static String ACTION_NAME_ADD_BLOCK_COMMENT = "AddBlockComment";//$NON-NLS-1$
- public final static String ACTION_NAME_CLEANUP_DOCUMENT = "CleanupDocument";//$NON-NLS-1$
- public final static String ACTION_NAME_COMMENT = "Comment";//$NON-NLS-1$
- public final static String ACTION_NAME_CONTENTASSIST_CONTEXT_INFORMATION = "ContentAssistContextInformation";//$NON-NLS-1$
- public final static String ACTION_NAME_CONTENTASSIST_PROPOSALS = "ContentAssistProposals";//$NON-NLS-1$
- public final static String ACTION_NAME_FIND_OCCURRENCES = "FindOccurrences"; //$NON-NLS-1$
- public final static String ACTION_NAME_FORMAT_ACTIVE_ELEMENTS = "FormatActiveElements";//$NON-NLS-1$
- public final static String ACTION_NAME_FORMAT_DOCUMENT = "FormatDocument";//$NON-NLS-1$
- public final static String ACTION_NAME_INFORMATION = "ShowTooltipDesc";//$NON-NLS-1$
- public final static String ACTION_NAME_MANAGE_BREAKPOINTS = "ManageBreakpoints";//$NON-NLS-1$
- public final static String ACTION_NAME_OPEN_FILE = "OpenFileFromSource";//$NON-NLS-1$
- public final static String ACTION_NAME_QUICK_FIX = "QuickFix";//$NON-NLS-1$
- public final static String ACTION_NAME_REMOVE_BLOCK_COMMENT = "RemoveBlockComment";//$NON-NLS-1$
- public final static String ACTION_NAME_STRUCTURE_SELECT_ENCLOSING = "StructureSelectEnclosing";//$NON-NLS-1$
- public final static String ACTION_NAME_STRUCTURE_SELECT_HISTORY = "StructureSelectHistory";//$NON-NLS-1$
- public final static String ACTION_NAME_STRUCTURE_SELECT_NEXT = "StructureSelectNext";//$NON-NLS-1$
- public final static String ACTION_NAME_STRUCTURE_SELECT_PREVIOUS = "StructureSelectPrevious";//$NON-NLS-1$
- public final static String ACTION_NAME_TOGGLE_COMMENT = "ToggleComment";//$NON-NLS-1$
- public final static String ACTION_NAME_UNCOMMENT = "Uncomment";//$NON-NLS-1$
-
- public final static String DOT = ".";//$NON-NLS-1$
-
- public final static String GROUP_NAME_MENU_ADDITIONS = "MenuAdditions";//$NON-NLS-1$
- public final static String GROUP_NAME_TOOLBAR_ADDITIONS = "ToolbarAdditions";//$NON-NLS-1$
-
- public final static String STATUS_CATEGORY_OFFSET = "Offset";//$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/CompoundContentAssistProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/CompoundContentAssistProcessor.java
deleted file mode 100644
index 204f0ea9d6..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/CompoundContentAssistProcessor.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-package org.eclipse.wst.sse.ui.internal.contentassist;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.contentassist.IContentAssistSubjectControl;
-import org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor;
-import org.eclipse.jface.contentassist.ISubjectControlContextInformationValidator;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.sse.ui.internal.IReleasable;
-
-/**
- * A processor that aggregates the proposals of multiple other processors.
- * When proposals are requested, the contained processors are queried in the
- * order they were added to the compound object. Copied from
- * org.eclipse.jdt.internal.ui.text.CompoundContentAssistProcessor.
- * Modification was made to add a dispose() method.
- */
-class CompoundContentAssistProcessor implements IContentAssistProcessor, ISubjectControlContentAssistProcessor {
-
- private static class WrappedContextInformation implements IContextInformation {
- private IContextInformation fInfo;
- private IContentAssistProcessor fProcessor;
-
- WrappedContextInformation(IContextInformation info, IContentAssistProcessor processor) {
- fInfo = info;
- fProcessor = processor;
- }
-
- /*
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- return fInfo.equals(obj);
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContextInformation#getContextDisplayString()
- */
- public String getContextDisplayString() {
- return fInfo.getContextDisplayString();
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContextInformation#getImage()
- */
- public Image getImage() {
- return fInfo.getImage();
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContextInformation#getInformationDisplayString()
- */
- public String getInformationDisplayString() {
- return fInfo.getInformationDisplayString();
- }
-
- /*
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fInfo.hashCode();
- }
-
- /*
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return fInfo.toString();
- }
-
- IContentAssistProcessor getProcessor() {
- return fProcessor;
- }
- }
-
- private static class CompoundContentAssistValidator implements IContextInformationValidator {
- List fValidators = new ArrayList();
- IContextInformationValidator fValidator;
-
- void add(IContextInformationValidator validator) {
- fValidators.add(validator);
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContextInformationValidator#install(org.eclipse.jface.text.contentassist.IContextInformation,
- * org.eclipse.jface.text.ITextViewer, int)
- */
- public void install(IContextInformation info, ITextViewer viewer, int documentPosition) {
- // install either the validator in the info, or all validators
- fValidator = getValidator(info);
- if (fValidator != null)
- fValidator.install(info, viewer, documentPosition);
- else {
- for (Iterator it = fValidators.iterator(); it.hasNext();) {
- IContextInformationValidator v = (IContextInformationValidator) it.next();
- v.install(info, viewer, documentPosition);
- }
- }
- }
-
- IContextInformationValidator getValidator(IContextInformation info) {
- if (info instanceof WrappedContextInformation) {
- WrappedContextInformation wrap = (WrappedContextInformation) info;
- return wrap.getProcessor().getContextInformationValidator();
- }
-
- return null;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContextInformationValidator#isContextInformationValid(int)
- */
- public boolean isContextInformationValid(int documentPosition) {
- // use either the validator in the info, or all validators
- boolean isValid = false;
- if (fValidator != null)
- isValid = fValidator.isContextInformationValid(documentPosition);
- else {
- for (Iterator it = fValidators.iterator(); it.hasNext();) {
- IContextInformationValidator v = (IContextInformationValidator) it.next();
- isValid |= v.isContextInformationValid(documentPosition);
- }
- }
- return isValid;
- }
-
- }
-
- private static class CompoundContentAssistValidatorEx extends CompoundContentAssistValidator implements ISubjectControlContextInformationValidator {
-
- /*
- * @see ISubjectControlContextInformationValidator#install(IContextInformation,
- * IContentAssistSubjectControl, int)
- */
- public void install(IContextInformation info, IContentAssistSubjectControl contentAssistSubjectControl, int documentPosition) {
- // install either the validator in the info, or all validators
- fValidator = getValidator(info);
- if (fValidator instanceof ISubjectControlContextInformationValidator)
- ((ISubjectControlContextInformationValidator) fValidator).install(info, contentAssistSubjectControl, documentPosition);
- else {
- for (Iterator it = fValidators.iterator(); it.hasNext();) {
- if (it.next() instanceof ISubjectControlContextInformationValidator)
- ((ISubjectControlContextInformationValidator) it.next()).install(info, contentAssistSubjectControl, documentPosition);
- }
- }
- }
-
- }
-
- private final Set fProcessors = new LinkedHashSet();
-
- /**
- * Creates a new instance.
- */
- public CompoundContentAssistProcessor() {
- }
-
- /**
- * Creates a new instance with one child processor.
- *
- * @param processor
- * the processor to add
- */
- public CompoundContentAssistProcessor(IContentAssistProcessor processor) {
- add(processor);
- }
-
- /**
- * Adds a processor to this compound processor.
- *
- * @param processor
- * the processor to add
- */
- public void add(IContentAssistProcessor processor) {
- Assert.isNotNull(processor);
- fProcessors.add(processor);
- }
-
- /**
- * Removes a processor from this compound processor.
- *
- * @param processor
- * the processor to remove
- */
- public void remove(IContentAssistProcessor processor) {
- fProcessors.remove(processor);
- }
-
- /**
- * Creates a new instance and adds all specified processors.
- *
- * @param processors
- */
- public CompoundContentAssistProcessor(IContentAssistProcessor[] processors) {
- for (int i = 0; i < processors.length; i++) {
- add(processors[i]);
- }
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer,
- * int)
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
- List ret = new LinkedList();
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- IContentAssistProcessor p = (IContentAssistProcessor) it.next();
- ICompletionProposal[] proposals = p.computeCompletionProposals(viewer, documentOffset);
- if (proposals != null)
- ret.addAll(Arrays.asList(proposals));
- }
- return (ICompletionProposal[]) ret.toArray(new ICompletionProposal[ret.size()]);
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * The returned objects are wrapper objects around the real information
- * containers.
- * </p>
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer,
- * int)
- */
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
- List ret = new LinkedList();
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- IContentAssistProcessor p = (IContentAssistProcessor) it.next();
- IContextInformation[] informations = p.computeContextInformation(viewer, documentOffset);
- if (informations != null)
- for (int i = 0; i < informations.length; i++)
- ret.add(new WrappedContextInformation(informations[i], p));
- }
- return (IContextInformation[]) ret.toArray(new IContextInformation[ret.size()]);
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- Set ret = new LinkedHashSet();
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- IContentAssistProcessor p = (IContentAssistProcessor) it.next();
- char[] chars = p.getCompletionProposalAutoActivationCharacters();
- if (chars != null)
- for (int i = 0; i < chars.length; i++)
- ret.add(new Character(chars[i]));
- }
-
- char[] chars = new char[ret.size()];
- int i = 0;
- for (Iterator it = ret.iterator(); it.hasNext(); i++) {
- Character ch = (Character) it.next();
- chars[i] = ch.charValue();
- }
- return chars;
- }
-
- /*
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
- */
- public char[] getContextInformationAutoActivationCharacters() {
- Set ret = new LinkedHashSet();
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- IContentAssistProcessor p = (IContentAssistProcessor) it.next();
- char[] chars = p.getContextInformationAutoActivationCharacters();
- if (chars != null)
- for (int i = 0; i < chars.length; i++)
- ret.add(new Character(chars[i]));
- }
-
- char[] chars = new char[ret.size()];
- int i = 0;
- for (Iterator it = ret.iterator(); it.hasNext(); i++) {
- Character ch = (Character) it.next();
- chars[i] = ch.charValue();
- }
- return chars;
- }
-
- /**
- * Returns the first non- <code>null</code> error message of any
- * contained processor, or <code>null</code> if no processor has an
- * error message.
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
- * @return {@inheritDoc}
- */
- public String getErrorMessage() {
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- IContentAssistProcessor p = (IContentAssistProcessor) it.next();
- String err = p.getErrorMessage();
- if (err != null)
- return err;
- }
- return null;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * The returned validator is a wrapper around the validators provided by
- * the child processors.
- * </p>
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
- */
- public IContextInformationValidator getContextInformationValidator() {
- boolean hasValidator = false;
- boolean hasExtension = false;
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- IContentAssistProcessor p = (IContentAssistProcessor) it.next();
- IContextInformationValidator v = p.getContextInformationValidator();
- if (v instanceof ISubjectControlContextInformationValidator) {
- hasExtension = true;
- break;
- }
- else if (v != null) {
- hasValidator = true;
- }
- }
-
- CompoundContentAssistValidator validator = null;
- if (hasExtension)
- validator = new CompoundContentAssistValidatorEx();
- else if (hasValidator)
- validator = new CompoundContentAssistValidator();
-
- if (validator != null)
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- IContentAssistProcessor p = (IContentAssistProcessor) it.next();
- IContextInformationValidator v = p.getContextInformationValidator();
- if (v != null)
- validator.add(v);
- }
-
- return validator;
- }
-
- /*
- * @see ISubjectControlContentAssistProcessor#computeCompletionProposals(IContentAssistSubjectControl,
- * int)
- */
- public ICompletionProposal[] computeCompletionProposals(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
- List ret = new LinkedList();
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- Object o = it.next();
- if (o instanceof ISubjectControlContentAssistProcessor) {
- ISubjectControlContentAssistProcessor p = (ISubjectControlContentAssistProcessor) o;
- ICompletionProposal[] proposals = p.computeCompletionProposals(contentAssistSubjectControl, documentOffset);
- if (proposals != null)
- ret.addAll(Arrays.asList(proposals));
- }
- }
-
- return (ICompletionProposal[]) ret.toArray(new ICompletionProposal[ret.size()]);
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * The returned objects are wrapper objects around the real information
- * containers.
- * </p>
- *
- * @see org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.contentassist.IContentAssistSubject,
- * int)
- */
- public IContextInformation[] computeContextInformation(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) {
- List ret = new LinkedList();
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- Object o = it.next();
- if (o instanceof ISubjectControlContentAssistProcessor) {
- ISubjectControlContentAssistProcessor p = (ISubjectControlContentAssistProcessor) o;
- IContextInformation[] informations = p.computeContextInformation(contentAssistSubjectControl, documentOffset);
- if (informations != null)
- for (int i = 0; i < informations.length; i++)
- ret.add(new WrappedContextInformation(informations[i], p));
- }
- }
- return (IContextInformation[]) ret.toArray(new IContextInformation[ret.size()]);
- }
-
- /**
- * Dispose of any content assist processors that need disposing
- */
- public void dispose() {
- // go through list of content assist processors and dispose
- for (Iterator it = fProcessors.iterator(); it.hasNext();) {
- IContentAssistProcessor p = (IContentAssistProcessor) it.next();
- if (p instanceof IReleasable) {
- ((IReleasable) p).release();
- }
- }
- fProcessors.clear();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/ContentAssistUtils.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/ContentAssistUtils.java
deleted file mode 100644
index 04080bea5d..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/ContentAssistUtils.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentassist;
-
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-
-
-/**
- * @author pavery
- *
- */
-public class ContentAssistUtils {
-
- /**
- * Returns the closest IndexedRegion for the offset and viewer allowing
- * for differences between viewer offsets and model positions. note: this
- * method returns an IndexedRegion for read only
- *
- * @param viewer
- * the viewer whose document is used to compute the proposals
- * @param documentOffset
- * an offset within the document for which completions should
- * be computed
- * @return an IndexedRegion
- */
- public static IndexedRegion getNodeAt(StructuredTextViewer viewer, int documentOffset) {
-
- if (viewer == null)
- return null;
-
- IndexedRegion node = null;
- IModelManager mm = StructuredModelManager.getModelManager();
- IStructuredModel model = null;
- if (mm != null)
- model = mm.getExistingModelForRead(viewer.getDocument());
- try {
- if (model != null) {
- int lastOffset = documentOffset;
- node = model.getIndexedRegion(documentOffset);
- while (node == null && lastOffset >= 0) {
- lastOffset--;
- node = model.getIndexedRegion(lastOffset);
- }
- }
- } finally {
- if (model != null)
- model.releaseFromRead();
- }
- return node;
- }
-
- /**
- * Returns the closest IStructuredDocumentRegion for the offest and
- * viewer.
- *
- * @param viewer
- * @param documentOffset
- * @return the closest IStructuredDocumentRegion for the offest and
- * viewer.
- */
- public static IStructuredDocumentRegion getStructuredDocumentRegion(StructuredTextViewer viewer, int documentOffset) {
- IStructuredDocumentRegion sdRegion = null;
- if (viewer == null || viewer.getDocument() == null)
- return null;
-
- int lastOffset = documentOffset;
- IStructuredDocument doc = (IStructuredDocument) viewer.getDocument();
- sdRegion = doc.getRegionAtCharacterOffset(documentOffset);
- while (sdRegion == null && lastOffset >= 0) {
- lastOffset--;
- sdRegion = doc.getRegionAtCharacterOffset(lastOffset);
- }
- return sdRegion;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/CustomCompletionProposal.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/CustomCompletionProposal.java
deleted file mode 100644
index 013799b989..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/CustomCompletionProposal.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentassist;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension5;
-import org.eclipse.jface.text.contentassist.CompletionProposal;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
-import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.wst.sse.core.internal.util.Debug;
-
-/**
- * An implementation of ICompletionProposal whose values can be read after
- * creation.
- */
-public class CustomCompletionProposal implements ICompletionProposal, ICompletionProposalExtension, ICompletionProposalExtension2, IRelevanceCompletionProposal {
-
- private String fAdditionalProposalInfo;
-
- private IContextInformation fContextInformation;
-
- private int fCursorPosition = 0;
-
- private String fDisplayString;
-
- private Image fImage;
-
- private int fOriginalReplacementLength;
-
- private int fRelevance = IRelevanceConstants.R_NONE;
-
- private int fReplacementLength = 0;
-
- private int fReplacementOffset = 0;
-
- private String fReplacementString = null;
-
- private boolean fUpdateLengthOnValidate;
-
- private char[] fTriggers;
-
- /**
- * Constructor with relevance and replacement length update flag.
- *
- * If the <code>updateReplacementLengthOnValidate</code> flag is true,
- * then when the user types, the replacement length will be incremented by
- * the number of new characters inserted from the original position.
- * Otherwise the replacement length will not change on validate.
- *
- * ex.
- *
- * <tag |name="attr"> - the replacement length is 4 <tag i|name="attr"> -
- * the replacement length is now 5 <tag id|name="attr"> - the replacement
- * length is now 6 <tag |name="attr"> - the replacementlength is now 4 again
- * <tag |name="attr"> - the replacment length remains 4
- *
- */
- public CustomCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString,
- IContextInformation contextInformation, String additionalProposalInfo, int relevance, boolean updateReplacementLengthOnValidate) {
- fReplacementString = replacementString;
- fReplacementOffset = replacementOffset;
- fReplacementLength = replacementLength;
- fCursorPosition = cursorPosition;
- fImage = image;
- fDisplayString = displayString;
- fContextInformation = contextInformation;
- fAdditionalProposalInfo = additionalProposalInfo;
- fRelevance = relevance;
- fUpdateLengthOnValidate = updateReplacementLengthOnValidate;
- fOriginalReplacementLength = fReplacementLength;
- }
-
- public CustomCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString,
- IContextInformation contextInformation, String additionalProposalInfo, int relevance) {
- this(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance, true);
- }
-
- public void apply(IDocument document) {
- CompletionProposal proposal = new CompletionProposal(getReplacementString(), getReplacementOffset(), getReplacementLength(), getCursorPosition(), getImage(), getDisplayString(),
- getContextInformation(), getAdditionalProposalInfo());
- proposal.apply(document);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension#apply(org.eclipse.jface.text.IDocument,
- * char, int)
- */
- public void apply(IDocument document, char trigger, int offset) {
- CompletionProposal proposal = new CompletionProposal(getReplacementString(), getReplacementOffset(), getReplacementLength(), getCursorPosition(), getImage(), getDisplayString(),
- getContextInformation(), getAdditionalProposalInfo());
- // we currently don't do anything special for which character
- // selected the proposal, and where the cursor offset is
- // but we might in the future...
- proposal.apply(document);
- // we want to ContextInformationPresenter.updatePresentation() here
- }
-
- public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
- IDocument document = viewer.getDocument();
- // CMVC 252634 to compensate for "invisible" initial region
- int caretOffset = viewer.getTextWidget().getCaretOffset();
- if (viewer instanceof ITextViewerExtension5) {
- ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
- caretOffset = extension.widgetOffset2ModelOffset(caretOffset);
- } else {
- caretOffset = viewer.getTextWidget().getCaretOffset() + viewer.getVisibleRegion().getOffset();
- }
-
- if (caretOffset == getReplacementOffset()) {
- apply(document);
- } else {
- // replace the text without affecting the caret Position as this
- // causes the cursor to move on its own
- try {
- int endOffsetOfChanges = getReplacementString().length() + getReplacementOffset();
- // Insert the portion of the new text that comes after the
- // current caret position
- if (endOffsetOfChanges >= caretOffset) {
- int postCaretReplacementLength = getReplacementOffset() + getReplacementLength() - caretOffset;
- int preCaretReplacementLength = getReplacementString().length() - (endOffsetOfChanges - caretOffset);
- if (postCaretReplacementLength < 0) {
- if (Debug.displayWarnings) {
- System.out.println("** postCaretReplacementLength was negative: " + postCaretReplacementLength); //$NON-NLS-1$
- }
- // This is just a quick fix while I figure out what
- // replacement length is supposed to be
- // in each case, otherwise we'll get negative
- // replacment length sometimes
- postCaretReplacementLength = 0;
- }
- document.replace(caretOffset, postCaretReplacementLength, getReplacementString().substring(preCaretReplacementLength));
- }
- // Insert the portion of the new text that comes before the
- // current caret position
- // Done second since offsets would change for the post text
- // otherwise
- // Outright insertions are handled here
- if (caretOffset > getReplacementOffset()) {
- int preCaretTextLength = caretOffset - getReplacementOffset();
- document.replace(getReplacementOffset(), preCaretTextLength, getReplacementString().substring(0, preCaretTextLength));
- }
- } catch (BadLocationException x) {
- apply(document);
- } catch (StringIndexOutOfBoundsException e) {
- apply(document);
- }
- }
- }
-
- public String getAdditionalProposalInfo() {
- // return fProposal.getAdditionalProposalInfo();
- return fAdditionalProposalInfo;
- }
-
- public IContextInformation getContextInformation() {
- // return fProposal.getContextInformation();
- return fContextInformation;
- }
-
- public void setContextInformation(IContextInformation contextInfo) {
- fContextInformation = contextInfo;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension#getContextInformationPosition()
- */
- public int getContextInformationPosition() {
- return getCursorPosition();
- }
-
- public int getCursorPosition() {
- return fCursorPosition;
- }
-
- public void setCursorPosition(int pos) {
- fCursorPosition = pos;
- }
-
- public void setDisplayString(String newDisplayString) {
- fDisplayString = newDisplayString;
- }
-
- public String getDisplayString() {
- // return fProposal.getDisplayString();
- return fDisplayString;
- }
-
- public Image getImage() {
- // return fProposal.getImage();
- return fImage;
- }
-
- public int getRelevance() {
- return fRelevance;
- }
-
- public void setReplacementLength(int newReplacementLength) {
- fReplacementLength = newReplacementLength;
- }
- public int getReplacementLength() {
- return fReplacementLength;
- }
-
- public int getReplacementOffset() {
- return fReplacementOffset;
- }
-
- public String getReplacementString() {
- return fReplacementString;
- }
-
- public Point getSelection(IDocument document) {
- // return fProposal.getSelection(document);
- CompletionProposal proposal = new CompletionProposal(getReplacementString(), getReplacementOffset(), getReplacementLength(), getCursorPosition(), getImage(), getDisplayString(),
- getContextInformation(), getAdditionalProposalInfo());
- return proposal.getSelection(document);
- }
-
- /**
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension#getTriggerCharacters()
- */
-
- public char[] getTriggerCharacters() {
- return fTriggers;
- }
-
- public void setTriggerCharacters(char[] triggers) {
- fTriggers = triggers;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension#isValidFor(org.eclipse.jface.text.IDocument,
- * int)
- */
- public boolean isValidFor(IDocument document, int offset) {
- return validate(document, offset, null);
- }
-
- /**
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#selected(org.eclipse.jface.text.ITextViewer,
- * boolean)
- */
- public void selected(ITextViewer viewer, boolean smartToggle) {
- }
-
- // code is borrowed from JavaCompletionProposal
- protected boolean startsWith(IDocument document, int offset, String word) {
-
- int wordLength = word == null ? 0 : word.length();
- if (offset > fReplacementOffset + wordLength)
- return false;
-
- try {
- int length = offset - fReplacementOffset;
- String start = document.get(fReplacementOffset, length);
-
- return word.substring(0, length).equalsIgnoreCase(start);
- } catch (BadLocationException x) {
- }
-
- return false;
- }
-
- /**
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#unselected(org.eclipse.jface.text.ITextViewer)
- */
- public void unselected(ITextViewer viewer) {
- }
-
- /**
- * borrowed from JavaCompletionProposal
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#validate(org.eclipse.jface.text.IDocument,
- * int, org.eclipse.jface.text.DocumentEvent)
- */
- public boolean validate(IDocument document, int offset, DocumentEvent event) {
- if (offset < fReplacementOffset)
- return false;
- boolean validated = startsWith(document, offset, fDisplayString);
-
- if (fUpdateLengthOnValidate) {
-
- // it would be better to use "originalCursorPosition" instead of
- // getReplacementOffset(), but we don't have that info.
- int newLength = offset - getReplacementOffset();
- int delta = newLength - fOriginalReplacementLength;
- fReplacementLength = delta + fOriginalReplacementLength;
-
- // if it's an attribute value, replacement offset is
- // going to be one off from the actual cursor offset...
- char firstChar = document.get().charAt(getReplacementOffset());
- if(firstChar == '"' || firstChar == '\'')
- fReplacementLength ++;
- }
- return validated;
- }
-
- /**
- * @param replacementOffset The fReplacementOffset to set.
- */
- public void setReplacementOffset(int replacementOffset) {
- fReplacementOffset = replacementOffset;
- }
- /**
- * @param replacementString The fReplacementString to set.
- */
- public void setReplacementString(String replacementString) {
- fReplacementString = replacementString;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/IRelevanceCompletionProposal.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/IRelevanceCompletionProposal.java
deleted file mode 100644
index d67b10e63e..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/IRelevanceCompletionProposal.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentassist;
-
-
-/**
- * CompletionProposal with a relevance value. The relevance value is used to
- * sort the completion proposals. Proposals with higher relevance should be
- * listed before proposals with lower relevance.
- *
- * @author pavery
- */
-public interface IRelevanceCompletionProposal {
- /**
- * Returns the relevance of the proposal.
- */
- int getRelevance();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/IRelevanceConstants.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/IRelevanceConstants.java
deleted file mode 100644
index ba5a16ed30..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/IRelevanceConstants.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentassist;
-
-public interface IRelevanceConstants {
- int R_NONE = 0;
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/StructuredContentAssistant.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/StructuredContentAssistant.java
deleted file mode 100644
index 30ee6a5d9f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/StructuredContentAssistant.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentassist;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
-
-public class StructuredContentAssistant extends ContentAssistant {
- private static final String CONTENT_ASSIST_PROCESSOR_EXTENDED_ID = "contentassistprocessor"; //$NON-NLS-1$
-
- /**
- * personal list of content assist processors
- */
- private Map fProcessors;
- /**
- * list of partition types where extended processors have been installed
- */
- private List fInstalledExtendedContentTypes;
-
- /**
- * Each set content assist processor is placed inside a
- * CompoundContentAssistProcessor which allows multiple processors per
- * partition type
- *
- * @param processor
- * the content assist processor to register, or
- * <code>null</code> to remove an existing one
- * @param contentType
- * the content type under which to register
- */
- public void setContentAssistProcessor(IContentAssistProcessor processor, String partitionType) {
- if (fProcessors == null)
- fProcessors = new HashMap();
-
- CompoundContentAssistProcessor compoundProcessor = getExistingContentAssistProcessor(partitionType);
-
- // if processor is null, you want to remove all processors of
- // contentType
- if (processor == null && compoundProcessor != null) {
- compoundProcessor.dispose();
- fProcessors.remove(partitionType);
- compoundProcessor = null;
- }
- if (processor != null) {
- // create a new compoundprocess if there already isnt one
- if (compoundProcessor == null) {
- compoundProcessor = new CompoundContentAssistProcessor();
- }
- // add processor to compound processor
- compoundProcessor.add(processor);
- // add compound procesor to processors list (will replace old one,
- // even if same instance)
- fProcessors.put(partitionType, compoundProcessor);
- }
- super.setContentAssistProcessor(compoundProcessor, partitionType);
- }
-
- private CompoundContentAssistProcessor getExistingContentAssistProcessor(String partitionType) {
- CompoundContentAssistProcessor compoundContentAssistProcessor = null;
- IContentAssistProcessor processor = super.getContentAssistProcessor(partitionType);
- if (processor != null) {
- if (processor instanceof CompoundContentAssistProcessor) {
- compoundContentAssistProcessor = (CompoundContentAssistProcessor) processor;
- }
- else {
- throw new IllegalStateException("StructuredContentAssistant use CompoundContentAssistProcessor"); //$NON-NLS-1$
- }
- }
- return compoundContentAssistProcessor;
-
- }
-
- /**
- * Returns the content assist processor to be used for the given content
- * type. Also installs any content assist processors that were added by
- * extension point.
- *
- * @param contentType
- * the type of the content for which this content assistant is
- * to be requested
- * @return an instance content assist processor or <code>null</code> if
- * none exists for the specified content type
- */
- public IContentAssistProcessor getContentAssistProcessor(String partitionType) {
- if (fInstalledExtendedContentTypes == null || !fInstalledExtendedContentTypes.contains(partitionType)) {
- // get extended content assist processors that have not already
- // been set
- List processors = ExtendedConfigurationBuilder.getInstance().getConfigurations(CONTENT_ASSIST_PROCESSOR_EXTENDED_ID, partitionType);
- if (processors != null && !processors.isEmpty()) {
- Iterator iter = processors.iterator();
- while (iter.hasNext()) {
- IContentAssistProcessor processor = (IContentAssistProcessor) iter.next();
- setContentAssistProcessor(processor, partitionType);
- }
- }
- // add partition type to list of extended partition types
- // installed (regardless of whether or not any extended content
- // assist processors were installed because dont want to look it
- // up every time)
- if (fInstalledExtendedContentTypes == null)
- fInstalledExtendedContentTypes = new ArrayList();
- fInstalledExtendedContentTypes.add(partitionType);
- }
-
- IContentAssistProcessor processor = super.getContentAssistProcessor(partitionType);
- return processor;
- }
-
- public void uninstall() {
- // dispose of all content assist processors
- if (fProcessors != null && !fProcessors.isEmpty()) {
- Collection collection = fProcessors.values();
- Iterator iter = collection.iterator();
- while (iter.hasNext()) {
- ((CompoundContentAssistProcessor) iter.next()).dispose();
- }
- fProcessors.clear();
- }
- // clear out list of installed content types
- if (fInstalledExtendedContentTypes != null) {
- fInstalledExtendedContentTypes.clear();
- }
- super.uninstall();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/ConfigurableContentOutlinePage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/ConfigurableContentOutlinePage.java
deleted file mode 100644
index 8e31f815e3..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/ConfigurableContentOutlinePage.java
+++ /dev/null
@@ -1,707 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentoutline;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IContributionManager;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.util.DelegatingDragAdapter;
-import org.eclipse.jface.util.DelegatingDropAdapter;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.util.TransferDragSourceListener;
-import org.eclipse.jface.util.TransferDropTargetListener;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IPostSelectionProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSource;
-import org.eclipse.swt.dnd.DropTarget;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.IShowInTarget;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.part.ShowInContext;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration;
-
-
-public class ConfigurableContentOutlinePage extends ContentOutlinePage implements IAdaptable {
- /*
- * Menu listener to create the additions group and add any menu items
- * contributed by the configuration; required since the context menu is
- * cleared every time it is shown
- */
- class AdditionGroupAdder implements IMenuListener {
- public void menuAboutToShow(IMenuManager manager) {
- IContributionItem[] items = manager.getItems();
- if (items.length > 0 && items[items.length - 1].getId() != null) {
- manager.insertAfter(items[items.length - 1].getId(), new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- }
- else {
- manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- // add configuration's menu items
- IMenuListener listener = getConfiguration().getMenuListener(getTreeViewer());
- if (listener != null) {
- listener.menuAboutToShow(manager);
- }
- }
- }
-
- /**
- * Provides double-click registration so it can be done before the Control
- * is created.
- */
- class DoubleClickProvider implements IDoubleClickListener {
- private IDoubleClickListener[] listeners = null;
-
- void addDoubleClickListener(IDoubleClickListener newListener) {
- if (listeners == null) {
- listeners = new IDoubleClickListener[]{newListener};
- }
- else {
- IDoubleClickListener[] newListeners = new IDoubleClickListener[listeners.length + 1];
- System.arraycopy(listeners, 0, newListeners, 0, listeners.length);
- newListeners[listeners.length] = newListener;
- listeners = newListeners;
- }
- }
-
- public void doubleClick(DoubleClickEvent event) {
- fireDoubleClickEvent(event);
- }
-
- private void fireDoubleClickEvent(final DoubleClickEvent event) {
- IDoubleClickListener[] firingListeners = listeners;
- for (int i = 0; i < firingListeners.length; ++i) {
- final IDoubleClickListener l = firingListeners[i];
- SafeRunner.run(new SafeRunnable() {
- public void run() {
- l.doubleClick(event);
- }
- });
- }
- }
-
- void removeDoubleClickListener(IDoubleClickListener oldListener) {
- if (listeners != null) {
- if (listeners.length == 1 && listeners[0].equals(oldListener)) {
- listeners = null;
- }
- else {
- List newListeners = new ArrayList(Arrays.asList(listeners));
- newListeners.remove(oldListener);
- listeners = (IDoubleClickListener[]) newListeners.toArray(new IDoubleClickListener[listeners.length - 1]);
- }
- }
- }
- }
-
- /**
- * Listens to post selection from the selection service, applying it to
- * the tree viewer.
- */
- private class PostSelectionServiceListener implements ISelectionListener {
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- // from selection service
- if (_DEBUG) {
- _DEBUG_TIME = System.currentTimeMillis();
- } /*
- * Bug 136310, unless this page is that part's
- * IContentOutlinePage, ignore the selection change
- */
- if (part == null || part.getAdapter(IContentOutlinePage.class) == ConfigurableContentOutlinePage.this) {
- ISelection validContentSelection = getConfiguration().getSelection(getTreeViewer(), selection);
-
- boolean isLinked = getConfiguration().isLinkedWithEditor(getTreeViewer());
- if (isLinked) {
- getTreeViewer().setSelection(validContentSelection, true);
- }
- }
- if (_DEBUG) {
- System.out.println("(O:" + (System.currentTimeMillis() - _DEBUG_TIME) + "ms) " + part + " : " + selection); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- }
-
- /**
- * Forwards post-selection from the tree viewer to the listeners while
- * acting as this page's selection provider.
- */
- private class SelectionProvider implements IPostSelectionProvider {
- private class PostSelectionChangedListener implements ISelectionChangedListener {
- public void selectionChanged(SelectionChangedEvent event) {
- if (!isFiringSelection()) {
- fireSelectionChanged(event, postListeners);
- }
- }
- }
-
- private class SelectionChangedListener implements ISelectionChangedListener {
- public void selectionChanged(SelectionChangedEvent event) {
- if (!isFiringSelection()) {
- fireSelectionChanged(event, listeners);
- }
- }
- }
-
- private boolean isFiringSelection = false;
- private ListenerList listeners = new ListenerList();
- private ListenerList postListeners = new ListenerList();
- private ISelectionChangedListener postSelectionChangedListener = new PostSelectionChangedListener();
- private ISelectionChangedListener selectionChangedListener = new SelectionChangedListener();
-
- public void addPostSelectionChangedListener(ISelectionChangedListener listener) {
- postListeners.add(listener);
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- listeners.add(listener);
- }
-
- public void fireSelectionChanged(final SelectionChangedEvent event, ListenerList listenerList) {
- isFiringSelection = true;
- Object[] listeners = listenerList.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
- SafeRunner.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(event);
- }
- });
- }
- isFiringSelection = false;
- }
-
- public ISelectionChangedListener getPostSelectionChangedListener() {
- return postSelectionChangedListener;
- }
-
- public ISelection getSelection() {
- if (getTreeViewer() != null) {
- return getTreeViewer().getSelection();
- }
- return StructuredSelection.EMPTY;
- }
-
- public ISelectionChangedListener getSelectionChangedListener() {
- return selectionChangedListener;
- }
-
- public boolean isFiringSelection() {
- return isFiringSelection;
- }
-
- public void removePostSelectionChangedListener(ISelectionChangedListener listener) {
- postListeners.remove(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- listeners.remove(listener);
- }
-
- public void setSelection(ISelection selection) {
- if (!isFiringSelection) {
- getTreeViewer().setSelection(selection);
- }
- }
- }
-
- private class ShowInTarget implements IShowInTarget {
- /*
- * @see org.eclipse.ui.part.IShowInTarget#show(org.eclipse.ui.part.ShowInContext)
- */
- public boolean show(ShowInContext context) {
- setSelection(context.getSelection());
- return getTreeViewer().getSelection().equals(context.getSelection());
- }
- }
-
- protected static final ContentOutlineConfiguration NULL_CONFIGURATION = new ContentOutlineConfiguration() {
- public IContentProvider getContentProvider(TreeViewer viewer) {
- return new ITreeContentProvider() {
- public void dispose() {
- }
-
- public Object[] getChildren(Object parentElement) {
- return null;
- }
-
- public Object[] getElements(Object inputElement) {
- return null;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- };
- }
- };
-
- private static final String OUTLINE_CONTEXT_MENU_ID = "org.eclipse.wst.sse.ui.StructuredTextEditor.OutlineContext"; //$NON-NLS-1$
-
- private static final String OUTLINE_CONTEXT_MENU_SUFFIX = ".source.OutlineContext"; //$NON-NLS-1$
- private static final boolean _DEBUG = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/contentOutline")); //$NON-NLS-1$ //$NON-NLS-2$;
-
- private long _DEBUG_TIME = 0;
-
- private TransferDragSourceListener[] fActiveDragListeners;
- private TransferDropTargetListener[] fActiveDropListeners;
- private ContentOutlineConfiguration fConfiguration;
-
- private Menu fContextMenu;
- private String fContextMenuId;
-
- private MenuManager fContextMenuManager;
- private DoubleClickProvider fDoubleClickProvider = null;
-
- private DelegatingDragAdapter fDragAdapter;
- private DragSource fDragSource;
- private DelegatingDropAdapter fDropAdapter;
- private DropTarget fDropTarget;
- private IEditorPart fEditor;
- private IMenuListener fGroupAdder = null;
- private Object fInput = null;
-
- private String fInputContentTypeIdentifier = null;
- private ISelectionListener fSelectionListener = null;
-
- SelectionProvider fSelectionProvider = null;
-
- /**
- * A ContentOutlinePage that abstract as much behavior as possible away
- * from the Controls and varies it by content type.
- */
- public ConfigurableContentOutlinePage() {
- super();
- fGroupAdder = new AdditionGroupAdder();
- fSelectionProvider = new SelectionProvider();
- }
-
- /**
- * Adds a listener to a list of those notified when someone double-clicks
- * in the page.
- *
- * @param newListener -
- * the listener to add
- */
- public void addDoubleClickListener(IDoubleClickListener newListener) {
- if (fDoubleClickProvider == null) {
- fDoubleClickProvider = new DoubleClickProvider();
- }
- fDoubleClickProvider.addDoubleClickListener(newListener);
- }
-
- private String computeContextMenuID() {
- String id = null;
- if (fInputContentTypeIdentifier != null) {
- id = fInputContentTypeIdentifier + OUTLINE_CONTEXT_MENU_SUFFIX;
- }
- return id;
- }
-
- /**
- * @see ContentOutlinePage#createControl
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
-
- IWorkbenchPage page = getSite().getWorkbenchWindow().getActivePage();
- if (page != null) {
- fEditor = page.getActiveEditor();
- }
-
- fDragAdapter = new DelegatingDragAdapter();
- fDragSource = new DragSource(getControl(), DND.DROP_COPY | DND.DROP_MOVE);
- fDropAdapter = new DelegatingDropAdapter();
- fDropTarget = new DropTarget(getControl(), DND.DROP_COPY | DND.DROP_MOVE);
-
- setConfiguration(getConfiguration());
-
- /*
- * ContentOutlinePage only implements ISelectionProvider while the
- * tree viewer implements both ISelectionProvider and
- * IPostSelectionProvider. Use an ISelectionProvider that listens to
- * post selection from the tree viewer and forward only post selection
- * to the selection service.
- */
- getTreeViewer().addPostSelectionChangedListener(fSelectionProvider.getPostSelectionChangedListener());
- getTreeViewer().addSelectionChangedListener(fSelectionProvider.getSelectionChangedListener());
- if (fDoubleClickProvider == null) {
- fDoubleClickProvider = new DoubleClickProvider();
- }
- getTreeViewer().addDoubleClickListener(fDoubleClickProvider);
- getSite().setSelectionProvider(fSelectionProvider);
- }
-
- public void dispose() {
- getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(getSelectionServiceListener());
- if (fDoubleClickProvider != null) {
- getTreeViewer().removeDoubleClickListener(fDoubleClickProvider);
- }
-
- // dispose menu controls
- if (fContextMenu != null) {
- fContextMenu.dispose();
- }
- if (fContextMenuManager != null) {
- fContextMenuManager.removeMenuListener(fGroupAdder);
- fContextMenuManager.removeAll();
- fContextMenuManager.dispose();
- }
- setConfiguration(NULL_CONFIGURATION);
- super.dispose();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class key) {
- Object adapter = null;
- if (key.equals(IShowInTarget.class)) {
- adapter = new ShowInTarget();
- }
- final IEditorPart editor = fEditor;
-
- if (key.equals(IShowInSource.class) && editor != null) {
- adapter = new IShowInSource() {
- public ShowInContext getShowInContext() {
- return new ShowInContext(editor.getEditorInput(), editor.getEditorSite().getSelectionProvider().getSelection());
- }
- };
- }
- else if (key.equals(IShowInTargetList.class) && editor != null) {
- adapter = editor.getAdapter(key);
- }
- return adapter;
- }
-
- /**
- * @return the currently used ContentOutlineConfiguration
- */
- public ContentOutlineConfiguration getConfiguration() {
- if (fConfiguration == null) {
- fConfiguration = NULL_CONFIGURATION;
- }
- return fConfiguration;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- return fSelectionProvider.getSelection();
- }
-
- private ISelectionListener getSelectionServiceListener() {
- if (fSelectionListener == null) {
- fSelectionListener = new PostSelectionServiceListener();
- }
- return fSelectionListener;
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.IPageBookViewPage#init(org.eclipse.ui.part.IPageSite)
- */
- public void init(IPageSite pageSite) {
- super.init(pageSite);
- pageSite.getWorkbenchWindow().getSelectionService().addPostSelectionListener(getSelectionServiceListener());
- }
-
- /**
- * Removes a listener to a list of those notified when someone
- * double-clicks in the page.
- *
- * @param oldListener -
- * the listener to remove
- */
- public void removeDoubleClickListener(IDoubleClickListener oldListener) {
- if (fDoubleClickProvider != null) {
- fDoubleClickProvider.removeDoubleClickListener(oldListener);
- }
- }
-
- /**
- * Configures (or reconfigures) the page according to the given
- * configuration.
- *
- * @param configuration
- */
- public void setConfiguration(ContentOutlineConfiguration configuration) {
- // intentionally do not check to see if the new configuration != old
- // configuration
- if (getTreeViewer() != null) {
- // remove the key listeners
- if (getControl() != null && !getControl().isDisposed()) {
- KeyListener[] listeners = getConfiguration().getKeyListeners(getTreeViewer());
- if (listeners != null) {
- for (int i = 0; i < listeners.length; i++) {
- getControl().removeKeyListener(listeners[i]);
- }
- }
- }
-
- IContributionManager toolbar = getSite().getActionBars().getToolBarManager();
- if (toolbar != null) {
- IContributionItem[] toolbarItems = getConfiguration().getToolbarContributions(getTreeViewer());
- if (toolbarItems != null && toolbarItems.length > 0) {
- for (int i = 0; i < toolbarItems.length; i++) {
- toolbar.remove(toolbarItems[i]);
- }
- toolbar.update(false);
- }
- }
-
- IContributionManager menubar = getSite().getActionBars().getMenuManager();
- if (menubar != null) {
- IContributionItem[] menuItems = getConfiguration().getMenuContributions(getTreeViewer());
- if (menuItems != null && menuItems.length > 0) {
- for (int i = 0; i < menuItems.length; i++) {
- menubar.remove(menuItems[i]);
- }
- menubar.remove(IWorkbenchActionConstants.MB_ADDITIONS);
- menubar.update(false);
- }
- }
- // clear the DnD listeners and transfer types
- if (fDragAdapter != null && !fDragAdapter.isEmpty() && fDragSource != null && !fDragSource.isDisposed() && fDragSource.getTransfer().length > 0) {
- if (fActiveDragListeners != null) {
- for (int i = 0; i < fActiveDragListeners.length; i++) {
- fDragAdapter.removeDragSourceListener(fActiveDragListeners[i]);
- }
- }
- fActiveDragListeners = null;
- fDragSource.removeDragListener(fDragAdapter);
- fDragSource.setTransfer(new Transfer[0]);
- }
- if (fDropAdapter != null && !fDropAdapter.isEmpty() && fDropTarget != null && !fDropTarget.isDisposed() && fDropTarget.getTransfer().length > 0) {
- if (fActiveDropListeners != null) {
- for (int i = 0; i < fActiveDropListeners.length; i++) {
- fDropAdapter.removeDropTargetListener(fActiveDropListeners[i]);
- }
- }
- fActiveDropListeners = null;
- fDropTarget.removeDropListener(fDropAdapter);
- fDropTarget.setTransfer(new Transfer[0]);
- }
- getConfiguration().getContentProvider(getTreeViewer()).inputChanged(getTreeViewer(), fInput, null);
- // release any ties to this tree viewer
- getConfiguration().unconfigure(getTreeViewer());
- }
-
- fConfiguration = configuration;
-
- if (getTreeViewer() != null && getControl() != null && !getControl().isDisposed()) {
- // (re)set the providers
- getTreeViewer().setLabelProvider(getConfiguration().getLabelProvider(getTreeViewer()));
- getTreeViewer().setContentProvider(getConfiguration().getContentProvider(getTreeViewer()));
-
- // view toolbar
- IContributionManager toolbar = getSite().getActionBars().getToolBarManager();
- if (toolbar != null) {
- IContributionItem[] toolbarItems = getConfiguration().getToolbarContributions(getTreeViewer());
- if (toolbarItems != null) {
- for (int i = 0; i < toolbarItems.length; i++) {
- toolbar.add(toolbarItems[i]);
- }
- toolbar.update(true);
- }
- }
- // view menu
- IContributionManager menu = getSite().getActionBars().getMenuManager();
- if (menu != null) {
- IContributionItem[] menuItems = getConfiguration().getMenuContributions(getTreeViewer());
- if (menuItems != null) {
- for (int i = 0; i < menuItems.length; i++) {
- menuItems[i].setVisible(true);
- menu.add(menuItems[i]);
- menuItems[i].update();
- }
- menu.update(true);
- }
- }
- // add the allowed DnD listeners and types
- TransferDragSourceListener[] dragListeners = getConfiguration().getTransferDragSourceListeners(getTreeViewer());
- if (fDragAdapter != null && dragListeners.length > 0) {
- for (int i = 0; i < dragListeners.length; i++) {
- fDragAdapter.addDragSourceListener(dragListeners[i]);
- }
- fActiveDragListeners = dragListeners;
- fDragSource.addDragListener(fDragAdapter);
- fDragSource.setTransfer(fDragAdapter.getTransfers());
- }
- TransferDropTargetListener[] dropListeners = getConfiguration().getTransferDropTargetListeners(getTreeViewer());
- if (fDropAdapter != null && dropListeners.length > 0) {
- for (int i = 0; i < dropListeners.length; i++) {
- fDropAdapter.addDropTargetListener(dropListeners[i]);
- }
- fActiveDropListeners = dropListeners;
- fDropTarget.addDropListener(fDropAdapter);
- fDropTarget.setTransfer(fDropAdapter.getTransfers());
- }
- // add the key listeners
- KeyListener[] listeners = getConfiguration().getKeyListeners(getTreeViewer());
- if (listeners != null) {
- for (int i = 0; i < listeners.length; i++) {
- getControl().addKeyListener(listeners[i]);
- }
- }
- }
-
- if (fInput != null) {
- setInput(fInput);
- }
- }
-
- /**
- * @param editor
- * The IEditorPart that "owns" this page. Used to support the
- * "Show In..." menu.
- */
- public void setEditorPart(IEditorPart editor) {
- fEditor = editor;
- }
-
- /**
- * @param newInput
- * The input for the page's viewer. Should only be set after a
- * configuration has been applied.
- */
- public void setInput(Object newInput) {
- fInput = newInput;
- /*
- * Intentionally not optimized for checking new input vs. old input so
- * that any existing content providers can be updated
- */
- if (getControl() != null && !getControl().isDisposed()) {
- getTreeViewer().setInput(fInput);
- updateContextMenuId();
- }
- }
-
- /**
- * @param id -
- * the content type identifier to use for further extension
- */
- public void setInputContentTypeIdentifier(String id) {
- fInputContentTypeIdentifier = id;
- }
-
- /**
- * Updates the outline page's context menu for the current input
- */
- private void updateContextMenuId() {
- String computedContextMenuId = null;
- // update outline view's context menu control and ID
-
- if (fEditor == null) {
- IWorkbenchPage page = getSite().getWorkbenchWindow().getActivePage();
- if (page != null) {
- fEditor = page.getActiveEditor();
- }
- }
-
- computedContextMenuId = computeContextMenuID();
-
- if (computedContextMenuId == null) {
- computedContextMenuId = OUTLINE_CONTEXT_MENU_ID;
- }
-
- /*
- * Update outline context menu id if updating to a new id or if
- * context menu is not already set up
- */
- if (!computedContextMenuId.equals(fContextMenuId) || (fContextMenu == null)) {
- fContextMenuId = computedContextMenuId;
-
- if (getControl() != null && !getControl().isDisposed()) {
- // dispose of previous context menu
- if (fContextMenu != null) {
- fContextMenu.dispose();
- }
- if (fContextMenuManager != null) {
- fContextMenuManager.removeMenuListener(fGroupAdder);
- fContextMenuManager.removeAll();
- fContextMenuManager.dispose();
- }
-
- fContextMenuManager = new MenuManager(fContextMenuId, fContextMenuId);
- fContextMenuManager.setRemoveAllWhenShown(true);
-
- fContextMenuManager.addMenuListener(fGroupAdder);
-
- fContextMenu = fContextMenuManager.createContextMenu(getControl());
- getControl().setMenu(fContextMenu);
-
- getSite().registerContextMenu(fContextMenuId, fContextMenuManager, this);
-
- /*
- * also register this menu for source page part and structured
- * text outline view ids
- */
- if (fEditor != null) {
- String partId = fEditor.getSite().getId();
- if (partId != null) {
- getSite().registerContextMenu(partId + OUTLINE_CONTEXT_MENU_SUFFIX, fContextMenuManager, this);
- }
- }
- getSite().registerContextMenu(OUTLINE_CONTEXT_MENU_ID, fContextMenuManager, this);
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/IJFaceNodeAdapter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/IJFaceNodeAdapter.java
deleted file mode 100644
index 1e96d5da28..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/IJFaceNodeAdapter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentoutline;
-
-
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-
-
-public interface IJFaceNodeAdapter extends INodeAdapter {
-
- public Object[] getChildren(Object node);
-
- /**
- * Returns an enumeration with the elements belonging to the passed
- * element. These are the top level items in a list, tree, table, etc...
- */
- public Object[] getElements(Object node);
-
- /**
- * Fetches the label image specific to this object instance.
- */
- public Image getLabelImage(Object node);
-
- /**
- * Fetches the label text specific to this object instance.
- */
- public String getLabelText(Object node);
-
- public Object getParent(Object node);
-
- public boolean hasChildren(Object node);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/IJFaceNodeAdapterFactory.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/IJFaceNodeAdapterFactory.java
deleted file mode 100644
index 2a47fe1456..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/IJFaceNodeAdapterFactory.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentoutline;
-
-import java.util.Collection;
-
-public interface IJFaceNodeAdapterFactory {
- public void addListener(Object listener);
-
- /**
- * returns "copy" so no one can modify our list. Its is a shallow copy.
- */
- public Collection getListeners();
-
- public void removeListener(Object listener);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/PropertyChangeUpdateAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/PropertyChangeUpdateAction.java
deleted file mode 100644
index 3a538c2d01..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/PropertyChangeUpdateAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentoutline;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * An IAction.AS_CHECK_BOX action that sets and gets its checked state along
- * with a value from a preference store. Should be used with
- * PropertyChangeUpdateActionContributionItem to listen to changes in the
- * store and update the checked state from PropertyChangeEvents.
- */
-public class PropertyChangeUpdateAction extends Action implements IUpdate {
- private String fPreferenceKey;
- private IPreferenceStore fStore;
- private boolean fUpdateFromPropertyChange = true;
-
- public PropertyChangeUpdateAction(String text, IPreferenceStore store, String preferenceKey, boolean defaultValue) {
- super(text, IAction.AS_CHECK_BOX);
- fPreferenceKey = preferenceKey;
- fStore = store;
- fStore.setDefault(getPreferenceKey(), defaultValue);
- setId(getPreferenceKey());
- setChecked(getPreferenceStore().getBoolean(getPreferenceKey()));
- }
-
- /**
- * @return Returns the orderPreferenceKey.
- */
- public String getPreferenceKey() {
- return fPreferenceKey;
- }
-
- /**
- * @return Returns the store.
- */
- public IPreferenceStore getPreferenceStore() {
- return fStore;
- }
-
- /**
- * @return Returns the updateFromPropertyChange.
- */
- public boolean isUpdateFromPropertyChange() {
- return fUpdateFromPropertyChange;
- }
-
- public final void run() {
- super.run();
- fStore.setValue(getPreferenceKey(), isChecked());
- if (!isUpdateFromPropertyChange())
- update();
- }
-
- /**
- * @param updateFromPropertyChange
- * The updateFromPropertyChange to set.
- */
- public void setUpdateFromPropertyChange(boolean updateFromPropertyChange) {
- fUpdateFromPropertyChange = updateFromPropertyChange;
- }
-
- public void update() {
- setChecked(fStore.getBoolean(getPreferenceKey()));
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/PropertyChangeUpdateActionContributionItem.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/PropertyChangeUpdateActionContributionItem.java
deleted file mode 100644
index 5c642ea2ac..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentoutline/PropertyChangeUpdateActionContributionItem.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentoutline;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * A listener on the given action's PreferenceStore. It calls .update() on the
- * action when the given key changes value.
- */
-public class PropertyChangeUpdateActionContributionItem extends ActionContributionItem {
-
- private class PreferenceUpdateListener implements IPropertyChangeListener {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(fProperty)) {
- if (debug) {
- System.out.println(fProperty + " preference changed, updating " + getAction()); //$NON-NLS-1$
- }
- ((IUpdate) getAction()).update();
- }
- }
- }
-
- static final boolean debug = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/propertyChangeUpdateActionContributionItem")); //$NON-NLS-1$ //$NON-NLS-2$;
-
- private IPropertyChangeListener fListener = null;
-
- protected String fProperty = null;
- private IPreferenceStore fStore;
-
- public PropertyChangeUpdateActionContributionItem(PropertyChangeUpdateAction action) {
- super(action);
- fProperty = action.getPreferenceKey();
- fStore = action.getPreferenceStore();
- fListener = new PreferenceUpdateListener();
- connect();
- }
-
- public void connect() {
- if (debug) {
- System.out.println("PropertyChangeUpdateActionContributionItem started listening for " + fProperty); //$NON-NLS-1$
- }
- if (fStore != null) {
- fStore.addPropertyChangeListener(fListener);
- }
- }
-
- public void disconnect() {
- if (debug) {
- System.out.println("PropertyChangeUpdateActionContributionItem stopped listening for " + fProperty); //$NON-NLS-1$
- }
- if (fStore != null) {
- fStore.removePropertyChangeListener(fListener);
- }
- }
-
- public void dispose() {
- super.dispose();
- disconnect();
- fProperty = null;
- fStore = null;
- }
-
- public String toString() {
- if (getAction().getId() != null)
- return super.toString();
- else
- return getClass().getName() + "(text=" + getAction().getText() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ComboList.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ComboList.java
deleted file mode 100644
index 8b8eb59087..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ComboList.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentproperties.ui;
-
-
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-
-/**
- * @deprecated People should manage their own combo/list
- */
-public class ComboList {
- private Combo combo;
-
-
- private List list;
-
- public ComboList(Composite parent, int style) {
- combo = new Combo(parent, style);
- list = new ArrayList();
- }
-
-
- /*
- * following methods is original method of Combo class.
- */
- public void add(String key) {
- checkError();
- combo.add(key);
- list.add(key);
- }
-
- public void add(String key, int index) {
- checkError();
- combo.add(key, index);
- list.add(index, key);
- }
-
- public void add(String key, String value) {
- checkError();
- combo.add(key);
- list.add(value);
- }
-
- public void add(String key, String value, int index) {
- checkError();
- combo.add(key, index);
- list.add(index, value);
- }
-
- public void addFocusListener(FocusListener listener) {
- combo.addFocusListener(listener);
- }
-
- public void addModifyListener(org.eclipse.swt.events.ModifyListener listener) {
- combo.addModifyListener(listener);
- }
-
- public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener) {
- combo.addSelectionListener(listener);
-
- }
-
- private void checkError() {
- if (!isConsistency()) {
- Logger.log(Logger.WARNING, "Difference between the number of keys[" + combo.getItemCount() + "] and the number of values[" + list.size() + "] in ComboList"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint) {
- return combo.computeSize(wHint, hHint);
- }
-
- public Map createHashtable() {
- checkError();
- Map m = new Hashtable();
- for (int i = 0; i < list.size(); i++)
- m.put(combo.getItem(i), list.get(i));
- return m;
- }
-
- public void deselect(int i) {
- combo.deselect(i);
- }
-
- public void deselectAll() {
- combo.deselectAll();
- }
-
- public boolean equals(Object obj) {
- return combo.equals(obj);
- }
-
- private void exchangePosition(int i, int j) {
- String tmpKey = getItem(i);
- Object tmpValue = list.remove(i);
-
- combo.setItem(i, getItem(j));
- list.add(i, list.remove(j - 1));
-
- combo.setItem(j, tmpKey);
- list.add(j, tmpValue);
- }
-
- public boolean existsAsKey(String str) {
- if (combo.indexOf(str) >= 0)
- return true;
- else
- return false;
- }
-
- public boolean existsAsValue(String str) {
- if (list.indexOf(str) >= 0)
- return true;
- else
- return false;
- }
-
- public boolean getEnabled() {
- return combo.getEnabled();
- }
-
- public String getItem(int index) {
- return combo.getItem(index);
- }
-
- public int getItemCount() {
- return combo.getItemCount();
- }
-
- public String getKey(String value) {
- if (value == null)
- return null;
- int index = -1;
- checkError();
- for (int i = 0; i < list.size(); i++) {
- if (!list.get(i).equals(value))
- continue;
- index = i;
- break;
- }
- if (index != -1)
- return combo.getItem(index);
- else
- return null;
- }
-
- public Object getLayoutData() {
- return combo.getLayoutData();
- }
-
- public String getSelectedValue() {
- checkError();
- int index = getSelectionIndex();
- if (index < 0)
- return null;
- return getValue(getItem(index));
- }
-
- public int getSelectionIndex() {
- return combo.getSelectionIndex();
- }
-
- public String getText() {
- return combo.getText();
- }
-
- public String getValue(String key) {
- if (key == null)
- return null;
- int index = -1;
- checkError();
- for (int i = 0; i < combo.getItemCount(); i++) {
- if (!combo.getItem(i).equals(key))
- continue;
- index = i;
- break;
- }
- if (index != -1)
- return (String) list.get(index);
- else
- return null;
- }
-
- public int indexOf(String str) {
- return combo.indexOf(str);
- }
-
-
- public boolean isConsistency() {
-
- if (list.size() == combo.getItemCount())
- return true;
- else
- return false;
- }
-
-
- public void remove(int index) {
- checkError();
- combo.remove(index);
- list.remove(index);
- }
-
- public void remove(String str) {
- checkError();
- combo.remove(str);
- list.remove(str);
- }
-
- public void select(int index) {
- combo.select(index);
- }
-
- public void setEnabled(boolean enabled) {
- combo.setEnabled(enabled);
- }
-
- public boolean setFocus() {
- return combo.setFocus();
- }
-
- public void setItem(int index, String str) {
- checkError();
- combo.setItem(index, str);
- list.remove(index);
- list.add(index, str);
- }
-
- public void setItem(String[] strArray) {
- checkError();
- combo.setItems(strArray);
- for (int i = 0; i < strArray.length; i++)
- list.add(strArray[i]);
- }
-
- public void setLayout(org.eclipse.swt.widgets.Layout lo) {
- combo.setLayout(lo);
- }
-
- public void setLayoutData(Object layoutData) {
- combo.setLayoutData(layoutData);
- }
-
- public void setSelection(Point point) {
- combo.setSelection(point);
- }
-
- public void setText(String str) {
- combo.setText(str);
- }
-
- public void sortByKey(int offset) {
- if (offset < 0 || offset > this.combo.getItemCount() - 1)
- return;
- checkError();
- //
- for (int i = offset; i < combo.getItemCount() - 1; i++) {
- for (int j = i + 1; j < combo.getItemCount(); j++) {
- if (getItem(i).compareTo(getItem(j)) > 0) {
- exchangePosition(i, j);
- }
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ComboListOnPropertyPage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ComboListOnPropertyPage.java
deleted file mode 100644
index f46c5177af..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ComboListOnPropertyPage.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentproperties.ui;
-
-
-
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @deprecated People should manage their own combo/list
- */
-public final class ComboListOnPropertyPage extends ComboList {
-
-
- private String currentApplyValue;
-
- public ComboListOnPropertyPage(Composite parent, int style) {
- super(parent, style);
- }
-
- public final String getApplyValue() {
- return currentApplyValue;
- }
-
- public final void setApplyValue(String currentApplyValue) {
- this.currentApplyValue = currentApplyValue;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ContentSettingsPropertyPage.java
deleted file mode 100644
index c21501f5fa..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentproperties/ui/ContentSettingsPropertyPage.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.contentproperties.ui;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.internal.contentproperties.ContentSettings;
-import org.eclipse.wst.sse.internal.contentproperties.ContentSettingsCreator;
-import org.eclipse.wst.sse.internal.contentproperties.IContentSettings;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-
-/**
- * @deprecated Please use
- * org.eclipse.wst.html.ui.internal.contentproperties.ui.WebContentSettingsPropertyPage
- * or
- * eclipse.wst.css.ui.internal.contentproperties.ui.CSSWebContentSettingsPropertyPage
- * instead
- */
-public abstract class ContentSettingsPropertyPage extends PropertyPage {
- private static final IStatus STATUS_ERROR = new Status(IStatus.ERROR, SSEUIPlugin.ID, IStatus.INFO, "ERROR", null); //$NON-NLS-1$
-
- // for validateEdit()
- private static final IStatus STATUS_OK = new Status(IStatus.OK, SSEUIPlugin.ID, IStatus.OK, "OK", null); //$NON-NLS-1$
-
- /**
- * Method validateEdit.
- *
- * @param file
- * org.eclipse.core.resources.IFile
- * @param context
- * org.eclipse.swt.widgets.Shell
- * @return IStatus
- */
- private static IStatus validateEdit(IFile file, Shell context) {
- if (file == null || !file.exists())
- return STATUS_ERROR;
- if (!(file.isReadOnly()))
- return STATUS_OK;
-
- IPath fullIPath = file.getLocation();
-
- final long beforeModifiedFromJavaIO = fullIPath.toFile().lastModified();
- final long beforeModifiedFromIFile = file.getModificationStamp();
-
- IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[]{file}, context);
- if (!status.isOK())
- return status;
-
- final long afterModifiedFromJavaIO = fullIPath.toFile().lastModified();
- final long afterModifiedFromIFile = file.getModificationStamp();
-
- if (beforeModifiedFromJavaIO != afterModifiedFromJavaIO) {
- IModelManager manager = StructuredModelManager.getModelManager();
- IStructuredModel model = manager.getExistingModelForRead(file);
- if (model != null) {
- if (!model.isDirty()) {
- try {
- file.refreshLocal(IResource.DEPTH_ONE, null);
- }
- catch (CoreException e) {
- return STATUS_ERROR;
- }
- finally {
- model.releaseFromRead();
- }
- }
- else {
- model.releaseFromRead();
- }
- }
- }
-
- if ((beforeModifiedFromJavaIO != afterModifiedFromJavaIO) || (beforeModifiedFromIFile != afterModifiedFromIFile)) {
- // the file is replaced. Modification cannot be
- // applied.
- return STATUS_ERROR;
- }
- return STATUS_OK;
- }
-
- protected ComboListOnPropertyPage[] combo;
- protected Composite composite;
-
- protected IContentSettings contentSettings;
- protected final String CSS_LABEL = SSEUIMessages.UI_CSS_profile___2; //$NON-NLS-1$
- protected final String DEVICE_LABEL = SSEUIMessages.UI_Target_Device___3; //$NON-NLS-1$
-
- protected final String DOCUMENT_LABEL = SSEUIMessages.UI_Default_HTML_DOCTYPE_ID___1; //$NON-NLS-1$
- protected int numberOfCombo;
- protected int numCols = 1;
- protected int numRows = 1;
- protected Composite propertyPage;
-
- public ContentSettingsPropertyPage() {
- super();
- }
-
- private void cleanUp() {
- // Are There any way to guarantee to call cleanUp() to re-load
- // downloaded .contentsettings file
- // after ContentSettings.releaseCache() in ContentSettingSelfHandler
- // class, which is called by resourceChangeEvent
- }
-
-
- protected ComboListOnPropertyPage createComboBoxOf(String title) {
-
- Label label = new Label(propertyPage, SWT.LEFT);
- label.setText(title);
- if (title != null && title.startsWith(SSEUIMessages.UI_Default_HTML_DOCTYPE_ID___1)) { //$NON-NLS-1$
- GridData data = new GridData();
- data.horizontalIndent = 10;
- label.setLayoutData(data);
- }
- ComboListOnPropertyPage combo = new ComboListOnPropertyPage(propertyPage, SWT.READ_ONLY);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- // data.horizontalAlignment= GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- combo.setLayoutData(data);
- return combo;
- }
-
-
-
- protected Composite createComposite(Composite parent, int numColumns, int numRows) {
- Composite composite = new Composite(parent, SWT.NONE);
-
- // GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
-
- // GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- // data.horizontalSpan=numColumns;
- // data.verticalSpan=numRows;
-
- composite.setLayoutData(data);
- return composite;
- }
-
-
- protected Control createContents(Composite parent) {
-
- contentSettings = ContentSettingsCreator.create();
-
- propertyPage = createComposite(parent, numCols, numRows);
-
- createSettingsPageGUI();
-
- return propertyPage;
-
-
- }
-
- protected abstract void createSettingsPageGUI();
-
- // protected abstract void applySelectedPropertyValue(String str,int
- // index);
- protected abstract void deleteNoneProperty(int index);
-
-
-
- protected boolean isInitValueChanged(String before, String after) {
- if (before == null && after == null)
- return false;
- if (before != null && before.equals(after))
- return false;
- return true;
- }
-
-
-
- protected void performDefaults() {
- super.performDefaults();
- // selected(applied) item is restored.
- for (int i = 0; i < numberOfCombo; i++) {
- // String appliedValue = combo[i].getApplyValue();
- // setSelectionItem(combo[i],appliedValue);
- combo[i].select(0); // select none.
-
- }
-
- }
-
- public boolean performOk() {
- Map properties = new Hashtable();
- if (validateState() == false) {
- cleanUp();
- return true;
- }
- for (int i = 0; i < numberOfCombo; i++) {
- // get selected item in Combo box.
- String str = combo[i].getSelectedValue();
- if (str == null)
- continue;
- // if no change, skip setProperty
- if (!isInitValueChanged(combo[i].getApplyValue(), str))
- continue;
- // if NONE is selected, delete attr instance (and write
- // .contentsettings.)
- if (str != null && str.length() == 0)
- deleteNoneProperty(i);
- else
- putSelectedPropertyInto(properties, str, i);
- // applySelectedPropertyValue(str,i);
-
- // set apply value in ComboListOnPropertyPage.
- combo[i].setApplyValue(str);
- }
- if (properties != null && !properties.isEmpty())
- contentSettings.setProperties((IResource) super.getElement(), properties);
- if (properties != null)
- properties.clear();
- properties = null;
- if (!contentSettings.existsProperties((IResource) super.getElement()))
- contentSettings.deleteAllProperties((IResource) super.getElement());
- return true;
- }
-
- protected abstract void putSelectedPropertyInto(Map properties, String str, int i);
-
-
- protected void setSelectionItem(ComboListOnPropertyPage combo, String value) {
- if (combo.getItemCount() <= 0)
- return;
- combo.setApplyValue(value);
- String item = combo.getKey(value);
- if (item != null)
- combo.select(combo.indexOf(item));
- else
- combo.select(0);
-
- }
-
- /*
- * Validate Edit. Similar function will be in HTMLCommand.java
- * ContentSettingsPropertyPage.java CSSActionManager.java
- * DesignRedoAction.java DesignUndoAction.java
- * HTMLConversionProcessor.java
- */
- private boolean validateState() {
-
- // get IFile of .contentsettings
- final String name = ContentSettings.getContentSettingsName();
- final IResource resource = (IResource) super.getElement();
- final IProject project = resource.getProject();
- IFile file = project.getFile(name);
-
- if (file != null && !file.exists())
- return true; // Is this really OK?
- // If false should be returned,
- // This statemant can be removed,
- // since ModelManagerUtil.validateEdit()
- // returns error to this case.
-
- Shell shell = getControl().getShell();
- IStatus status = validateEdit(file, shell);
- return status.isOK() ? true : false;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/ContributedProcessorDescriptor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/ContributedProcessorDescriptor.java
deleted file mode 100644
index be6df0f2fd..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/ContributedProcessorDescriptor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.correction;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-public class ContributedProcessorDescriptor {
- private static final String CLASS = "class"; //$NON-NLS-1$
-
- private IConfigurationElement fConfigurationElement;
- private Object fProcessorInstance;
-
- public ContributedProcessorDescriptor(IConfigurationElement element) {
- fConfigurationElement = element;
- fProcessorInstance = null;
- }
-
- public Object getProcessor() throws CoreException {
- if (fProcessorInstance == null && fConfigurationElement != null) {
- fProcessorInstance = fConfigurationElement.createExecutableExtension(CLASS);
- }
- return fProcessorInstance;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/CorrectionAssistantProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/CorrectionAssistantProvider.java
deleted file mode 100644
index 2a11fd99be..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/CorrectionAssistantProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.correction;
-
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.source.ISourceViewer;
-
-/**
- * Provides the appropriate correction assistant for a given source viewer.
- * This class should only be a placeholder until the base implements a common
- * way for quickfix/quick assist.
- */
-abstract public class CorrectionAssistantProvider {
- /**
- * Returns the correction assistant for the given sourceviewer.
- *
- * @param sourceViewer
- * @return
- */
- abstract public IContentAssistant getCorrectionAssistant(ISourceViewer sourceViewer);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickAssistProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickAssistProcessor.java
deleted file mode 100644
index 444e0923ce..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickAssistProcessor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.correction;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-
-
-public interface IQuickAssistProcessor {
- /**
- * Returns true if the processor can assist at the given offset. This test
- * should be an optimistic guess and be extremly cheap.
- */
- boolean canAssist(StructuredTextViewer viewer, int offset);
-
- /**
- * Collects proposals for assistant at the given offset.
- */
- ICompletionProposal[] getProposals(StructuredTextViewer viewer, int offset) throws CoreException;
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickFixProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickFixProcessor.java
deleted file mode 100644
index 77441acf0b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/IQuickFixProcessor.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.correction;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.source.Annotation;
-
-public interface IQuickFixProcessor {
- /**
- * Returns true if the processor can fix the given problem. This test
- * should be an optimistic guess and be extremly cheap.
- */
- boolean canFix(Annotation annnotation);
-
- /**
- * Collects proposals for fixing the given problem.
- */
- ICompletionProposal[] getProposals(Annotation annnotation) throws CoreException;
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/NoModificationCompletionProposal.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/NoModificationCompletionProposal.java
deleted file mode 100644
index c98bb53b8e..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/NoModificationCompletionProposal.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.correction;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-public class NoModificationCompletionProposal implements ICompletionProposal {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposal#apply(org.eclipse.jface.text.IDocument)
- */
- public void apply(IDocument document) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getAdditionalProposalInfo()
- */
- public String getAdditionalProposalInfo() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getContextInformation()
- */
- public IContextInformation getContextInformation() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getDisplayString()
- */
- public String getDisplayString() {
- return SSEUIMessages.NoModificationCompletionProposal_0; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getImage()
- */
- public Image getImage() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getSelection(org.eclipse.jface.text.IDocument)
- */
- public Point getSelection(IDocument document) {
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/StructuredCorrectionProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/StructuredCorrectionProcessor.java
deleted file mode 100644
index 6183b9264a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/correction/StructuredCorrectionProcessor.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.correction;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.contentassist.IContextInformationValidator;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-
-
-public class StructuredCorrectionProcessor implements IContentAssistProcessor {
- protected IAnnotationModel fAnnotationModel;
- protected IQuickAssistProcessor fQuickAssistProcessor;
- protected IQuickFixProcessor fQuickFixProcessor;
-
- public StructuredCorrectionProcessor(ISourceViewer sourceViewer) {
- fAnnotationModel = sourceViewer.getAnnotationModel();
- }
-
- protected void addQuickAssistProposals(StructuredTextViewer viewer, ArrayList proposals, int documentOffset) {
- try {
- IQuickAssistProcessor processor = getQuickAssistProcessor();
- if (processor != null && processor.canAssist(viewer, documentOffset)) {
- ICompletionProposal[] res = processor.getProposals(viewer, documentOffset);
- if (res != null) {
- for (int k = 0; k < res.length; k++) {
- proposals.add(res[k]);
- }
- }
- }
- } catch (CoreException e) {
- // log for now, unless we find reason not to
- Logger.log(Logger.INFO, e.getMessage());
- }
- }
-
- protected void addQuickFixProposals(StructuredTextViewer viewer, ArrayList proposals, int documentOffset) {
- Iterator iter = fAnnotationModel.getAnnotationIterator();
- while (iter.hasNext()) {
- Annotation annotation = (Annotation) iter.next();
- Position pos = fAnnotationModel.getPosition(annotation);
- if (pos != null && documentOffset >= pos.offset && documentOffset <= pos.offset + pos.length) {
- IQuickFixProcessor processor = getQuickFixProcessor();
- if (processor != null && processor.canFix(annotation)) {
- try {
- ICompletionProposal[] res = processor.getProposals(annotation);
- if (res != null) {
- for (int k = 0; k < res.length; k++) {
- proposals.add(res[k]);
- }
- }
- } catch (CoreException e) {
- // log for now, unless we find reason not to
- Logger.log(Logger.INFO, e.getMessage());
- }
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer,
- * int)
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
- ArrayList proposals = new ArrayList();
-
- if (viewer instanceof StructuredTextViewer) {
- addQuickFixProposals((StructuredTextViewer) viewer, proposals, documentOffset);
-
- if (proposals.isEmpty()) {
- addQuickAssistProposals((StructuredTextViewer) viewer, proposals, documentOffset);
- }
- }
-
- if (proposals.isEmpty())
- proposals.add(new NoModificationCompletionProposal());
-
- return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer,
- * int)
- */
- public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
- */
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
- */
- public IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
- */
- public String getErrorMessage() {
- return null;
- }
-
- protected IQuickAssistProcessor getQuickAssistProcessor() {
- return null;
- }
-
- protected IQuickFixProcessor getQuickFixProcessor() {
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/BreakpointRulerAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/BreakpointRulerAction.java
deleted file mode 100644
index 947d649abe..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/BreakpointRulerAction.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.debug;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.extension.BreakpointProviderBuilder;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IBreakpointProvider;
-
-
-public abstract class BreakpointRulerAction extends Action implements IUpdate {
-
- protected class MouseUpdater implements MouseListener {
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing (here)
- }
-
- public void mouseDown(MouseEvent e) {
- update();
- }
-
- public void mouseUp(MouseEvent e) {
- // do nothing
- }
- }
-
- public static final String getFileExtension(IEditorInput input) {
- IPath path = null;
- if (input instanceof IStorageEditorInput) {
- try {
- path = ((IStorageEditorInput) input).getStorage().getFullPath();
- } catch (CoreException e) {
- Logger.logException(e);
- }
- }
- if (path != null) {
- return path.getFileExtension();
- }
- String name = input.getName();
- int index = name.lastIndexOf('.');
- if (index == -1)
- return null;
- if (index == (name.length() - 1))
- return ""; //$NON-NLS-1$
- return name.substring(index + 1);
- }
-
- public static final IResource getResource(IEditorInput input) {
- IResource resource = null;
-
- if (input instanceof IFileEditorInput)
- resource = ((IFileEditorInput) input).getFile();
- if (resource == null)
- resource = (IResource) input.getAdapter(IFile.class);
- if (resource == null)
- resource = (IResource) input.getAdapter(IResource.class);
-
- IEditorPart editorPart = null;
- if (resource == null) {
- IWorkbench workbench = SSEUIPlugin.getDefault().getWorkbench();
- if (workbench != null) {
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- if (window != null) {
- IPartService service = window.getPartService();
- if (service != null) {
- Object part = service.getActivePart();
- if (part != null && part instanceof IEditorPart) {
- editorPart = (IEditorPart) part;
- if (editorPart != null) {
- IStructuredModel model = null;
- ITextEditor textEditor = null;
- try {
- if (editorPart instanceof ITextEditor) {
- textEditor = (ITextEditor) editorPart;
- }
- if (textEditor == null) {
- textEditor = (ITextEditor) editorPart.getAdapter(ITextEditor.class);
- }
- if (textEditor != null) {
- IDocument textDocument = textEditor.getDocumentProvider().getDocument(input);
- model = StructuredModelManager.getModelManager().getExistingModelForRead(textDocument);
- if (model != null) {
- resource = BreakpointProviderBuilder.getInstance().getResource(input, model.getContentTypeIdentifier(), getFileExtension(input));
- }
- }
- if (resource == null) {
- IBreakpointProvider[] providers = BreakpointProviderBuilder.getInstance().getBreakpointProviders(editorPart, null, getFileExtension(input));
- for (int i = 0; i < providers.length && resource == null; i++) {
- resource = providers[i].getResource(input);
- }
- }
- } catch (Exception e) {
- Logger.logException(e);
- } finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- }
-
- }
- }
- }
-
- }
- }
- return resource;
- }
-
- protected MouseListener fMouseListener = null;
-
- protected IVerticalRulerInfo fRulerInfo = null;
- protected ITextEditor fTextEditor = null;
-
- public BreakpointRulerAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
- super();
- fTextEditor = editor;
- if(rulerInfo != null) {
- fRulerInfo = rulerInfo;
- fMouseListener = new MouseUpdater();
- rulerInfo.getControl().addMouseListener(fMouseListener);
- }
- }
-
- /**
- * Returns the <code>AbstractMarkerAnnotationModel</code> of the
- * editor's input.
- *
- * @return the marker annotation model
- */
- protected AbstractMarkerAnnotationModel getAnnotationModel() {
- IDocumentProvider provider = fTextEditor.getDocumentProvider();
- IAnnotationModel model = provider.getAnnotationModel(fTextEditor.getEditorInput());
- if (model instanceof AbstractMarkerAnnotationModel)
- return (AbstractMarkerAnnotationModel) model;
- return null;
- }
-
- protected IBreakpoint[] getBreakpoints(IMarker[] markers) {
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- List breakpoints = new ArrayList(markers.length);
- for (int i = 0; i < markers.length; i++) {
- IBreakpoint breakpoint = manager.getBreakpoint(markers[i]);
- if (breakpoint != null) {
- breakpoints.add(breakpoint);
- }
- }
- return (IBreakpoint[]) breakpoints.toArray(new IBreakpoint[0]);
- }
-
- /**
- * Returns the <code>IDocument</code> of the editor's input.
- *
- * @return the document of the editor's input
- */
- protected IDocument getDocument() {
- IDocumentProvider provider = fTextEditor.getDocumentProvider();
- return provider.getDocument(fTextEditor.getEditorInput());
- }
-
- /**
- * Returns all markers which include the ruler's line of activity.
- *
- * @return an array of markers which include the ruler's line of activity
- */
- protected IMarker[] getMarkers() {
- List markers = new ArrayList();
-
- IResource resource = getResource();
- IDocument document = getDocument();
- AbstractMarkerAnnotationModel annotationModel = getAnnotationModel();
-
- if (resource != null && annotationModel != null && resource.exists()) {
- try {
- IMarker[] allMarkers = resource.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_ZERO);
- if (allMarkers != null) {
- for (int i = 0; i < allMarkers.length; i++) {
- if (includesRulerLine(annotationModel.getMarkerPosition(allMarkers[i]), document)) {
- markers.add(allMarkers[i]);
- }
- }
- }
- } catch (CoreException x) {
- //
- }
- }
-
- return (IMarker[]) markers.toArray(new IMarker[0]);
- }
-
- protected IResource getResource() {
- IEditorInput input = getTextEditor().getEditorInput();
- IResource resource = getResource(input);
- return resource;
- }
-
- /**
- * @return Returns the rulerInfo.
- */
- public IVerticalRulerInfo getRulerInfo() {
- return fRulerInfo;
- }
-
- /**
- * @return Returns the textEditor.
- */
- public ITextEditor getTextEditor() {
- return fTextEditor;
- }
-
- protected boolean hasMarkers() {
- IResource resource = getResource();
- IDocument document = getDocument();
- AbstractMarkerAnnotationModel model = getAnnotationModel();
-
- if (resource != null && model != null && resource.exists()) {
- try {
- IMarker[] allMarkers = resource.findMarkers(IBreakpoint.LINE_BREAKPOINT_MARKER, true, IResource.DEPTH_ZERO);
- if (allMarkers != null) {
- for (int i = 0; i < allMarkers.length; i++) {
- if (includesRulerLine(model.getMarkerPosition(allMarkers[i]), document)) {
- return true;
- }
- }
- }
- } catch (CoreException x) {
- //
- }
- }
- return false;
- }
-
- /**
- * Checks whether a position includes the ruler's line of activity.
- *
- * @param position
- * the position to be checked
- * @param document
- * the document the position refers to
- * @return <code>true</code> if the line is included by the given
- * position
- */
- protected boolean includesRulerLine(Position position, IDocument document) {
- if (position != null && fRulerInfo != null) {
- try {
- int markerLine = document.getLineOfOffset(position.getOffset());
- int line = getRulerInfo().getLineOfLastMouseButtonActivity();
- if (line == markerLine)
- return true;
- // commented because of "1GEUOZ9: ITPJUI:ALL - Confusing UI
- // for
- // multiline Bookmarks and Tasks"
- // return (markerLine <= line && line <=
- // document.getLineOfOffset(position.getOffset() +
- // position.getLength()));
- } catch (BadLocationException x) {
- //
- }
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/DebugTextEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/DebugTextEditor.java
deleted file mode 100644
index 21c9b84f68..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/DebugTextEditor.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.debug;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.filebuffers.FileBuffers;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPathEditorInput;
-import org.eclipse.ui.IStorageEditorInput;
-import org.eclipse.ui.editors.text.FileDocumentProvider;
-import org.eclipse.ui.editors.text.ILocationProvider;
-import org.eclipse.ui.editors.text.StorageDocumentProvider;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.texteditor.AbstractDocumentProvider;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.IElementStateListener;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.texteditor.MarkerRulerAction;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
-import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder;
-import org.eclipse.wst.sse.ui.internal.IExtendedContributor;
-import org.eclipse.wst.sse.ui.internal.IPopupMenuContributor;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.StructuredResourceMarkerAnnotationModel;
-import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
-import org.eclipse.wst.sse.ui.internal.extension.BreakpointProviderBuilder;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ConfigurationPointCalculator;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IExtendedStorageEditorInput;
-
-
-/**
- * @author nitin
- *
- * A text editor capable of using the IBreakpointProvider framework.
- *
- * This class is intended to be used by clients who wish to use the
- * IBreakpointProvider framework but not the StructuredTextEditor, e.g. VBS
- * source editors. It is provided AS-IS and marked internal as it is
- * unsupported and subject to change at any time.
- */
-public class DebugTextEditor extends TextEditor {
-
- private class ShowInTargetLister implements IShowInTargetList {
- public String[] getShowInTargetIds() {
- return fShowInTargetIds;
- }
- }
-
- /**
- * DocumentProvider for IStorageEditorInputs - supports
- * IExtendedStorageEditorInput notifications and assigning breakpoint
- * markers.
- */
- class StorageInputDocumentProvider extends StorageDocumentProvider implements IElementStateListener {
- protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
- IAnnotationModel model = null;
- IStorageEditorInput storageInput = (IStorageEditorInput) element;
- String ext = BreakpointRulerAction.getFileExtension(storageInput);
- IContentType[] types = getEditorInputContentTypes(storageInput);
- IResource res = null;
- for (int i = 0; res == null && i < types.length; i++) {
- res = BreakpointProviderBuilder.getInstance().getResource(storageInput, types[i].getId(), ext);
- }
- String id = storageInput.getName();
- if (storageInput.getStorage() != null) {
- IPath fullPath = storageInput.getStorage().getFullPath();
- if (fullPath != null)
- id = fullPath.toString();
- else
- id = storageInput.getName();
- }
- if (res != null)
- model = new StructuredResourceMarkerAnnotationModel(res, id);
- else
- model = new StructuredResourceMarkerAnnotationModel(ResourcesPlugin.getWorkspace().getRoot(), id);
-
- return model;
- }
-
- protected AbstractDocumentProvider.ElementInfo createElementInfo(Object element) throws CoreException {
- if (element instanceof IExtendedStorageEditorInput) {
- ((IExtendedStorageEditorInput) element).addElementStateListener(this);
- }
- return super.createElementInfo(element);
- }
-
- protected void disposeElementInfo(Object element, ElementInfo info) {
- if (element instanceof IExtendedStorageEditorInput) {
- ((IExtendedStorageEditorInput) element).removeElementStateListener(this);
- }
- super.disposeElementInfo(element, info);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.editors.text.StorageDocumentProvider#doSaveDocument(org.eclipse.core.runtime.IProgressMonitor,
- * java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
- */
- protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
- // untested
- new FileDocumentProvider().saveDocument(monitor, element, document, overwrite);
- }
-
- public void elementContentAboutToBeReplaced(Object element) {
- fireElementContentAboutToBeReplaced(element);
- }
-
- public void elementContentReplaced(Object element) {
- fireElementContentReplaced(element);
- }
-
- public void elementDeleted(Object element) {
- fireElementDeleted(element);
- }
-
- public void elementDirtyStateChanged(Object element, boolean isDirty) {
- fireElementDirtyStateChanged(element, isDirty);
- }
-
- public void elementMoved(Object originalElement, Object movedElement) {
- fireElementMoved(originalElement, movedElement);
- }
- }
-
- String[] fShowInTargetIds = new String[]{IPageLayout.ID_RES_NAV};
- private IShowInTargetList fShowInTargetListAdapter = new ShowInTargetLister();
-
- IDocumentProvider fStorageInputDocumentProvider = null;
-
- public DebugTextEditor() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.editors.text.TextEditor#createActions()
- */
- protected void createActions() {
- super.createActions();
-
- // StructuredTextEditor Action - toggle breakpoints
- IAction action = new ToggleBreakpointAction(this, getVerticalRuler()) {
- protected String getContentType(IDocument document) {
- ILocationProvider provider = (ILocationProvider) getEditorInput().getAdapter(ILocationProvider.class);
- if (provider != null) {
- IPath location = provider.getPath(getEditorInput());
- return detectContentType(location).getId();
- }
- else if (getEditorInput() instanceof IPathEditorInput) {
- IPath location = ((IPathEditorInput) getEditorInput()).getPath();
- return detectContentType(location).getId();
- }
- return IContentTypeManager.CT_TEXT;
- }
- };
- setAction(ActionDefinitionIds.TOGGLE_BREAKPOINTS, action);
- // StructuredTextEditor Action - manage breakpoints
- action = new ManageBreakpointAction(this, getVerticalRuler());
- setAction(ActionDefinitionIds.MANAGE_BREAKPOINTS, action);
- // StructuredTextEditor Action - edit breakpoints
- action = new EditBreakpointAction(this, getVerticalRuler());
- setAction(ActionDefinitionIds.EDIT_BREAKPOINTS, action);
- }
-
- /**
- * Loads the Show In Target IDs from the Extended Configuration extension
- * point.
- *
- * @return
- */
- protected String[] createShowInTargetIds() {
- List allIds = new ArrayList(0);
- ExtendedConfigurationBuilder builder = ExtendedConfigurationBuilder.getInstance();
- String[] configurationIds = getConfigurationPoints();
- for (int i = 0; i < configurationIds.length; i++) {
- String[] definitions = builder.getDefinitions("showintarget", configurationIds[i]); //$NON-NLS-1$
- for (int j = 0; j < definitions.length; j++) {
- String someIds = definitions[j];
- if (someIds != null && someIds.length() > 0) {
- String[] ids = StringUtils.unpack(someIds);
- for (int k = 0; k < ids.length; k++) {
- // trim, just to keep things clean
- String id = ids[k].trim();
- if (!allIds.contains(id)) {
- allIds.add(id);
- }
- }
- }
- }
- }
-
- if (!allIds.contains(IPageLayout.ID_RES_NAV)) {
- allIds.add(IPageLayout.ID_RES_NAV);
- }
- return (String[]) allIds.toArray(new String[0]);
- }
-
- IContentType detectContentType(IPath location) {
- IContentType type = null;
-
- IResource resource = FileBuffers.getWorkspaceFileAtLocation(location);
- if (resource != null) {
- if (resource.getType() == IResource.FILE && resource.isAccessible()) {
- IContentDescription d = null;
- try {
- // Optimized description lookup, might not succeed
- d = ((IFile) resource).getContentDescription();
- if (d != null) {
- type = d.getContentType();
- }
- }
- catch (CoreException e) {
- // Should not be possible given the accessible and file
- // type check above
- }
- if (type == null) {
- type = Platform.getContentTypeManager().findContentTypeFor(resource.getName());
- }
- }
- }
- else {
- File file = FileBuffers.getSystemFileAtLocation(location);
- if (file != null) {
- InputStream input = null;
- try {
- input = new FileInputStream(file);
- type = Platform.getContentTypeManager().findContentTypeFor(input, location.toOSString());
- }
- catch (FileNotFoundException e) {
- }
- catch (IOException e) {
- }
- finally {
- if (input != null) {
- try {
- input.close();
- }
- catch (IOException e1) {
- }
- }
- }
- if (type == null) {
- type = Platform.getContentTypeManager().findContentTypeFor(file.getName());
- }
- }
- }
- if (type == null) {
- type = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
- }
- return type;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
- */
- protected void editorContextMenuAboutToShow(IMenuManager menu) {
- super.editorContextMenuAboutToShow(menu);
-
- IEditorActionBarContributor c = getEditorSite().getActionBarContributor();
- if (c instanceof IPopupMenuContributor) {
- ((IPopupMenuContributor) c).contributeToPopupMenu(menu);
- }
- else {
- ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder();
- IExtendedContributor pmc = builder.readActionExtensions(getConfigurationPoints());
- if (pmc != null) {
- pmc.setActiveEditor(this);
- pmc.contributeToPopupMenu(menu);
- }
- }
- }
-
- /**
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class required) {
- // Navigate action set menu
- if (IShowInTargetList.class.equals(required))
- return fShowInTargetListAdapter;
- return super.getAdapter(required);
- }
-
-
- protected String[] getConfigurationPoints() {
- return ConfigurationPointCalculator.getConfigurationPoints(this, getInputContentType(getEditorInput()), ConfigurationPointCalculator.SOURCE, DebugTextEditor.class);
- }
-
- IContentType[] getEditorInputContentTypes(IEditorInput input) {
- IContentType[] types = null;
- IResource resource = null;
-
- if (input.getAdapter(IFile.class) != null) {
- resource = (IFile) input.getAdapter(IFile.class);
- }
- else if (input.getAdapter(IFile.class) != null) {
- resource = (IResource) input.getAdapter(IResource.class);
- }
- if (resource.getType() == IResource.FILE && resource.isAccessible()) {
- IContentDescription d = null;
- try {
- // optimized description lookup, might not succeed
- d = ((IFile) resource).getContentDescription();
- if (d != null) {
- types = new IContentType[]{d.getContentType()};
- }
- }
- catch (CoreException e) {
- // should not be possible given the accessible and file type
- // check above
- }
- }
- if (types == null) {
- types = Platform.getContentTypeManager().findContentTypesFor(input.getName());
- }
- return types;
- }
-
- /**
- * @param editorInput
- * @return
- */
- private String getInputContentType(IEditorInput editorInput) {
- IContentType[] types = getEditorInputContentTypes(editorInput);
- if (types != null) {
- return types[0].getId();
- }
- return null;
- }
-
- /**
- *
- * @return
- */
- private boolean isDebuggingAvailable() {
- boolean debuggingAvailable = false;
- IContentType[] types = getEditorInputContentTypes(getEditorInput());
- for (int i = 0; !debuggingAvailable && i < types.length; i++) {
- debuggingAvailable = debuggingAvailable || BreakpointProviderBuilder.getInstance().isAvailable(types[i].getId(), BreakpointRulerAction.getFileExtension(getEditorInput()));
- }
- return debuggingAvailable;
- }
-
- protected void rulerContextMenuAboutToShow(IMenuManager menu) {
- if (isDebuggingAvailable()) {
- menu.add(getAction(ActionDefinitionIds.TOGGLE_BREAKPOINTS));
- menu.add(getAction(ActionDefinitionIds.MANAGE_BREAKPOINTS));
- menu.add(getAction(ActionDefinitionIds.EDIT_BREAKPOINTS));
- menu.add(new Separator());
- }
- else {
- Logger.log(Logger.INFO, getClass().getName() + " could not enable debugging actions"); //$NON-NLS-1$
- }
- super.rulerContextMenuAboutToShow(menu);
- }
-
- /**
- * Ensure that the correct IDocumentProvider is used. For IFile and Files,
- * the default provider with a specified AnnotationModelFactory is used.
- * For StorageEditorInputs, use a custom provider that creates a usable
- * ResourceAnnotationModel
- *
- * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#setDocumentProvider(org.eclipse.ui.IEditorInput)
- */
- protected void setDocumentProvider(IEditorInput input) {
- if (input instanceof IStorageEditorInput && !(input instanceof IFileEditorInput)) {
- if (fStorageInputDocumentProvider == null) {
- fStorageInputDocumentProvider = new StorageInputDocumentProvider();
- }
- setDocumentProvider(fStorageInputDocumentProvider);
- }
- else {
- super.setDocumentProvider(input);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.AbstractTextEditor#updateContentDependentActions()
- */
- protected void updateContentDependentActions() {
- super.updateContentDependentActions();
- if (isDebuggingAvailable()) {
- setAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK, getAction(ActionDefinitionIds.TOGGLE_BREAKPOINTS));
- }
- else {
- // The Default Text Editor uses editorContribution to perform this
- // mapping, but since it relies on the IEditorSite ID, it can't be
- // relied on for MultiPageEditorParts. Instead, force the action
- // registration manually.
- setAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK, new MarkerRulerAction(SSEUIMessages.getResourceBundle(), "Editor.ManageBookmarks.", this, getVerticalRuler(), IMarker.BOOKMARK, true)); //$NON-NLS-1$
- }
- fShowInTargetIds = createShowInTargetIds();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/EditBreakpointAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/EditBreakpointAction.java
deleted file mode 100644
index 8ac44a1f10..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/EditBreakpointAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.debug;
-
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-public class EditBreakpointAction extends BreakpointRulerAction {
- protected IBreakpoint[] breakpoints = null;
-
- /**
- * @param editor
- * @param rulerInfo
- */
- public EditBreakpointAction(ITextEditor editor, IVerticalRuler rulerInfo) {
- super(editor, rulerInfo);
- setText(SSEUIMessages.EditBreakpointAction_0); //$NON-NLS-1$
- }
-
- public void run() {
- PropertyDialogAction action = new PropertyDialogAction(getTextEditor().getEditorSite(), new ISelectionProvider() {
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- // do nothing
- }
-
- public ISelection getSelection() {
- return new StructuredSelection(breakpoints);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- // do nothing
- }
-
- public void setSelection(ISelection selection) {
- // do nothing
- }
- });
- action.run();
- }
-
- public void update() {
- boolean enableThisAction = hasMarkers();
- setEnabled(enableThisAction);
- breakpoints = getBreakpoints(getMarkers());
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ManageBreakpointAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ManageBreakpointAction.java
deleted file mode 100644
index ddc7ac653f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ManageBreakpointAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.debug;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-/**
- * ManageBreakpointAction - Enables and Disables
- */
-public class ManageBreakpointAction extends BreakpointRulerAction {
-
- protected IBreakpoint[] breakpoints = null;
- private boolean doEnable = true;
-
- /**
- * @param editor
- * @param rulerInfo
- */
- public ManageBreakpointAction(ITextEditor editor, IVerticalRuler rulerInfo) {
- super(editor, rulerInfo);
- setEnabled(true);
- }
-
- /**
- *
- */
- protected void disableBreakpoints(IBreakpoint[] breakpoints) {
- for (int i = 0; i < breakpoints.length; i++) {
- try {
- breakpoints[i].setEnabled(false);
- } catch (CoreException e) {
- Logger.logException(e);
- }
- }
- }
-
- protected void enableBreakpoints(IBreakpoint[] breakpoints) {
- for (int i = 0; i < breakpoints.length; i++) {
- try {
- breakpoints[i].setEnabled(true);
- } catch (CoreException e) {
- Logger.logException(e);
- }
- }
- }
-
- public void run() {
- if (doEnable)
- enableBreakpoints(breakpoints);
- else
- disableBreakpoints(breakpoints);
- }
-
- public void update() {
- // doEnable means "enable" instead of "disable"
- doEnable = true;
- breakpoints = getBreakpoints(getMarkers());
- for (int i = 0; doEnable && i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- try {
- if (breakpoint.isEnabled()) {
- doEnable = false;
- }
- } catch (CoreException e) {
- Logger.logException("breakpoint not responding to isEnabled: " + breakpoint, e); //$NON-NLS-1$
- }
- }
- setEnabled(breakpoints != null && breakpoints.length > 0);
- if (doEnable)
- setText(SSEUIMessages.ManageBreakpointAction_0); //$NON-NLS-1$
- else
- setText(SSEUIMessages.ManageBreakpointAction_1); //$NON-NLS-1$
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ToggleBreakpointAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ToggleBreakpointAction.java
deleted file mode 100644
index 84937bf12d..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ToggleBreakpointAction.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.debug;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IVerticalRulerInfo;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.IDocumentProviderExtension4;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.util.Debug;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.extension.BreakpointProviderBuilder;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IBreakpointProvider;
-
-/**
- * ToggleBreakpointAction
- */
-public class ToggleBreakpointAction extends BreakpointRulerAction {
- IAction fFallbackAction;
-
- /**
- * @param editor
- * @param rulerInfo
- */
- public ToggleBreakpointAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
- super(editor, rulerInfo);
- setText(SSEUIMessages.ToggleBreakpointAction_0); //$NON-NLS-1$
- }
-
- public ToggleBreakpointAction(ITextEditor editor, IVerticalRulerInfo rulerInfo, IAction fallbackAction) {
- this(editor, rulerInfo);
- fFallbackAction = fallbackAction;
- }
-
- protected boolean createBreakpoints(int lineNumber) {
- /*
- * Note: we'll always allow processing to continue, even for a "read
- * only" IStorageEditorInput, for the ActiveScript debugger. But this
- * means sometimes the ActiveScript provider might get an input from
- * CVS or something that is not related to debugging.
- */
-
- ITextEditor editor = getTextEditor();
- IEditorInput input = editor.getEditorInput();
- IDocument document = editor.getDocumentProvider().getDocument(input);
- if (document == null)
- return false;
-
- String contentType = getContentType(document);
- IBreakpointProvider[] providers = BreakpointProviderBuilder.getInstance().getBreakpointProviders(editor, contentType, getFileExtension(input));
-
- int pos = -1;
- ISourceEditingTextTools tools = (ISourceEditingTextTools) editor.getAdapter(ISourceEditingTextTools.class);
- if (tools != null) {
- pos = tools.getCaretOffset();
- }
-
- final int n = providers.length;
- List errors = new ArrayList(0);
- for (int i = 0; i < n; i++) {
- try {
- if (Debug.debugBreakpoints)
- System.out.println(providers[i].getClass().getName() + " adding breakpoint to line " + lineNumber); //$NON-NLS-1$
- IStatus status = providers[i].addBreakpoint(document, input, lineNumber, pos);
- if (status != null && !status.isOK()) {
- errors.add(status);
- }
- }
- catch (CoreException e) {
- errors.add(e.getStatus());
- }
- catch (Exception t) {
- Logger.logException("exception while adding breakpoint", t); //$NON-NLS-1$
- }
- }
-
- if (errors.size() > 0) {
- Shell shell = editor.getSite().getShell();
- MultiStatus allStatus = new MultiStatus(SSEUIPlugin.ID, IStatus.INFO, (IStatus[]) errors.toArray(new IStatus[0]), SSEUIMessages.ManageBreakpoints_error_adding_message1, null); //$NON-NLS-1$
- /*
- * Show for conditions more severe than INFO or when no
- * breakpoints were created
- */
- if (allStatus.getSeverity() > IStatus.INFO || getBreakpoints(getMarkers()).length < 1) {
- ErrorDialog.openError(shell, SSEUIMessages.ManageBreakpoints_error_adding_title1, SSEUIMessages.ManageBreakpoints_error_adding_message1, allStatus); //$NON-NLS-1$ //$NON-NLS-2$
- return false;
- }
- }
- /*
- * Although no errors were reported, no breakpoints exist on this line
- * after having run the existing providers. Run the fallback action.
- */
- else if (fFallbackAction != null && !hasMarkers()) {
- if (fFallbackAction instanceof ISelectionListener) {
- ((ISelectionListener) fFallbackAction).selectionChanged(null, null);
- }
- fFallbackAction.run();
- }
- return true;
- }
-
- protected String getContentType(IDocument document) {
- IModelManager mgr = StructuredModelManager.getModelManager();
- String contentType = null;
-
- IDocumentProvider provider = fTextEditor.getDocumentProvider();
- if (provider instanceof IDocumentProviderExtension4) {
- try {
- IContentType type = ((IDocumentProviderExtension4) provider).getContentType(fTextEditor.getEditorInput());
- if (type != null)
- contentType = type.getId();
- }
- catch (CoreException e) {
- /*
- * A failure accessing the underlying store really isn't
- * interesting, although it can be a problem for
- * IStorageEditorInputs.
- */
- }
- }
-
- if (contentType == null) {
- IStructuredModel model = null;
- try {
- model = mgr.getExistingModelForRead(document);
- if (model != null) {
- contentType = model.getContentTypeIdentifier();
- }
- }
- finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- }
- return contentType;
- }
-
- protected void removeBreakpoints(int lineNumber) {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- IBreakpoint[] breakpoints = getBreakpoints(getMarkers());
- for (int i = 0; i < breakpoints.length; i++) {
- try {
- breakpoints[i].getMarker().delete();
- breakpointManager.removeBreakpoint(breakpoints[i], true);
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- }
- }
-
- public void run() {
- int lineNumber = fRulerInfo.getLineOfLastMouseButtonActivity() + 1;
- boolean doAdd = !hasMarkers();
- if (doAdd)
- createBreakpoints(lineNumber);
- else
- removeBreakpoints(lineNumber);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ToggleBreakpointsTarget.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ToggleBreakpointsTarget.java
deleted file mode 100644
index e0dd3124bd..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/debug/ToggleBreakpointsTarget.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.debug;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * @author nsd
- */
-public class ToggleBreakpointsTarget implements IToggleBreakpointsTarget {
- static final IToggleBreakpointsTarget instance = new ToggleBreakpointsTarget();
-
- public static IToggleBreakpointsTarget getInstance() {
- return instance;
- }
-
- /**
- *
- */
- private ToggleBreakpointsTarget() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart,
- * org.eclipse.jface.viewers.ISelection)
- */
- public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
- ITextEditor editor = (ITextEditor) part.getAdapter(ITextEditor.class);
- if (selection instanceof ITextSelection) {
- ITextSelection textSelection = (ITextSelection) selection;
- IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
- if (document != null && textSelection.getOffset() > -1) {
- int lineNumber = -1;
- try {
- lineNumber = document.getLineOfOffset(textSelection.getOffset());
- }
- catch (BadLocationException e) {
- }
- if (lineNumber >= 0) {
- ToggleBreakpointAction toggler = new ToggleBreakpointAction(editor, null);
- toggler.update();
- return toggler.isEnabled();
- }
- }
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart,
- * org.eclipse.jface.viewers.ISelection)
- */
- public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart,
- * org.eclipse.jface.viewers.ISelection)
- */
- public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
- return false;
- }
-
- private IBreakpoint[] getBreakpoints(IResource resource, IDocument document, AbstractMarkerAnnotationModel model, int lineNumber) {
- List markers = new ArrayList();
- if (resource != null && model != null && resource.exists()) {
- try {
- IMarker[] allMarkers = resource.findMarkers(IBreakpoint.LINE_BREAKPOINT_MARKER, true, IResource.DEPTH_ZERO);
- if (allMarkers != null) {
- for (int i = 0; i < allMarkers.length; i++) {
- Position p = model.getMarkerPosition(allMarkers[i]);
- int markerLine = -1;
- try {
- markerLine = document.getLineOfOffset(p.getOffset());
- }
- catch (BadLocationException e1) {
- }
- if (markerLine == lineNumber) {
- markers.add(allMarkers[i]);
- }
- }
- }
- }
- catch (CoreException x) {
- }
- }
- IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
- List breakpoints = new ArrayList(markers.size());
- for (int i = 0; i < markers.size(); i++) {
- IBreakpoint breakpoint = manager.getBreakpoint((IMarker) markers.get(i));
- if (breakpoint != null) {
- breakpoints.add(breakpoint);
- }
- }
- return (IBreakpoint[]) breakpoints.toArray(new IBreakpoint[0]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(org.eclipse.ui.IWorkbenchPart,
- * org.eclipse.jface.viewers.ISelection)
- */
- public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- ITextEditor editor = (ITextEditor) part.getAdapter(ITextEditor.class);
- if (selection instanceof ITextSelection) {
- ITextSelection textSelection = (ITextSelection) selection;
- IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
- int lineNumber = -1;
- try {
- lineNumber = document.getLineOfOffset(textSelection.getOffset());
- }
- catch (BadLocationException e) {
- }
- if (lineNumber >= 0) {
- ToggleBreakpointAction toggler = new ToggleBreakpointAction(editor, null);
- toggler.update();
- if (toggler.isEnabled()) {
- IResource resource = toggler.getResource();
- AbstractMarkerAnnotationModel model = toggler.getAnnotationModel();
- IBreakpoint[] breakpoints = getBreakpoints(resource, document, model, lineNumber);
- if (breakpoints.length > 0) {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- for (int i = 0; i < breakpoints.length; i++) {
- breakpoints[i].getMarker().delete();
- breakpointManager.removeBreakpoint(breakpoints[i], true);
- }
- }
- else {
- toggler.createBreakpoints(lineNumber + 1);
- }
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleMethodBreakpoints(org.eclipse.ui.IWorkbenchPart,
- * org.eclipse.jface.viewers.ISelection)
- */
- public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart,
- * org.eclipse.jface.viewers.ISelection)
- */
- public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTML2TextReader.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTML2TextReader.java
deleted file mode 100644
index 35a636672b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTML2TextReader.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-package org.eclipse.wst.sse.ui.internal.derived;
-
-import java.io.IOException;
-import java.io.PushbackReader;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-
-/*
- * Copied from org.eclipse.jdt.internal.ui.text.HTML2TextReader Modifications
- * were made to add br/ tag and fix warnings
- */
-/**
- * Reads the text contents from a reader of HTML contents and translates the
- * tags or cut them out.
- */
-public class HTML2TextReader extends SubstitutionTextReader {
-
- private static final String EMPTY_STRING= ""; //$NON-NLS-1$
- private static final Map fgEntityLookup;
- private static final Set fgTags;
-
- static {
-
- fgTags= new HashSet();
- fgTags.add("b"); //$NON-NLS-1$
- fgTags.add("br"); //$NON-NLS-1$
- fgTags.add("br/");//$NON-NLS-1$
- fgTags.add("h5"); //$NON-NLS-1$
- fgTags.add("p"); //$NON-NLS-1$
- fgTags.add("dl"); //$NON-NLS-1$
- fgTags.add("dt"); //$NON-NLS-1$
- fgTags.add("dd"); //$NON-NLS-1$
- fgTags.add("li"); //$NON-NLS-1$
- fgTags.add("ul"); //$NON-NLS-1$
- fgTags.add("pre"); //$NON-NLS-1$
-
- fgEntityLookup= new HashMap(7);
- fgEntityLookup.put("lt", "<"); //$NON-NLS-1$ //$NON-NLS-2$
- fgEntityLookup.put("gt", ">"); //$NON-NLS-1$ //$NON-NLS-2$
- fgEntityLookup.put("nbsp", " "); //$NON-NLS-1$ //$NON-NLS-2$
- fgEntityLookup.put("amp", "&"); //$NON-NLS-1$ //$NON-NLS-2$
- fgEntityLookup.put("circ", "^"); //$NON-NLS-1$ //$NON-NLS-2$
- fgEntityLookup.put("tilde", "~"); //$NON-NLS-2$ //$NON-NLS-1$
- fgEntityLookup.put("quot", "\""); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private int fCounter= 0;
- private TextPresentation fTextPresentation;
- private int fBold= 0;
- private int fStartOffset= -1;
- private boolean fInParagraph= false;
- private boolean fIsPreformattedText= false;
-
- /**
- * Transforms the html text from the reader to formatted text.
- * @param presentation If not <code>null</code>, formattings will be applied to
- * the presentation.
- */
- public HTML2TextReader(Reader reader, TextPresentation presentation) {
- super(new PushbackReader(reader));
- fTextPresentation= presentation;
- }
-
- public int read() throws IOException {
- int c= super.read();
- if (c != -1)
- ++ fCounter;
- return c;
- }
-
- protected void startBold() {
- if (fBold == 0)
- fStartOffset= fCounter;
- ++ fBold;
- }
-
- protected void startPreformattedText() {
- fIsPreformattedText= true;
- setSkipWhitespace(false);
- }
-
- protected void stopPreformattedText() {
- fIsPreformattedText= false;
- setSkipWhitespace(true);
- }
-
- protected void stopBold() {
- -- fBold;
- if (fBold == 0) {
- if (fTextPresentation != null) {
- fTextPresentation.addStyleRange(new StyleRange(fStartOffset, fCounter - fStartOffset, null, null, SWT.BOLD));
- }
- fStartOffset= -1;
- }
- }
-
- /*
- * @see org.eclipse.jdt.internal.ui.text.SubstitutionTextReader#computeSubstitution(int)
- */
- protected String computeSubstitution(int c) throws IOException {
-
- if (c == '<')
- return processHTMLTag();
- else if (c == '&')
- return processEntity();
- else if (fIsPreformattedText)
- return processPreformattedText(c);
-
- return null;
- }
-
- private String html2Text(String html) {
-
- if (html == null || html.length() == 0)
- return EMPTY_STRING;
-
- String tag= html;
- if ('/' == tag.charAt(0))
- tag= tag.substring(1);
-
- if (!fgTags.contains(tag))
- return EMPTY_STRING;
-
-
- if ("pre".equals(html)) { //$NON-NLS-1$
- startPreformattedText();
- return EMPTY_STRING;
- }
-
- if ("/pre".equals(html)) { //$NON-NLS-1$
- stopPreformattedText();
- return EMPTY_STRING;
- }
-
- if (fIsPreformattedText)
- return EMPTY_STRING;
-
- if ("b".equals(html)) { //$NON-NLS-1$
- startBold();
- return EMPTY_STRING;
- }
-
- if ("h5".equals(html) || "dt".equals(html)) { //$NON-NLS-1$ //$NON-NLS-2$
- startBold();
- return EMPTY_STRING;
- }
-
- if ("dl".equals(html)) //$NON-NLS-1$
- return LINE_DELIM;
-
- if ("dd".equals(html)) //$NON-NLS-1$
- return "\t"; //$NON-NLS-1$
-
- if ("li".equals(html)) //$NON-NLS-1$
- return LINE_DELIM + "\t" + "- "; //$NON-NLS-1$ //$NON-NLS-2$
-
- if ("/b".equals(html)) { //$NON-NLS-1$
- stopBold();
- return EMPTY_STRING;
- }
-
- if ("p".equals(html)) { //$NON-NLS-1$
- fInParagraph= true;
- return LINE_DELIM;
- }
-
- if ("br".equals(html) || "br/".equals(html)) //$NON-NLS-1$ //$NON-NLS-2$
- return LINE_DELIM;
-
- if ("/p".equals(html)) { //$NON-NLS-1$
- boolean inParagraph= fInParagraph;
- fInParagraph= false;
- return inParagraph ? EMPTY_STRING : LINE_DELIM;
- }
-
- if ("/h5".equals(html) || "/dt".equals(html)) { //$NON-NLS-1$ //$NON-NLS-2$
- stopBold();
- return LINE_DELIM;
- }
-
- if ("/dd".equals(html)) //$NON-NLS-1$
- return LINE_DELIM;
-
- return EMPTY_STRING;
- }
-
- /*
- * A '<' has been read. Process a html tag
- */
- private String processHTMLTag() throws IOException {
-
- StringBuffer buf= new StringBuffer();
- int ch;
- do {
-
- ch= nextChar();
-
- while (ch != -1 && ch != '>') {
- buf.append(Character.toLowerCase((char) ch));
- ch= nextChar();
- if (ch == '"'){
- buf.append(Character.toLowerCase((char) ch));
- ch= nextChar();
- while (ch != -1 && ch != '"'){
- buf.append(Character.toLowerCase((char) ch));
- ch= nextChar();
- }
- }
- if (ch == '<'){
- unread(ch);
- return '<' + buf.toString();
- }
- }
-
- if (ch == -1)
- return null;
-
- int tagLen= buf.length();
- // needs special treatment for comments
- if ((tagLen >= 3 && "!--".equals(buf.substring(0, 3))) //$NON-NLS-1$
- && !(tagLen >= 5 && "--".equals(buf.substring(tagLen - 2)))) { //$NON-NLS-1$
- // unfinished comment
- buf.append(ch);
- } else {
- break;
- }
- } while (true);
-
- return html2Text(buf.toString());
- }
-
- private String processPreformattedText(int c) {
- if (c == '\r' || c == '\n')
- fCounter++;
- return null;
- }
-
-
- private void unread(int ch) throws IOException {
- ((PushbackReader) getReader()).unread(ch);
- }
-
- protected String entity2Text(String symbol) {
- if (symbol.length() > 1 && symbol.charAt(0) == '#') {
- int ch;
- try {
- if (symbol.charAt(1) == 'x') {
- ch= Integer.parseInt(symbol.substring(2), 16);
- } else {
- ch= Integer.parseInt(symbol.substring(1), 10);
- }
- return EMPTY_STRING + (char)ch;
- } catch (NumberFormatException e) {
- // log problem?
- }
- } else {
- String str= (String) fgEntityLookup.get(symbol);
- if (str != null) {
- return str;
- }
- }
- return "&" + symbol; // not found //$NON-NLS-1$
- }
-
- /*
- * A '&' has been read. Process a entity
- */
- private String processEntity() throws IOException {
- StringBuffer buf= new StringBuffer();
- int ch= nextChar();
- while (Character.isLetterOrDigit((char)ch) || ch == '#') {
- buf.append((char) ch);
- ch= nextChar();
- }
-
- if (ch == ';')
- return entity2Text(buf.toString());
-
- buf.insert(0, '&');
- if (ch != -1)
- buf.append((char) ch);
- return buf.toString();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTMLTextPresenter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTMLTextPresenter.java
deleted file mode 100644
index 477435277c..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/HTMLTextPresenter.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.derived;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Iterator;
-
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextPresentation;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-/*
- * Copied from org.eclipse.jdt.internal.ui.text.HTMLTextPresenter
- * Modifications were made to use own Logger to log exception, and the
- * ellipses constant
- */
-public class HTMLTextPresenter implements DefaultInformationControl.IInformationPresenter {
- private static final String ELLIPSES = "..."; //$NON-NLS-1$
- private static final String LINE_DELIM = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
-
- private int fCounter;
- private boolean fEnforceUpperLineLimit;
-
- public HTMLTextPresenter(boolean enforceUpperLineLimit) {
- super();
- fEnforceUpperLineLimit = enforceUpperLineLimit;
- }
-
- public HTMLTextPresenter() {
- this(true);
- }
-
- protected Reader createReader(String hoverInfo, TextPresentation presentation) {
- return new HTML2TextReader(new StringReader(hoverInfo), presentation);
- }
-
- protected void adaptTextPresentation(TextPresentation presentation, int offset, int insertLength) {
-
- int yoursStart = offset;
- int yoursEnd = offset + insertLength - 1;
- yoursEnd = Math.max(yoursStart, yoursEnd);
-
- Iterator e = presentation.getAllStyleRangeIterator();
- while (e.hasNext()) {
-
- StyleRange range = (StyleRange) e.next();
-
- int myStart = range.start;
- int myEnd = range.start + range.length - 1;
- myEnd = Math.max(myStart, myEnd);
-
- if (myEnd < yoursStart)
- continue;
-
- if (myStart < yoursStart)
- range.length += insertLength;
- else
- range.start += insertLength;
- }
- }
-
- private void append(StringBuffer buffer, String string, TextPresentation presentation) {
-
- int length = string.length();
- buffer.append(string);
-
- if (presentation != null)
- adaptTextPresentation(presentation, fCounter, length);
-
- fCounter += length;
- }
-
- private String getIndent(String line) {
- int length = line.length();
-
- int i = 0;
- while (i < length && Character.isWhitespace(line.charAt(i)))
- ++i;
-
- return (i == length ? line : line.substring(0, i)) + " "; //$NON-NLS-1$
- }
-
- /*
- * @see IHoverInformationPresenter#updatePresentation(Display display,
- * String, TextPresentation, int, int)
- */
- public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight) {
-
- if (hoverInfo == null)
- return null;
-
- GC gc = new GC(display);
- try {
-
- StringBuffer buffer = new StringBuffer();
- int maxNumberOfLines = Math.round(maxHeight / gc.getFontMetrics().getHeight());
-
- fCounter = 0;
- LineBreakingReader reader = new LineBreakingReader(createReader(hoverInfo, presentation), gc, maxWidth);
-
- boolean lastLineFormatted = false;
- String lastLineIndent = null;
-
- String line = reader.readLine();
- boolean lineFormatted = reader.isFormattedLine();
- boolean firstLineProcessed = false;
-
- while (line != null) {
-
- if (fEnforceUpperLineLimit && maxNumberOfLines <= 0)
- break;
-
- if (firstLineProcessed) {
- if (!lastLineFormatted)
- append(buffer, LINE_DELIM, null);
- else {
- append(buffer, LINE_DELIM, presentation);
- if (lastLineIndent != null)
- append(buffer, lastLineIndent, presentation);
- }
- }
-
- append(buffer, line, null);
- firstLineProcessed = true;
-
- lastLineFormatted = lineFormatted;
- if (!lineFormatted)
- lastLineIndent = null;
- else if (lastLineIndent == null)
- lastLineIndent = getIndent(line);
-
- line = reader.readLine();
- lineFormatted = reader.isFormattedLine();
-
- maxNumberOfLines--;
- }
-
- if (line != null && buffer.length() > 0) {
- append(buffer, LINE_DELIM, lineFormatted ? presentation : null);
- append(buffer, ELLIPSES, presentation);
- }
-
- return trim(buffer, presentation);
-
- } catch (IOException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- return null;
-
- } finally {
- gc.dispose();
- }
- }
-
- private String trim(StringBuffer buffer, TextPresentation presentation) {
-
- int length = buffer.length();
-
- int end = length - 1;
- while (end >= 0 && Character.isWhitespace(buffer.charAt(end)))
- --end;
-
- if (end == -1)
- return ""; //$NON-NLS-1$
-
- if (end < length - 1)
- buffer.delete(end + 1, length);
- else
- end = length;
-
- int start = 0;
- while (start < end && Character.isWhitespace(buffer.charAt(start)))
- ++start;
-
- buffer.delete(0, start);
- presentation.setResultWindow(new Region(start, buffer.length()));
- return buffer.toString();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/LineBreakingReader.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/LineBreakingReader.java
deleted file mode 100644
index 86f7f685f9..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/LineBreakingReader.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.derived;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import com.ibm.icu.text.BreakIterator;
-
-import org.eclipse.swt.graphics.GC;
-
-/**
- * Copied from org.eclipse.jdt.internal.ui.text.LineBreakingReader.
- * Modifications were made to fix warnings.
- */
-/*
- * Not a real reader. Could change if requested
- */
-public class LineBreakingReader {
- private GC fGC;
-
- private String fLine;
-
- private BreakIterator fLineBreakIterator;
- private int fMaxWidth;
- private int fOffset;
-
-
- private BufferedReader fReader;
-
- /**
- * Creates a reader that breaks an input text to fit in a given width.
- *
- * @param reader
- * Reader of the input text
- * @param gc
- * The graphic context that defines the currently used font
- * sizes
- * @param maxLineWidth
- * The max width (pixes) where the text has to fit in
- */
- public LineBreakingReader(Reader reader, GC gc, int maxLineWidth) {
- fReader = new BufferedReader(reader);
- fGC = gc;
- fMaxWidth = maxLineWidth;
- fOffset = 0;
- fLine = null;
- fLineBreakIterator = BreakIterator.getLineInstance();
- }
-
- private int findNextBreakOffset(int currOffset) {
- int currWidth = 0;
- int nextOffset = fLineBreakIterator.following(currOffset);
- while (nextOffset != BreakIterator.DONE) {
- String word = fLine.substring(currOffset, nextOffset);
- int wordWidth = fGC.textExtent(word).x;
- int nextWidth = wordWidth + currWidth;
- if (nextWidth > fMaxWidth) {
- if (currWidth > 0) {
- return currOffset;
- }
- return nextOffset;
- }
- currWidth = nextWidth;
- currOffset = nextOffset;
- nextOffset = fLineBreakIterator.next();
- }
- return nextOffset;
- }
-
- private int findWordBegin(int idx) {
- while (idx < fLine.length() && Character.isWhitespace(fLine.charAt(idx))) {
- idx++;
- }
- return idx;
- }
-
- public boolean isFormattedLine() {
- return fLine != null;
- }
-
- /**
- * Reads the next line. The lengths of the line will not exceed the gived
- * maximum width.
- */
- public String readLine() throws IOException {
- if (fLine == null) {
- String line = fReader.readLine();
- if (line == null)
- return null;
-
- int lineLen = fGC.textExtent(line).x;
- if (lineLen < fMaxWidth) {
- return line;
- }
- fLine = line;
- fLineBreakIterator.setText(line);
- fOffset = 0;
- }
- int breakOffset = findNextBreakOffset(fOffset);
- String res;
- if (breakOffset != BreakIterator.DONE) {
- res = fLine.substring(fOffset, breakOffset);
- fOffset = findWordBegin(breakOffset);
- if (fOffset == fLine.length()) {
- fLine = null;
- }
- } else {
- res = fLine.substring(fOffset);
- fLine = null;
- }
- return res;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/SingleCharReader.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/SingleCharReader.java
deleted file mode 100644
index a097d82329..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/SingleCharReader.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.derived;
-
-import java.io.IOException;
-import java.io.Reader;
-
-/*
- * Copied from org.eclipse.jdt.internal.corext.javadoc.SingleCharReader.
- * Modification was made to fix statement unnecessarily nested within else
- * clause warning in read(..).
- */
-public abstract class SingleCharReader extends Reader {
-
- /**
- * @see Reader#read()
- */
- public abstract int read() throws IOException;
-
- /**
- * @see Reader#read(char[],int,int)
- */
- public int read(char cbuf[], int off, int len) throws IOException {
- int end = off + len;
- for (int i = off; i < end; i++) {
- int ch = read();
- if (ch == -1) {
- if (i == off) {
- return -1;
- }
- return i - off;
- }
- cbuf[i] = (char) ch;
- }
- return len;
- }
-
- /**
- * @see Reader#ready()
- */
- public boolean ready() throws IOException {
- return true;
- }
-
- /**
- * Gets the content as a String
- */
- public String getString() throws IOException {
- StringBuffer buf = new StringBuffer();
- int ch;
- while ((ch = read()) != -1) {
- buf.append((char) ch);
- }
- return buf.toString();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/SubstitutionTextReader.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/SubstitutionTextReader.java
deleted file mode 100644
index 2fd9b68f81..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/derived/SubstitutionTextReader.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.derived;
-
-import java.io.IOException;
-import java.io.Reader;
-
-/*
- * Copied from org.eclipse.jdt.internal.ui.text.SubstitutionTextReader.
- * Modifications were made to read() to allow whitespaces and fixed statement
- * unnecessarily nested within else clause warning in nextChar()
- */
-/**
- * Reads the text contents from a reader and computes for each character a
- * potential substitution. The substitution may eat more characters than only
- * the one passed into the computation routine.
- */
-public abstract class SubstitutionTextReader extends SingleCharReader {
-
- protected static final String LINE_DELIM = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
-
- private Reader fReader;
- protected boolean fWasWhiteSpace;
- private int fCharAfterWhiteSpace;
-
- /**
- * Tells whether white space characters are skipped.
- */
- private boolean fSkipWhiteSpace = true;
-
- private boolean fReadFromBuffer;
- private StringBuffer fBuffer;
- private int fIndex;
-
-
- protected SubstitutionTextReader(Reader reader) {
- fReader = reader;
- fBuffer = new StringBuffer();
- fIndex = 0;
- fReadFromBuffer = false;
- fCharAfterWhiteSpace = -1;
- fWasWhiteSpace = true;
- }
-
- /**
- * Implement to compute the substitution for the given character and if
- * necessary subsequent characters. Use <code>nextChar</code> to read
- * subsequent characters.
- */
- protected abstract String computeSubstitution(int c) throws IOException;
-
- /**
- * Returns the internal reader.
- */
- protected Reader getReader() {
- return fReader;
- }
-
- /**
- * Returns the next character.
- */
- protected int nextChar() throws IOException {
- fReadFromBuffer = (fBuffer.length() > 0);
- if (fReadFromBuffer) {
- char ch = fBuffer.charAt(fIndex++);
- if (fIndex >= fBuffer.length()) {
- fBuffer.setLength(0);
- fIndex = 0;
- }
- return ch;
- }
- int ch = fCharAfterWhiteSpace;
- if (ch == -1) {
- ch = fReader.read();
- }
- if (fSkipWhiteSpace && Character.isWhitespace((char) ch)) {
- do {
- ch = fReader.read();
- } while (Character.isWhitespace((char) ch));
- if (ch != -1) {
- fCharAfterWhiteSpace = ch;
- return ' ';
- }
- } else {
- fCharAfterWhiteSpace = -1;
- }
- return ch;
- }
-
- /**
- * @see Reader#read()
- */
- public int read() throws IOException {
- int c;
- do {
-
- c = nextChar();
- while (!fReadFromBuffer) {
- String s = computeSubstitution(c);
- if (s == null)
- break;
- if (s.length() > 0)
- fBuffer.insert(0, s);
- c = nextChar();
- }
-
- } while (fSkipWhiteSpace && fWasWhiteSpace && ((c == ' ') && !fReadFromBuffer));
- /*
- * SSE: For above and below check, if whitespace is read from buffer,
- * do not skip
- */
- fWasWhiteSpace = ((c == ' ' && !fReadFromBuffer) || c == '\r' || c == '\n');
- return c;
- }
-
- /**
- * @see Reader#ready()
- */
- public boolean ready() throws IOException {
- return fReader.ready();
- }
-
- /**
- * @see Reader#close()
- */
- public void close() throws IOException {
- fReader.close();
- }
-
- /**
- * @see Reader#reset()
- */
- public void reset() throws IOException {
- fReader.reset();
- fWasWhiteSpace = true;
- fCharAfterWhiteSpace = -1;
- fBuffer.setLength(0);
- fIndex = 0;
- }
-
- protected final void setSkipWhitespace(boolean state) {
- fSkipWhiteSpace = state;
- }
-
- protected final boolean isSkippingWhitespace() {
- return fSkipWhiteSpace;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/edit/util/SharedEditorPluginImageHelper.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/edit/util/SharedEditorPluginImageHelper.java
deleted file mode 100644
index 2111583580..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/edit/util/SharedEditorPluginImageHelper.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.edit.util;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImageHelper;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImages;
-
-
-public class SharedEditorPluginImageHelper {
- public static final String IMG_DLCL_COLLAPSEALL = EditorPluginImages.IMG_DLCL_COLLAPSEALL;
- public static final String IMG_DLCL_DELETE = EditorPluginImages.IMG_DLCL_DELETE;
- public static final String IMG_DLCL_SYNCED = EditorPluginImages.IMG_DLCL_SYNCED;
- public static final String IMG_ELCL_COLLAPSEALL = EditorPluginImages.IMG_ELCL_COLLAPSEALL;
- public static final String IMG_ELCL_DELETE = EditorPluginImages.IMG_ELCL_DELETE;
- public static final String IMG_ELCL_SYNCED = EditorPluginImages.IMG_ELCL_SYNCED;
-
- /**
- * Retrieves the specified image from the source editor plugin's image
- * registry. Note: The returned <code>Image</code> is managed by the
- * workbench; clients must <b>not </b> dispose of the returned image.
- *
- * @param symbolicName
- * the symbolic name of the image; there are constants declared
- * in this class for build-in images that come with the source
- * editor
- * @return the image, or <code>null</code> if not found
- */
- public static Image getImage(String symbolicName) {
- return EditorPluginImageHelper.getInstance().getImage(symbolicName);
- }
-
- /**
- * Retrieves the image descriptor for specified image from the source
- * editor plugin's image registry. Unlike <code>Image</code>s, image
- * descriptors themselves do not need to be disposed.
- *
- * @param symbolicName
- * the symbolic name of the image; there are constants declared
- * in this interface for build-in images that come with the
- * source editor
- * @return the image descriptor, or <code>null</code> if not found
- */
- public static ImageDescriptor getImageDescriptor(String symbolicName) {
- return EditorPluginImageHelper.getInstance().getImageDescriptor(symbolicName);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorModelUtil.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorModelUtil.java
deleted file mode 100644
index 04dca68346..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorModelUtil.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.editor;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.wst.sse.core.internal.model.FactoryRegistry;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.provisional.registry.AdapterFactoryProvider;
-import org.eclipse.wst.sse.ui.internal.provisional.registry.AdapterFactoryRegistry;
-import org.eclipse.wst.sse.ui.internal.provisional.registry.AdapterFactoryRegistryExtension;
-import org.eclipse.wst.sse.ui.internal.util.Assert;
-
-
-/**
- * INTERNAL USAGE ONLY
- *
- * @author nsd
- */
-public class EditorModelUtil {
-
- public static void addFactoriesTo(final IStructuredModel structuredModel) {
- if (structuredModel == null)
- return;
-
- AdapterFactoryRegistry adapterRegistry = SSEUIPlugin.getDefault().getAdapterFactoryRegistry();
- String contentTypeId = structuredModel.getContentTypeIdentifier();
-
- Iterator adapterFactoryProviders = null;
- if (adapterRegistry instanceof AdapterFactoryRegistryExtension) {
- adapterFactoryProviders = ((AdapterFactoryRegistryExtension) adapterRegistry).getAdapterFactories(contentTypeId);
- }
- else {
- adapterFactoryProviders = adapterRegistry.getAdapterFactories();
- }
-
- FactoryRegistry factoryRegistry = structuredModel.getFactoryRegistry();
- Assert.isNotNull(factoryRegistry, SSEUIMessages.EditorModelUtil_0); //$NON-NLS-1$
- // Add all those appropriate for this particular type of content
- while (adapterFactoryProviders.hasNext()) {
- try {
- final AdapterFactoryProvider provider = (AdapterFactoryProvider) adapterFactoryProviders.next();
- /*
- * ContentType might have already been checked above, this
- * check is here for backwards compatability for those that
- * don't specify a content type
- */
- if (provider.isFor(structuredModel.getModelHandler())) {
- SafeRunner.run(new SafeRunnable(SSEUIMessages.EditorModelUtil_1) { //$NON-NLS-1$
- public void run() {
- provider.addAdapterFactories(structuredModel);
- }
- });
- }
- }
- catch (Exception e) {
- Logger.logException(e);
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorPluginImageHelper.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorPluginImageHelper.java
deleted file mode 100644
index f78633f744..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorPluginImageHelper.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.editor;
-
-import java.util.HashMap;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-
-
-/**
- * Helper class to handle images provided by this plug-in.
- *
- * NOTE: For internal use only. For images used externally, please use the
- * Shared***ImageHelper class instead.
- *
- * @author amywu
- */
-public class EditorPluginImageHelper {
- private static EditorPluginImageHelper instance = null;
-
- /**
- * Gets the instance.
- *
- * @return Returns a EditorPluginImageHelper
- */
- public synchronized static EditorPluginImageHelper getInstance() {
- if (instance == null)
- instance = new EditorPluginImageHelper();
- return instance;
- }
-
- // save a descriptor for each image
- private HashMap fImageDescRegistry = null;
- private final String PLUGINID = SSEUIPlugin.ID;
-
- /**
- * Creates an image from the given resource and adds the image to the
- * image registry.
- *
- * @param resource
- * @return Image
- */
- private Image createImage(String resource) {
- ImageDescriptor desc = getImageDescriptor(resource);
- Image image = null;
-
- if (desc != null) {
- image = desc.createImage();
- // dont add the missing image descriptor image to the image
- // registry
- if (!desc.equals(ImageDescriptor.getMissingImageDescriptor()))
- getImageRegistry().put(resource, image);
- }
- return image;
- }
-
- /**
- * Creates an image descriptor from the given imageFilePath and adds the
- * image descriptor to the image descriptor registry. If an image
- * descriptor could not be created, the default "missing" image descriptor
- * is returned but not added to the image descriptor registry.
- *
- * @param imageFilePath
- * @return ImageDescriptor image descriptor for imageFilePath or default
- * "missing" image descriptor if resource could not be found
- */
- private ImageDescriptor createImageDescriptor(String imageFilePath) {
- ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGINID, imageFilePath);
- if (imageDescriptor != null) {
- getImageDescriptorRegistry().put(imageFilePath, imageDescriptor);
- } else {
- imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
- }
-
- return imageDescriptor;
- }
-
- /**
- * Retrieves the image associated with resource from the image registry.
- * If the image cannot be retrieved, attempt to find and load the image at
- * the location specified in resource.
- *
- * @param resource
- * the image to retrieve
- * @return Image the image associated with resource or null if one could
- * not be found
- */
- public Image getImage(String resource) {
- Image image = getImageRegistry().get(resource);
- if (image == null) {
- // create an image
- image = createImage(resource);
- }
- return image;
- }
-
- /**
- * Retrieves the image descriptor associated with resource from the image
- * descriptor registry. If the image descriptor cannot be retrieved,
- * attempt to find and load the image descriptor at the location specified
- * in resource.
- *
- * @param resource
- * the image descriptor to retrieve
- * @return ImageDescriptor the image descriptor assocated with resource or
- * the default "missing" image descriptor if one could not be
- * found
- */
- public ImageDescriptor getImageDescriptor(String resource) {
- ImageDescriptor imageDescriptor = null;
- Object o = getImageDescriptorRegistry().get(resource);
- if (o == null) {
- //create a descriptor
- imageDescriptor = createImageDescriptor(resource);
- } else {
- imageDescriptor = (ImageDescriptor) o;
- }
- return imageDescriptor;
- }
-
- /**
- * Returns the image descriptor registry for this plugin.
- *
- * @return HashMap - image descriptor registry for this plugin
- */
- private HashMap getImageDescriptorRegistry() {
- if (fImageDescRegistry == null)
- fImageDescRegistry = new HashMap();
- return fImageDescRegistry;
- }
-
- /**
- * Returns the image registry for this plugin.
- *
- * @return ImageRegistry - image registry for this plugin
- */
- private ImageRegistry getImageRegistry() {
- return JFaceResources.getImageRegistry();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorPluginImages.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorPluginImages.java
deleted file mode 100644
index 7b388440f2..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/EditorPluginImages.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.editor;
-
-/**
- * Bundle of most images used by the Source Editor plug-in.
- */
-public class EditorPluginImages {
-
- public static final String IMG_CTOOL16_SPELLCHECK = "icons/full/ctool16/spellcheck.gif"; //$NON-NLS-1$
- public static final String IMG_DLCL_COLLAPSEALL = "icons/full/dlcl16/collapseall.gif"; //$NON-NLS-1$
- public static final String IMG_DLCL_DELETE = "icons/full/dlcl16/delete.gif"; //$NON-NLS-1$
- public static final String IMG_DLCL_SYNCED = "icons/full/dlcl16/synced.gif"; //$NON-NLS-1$
- public static final String IMG_DTOOL16_SPELLCHECK = "icons/full/dtool16/spellcheck.gif"; //$NON-NLS-1$
- public static final String IMG_ELCL_COLLAPSEALL = "icons/full/elcl16/collapseall.gif"; //$NON-NLS-1$
- public static final String IMG_ELCL_DELETE = "icons/full/elcl16/delete.gif"; //$NON-NLS-1$
- public static final String IMG_ELCL_SYNCED = "icons/full/elcl16/synced.gif"; //$NON-NLS-1$
- public static final String IMG_ETOOL16_SPELLCHECK = "icons/full/etool16/spellcheck.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_OCC_MATCH = "icons/full/obj16/occ_match.gif"; //$NON-NLS-1$
-
- public static final String IMG_OBJ_PREFERENCES = "icons/full/obj16/preferences.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_PROP_PS = "icons/full/obj16/prop_ps.gif"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/IHelpContextIds.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/IHelpContextIds.java
deleted file mode 100644
index 37a2dbddef..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/IHelpContextIds.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.editor;
-
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-
-/**
- * Help context ids for the Source Editor.
- * <p>
- * This interface contains constants only; it is not intended to be
- * implemented.
- * </p>
- *
- */
-public interface IHelpContextIds {
-
- // org.eclipse.wst.sse.ui.
- public static final String PREFIX = SSEUIPlugin.ID + "."; //$NON-NLS-1$
- // Abstract Source Editor Context Menu
- // Content Assist
- public static final String CONTMNU_CONTENTASSIST_HELPID = PREFIX + "xmlm1010"; //$NON-NLS-1$
- // Format Document
- public static final String CONTMNU_FORMAT_DOC_HELPID = PREFIX + "xmlm1030"; //$NON-NLS-1$
- // Format Active Elements
- public static final String CONTMNU_FORMAT_ELEMENTS_HELPID = PREFIX + "xmlm1040"; //$NON-NLS-1$
- // Cleanup Document
- // public static final String CONTMNU_CLEANUP_DOC_HELPID = PREFIX +
- // "xmlm1050"; //$NON-NLS-1$
-
- // Properties
- public static final String CONTMNU_PROPERTIES_HELPID = PREFIX + "xmlm1070"; //$NON-NLS-1$
-
- // Structured Text Editor Preference Page
- // Appearance
- public static final String PREFSTE_APPEARANCE_HELPID = PREFIX + "sted0001"; //$NON-NLS-1$
- // Hovers
- public static final String PREFSTE_HOVERS_HELPID = PREFIX + "sted0003"; //$NON-NLS-1$
-
-// // Read-Only Text Style
-// public static final String PREFWEBX_READONLY_HELPID = PREFIX + "webx0001"; //$NON-NLS-1$
-
- // Web and XML Preference Page
- // Task Tags
- public static final String PREFWEBX_TASKTAGS_HELPID = PREFIX + "webx0000"; //$NON-NLS-1$
-
- // Source Editor View
- public static final String XML_SOURCE_VIEW_HELPID = PREFIX + "xmlm2000"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/StructuredModelDocumentProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/StructuredModelDocumentProvider.java
deleted file mode 100644
index 32ffbcd43a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/editor/StructuredModelDocumentProvider.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.editor;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.IDocumentProviderExtension;
-import org.eclipse.ui.texteditor.IDocumentProviderExtension4;
-import org.eclipse.ui.texteditor.IElementStateListener;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-
-
-/**
- * @author nitin
- */
-public class StructuredModelDocumentProvider implements IDocumentProvider, IDocumentProviderExtension, IDocumentProviderExtension4 {
- private static StructuredModelDocumentProvider _instance = null;
-
- /**
- * @return Returns the instance.
- */
- public static StructuredModelDocumentProvider getInstance() {
- return _instance;
- }
-
- {
- _instance = new StructuredModelDocumentProvider();
- }
-
- private StructuredModelDocumentProvider() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#aboutToChange(java.lang.Object)
- */
- public void aboutToChange(Object element) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#addElementStateListener(org.eclipse.ui.texteditor.IElementStateListener)
- */
- public void addElementStateListener(IElementStateListener listener) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#canSaveDocument(java.lang.Object)
- */
- public boolean canSaveDocument(Object element) {
- return ((IStructuredModel) element).isDirty();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#changed(java.lang.Object)
- */
- public void changed(Object element) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#connect(java.lang.Object)
- */
- public void connect(Object element) throws CoreException {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#disconnect(java.lang.Object)
- */
- public void disconnect(Object element) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#getAnnotationModel(java.lang.Object)
- */
- public IAnnotationModel getAnnotationModel(Object element) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#getDocument(java.lang.Object)
- */
- public IDocument getDocument(Object element) {
- return ((IStructuredModel) element).getStructuredDocument();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#getModificationStamp(java.lang.Object)
- */
- public long getModificationStamp(Object element) {
- return ((IStructuredModel) element).getSynchronizationStamp();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#getStatus(java.lang.Object)
- */
- public IStatus getStatus(Object element) {
- return Status.OK_STATUS;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#getSynchronizationStamp(java.lang.Object)
- */
- public long getSynchronizationStamp(Object element) {
- return 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#isDeleted(java.lang.Object)
- */
- public boolean isDeleted(Object element) {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#isModifiable(java.lang.Object)
- */
- public boolean isModifiable(Object element) {
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#isReadOnly(java.lang.Object)
- */
- public boolean isReadOnly(Object element) {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#isStateValidated(java.lang.Object)
- */
- public boolean isStateValidated(Object element) {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#mustSaveDocument(java.lang.Object)
- */
- public boolean mustSaveDocument(Object element) {
- return ((IStructuredModel) element).isDirty();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#removeElementStateListener(org.eclipse.ui.texteditor.IElementStateListener)
- */
- public void removeElementStateListener(IElementStateListener listener) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#resetDocument(java.lang.Object)
- */
- public void resetDocument(Object element) throws CoreException {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProvider#saveDocument(org.eclipse.core.runtime.IProgressMonitor,
- * java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
- */
- public void saveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
- try {
- ((IStructuredModel) element).save();
- }
- catch (UnsupportedEncodingException e) {
- }
- catch (IOException e) {
- }
- catch (CoreException e) {
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#setCanSaveDocument(java.lang.Object)
- */
- public void setCanSaveDocument(Object element) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#synchronize(java.lang.Object)
- */
- public void synchronize(Object element) throws CoreException {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#updateStateCache(java.lang.Object)
- */
- public void updateStateCache(Object element) throws CoreException {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IDocumentProviderExtension#validateState(java.lang.Object,
- * java.lang.Object)
- */
- public void validateState(Object element, Object computationContext) throws CoreException {
- }
-
- public IContentType getContentType(Object element) throws CoreException {
- return Platform.getContentTypeManager().getContentType(((IStructuredModel) element).getContentTypeIdentifier());
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ActionDescriptor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ActionDescriptor.java
deleted file mode 100644
index 4f615e71c9..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ActionDescriptor.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.extension;
-
-
-
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.sse.ui.internal.IActionValidator;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.osgi.framework.Bundle;
-
-
-/**
- * When 'action' tag is found in the registry, an object of this class is
- * created. It creates the appropriate action object and captures information
- * that is later used to add this action object into menu/tool bar. This class
- * is reused for global (workbench) menu/tool bar, popup menu actions, as well
- * as view's pulldown and local tool bar.
- */
-public class ActionDescriptor {
- public static final String ATT_ACCELERATOR = "accelerator"; //$NON-NLS-1$
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
- public static final String ATT_DEFINITION_ID = "definitionId"; //$NON-NLS-1$
- public static final String ATT_DESCRIPTION = "description"; //$NON-NLS-1$
- public static final String ATT_DISABLEDICON = "disabledIcon"; //$NON-NLS-1$
- public static final String ATT_HELP_CONTEXT_ID = "helpContextId"; //$NON-NLS-1$
- public static final String ATT_HOVERICON = "hoverIcon"; //$NON-NLS-1$
- public static final String ATT_ICON = "icon"; //$NON-NLS-1$
-
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- public static final String ATT_LABEL = "label"; //$NON-NLS-1$
- public static final String ATT_MENUBAR_PATH = "menubarPath"; //$NON-NLS-1$
- public static final String ATT_POPUPMENU_PATH = "popupmenuPath"; //$NON-NLS-1$
- public static final String ATT_STATE = "state"; //$NON-NLS-1$
- public static final String ATT_TOOLBAR_PATH = "toolbarPath"; //$NON-NLS-1$
- public static final String ATT_TOOLTIP = "tooltip"; //$NON-NLS-1$
-
- /**
- * Creates an extension. If the extension plugin has not been loaded a
- * busy cursor will be activated during the duration of the load.
- *
- * @param element
- * the config element defining the extension
- * @param classAttribute
- * the name of the attribute carrying the class
- * @returns the extension object if successful. If an error occurs when
- * createing executable extension, the exception is logged, and
- * null returned.
- */
- public static Object createExtension(final IConfigurationElement element, final String classAttribute) {
- final Object[] result = new Object[1];
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- String pluginId = element.getDeclaringExtension().getNamespace();
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle.getState() == Bundle.ACTIVE) {
- try {
- result[0] = element.createExecutableExtension(classAttribute);
- } catch (Exception e) {
- // catch and log ANY exception from extension point
- handleCreateExecutableException(result, e);
- }
- } else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = element.createExecutableExtension(classAttribute);
- } catch (Exception e) {
- // catch and log ANY exception from extension point
- handleCreateExecutableException(result, e);
- }
- }
- });
- }
- return result[0];
- }
-
- private static void handleCreateExecutableException(final Object[] result, Throwable e) {
- Logger.logException(e);
- result[0] = null;
- }
-
- private String id;
-
- private ActionContributionItem item;
- private String menuGroup;
- private String menuPath;
- private String popupmenuGroup;
- private String popupmenuPath;
- private String toolbarGroup;
- private String toolbarPath;
-
- /**
- * Creates a new descriptor with the targetType
- */
- public ActionDescriptor(IConfigurationElement actionElement) throws CoreException {
-
- // Calculate menu and toolbar paths.
- String mpath = actionElement.getAttribute(ATT_MENUBAR_PATH);
- String mgroup = null;
- if (mpath != null) {
- int loc = mpath.lastIndexOf('/');
- if (loc != -1) {
- mgroup = mpath.substring(loc + 1);
- mpath = mpath.substring(0, loc);
- } else {
- mgroup = mpath;
- mpath = null;
- }
- }
- menuPath = mpath;
- menuGroup = mgroup;
-
- String ppath = actionElement.getAttribute(ATT_POPUPMENU_PATH);
- String pgroup = null;
- if (ppath != null) {
- int loc = ppath.lastIndexOf('/');
- if (loc != -1) {
- pgroup = ppath.substring(loc + 1);
- ppath = ppath.substring(0, loc);
- } else {
- pgroup = ppath;
- ppath = null;
- }
- }
- popupmenuPath = ppath;
- popupmenuGroup = pgroup;
-
- String tpath = actionElement.getAttribute(ATT_TOOLBAR_PATH);
- String tgroup = null;
- if (tpath != null) {
- int loc = tpath.lastIndexOf('/');
- if (loc != -1) {
- tgroup = tpath.substring(loc + 1);
- tpath = tpath.substring(0, loc);
- } else {
- tgroup = tpath;
- tpath = null;
- }
- }
- toolbarPath = tpath;
- toolbarGroup = tgroup;
-
- // Create action.
- IAction action = createAction(actionElement);
- if (action == null)
- return;
-
- String label = actionElement.getAttribute(ATT_LABEL);
- if (label != null)
- action.setText(label);
-
- id = actionElement.getAttribute(ATT_ID);
- if (id == null) {
- id = actionElement.getAttribute(ATT_CLASS);
- }
- if (id != null)
- action.setId(id);
-
- String defId = actionElement.getAttribute(ATT_DEFINITION_ID);
- if (defId != null && defId.length() != 0) {
- action.setActionDefinitionId(defId);
- }
-
- String tooltip = actionElement.getAttribute(ATT_TOOLTIP);
- if (tooltip != null)
- action.setToolTipText(tooltip);
-
- String helpContextId = actionElement.getAttribute(ATT_HELP_CONTEXT_ID);
- if (helpContextId != null) {
- String fullID = helpContextId;
- if (helpContextId.indexOf(".") == -1) //$NON-NLS-1$
- // For backward compatibility we auto qualify the id if it is
- // not qualified)
- fullID = actionElement.getDeclaringExtension().getNamespace() + "." + helpContextId; //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(action, fullID);
- }
-
- String description = actionElement.getAttribute(ATT_DESCRIPTION);
- if (description != null)
- action.setDescription(description);
-
- String state = actionElement.getAttribute(ATT_STATE);
- if (state != null) {
- action.setChecked(state.equals("true")); //$NON-NLS-1$
- }
-
- String icon = actionElement.getAttribute(ATT_ICON);
- if (icon != null) {
- action.setImageDescriptor(ImageUtil.getImageDescriptorFromExtension(actionElement.getDeclaringExtension(), icon));
- }
-
- String hoverIcon = actionElement.getAttribute(ATT_HOVERICON);
- if (hoverIcon != null) {
- action.setHoverImageDescriptor(ImageUtil.getImageDescriptorFromExtension(actionElement.getDeclaringExtension(), hoverIcon));
- }
-
- String disabledIcon = actionElement.getAttribute(ATT_DISABLEDICON);
- if (disabledIcon != null) {
- action.setDisabledImageDescriptor(ImageUtil.getImageDescriptorFromExtension(actionElement.getDeclaringExtension(), disabledIcon));
- }
-
- String accelerator = actionElement.getAttribute(ATT_ACCELERATOR);
- if (accelerator != null)
- processAccelerator(action, accelerator);
-
- item = new ActionContributionItem(action);
- }
-
- /**
- * Parses the given accelerator text, and converts it to an accelerator
- * key code.
- *
- * @param acceleratorText
- * the accelerator text
- * @result the SWT key code, or 0 if there is no accelerator
- */
- private int convertAccelerator(String acceleratorText) {
- int accelerator = 0;
- StringTokenizer stok = new StringTokenizer(acceleratorText, "+"); //$NON-NLS-1$
-
- int keyCode = -1;
-
- boolean hasMoreTokens = stok.hasMoreTokens();
- while (hasMoreTokens) {
- String token = stok.nextToken();
- hasMoreTokens = stok.hasMoreTokens();
- // Every token except the last must be one of the modifiers
- // Ctrl, Shift, or Alt.
- if (hasMoreTokens) {
- int modifier = Action.findModifier(token);
- if (modifier != 0) {
- accelerator |= modifier;
- } else { //Leave if there are none
- return 0;
- }
- } else {
- keyCode = Action.findKeyCode(token);
- }
- }
- if (keyCode != -1) {
- accelerator |= keyCode;
- }
- return accelerator;
- }
-
- /**
- */
- private IAction createAction(IConfigurationElement actionElement) {
- Object action = new ExtendedEditorActionProxyForDelayLoading(actionElement, ATT_CLASS);
- if (action == null)
- return null;
- if (action instanceof IActionValidator) {
- if (!((IActionValidator) action).isValidAction())
- return null;
- }
- return (action instanceof IAction ? (IAction) ExtendedEditorActionProxy.newInstance(action) : null);
- }
-
- /**
- * Returns the action object held in this descriptor.
- */
- public IAction getAction() {
- return (item != null ? item.getAction() : null);
- }
-
- /**
- * Returns the IContributionItem object held in this descriptor.
- */
- public IContributionItem getContributionItem() {
- return item;
- }
-
- /**
- * Returns action's id as defined in the registry.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns named slot (group) in the menu where this action should be
- * added.
- */
- public String getMenuGroup() {
- return menuGroup;
- }
-
- /**
- * Returns menu path where this action should be added. If null, the
- * action will not be added into the menu.
- */
-
- public String getMenuPath() {
- return menuPath;
- }
-
- /**
- * Returns named slot (group) in the popup menu where this action should
- * be added.
- */
- public String getPopupMenuGroup() {
- return popupmenuGroup;
- }
-
- /**
- * Returns popup menu path where this action should be added. If null, the
- * action will not be added into the popup menu.
- */
-
- public String getPopupMenuPath() {
- return popupmenuPath;
- }
-
- /**
- * Returns the named slot (group) in the tool bar where this action should
- * be added.
- */
-
- public String getToolbarGroup() {
- return toolbarGroup;
- }
-
- /**
- * Returns path in the tool bar where this action should be added. If
- * null, action will not be added to the tool bar.
- */
- public String getToolbarPath() {
- return toolbarPath;
- }
-
- /**
- * Process the accelerator definition. If it is a number then process the
- * code directly - if not then parse it and create the code
- */
- private void processAccelerator(IAction action, String acceleratorText) {
-
- if (acceleratorText.length() == 0)
- return;
-
- //Is it a numeric definition?
- if (Character.isDigit(acceleratorText.charAt(0))) {
- try {
- action.setAccelerator(Integer.valueOf(acceleratorText).intValue());
- } catch (NumberFormatException exception) {
- Logger.log(Logger.ERROR, "Invalid accelerator declaration: " + id); //$NON-NLS-1$
- }
- } else
- action.setAccelerator(convertAccelerator(acceleratorText));
- }
-
- /**
- * For debugging only.
- */
- public String toString() {
- return "ActionDescriptor(" + id + ")"; //$NON-NLS-2$//$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/BreakpointProviderBuilder.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/BreakpointProviderBuilder.java
deleted file mode 100644
index 9a33f4d86c..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/BreakpointProviderBuilder.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.extension;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.IBreakpointProvider;
-import org.osgi.framework.Bundle;
-
-
-/**
- * Reads breakpoint extension registory and returns breakpoint provider
- * instances
- */
-public class BreakpointProviderBuilder extends RegistryReader {
-
- private static final String ATT_CLASS = "class"; //$NON-NLS-1$
- // private static final String ATT_ID = "id"; //$NON-NLS-1$
- private static final String ATT_CONTENT_TYPES = "contentTypes"; //$NON-NLS-1$
- private static final String ATT_EXTENSIONS = "extensions"; //$NON-NLS-1$
- private static BreakpointProviderBuilder instance;
- private static final String PL_BREAKPOINT = "breakpoint"; //$NON-NLS-1$
-
- private static final String PLUGIN_ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
-
- private static final String TAG_BREAKPOINT_CONTRIBUTION = "breakpointContribution"; //$NON-NLS-1$
- private static final String TAG_PROVIDER = "provider"; //$NON-NLS-1$
-
- /*
- * Creates an executable extension. @param element the config element
- * defining the extension @param classAttribute the name of the attribute
- * carrying the class @return the extension object @throws CoreException
- */
- static Object createExecutableExtension(final IConfigurationElement element, final String classAttribute) throws CoreException {
- return element.createExecutableExtension(classAttribute);
- }
-
- /**
- * Creates an extension. If the extension plugin has not been loaded a
- * busy cursor will be activated during the duration of the load.
- *
- * @param element
- * the config element defining the extension
- * @param classAttribute
- * the name of the attribute carrying the class
- * @return the extension object
- * @throws CoreException
- */
- public static Object createExtension(final IConfigurationElement element, final String classAttribute) {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- final Object[] result = new Object[1];
- String pluginId = element.getDeclaringExtension().getNamespace();
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle.getState() == Bundle.ACTIVE) {
- try {
- result[0] = createExecutableExtension(element, classAttribute);
- }
- catch (Exception e) {
- handleCreateExecutableException(result, e);
- }
- }
- else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = createExecutableExtension(element, classAttribute);
- }
- catch (CoreException e) {
- handleCreateExecutableException(result, e);
- }
- }
- });
-
- }
- return result[0];
- }
-
- /**
- * returns singleton instance of BreakpointProviderBuilder
- *
- * @return BreakpointProviderBuilder
- */
- public synchronized static BreakpointProviderBuilder getInstance() {
- if (instance == null) {
- instance = new BreakpointProviderBuilder();
- }
- return instance;
- }
-
- /**
- * @param result
- * @param e
- */
- private static void handleCreateExecutableException(Object[] result, Throwable e) {
- Logger.logException(e);
- result[0] = null;
-
- }
-
- protected List cache;
- private Map map = new HashMap();
-
- protected String targetContributionTag;
-
- /*
- * Constructor
- */
- private BreakpointProviderBuilder() {
- super();
- }
-
- /*
- * Creates a breakpoint provider object to given element @param element
- * configuration element object @return IBreakpointProvider
- */
- protected IBreakpointProvider createBreakpointProvider(IConfigurationElement element) {
- Object obj = createExtension(element, ATT_CLASS);
- if (obj == null)
- return null;
- return (obj instanceof IBreakpointProvider) ? (IBreakpointProvider) obj : null;
- }
-
- /*
- * Creates an array of breakpoint providers matching the given key to the
- * value of the IConfigurationElement attribute "attrName" @return
- * IBreakpointProvider[]
- */
- protected IBreakpointProvider[] createBreakpointProviders(String attrName, String key) {
- if (cache == null)
- return new IBreakpointProvider[0];
-
- final int num = cache.size();
- if (num == 0)
- return new IBreakpointProvider[0];
-
- IBreakpointProvider[] bp = new IBreakpointProvider[num];
- int j = 0;
- for (int i = 0; i < num; i++) {
- Object obj = cache.get(i);
- if (!(obj instanceof IConfigurationElement))
- continue;
-
- IConfigurationElement element = (IConfigurationElement) obj;
- if (!TAG_PROVIDER.equals(element.getName()))
- continue;
-
- boolean doCreate = false;
-
- String attrValues = element.getAttribute(attrName);
-
- if (attrValues != null) {
- StringTokenizer tokenizer = new StringTokenizer(attrValues, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String type = tokenizer.nextToken();
- if (type.trim().equalsIgnoreCase(key.trim())) {
- doCreate = true;
- break;
- }
- }
- }
-
- if (doCreate) {
- IBreakpointProvider b = createBreakpointProvider(element);
- if (b != null) {
- bp[j] = b;
- j++;
- }
- }
- }
-
- IBreakpointProvider[] bp2 = new IBreakpointProvider[j];
- for (int i = 0; i < j; i++) {
- bp2[i] = bp[i];
- }
-
- return bp2;
- }
-
- /*
- * Returns a matching array of extension points matching this key. Doesn't
- * cause instantiation of providers. @return IBreakpointProvider[]
- */
- protected IConfigurationElement[] findElements(String key) {
- initCache();
-
- if (cache == null || cache.size() == 0)
- return new IConfigurationElement[0];
-
- int num = cache.size();
- List elements = new ArrayList(1);
- for (int i = 0; i < num; i++) {
- Object obj = cache.get(i);
- if (!(obj instanceof IConfigurationElement))
- continue;
-
- IConfigurationElement element = (IConfigurationElement) obj;
- if (!TAG_PROVIDER.equals(element.getName()))
- continue;
-
- boolean add = false;
- String types = element.getAttribute(ATT_CONTENT_TYPES);
- String exts = element.getAttribute(ATT_EXTENSIONS);
-
- if (types == null && exts == null) {
- add = true;
- }
-
- if (!add && types != null && types.length() > 0) {
- IContentType testType = Platform.getContentTypeManager().getContentType(key);
- StringTokenizer tokenizer = new StringTokenizer(types, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String type = tokenizer.nextToken();
- IContentType contentType = Platform.getContentTypeManager().getContentType(type);
- if (contentType != null && testType != null && contentType.isKindOf(testType)) {
- add = true;
- break;
- }
- }
- }
-
- if (!add && exts != null) {
- StringTokenizer tokenizer = new StringTokenizer(exts, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String ext = tokenizer.nextToken();
- if (ext.trim().equals(key.trim())) {
- add = true;
- break;
- }
- }
- }
-
- if (add) {
- elements.add(element);
- }
- }
- return (IConfigurationElement[]) elements.toArray(new IConfigurationElement[0]);
- }
-
- /**
- * Returns an array of breakpoint providers for a specified content type
- * handler
- *
- * @param handler
- * a content type handler
- * @param ext
- * file extension
- * @return IBreakpointProvider[]
- */
- public IBreakpointProvider[] getBreakpointProviders(IEditorPart editorpart, String contentTypeID, String ext) {
- initCache();
-
- // Get breakpoint providers for this content type handler
- IBreakpointProvider[] providers1 = new IBreakpointProvider[0];
- IContentType contentType = Platform.getContentTypeManager().getContentType(contentTypeID);
- List holdProviders = new ArrayList(2);
- while (contentType != null) {
- IBreakpointProvider[] providers = (IBreakpointProvider[]) map.get(contentType.getId());
- if (providers == null) {
- providers = createBreakpointProviders(ATT_CONTENT_TYPES, contentType.getId());
- if (providers != null) {
- map.put(contentType.getId(), providers);
- }
- }
- // providers were retrieved from cache or newly created
- if(providers != null) {
- holdProviders.addAll(Arrays.asList(providers));
- }
- contentType = contentType.getBaseType();
- }
- providers1 = (IBreakpointProvider[]) holdProviders.toArray(new IBreakpointProvider[holdProviders.size()]);
-
- // Get breakpoint providers for this extension
- IBreakpointProvider[] providers2 = new IBreakpointProvider[0];
- if (ext != null) {
- providers2 = (IBreakpointProvider[]) map.get(ext);
- if (providers2 == null) {
- providers2 = createBreakpointProviders(ATT_EXTENSIONS, ext);
- if (providers2 != null) {
- map.put(ext, providers2);
- }
- }
- }
-
- // create single hash set to remove duplication
- Set s = new HashSet();
- s.addAll(Arrays.asList(providers1));
- s.addAll(Arrays.asList(providers2));
-
- // create IBreakpointProvider[] to return
- IBreakpointProvider[] providers = new IBreakpointProvider[s.size()];
- Iterator itr = s.iterator();
- int i = 0;
- ISourceEditingTextTools tools = null;
- if (editorpart != null && itr.hasNext())
- tools = (ISourceEditingTextTools) editorpart.getAdapter(ISourceEditingTextTools.class);
- while (itr.hasNext()) {
- providers[i] = (IBreakpointProvider) itr.next();
- providers[i].setSourceEditingTextTools(tools);
- i++;
- }
- return providers;
- }
-
- /**
- * Returns corresponding resource from given parameters
- *
- * @param input
- * @param handler
- * @param ext
- * @return IResource
- */
- public IResource getResource(IEditorInput input, String contentType, String ext) {
- IBreakpointProvider[] providers = getBreakpointProviders(null, contentType, ext);
- IResource res = null;
- for (int i = 0; i < providers.length; i++) {
- res = providers[i].getResource(input);
- if (res != null) {
- break;
- }
- }
- return res;
- }
-
- private void initCache() {
- if (cache == null) {
- cache = new ArrayList();
- readContributions(TAG_BREAKPOINT_CONTRIBUTION, PL_BREAKPOINT);
- }
- }
-
- /**
- * Returns an array of breakpoint providers for a specified content type
- * handler
- *
- * @param contentType
- * a content type ID or null
- * @param ext
- * a filename extension or null
- * @return boolean
- */
- public boolean isAvailable(String contentType, String ext) {
- boolean available = false;
- if (ext != null)
- available = findElements(ext).length > 0;
- if (!available && contentType != null)
- available = findElements(contentType).length > 0;
- return available;
- }
-
- /**
- * Reads the contributions from the registry for the provided workbench
- * part and the provided extension point ID.
- *
- * @param tag
- * @param extensionPoint
- */
- protected void readContributions(String tag, String extensionPoint) {
- targetContributionTag = tag;
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, PLUGIN_ID, extensionPoint);
- }
-
- protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
- if (tag.equals(targetContributionTag)) {
- readElementChildren(element);
- return true;
- }
- else if (tag.equals(TAG_PROVIDER)) {
- cache.add(element);
- return true; // just cache the element - don't go into it
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/DropActionProxy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/DropActionProxy.java
deleted file mode 100644
index 0eebf4e9cb..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/DropActionProxy.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.extension;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.undo.IStructuredTextUndoManager;
-import org.eclipse.wst.sse.ui.internal.IExtendedSimpleEditor;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISelfValidateEditAction;
-
-
-/**
- */
-public class DropActionProxy implements InvocationHandler {
- public static Object newInstance(Object obj) {
- Object instance = null;
- try {
- Set set = new HashSet();
- Class clazz = obj.getClass();
- while (clazz != null) {
- Class[] interfaces = clazz.getInterfaces();
- for (int i = 0; i < interfaces.length; i++) {
- set.add(interfaces[i]);
- }
- clazz = clazz.getSuperclass();
- }
- Class[] classes = new Class[set.size()];
- Iterator itr = set.iterator();
- int i = 0;
- while (itr.hasNext()) {
- classes[i] = (Class) itr.next();
- i++;
- }
- instance = Proxy.newProxyInstance(obj.getClass().getClassLoader(), classes, new DropActionProxy(obj));
- } catch (Error e) {
- Logger.logException("Exception while proxying a drop action", e); //$NON-NLS-1$
- instance = obj;
- }
- return instance;
- }
-
- private IExtendedSimpleEditor editor = null;
- private IStructuredModel fRecorder;
- private Object obj;
-
- private DropActionProxy(Object obj) {
- this.obj = obj;
- }
-
- private void beginRecording() {
- IDocument document = null;
- if (editor != null) {
- document = editor.getDocument();
- if (document != null)
- fRecorder = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
- // Prepare for Undo
- if (fRecorder != null) {
- IStructuredTextUndoManager um = fRecorder.getUndoManager();
- if (um != null) {
- if (this.obj instanceof IAction)
- um.beginRecording(this, ((IAction) this.obj).getText(), ((IAction) this.obj).getDescription());
- else
- um.beginRecording(this);
- }
- }
- }
- }
-
- private void endRecording() {
- if (fRecorder != null) {
- IStructuredTextUndoManager um = fRecorder.getUndoManager();
- if (um != null)
- um.endRecording(this);
- fRecorder.releaseFromEdit();
- fRecorder = null;
- }
- }
-
- /**
- * @see java.lang.reflect.InvocationHandler#invoke(Object, Method,
- * Object[])
- */
- public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
- Object result;
- String name = m.getName();
- try {
- if (name.equals("equals")) { //$NON-NLS-1$
- // Workaround for JDK's bug 4652876
- // "equals" always returns false even if both
- // InvocationHandler
- // class
- // hold the same objects
- // See
- // http://developer.java.sun.com/developer/bugParade/bugs/4652876.html
- // This problem is in the IBM SDK 1.3.1
- // but I don't see the bug in Sun's JDK 1.4.1 (beta)
- Object arg = args[0];
- return (proxy.getClass() == arg.getClass() && equals(Proxy.getInvocationHandler(arg))) ? Boolean.TRUE : Boolean.FALSE;
- } else if (name.equals("run")) { //$NON-NLS-1$
- if (args[1] instanceof IExtendedSimpleEditor) {
- editor = (IExtendedSimpleEditor) args[1];
- }
- beginRecording();
- if ((editor != null) && !(obj instanceof ISelfValidateEditAction)) {
-
- // TODO: cleanup validateEdit
- // just leaving this check and following code here for transition.
- // I assume we'll remove all need for 'validateEdit'
- // or move to platform editor's validateState
-
-// IStatus status = editor.validateEdit(getDisplay().getActiveShell());
-// if (!status.isOK()) {
-// return null;
-// }
- }
- }
- result = m.invoke(obj, args);
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- } catch (Exception e) {
- throw new RuntimeException(e.getMessage());
- } finally {
- if (name.equals("run")) { //$NON-NLS-1$
- endRecording();
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ExtendedEditorActionProxy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ExtendedEditorActionProxy.java
deleted file mode 100644
index 72c7bba014..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ExtendedEditorActionProxy.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.extension;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.undo.IStructuredTextUndoManager;
-import org.eclipse.wst.sse.ui.internal.IExtendedSimpleEditor;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISelfValidateEditAction;
-
-
-/**
- * Begins and ends UndoManager recording around run() and runWithEvent(...)
- */
-public class ExtendedEditorActionProxy implements InvocationHandler {
- public static Object newInstance(Object obj) {
- Set set = new HashSet();
- Class clazz = obj.getClass();
- while (clazz != null) {
- Class[] interfaces = clazz.getInterfaces();
- for (int i = 0; i < interfaces.length; i++) {
- set.add(interfaces[i]);
- }
- clazz = clazz.getSuperclass();
- }
- Class[] classes = new Class[set.size()];
- Iterator itr = set.iterator();
- int i = 0;
- while (itr.hasNext()) {
- classes[i] = (Class) itr.next();
- i++;
- }
- return Proxy.newProxyInstance(obj.getClass().getClassLoader(), classes, new ExtendedEditorActionProxy(obj));
- }
-
- private IExtendedSimpleEditor editor = null;
- private IStructuredModel fRecorder;
- private Object obj;
-
- private ExtendedEditorActionProxy(Object obj) {
- this.obj = obj;
- }
-
- private void beginRecording() {
- IDocument document = null;
- if (editor != null) {
- document = editor.getDocument();
- if (document != null)
- fRecorder = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
- // Prepare for Undo
- if (fRecorder != null) {
- IStructuredTextUndoManager um = fRecorder.getUndoManager();
- if (um != null) {
- um.beginRecording(this, ((IAction) this.obj).getText(), ((IAction) this.obj).getDescription());
- }
- }
- }
- }
-
- private void endRecording() {
- if (fRecorder != null) {
- IStructuredTextUndoManager um = fRecorder.getUndoManager();
- if (um != null) {
- um.endRecording(this);
- }
- fRecorder.releaseFromEdit();
- fRecorder = null;
- }
- }
-
- /**
- * @see java.lang.reflect.InvocationHandler#invoke(Object, Method,
- * Object[])
- */
- public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
- Object result = null;
- String name = m.getName();
- try {
- if (name.equals("equals")) { //$NON-NLS-1$
- // Workaround for JDK's bug 4652876
- // "equals" always returns false even if both
- // InvocationHandler
- // class
- // hold the same objects
- // See
- // http://developer.java.sun.com/developer/bugParade/bugs/4652876.html
- // This problem is in the IBM SDK 1.3.1
- // but I don't see the bug in Sun's JDK 1.4.1 (beta)
- Object arg = args[0];
- return (proxy.getClass() == arg.getClass() && equals(Proxy.getInvocationHandler(arg))) ? Boolean.TRUE : Boolean.FALSE;
- } else if (name.equals("runWithEvent") || name.equals("run")) { //$NON-NLS-1$ //$NON-NLS-2$
- beginRecording();
- if ((editor != null) && !(this.obj instanceof ISelfValidateEditAction)) {
-
- // TODO: cleanup validateEdit
- // just leaving this check and following code here for transition.
- // I assume we'll remove all need for 'validateEdit'
- // or move to platform editor's validateState
-
-// IStatus status = editor.validateEdit(getDisplay().getActiveShell());
-// if (!status.isOK()) {
-// return null;
-// }
- }
- } else if (name.equals("setActiveExtendedEditor")) { //$NON-NLS-1$
- if (args[0] instanceof IExtendedSimpleEditor) {
- editor = (IExtendedSimpleEditor) args[0];
- }
- }
- result = m.invoke(this.obj, args);
- } catch (InvocationTargetException e) {
- Logger.logException(e.getTargetException());
- //throw e.getTargetException();
- } catch (Exception e) {
- Logger.logException(e);
- if (name.equals("runWithEvent") || name.equals("run")) { //$NON-NLS-1$ //$NON-NLS-2$
- // only expose user-driven exceptions from "running" to the
- // user
- throw new RuntimeException(e.getMessage());
- }
- } finally {
- if (name.equals("runWithEvent") || name.equals("run")) { //$NON-NLS-1$ //$NON-NLS-2$
- endRecording();
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ExtendedEditorActionProxyForDelayLoading.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ExtendedEditorActionProxyForDelayLoading.java
deleted file mode 100644
index c4565df89f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ExtendedEditorActionProxyForDelayLoading.java
+++ /dev/null
@@ -1,752 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.extension;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.wst.sse.ui.internal.IExtendedEditorAction;
-import org.eclipse.wst.sse.ui.internal.IExtendedSimpleEditor;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.osgi.framework.Bundle;
-
-public class ExtendedEditorActionProxyForDelayLoading implements IExtendedEditorAction, IExtendedEditorActionProxyForDelayLoading, IAction {
- private IAction proxy;
- private IAction dummy = new Action() { // this is for mainly its property change notify...
- };
- // proxy'ed properties
- private String p_id;
- private boolean set_p_id;
- private String p_text;
- private boolean set_p_text;
- private String p_toolTipText;
- private boolean set_p_toolTipText;
- private String p_actionDefinitionId;
- private boolean set_p_actionDefinitionId;
- private ImageDescriptor p_image;
- private boolean set_p_image;
- private ImageDescriptor p_hoverImage;
- private boolean set_p_hoverImage;
- private ImageDescriptor p_disabledImage;
- private boolean set_p_disabledImage;
- private int p_accelerator;
- private boolean set_p_accelerator;
- private int p_style = AS_PUSH_BUTTON;
- //private boolean set_p_style;
- private HelpListener p_helpListener;
- private boolean set_p_helpListener;
- private boolean p_enabled = true; // should be same as what is done in
- private boolean set_p_enabled;
- private ListenerList p_listeners = new ListenerList(3);
- private boolean set_p_listeners;
- private boolean p_checked;
- private boolean set_p_checked;
- private IExtendedSimpleEditor p_targetEditor;
- private boolean set_p_targetEditor;
- private boolean p_isvisible = true; // should be true
-
- private IConfigurationElement element;
- private String classAttribute;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- p_listeners.add(listener);
- set_p_listeners = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.addPropertyChangeListener(listener);
- } else {
- dummy.addPropertyChangeListener(listener);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getAccelerator()
- */
- public int getAccelerator() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getAccelerator();
- }
- return p_accelerator;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getActionDefinitionId()
- */
- public String getActionDefinitionId() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getActionDefinitionId();
- }
- return p_actionDefinitionId;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getDescription()
- */
- public String getDescription() {
- // System.out.println(p_id + ": getDescription");
- // System.out.flush();
- realize();
- if (proxy != null) {
- return proxy.getDescription();
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getDisabledImageDescriptor()
- */
- public ImageDescriptor getDisabledImageDescriptor() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getDisabledImageDescriptor();
- }
- return p_disabledImage;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getHelpListener()
- */
- public HelpListener getHelpListener() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getHelpListener();
- }
- return p_helpListener;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getHoverImageDescriptor()
- */
- public ImageDescriptor getHoverImageDescriptor() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getHoverImageDescriptor();
- }
- return p_hoverImage;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getId()
- */
- public String getId() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getId();
- }
- return p_id;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getImageDescriptor();
- }
- return p_image;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getMenuCreator()
- */
- public IMenuCreator getMenuCreator() {
- // System.out.println(p_id + ": getMenuCreator");
- // System.out.flush();
- realize();
- if (proxy != null) {
- return proxy.getMenuCreator();
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getStyle()
- */
- public int getStyle() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getStyle();
- }
- return p_style;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getText()
- */
- public String getText() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getText();
- }
- return p_text;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#getToolTipText()
- */
- public String getToolTipText() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.getToolTipText();
- }
- return p_toolTipText;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#isChecked()
- */
- public boolean isChecked() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.isChecked();
- }
- return p_checked;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#isEnabled()
- */
- public boolean isEnabled() {
- // don't realize class.
- // realize();
- if (proxy != null) {
- return proxy.isEnabled();
- }
- return p_enabled;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- p_listeners.remove(listener);
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.removePropertyChangeListener(listener);
- }
- dummy.removePropertyChangeListener(listener);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- realize();
- if (proxy != null) {
- // if this has a key accelerator, first update this action and to
- // see if this action is enabled or not.
- if ((proxy.getAccelerator() > 0) || (proxy.getActionDefinitionId() != null)) {
- update();
- if (isEnabled() == true) {
- proxy.run();
- }
- } else {
- proxy.run();
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event)
- */
- public void runWithEvent(Event event) {
- realize();
- if (proxy != null) {
- // same as run()
- if ((proxy.getAccelerator() > 0) || (proxy.getActionDefinitionId() != null)) {
- update();
- if (isEnabled() == true) {
- proxy.runWithEvent(event);
- }
- } else {
- proxy.runWithEvent(event);
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setActionDefinitionId(java.lang.String)
- */
- public void setActionDefinitionId(String id) {
- p_actionDefinitionId = id;
- set_p_actionDefinitionId = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setActionDefinitionId(id);
- } else {
- dummy.setActionDefinitionId(id);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setChecked(boolean)
- */
- public void setChecked(boolean checked) {
- p_checked = checked;
- set_p_checked = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setChecked(checked);
- } else {
- dummy.setChecked(checked);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setDescription(java.lang.String)
- */
- public void setDescription(String text) {
- // System.out.println(p_id + ": setDescription");
- // System.out.flush();
- realize();
- if (proxy != null) {
- proxy.setDescription(text);
- } else {
- dummy.setDescription(text);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setDisabledImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
- */
- public void setDisabledImageDescriptor(ImageDescriptor newImage) {
- p_disabledImage = newImage;
- set_p_disabledImage = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setDisabledImageDescriptor(newImage);
- } else {
- dummy.setDisabledImageDescriptor(newImage);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setEnabled(boolean)
- */
- public void setEnabled(boolean enabled) {
- p_enabled = enabled;
- set_p_enabled = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setEnabled(enabled);
- } else {
- dummy.setEnabled(enabled);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setHelpListener(org.eclipse.swt.events.HelpListener)
- */
- public void setHelpListener(HelpListener listener) {
- p_helpListener = listener;
- set_p_helpListener = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setHelpListener(listener);
- } else {
- dummy.setHelpListener(listener);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setHoverImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
- */
- public void setHoverImageDescriptor(ImageDescriptor newImage) {
- p_hoverImage = newImage;
- set_p_hoverImage = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setHoverImageDescriptor(newImage);
- } else {
- dummy.setHoverImageDescriptor(newImage);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setId(java.lang.String)
- */
- public void setId(String id) {
- p_id = id;
- set_p_id = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setId(id);
- } else {
- dummy.setId(id);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
- */
- public void setImageDescriptor(ImageDescriptor newImage) {
- p_image = newImage;
- set_p_image = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setImageDescriptor(newImage);
- } else {
- dummy.setImageDescriptor(newImage);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setMenuCreator(org.eclipse.jface.action.IMenuCreator)
- */
- public void setMenuCreator(IMenuCreator creator) {
- // System.out.println(p_id + ": setMenuCreator");
- // System.out.flush();
- realize();
- if (proxy != null) {
- proxy.setMenuCreator(creator);
- } else {
- dummy.setMenuCreator(creator);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setText(java.lang.String)
- */
- public void setText(String text) {
- p_text = text;
- set_p_text = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setText(text);
- } else {
- dummy.setText(text);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setToolTipText(java.lang.String)
- */
- public void setToolTipText(String text) {
- p_toolTipText = text;
- set_p_toolTipText = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setToolTipText(text);
- } else {
- dummy.setToolTipText(text);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#setAccelerator(int)
- */
- public void setAccelerator(int keycode) {
- p_accelerator = keycode;
- set_p_accelerator = true;
- // don't realize class.
- // realize();
- if (proxy != null) {
- proxy.setAccelerator(keycode);
- } else {
- dummy.setAccelerator(keycode);
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.sse.ui.internal.IExtendedEditorAction#setActiveExtendedEditor(com.ibm.sse.editor.extension.IExtendedSimpleEditor)
- */
- public void setActiveExtendedEditor(IExtendedSimpleEditor targetEditor) {
- p_targetEditor = targetEditor;
- set_p_targetEditor = true;
- // don't realize class.
- // realize();
- if ((proxy != null) && (proxy instanceof IExtendedEditorAction)) {
- ((IExtendedEditorAction)proxy).setActiveExtendedEditor(targetEditor);
- }
- }
-
- /* (non-Javadoc)
- * @see com.ibm.sse.editor.extension.IExtendedEditorAction#isVisible()
- */
- public boolean isVisible() {
- // don't realize class.
- // realize();
- if ((proxy != null) && (proxy instanceof IExtendedEditorAction)) {
- return ((IExtendedEditorAction)proxy).isVisible();
- }
- return p_isvisible;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#isHandled
- */
- public boolean isHandled() {
- return false;
- }
-
- // see ActionDescriptor#createExtension
- private static IAction newInstance(final IConfigurationElement elm, final String cla) {
- final Object[] result = new Object[1];
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- Bundle bundle= Platform.getBundle(elm.getDeclaringExtension().getNamespace());
- if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
- try {
- result[0] = elm.createExecutableExtension(cla);
- }
- catch (Exception e) {
- // catch and log ANY exception from extension point
- handleCreateExecutableException(result, e);
- }
- }
- else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = elm.createExecutableExtension(cla);
- }
- catch (Exception e) {
- // catch and log ANY exception from extension point
- handleCreateExecutableException(result, e);
- }
- }
- });
- }
- if ((result[0] != null) && (result[0] instanceof IAction)) {
- return (IAction)result[0];
- }
- return null;
- }
-
- private static void handleCreateExecutableException(final Object[] result, Throwable e) {
- Logger.logException(e);
- result[0] = null;
- }
-
- /**
- * Instantiate a real class here
- */
- public void realize() {
- if ((proxy == null) && (element != null) && (classAttribute != null)) {
- proxy = newInstance(element, classAttribute);
- if (proxy != null) {
- element = null;
- classAttribute = null;
- // propagate proxy'ed properties
- if (set_p_listeners == true) {
- if (p_listeners.size() > 0) {
- Object[] l = p_listeners.getListeners();
- int ls = l.length;
- for (int i = 0; i < ls; i++) {
- IPropertyChangeListener pl = (IPropertyChangeListener) l[i];
- proxy.addPropertyChangeListener(pl);
- dummy.removePropertyChangeListener(pl); // remove listener from dymmy so that we don't send notifications twice anymore
- }
- }
- }
- if (set_p_accelerator == true) {
- proxy.setAccelerator(p_accelerator);
- }
- if (set_p_actionDefinitionId == true) {
- if (p_actionDefinitionId != null) {
- proxy.setActionDefinitionId(p_actionDefinitionId);
- }
- }
- if (set_p_checked == true) {
- proxy.setChecked(p_checked);
- }
- if (set_p_disabledImage == true) {
- if (p_disabledImage != null) {
- proxy.setDisabledImageDescriptor(p_disabledImage);
- }
- }
- if (set_p_enabled == true) {
- proxy.setEnabled(p_enabled);
- }
- if (set_p_helpListener == true) {
- if (p_helpListener != null) {
- proxy.setHelpListener(p_helpListener);
- }
- }
- if (set_p_hoverImage == true) {
- if (p_hoverImage != null) {
- proxy.setHoverImageDescriptor(p_hoverImage);
- }
- }
- if (set_p_id == true) {
- if (p_id != null) {
- proxy.setId(p_id);
- }
- }
- if (set_p_image == true) {
- if (p_image != null) {
- proxy.setImageDescriptor(p_image);
- }
- }
- if (set_p_text == true) {
- if (p_text != null) {
- proxy.setText(p_text);
- }
- }
- if (set_p_toolTipText == true) {
- if (p_toolTipText != null) {
- proxy.setToolTipText(p_toolTipText);
- }
- }
- if (set_p_targetEditor == true) {
- if (p_targetEditor != null) {
- if (proxy instanceof IExtendedEditorAction) {
- ((IExtendedEditorAction)proxy).setActiveExtendedEditor(p_targetEditor);
- }
- }
- }
- }
- }
- }
-
- public boolean isRealized() {
- return (proxy != null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- // don't realize class.
- // realize();
- if ((proxy != null) && (proxy instanceof IUpdate)) {
- ((IUpdate) proxy).update();
- }
- }
-
- /**
- * get a real action class
- */
- public IAction getAction() {
- realize();
- return proxy;
- }
-
-
- /**
- * These are Actions's constructors
- */
- ExtendedEditorActionProxyForDelayLoading() {
- super();
- }
- public ExtendedEditorActionProxyForDelayLoading(final IConfigurationElement element, final String classAttribute) {
- super();
- this.element = element;
- this.classAttribute = classAttribute;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/IExtendedEditorActionProxyForDelayLoading.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/IExtendedEditorActionProxyForDelayLoading.java
deleted file mode 100644
index 0152cbe899..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/IExtendedEditorActionProxyForDelayLoading.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.extension;
-
-import org.eclipse.jface.action.IAction;
-
-
-public interface IExtendedEditorActionProxyForDelayLoading {
- public IAction getAction();
- public boolean isRealized();
- public void realize();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ImageUtil.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ImageUtil.java
deleted file mode 100644
index b4ec6938ff..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/ImageUtil.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.extension;
-
-
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.osgi.framework.Bundle;
-
-public class ImageUtil {
-
-
- /**
- * Convenience Method. Returns an ImageDescriptor whose path, relative to
- * the plugin containing the <code>extension</code> is
- * <code>subdirectoryAndFilename</code>. If there isn't any value
- * associated with the name then <code>null
- * </code> is returned.
- *
- * This method is convenience and only intended for use by the workbench
- * because it explicitly uses the workbench's registry for
- * caching/retrieving images from other extensions -- other plugins must
- * user their own registry. This convenience method is subject to removal.
- *
- * Note: subdirectoryAndFilename must not have any leading "." or path
- * separators / or \ ISV's should use icons/mysample.gif and not
- * ./icons/mysample.gif
- *
- * Note: This consults the plugin for extension and obtains its
- * installation location. all requested images are assumed to be in a
- * directory below and relative to that plugins installation directory.
- */
- public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) {
- String pluginId = extension.getNamespace();
- Bundle bundle = Platform.getBundle(pluginId);
- return getImageDescriptorFromBundle(bundle, subdirectoryAndFilename);
- }
-
- /**
- * Convenience Method. Return an ImageDescriptor whose path relative to
- * the plugin described by <code>bundle</code> is
- * <code>subdirectoryAndFilename</code>. Returns <code>null</code> if
- * no image could be found.
- *
- * This method is convenience and only intended for use by the workbench
- * because it explicitly uses the workbench's registry for
- * caching/retrieving images from other extensions -- other plugins must
- * user their own registry. This convenience method is subject to removal.
- *
- * Note: subdirectoryAndFilename must not have any leading "." or path
- * separators / or \ ISV's should use icons/mysample.gif and not
- * ./icons/mysample.gif
- *
- * Note: This consults the plugin for extension and obtains its
- * installation location. all requested images are assumed to be in a
- * directory below and relative to that plugins installation directory.
- */
- public static ImageDescriptor getImageDescriptorFromBundle(Bundle bundle, String subdirectoryAndFilename) {
-
- URL path = bundle.getEntry("/"); //$NON-NLS-1$
- URL fullPathString = null;
- try {
- fullPathString = new URL(path, subdirectoryAndFilename);
- return ImageDescriptor.createFromURL(fullPathString);
- } catch (MalformedURLException e) {
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/RegistryReader.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/RegistryReader.java
deleted file mode 100644
index bd444ce8e6..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/extension/RegistryReader.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.extension;
-
-
-
-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.IPluginRegistry;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.util.Sorter;
-
-
-/**
- * Template implementation of a registry reader that creates objects
- * representing registry contents. Typically, an extension contains one
- * element, but this reader handles multiple elements per extension.
- *
- * To start reading the extensions from the registry for an extension point,
- * call the method <code>readRegistry</code>.
- *
- * To read children of an IConfigurationElement, call the method
- * <code>readElementChildren</code> from your implementation of the method
- * <code>readElement</code>, as it will not be done by default.
- */
-public abstract class RegistryReader {
-
-
- protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
-
- /**
- * The constructor.
- */
- protected RegistryReader() {
- }
-
- /**
- * This method extracts description as a subelement of the given element.
- *
- * @return description string if defined, or empty string if not.
- */
- protected String getDescription(IConfigurationElement config) {
- IConfigurationElement[] children = config.getChildren(TAG_DESCRIPTION);
- if (children.length >= 1) {
- return children[0].getValue();
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Logs the error in the workbench log using the provided text and the
- * information in the configuration element.
- */
- protected void logError(IConfigurationElement element, String text) {
- IExtension extension = element.getDeclaringExtension();
- StringBuffer buf = new StringBuffer();
- buf.append("Plugin " + extension.getNamespace() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-2$//$NON-NLS-1$
- buf.append("\n" + text); //$NON-NLS-1$
- Logger.log(Logger.ERROR, buf.toString());
- }
-
- /**
- * Logs a very common registry error when a required attribute is missing.
- */
- protected void logMissingAttribute(IConfigurationElement element, String attributeName) {
- logError(element, "Required attribute '" + attributeName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * Logs a registry error when the configuration element is unknown.
- */
- protected void logUnknownElement(IConfigurationElement element) {
- logError(element, "Unknown extension tag found: " + element.getName()); //$NON-NLS-1$
- }
-
- /**
- * Apply a reproducable order to the list of extensions provided, such
- * that the order will not change as extensions are added or removed.
- */
- protected IExtension[] orderExtensions(IExtension[] extensions) {
- // By default, the order is based on plugin id sorted
- // in ascending order. The order for a plugin providing
- // more than one extension for an extension point is
- // dependent in the order listed in the XML file.
- Sorter sorter = new Sorter() {
- public boolean compare(Object extension1, Object extension2) {
- String s1 = ((IExtension) extension1).getNamespace().toUpperCase();
- String s2 = ((IExtension) extension2).getNamespace().toUpperCase();
- //Return true if elementTwo is 'greater than' elementOne
- return s2.compareTo(s1) > 0;
- }
- };
-
- Object[] sorted = sorter.sort(extensions);
- IExtension[] sortedExtension = new IExtension[sorted.length];
- System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length);
- return sortedExtension;
- }
-
- /**
- * Implement this method to read element's attributes. If children should
- * also be read, then implementor is responsible for calling
- * <code>readElementChildren</code>. Implementor is also responsible
- * for logging missing attributes.
- *
- * @return true if element was recognized, false if not.
- */
- protected abstract boolean readElement(IConfigurationElement element);
-
- /**
- * Read the element's children. This is called by the subclass'
- * readElement method when it wants to read the children of the element.
- */
- protected void readElementChildren(IConfigurationElement element) {
- readElements(element.getChildren());
- }
-
- /**
- * Read each element one at a time by calling the subclass implementation
- * of <code>readElement</code>.
- *
- * Logs an error if the element was not recognized.
- */
- protected void readElements(IConfigurationElement[] elements) {
- for (int i = 0; i < elements.length; i++) {
- if (!readElement(elements[i]))
- logUnknownElement(elements[i]);
- }
- }
-
- /**
- * Read one extension by looping through its configuration elements.
- */
- protected void readExtension(IExtension extension) {
- readElements(extension.getConfigurationElements());
- }
-
- /**
- * @deprecated use readRegistry(IExtensionRegistry registry, String pluginId, String extensionPoint)
- */
- protected void readRegistry(IPluginRegistry registry, String pluginId, String extensionPoint) {
- IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- extensions = orderExtensions(extensions);
- for (int i = 0; i < extensions.length; i++)
- readExtension(extensions[i]);
- }
- }
-
- /**
- * Start the registry reading process using the supplied plugin ID and
- * extension point.
- */
- protected void readRegistry(IExtensionRegistry registry, String pluginId, String extensionPoint) {
- IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- extensions = orderExtensions(extensions);
- for (int i = 0; i < extensions.length; i++)
- readExtension(extensions[i]);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/format/StructuredFormattingStrategy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/format/StructuredFormattingStrategy.java
deleted file mode 100644
index 417ad2750e..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/format/StructuredFormattingStrategy.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.format;
-
-import java.io.IOException;
-import java.util.LinkedList;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.TypedPosition;
-import org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy;
-import org.eclipse.jface.text.formatter.FormattingContextProperties;
-import org.eclipse.jface.text.formatter.IFormattingContext;
-import org.eclipse.wst.sse.core.internal.format.IStructuredFormatProcessor;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-
-public class StructuredFormattingStrategy extends ContextBasedFormattingStrategy {
-
- /** Documents to be formatted by this strategy */
- private final LinkedList fDocuments = new LinkedList();
- private IStructuredFormatProcessor fFormatProcessor;
- /** Partitions to be formatted by this strategy */
- private final LinkedList fPartitions = new LinkedList();
- private IRegion fRegion;
-
- /**
- * @param formatProcessor
- */
- public StructuredFormattingStrategy(IStructuredFormatProcessor formatProcessor) {
- super();
-
- fFormatProcessor = formatProcessor;
- }
-
- /*
- * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#format()
- */
- public void format() {
- super.format();
-
- final IDocument document = (IDocument) fDocuments.removeFirst();
- final TypedPosition partition = (TypedPosition) fPartitions.removeFirst();
-
- if (document != null && partition != null && fRegion != null && fFormatProcessor != null) {
- try {
- fFormatProcessor.formatDocument(document, fRegion.getOffset(), fRegion.getLength());
- }
- catch (IOException e) {
- // log for now, unless we find reason not to
- Logger.log(Logger.INFO, e.getMessage());
- }
- catch (CoreException e) {
- // log for now, unless we find reason not to
- Logger.log(Logger.INFO, e.getMessage());
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#formatterStarts(org.eclipse.jface.text.formatter.IFormattingContext)
- */
- public void formatterStarts(final IFormattingContext context) {
- super.formatterStarts(context);
-
- fPartitions.addLast(context.getProperty(FormattingContextProperties.CONTEXT_PARTITION));
- fDocuments.addLast(context.getProperty(FormattingContextProperties.CONTEXT_MEDIUM));
- fRegion = (IRegion) context.getProperty(FormattingContextProperties.CONTEXT_REGION);
- }
-
- /*
- * @see org.eclipse.jface.text.formatter.ContextBasedFormattingStrategy#formatterStops()
- */
- public void formatterStops() {
- super.formatterStops();
-
- fPartitions.clear();
- fDocuments.clear();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/hyperlink/HighlighterHyperlinkPresenter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/hyperlink/HighlighterHyperlinkPresenter.java
deleted file mode 100644
index 5085fa4c43..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/hyperlink/HighlighterHyperlinkPresenter.java
+++ /dev/null
@@ -1,468 +0,0 @@
-package org.eclipse.wst.sse.ui.internal.hyperlink;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextInputListener;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension2;
-import org.eclipse.jface.text.ITextViewerExtension5;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.text.hyperlink.IHyperlinkPresenter;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
-
-
-/**
- * The is almost an exact copy of DefaultHyperlinkPresenter. However this
- * hyperlink presenter works with the StructuredTextEditor's Highlighter
- * instead of TextPresentation.
- *
- * The main difference is <code>text.redrawRange(offset, length, true);</code>
- * is called instead of passing false for clearBackground. Also all mention of
- * TextPresentation was removed since it does not really apply.
- *
- * @see org.eclipse.jface.text.hyperlink.DefaultHyperlinkPresenter
- */
-public class HighlighterHyperlinkPresenter implements IHyperlinkPresenter, PaintListener, ITextInputListener, IDocumentListener, IPropertyChangeListener {
-
- /**
- * A named preference that holds the color used for hyperlinks.
- * <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a
- * string using class <code>PreferenceConverter</code>
- * </p>
- *
- * @see org.eclipse.jface.resource.StringConverter
- * @see org.eclipse.jface.preference.PreferenceConverter
- */
- public final static String HYPERLINK_COLOR = "hyperlinkColor"; //$NON-NLS-1$
-
-
- /** The text viewer. */
- private ITextViewer fTextViewer;
- /** The hand cursor. */
- private Cursor fCursor;
- /** The link color. */
- private Color fColor;
- /** Tells whether to dispose the color on uninstall. */
- private boolean fDisposeColor;
- /** The currently active region. */
- private IRegion fActiveRegion;
- /** The currently active style range as position. */
- private Position fRememberedPosition;
- /** The optional preference store */
- private IPreferenceStore fPreferenceStore;
-
-
- /**
- * Creates a new default hyperlink presenter which uses
- * {@link #HYPERLINK_COLOR}to read the color from the given preference
- * store.
- *
- * @param store
- * the preference store
- */
- public HighlighterHyperlinkPresenter(IPreferenceStore store) {
- fPreferenceStore = store;
- fDisposeColor = true;
- }
-
- /**
- * Creates a new default hyperlink presenter.
- *
- * @param color
- * the hyperlink color, to be disposed by the caller
- */
- public HighlighterHyperlinkPresenter(Color color) {
- fDisposeColor = false;
- fColor = color;
- }
-
- public boolean canShowMultipleHyperlinks() {
- return false;
- }
-
- public void showHyperlinks(IHyperlink[] hyperlinks) {
- Assert.isLegal(hyperlinks != null && hyperlinks.length == 1);
- highlightRegion(hyperlinks[0].getHyperlinkRegion());
- activateCursor();
- }
-
- public void hideHyperlinks() {
- repairRepresentation();
- fRememberedPosition = null;
- }
-
- public void install(ITextViewer textViewer) {
- Assert.isNotNull(textViewer);
- fTextViewer = textViewer;
- fTextViewer.addTextInputListener(this);
-
- StyledText text = fTextViewer.getTextWidget();
- if (text != null && !text.isDisposed()) {
- text.addPaintListener(this);
- if (fPreferenceStore != null)
- fColor = createColor(fPreferenceStore, HYPERLINK_COLOR, text.getDisplay());
- }
-
- if (fPreferenceStore != null)
- fPreferenceStore.addPropertyChangeListener(this);
- }
-
- public void uninstall() {
- fTextViewer.removeTextInputListener(this);
-
- if (fColor != null) {
- if (fDisposeColor)
- fColor.dispose();
- fColor = null;
- }
-
- if (fCursor != null) {
- fCursor.dispose();
- fCursor = null;
- }
-
- StyledText text = fTextViewer.getTextWidget();
- if (text != null && !text.isDisposed())
- text.removePaintListener(this);
-
- fTextViewer = null;
-
- if (fPreferenceStore != null)
- fPreferenceStore.removePropertyChangeListener(this);
- }
-
- public void setColor(Color color) {
- Assert.isNotNull(fTextViewer);
- fColor = color;
- }
-
- private void highlightRegion(IRegion region) {
-
- if (region.equals(fActiveRegion))
- return;
-
- repairRepresentation();
-
- StyledText text = fTextViewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
-
-
- // Underline
- int offset = 0;
- int length = 0;
- if (fTextViewer instanceof ITextViewerExtension5) {
- ITextViewerExtension5 extension = (ITextViewerExtension5) fTextViewer;
- IRegion widgetRange = extension.modelRange2WidgetRange(region);
- if (widgetRange == null)
- return;
-
- offset = widgetRange.getOffset();
- length = widgetRange.getLength();
-
- }
- else {
- offset = region.getOffset() - fTextViewer.getVisibleRegion().getOffset();
- length = region.getLength();
- }
-
- // needs to clean background due to StructuredTextEditor's highlighter
- text.redrawRange(offset, length, true);
-
- // Invalidate region ==> apply text presentation
- fActiveRegion = region;
-
- if (fTextViewer instanceof ITextViewerExtension2)
- ((ITextViewerExtension2) fTextViewer).invalidateTextPresentation(region.getOffset(), region.getLength());
- else
- fTextViewer.invalidateTextPresentation();
- }
-
- private void activateCursor() {
- StyledText text = fTextViewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
- Display display = text.getDisplay();
- if (fCursor == null)
- fCursor = new Cursor(display, SWT.CURSOR_HAND);
- text.setCursor(fCursor);
- }
-
- private void resetCursor() {
- StyledText text = fTextViewer.getTextWidget();
- if (text != null && !text.isDisposed())
- text.setCursor(null);
-
- if (fCursor != null) {
- fCursor.dispose();
- fCursor = null;
- }
- }
-
- private void repairRepresentation() {
-
- if (fActiveRegion == null)
- return;
-
- int offset = fActiveRegion.getOffset();
- int length = fActiveRegion.getLength();
- fActiveRegion = null;
-
- resetCursor();
-
- // Invalidate ==> remove applied text presentation
- if (fTextViewer instanceof ITextViewerExtension2)
- ((ITextViewerExtension2) fTextViewer).invalidateTextPresentation(offset, length);
- else
- fTextViewer.invalidateTextPresentation();
-
- // Remove underline
- if (fTextViewer instanceof ITextViewerExtension5) {
- ITextViewerExtension5 extension = (ITextViewerExtension5) fTextViewer;
- offset = extension.modelOffset2WidgetOffset(offset);
- }
- else {
- offset -= fTextViewer.getVisibleRegion().getOffset();
- }
- try {
- StyledText text = fTextViewer.getTextWidget();
-
- // needs to clean background due to StructuredTextEditor's
- // highlighter
- text.redrawRange(offset, length, true);
-
- }
- catch (IllegalArgumentException x) {
- // ignore - do not log
- }
- }
-
- /*
- * @see PaintListener#paintControl(PaintEvent)
- */
- public void paintControl(PaintEvent event) {
- if (fActiveRegion == null)
- return;
-
- StyledText text = fTextViewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
-
- int offset = 0;
- int length = 0;
-
- if (fTextViewer instanceof ITextViewerExtension5) {
-
- ITextViewerExtension5 extension = (ITextViewerExtension5) fTextViewer;
- IRegion widgetRange = extension.modelRange2WidgetRange(fActiveRegion);
- if (widgetRange == null)
- return;
-
- offset = widgetRange.getOffset();
- length = widgetRange.getLength();
-
- }
- else {
-
- IRegion region = fTextViewer.getVisibleRegion();
- if (!includes(region, fActiveRegion))
- return;
-
- offset = fActiveRegion.getOffset() - region.getOffset();
- length = fActiveRegion.getLength();
- }
-
- // support for BIDI
- Point minLocation = getMinimumLocation(text, offset, length);
- Point maxLocation = getMaximumLocation(text, offset, length);
-
- int x1 = minLocation.x;
- int x2 = maxLocation.x - 1;
- int y = minLocation.y + text.getLineHeight() - 1;
-
- GC gc = event.gc;
- if (fColor != null && !fColor.isDisposed())
- gc.setForeground(fColor);
- else if (fColor == null && !(offset < 0 && offset >= text.getCharCount())) {
- StyleRange style = text.getStyleRangeAtOffset(offset);
- if (style != null)
- gc.setForeground(style.foreground);
- }
- gc.drawLine(x1, y, x2, y);
- }
-
- private Point getMinimumLocation(StyledText text, int offset, int length) {
- int max = text.getCharCount();
- Rectangle bounds = text.getBounds();
- Point minLocation = new Point(bounds.width, bounds.height);
- for (int i = 0; i <= length; i++) {
- int k = offset + i;
- if (k < 0 || k > max)
- break;
-
- Point location = text.getLocationAtOffset(k);
- if (location.x < minLocation.x)
- minLocation.x = location.x;
- if (location.y < minLocation.y)
- minLocation.y = location.y;
- }
-
- return minLocation;
- }
-
- private Point getMaximumLocation(StyledText text, int offset, int length) {
- Point maxLocation = new Point(0, 0);
-
- for (int i = 0; i <= length; i++) {
- int k = offset + i;
- if (k < 0 || k > text.getCharCount())
- break;
-
- Point location = text.getLocationAtOffset(k);
- if (location.x > maxLocation.x)
- maxLocation.x = location.x;
- if (location.y > maxLocation.y)
- maxLocation.y = location.y;
- }
-
- return maxLocation;
- }
-
- private boolean includes(IRegion region, IRegion position) {
- return position.getOffset() >= region.getOffset() && position.getOffset() + position.getLength() <= region.getOffset() + region.getLength();
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- if (fActiveRegion != null) {
- fRememberedPosition = new Position(fActiveRegion.getOffset(), fActiveRegion.getLength());
- try {
- event.getDocument().addPosition(fRememberedPosition);
- }
- catch (BadLocationException x) {
- fRememberedPosition = null;
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- if (fRememberedPosition != null) {
- if (!fRememberedPosition.isDeleted()) {
-
- event.getDocument().removePosition(fRememberedPosition);
- fActiveRegion = new Region(fRememberedPosition.getOffset(), fRememberedPosition.getLength());
- fRememberedPosition = null;
-
- StyledText widget = fTextViewer.getTextWidget();
- if (widget != null && !widget.isDisposed()) {
- widget.getDisplay().asyncExec(new Runnable() {
- public void run() {
- hideHyperlinks();
- }
- });
- }
-
- }
- else {
- fActiveRegion = null;
- fRememberedPosition = null;
- hideHyperlinks();
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument,
- * org.eclipse.jface.text.IDocument)
- */
- public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
- if (oldInput == null)
- return;
- hideHyperlinks();
- oldInput.removeDocumentListener(this);
- }
-
- /*
- * @see org.eclipse.jface.text.ITextInputListener#inputDocumentChanged(org.eclipse.jface.text.IDocument,
- * org.eclipse.jface.text.IDocument)
- */
- public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
- if (newInput == null)
- return;
- newInput.addDocumentListener(this);
- }
-
- /**
- * Creates a color from the information stored in the given preference
- * store.
- *
- * @param store
- * the preference store
- * @param key
- * the key
- * @param display
- * the display
- * @return the color or <code>null</code> if there is no such
- * information available
- */
- private Color createColor(IPreferenceStore store, String key, Display display) {
-
- RGB rgb = null;
-
- if (store.contains(key)) {
-
- if (store.isDefault(key))
- rgb = PreferenceConverter.getDefaultColor(store, key);
- else
- rgb = PreferenceConverter.getColor(store, key);
-
- if (rgb != null)
- return new Color(display, rgb);
- }
-
- return null;
- }
-
- /*
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (!HYPERLINK_COLOR.equals(event.getProperty()))
- return;
-
- if (fDisposeColor && fColor != null && !fColor.isDisposed())
- fColor.dispose();
- fColor = null;
-
- StyledText textWidget = fTextViewer.getTextWidget();
- if (textWidget != null && !textWidget.isDisposed())
- fColor = createColor(fPreferenceStore, HYPERLINK_COLOR, textWidget.getDisplay());
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/hyperlink/OpenHyperlinkAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/hyperlink/OpenHyperlinkAction.java
deleted file mode 100644
index 9994523a7b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/hyperlink/OpenHyperlinkAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.wst.sse.ui.internal.hyperlink;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-
-/**
- * Open hyperlink action
- */
-public class OpenHyperlinkAction extends TextEditorAction {
- private IHyperlinkDetector[] fHyperlinkDetectors;
- private ITextViewer fTextViewer;
-
- public OpenHyperlinkAction(ResourceBundle bundle, String prefix, ITextEditor editor, ITextViewer viewer) {
- super(bundle, prefix, editor);
- fTextViewer = viewer;
- }
-
- public void setHyperlinkDetectors(IHyperlinkDetector[] detectors) {
- fHyperlinkDetectors = detectors;
- }
-
- public void run() {
- if (fHyperlinkDetectors == null)
- return;
- ISelection selection = getTextEditor().getSelectionProvider().getSelection();
- if (selection == null || !(selection instanceof ITextSelection)) {
- return;
- }
-
- ITextSelection textSelection = (ITextSelection) selection;
- IRegion region = new Region(textSelection.getOffset(), textSelection.getLength());
- IHyperlink hyperlink = null;
-
- synchronized (fHyperlinkDetectors) {
- for (int i = 0, length = fHyperlinkDetectors.length; i < length && hyperlink == null; i++) {
- IHyperlinkDetector detector = fHyperlinkDetectors[i];
- if (detector == null)
- continue;
-
- IHyperlink[] hyperlinks = detector.detectHyperlinks(fTextViewer, region, false);
- if (hyperlinks == null)
- continue;
-
- if (hyperlinks.length > 0)
- hyperlink = hyperlinks[0];
- }
- }
- if (hyperlink != null) {
- /**
- * Force the highlight range to change when the hyperlink is
- * opened by altering the highlighted range beforehand.
- */
- getTextEditor().setHighlightRange(Math.max(0, region.getOffset() - 1), 0, false);
- hyperlink.open();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/AbstractOpenOn.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/AbstractOpenOn.java
deleted file mode 100644
index 8bcf216b48..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/AbstractOpenOn.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.openon;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.swt.program.Program;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil;
-
-
-/**
- * This action class retrieves the link/file selected by the cursor and
- * attempts to open the link/file in the default editor or web browser
- *
- * @deprecated Use base support for hyperlink navigation
- */
-abstract public class AbstractOpenOn implements IOpenOn {
- protected final String CANNOT_OPEN = SSEUIMessages.AbstractOpenOn_0; //$NON-NLS-1$
- // document currently associated with open
- private IDocument fDocument;
- protected final String FILE_PROTOCOL = "file:/";//$NON-NLS-1$
- private final String HTTP_PROTOCOL = "http://";//$NON-NLS-1$
-
- abstract protected IRegion doGetOpenOnRegion(int offset);
-
- abstract protected void doOpenOn(IRegion region);
-
- /**
- * Returns the current document associated with open on
- *
- * @return IDocument
- */
- public IDocument getDocument() {
- return fDocument;
- }
-
- /**
- * Determines the editor associated with the given file name
- *
- * @param filename
- * @return editor id of the editor associated with the given file name
- */
- private String getEditorId(String filename) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IEditorRegistry editorRegistry = workbench.getEditorRegistry();
- IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(filename);
- if (descriptor != null)
- return descriptor.getId();
- return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
- }
-
- /**
- * Returns an IFile from the given uri if possible, null if cannot find
- * file from uri.
- *
- * @param fileString
- * file system path
- * @return returns IFile if fileString exists in the workspace
- */
- protected IFile getFile(String fileString) {
- IStructuredModel model = null;
- IFile file = null;
- try {
- model = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
- if (model != null) {
- // use the base location to obtain the in-workspace IFile
- IFile modelFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(model.getBaseLocation()));
- if (modelFile != null) {
- // find the referenced file's location on disk
- String filesystemLocation = model.getResolver().getLocationByURI(fileString);
- if (filesystemLocation != null) {
- IFile[] workspaceFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(filesystemLocation));
- // favor a workspace file in the same project
- for (int i = 0; i < workspaceFiles.length && file == null; i++) {
- if (workspaceFiles[i].getProject().equals(modelFile.getProject())) {
- file = workspaceFiles[i];
- }
- }
- // if none were in the same project, just pick one
- if (file == null && workspaceFiles.length > 0) {
- file = workspaceFiles[0];
- }
- }
- }
- }
- }
- catch (Exception e) {
- Logger.log(Logger.WARNING, e.getMessage());
- }
- finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- if (file == null && fileString.startsWith("/")) { //$NON-NLS-1$
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fileString));
- }
- return file;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.IOpenOn#getOpenOnRegion(org.eclipse.jface.text.IDocument,
- * int)
- */
- public IRegion getOpenOnRegion(IDocument doc, int offset) {
- IRegion region;
- // set the document for this action
- setDocument(doc);
- region = doGetOpenOnRegion(offset);
- // reset the document back to null for this action
- setDocument(null);
- return region;
- }
-
- /**
- * Try to open the external file, fileString in its default editor
- *
- * @param fileString
- * @return IEditorPart editor opened or null if editor could not be opened
- */
- protected IEditorPart openExternalFile(String fileString) {
- // file does not exist in workspace so try to open using system editor
- File file = new File(fileString);
- // try to open existing external file if it exists
- if (file.exists()) {
- IEditorInput input = new ExternalFileEditorInput(file);
- String editorId = getEditorId(fileString);
-
- try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- return page.openEditor(input, editorId, true);
- }
- catch (PartInitException pie) {
- Logger.log(Logger.WARNING_DEBUG, pie.getMessage(), pie);
- }
- }
- return null;
- }
-
- /**
- * Notifies user that open on selection action could not successfully open
- * the selection (writes message on status bar and beeps)
- */
- protected void openFileFailed() {
- PlatformStatusLineUtil.displayErrorMessage(CANNOT_OPEN);
- PlatformStatusLineUtil.addOneTimeClearListener();
- }
-
- /**
- * Opens the IFile, input in its default editor, if possible, and returns
- * the editor opened. Possible reasons for failure: input cannot be found,
- * input does not exist in workbench, editor cannot be opened.
- *
- * @return IEditorPart editor opened or null if input == null or does not
- * exist, external editor was opened, editor could not be opened
- */
- protected IEditorPart openFileInEditor(IFile input) {
- if (input != null && input.exists()) {
- try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- return IDE.openEditor(page, input, true);
- }
- catch (PartInitException pie) {
- Logger.log(Logger.WARNING_DEBUG, pie.getMessage(), pie);
- }
- }
- return null;
- }
-
- // on
-
- /**
- * Opens the appropriate editor for fileString
- *
- * @param fileString
- */
- protected void openFileInEditor(String fileString) {
- IEditorPart editor = null;
- if (fileString != null) {
- // open web browser if this is a web address
- String temp = fileString.toLowerCase();
- if (temp.startsWith(HTTP_PROTOCOL)) {
- Program.launch(fileString); // launches web browser/executable
- // associated with uri
- return;
- }
- // chop off the file protocol
- if (temp.startsWith(FILE_PROTOCOL)) {
- fileString = fileString.substring(FILE_PROTOCOL.length());
- }
-
- // try to locate the file in the workspace and return an IFile if
- // found
- IFile file = getFile(fileString);
- if (file != null) {
- // file exists in workspace
- editor = openFileInEditor(file);
- }
- else {
- // file does not exist in workspace
- editor = openExternalFile(fileString);
- }
- }
- // no editor was opened
- if (editor == null) {
- openFileFailed();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.IOpenOn#openOn(org.eclipse.jface.text.IDocument,
- * org.eclipse.jface.text.IRegion)
- */
- public void openOn(IDocument doc, IRegion region) {
- // set the document for this action
- setDocument(doc);
- // if no region was given this action fails
- if (region == null)
- openFileFailed();
- else
- doOpenOn(region);
- // reset the document back to null for this action
- setDocument(null);
- }
-
- /**
- * Sets current document associated with open on
- *
- * @param document
- */
- public void setDocument(IDocument document) {
- fDocument = document;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/ExternalFileEditorInput.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/ExternalFileEditorInput.java
deleted file mode 100644
index 58eb65861f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/ExternalFileEditorInput.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.openon;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.editors.text.ILocationProvider;
-
-/**
- * EditorInput for external files. Copied from
- * org.eclipse.ui.internal.editors.text.JavaFileEditorInput
- *
- * @deprecated Use base support for hyperlink navigation
- */
-public class ExternalFileEditorInput implements IEditorInput, ILocationProvider {
-
- private File fFile;
-
- public ExternalFileEditorInput(File file) {
- super();
- fFile = file;
- }
-
- /*
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object o) {
- if (o == this)
- return true;
-
- if (o instanceof ExternalFileEditorInput) {
- ExternalFileEditorInput input = (ExternalFileEditorInput) o;
- return fFile.equals(input.fFile);
- }
-
- return false;
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- public boolean exists() {
- return fFile.exists();
- }
-
- /*
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- public Object getAdapter(Class adapter) {
- if (ILocationProvider.class.equals(adapter))
- return this;
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- public String getName() {
- return fFile.getName();
- }
-
- /*
- * @see org.eclipse.ui.editors.text.ILocationProvider#getPath(java.lang.Object)
- */
- public IPath getPath(Object element) {
- if (element instanceof ExternalFileEditorInput) {
- ExternalFileEditorInput input = (ExternalFileEditorInput) element;
- return new Path(input.fFile.getAbsolutePath());
- }
- return null;
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /*
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- public String getToolTipText() {
- return fFile.getAbsolutePath();
- }
-
- /*
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return fFile.hashCode();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/IOpenOn.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/IOpenOn.java
deleted file mode 100644
index ec4b292ffe..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/IOpenOn.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.openon;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-
-/**
- * Interface for Open On... navigation
- *
- * @author amywu
- */
-public interface IOpenOn {
- /**
- * Returns the entire region relevant to the current offset where an
- * openable source region is found. null if offset does not contain an
- * openable source.
- *
- * @param document
- * IDocument
- * @param offset
- * int
- * @return IRegion entire region of openable source
- */
- public IRegion getOpenOnRegion(IDocument document, int offset);
-
- /**
- * Opens the file/source relevant to region if possible.
- *
- * @param viewer
- * ITextViewer
- * @param region
- * Region to examine
- */
- public void openOn(IDocument document, IRegion region);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenFileHyperlinkTracker.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenFileHyperlinkTracker.java
deleted file mode 100644
index e4e8659b03..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenFileHyperlinkTracker.java
+++ /dev/null
@@ -1,660 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.openon;
-
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextInputListener;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension5;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
-
-
-/**
- * @deprecated Use org.eclipse.jface.text.hyperlink.HyperlinkManager
- */
-public class OpenFileHyperlinkTracker implements KeyListener, MouseListener, MouseMoveListener, FocusListener, PaintListener, IPropertyChangeListener, IDocumentListener, ITextInputListener {
-
- /** The session is active. */
- private boolean fActive;
-
- /** The currently active style range. */
- private IRegion fActiveRegion;
- /** Preference key for browser-like links to be enabled */
- private String fBrowserLikeLinksKeyModifierKey;
-
- /** The link color. */
- private Color fColor;
- /** The hand cursor. */
- private Cursor fCursor;
- /** The key modifier mask. */
- private int fKeyModifierMask;
- /** Preference key for hyperlink underline color */
- private String fLinkColorKey;
- /** The preference store */
- private IPreferenceStore fPreferenceStore;
- /** The currently active style range as position. */
- private Position fRememberedPosition;
-
- /** The text viewer this hyperlink tracker is associated with */
- private ITextViewer fTextViewer;
-
- /**
- *
- */
- public OpenFileHyperlinkTracker(ITextViewer textViewer) {
- fTextViewer = textViewer;
- }
-
- private void activateCursor(ITextViewer viewer) {
- StyledText text = viewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
- Display display = text.getDisplay();
- if (fCursor == null)
- fCursor = new Cursor(display, SWT.CURSOR_HAND);
- text.setCursor(fCursor);
- }
-
- private int computeStateMask(String modifiers) {
- if (modifiers == null)
- return -1;
-
- if (modifiers.length() == 0)
- return SWT.NONE;
-
- int stateMask = 0;
- StringTokenizer modifierTokenizer = new StringTokenizer(modifiers, ",;.:+-* "); //$NON-NLS-1$
- while (modifierTokenizer.hasMoreTokens()) {
- int modifier = EditorUtility.findLocalizedModifier(modifierTokenizer.nextToken());
- if (modifier == 0 || (stateMask & modifier) == modifier)
- return -1;
- stateMask = stateMask | modifier;
- }
- return stateMask;
- }
-
- /**
- * Creates a color from the information stored in the given preference
- * store. Returns <code>null</code> if there is no such information
- * available.
- */
- private Color createColor(IPreferenceStore store, String key, Display display) {
-
- RGB rgb = null;
-
- if (store.contains(key)) {
-
- if (store.isDefault(key))
- rgb = PreferenceConverter.getDefaultColor(store, key);
- else
- rgb = PreferenceConverter.getColor(store, key);
- }
-
- return EditorUtility.getColor(rgb);
- }
-
- public void deactivate() {
- deactivate(false);
- }
-
- public void deactivate(boolean redrawAll) {
- if (!fActive)
- return;
-
- repairRepresentation(redrawAll);
- fActive = false;
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentAboutToBeChanged(DocumentEvent event) {
- if (fActive && fActiveRegion != null) {
- fRememberedPosition = new Position(fActiveRegion.getOffset(), fActiveRegion.getLength());
- try {
- event.getDocument().addPosition(fRememberedPosition);
- } catch (BadLocationException x) {
- fRememberedPosition = null;
- }
- }
- }
-
- /*
- * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
- */
- public void documentChanged(DocumentEvent event) {
- if (fRememberedPosition != null) {
- if (!fRememberedPosition.isDeleted()) {
-
- event.getDocument().removePosition(fRememberedPosition);
- fActiveRegion = new Region(fRememberedPosition.getOffset(), fRememberedPosition.getLength());
- fRememberedPosition = null;
-
- ITextViewer viewer = getTextViewer();
- if (viewer != null) {
- StyledText widget = viewer.getTextWidget();
- if (widget != null && !widget.isDisposed()) {
- widget.getDisplay().asyncExec(new Runnable() {
- public void run() {
- deactivate();
- }
- });
- }
- }
-
- } else {
- fActiveRegion = null;
- fRememberedPosition = null;
- deactivate();
- }
- }
- }
-
- /*
- * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- }
-
- /*
- * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
- */
- public void focusLost(FocusEvent event) {
- deactivate();
- }
-
- private int getCurrentTextOffset() {
- try {
- StyledText text = getTextViewer().getTextWidget();
- if (text == null || text.isDisposed())
- return -1;
-
- Display display = text.getDisplay();
- Point absolutePosition = display.getCursorLocation();
- Point relativePosition = text.toControl(absolutePosition);
-
- int widgetOffset = text.getOffsetAtLocation(relativePosition);
- if (getTextViewer() instanceof ITextViewerExtension5) {
- ITextViewerExtension5 extension = (ITextViewerExtension5) getTextViewer();
- return extension.widgetOffset2ModelOffset(widgetOffset);
- } else {
- return widgetOffset + getTextViewer().getVisibleRegion().getOffset();
- }
-
- } catch (IllegalArgumentException e) {
- return -1;
- }
- }
-
- private Point getMaximumLocation(StyledText text, int offset, int length) {
- Point maxLocation = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE);
-
- for (int i = 0; i <= length; i++) {
- Point location = text.getLocationAtOffset(offset + i);
-
- if (location.x > maxLocation.x)
- maxLocation.x = location.x;
- if (location.y > maxLocation.y)
- maxLocation.y = location.y;
- }
-
- return maxLocation;
- }
-
- private Point getMinimumLocation(StyledText text, int offset, int length) {
- Point minLocation = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
-
- for (int i = 0; i <= length; i++) {
- Point location = text.getLocationAtOffset(offset + i);
-
- if (location.x < minLocation.x)
- minLocation.x = location.x;
- if (location.y < minLocation.y)
- minLocation.y = location.y;
- }
-
- return minLocation;
- }
-
- private IPreferenceStore getNewPreferenceStore() {
- return fPreferenceStore;
- }
-
- private ITextViewer getTextViewer() {
- return fTextViewer;
- }
-
- private void highlightRegion(ITextViewer viewer, IRegion region) {
-
- if (region.equals(fActiveRegion))
- return;
-
- repairRepresentation();
-
- StyledText text = viewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
-
-
- // Underline
- int offset = 0;
- int length = 0;
- if (viewer instanceof ITextViewerExtension5) {
- ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
- IRegion widgetRange = extension.modelRange2WidgetRange(new Region(region.getOffset(), region.getLength()));
- if (widgetRange == null)
- return;
-
- offset = widgetRange.getOffset();
- length = widgetRange.getLength();
-
- } else {
- offset = region.getOffset() - viewer.getVisibleRegion().getOffset();
- length = region.getLength();
- }
- // need clearBackground to be true for paint event to be fired
- text.redrawRange(offset, length, true);
-
- fActiveRegion = region;
- }
-
- private boolean includes(IRegion region, IRegion position) {
- return position.getOffset() >= region.getOffset() && position.getOffset() + position.getLength() <= region.getOffset() + region.getLength();
- }
-
- /*
- * @see org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument,
- * org.eclipse.jface.text.IDocument)
- */
- public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
- if (oldInput == null)
- return;
- deactivate();
- oldInput.removeDocumentListener(this);
- }
-
- /*
- * @see org.eclipse.jface.text.ITextInputListener#inputDocumentChanged(org.eclipse.jface.text.IDocument,
- * org.eclipse.jface.text.IDocument)
- */
- public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
- if (newInput == null)
- return;
- newInput.addDocumentListener(this);
- }
-
- public void install(IPreferenceStore store) {
- fPreferenceStore = store;
- ITextViewer textViewer = getTextViewer();
- if (textViewer == null)
- return;
-
- StyledText text = textViewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
-
- updateColor(textViewer);
-
- textViewer.addTextInputListener(this);
-
- IDocument document = textViewer.getDocument();
- if (document != null)
- document.addDocumentListener(this);
-
- text.addKeyListener(this);
- text.addMouseListener(this);
- text.addMouseMoveListener(this);
- text.addFocusListener(this);
- text.addPaintListener(this);
-
- updateKeyModifierMask();
-
- fPreferenceStore.addPropertyChangeListener(this);
- }
-
- /*
- * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
- */
- public void keyPressed(KeyEvent event) {
-
- if (fActive) {
- deactivate();
- return;
- }
-
- if (event.keyCode != fKeyModifierMask) {
- deactivate();
- return;
- }
-
- fActive = true;
-
- // removed for #25871
- //
- // ISourceViewer viewer= getSourceViewer();
- // if (viewer == null)
- // return;
- //
- // IRegion region= getCurrentTextRegion(viewer);
- // if (region == null)
- // return;
- //
- // highlightRegion(viewer, region);
- // activateCursor(viewer);
- }
-
- /*
- * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
- */
- public void keyReleased(KeyEvent event) {
-
- if (!fActive)
- return;
-
- deactivate();
- }
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDown(MouseEvent event) {
-
- if (!fActive)
- return;
-
- if (event.stateMask != fKeyModifierMask) {
- deactivate();
- return;
- }
-
- if (event.button != 1) {
- deactivate();
- return;
- }
- }
-
- /*
- * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseMove(MouseEvent event) {
-
- if (event.widget instanceof Control && !((Control) event.widget).isFocusControl()) {
- deactivate();
- return;
- }
-
- if (!fActive) {
- if (event.stateMask != fKeyModifierMask)
- return;
- // modifier was already pressed
- fActive = true;
- }
-
- ITextViewer viewer = getTextViewer();
- if (viewer == null) {
- deactivate();
- return;
- }
-
- StyledText text = viewer.getTextWidget();
- if (text == null || text.isDisposed()) {
- deactivate();
- return;
- }
-
- if ((event.stateMask & SWT.BUTTON1) != 0 && text.getSelectionCount() != 0) {
- deactivate();
- return;
- }
-
- IRegion region = null;
- int offset = getCurrentTextOffset();
- IOpenOn openOn = OpenOnProvider.getInstance().getOpenOn(getTextViewer().getDocument(), offset);
- if (openOn != null) {
- region = openOn.getOpenOnRegion(getTextViewer().getDocument(), offset);
- }
- if (region == null || region.getLength() == 0) {
- repairRepresentation();
- return;
- }
-
- highlightRegion(viewer, region);
- activateCursor(viewer);
- }
-
- /*
- * @see org.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseUp(MouseEvent e) {
-
- if (!fActive)
- return;
-
- if (e.button != 1) {
- deactivate();
- return;
- }
-
- boolean wasActive = fCursor != null;
- IRegion previousRegion = fActiveRegion;
-
- deactivate();
-
- if (wasActive) {
- IOpenOn openOn = OpenOnProvider.getInstance().getOpenOn(getTextViewer().getDocument(), previousRegion.getOffset());
- if (openOn != null) {
- openOn.openOn(getTextViewer().getDocument(), previousRegion);
- }
- }
- }
-
- /*
- * @see PaintListener#paintControl(PaintEvent)
- */
- public void paintControl(PaintEvent event) {
- if (fActiveRegion == null)
- return;
-
- ITextViewer viewer = getTextViewer();
- if (viewer == null)
- return;
-
- StyledText text = viewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
-
-
- int offset = 0;
- int length = 0;
-
- if (viewer instanceof ITextViewerExtension5) {
-
- ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
- IRegion widgetRange = extension.modelRange2WidgetRange(fActiveRegion);
- if (widgetRange == null)
- return;
-
- offset = widgetRange.getOffset();
- length = widgetRange.getLength();
-
- } else {
-
- IRegion region = viewer.getVisibleRegion();
- if (!includes(region, fActiveRegion))
- return;
-
- offset = fActiveRegion.getOffset() - region.getOffset();
- length = fActiveRegion.getLength();
- }
-
- // support for bidi
- Point minLocation = getMinimumLocation(text, offset, length);
- Point maxLocation = getMaximumLocation(text, offset, length);
-
- int x1 = minLocation.x;
- int x2 = minLocation.x + maxLocation.x - minLocation.x - 1;
- int y = minLocation.y + text.getLineHeight() - 1;
-
- GC gc = event.gc;
- if (fColor != null && !fColor.isDisposed())
- gc.setForeground(fColor);
- gc.drawLine(x1, y, x2, y);
- }
-
- /*
- * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(fLinkColorKey)) {
- ITextViewer viewer = getTextViewer();
- if (viewer != null)
- updateColor(viewer);
- } else if (event.getProperty().equals(fBrowserLikeLinksKeyModifierKey)) {
- updateKeyModifierMask();
- }
- }
-
- private void repairRepresentation() {
- repairRepresentation(false);
- }
-
- private void repairRepresentation(boolean redrawAll) {
-
- if (fActiveRegion == null)
- return;
-
- int offset = fActiveRegion.getOffset();
- int length = fActiveRegion.getLength();
- fActiveRegion = null;
-
- ITextViewer viewer = getTextViewer();
- if (viewer != null) {
-
- resetCursor(viewer);
-
- // Remove underline
- if (viewer instanceof ITextViewerExtension5) {
- ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
- offset = extension.modelOffset2WidgetOffset(offset);
- } else {
- offset -= viewer.getVisibleRegion().getOffset();
- }
- try {
- StyledText text = viewer.getTextWidget();
-
- // need clearBackground to be true for paint event to be fired
- text.redrawRange(offset, length, true);
- } catch (IllegalArgumentException x) {
- Logger.logException(x);
- }
- }
- }
-
- private void resetCursor(ITextViewer viewer) {
- StyledText text = viewer.getTextWidget();
- if (text != null && !text.isDisposed())
- text.setCursor(null);
-
- if (fCursor != null) {
- fCursor.dispose();
- fCursor = null;
- }
- }
-
- public void setHyperlinkPreferenceKeys(String linkColorKey, String browserLikeLinksKeyModifierKey) {
- fLinkColorKey = linkColorKey;
- fBrowserLikeLinksKeyModifierKey = browserLikeLinksKeyModifierKey;
- }
-
- public void uninstall() {
- if (fCursor != null) {
- fCursor.dispose();
- fCursor = null;
- }
-
- ITextViewer textViewer = getTextViewer();
- if (textViewer == null)
- return;
-
- textViewer.removeTextInputListener(this);
-
- IDocument document = textViewer.getDocument();
- if (document != null)
- document.removeDocumentListener(this);
-
- IPreferenceStore preferenceStore = getNewPreferenceStore();
- if (preferenceStore != null)
- preferenceStore.removePropertyChangeListener(this);
-
- StyledText text = textViewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
-
- text.removeKeyListener(this);
- text.removeMouseListener(this);
- text.removeMouseMoveListener(this);
- text.removeFocusListener(this);
- text.removePaintListener(this);
- }
-
- private void updateColor(ITextViewer viewer) {
- StyledText text = viewer.getTextWidget();
- if (text == null || text.isDisposed())
- return;
-
- Display display = text.getDisplay();
- fColor = createColor(getNewPreferenceStore(), fLinkColorKey, display);
- }
-
- private void updateKeyModifierMask() {
- String modifiers = getNewPreferenceStore().getString(fBrowserLikeLinksKeyModifierKey);
- fKeyModifierMask = computeStateMask(modifiers);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnAction.java
deleted file mode 100644
index 44487875fa..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.openon;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-import org.eclipse.wst.sse.ui.internal.IExtendedSimpleEditor;
-import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
-
-
-/**
- * Determines the appropriate IOpenFileAction to call based on current
- * partition.
- *
- * @deprecated Use base support for hyperlink navigation
- */
-public class OpenOnAction extends TextEditorAction {
- public OpenOnAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
- super(bundle, prefix, editor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- BusyIndicator.showWhile(getTextEditor().getEditorSite().getShell().getDisplay(), new Runnable() {
- public void run() {
- ITextEditor editor = getTextEditor();
-
- // figure out current offset
- int offset = -1;
- ISourceEditingTextTools textTools = (ISourceEditingTextTools) getTextEditor().getAdapter(ISourceEditingTextTools.class);
- if (textTools != null) {
- offset = textTools.getCaretOffset();
- }
- else if (editor instanceof IExtendedSimpleEditor) {
- offset = ((IExtendedSimpleEditor) editor).getCaretPosition();
- }
- else {
- if (editor.getSelectionProvider() != null) {
- ISelection sel = editor.getSelectionProvider().getSelection();
- if (sel instanceof ITextSelection) {
- offset = ((ITextSelection) sel).getOffset();
- }
- }
- }
- IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
- IOpenOn openOn = OpenOnProvider.getInstance().getOpenOn(document, offset);
- if (openOn != null) {
- openOn.openOn(document, new Region(offset, 0));
- }
- }
- });
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnBuilder.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnBuilder.java
deleted file mode 100644
index b62de63f8f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnBuilder.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.openon;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.sse.ui.internal.extension.RegistryReader;
-
-
-/**
- * Reads extensions for open on extension point,
- * org.eclipse.wst.sse.ui.extensions.openon
- *
- * @deprecated Use base support for hyperlink navigation
- */
-public class OpenOnBuilder extends RegistryReader {
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
-
- public static final String ATT_ID = "id"; //$NON-NLS-1$
-
- private static OpenOnBuilder fInstance;
- // extension point ID
- public static final String PL_OPENON = "openon"; //$NON-NLS-1$
-
- public static final String PLUGIN_ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
- public static final String TAG_CONTENT_TYPE_IDENTIFIER = "contenttypeidentifier"; //$NON-NLS-1$
-
- public static final String TAG_OPENON = "openon"; //$NON-NLS-1$
- public static final String TAG_PARTITION_TYPE = "partitiontype"; //$NON-NLS-1$
-
- /**
- * returns singleton instance of OpenOnBuilder
- *
- * @return OpenOnBuilder
- */
- public synchronized static OpenOnBuilder getInstance() {
- if (fInstance == null) {
- fInstance = new OpenOnBuilder();
- }
- return fInstance;
- }
-
- private String fCurrentContentType;
- private OpenOnDefinition fCurrentOpenOnDefinition = null;
-
- private List fOpenOnDefs = null;
-
- protected String targetContributionTag;
-
- /**
- * Returns the name of the part ID attribute that is expected in the
- * target extension.
- *
- * @param element
- * @return String
- */
- protected String getId(IConfigurationElement element) {
- String value = element.getAttribute(ATT_ID);
- return value;
- }
-
- protected String getOpenOnClass(IConfigurationElement element) {
- String value = element.getAttribute(ATT_CLASS);
- return value;
- }
-
- /**
- * Returns all the open on definition objects
- *
- * @return
- */
- public OpenOnDefinition[] getOpenOnDefinitions() {
- initCache();
- return (OpenOnDefinition[]) fOpenOnDefs.toArray(new OpenOnDefinition[fOpenOnDefs.size()]);
- }
-
- /**
- * Returns all the open on definition objects valid for
- * contentType/partitionType
- *
- * @param contentType
- * @param partitionType
- * @return if either contentType or partitionType is null, null is
- * returned
- */
- public OpenOnDefinition[] getOpenOnDefinitions(String contentType, String partitionType) {
- if (contentType == null || partitionType == null) {
- // should not be able to define an openon without a content type
- // but if it were possible then would need to search all openon
- // definitions for
- // definitions with empty contentType list
- return null;
- }
-
- // entire list of openon definition objects
- OpenOnDefinition[] allDefs = getOpenOnDefinitions();
- // current list of open on definitions valid for
- // contentType/partitionType
- List defs = new ArrayList();
- // default definitions that should be added to end of list of open on
- // definitions
- List lastDefs = new ArrayList();
-
- for (int i = 0; i < allDefs.length; ++i) {
- // for each one check if it contains contentType
- List partitions = (List) allDefs[i].getContentTypes().get(contentType);
- if (partitions != null) {
- // this openon definition is valid for all partition types for
- // this content type
- if (partitions.isEmpty()) {
- // this will be added to end of list because this is
- // considered a default openon
- lastDefs.add(allDefs[i]);
- } else {
- // examine the partition types of this openon
- int j = 0; // current index in list of partitions
- boolean added = false; // openon has been added to list
- while (j < partitions.size() && !added) {
- // this openon definition applies to partitionType so
- // add to list of valid openons
- if (partitionType.equals(partitions.get(j))) {
- defs.add(allDefs[i]);
- added = true;
- } else {
- // continue checking to see if this openon
- // definition is valid for current partitionType
- ++j;
- }
- }
- }
- }
- }
- // append the default openon definitions
- defs.addAll(lastDefs);
-
- // return the list
- return (OpenOnDefinition[]) defs.toArray(new OpenOnDefinition[defs.size()]);
- }
-
- private void initCache() {
- if (fOpenOnDefs == null) {
- fOpenOnDefs = new ArrayList(0);
- readContributions(TAG_OPENON, PL_OPENON);
- }
- }
-
- /**
- * Processes element which should be a configuration element specifying a
- * content type for the current open on tag. Assumes that there is a valid
- * current open on definition object.
- *
- * @param element
- * contenttypeidentifier configuration element
- */
- private void processContentTypeTag(IConfigurationElement element) {
- // add to current openOnDefinition
- String theId = getId(element);
-
- if (theId != null) {
- fCurrentContentType = theId;
- fCurrentOpenOnDefinition.addContentTypeId(fCurrentContentType);
- } else {
- fCurrentContentType = null;
- }
- }
-
- /**
- * Processes element which should be a configuration element specifying an
- * open on object. Creates a new open on definition object and adds it to
- * the list of open on definition objects
- *
- * @param element
- * openon configuration element
- */
- private void processOpenOnTag(IConfigurationElement element) {
- String theId = getId(element);
- String theClass = getOpenOnClass(element);
-
- if (theId != null && theClass != null) {
- // start building new OpenOnDefinition
- fCurrentOpenOnDefinition = new OpenOnDefinition(theId, theClass, element);
- fOpenOnDefs.add(fCurrentOpenOnDefinition);
- } else {
- fCurrentOpenOnDefinition = null;
- }
- }
-
- /**
- * Processes element which should be a configuration element specifying a
- * partition type for the current open on/content type tag. Assumes that
- * there is a valid current open on/content type tag.
- *
- * @param element
- * partitiontype configuration element
- */
- private void processPartitionTypeTag(IConfigurationElement element) {
- // add to current openOnDefinition/contentType
- String theId = getId(element);
-
- if (theId != null) {
- fCurrentOpenOnDefinition.addPartitionType(fCurrentContentType, theId);
- }
- }
-
- /**
- * Reads the contributions from the registry for the provided workbench
- * part and the provided extension point ID.
- *
- * @param tag
- * @param extensionPoint
- */
- protected void readContributions(String tag, String extensionPoint) {
- targetContributionTag = tag;
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, PLUGIN_ID, extensionPoint);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.internal.extension.RegistryReader#readElement(org.eclipse.core.runtime.IConfigurationElement)
- */
- protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
-
- if (tag.equals(targetContributionTag)) {
- processOpenOnTag(element);
-
- // make sure processing of current open on tag resulted in a
- // current open on definition
- // before continue reading the children
- if (fCurrentOpenOnDefinition != null) {
- readElementChildren(element);
- }
- return true;
- } else if (tag.equals(TAG_CONTENT_TYPE_IDENTIFIER)) {
- processContentTypeTag(element);
-
- // make sure processing of current content type resulted in a
- // valid content type
- // before reading the children
- if (fCurrentContentType != null) {
- readElementChildren(element);
- }
- return true;
- } else if (tag.equals(TAG_PARTITION_TYPE)) {
- processPartitionTypeTag(element);
- return true;
- }
-
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnDefinition.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnDefinition.java
deleted file mode 100644
index e69159e95f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnDefinition.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.openon;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.osgi.framework.Bundle;
-
-
-/**
- * Open on definition object
- *
- * @deprecated Use base support for hyperlink navigation
- */
-public class OpenOnDefinition {
- private String fClassName = null;
-
- private IConfigurationElement fConfigurationElement = null;
-
- // a hash map of content type Ids (String) that points to lists of
- // parition types (List of Strings)
- // contentTypeId -> List(paritionType, paritionType, partitionType, ...)
- // contentTypeId2 -> List(partitionType, partitionType, ...)
- // ...
- private HashMap fContentTypes = null;
- private String fId = null;
-
- /**
- * @param id
- * @param class1
- * @param configurationElement
- */
- public OpenOnDefinition(String id, String class1, IConfigurationElement configurationElement) {
- super();
- fId = id;
- fClassName = class1;
- fConfigurationElement = configurationElement;
- fContentTypes = new HashMap();
- }
-
- public void addContentTypeId(String contentTypeId) {
- if (!fContentTypes.containsKey(contentTypeId))
- fContentTypes.put(contentTypeId, new ArrayList());
- }
-
- public void addPartitionType(String contentTypeId, String partitionType) {
- if (!fContentTypes.containsKey(contentTypeId))
- fContentTypes.put(contentTypeId, new ArrayList());
-
- List partitionList = (List) fContentTypes.get(contentTypeId);
- partitionList.add(partitionType);
- }
-
- /**
- * Creates an extension. If the extension plugin has not been loaded a
- * busy cursor will be activated during the duration of the load.
- *
- * @param propertyName
- * @return Object
- */
- private Object createExtension(String propertyName) {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- final IConfigurationElement element = getConfigurationElement();
- final String name = propertyName;
-
- final Object[] result = new Object[1];
- String pluginId = element.getDeclaringExtension().getNamespace();
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle.getState() == Bundle.ACTIVE) {
- try {
- return element.createExecutableExtension(name);
- } catch (CoreException e) {
- handleCreateExecutableException(result, e);
- }
- } else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = element.createExecutableExtension(name);
- } catch (Exception e) {
- handleCreateExecutableException(result, e);
- }
- }
- });
- }
- return result[0];
- }
-
- /**
- * @return IOpenOn for this definition
- */
- public IOpenOn createOpenOn() {
- IOpenOn openOn = null;
-
- if (getClassName() != null) {
- openOn = (IOpenOn) createExtension(OpenOnBuilder.ATT_CLASS);
- }
-
- return openOn;
- }
-
- /**
- * @return Returns the fClass.
- */
- public String getClassName() {
- return fClassName;
- }
-
- /**
- * @return Returns the fConfigurationElement.
- */
- public IConfigurationElement getConfigurationElement() {
- return fConfigurationElement;
- }
-
- /**
- * @return Returns the fContentTypes.
- */
- public HashMap getContentTypes() {
- return fContentTypes;
- }
-
- /**
- * @return Returns the fId.
- */
- public String getId() {
- return fId;
- }
-
- /**
- * @param result
- * @param e
- */
- private void handleCreateExecutableException(Object[] result, Throwable e) {
- Logger.logException("Unable to create open on: " + getId(), e); //$NON-NLS-1$
- e.printStackTrace();
- result[0] = null;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnProvider.java
deleted file mode 100644
index 46d90b93d3..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/openon/OpenOnProvider.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.openon;
-
-
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitioning;
-
-
-/**
- * Determines the appropriate IOpenOn to call based on current partition.
- *
- * @deprecated Use base support for hyperlink navigation
- */
-public class OpenOnProvider {
- private static OpenOnProvider fInstance;
-
- /**
- * returns singleton instance of OpenOnProvider
- *
- * @return OpenOnProvider
- */
- public synchronized static OpenOnProvider getInstance() {
- if (fInstance == null) {
- fInstance = new OpenOnProvider();
- }
- return fInstance;
- }
-
-
- /**
- * Returns the content type of document
- *
- * @param document -
- * assumes document is not null
- * @return String content type of given document
- */
- protected String getContentType(IDocument document) {
- String type = null;
-
- IModelManager mgr = StructuredModelManager.getModelManager();
- IStructuredModel model = null;
- try {
- model = mgr.getExistingModelForRead(document);
- if (model != null) {
- type = model.getContentTypeIdentifier();
- }
- }
- finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- return type;
- }
-
- /**
- * Returns the appropriate IOpenOn for the current partition
- *
- * @return
- */
- public IOpenOn getOpenOn(IDocument document, int offset) {
- IOpenOn openOn = null;
-
- // determine the current partition
- if (document != null) {
- String contentTypeID = getContentType(document);
- String partitionType = getPartitionType(document, offset);
-
- IContentType contentType = Platform.getContentTypeManager().getContentType(contentTypeID);
-
- while (openOn == null && contentType != null) {
- // Query OpenOnBuilder and get the list of OpenOns for the
- // current partition
- OpenOnDefinition[] defs = OpenOnBuilder.getInstance().getOpenOnDefinitions(contentType.getId(), partitionType);
- contentType = contentType.getBaseType();
-
- // If more than 1 openon is returned, need to further check
- // which OpenOn is the appropriate one to return
- // for now just returning the first one
- if (defs != null && defs.length > 0) {
- openOn = defs[0].createOpenOn();
- }
- }
- }
-
- return openOn;
- }
-
- /**
- * Returns the partition type located at offset in the document
- *
- * @param document -
- * assumes document is not null
- * @param offset
- * @return String partition type
- */
- protected String getPartitionType(IDocument document, int offset) {
- String type = null;
- try {
- // TODO: provide partitioning information so we're not using a default like this
- if (document instanceof IStructuredDocument) {
- type = TextUtilities.getContentType(document, IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, offset, false);
- }
- }
- catch (BadLocationException e1) {
- }
- finally {
- if (type == null) {
- try {
- ITypedRegion region = document.getPartition(offset);
- if (region != null) {
- type = region.getType();
- }
- }
- catch (BadLocationException e) {
- type = null;
- }
- }
- }
- return type;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java
deleted file mode 100644
index 5130c77d8e..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/EditorPreferenceNames.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences;
-
-/**
- * Preference keys for SSE UI
- */
-public class EditorPreferenceNames {
- /**
- * A named preference that controls on-the-fly validation
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- */
- public static final String EVALUATE_TEMPORARY_PROBLEMS = getEvaluateTemporaryProblemsKey();
-
- private static String getEvaluateTemporaryProblemsKey() {
- return "evaluateTemporaryProblems"; //$NON-NLS-1$
- }
-
- /**
- * A named preference that controls whether bracket matching highlighting
- * is turned on or off.
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- */
- public final static String MATCHING_BRACKETS = getMatchingBracketsKey();
-
- private static String getMatchingBracketsKey() {
- return "matchingBrackets"; //$NON-NLS-1$
- }
-
- /**
- * A named preference that holds the color used to highlight matching
- * brackets.
- * <p>
- * Value is of type <code>String</code>. A RGB color value encoded as a
- * string using class <code>PreferenceConverter</code>
- * </p>
- */
- public final static String MATCHING_BRACKETS_COLOR = getMatchingBracketsColorKey();
-
- private static String getMatchingBracketsColorKey() {
- return "matchingBracketsColor"; //$NON-NLS-1$
- }
-
- /**
- * A named preference that defines the key for the hover modifiers.
- * <p>
- * Value is of type <code>String</code>.
- * </p>
- */
- public static final String EDITOR_TEXT_HOVER_MODIFIERS = getTextHoverModifiersKey();
-
- private static String getTextHoverModifiersKey() {
- return "hoverModifiers"; //$NON-NLS-1$
- }
-
- /**
- * A named preference that defines read only contrast scale.
- * <p>
- * Value is of type <code>Integer</code>.
- * </p>
- */
- public static final String READ_ONLY_FOREGROUND_SCALE = getReadOnlyForegroundScaleKey();
-
- private static String getReadOnlyForegroundScaleKey() {
- return "readOnlyForegroundScale"; //$NON-NLS-1$
- }
-
- /**
- * A named preference that defines whether or not to show a message dialog
- * informing user of unknown content type in editor.
- */
- public static final String SHOW_UNKNOWN_CONTENT_TYPE_MSG = "showUnknownContentTypeMsg"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/OverlayPreferenceStore.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/OverlayPreferenceStore.java
deleted file mode 100644
index 06054fe7df..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/OverlayPreferenceStore.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceStore;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- * An overlaying preference store. copied from JDT
- */
-public class OverlayPreferenceStore implements IPreferenceStore {
-
- public static class OverlayKey {
-
- TypeDescriptor fDescriptor;
- String fKey;
-
- public OverlayKey(TypeDescriptor descriptor, String key) {
- fDescriptor = descriptor;
- fKey = key;
- }
- }
-
- private class PropertyListener implements IPropertyChangeListener {
-
- /*
- * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- OverlayKey key = findOverlayKey(event.getProperty());
- if (key != null)
- propagateProperty(fParent, key, fStore);
- }
- }
-
-
- public static final class TypeDescriptor {
- private TypeDescriptor() {
- }
- }
-
- public static final TypeDescriptor BOOLEAN = new TypeDescriptor();
- public static final TypeDescriptor DOUBLE = new TypeDescriptor();
- public static final TypeDescriptor FLOAT = new TypeDescriptor();
- public static final TypeDescriptor INT = new TypeDescriptor();
- public static final TypeDescriptor LONG = new TypeDescriptor();
- public static final TypeDescriptor STRING = new TypeDescriptor();
- private boolean fLoaded;
- private OverlayKey[] fOverlayKeys;
-
-
- IPreferenceStore fParent;
-
- private PropertyListener fPropertyListener;
- IPreferenceStore fStore;
-
-
- public OverlayPreferenceStore(IPreferenceStore parent, OverlayKey[] overlayKeys) {
- fParent = parent;
- fOverlayKeys = overlayKeys;
- fStore = new PreferenceStore();
- }
-
- /**
- * The keys to add to the list of overlay keys.
- * <p>
- * Note: This method must be called before {@link #load()}is called.
- * </p>
- *
- * @param keys
- * @plannedfor 3.0
- */
- public void addKeys(OverlayKey[] keys) {
- Assert.isTrue(!fLoaded);
- Assert.isNotNull(keys);
-
- int overlayKeysLength = fOverlayKeys.length;
- OverlayKey[] result = new OverlayKey[keys.length + overlayKeysLength];
-
- for (int i = 0, length = overlayKeysLength; i < length; i++)
- result[i] = fOverlayKeys[i];
-
- for (int i = 0, length = keys.length; i < length; i++)
- result[overlayKeysLength + i] = keys[i];
-
- fOverlayKeys = result;
-
- if (fLoaded)
- load();
- }
-
- /*
- * @see IPreferenceStore#addPropertyChangeListener(IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- fStore.addPropertyChangeListener(listener);
- }
-
- /*
- * @see IPreferenceStore#contains(String)
- */
- public boolean contains(String name) {
- return fStore.contains(name);
- }
-
- private boolean covers(String key) {
- return (findOverlayKey(key) != null);
- }
-
- OverlayKey findOverlayKey(String key) {
- for (int i = 0; i < fOverlayKeys.length; i++) {
- if (fOverlayKeys[i].fKey.equals(key))
- return fOverlayKeys[i];
- }
- return null;
- }
-
- /*
- * @see IPreferenceStore#firePropertyChangeEvent(String, Object, Object)
- */
- public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- fStore.firePropertyChangeEvent(name, oldValue, newValue);
- }
-
- /*
- * @see IPreferenceStore#getBoolean(String)
- */
- public boolean getBoolean(String name) {
- return fStore.getBoolean(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultBoolean(String)
- */
- public boolean getDefaultBoolean(String name) {
- return fStore.getDefaultBoolean(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultDouble(String)
- */
- public double getDefaultDouble(String name) {
- return fStore.getDefaultDouble(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultFloat(String)
- */
- public float getDefaultFloat(String name) {
- return fStore.getDefaultFloat(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultInt(String)
- */
- public int getDefaultInt(String name) {
- return fStore.getDefaultInt(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultLong(String)
- */
- public long getDefaultLong(String name) {
- return fStore.getDefaultLong(name);
- }
-
- /*
- * @see IPreferenceStore#getDefaultString(String)
- */
- public String getDefaultString(String name) {
- return fStore.getDefaultString(name);
- }
-
- /*
- * @see IPreferenceStore#getDouble(String)
- */
- public double getDouble(String name) {
- return fStore.getDouble(name);
- }
-
- /*
- * @see IPreferenceStore#getFloat(String)
- */
- public float getFloat(String name) {
- return fStore.getFloat(name);
- }
-
- /*
- * @see IPreferenceStore#getInt(String)
- */
- public int getInt(String name) {
- return fStore.getInt(name);
- }
-
- /*
- * @see IPreferenceStore#getLong(String)
- */
- public long getLong(String name) {
- return fStore.getLong(name);
- }
-
- /*
- * @see IPreferenceStore#getString(String)
- */
- public String getString(String name) {
- return fStore.getString(name);
- }
-
- /*
- * @see IPreferenceStore#isDefault(String)
- */
- public boolean isDefault(String name) {
- return fStore.isDefault(name);
- }
-
- public void load() {
- for (int i = 0; i < fOverlayKeys.length; i++)
- loadProperty(fParent, fOverlayKeys[i], fStore, true);
-
- fLoaded = true;
-
- }
-
- public void loadDefaults() {
- for (int i = 0; i < fOverlayKeys.length; i++)
- setToDefault(fOverlayKeys[i].fKey);
- }
-
- private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) {
- TypeDescriptor d = key.fDescriptor;
- if (BOOLEAN == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, true);
- target.setValue(key.fKey, orgin.getBoolean(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));
-
- } else if (DOUBLE == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1.0D);
- target.setValue(key.fKey, orgin.getDouble(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));
-
- } else if (FLOAT == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1.0F);
- target.setValue(key.fKey, orgin.getFloat(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));
-
- } else if (INT == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1);
- target.setValue(key.fKey, orgin.getInt(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));
-
- } else if (LONG == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, 1L);
- target.setValue(key.fKey, orgin.getLong(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));
-
- } else if (STRING == d) {
-
- if (forceInitialization)
- target.setValue(key.fKey, "1"); //$NON-NLS-1$
- target.setValue(key.fKey, orgin.getString(key.fKey));
- target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));
-
- }
- }
-
- /*
- * @see IPreferenceStore#needsSaving()
- */
- public boolean needsSaving() {
- return fStore.needsSaving();
- }
-
- public void propagate() {
- for (int i = 0; i < fOverlayKeys.length; i++)
- propagateProperty(fStore, fOverlayKeys[i], fParent);
- }
-
- void propagateProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target) {
-
- if (orgin.isDefault(key.fKey)) {
- if (!target.isDefault(key.fKey))
- target.setToDefault(key.fKey);
- return;
- }
-
- TypeDescriptor d = key.fDescriptor;
- if (BOOLEAN == d) {
-
- boolean originValue = orgin.getBoolean(key.fKey);
- boolean targetValue = target.getBoolean(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (DOUBLE == d) {
-
- double originValue = orgin.getDouble(key.fKey);
- double targetValue = target.getDouble(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (FLOAT == d) {
-
- float originValue = orgin.getFloat(key.fKey);
- float targetValue = target.getFloat(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (INT == d) {
-
- int originValue = orgin.getInt(key.fKey);
- int targetValue = target.getInt(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (LONG == d) {
-
- long originValue = orgin.getLong(key.fKey);
- long targetValue = target.getLong(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (STRING == d) {
-
- String originValue = orgin.getString(key.fKey);
- String targetValue = target.getString(key.fKey);
- if (targetValue != null && originValue != null && !targetValue.equals(originValue))
- target.setValue(key.fKey, originValue);
-
- }
- }
-
- /*
- * @see IPreferenceStore#putValue(String, String)
- */
- public void putValue(String name, String value) {
- if (covers(name))
- fStore.putValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#removePropertyChangeListener(IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- fStore.removePropertyChangeListener(listener);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, boolean)
- */
- public void setDefault(String name, boolean value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, double)
- */
- public void setDefault(String name, double value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, float)
- */
- public void setDefault(String name, float value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, int)
- */
- public void setDefault(String name, int value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, long)
- */
- public void setDefault(String name, long value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setDefault(String, String)
- */
- public void setDefault(String name, String value) {
- if (covers(name))
- fStore.setDefault(name, value);
- }
-
- /*
- * @see IPreferenceStore#setToDefault(String)
- */
- public void setToDefault(String name) {
- fStore.setToDefault(name);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, boolean)
- */
- public void setValue(String name, boolean value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, double)
- */
- public void setValue(String name, double value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, float)
- */
- public void setValue(String name, float value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, int)
- */
- public void setValue(String name, int value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, long)
- */
- public void setValue(String name, long value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- /*
- * @see IPreferenceStore#setValue(String, String)
- */
- public void setValue(String name, String value) {
- if (covers(name))
- fStore.setValue(name, value);
- }
-
- public void start() {
- if (fPropertyListener == null) {
- fPropertyListener = new PropertyListener();
- fParent.addPropertyChangeListener(fPropertyListener);
- }
- }
-
- public void stop() {
- if (fPropertyListener != null) {
- fParent.removePropertyChangeListener(fPropertyListener);
- fPropertyListener = null;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/TabFolderLayout.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/TabFolderLayout.java
deleted file mode 100644
index b1b8903bea..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/TabFolderLayout.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-
-/**
- * Copied from JDT
- *
- * @author pavery
- */
-public class TabFolderLayout extends Layout {
-
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- Control[] children = composite.getChildren();
- int count = children.length;
- int maxWidth = 0, maxHeight = 0;
- for (int i = 0; i < count; i++) {
- Control child = children[i];
- Point pt = child.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- maxWidth = Math.max(maxWidth, pt.x);
- maxHeight = Math.max(maxHeight, pt.y);
- }
-
- if (wHint != SWT.DEFAULT)
- maxWidth = wHint;
- if (hHint != SWT.DEFAULT)
- maxHeight = hHint;
-
- return new Point(maxWidth, maxHeight);
-
- }
-
- protected void layout(Composite composite, boolean flushCache) {
- Rectangle rect = composite.getClientArea();
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractColorPage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractColorPage.java
deleted file mode 100644
index 7cc81f4dca..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractColorPage.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.graphics.Point;
-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.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore;
-
-public abstract class AbstractColorPage extends org.eclipse.jface.preference.PreferencePage implements org.eclipse.ui.IWorkbenchPreferencePage {
- protected OverlayPreferenceStore fOverlayStore;
- protected StyledTextColorPicker fPicker = null;
-
- /**
- * Creates the coloring group used in createContents This method can be
- * overwritten to set the text of the group or provide an infopop
- */
- protected Composite createColoringComposite(Composite parent) {
- Composite coloringComposite = createComposite(parent, 1);
- return coloringComposite;
- }
-
- /**
- * Creates composite control and sets the default layout data.
- */
- protected Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- return composite;
- }
-
- protected Control createContents(Composite parent) {
- // create scrollbars for this preference page when needed
- final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
- Composite pageComponent = createComposite(sc1, 1);
- sc1.setContent(pageComponent);
- setSize(pageComponent);
-
- Label descLabel = createDescriptionLabel(pageComponent, SSEUIMessages.AbstractColorPageDescription); //$NON-NLS-1$
- Composite coloringComposite = createColoringComposite(pageComponent);
- createContentsForPicker(coloringComposite);
-
- GridData gd = (GridData) descLabel.getLayoutData();
- gd.widthHint = (coloringComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)).x;
- setSize(pageComponent);
- return pageComponent;
- }
-
- /**
- * Creates the StyledTextColorPicker used in createContents This method
- * can be overwritten to set up StyledTextColorPicker differently
- */
- protected void createContentsForPicker(Composite parent) {
- // create the color picker
- fPicker = new StyledTextColorPicker(parent, SWT.NULL);
- GridData data = new GridData(GridData.FILL_BOTH);
- fPicker.setLayoutData(data);
-
- fPicker.setPreferenceStore(fOverlayStore);
- setupPicker(fPicker);
-
- fPicker.setText(getSampleText());
- }
-
- /**
- * Create description label displayed at top of preference page. This
- * method/label is used instead of PreferencePage's description label
- * because the ScrolledComposite contained in this page will not fully
- * work (horizontal scrolling) with PreferencePage's description label.
- */
- protected Label createDescriptionLabel(Composite parent, String description) {
- Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
- label.setText(description);
-
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.grabExcessHorizontalSpace = true;
- label.setLayoutData(data);
-
- return label;
- }
-
- /**
- * Creates composite control and sets the default layout data.
- */
-
- protected Group createGroup(Composite parent, int numColumns) {
- Group group = new Group(parent, SWT.NULL);
-
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- group.setLayout(layout);
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- group.setLayoutData(data);
-
- return group;
- }
-
- /**
- * Utility method that creates a label instance and sets the default
- * layout data.
- */
- protected Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData(GridData.FILL);
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
-
- protected OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
- return null;
- }
-
- protected Button createPushButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.PUSH);
- button.setText(label);
- GridData data = new GridData(GridData.FILL);
- data.horizontalAlignment = GridData.FILL;
- button.setLayoutData(data);
- return button;
- }
-
- /**
- * Utility method that creates a text instance and sets the default layout
- * data.
- */
- protected Text createTextField(Composite parent, String text) {
- Text textfield = new Text(parent, SWT.LEFT);
- textfield.setText(text);
- GridData data = new GridData(GridData.FILL);
- data.horizontalAlignment = GridData.FILL;
- textfield.setLayoutData(data);
- return textfield;
- }
-
- public void dispose() {
- super.dispose();
- if (fPicker != null && !fPicker.isDisposed())
- fPicker.releasePickerResources();
- if (fOverlayStore != null) {
- fOverlayStore.stop();
- }
- }
-
- public StyledTextColorPicker getPicker() {
- return fPicker;
- }
-
- public abstract String getSampleText();
-
- /**
- * Initializes this preference page for the given workbench.
- * <p>
- * This method is called automatically as the preference page is being
- * created and initialized. Clients must not call this method.
- * </p>
- *
- * @param workbench
- * the workbench
- */
- public void init(IWorkbench workbench) {
- fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), createOverlayStoreKeys());
- fOverlayStore.load();
- fOverlayStore.start();
- }
-
- /**
- * Initializes states of the controls using default values in the
- * preference store.
- */
- protected void performDefaults() {
- fOverlayStore.loadDefaults();
- fPicker.refresh();
- }
-
- public boolean performOk() {
- fOverlayStore.propagate();
- savePreferences();
- return true;
- }
-
- protected void savePreferences() {
- // save plugin preferences here
- }
-
- /**
- * Sets the size of composite to the default value
- */
- protected void setSize(Composite composite) {
- if (composite != null) {
- // Note: The font is set here in anticipation that the class inheriting
- // this base class may add widgets to the dialog. setSize
- // is assumed to be called just before we go live.
- applyDialogFont(composite);
- Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- composite.setSize(minSize);
- // set scrollbar composite's min size so page is expandable but
- // has scrollbars when needed
- if (composite.getParent() instanceof ScrolledComposite) {
- ScrolledComposite sc1 = (ScrolledComposite) composite.getParent();
- sc1.setMinSize(minSize);
- sc1.setExpandHorizontal(true);
- sc1.setExpandVertical(true);
- }
- }
- }
-
- protected abstract void setupPicker(StyledTextColorPicker picker);
-
- public void setVisible(boolean visible) {
- boolean doShrink = false;
- // limiter, for the really huge fonts
- if (visible) {
- getPicker().refresh();
- int x = Math.min(getControl().getShell().getSize().x, getControl().getDisplay().getClientArea().width * 9 / 10);
- int y = Math.min(getControl().getShell().getSize().y, getControl().getDisplay().getClientArea().height * 9 / 10);
- boolean shrinkWidth = (x != getControl().getShell().getSize().x);
- boolean shrinkHeight = (y != getControl().getShell().getSize().y);
- doShrink = shrinkWidth || shrinkHeight;
- if (doShrink) {
- // modify just the height
- if (shrinkHeight && !shrinkWidth)
- getShell().setBounds(getShell().getLocation().x, 0, getShell().getSize().x, getControl().getDisplay().getClientArea().height);
- // modify just the width
- else if (!shrinkHeight && shrinkWidth)
- getShell().setBounds(0, getShell().getLocation().y, getControl().getDisplay().getClientArea().width, getShell().getSize().y);
- // change the entire shell size to only fill the display, and
- // move it to the origin
- else
- getShell().setBounds(0, 0, getControl().getDisplay().getClientArea().width, getControl().getDisplay().getClientArea().height);
- }
- }
- super.setVisible(visible);
- if (doShrink) {
- getControl().getShell().redraw();
- getControl().getShell().update();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractPreferencePage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractPreferencePage.java
deleted file mode 100644
index 4ce9e94d6a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractPreferencePage.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.wst.sse.core.internal.SSECorePlugin;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-
-/**
- * (pa) why is this class abstract if there are no abstract methods?
- */
-public abstract class AbstractPreferencePage extends PreferencePage implements ModifyListener, SelectionListener, IWorkbenchPreferencePage {
-
- protected final static int WIDTH_VALIDATION_LOWER_LIMIT = 0; //$NON-NLS-1$
- protected final static int WIDTH_VALIDATION_UPPER_LIMIT = 999; //$NON-NLS-1$
-
- protected Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.verticalAlignment = GridData.CENTER;
- data.horizontalAlignment = GridData.FILL;
- button.setLayoutData(data);
-
- return button;
- }
-
- protected Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.horizontalIndent = 0;
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
-
- return composite;
- }
-
- protected Control createContents(Composite parent) {
- return createScrolledComposite(parent);
- }
-
- protected Combo createDropDownBox(Composite parent) {
- Combo comboBox = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
-
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.CENTER;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- comboBox.setLayoutData(data);
-
- return comboBox;
- }
-
- protected Group createGroup(Composite parent, int numColumns) {
- Group group = new Group(parent, SWT.NULL);
-
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- group.setLayout(layout);
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.horizontalIndent = 0;
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- group.setLayoutData(data);
-
- return group;
- }
-
- protected Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
-
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.verticalAlignment = GridData.CENTER;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
-
- return label;
- }
-
- protected Button createRadioButton(Composite group, String label) {
- Button button = new Button(group, SWT.RADIO);
- button.setText(label);
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.verticalAlignment = GridData.CENTER;
- data.horizontalAlignment = GridData.FILL;
- button.setLayoutData(data);
-
- return button;
- }
-
- protected Composite createScrolledComposite(Composite parent) {
- // create scrollbars for this parent when needed
- final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
- Composite composite = createComposite(sc1, 1);
- sc1.setContent(composite);
-
- // not calling setSize for composite will result in a blank composite,
- // so calling it here initially
- // setSize actually needs to be called after all controls are created,
- // so scrolledComposite
- // has correct minSize
- setSize(composite);
- return composite;
- }
-
- protected Label createSeparator(Composite parent, int columnSpan) {
- // Create a spacer line
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.verticalAlignment = GridData.CENTER;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = columnSpan;
-
- separator.setLayoutData(data);
- return separator;
- }
-
- protected Text createTextField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
-
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.CENTER;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- text.setLayoutData(data);
-
- return text;
- }
-
- protected void enableValues() {
- }
-
- protected Preferences getModelPreferences() {
- return SSECorePlugin.getDefault().getPluginPreferences();
- }
-
- public void init(IWorkbench workbench) {
- }
-
- protected void initializeValues() {
- }
-
- protected boolean loadPreferences() {
- BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
- public void run() {
- initializeValues();
- validateValues();
- enableValues();
- }
- });
- return true;
- }
-
- public void modifyText(ModifyEvent e) {
- // If we are called too early, i.e. before the controls are created
- // then return
- // to avoid null pointer exceptions
- if (e.widget != null && e.widget.isDisposed())
- return;
-
- validateValues();
- enableValues();
- }
-
- protected void performDefaults() {
- super.performDefaults();
- }
-
- public boolean performOk() {
- savePreferences();
- return true;
- }
-
- protected boolean savePreferences() {
- BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() {
- public void run() {
- storeValues();
- }
- });
- return true;
- }
-
- protected void setInvalidInputMessage(String widthText) {
- String msg = NLS.bind(SSEUIMessages._4concat, (new Object[]{widthText}));
- setErrorMessage(msg);
- }
-
- protected void setSize(Composite composite) {
- if (composite != null) {
- // Note: The font is set here in anticipation that the class inheriting
- // this base class may add widgets to the dialog. setSize
- // is assumed to be called just before we go live.
- applyDialogFont(composite);
- Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- composite.setSize(minSize);
- // set scrollbar composite's min size so page is expandable but
- // has scrollbars when needed
- if (composite.getParent() instanceof ScrolledComposite) {
- ScrolledComposite sc1 = (ScrolledComposite) composite.getParent();
- sc1.setMinSize(minSize);
- sc1.setExpandHorizontal(true);
- sc1.setExpandVertical(true);
- }
- }
- }
-
- protected void storeValues() {
- SSEUIPlugin.getDefault().savePluginPreferences();
- }
-
- protected void validateValues() {
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- // If we are called too early, i.e. before the controls are created
- // then return
- // to avoid null pointer exceptions
- if (e.widget != null && e.widget.isDisposed())
- return;
-
- validateValues();
- enableValues();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractPreferenceTab.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractPreferenceTab.java
deleted file mode 100644
index 0401f3f6c9..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/AbstractPreferenceTab.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore;
-
-/**
- * Generic preference tab page that contains helpful methods
- *
- * @author amywu
- */
-abstract public class AbstractPreferenceTab implements IPreferenceTab {
-
- Map fCheckBoxes = new HashMap();
- private SelectionListener fCheckBoxListener = new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button) e.widget;
- fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
- }
- };
- private PreferencePage fMainPreferencePage;
- private ModifyListener fNumberFieldListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- numberFieldChanged((Text) e.widget);
- }
- };
- private ArrayList fNumberFields = new ArrayList();
- OverlayPreferenceStore fOverlayStore;
- private ModifyListener fTextFieldListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- Text text = (Text) e.widget;
- fOverlayStore.setValue((String) fTextFields.get(text), text.getText());
- }
- };
- Map fTextFields = new HashMap();
-
- protected Button addCheckBox(Composite parent, String label, String key, int indentation) {
- Button checkBox = new Button(parent, SWT.CHECK);
- checkBox.setText(label);
-
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent = indentation;
- gd.horizontalSpan = 2;
- checkBox.setLayoutData(gd);
- checkBox.addSelectionListener(fCheckBoxListener);
-
- fCheckBoxes.put(checkBox, key);
-
- return checkBox;
- }
-
- /**
- * Returns an array of size 2: - first element is of type
- * <code>Label</code>- second element is of type <code>Text</code>
- * Use <code>getLabelControl</code> and <code>getTextControl</code> to
- * get the 2 controls.
- */
- private Control[] addLabelledTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
- Label labelControl = new Label(composite, SWT.NONE);
- labelControl.setText(label);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent = indentation;
- labelControl.setLayoutData(gd);
-
- Text textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.widthHint = convertWidthInCharsToPixels(textControl, textLimit + 1);
- textControl.setLayoutData(gd);
- textControl.setTextLimit(textLimit);
- fTextFields.put(textControl, key);
- if (isNumber) {
- fNumberFields.add(textControl);
- textControl.addModifyListener(fNumberFieldListener);
- } else {
- textControl.addModifyListener(fTextFieldListener);
- }
-
- return new Control[]{labelControl, textControl};
- }
-
- protected Text addTextField(Composite composite, String label, String key, int textLimit, int indentation, boolean isNumber) {
- return getTextControl(addLabelledTextField(composite, label, key, textLimit, indentation, isNumber));
- }
-
- /**
- * Applies the status to the status line of a dialog page.
- */
- private void applyToStatusLine(IStatus status) {
- String message = status.getMessage();
- switch (status.getSeverity()) {
- case IStatus.OK :
- fMainPreferencePage.setMessage(message, IMessageProvider.NONE);
- fMainPreferencePage.setErrorMessage(null);
- break;
- case IStatus.WARNING :
- fMainPreferencePage.setMessage(message, IMessageProvider.WARNING);
- fMainPreferencePage.setErrorMessage(null);
- break;
- case IStatus.INFO :
- fMainPreferencePage.setMessage(message, IMessageProvider.INFORMATION);
- fMainPreferencePage.setErrorMessage(null);
- break;
- default :
- if (message.length() == 0) {
- message = null;
- }
- fMainPreferencePage.setMessage(null);
- fMainPreferencePage.setErrorMessage(message);
- break;
- }
- }
-
- /**
- * Returns the number of pixels corresponding to the width of the given
- * number of characters. This method was copied from
- * org.eclipse.jface.dialogs.DialogPage
- * <p>
- *
- * @param a
- * control in the page
- * @param chars
- * the number of characters
- * @return the number of pixels
- */
- private int convertWidthInCharsToPixels(Control testControl, int chars) {
- // Compute and store a font metric
- GC gc = new GC(testControl);
- gc.setFont(JFaceResources.getDialogFont());
- FontMetrics fontMetrics = gc.getFontMetrics();
- gc.dispose();
-
- // test for failure to initialize for backward compatibility
- if (fontMetrics == null)
- return 0;
- return Dialog.convertWidthInCharsToPixels(fontMetrics, chars);
- }
-
- /**
- * @return Returns the fMainPreferencePage.
- */
- protected PreferencePage getMainPreferencePage() {
- return fMainPreferencePage;
- }
-
- /**
- * @return Returns the fOverlayStore.
- */
- protected OverlayPreferenceStore getOverlayStore() {
- return fOverlayStore;
- }
-
- private Text getTextControl(Control[] labelledTextField) {
- return (Text) labelledTextField[1];
- }
-
- protected void initializeFields() {
- Iterator e = fCheckBoxes.keySet().iterator();
- while (e.hasNext()) {
- Button b = (Button) e.next();
- String key = (String) fCheckBoxes.get(b);
- b.setSelection(fOverlayStore.getBoolean(key));
- }
-
- e = fTextFields.keySet().iterator();
- while (e.hasNext()) {
- Text t = (Text) e.next();
- String key = (String) fTextFields.get(t);
- t.setText(fOverlayStore.getString(key));
- }
- }
-
- void numberFieldChanged(Text textControl) {
- String number = textControl.getText();
- IStatus status = validatePositiveNumber(number);
- if (!status.matches(IStatus.ERROR))
- fOverlayStore.setValue((String) fTextFields.get(textControl), number);
- updateStatus(status);
- }
-
- /**
- * @param mainPreferencePage
- * The fMainPreferencePage to set.
- */
- protected void setMainPreferencePage(PreferencePage mainPreferencePage) {
- fMainPreferencePage = mainPreferencePage;
- }
-
- /**
- * @param overlayStore
- * The fOverlayStore to set.
- */
- protected void setOverlayStore(OverlayPreferenceStore overlayStore) {
- fOverlayStore = overlayStore;
- }
-
- /**
- * Update status of main preference page
- *
- * @param status
- */
- protected void updateStatus(IStatus status) {
- if (!status.matches(IStatus.ERROR)) {
- for (int i = 0; i < fNumberFields.size(); i++) {
- Text text = (Text) fNumberFields.get(i);
- IStatus s = validatePositiveNumber(text.getText());
- status = s.getSeverity() > status.getSeverity() ? s : status;
- }
- }
-
- fMainPreferencePage.setValid(!status.matches(IStatus.ERROR));
- applyToStatusLine(status);
- }
-
- private IStatus validatePositiveNumber(String number) {
- StatusInfo status = new StatusInfo();
- if (number.length() == 0) {
- status.setError(SSEUIMessages.StructuredTextEditorPreferencePage_37);
- } else {
- try {
- int value = Integer.parseInt(number);
- if (value < 0)
- status.setError(number + SSEUIMessages.StructuredTextEditorPreferencePage_38);
- } catch (NumberFormatException e) {
- status.setError(number + SSEUIMessages.StructuredTextEditorPreferencePage_38);
- }
- }
- return status;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorEditor.java
deleted file mode 100644
index e564d60352..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorEditor.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.ColorDialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * A "button" of a certain color determined by the color picker.
- */
-public class ColorEditor {
- Button fButton;
- Color fColor;
- RGB fColorValue;
-
- private Point fExtent;
- Image fImage;
-
- public ColorEditor(Composite parent) {
-
- fButton = new Button(parent, SWT.PUSH);
- fExtent = computeImageSize(parent);
- fImage = new Image(parent.getDisplay(), fExtent.x, fExtent.y);
-
- GC gc = new GC(fImage);
- gc.setBackground(fButton.getBackground());
- gc.fillRectangle(0, 0, fExtent.x, fExtent.y);
- gc.dispose();
-
- fButton.setImage(fImage);
-
- // bug2541 - associate color value to button's value field
- fButton.getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() {
- /**
- * @see org.eclipse.swt.accessibility.AccessibleControlAdapter#getValue(AccessibleControlEvent)
- */
- public void getValue(AccessibleControlEvent e) {
- if (e.childID == ACC.CHILDID_SELF) {
- if (getColorValue() != null)
- e.result = getColorValue().toString();
- else
- e.result = null;
- }
- }
- });
-
- fButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- ColorDialog colorDialog = new ColorDialog(fButton.getShell());
- colorDialog.setRGB(fColorValue);
- RGB newColor = colorDialog.open();
- if (newColor != null) {
- fColorValue = newColor;
- updateColorImage();
- }
- }
- });
-
- fButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- if (fImage != null) {
- fImage.dispose();
- fImage = null;
- }
- if (fColor != null) {
- fColor.dispose();
- fColor = null;
- }
- }
- });
- }
-
- protected Point computeImageSize(Control window) {
- GC gc = new GC(window);
- Font f = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
- gc.setFont(f);
- int height = gc.getFontMetrics().getHeight();
- gc.dispose();
- Point p = new Point(height * 3 - 6, height);
- return p;
- }
-
- public Button getButton() {
- return fButton;
- }
-
- public RGB getColorValue() {
- return fColorValue;
- }
-
- public void setColorValue(RGB rgb) {
- fColorValue = rgb;
- updateColorImage();
- }
-
- protected void updateColorImage() {
-
- Display display = fButton.getDisplay();
-
- GC gc = new GC(fImage);
- gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);
-
- if (fColor != null)
- fColor.dispose();
-
- fColor = new Color(display, fColorValue);
- gc.setBackground(fColor);
- gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
- gc.dispose();
-
- fButton.setImage(fImage);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorHelper.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorHelper.java
deleted file mode 100644
index 58aefdbcfe..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorHelper.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-
-
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-
-public class ColorHelper {
- public final static String BACKGROUND = "background";//$NON-NLS-1$
- public final static String BOLD = "bold";//$NON-NLS-1$
- public final static String FOREGROUND = "foreground";//$NON-NLS-1$
- public final static String NAME = "name";//$NON-NLS-1$
- private final static String STYLE_SEPARATOR = "|"; //$NON-NLS-1$
-
- /**
- * Return an RGB String given the int r, g, b values
- */
- public static String getColorString(int r, int g, int b) {
- return "#" + getHexString(r, 2) + getHexString(g, 2) + getHexString(b, 2);//$NON-NLS-1$
- }
-
- private static String getHexString(int value, int minWidth) {
- String hexString = Integer.toHexString(value);
- for (int i = hexString.length(); i < minWidth; i++) {
- hexString = "0" + hexString;//$NON-NLS-1$
- }
- return hexString;
- }
-
- /**
- * Generates a preference string to be placed in preferences from the
- * given String array.
- *
- * @param stylePrefs
- * assumes not null and should be in the form of String[0] =
- * Foreground RGB String, String[1] = Background RGB String,
- * String[2] = Bold true/false
- *
- * @return String in the form of Foreground RGB String | Background RGB
- * String | Bold true/false
- */
- public static String packStylePreferences(String[] stylePrefs) {
- StringBuffer styleString = new StringBuffer();
-
- if (stylePrefs.length == 3) {
- for (int i = 0; i < 3; ++i) {
- String s = stylePrefs[i];
- styleString.append(s);
-
- // add in the separator (except on last iteration)
- if (i != 2) {
- styleString.append(" " + STYLE_SEPARATOR + " "); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
-
- return styleString.toString();
- }
-
- /**
- * @return org.eclipse.swt.graphics.RGB
- * @param anRGBString
- * java.lang.String
- */
- public static RGB toRGB(String anRGBString) {
- RGB result = null;
- if (anRGBString.length() > 6 && anRGBString.charAt(0) == '#') {
- int r = 0;
- int g = 0;
- int b = 0;
- try {
- r = Integer.valueOf(anRGBString.substring(1, 3), 16).intValue();
- g = Integer.valueOf(anRGBString.substring(3, 5), 16).intValue();
- b = Integer.valueOf(anRGBString.substring(5, 7), 16).intValue();
- result = new RGB(r, g, b);
- } catch (NumberFormatException nfExc) {
- Logger.logException("Could not load highlighting preference for color " + anRGBString, nfExc);//$NON-NLS-1$
- }
- }
- return result;
- }
-
- /**
- * @return java.lang.String
- * @param anRGB
- * org.eclipse.swt.graphics.RGB
- */
- public static String toRGBString(RGB anRGB) {
- if (anRGB == null)
- return "#000000";//$NON-NLS-1$
- String red = Integer.toHexString(anRGB.red);
- while (red.length() < 2)
- red = "0" + red;//$NON-NLS-1$
- String green = Integer.toHexString(anRGB.green);
- while (green.length() < 2)
- green = "0" + green;//$NON-NLS-1$
- String blue = Integer.toHexString(anRGB.blue);
- while (blue.length() < 2)
- blue = "0" + blue;//$NON-NLS-1$
- return "#" + red + green + blue;//$NON-NLS-1$
- }
-
- /**
- * Extracts the foreground (RGB String), background (RGB String), bold
- * (boolean String) from the given preference string.
- *
- * @param preference
- * should be in the form of Foreground RGB String | Background
- * RGB String | Bold true/false
- * @return String[] where String[0] = Foreground RGB String, String[1] =
- * Background RGB String, String[2] = Bold true/false OR null if
- * ran into problems extracting
- */
- public static String[] unpackStylePreferences(String preference) {
- String[] stylePrefs = null;
- if (preference != null) {
- StringTokenizer st = new StringTokenizer(preference, STYLE_SEPARATOR);
- if (st.countTokens() == 3) {
- String foreground = st.nextToken().trim();
- String background = st.nextToken().trim();
- String bold = st.nextToken().trim();
-
- stylePrefs = new String[3];
- stylePrefs[0] = foreground;
- stylePrefs[1] = background;
- stylePrefs[2] = bold;
- }
- }
-
- return stylePrefs;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorNames.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorNames.java
deleted file mode 100644
index 846095455c..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/ColorNames.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-
-
-public interface ColorNames {
- String BACKGROUND = "background"; //$NON-NLS-1$
- String BOLD = "bold"; //$NON-NLS-1$
- String COLOR = "color"; //$NON-NLS-1$
-
- String COLORS = "colors"; //$NON-NLS-1$
- String FOREGROUND = "foreground"; //$NON-NLS-1$
- String ITALIC = "italic"; //$NON-NLS-1$
-
- String NAME = "name"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/EmptyFilePreferencePage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/EmptyFilePreferencePage.java
deleted file mode 100644
index f3b4b1aca8..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/EmptyFilePreferencePage.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-public class EmptyFilePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private Composite createComposite(Composite parent, int numColumns) {
- noDefaultAndApplyButton();
-
- Composite composite = new Composite(parent, SWT.NULL);
-
- // GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
-
- // GridData
- GridData data = new GridData(GridData.FILL);
- data.horizontalIndent = 0;
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
-
- return composite;
- }
-
- protected Control createContents(Composite parent) {
- Composite composite = createScrolledComposite(parent);
-
- String description = SSEUIMessages.EmptyFilePreferencePage_0; //$NON-NLS-1$
- Text text = new Text(composite, SWT.READ_ONLY);
- // some themes on GTK have different background colors for Text and Labels
- text.setBackground(composite.getBackground());
- text.setText(description);
-
- setSize(composite);
- return composite;
- }
-
- private Composite createScrolledComposite(Composite parent) {
- // create scrollbars for this parent when needed
- final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
- sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
- Composite composite = createComposite(sc1, 1);
- sc1.setContent(composite);
-
- // not calling setSize for composite will result in a blank composite,
- // so calling it here initially
- // setSize actually needs to be called after all controls are created,
- // so scrolledComposite
- // has correct minSize
- setSize(composite);
- return composite;
- }
-
- public void init(IWorkbench workbench) {
- }
-
- private void setSize(Composite composite) {
- if (composite != null) {
- // Note: The font is set here in anticipation that the class inheriting
- // this base class may add widgets to the dialog. setSize
- // is assumed to be called just before we go live.
- applyDialogFont(composite);
- Point minSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- composite.setSize(minSize);
- // set scrollbar composite's min size so page is expandable but
- // has scrollbars when needed
- if (composite.getParent() instanceof ScrolledComposite) {
- ScrolledComposite sc1 = (ScrolledComposite) composite.getParent();
- sc1.setMinSize(minSize);
- sc1.setExpandHorizontal(true);
- sc1.setExpandVertical(true);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/FilePreferencePage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/FilePreferencePage.java
deleted file mode 100644
index c55af89db8..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/FilePreferencePage.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.wst.sse.core.internal.SSECorePlugin;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout;
-
-public class FilePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private IPreferenceTab[] fTabs = null;
-
- protected Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.horizontalIndent = 0;
- data.verticalAlignment = GridData.FILL_VERTICAL;
- data.horizontalAlignment = GridData.FILL_HORIZONTAL;
- composite.setLayoutData(data);
-
- return composite;
- }
-
- protected Control createContents(Composite parent) {
- Composite composite = createComposite(parent, 1);
-
- String description = SSEUIMessages.FilePreferencePage_0; //$NON-NLS-1$
- createLabel(composite, description);
- createLabel(composite, ""); //$NON-NLS-1$
-
- TabFolder folder = new TabFolder(composite, SWT.NONE);
- folder.setLayout(new TabFolderLayout());
- folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
-// TabItem taskItem = new TabItem(folder, SWT.NONE);
-// IPreferenceTab tasksTab = new TaskTagPreferenceTab();
-// taskItem.setText(tasksTab.getTitle());
-// Control taskTags = tasksTab.createContents(folder);
-// taskItem.setControl(taskTags);
-
- TabItem translucenceItem = new TabItem(folder, SWT.NONE);
- IPreferenceTab translucenceTab = new TranslucencyPreferenceTab(this);
- translucenceItem.setText(translucenceTab.getTitle());
- Control translucenceControl = translucenceTab.createContents(folder);
- translucenceItem.setControl(translucenceControl);
-
- fTabs = new IPreferenceTab[]{/*tasksTab,*/ translucenceTab};
-
- return composite;
- }
-
- protected Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
-
- //GridData
- GridData data = new GridData(GridData.FILL);
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
- label.setLayoutData(data);
-
- return label;
- }
-
- public void init(IWorkbench desktop) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#performApply()
- */
- protected void performApply() {
- super.performApply();
- for (int i = 0; i < fTabs.length; i++) {
- fTabs[i].performApply();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- super.performDefaults();
- for (int i = 0; i < fTabs.length; i++) {
- fTabs[i].performDefaults();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- boolean ok = super.performOk();
- for (int i = 0; i < fTabs.length; i++) {
- fTabs[i].performOk();
- }
- SSECorePlugin.getDefault().savePluginPreferences();
- return ok;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/IPreferenceTab.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/IPreferenceTab.java
deleted file mode 100644
index bfd411e10a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/IPreferenceTab.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public interface IPreferenceTab {
-
- Control createContents(Composite tabFolder);
-
- String getTitle();
-
- void performApply();
-
- void performDefaults();
-
- void performOk();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StatusInfo.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StatusInfo.java
deleted file mode 100644
index 7ae5bb4776..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StatusInfo.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.ui.editors.text.EditorsUI;
-
-/**
- * A settable IStatus. Can be an error, warning, info or ok. For error, info
- * and warning states, a message describes the problem.
- *
- * This class was copied from other StatusInfo classes that are located in
- * internal packages
- */
-class StatusInfo implements IStatus {
- /** The severity of this status. */
- private int fSeverity;
-
- /** The message of this status. */
- private String fStatusMessage;
-
- /**
- * Creates a status set to OK (no message).
- */
- public StatusInfo() {
- this(OK, null);
- }
-
- /**
- * Creates a status with the given severity and message.
- *
- * @param severity
- * the severity of this status: ERROR, WARNING, INFO and OK.
- * @param message
- * the message of this status. Applies only for ERROR, WARNING
- * and INFO.
- */
- public StatusInfo(int severity, String message) {
- fStatusMessage = message;
- fSeverity = severity;
- }
-
- /**
- * Returns always <code>null</code>.
- *
- * @see IStatus#getChildren()
- */
- public IStatus[] getChildren() {
- return new IStatus[0];
- }
-
- /**
- * Returns always the error severity.
- *
- * @see IStatus#getCode()
- */
- public int getCode() {
- return fSeverity;
- }
-
- /**
- * Returns always <code>null</code>.
- *
- * @see IStatus#getException()
- */
- public Throwable getException() {
- return null;
- }
-
- /*
- * @see IStatus#getMessage()
- */
- public String getMessage() {
- return fStatusMessage;
- }
-
- /*
- * @see IStatus#getPlugin()
- */
- public String getPlugin() {
- return EditorsUI.PLUGIN_ID;
- }
-
- /*
- * @see IStatus#getSeverity()
- */
- public int getSeverity() {
- return fSeverity;
- }
-
- /**
- * Returns whether this status indicates an error.
- *
- * @return <code>true</code> if this status has severity
- * {@link IStatus#ERROR}and <code>false</code> otherwise
- */
- public boolean isError() {
- return fSeverity == IStatus.ERROR;
- }
-
- /**
- * Returns whether this status indicates an info.
- *
- * @return <code>true</code> if this status has severity
- * {@link IStatus#INFO}and <code>false</code> otherwise
- */
- public boolean isInfo() {
- return fSeverity == IStatus.INFO;
- }
-
- /**
- * Returns always <code>false</code>.
- *
- * @see IStatus#isMultiStatus()
- */
- public boolean isMultiStatus() {
- return false;
- }
-
- /*
- * @see org.eclipse.core.runtime.IStatus#isOK()
- */
- public boolean isOK() {
- return fSeverity == IStatus.OK;
- }
-
- /**
- * Returns whether this status indicates a warning.
- *
- * @return <code>true</code> if this status has severity
- * {@link IStatus#WARNING}and <code>false</code> otherwise
- */
- public boolean isWarning() {
- return fSeverity == IStatus.WARNING;
- }
-
- /*
- * @see IStatus#matches(int)
- */
- public boolean matches(int severityMask) {
- return (fSeverity & severityMask) != 0;
- }
-
- /**
- * Sets the status to ERROR.
- *
- * @param errorMessage
- * the error message which can be an empty string, but not
- * <code>null</code>
- */
- public void setError(String errorMessage) {
- Assert.isNotNull(errorMessage);
- fStatusMessage = errorMessage;
- fSeverity = IStatus.ERROR;
- }
-
- /**
- * Sets the status to INFO.
- *
- * @param infoMessage
- * the info message which can be an empty string, but not
- * <code>null</code>
- */
- public void setInfo(String infoMessage) {
- Assert.isNotNull(infoMessage);
- fStatusMessage = infoMessage;
- fSeverity = IStatus.INFO;
- }
-
- /**
- * Sets the status to OK.
- */
- public void setOK() {
- fStatusMessage = null;
- fSeverity = IStatus.OK;
- }
-
- /**
- * Sets the status to WARNING.
- *
- * @param warningMessage
- * the warning message which can be an empty string, but not
- * <code>null</code>
- */
- public void setWarning(String warningMessage) {
- Assert.isNotNull(warningMessage);
- fStatusMessage = warningMessage;
- fSeverity = IStatus.WARNING;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java
deleted file mode 100644
index 18bbd5951c..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StructuredTextEditorPreferencePage.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.RGB;
-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.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferenceLinkArea;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
-import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore;
-import org.eclipse.wst.sse.ui.internal.preferences.TabFolderLayout;
-import org.eclipse.wst.sse.ui.internal.projection.IStructuredTextFoldingProvider;
-import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames;
-
-/**
- * Gutted version of JavaEditorPreferencePage
- *
- * @author pavery
- */
-public class StructuredTextEditorPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private ColorEditor fAppearanceColorEditor;
- private List fAppearanceColorList;
-
- private final String[][] fAppearanceColorListModel = new String[][]{{SSEUIMessages.StructuredTextEditorPreferencePage_2, EditorPreferenceNames.MATCHING_BRACKETS_COLOR}}; //$NON-NLS-1$
- private Map fCheckBoxes = new HashMap();
- private SelectionListener fCheckBoxListener = new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button) e.widget;
- fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection());
- }
- };
-
- private Map fColorButtons = new HashMap();
-
- private ArrayList fNumberFields = new ArrayList();
- private OverlayPreferenceStore fOverlayStore;
- /** Button controlling default setting of the selected reference provider. */
- // TODO: private field never read locally
- Button fSetDefaultButton;
- private IPreferenceTab[] fTabs = null;
- private Map fTextFields = new HashMap();
-
- public StructuredTextEditorPreferencePage() {
- setDescription(SSEUIMessages.StructuredTextEditorPreferencePage_6); //$NON-NLS-1$
- setPreferenceStore(SSEUIPlugin.getDefault().getPreferenceStore());
-
- fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), createOverlayStoreKeys());
- }
-
- private Button addCheckBox(Composite parent, String label, String key, int indentation) {
- Button checkBox = new Button(parent, SWT.CHECK);
- checkBox.setText(label);
-
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- gd.horizontalIndent = indentation;
- gd.horizontalSpan = 2;
- checkBox.setLayoutData(gd);
- checkBox.addSelectionListener(fCheckBoxListener);
-
- fCheckBoxes.put(checkBox, key);
-
- return checkBox;
- }
-
- /**
- * Applies the status to the status line of a dialog page.
- */
- public void applyToStatusLine(DialogPage page, IStatus status) {
- String message = status.getMessage();
- switch (status.getSeverity()) {
- case IStatus.OK :
- page.setMessage(message, IMessageProvider.NONE);
- page.setErrorMessage(null);
- break;
- case IStatus.WARNING :
- page.setMessage(message, IMessageProvider.WARNING);
- page.setErrorMessage(null);
- break;
- case IStatus.INFO :
- page.setMessage(message, IMessageProvider.INFORMATION);
- page.setErrorMessage(null);
- break;
- default :
- if (message.length() == 0) {
- message = null;
- }
- page.setMessage(null);
- page.setErrorMessage(message);
- break;
- }
- }
-
- private Control createAppearancePage(Composite parent) {
- Composite appearanceComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- appearanceComposite.setLayout(layout);
-
- String label = SSEUIMessages.StructuredTextEditorPreferencePage_20; //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, EditorPreferenceNames.MATCHING_BRACKETS, 0);
-
- label = SSEUIMessages.StructuredTextEditorPreferencePage_30; //$NON-NLS-1$
- addCheckBox(appearanceComposite, label, CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS, 0);
-
- PreferenceLinkArea contentTypeArea = new PreferenceLinkArea(appearanceComposite, SWT.NONE, "ValidationPreferencePage", SSEUIMessages.StructuredTextEditorPreferencePage_40, (IWorkbenchPreferenceContainer) getContainer(), null); //$NON-NLS-1$
-
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- data.horizontalIndent = 20;
- contentTypeArea.getControl().setLayoutData(data);
-
- label = SSEUIMessages.StructuredTextEditorPreferencePage_39;
- addCheckBox(appearanceComposite, label, EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG, 0);
-
- label = SSEUIMessages.StructuredTextEditorPreferencePage_3;
- addCheckBox(appearanceComposite, label, IStructuredTextFoldingProvider.FOLDING_ENABLED, 0);
-
- Label l = new Label(appearanceComposite, SWT.LEFT);
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
- gd.heightHint = convertHeightInCharsToPixels(1) / 2;
- l.setLayoutData(gd);
-
- l = new Label(appearanceComposite, SWT.LEFT);
- l.setText(SSEUIMessages.StructuredTextEditorPreferencePage_23); //$NON-NLS-1$
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- gd.horizontalSpan = 2;
- l.setLayoutData(gd);
-
- Composite editorComposite = new Composite(appearanceComposite, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- editorComposite.setLayout(layout);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
- gd.horizontalSpan = 2;
- editorComposite.setLayoutData(gd);
-
- fAppearanceColorList = new List(editorComposite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER);
- gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- gd.heightHint = convertHeightInCharsToPixels(5);
- fAppearanceColorList.setLayoutData(gd);
-
- Composite stylesComposite = new Composite(editorComposite, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.numColumns = 2;
- stylesComposite.setLayout(layout);
- stylesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- l = new Label(stylesComposite, SWT.LEFT);
- // needs to be made final so label can be set in
- // foregroundcolorbutton's acc listener
- final String buttonLabel = SSEUIMessages.StructuredTextEditorPreferencePage_24; //$NON-NLS-1$
- l.setText(buttonLabel);
- gd = new GridData();
- gd.horizontalAlignment = GridData.BEGINNING;
- l.setLayoutData(gd);
-
- fAppearanceColorEditor = new ColorEditor(stylesComposite);
- Button foregroundColorButton = fAppearanceColorEditor.getButton();
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalAlignment = GridData.BEGINNING;
- foregroundColorButton.setLayoutData(gd);
-
- fAppearanceColorList.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- handleAppearanceColorListSelection();
- }
- });
- foregroundColorButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- int i = fAppearanceColorList.getSelectionIndex();
- String key = fAppearanceColorListModel[i][1];
-
- PreferenceConverter.setValue(fOverlayStore, key, fAppearanceColorEditor.getColorValue());
- }
- });
-
- // bug2541 - associate color label to button's label field
- foregroundColorButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getName(AccessibleEvent e) {
- if (e.childID == ACC.CHILDID_SELF)
- e.result = buttonLabel;
- }
- });
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(appearanceComposite, IHelpContextIds.PREFSTE_APPEARANCE_HELPID);
- return appearanceComposite;
- }
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- // need to create tabs before loading/starting overlaystore in case
- // tabs also add values
- IPreferenceTab hoversTab = new TextHoverPreferenceTab(this, fOverlayStore);
-
- fOverlayStore.load();
- fOverlayStore.start();
-
- TabFolder folder = new TabFolder(parent, SWT.NONE);
- folder.setLayout(new TabFolderLayout());
- folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- TabItem item = new TabItem(folder, SWT.NONE);
- item.setText(SSEUIMessages.StructuredTextEditorPreferencePage_0); //$NON-NLS-1$
- item.setControl(createAppearancePage(folder));
-
- item = new TabItem(folder, SWT.NONE);
- item.setText(hoversTab.getTitle());
- item.setControl(hoversTab.createContents(folder));
-
- fTabs = new IPreferenceTab[]{hoversTab};
-
- initialize();
-
- Dialog.applyDialogFont(folder);
- return folder;
- }
-
- /*
- * @see PreferencePage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- // WorkbenchHelp.setHelp(getControl(),
- // IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
- }
-
- private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
- ArrayList overlayKeys = new ArrayList();
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.MATCHING_BRACKETS_COLOR));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, EditorPreferenceNames.MATCHING_BRACKETS));
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS));
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG));
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IStructuredTextFoldingProvider.FOLDING_ENABLED));
-
- OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
- overlayKeys.toArray(keys);
- return keys;
- }
-
- /*
- * @see DialogPage#dispose()
- */
- public void dispose() {
- if (fOverlayStore != null) {
- fOverlayStore.stop();
- fOverlayStore = null;
- }
-
- super.dispose();
- }
-
- private void handleAppearanceColorListSelection() {
- int i = fAppearanceColorList.getSelectionIndex();
- String key = fAppearanceColorListModel[i][1];
- RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
- fAppearanceColorEditor.setColorValue(rgb);
- }
-
- /*
- * @see IWorkbenchPreferencePage#init()
- */
- public void init(IWorkbench workbench) {
- // nothing to do
- }
-
- private void initialize() {
- initializeFields();
-
- for (int i = 0; i < fAppearanceColorListModel.length; i++)
- fAppearanceColorList.add(fAppearanceColorListModel[i][0]);
- fAppearanceColorList.getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (fAppearanceColorList != null && !fAppearanceColorList.isDisposed()) {
- fAppearanceColorList.select(0);
- handleAppearanceColorListSelection();
- }
- }
- });
- }
-
- private void initializeFields() {
- Iterator e = fColorButtons.keySet().iterator();
- while (e.hasNext()) {
- ColorEditor c = (ColorEditor) e.next();
- String key = (String) fColorButtons.get(c);
- RGB rgb = PreferenceConverter.getColor(fOverlayStore, key);
- c.setColorValue(rgb);
- }
-
- e = fCheckBoxes.keySet().iterator();
- while (e.hasNext()) {
- Button b = (Button) e.next();
- String key = (String) fCheckBoxes.get(b);
- b.setSelection(fOverlayStore.getBoolean(key));
- }
-
- e = fTextFields.keySet().iterator();
- while (e.hasNext()) {
- Text t = (Text) e.next();
- String key = (String) fTextFields.get(t);
- t.setText(fOverlayStore.getString(key));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#performApply()
- */
- protected void performApply() {
- for (int i = 0; i < fTabs.length; i++) {
- fTabs[i].performApply();
- }
- super.performApply();
- }
-
- /*
- * @see PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- fOverlayStore.loadDefaults();
-
- initializeFields();
-
- handleAppearanceColorListSelection();
-
- for (int i = 0; i < fTabs.length; i++) {
- fTabs[i].performDefaults();
- }
-
- super.performDefaults();
-
- // there is currently no need for a viewer
- // fPreviewViewer.invalidateTextPresentation();
- }
-
- /*
- * @see PreferencePage#performOk()
- */
- public boolean performOk() {
- for (int i = 0; i < fTabs.length; i++) {
- fTabs[i].performOk();
- }
-
- fOverlayStore.propagate();
- SSEUIPlugin.getDefault().savePluginPreferences();
-
- // tab width is also a model-side preference so need to set it
- // TODO need to handle tab width for formatter somehow
- // int tabWidth =
- // getPreferenceStore().getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
- // ModelPlugin.getDefault().getPluginPreferences().setValue(CommonModelPreferenceNames.TAB_WIDTH,
- // tabWidth);
- // ModelPlugin.getDefault().savePluginPreferences();
-
- return true;
- }
-
- void updateStatus(IStatus status) {
- if (!status.matches(IStatus.ERROR)) {
- for (int i = 0; i < fNumberFields.size(); i++) {
- Text text = (Text) fNumberFields.get(i);
- IStatus s = validatePositiveNumber(text.getText());
- status = s.getSeverity() > status.getSeverity() ? s : status;
- }
- }
-
- setValid(!status.matches(IStatus.ERROR));
- applyToStatusLine(this, status);
- }
-
- private IStatus validatePositiveNumber(String number) {
- StatusInfo status = new StatusInfo();
- if (number.length() == 0) {
- status.setError(SSEUIMessages.StructuredTextEditorPreferencePage_37);
- }
- else {
- try {
- int value = Integer.parseInt(number);
- if (value < 0)
- status.setError(number + SSEUIMessages.StructuredTextEditorPreferencePage_38);
- }
- catch (NumberFormatException e) {
- status.setError(number + SSEUIMessages.StructuredTextEditorPreferencePage_38);
- }
- }
- return status;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StyledTextColorPicker.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StyledTextColorPicker.java
deleted file mode 100644
index 6fbb0994da..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/StyledTextColorPicker.java
+++ /dev/null
@@ -1,948 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import java.io.CharArrayReader;
-import java.util.Dictionary;
-import java.util.List;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.accessibility.AccessibleControlListener;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.PaletteData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.ColorDialog;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.sse.core.internal.ltk.parser.RegionParser;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.sse.core.internal.util.Debug;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
-import org.w3c.dom.Node;
-
-import com.ibm.icu.text.Collator;
-
-/**
- * This class is configurable by setting 3 properties: 1) an array of Strings
- * as the styleNames; one unique entry for every style type meant to be
- * configurable by the user 2) a Dictionary of descriptions, mapping the
- * styleNames to unique descriptions - meant for use within the selection
- * ComboBox TODO (pa) this should probably be working off document partitions
- * now (2.1+) 3) a Dictionary mapping parsed ITextRegion contexts (strings) to
- * the locally defined styleNames
- *
- */
-public class StyledTextColorPicker extends Composite {
- protected class DescriptionSorter extends org.eclipse.wst.sse.ui.internal.util.Sorter {
- Collator collator = Collator.getInstance();
-
- public boolean compare(Object elementOne, Object elementTwo) {
- /**
- * Returns true if elementTwo is 'greater than' elementOne This is
- * the 'ordering' method of the sort operation. Each subclass
- * overides this method with the particular implementation of the
- * 'greater than' concept for the objects being sorted.
- */
- return (collator.compare(elementOne.toString(), elementTwo.toString())) < 0;
- }
- }
-
- public static final String BACKGROUND = "background"; //$NON-NLS-1$
- public static final String BOLD = "bold"; //$NON-NLS-1$
- public static final String COLOR = "color"; //$NON-NLS-1$
-
- // names for preference elements ... non-NLS
- public static final String FOREGROUND = "foreground"; //$NON-NLS-1$
- public static final String ITALIC = "italic"; //$NON-NLS-1$
- public static final String NAME = "name"; //$NON-NLS-1$
-
- protected static final boolean showItalic = false;
- protected AccessibleControlListener backgroundAccListener = new AccessibleControlAdapter() {
- /**
- * @see org.eclipse.swt.accessibility.AccessibleControlAdapter#getValue(AccessibleControlEvent)
- */
- public void getValue(AccessibleControlEvent e) {
- if (e.childID == ACC.CHILDID_SELF) {
- e.result = getColorButtonValue(fBackground);
- }
- }
- };
- protected SelectionListener buttonListener = new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- String namedStyle = getStyleName(fStyleCombo.getItem(fStyleCombo.getSelectionIndex()));
- if (namedStyle == null)
- return;
- if (e.widget == fForeground) {
- // get current (newly old) style
- String prefString = getPreferenceStore().getString(getPreferenceKey(namedStyle));
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[0];
- // open color dialog to get new color
- String newValue = changeColor(oldValue);
-
- if (!newValue.equals(oldValue)) {
- stylePrefs[0] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getPreferenceStore().setValue(getPreferenceKey(namedStyle), newPrefString);
- refresh();
- }
- }
- } else if (e.widget == fBackground) {
- // get current (newly old) style
- String prefString = getPreferenceStore().getString(getPreferenceKey(namedStyle));
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[1];
- // open color dialog to get new color
- String newValue = changeColor(oldValue);
-
- if (!newValue.equals(oldValue)) {
- stylePrefs[1] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getPreferenceStore().setValue(getPreferenceKey(namedStyle), newPrefString);
- refresh();
- }
- }
- } else if (e.widget == fBold) {
- // get current (newly old) style
- String prefString = getPreferenceStore().getString(getPreferenceKey(namedStyle));
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[2];
- String newValue = String.valueOf(fBold.getSelection());
- if (!newValue.equals(oldValue)) {
- stylePrefs[2] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getPreferenceStore().setValue(getPreferenceKey(namedStyle), newPrefString);
- refresh();
- }
- }
- } else if (showItalic && e.widget == fItalic) {
- // get current (newly old) style
- String prefString = getPreferenceStore().getString(getPreferenceKey(namedStyle));
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[3];
- String newValue = String.valueOf(fItalic.getSelection());
- if (!newValue.equals(oldValue)) {
- stylePrefs[3] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getPreferenceStore().setValue(getPreferenceKey(namedStyle), newPrefString);
- refresh();
- }
- }
- } else if (e.widget == fClearStyle) {
- getPreferenceStore().setToDefault(getPreferenceKey(namedStyle));
- refresh();
- }
- }
- };
-
- protected SelectionListener comboListener = new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- int selectedIndex = fStyleCombo.getSelectionIndex();
- String description = selectedIndex >= 0 ? fStyleCombo.getItem(selectedIndex) : null;
- activate(getStyleName(description));
- }
- };
- protected Button fBackground;
- protected Label fBackgroundLabel;
- protected Button fBold;
- protected Button fClearStyle;
- // Dictionary mapping the ITextRegion types above to color names, which
- // are, in turn, attributes
- protected Dictionary fContextStyleMap = null;
- protected Color fDefaultBackground = getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
-
- protected Color fDefaultForeground = getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- // Dictionary mapping the ITextRegion types above to display strings, for
- // use in the combo box
- protected Dictionary fDescriptions = null;
- protected Button fForeground;
- protected Label fForegroundLabel;
-// private String fGeneratorKey;
- protected String fInput = ""; //$NON-NLS-1$
- protected Button fItalic;
-
- private IStructuredDocumentRegion fNodes = null;
- // defect 200764 - ACC:display values for color buttons
- protected AccessibleControlListener foregroundAccListener = new AccessibleControlAdapter() {
- /**
- * @see org.eclipse.swt.accessibility.AccessibleControlAdapter#getValue(AccessibleControlEvent)
- */
- public void getValue(AccessibleControlEvent e) {
- if (e.childID == ACC.CHILDID_SELF) {
- e.result = getColorButtonValue(fForeground);
- }
- }
- };
- // A RegionParser, which will turn the input into
- // IStructuredDocumentRegion(s) and Regions
- protected RegionParser fParser = null;
-
- private IPreferenceStore fPreferenceStore;
- protected Combo fStyleCombo = null;
- // The list of supported ITextRegion types [Strings]
- protected List fStyleList = null;
-
- // controls in picker
- protected StyledText fText = null;
-
- /**
- * XMLTextColorPicker constructor comment.
- *
- * @param parent
- * org.eclipse.swt.widgets.Composite
- * @param style
- * int
- */
- public StyledTextColorPicker(Composite parent, int style) {
- super(parent, style);
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- setLayout(layout);
- createControls(this);
- }
-
- // activate controls based on the given local color type
- protected void activate(String namedStyle) {
- if (namedStyle == null) {
- fForeground.setEnabled(false);
- fBackground.setEnabled(false);
- fClearStyle.setEnabled(false);
- fBold.setEnabled(false);
- if (showItalic)
- fItalic.setEnabled(false);
- fForegroundLabel.setEnabled(false);
- fBackgroundLabel.setEnabled(false);
- }
- else {
- fForeground.setEnabled(true);
- fBackground.setEnabled(true);
- fClearStyle.setEnabled(true);
- fBold.setEnabled(true);
- if (showItalic)
- fItalic.setEnabled(true);
- fForegroundLabel.setEnabled(true);
- fBackgroundLabel.setEnabled(true);
-
- }
- TextAttribute attribute = getAttribute(namedStyle);
- Color color = attribute.getForeground();
- if (color == null) {
- color = fDefaultForeground;
- }
- if (fForeground.getSize().x > 0 && fForeground.getSize().y > 0 && (fForeground.getImage() == null || fForeground.getImage().getImageData() == null || fForeground.getImage().getImageData().getRGBs() == null || fForeground.getImage().getImageData().getRGBs().length < 1 || !fForeground.getImage().getImageData().getRGBs()[0].equals(color.getRGB()))) {
- if (fForeground.getImage() != null)
- fForeground.getImage().dispose();
- Image foreground = new Image(getDisplay(), new ImageData(fForeground.getSize().x, fForeground.getSize().y, 1, new PaletteData(new RGB[]{color.getRGB()})));
- fForeground.setImage(foreground);
- }
- color = attribute.getBackground();
- if (color == null) {
- color = fDefaultBackground;
- }
- if (fBackground.getSize().x > 0 && fBackground.getSize().y > 0 && (fBackground.getImage() == null || fBackground.getImage().getImageData() == null || fBackground.getImage().getImageData().getRGBs() == null || fBackground.getImage().getImageData().getRGBs().length < 1 || !fBackground.getImage().getImageData().getRGBs()[0].equals(color.getRGB()))) {
- if (fBackground.getImage() != null)
- fBackground.getImage().dispose();
- Image background = new Image(getDisplay(), new ImageData(fBackground.getSize().x, fBackground.getSize().y, 1, new PaletteData(new RGB[]{color.getRGB()})));
- fBackground.setImage(background);
- }
- fBold.setSelection((attribute.getStyle() & SWT.BOLD) != 0);
- if (showItalic)
- fItalic.setSelection((attribute.getStyle() & SWT.ITALIC) != 0);
- }
-
- protected void applyStyles() {
- if (fText == null || fText.isDisposed() || fInput == null || fInput.length() == 0)
- return;
- // List regions = fParser.getRegions();
- IStructuredDocumentRegion node = fNodes;
- while (node != null) {
- ITextRegionList regions = node.getRegions();
- for (int i = 0; i < regions.size(); i++) {
- ITextRegion currentRegion = regions.get(i);
- // lookup the local coloring type and apply it
- String namedStyle = (String) getContextStyleMap().get(currentRegion.getType());
- if (namedStyle == null)
- continue;
- TextAttribute attribute = getAttribute(namedStyle);
- if (attribute == null)
- continue;
- StyleRange style = new StyleRange(node.getStartOffset(currentRegion), currentRegion.getLength(), attribute.getForeground(), attribute.getBackground(), attribute.getStyle());
- fText.setStyleRange(style);
- }
- node = node.getNext();
- }
- }
-
- private RGB changeColor(RGB startValue) {
- ColorDialog colorDlg = new ColorDialog(getShell());
- if (startValue != null)
- colorDlg.setRGB(startValue);
- if(colorDlg.getText() == null || colorDlg.getText().length() == 0)
- colorDlg.setText(SSEUIMessages.StyledTextColorPicker_0);
- colorDlg.open();
- RGB newRGB = colorDlg.getRGB();
- if (newRGB != null)
- return newRGB;
- return startValue;
- }
-
- private String changeColor(String rgb) {
- String changedColor = "null"; //$NON-NLS-1$
-
- RGB newColor = changeColor(ColorHelper.toRGB(rgb));
- // null check to see if using default value
- if (newColor != null)
- changedColor = ColorHelper.toRGBString(newColor);
- return changedColor;
- }
-
- protected void close() {
- }
-
- /**
- * Determines size of color button copied from
- * org.eclipse.jdt.internal.ui.preferences.ColorEditor 1 modification -
- * added 4 to final height
- */
- private Point computeImageSize(Control window) {
- GC gc = new GC(window);
- Font f = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
- gc.setFont(f);
- int height = gc.getFontMetrics().getHeight();
- gc.dispose();
- Point p = new Point(height * 3 - 6, height + 4);
- return p;
- }
-
- /**
- * Creates an new checkbox instance and sets the default layout data.
- *
- * @param group
- * the composite in which to create the checkbox
- * @param label
- * the string to set into the checkbox
- * @return the new checkbox
- */
- private Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.CENTER);
- if (label != null)
- button.setText(label);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END;
- // data.verticalAlignment = GridData.VERTICAL_ALIGN_FILL;
- button.setLayoutData(data);
- return button;
- }
-
- private Combo createCombo(Composite parent, String[] labels, int selectedItem) {
- Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
- combo.setItems(labels);
- if (selectedItem >= 0)
- combo.select(selectedItem);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
- combo.setLayoutData(data);
- return combo;
- }
-
- /**
- * Creates composite control and sets the default layout data.
- */
- private Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.horizontalSpacing = 5;
- layout.makeColumnsEqualWidth = false;
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData(GridData.FILL_VERTICAL);
- data.grabExcessVerticalSpace = false;
- data.verticalAlignment = GridData.VERTICAL_ALIGN_CENTER;
- composite.setLayoutData(data);
- return composite;
- }
-
- protected void createControls(Composite parent) {
- Composite styleRow = createComposite(parent, 3);
- // row 1 - content type label, combo box, restore defaults
- createLabel(styleRow, SSEUIMessages.Content_type__UI_); //$NON-NLS-1$ = "Content type:"
- // Contexts combo box
- fStyleCombo = createCombo(styleRow, new String[0], -1);
- fClearStyle = createPushButton(styleRow, SSEUIMessages.Restore_Default_UI_); //$NON-NLS-1$ = "Restore Default"
- Composite styleRow2;
- if (showItalic)
- styleRow2 = createComposite(parent, 7);
- else
- styleRow2 = createComposite(parent, 6);
- // row 2 - foreground label, button, background label, button, bold,
- // italics?
- fForegroundLabel = createLabel(styleRow2, SSEUIMessages.Foreground_UI_); //$NON-NLS-1$ = "Foreground"
- fForeground = createPushButton(styleRow2, ""); //$NON-NLS-1$
- setAccessible(fForeground, fForegroundLabel.getText());
- fForeground.getAccessible().addAccessibleControlListener(foregroundAccListener); // defect
- // 200764
- // -
- // ACC:display
- // values
- // for
- // color
- // buttons
- Point buttonSize = computeImageSize(parent);
- ((GridData) fForeground.getLayoutData()).widthHint = buttonSize.x;
- ((GridData) fForeground.getLayoutData()).heightHint = buttonSize.y;
- fBackgroundLabel = createLabel(styleRow2, SSEUIMessages.Background_UI_); //$NON-NLS-1$ = "Background"
- fBackground = createPushButton(styleRow2, ""); //$NON-NLS-1$
- setAccessible(fBackground, fBackgroundLabel.getText());
- fBackground.getAccessible().addAccessibleControlListener(backgroundAccListener); // defect
- // 200764
- // -
- // ACC:display
- // values
- // for
- // color
- // buttons
- ((GridData) fBackground.getLayoutData()).widthHint = buttonSize.x;
- ((GridData) fBackground.getLayoutData()).heightHint = buttonSize.y;
- createLabel(styleRow2, ""); //$NON-NLS-1$
- fBold = createCheckBox(styleRow2, SSEUIMessages.Bold_UI_);
- if (showItalic)
- fItalic = createCheckBox(styleRow2, SSEUIMessages.Italics_UI);
- // // Defaults checkbox
- fForeground.setEnabled(false);
- fBackground.setEnabled(false);
- fClearStyle.setEnabled(false);
- fBold.setEnabled(false);
- if (showItalic)
- fItalic.setEnabled(false);
- fForegroundLabel.setEnabled(false);
- fBackgroundLabel.setEnabled(false);
- Composite sample = createComposite(parent, 1);
- createLabel(sample, SSEUIMessages.Sample_text__UI_); //$NON-NLS-1$ = "&Sample text:"
- // BUG141089 - make sure text is left-aligned
- fText = new StyledText(sample, SWT.LEFT_TO_RIGHT | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_BOTH);
- fText.setLayoutData(data);
- fText.setEditable(false);
- fText.setBackground(fDefaultBackground);
- fText.setFont(JFaceResources.getTextFont());
- fText.addKeyListener(getTextKeyListener());
- fText.addSelectionListener(getTextSelectionListener());
- fText.addMouseListener(getTextMouseListener());
- fText.addTraverseListener(getTraverseListener()); // defect 220377 -
- // Provide tab
- // traversal for
- // fText widget
- setAccessible(fText, SSEUIMessages.Sample_text__UI_); //$NON-NLS-1$ = "&Sample text:"
- fForeground.addSelectionListener(buttonListener);
- fBackground.addSelectionListener(buttonListener);
- fClearStyle.addSelectionListener(buttonListener);
- fBold.addSelectionListener(buttonListener);
- if (showItalic)
- fItalic.addSelectionListener(buttonListener);
- fStyleCombo.addSelectionListener(comboListener);
- }
-
- /**
- * Utility method that creates a label instance and sets the default
- * layout data.
- */
- private Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
- }
-
- private Button createPushButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.PUSH);
- button.setText(label);
- GridData data = new GridData(GridData.FILL_BOTH);
- // data.horizontalAlignment = GridData.FILL;
- button.setLayoutData(data);
- return button;
- }
-
- protected TextAttribute getAttribute(String namedStyle) {
- TextAttribute ta = new TextAttribute(getDefaultForeground(), getDefaultBackground(), SWT.NORMAL);
-
- if (namedStyle != null && getPreferenceStore() != null) {
- String prefString = getPreferenceStore().getString(getPreferenceKey(namedStyle));
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- RGB foreground = ColorHelper.toRGB(stylePrefs[0]);
- RGB background = ColorHelper.toRGB(stylePrefs[1]);
-
- int fontModifier = SWT.NORMAL;
- boolean bold = Boolean.valueOf(stylePrefs[2]).booleanValue();
- if (bold)
- fontModifier = fontModifier | SWT.BOLD;
-
- if (showItalic) {
- boolean italic = Boolean.valueOf(stylePrefs[3]).booleanValue();
- if (italic)
- fontModifier = fontModifier | SWT.ITALIC;
- }
-
- ta = new TextAttribute((foreground != null) ? EditorUtility.getColor(foreground) : null, (background != null) ? EditorUtility.getColor(background) : null, fontModifier);
- }
- }
- return ta;
- }
-
- // defect 200764 - ACC:display values for color buttons
- /**
- * @return String - color Button b's current RBG value
- */
- private String getColorButtonValue(Button b) {
- if ((b == null) || (b.getImage() == null) || (b.getImage().getImageData() == null) || (b.getImage().getImageData().getRGBs() == null) || (b.getImage().getImageData().getRGBs()[0] == null))
- return null;
- String val = b.getImage().getImageData().getRGBs()[0].toString();
- return val;
- }
-
- /**
- * @deprecated use getPreferenceStore instead left for legacy clients,
- * delete by WTP M4
- */
- public Node getColorsNode() {
- //return fColorsNode;
- return null;
- }
-
- /**
- * @return java.util.Dictionary
- */
- public Dictionary getContextStyleMap() {
- return fContextStyleMap;
- }
-
- /**
- * @return org.eclipse.swt.graphics.Color
- */
- public Color getDefaultBackground() {
- return fDefaultBackground;
- }
-
- /**
- * @return org.eclipse.swt.graphics.Color
- */
- public Color getDefaultForeground() {
- return fDefaultForeground;
- }
-
- /**
- * @return java.util.Dictionary
- */
- public Dictionary getDescriptions() {
- return fDescriptions;
- }
-
- public Font getFont() {
- return fText.getFont();
- }
-
- protected String getNamedStyleAtOffset(int offset) {
- // ensure the offset is clean
- if (offset >= fInput.length())
- return getNamedStyleAtOffset(fInput.length() - 1);
- else if (offset < 0)
- return getNamedStyleAtOffset(0);
- // find the ITextRegion at this offset
- if (fNodes == null)
- return null;
- IStructuredDocumentRegion aNode = fNodes;
- while (aNode != null && !aNode.containsOffset(offset))
- aNode = aNode.getNext();
- if (aNode != null) {
- // find the ITextRegion's Context at this offset
- ITextRegion interest = aNode.getRegionAtCharacterOffset(offset);
- if (interest == null)
- return null;
- if (offset > aNode.getTextEndOffset(interest))
- return null;
- String regionContext = interest.getType();
- if (regionContext == null)
- return null;
- // find the named style (internal/selectable name) for that
- // context
- String namedStyle = (String) getContextStyleMap().get(regionContext);
- if (namedStyle != null) {
- return namedStyle;
- }
- }
- return null;
- }
-
-
- public RegionParser getParser() {
- return fParser;
- }
-
- /**
- * @deprecated just key key (no need for generator)
- */
- private String getPreferenceKey(String key) {
- String newKey = key;
-// if (fGeneratorKey != null) {
-// newKey = PreferenceKeyGenerator.generateKey(key, fGeneratorKey);
-// }
- return newKey;
- }
-
- private IPreferenceStore getPreferenceStore() {
- return fPreferenceStore;
- }
-
- /**
- * @return String[]
- */
- public List getStyleList() {
- return fStyleList;
- }
-
- private String getStyleName(String description) {
- if (description == null)
- return null;
- String styleName = null;
- java.util.Enumeration keys = getDescriptions().keys();
- while (keys.hasMoreElements()) {
- String test = keys.nextElement().toString();
- if (getDescriptions().get(test).equals(description)) {
- styleName = test;
- break;
- }
- }
- return styleName;
- }
-
- public String getText() {
- return fInput;
- }
-
- private KeyListener getTextKeyListener() {
- return new KeyListener() {
- public void keyPressed(KeyEvent e) {
- if (e.widget instanceof StyledText) {
- int x = ((StyledText) e.widget).getCaretOffset();
- selectColorAtOffset(x);
- }
- }
-
- public void keyReleased(KeyEvent e) {
- if (e.widget instanceof StyledText) {
- int x = ((StyledText) e.widget).getCaretOffset();
- selectColorAtOffset(x);
- }
- }
- };
- }
-
- private MouseListener getTextMouseListener() {
- return new MouseListener() {
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
- }
-
- public void mouseUp(MouseEvent e) {
- if (e.widget instanceof StyledText) {
- int x = ((StyledText) e.widget).getCaretOffset();
- selectColorAtOffset(x);
- }
- }
- };
- }
-
- private SelectionListener getTextSelectionListener() {
- return new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- selectColorAtOffset(e.x);
- if (e.widget instanceof StyledText) {
- ((StyledText) e.widget).setSelection(e.x);
- }
- }
-
-// Commented out when moving to RC2 to remove "unused" error/warning
-// public void widgetDoubleSelected(SelectionEvent e) {
-// selectColorAtOffset(e.x);
-// if (e.widget instanceof StyledText) {
-// ((StyledText) e.widget).setSelection(e.x);
-// }
-// }
-
- public void widgetSelected(SelectionEvent e) {
- selectColorAtOffset(e.x);
- if (e.widget instanceof StyledText) {
- ((StyledText) e.widget).setSelection(e.x);
- }
- }
- };
- }
-
- // defect 220377 - Provide tab traversal for fText widget
- private TraverseListener getTraverseListener() {
- return new TraverseListener() {
- /**
- * @see org.eclipse.swt.events.TraverseListener#keyTraversed(TraverseEvent)
- */
- public void keyTraversed(TraverseEvent e) {
- if (e.widget instanceof StyledText) {
- if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS))
- e.doit = true;
- }
- }
- };
- }
-
- // refresh the GUI after a color change
- public void refresh() {
- fText.setRedraw(false);
- int selectedIndex = fStyleCombo.getSelectionIndex();
- String description = selectedIndex >= 0 ? fStyleCombo.getItem(selectedIndex) : null;
- activate(getStyleName(description));
- // update Font
- fText.setFont(JFaceResources.getTextFont());
- // reapplyStyles
- applyStyles();
- fText.setRedraw(true);
- }
-
- public void releasePickerResources() {
- if (fForeground != null && !fForeground.isDisposed() && fForeground.getImage() != null)
- fForeground.getImage().dispose();
- if (fBackground != null && !fBackground.isDisposed() && fBackground.getImage() != null)
- fBackground.getImage().dispose();
- }
-
- private void selectColorAtOffset(int offset) {
- String namedStyle = getNamedStyleAtOffset(offset);
- if (namedStyle == null) {
- fStyleCombo.deselectAll();
- activate(null);
- return;
- }
- String description = (String) getDescriptions().get(namedStyle);
- if (description == null)
- return;
- int itemCount = fStyleCombo.getItemCount();
- for (int i = 0; i < itemCount; i++) {
- if (fStyleCombo.getItem(i).equals(description)) {
- fStyleCombo.select(i);
- break;
- }
- }
- activate(namedStyle);
- }
-
- /**
- * Specifically set the reporting name of a control for accessibility
- */
- private void setAccessible(Control control, String name) {
- if (control == null)
- return;
- final String n = name;
- control.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getName(AccessibleEvent e) {
- if (e.childID == ACC.CHILDID_SELF)
- e.result = n;
- }
- });
- }
-
- /**
- * @deprecated use setPreferenceStore instead left for legacy clients,
- * delete by WTP M4
- */
- public void setColorsNode(Node newColorsNode) {
- //fColorsNode = newColorsNode;
- }
-
- /**
- * @param newContextStyleMap
- * java.util.Dictionary
- */
- public void setContextStyleMap(Dictionary newContextStyleMap) {
- fContextStyleMap = newContextStyleMap;
- }
-
- /**
- * @param newDefaultBackground
- * org.eclipse.swt.graphics.Color
- */
- public void setDefaultBackground(Color newDefaultBackground) {
- fDefaultBackground = newDefaultBackground;
- }
-
- /**
- * @deprecated use setPreferenceStore instead left for legacy clients,
- * delete by WTP M4
- */
- public void setDefaultColorsNode(Node newDefaultColorsNode) {
- //fDefaultColorsNode = newDefaultColorsNode;
- }
-
- /**
- * @param newDefaultForeground
- * org.eclipse.swt.graphics.Color
- */
- public void setDefaultForeground(Color newDefaultForeground) {
- fDefaultForeground = newDefaultForeground;
- }
-
- /**
- * @param newDescriptions
- * java.util.Dictionary
- */
- public void setDescriptions(Dictionary newDescriptions) {
- fDescriptions = newDescriptions;
- updateStyleList();
- }
-
- public void setFont(Font font) {
- fText.setFont(font);
- fText.redraw();
- }
-
- /**
- * @deprecated generator key should no longer be needed
- */
- public void setGeneratorKey(String key) {
-// fGeneratorKey = key;
- }
-
- /**
- * @param newParser
- */
- public void setParser(RegionParser newParser) {
- fParser = newParser;
- }
-
- public void setPreferenceStore(IPreferenceStore store) {
- fPreferenceStore = store;
- }
-
- /**
- * @param newStyleList
- * String[]
- */
- public void setStyleList(List newStyleList) {
- fStyleList = newStyleList;
- updateStyleList();
- }
-
- public void setText(String s) {
- fInput = s;
- getParser().reset(new CharArrayReader(fInput.toCharArray()));
- fNodes = getParser().getDocumentRegions();
- if (Debug.displayInfo)
- System.out.println("Length of input: " //$NON-NLS-1$
- //$NON-NLS-1$
- + s.length() + ", " //$NON-NLS-1$
- + getParser().getRegions().size() + " regions."); //$NON-NLS-1$
- if (fText != null)
- fText.setText(s);
- applyStyles();
- }
-
-
-
- /**
- * @return org.eclipse.swt.graphics.RGB
- * @param anRGBString
- * java.lang.String
- * @param defaultRGB
- * org.eclipse.swt.graphics.RGB
- */
- // TODO: never used
- RGB toRGB(String anRGBString, RGB defaultRGB) {
- RGB result = ColorHelper.toRGB(anRGBString);
- if (result == null)
- return defaultRGB;
- return result;
- }
-
- private void updateStyleList() {
- if (fStyleList == null || fDescriptions == null)
- return;
- String[] descriptions = new String[fStyleList.size()];
- for (int i = 0; i < fStyleList.size(); i++) {
- if (fStyleList.get(i) != null)
- descriptions[i] = (String) getDescriptions().get(fStyleList.get(i));
- else
- descriptions[i] = (String) fStyleList.get(i);
- }
- Object[] sortedObjects = new DescriptionSorter().sort(descriptions);
- String[] sortedDescriptions = new String[descriptions.length];
- for (int i = 0; i < descriptions.length; i++) {
- sortedDescriptions[i] = sortedObjects[i].toString();
- }
- fStyleCombo.setItems(sortedDescriptions);
- fStyleCombo.select(0); //defect 219855 - initially select first item
- // in comboBox
- // fStyleCombo.deselectAll();
- }
-
-
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/TextHoverPreferenceTab.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/TextHoverPreferenceTab.java
deleted file mode 100644
index 009239b0ee..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/TextHoverPreferenceTab.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
-import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore;
-import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
-import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager.TextHoverDescriptor;
-import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
-
-/**
- * Preference tab for Structured text editor hover help preferences
- *
- * @author amywu
- */
-public class TextHoverPreferenceTab extends AbstractPreferenceTab {
-
- private class InternalTableLabelProvider extends LabelProvider implements ITableLabelProvider {
- public InternalTableLabelProvider() {
- super();
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- switch (columnIndex) {
- case 0 : // text hover label
- return ((TextHoverManager.TextHoverDescriptor) element).getLabel();
-
- case 1 : // text hover state mask
- return ((TextHoverManager.TextHoverDescriptor) element).getModifierString();
-
- default :
- break;
- }
-
- return null;
- }
- }
-
- private static final String DELIMITER = SSEUIMessages.TextHoverPreferenceTab_delimiter; //$NON-NLS-1$
- private Text fDescription;
- private Table fHoverTable;
- private TableViewer fHoverTableViewer;
- private TableColumn fModifierColumn;
- // for this preference page
- private Text fModifierEditor;
- private TableColumn fNameColumn;
-
- private TextHoverDescriptor[] fTextHovers; // current list of text hovers
-
- public TextHoverPreferenceTab(PreferencePage mainPreferencePage, OverlayPreferenceStore store) {
- Assert.isNotNull(mainPreferencePage);
- Assert.isNotNull(store);
- setMainPreferencePage(mainPreferencePage);
- setOverlayStore(store);
- getOverlayStore().addKeys(createOverlayStoreKeys());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#createContents(org.eclipse.swt.widgets.Composite)
- */
- public Control createContents(Composite tabFolder) {
- Composite hoverComposite = new Composite(tabFolder, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- hoverComposite.setLayout(layout);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- hoverComposite.setLayoutData(gd);
-
- // commented out until these preferences are actually handled in some
- // way
- // String rollOverLabel=
- // ResourceHandler.getString("TextHoverPreferenceTab.annotationRollover");
- // //$NON-NLS-1$
- // addCheckBox(hoverComposite, rollOverLabel,
- // CommonEditorPreferenceNames.EDITOR_ANNOTATION_ROLL_OVER, 0);
- //
- // // Affordance checkbox
- // String showAffordanceLabel =
- // ResourceHandler.getString("TextHoverPreferenceTab.showAffordance");
- // //$NON-NLS-1$
- // addCheckBox(hoverComposite, showAffordanceLabel,
- // CommonEditorPreferenceNames.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, 0);
-
- Label label = new Label(hoverComposite, SWT.NONE);
- label.setText(SSEUIMessages.TextHoverPreferenceTab_hoverPreferences); //$NON-NLS-1$
- gd = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- gd.horizontalAlignment = GridData.BEGINNING;
- label.setLayoutData(gd);
-
- fHoverTableViewer = CheckboxTableViewer.newCheckList(hoverComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
- // Hover table
- fHoverTable = fHoverTableViewer.getTable();
- fHoverTable.setHeaderVisible(true);
- fHoverTable.setLinesVisible(true);
-
- gd = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=104507
- GC gc = new GC(fHoverTable);
- gc.setFont(fHoverTable.getFont());
- FontMetrics fontMetrics = gc.getFontMetrics();
- gc.dispose();
- int heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, 7);
- gd.heightHint = heightHint;
-
- fHoverTable.setLayoutData(gd);
-
- TableLayout tableLayout = new TableLayout();
- tableLayout.addColumnData(new ColumnWeightData(1, 140, true));
- tableLayout.addColumnData(new ColumnWeightData(1, 140, true));
- fHoverTable.setLayout(tableLayout);
-
- fHoverTable.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- handleHoverListSelection();
- }
- });
-
- fNameColumn = new TableColumn(fHoverTable, SWT.NONE);
- fNameColumn.setText(SSEUIMessages.TextHoverPreferenceTab_nameColumnTitle); //$NON-NLS-1$
- fNameColumn.setResizable(true);
-
- fModifierColumn = new TableColumn(fHoverTable, SWT.NONE);
- fModifierColumn.setText(SSEUIMessages.TextHoverPreferenceTab_modifierColumnTitle); //$NON-NLS-1$
- fModifierColumn.setResizable(true);
-
- fHoverTableViewer.setUseHashlookup(true);
- fHoverTableViewer.setContentProvider(new ArrayContentProvider());
- fHoverTableViewer.setLabelProvider(new InternalTableLabelProvider());
- ((CheckboxTableViewer) fHoverTableViewer).addCheckStateListener(new ICheckStateListener() {
- /*
- * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
- */
- public void checkStateChanged(CheckStateChangedEvent event) {
- String id = ((TextHoverDescriptor) event.getElement()).getId();
- if (id == null)
- return;
-
- TextHoverManager.TextHoverDescriptor[] descriptors = getTextHoverManager().getTextHovers();
- TextHoverManager.TextHoverDescriptor hoverConfig = null;
- int i = 0, length = fTextHovers.length;
- while (i < length) {
- if (id.equals(descriptors[i].getId())) {
- hoverConfig = fTextHovers[i];
- hoverConfig.setEnabled(event.getChecked());
- fModifierEditor.setEnabled(event.getChecked());
- fHoverTableViewer.setSelection(new StructuredSelection(descriptors[i]));
- }
- i++;
- }
-
- handleHoverListSelection();
- updateStatus(hoverConfig);
- }
- });
-
- // Text field for modifier string
- label = new Label(hoverComposite, SWT.LEFT);
- label.setText(SSEUIMessages.TextHoverPreferenceTab_keyModifier); //$NON-NLS-1$
- fModifierEditor = new Text(hoverComposite, SWT.BORDER);
- gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- fModifierEditor.setLayoutData(gd);
-
- fModifierEditor.addKeyListener(new KeyListener() {
- private boolean isModifierCandidate;
-
- public void keyPressed(KeyEvent e) {
- isModifierCandidate = e.keyCode > 0 && e.character == 0 && e.stateMask == 0;
- }
-
- public void keyReleased(KeyEvent e) {
- if (isModifierCandidate && e.stateMask > 0 && e.stateMask == e.stateMask && e.character == 0) {// &&
- // e.time
- // -time
- // <
- // 1000)
- // {
- String text = fModifierEditor.getText();
- Point selection = fModifierEditor.getSelection();
- int i = selection.x - 1;
- while (i > -1 && Character.isWhitespace(text.charAt(i))) {
- i--;
- }
- boolean needsPrefixDelimiter = i > -1 && !String.valueOf(text.charAt(i)).equals(DELIMITER);
-
- i = selection.y;
- while (i < text.length() && Character.isWhitespace(text.charAt(i))) {
- i++;
- }
- boolean needsPostfixDelimiter = i < text.length() && !String.valueOf(text.charAt(i)).equals(DELIMITER);
-
- String insertString;
-
- if (needsPrefixDelimiter && needsPostfixDelimiter)
- insertString = NLS.bind(SSEUIMessages.TextHoverPreferenceTab_insertDelimiterAndModifierAndDelimiter, new String[]{Action.findModifierString(e.stateMask)});
- else if (needsPrefixDelimiter)
- insertString = NLS.bind(SSEUIMessages.TextHoverPreferenceTab_insertDelimiterAndModifier, new String[]{Action.findModifierString(e.stateMask)});
- else if (needsPostfixDelimiter)
- insertString = NLS.bind(SSEUIMessages.TextHoverPreferenceTab_insertModifierAndDelimiter, new String[]{Action.findModifierString(e.stateMask)});
- else
- insertString = Action.findModifierString(e.stateMask);
-
- if (insertString != null)
- fModifierEditor.insert(insertString);
- }
- }
- });
-
- fModifierEditor.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- handleModifierModified();
- }
- });
-
- // Description
- Label descriptionLabel = new Label(hoverComposite, SWT.LEFT);
- descriptionLabel.setText(SSEUIMessages.TextHoverPreferenceTab_description); //$NON-NLS-1$
- gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- gd.horizontalSpan = 2;
- descriptionLabel.setLayoutData(gd);
- fDescription = new Text(hoverComposite, SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER);
- gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
- gd.horizontalSpan = 2;
- fDescription.setLayoutData(gd);
-
- initialize();
-
- Dialog.applyDialogFont(hoverComposite);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(hoverComposite, IHelpContextIds.PREFSTE_HOVERS_HELPID);
- return hoverComposite;
- }
-
- private OverlayPreferenceStore.OverlayKey[] createOverlayStoreKeys() {
- ArrayList overlayKeys = new ArrayList();
-
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, EditorPreferenceNames.EDITOR_TEXT_HOVER_MODIFIERS));
-
- OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
- overlayKeys.toArray(keys);
- return keys;
- }
-
- private String generateTextHoverString() {
- StringBuffer buf = new StringBuffer();
-
- for (int i = 0; i < fTextHovers.length; i++) {
- buf.append(fTextHovers[i].getId());
- buf.append(TextHoverManager.HOVER_ATTRIBUTE_SEPARATOR);
- buf.append(Boolean.toString(fTextHovers[i].isEnabled()));
- buf.append(TextHoverManager.HOVER_ATTRIBUTE_SEPARATOR);
- String modifier = fTextHovers[i].getModifierString();
- if (modifier == null || modifier.length() == 0)
- modifier = TextHoverManager.NO_MODIFIER;
- buf.append(modifier);
- buf.append(TextHoverManager.HOVER_SEPARATOR);
- }
- return buf.toString();
- }
-
- private TextHoverManager getTextHoverManager() {
- return SSEUIPlugin.getDefault().getTextHoverManager();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#getTitle()
- */
- public String getTitle() {
- return SSEUIMessages.TextHoverPreferenceTab_title; //$NON-NLS-1$
- }
-
- void handleHoverListSelection() {
- int i = fHoverTable.getSelectionIndex();
-
- if (i == -1) {
- if (fHoverTable.getSelectionCount() == 0)
- fModifierEditor.setEnabled(false);
- return;
- }
-
- boolean enabled = fTextHovers[i].isEnabled();
- fModifierEditor.setEnabled(enabled);
- fModifierEditor.setText(fTextHovers[i].getModifierString());
- String description = fTextHovers[i].getDescription();
- if (description == null)
- description = ""; //$NON-NLS-1$
- fDescription.setText(description);
- }
-
- private void handleModifierModified() {
- int i = fHoverTable.getSelectionIndex();
- if (i == -1)
- return;
-
- String modifiers = fModifierEditor.getText();
- fTextHovers[i].setModifierString(modifiers);
-
- // update table
- fHoverTableViewer.refresh(fTextHovers[i]);
-
- updateStatus(fTextHovers[i]);
- }
-
- private void initialize() {
- restoreFromOverlay();
- fHoverTableViewer.setInput(fTextHovers);
-
- initializeFields();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.AbstractPreferenceTab#initializeFields()
- */
- protected void initializeFields() {
- super.initializeFields();
-
- fModifierEditor.setEnabled(false);
- // initialize checkboxes in hover table
- for (int i = 0; i < fTextHovers.length; i++)
- fHoverTable.getItem(i).setChecked(fTextHovers[i].isEnabled());
- fHoverTableViewer.refresh();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#performApply()
- */
- public void performApply() {
- performOk();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#performDefaults()
- */
- public void performDefaults() {
- initialize();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#performOk()
- */
- public void performOk() {
- String textHoverString = generateTextHoverString();
- getOverlayStore().setValue(EditorPreferenceNames.EDITOR_TEXT_HOVER_MODIFIERS, textHoverString);
- getTextHoverManager().resetTextHovers(); // notify text hover manager
- // it should reset to get
- // latest preferences
- }
-
- /**
- * Populates fTextHovers with text hover description from the overlay
- * store (which is the preferences)
- */
- private void restoreFromOverlay() {
- String descriptorsString = getOverlayStore().getString(EditorPreferenceNames.EDITOR_TEXT_HOVER_MODIFIERS);
- fTextHovers = getTextHoverManager().generateTextHoverDescriptors(descriptorsString);
- }
-
- void updateStatus(TextHoverManager.TextHoverDescriptor hoverConfig) {
- IStatus status = new StatusInfo();
-
- if (hoverConfig != null && hoverConfig.isEnabled() && EditorUtility.computeStateMask(hoverConfig.getModifierString()) == -1)
- status = new StatusInfo(IStatus.ERROR, NLS.bind(SSEUIMessages.TextHoverPreferenceTab_modifierIsNotValid, new String[]{hoverConfig.getModifierString()}));
-
- int i = 0;
- HashMap stateMasks = new HashMap(fTextHovers.length);
- while (status.isOK() && i < fTextHovers.length) {
- if (fTextHovers[i].isEnabled()) {
- String label = fTextHovers[i].getLabel();
- Integer stateMask = new Integer(EditorUtility.computeStateMask(fTextHovers[i].getModifierString()));
- if (stateMask.intValue() == -1)
- status = new StatusInfo(IStatus.ERROR, NLS.bind(SSEUIMessages.TextHoverPreferenceTab_modifierIsNotValidForHover, new String[]{fTextHovers[i].getModifierString(), label}));
- else if (stateMasks.containsKey(stateMask))
- status = new StatusInfo(IStatus.ERROR, NLS.bind(SSEUIMessages.TextHoverPreferenceTab_duplicateModifier, new String[]{label, (String) stateMasks.get(stateMask)}));
- else
- stateMasks.put(stateMask, label);
- }
- i++;
- }
-
- updateStatus(status);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/TranslucencyPreferenceTab.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/TranslucencyPreferenceTab.java
deleted file mode 100644
index d89b41dcba..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/preferences/ui/TranslucencyPreferenceTab.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.preferences.ui;
-
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.Assert;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
-
-public class TranslucencyPreferenceTab implements IPreferenceTab {
-
- private PreferencePage fMainPreferencePage;
- private IntegerFieldEditor fTranslucencyScale = null;
- private final int MAX_PERCENTAGE = 100;
-
- private IPropertyChangeListener validityChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(FieldEditor.IS_VALID))
- updateValidState();
- }
- };
-
- /**
- *
- */
- public TranslucencyPreferenceTab() {
- super();
- }
-
- public TranslucencyPreferenceTab(PreferencePage mainPreferencePage) {
- Assert.isNotNull(mainPreferencePage);
- setMainPreferencePage(mainPreferencePage);
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#createContents(org.eclipse.swt.widgets.Composite)
- */
- public Control createContents(Composite tabFolder) {
- Composite composite = new Composite(tabFolder, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- String text = SSEUIMessages.TranslucencyPreferenceTab_1; //$NON-NLS-1$
- fTranslucencyScale = new IntegerFieldEditor(EditorPreferenceNames.READ_ONLY_FOREGROUND_SCALE, text, composite);
-
- fTranslucencyScale.setErrorMessage(JFaceResources.getString("StringFieldEditor.errorMessage"));//$NON-NLS-1$
- fTranslucencyScale.setPreferenceStore(getPreferenceStore());
- fTranslucencyScale.setPreferencePage(getMainPreferencePage());
- fTranslucencyScale.setTextLimit(Integer.toString(MAX_PERCENTAGE).length());
- fTranslucencyScale.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
- fTranslucencyScale.setValidRange(0, MAX_PERCENTAGE);
- fTranslucencyScale.load();
- fTranslucencyScale.setPropertyChangeListener(validityChangeListener);
-
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.PREFWEBX_READONLY_HELPID);
- return composite;
- }
-
- /**
- * @return Returns the fMainPreferencePage.
- */
- private PreferencePage getMainPreferencePage() {
- return fMainPreferencePage;
- }
-
- /**
- * @return Returns the preference store used in this tab
- */
- private IPreferenceStore getPreferenceStore() {
- return SSEUIPlugin.getDefault().getPreferenceStore();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#getTitle()
- */
- public String getTitle() {
- return SSEUIMessages.TranslucencyPreferenceTab_0; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#performApply()
- */
- public void performApply() {
- fTranslucencyScale.store();
- SSEUIPlugin.getDefault().savePluginPreferences();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#performDefaults()
- */
- public void performDefaults() {
- fTranslucencyScale.loadDefault();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.IPreferenceTab#performOk()
- */
- public void performOk() {
- performApply();
- }
-
- /**
- * @param mainPreferencePage
- * The fMainPreferencePage to set.
- */
- private void setMainPreferencePage(PreferencePage mainPreferencePage) {
- fMainPreferencePage = mainPreferencePage;
- }
-
- private void updateValidState() {
- if (getMainPreferencePage() != null) {
- getMainPreferencePage().setValid(fTranslucencyScale.isValid());
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/IStructuredTextFoldingProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/IStructuredTextFoldingProvider.java
deleted file mode 100644
index 76d9af2629..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/projection/IStructuredTextFoldingProvider.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.wst.sse.ui.internal.projection;
-
-import org.eclipse.jface.text.source.projection.ProjectionViewer;
-
-/**
- * Implementors of this interface which will create and maintain
- * {@link org.eclipse.jface.text.source.projection.ProjectionAnnotation}
- * objects that define folded regions in the the
- * {@link org.eclipse.jface.text.source.projection.ProjectionViewer}for a
- * structured model.
- */
-public interface IStructuredTextFoldingProvider {
- public static final String ID = "structuredtextfoldingprovider"; //$NON-NLS-1$
-
- /**
- * A named preference that controls whether folding is enabled in the
- * Structured Text editor.
- */
- public final static String FOLDING_ENABLED = "foldingEnabled"; //$NON-NLS-1$
-
- // copied interface from
- // org.eclipse.jdt.ui.text.folding.IJavaFoldingStructureProvider
- /**
- * Installs this structure provider on the given viewer. Implementations
- * should listen to the projection events generated by <code>viewer</code>
- * and enable / disable generation of projection structure accordingly.
- *
- * @param viewer
- * the projection viewer that displays the annotations created
- * by this structure provider
- */
- public void install(ProjectionViewer viewer);
-
- /**
- * Uninstalls this structure provider. Any references to viewers should be
- * cleared.
- */
- public void uninstall();
-
- /**
- * Initialize this provider with the correct document. Assumes projection
- * is enabled. (otherwise, only install would have been called)
- */
- public void initialize();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/AdapterPropertySheetEntryLabelProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/AdapterPropertySheetEntryLabelProvider.java
deleted file mode 100644
index ec0a53c997..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/AdapterPropertySheetEntryLabelProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.properties;
-
-
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.views.properties.IPropertySheetEntry;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-
-
-public class AdapterPropertySheetEntryLabelProvider extends LabelProvider {
- public Image getImage(Object element) {
- if (element == null)
- return null;
- if (element instanceof IPropertySheetEntry) {
- return ((IPropertySheetEntry) element).getImage();
- }
- if (element instanceof INodeNotifier) {
- IPropertySheetEntry entry = (IPropertySheetEntry) ((INodeNotifier) element).getAdapterFor(IPropertySheetEntry.class);
- if (entry != null)
- return entry.getImage();
- }
- return super.getImage(element);
- }
-
- public String getText(Object element) {
- if (element == null)
- return null;
- if (element instanceof IPropertySheetEntry) {
- return ((IPropertySheetEntry) element).getValueAsString();
- }
- if (element instanceof INodeNotifier) {
- IPropertySheetEntry entry = (IPropertySheetEntry) ((INodeNotifier) element).getAdapterFor(IPropertySheetEntry.class);
- if (entry != null)
- return entry.getValueAsString();
- }
- return super.getText(element);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ConfigurablePropertySheetPage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ConfigurablePropertySheetPage.java
deleted file mode 100644
index 78235dfaab..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ConfigurablePropertySheetPage.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.properties;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.views.properties.IPropertySheetEntry;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.IPropertySourceProvider;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-import org.eclipse.wst.sse.ui.views.properties.IPropertySourceExtension;
-import org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration;
-
-
-/**
- * A configurable IPropertySheetPage since the standard PropertySheetPage does
- * not expose its viewer field.
- */
-
-public class ConfigurablePropertySheetPage extends PropertySheetPage {
- private class NullPropertySheetConfiguration extends PropertySheetConfiguration {
- public IPropertySourceProvider getPropertySourceProvider(IPropertySheetPage page) {
- return null;
- }
- }
-
- private static final boolean _DEBUG = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/propertySheet")); //$NON-NLS-1$ //$NON-NLS-2$;;
-
- private long _DEBUG_TIME = 0;
-
- private PropertySheetConfiguration fConfiguration;
- private Object[] fSelectedEntries = null;
- private ISelection fInput = null;
- private IMenuManager fMenuManager;
-
- private RemoveAction fRemoveAction;
-
- private IStatusLineManager fStatusLineManager;
-
- private IToolBarManager fToolBarManager;
-
- private final PropertySheetConfiguration NULL_CONFIGURATION = new NullPropertySheetConfiguration();
-
- public ConfigurablePropertySheetPage() {
- super();
- }
-
- public void createControl(Composite parent) {
- setPropertySourceProvider(getConfiguration().getPropertySourceProvider(this));
- super.createControl(parent);
- }
-
- public void dispose() {
- setConfiguration(null);
- getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(this);
- super.dispose();
- }
-
- public PropertySheetConfiguration getConfiguration() {
- if (fConfiguration == null)
- fConfiguration = NULL_CONFIGURATION;
- return fConfiguration;
- }
-
- public void handleEntrySelection(ISelection selection) {
- if (getControl() != null && !getControl().isDisposed() && selection != null) {
- super.handleEntrySelection(selection);
- if (selection instanceof IStructuredSelection) {
- fSelectedEntries = ((IStructuredSelection) selection).toArray();
- }
- else {
- fSelectedEntries = null;
- }
- fRemoveAction.setEnabled(!selection.isEmpty());
- }
- }
-
- public void init(IPageSite pageSite) {
- super.init(pageSite);
- pageSite.getWorkbenchWindow().getSelectionService().addPostSelectionListener(this);
- }
-
- public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
- super.makeContributions(menuManager, toolBarManager, statusLineManager);
- fMenuManager = menuManager;
- fToolBarManager = toolBarManager;
- fStatusLineManager = statusLineManager;
-
- fRemoveAction = new RemoveAction(this);
- toolBarManager.add(fRemoveAction);
- menuManager.add(fRemoveAction);
- getConfiguration().addContributions(menuManager, toolBarManager, statusLineManager);
-
- menuManager.update(true);
- }
-
- void remove() {
- if (fSelectedEntries != null) {
- Object[] entries = fSelectedEntries;
- ISelection selection = fInput;
- if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
- IPropertySource source = getConfiguration().getPropertySourceProvider(this).getPropertySource(((IStructuredSelection) selection).getFirstElement());
- if (source != null && source instanceof IPropertySourceExtension) {
- for (int i = 0; i < entries.length; i++) {
- if (entries[i] instanceof IPropertySheetEntry) {
- IPropertySheetEntry entry = (IPropertySheetEntry) entries[i];
- ((IPropertySourceExtension) source).removeProperty(entry.getDisplayName());
- }
- }
- }
- }
- }
- }
-
- /*
- * Filter the selection through the current Configuration. Not every
- * selection received is a Structured selection nor are the Structured
- * selection's elements all to be displayed.
- *
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart,
- * org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if (_DEBUG) {
- _DEBUG_TIME = System.currentTimeMillis();
- }
- if (getControl() != null && getControl().isVisible() && !getControl().isFocusControl()) {
- ISelection preferredSelection = getConfiguration().getInputSelection(part, selection);
- /*
- * Do some minor caching of the selection.
- *
- * As a PropertySheetPage, we've always notified of selection
- * changes, but we've also subscribed to post selection
- * notification so we can track caret movements in source viewers.
- * When selecting a block of text, we're thus notified of the new
- * selection twice. Remembering what our last *effective*
- * selection was allows us to cut out most of the
- * double-notification penalty.
- */
- if (!preferredSelection.equals(fInput)) {
- fInput = preferredSelection;
- fSelectedEntries = null;
- super.selectionChanged(part, preferredSelection);
- }
-
- if (_DEBUG) {
- System.out.println("(P:service " + (System.currentTimeMillis() - _DEBUG_TIME) + "ms) " + part + " : " + ((IStructuredSelection) preferredSelection).getFirstElement()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- else if (_DEBUG) {
- System.out.println("[skipped] (P:" + (System.currentTimeMillis() - _DEBUG_TIME) + "ms) " + part + " : " + selection); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
-
- /**
- * @param configuration
- * The configuration to set.
- */
- public void setConfiguration(PropertySheetConfiguration configuration) {
- if (fConfiguration != null) {
- fConfiguration.removeContributions(fMenuManager, fToolBarManager, fStatusLineManager);
- fConfiguration.unconfigure();
- }
-
- fConfiguration = configuration;
-
- if (fConfiguration != null) {
- setPropertySourceProvider(fConfiguration.getPropertySourceProvider(this));
- fConfiguration.addContributions(fMenuManager, fToolBarManager, fStatusLineManager);
- }
- }
-
- public void setFocus() {
- super.setFocus();
-
- IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow();
- IWorkbenchPage activePage = workbenchWindow.getActivePage();
- if (activePage != null) {
- IEditorPart activeEditor = activePage.getActiveEditor();
- if (activeEditor != null) {
- IEditorSite editorSite = activeEditor.getEditorSite();
- if (editorSite != null) {
- ISelectionProvider selectionProvider = editorSite.getSelectionProvider();
- if (selectionProvider != null) {
- selectionChanged(activeEditor, selectionProvider.getSelection());
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/CustomPropertyDescriptor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/CustomPropertyDescriptor.java
deleted file mode 100644
index 5c6904b963..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/CustomPropertyDescriptor.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.properties;
-
-
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-public class CustomPropertyDescriptor extends PropertyDescriptor {
-
- protected Class cellEditorClass = null;
-
- /**
- * Returns a property descriptor with a unique name and a display name.
- *
- * @param id
- * the id for the property
- * @param displayName
- * the name to display for the property
- */
- public CustomPropertyDescriptor(Object id, String newDisplayName, Class editorClass) {
- super(id, newDisplayName);
- setDescription((String) id);
- setCellEditorClass(editorClass);
- }
-
- /**
- * Returns a property descriptor with a unique name and a display name.
- *
- * @param uniqueName
- * the unique name of the property
- * @param displayName
- * the name to display for the property
- */
- public CustomPropertyDescriptor(String uniqueName, String newDisplayName) {
- this(uniqueName, newDisplayName, TextCellEditor.class);
- }
-
- public CellEditor createPropertyEditor(Composite parent) {
- return getPropertyEditor(parent);
- }
-
- public Class getCellEditorClass() {
- return cellEditorClass;
- }
-
- /**
- * Returns the editor used to edit the property.
- *
- * @return an editor for the property
- */
- protected CellEditor getPropertyEditor(Composite parent) {
- if (getCellEditorClass() == null)
- return null;
-
- java.lang.reflect.Constructor constructor = null;
- try {
- constructor = getCellEditorClass().getDeclaredConstructor(new Class[]{Composite.class});
- } catch (NoSuchMethodException nsme) {
- return new TextCellEditor(parent);
- }
- if (constructor != null) {
- try {
- return (CellEditor) constructor.newInstance(new Object[]{parent});
- } catch (InstantiationException ie) {
- } catch (java.lang.reflect.InvocationTargetException ite) {
- } catch (IllegalAccessException iae) {
- }
- }
- return new TextCellEditor(parent);
- }
-
- public void setCellEditorClass(Class newCellEditorClass) {
- cellEditorClass = newCellEditorClass;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/RemoveAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/RemoveAction.java
deleted file mode 100644
index 488b2414a1..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/RemoveAction.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.properties;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImageHelper;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImages;
-
-public class RemoveAction extends Action {
- private ConfigurablePropertySheetPage fPage;
-
- public RemoveAction(ConfigurablePropertySheetPage page) {
- super();
- fPage = page;
- setText(getText());
- setToolTipText(getText());
- setImageDescriptor(EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_ELCL_DELETE));
- setDisabledImageDescriptor(EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_DLCL_DELETE));
- }
-
- /**
- * @see org.eclipse.jface.action.Action#getText()
- */
- public String getText() {
- return SSEUIMessages.RemoveAction_0; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- fPage.remove();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ShowPropertiesAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ShowPropertiesAction.java
deleted file mode 100644
index 2abb375b8b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/properties/ShowPropertiesAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.properties;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.ShowViewAction;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImageHelper;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImages;
-import org.eclipse.wst.sse.ui.internal.editor.IHelpContextIds;
-
-/**
- * Surfaces the Properties view
- *
- * @author Nitin Dahyabhai
- */
-public class ShowPropertiesAction extends ShowViewAction {
- private final static String VIEW_ID = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$
-
- public ShowPropertiesAction() {
- super(SSEUIMessages.ShowPropertiesAction_0, EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_OBJ_PROP_PS)); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IHelpContextIds.CONTMNU_PROPERTIES_HELPID);
- }
-
- protected String getViewID() {
- return VIEW_ID;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/preferences/CommonEditorPreferenceNames.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/preferences/CommonEditorPreferenceNames.java
deleted file mode 100644
index d09f811ef1..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/preferences/CommonEditorPreferenceNames.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-package org.eclipse.wst.sse.ui.internal.provisional.preferences;
-
-import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
-
-/**
- * Common editor preference keys used by the Structured Text Editor.
- *
- * @plannedfor 1.0
- */
-public class CommonEditorPreferenceNames {
- private CommonEditorPreferenceNames() {
- // empty private constructor so users cannot instantiate class
- }
-
- /**
- * A named preference that controls as-you-type validation
- * <p>
- * Value is of type <code>Boolean</code>.
- * </p>
- */
- public static final String EVALUATE_TEMPORARY_PROBLEMS = EditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS;
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryProvider.java
deleted file mode 100644
index 5ccdeb278f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryProvider.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.registry;
-
-import org.eclipse.wst.sse.core.internal.ltk.modelhandler.IDocumentTypeHandler;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-
-
-public interface AdapterFactoryProvider {
-
- public void addAdapterFactories(IStructuredModel structuredModel);
-
- // TODO_issue: IDocumentTypeHandler doesn't seem correct in this API.
- // reexamine and see if should be ModelHandler, or ContentTypeIdentifer
- // instead.
- public boolean isFor(IDocumentTypeHandler contentTypeDescription);
-
- /**
- * This method should only add those factories related to embedded content
- * type
- */
- public void reinitializeFactories(IStructuredModel structuredModel);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistry.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistry.java
deleted file mode 100644
index 3b1990f13f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistry.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.registry;
-
-import java.util.Iterator;
-
-/**
- * This is basically a "factory for factories". It is to used to associate
- * "edit time" AdapterFactories with a StructuredModel, based on the
- * IStructuredModel's ContentTypeDescription. In plugin.xml files, there
- * should be an AdapterFactoryProvider defined for every definition of
- * ContentTypeDescription.
- */
-public interface AdapterFactoryRegistry {
-
- /**
- * Returns an Iterator over a Collection of AdapterFactoryProviders
- *
- * @return
- */
- public Iterator getAdapterFactories();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryExtension.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryExtension.java
deleted file mode 100644
index c229f20ac3..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryExtension.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.registry;
-
-import java.util.Iterator;
-import java.util.List;
-
-public interface AdapterFactoryRegistryExtension {
- Iterator getAdapterFactories(String contentTypeID);
-
- List getAdapterFactoriesAsList(String contentTypeID);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryImpl.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryImpl.java
deleted file mode 100644
index e8f5bbcb36..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryImpl.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.registry;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-
-public class AdapterFactoryRegistryImpl implements AdapterFactoryRegistry, AdapterFactoryRegistryExtension {
-
- protected final static String ATT_CLASS = "class"; //$NON-NLS-1$
-
- private static AdapterFactoryRegistry instance = null;
-
- static synchronized public AdapterFactoryRegistry getInstance() {
- if (instance == null) {
- instance = new AdapterFactoryRegistryImpl();
- }
- return instance;
- }
-
- // this map exists so there is only one provider
- // instance not duplicate providers for different content types
- private HashMap adapterProviders = null;
-
- private boolean DEBUG = false;
- /**
- * This HashMap contains: [contentTypeId -> element2providerMap] | V
- * [configurationElement -> AdapterFactoryProvider]
- *
- */
- private HashMap hashMap = null;
-
- // providers with no content type associated
- // just added through the add(...) method
- private HashSet unassociatedProviders = null;
-
- private AdapterFactoryRegistryImpl() {
- super();
- this.hashMap = new HashMap();
- this.unassociatedProviders = new HashSet();
- this.adapterProviders = new HashMap();
-
- // doesn't instantiate classes, just stores configuration elements
- AdapterFactoryRegistryReader.readRegistry(hashMap);
- }
-
- void add(AdapterFactoryProvider adapterFactoryProvider) {
- this.unassociatedProviders.add(adapterFactoryProvider);
- }
-
- public Iterator getAdapterFactories() {
- if (DEBUG) {
- System.out.println("===================================================================================="); //$NON-NLS-1$
- System.out.println("GETTING ALL ADAPTER FACTORIES"); //$NON-NLS-1$
- }
-
- List results = new ArrayList();
-
- // add providers that have no content type specification
- results.addAll(this.unassociatedProviders);
- Iterator it = this.hashMap.keySet().iterator();
- String contentTypeId = null;
- while (it.hasNext()) {
- contentTypeId = (String) it.next();
-
- if (DEBUG)
- System.out.println(" + for: " + contentTypeId); //$NON-NLS-1$
-
- results.addAll(getAdapterFactoriesAsList(contentTypeId));
- }
-
- if (DEBUG) {
- System.out.println("===================================================================================="); //$NON-NLS-1$
- }
-
- return results.iterator();
- }
-
- public Iterator getAdapterFactories(String contentTypeID) {
- if (DEBUG) {
- System.out.println("===================================================================================="); //$NON-NLS-1$
- System.out.println("GETTING ADAPTER FACTORIES for: " + contentTypeID); //$NON-NLS-1$
- }
-
- List results = new ArrayList();
-
- // add providers that have no content type specification
- results.addAll(unassociatedProviders);
-
- // add unknown content type providers (for backwards compatability)
- results.addAll(getAdapterFactoriesAsList(AdapterFactoryRegistryReader.UNKNOWN_CONTENT_TYPE));
-
- // add providers for specific content type
- results.addAll(getAdapterFactoriesAsList(Platform.getContentTypeManager().getContentType(contentTypeID)));
-
-
- if (DEBUG) {
- System.out.println("===================================================================================="); //$NON-NLS-1$
- }
-
- return results.iterator();
- }
-
- public List getAdapterFactoriesAsList(IContentType contentType) {
- IContentType type = contentType;
- List results = new ArrayList();
- while (type != null && !type.getId().equals(IContentTypeManager.CT_TEXT)) {
- results.addAll(getAdapterFactoriesAsList(type.getId()));
- type = type.getBaseType();
- }
- return results;
- }
-
- /**
- * Using this new API, only AdapterFactoryProviders for a certain content
- * type are instantiated. This will allow for the minimum number of
- * plugins to be loaded rather than all that implement the adapter factory
- * extension point.
- *
- * @param contentTypeID
- * @return
- */
- public List getAdapterFactoriesAsList(String contentTypeID) {
-
- List results = new ArrayList();
-
- // get element2Provider map for specified content type
- Object o = hashMap.get(contentTypeID);
- if (o != null) {
- // instantiate if necessary from
- // element2adapterFactoryProvider
- // map
- Map element2Provider = (Map) o;
- Iterator it = element2Provider.keySet().iterator();
- IConfigurationElement element = null;
- String classname = null;
- Object existing = null;
- AdapterFactoryProvider p = null;
- while (it.hasNext()) {
- element = (IConfigurationElement) it.next();
- o = element2Provider.get(element);
- if (o != null) {
- // this provider has already been created
- if (DEBUG)
- System.out.println("already created: " + element.getAttribute(ATT_CLASS)); //$NON-NLS-1$
-
- results.add(o);
- }
- else {
- // need to create the provider
- try {
- classname = element.getAttribute(ATT_CLASS);
-
- if (DEBUG)
- System.out.println("about to create: " + classname); //$NON-NLS-1$
-
- // check if we created one already
- existing = this.adapterProviders.get(classname);
- if (existing == null) {
- // this is the only place
- // AdapterFactoryProviders
- // are created
- p = (AdapterFactoryProvider) element.createExecutableExtension(ATT_CLASS); // $NON-NLS-1$
- this.adapterProviders.put(classname, p);
- }
- else {
- p = (AdapterFactoryProvider) existing;
- }
-
- // add to element2Provider for this contentType
- element2Provider.put(element, p);
- // add to results to return for this method
- results.add(p);
-
- }
- catch (CoreException e) {
- // if the provider throws any exception, just log
- // and
- // continue
- Logger.logException(e);
- }
- }
- }
- }
-
- return results;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryReader.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryReader.java
deleted file mode 100644
index b5d49d412d..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/registry/AdapterFactoryRegistryReader.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.registry;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-
-/**
- * This class just converts what's in the plugins registry into a form more
- * easily useable by others, the ContentTypeRegistry.
- */
-class AdapterFactoryRegistryReader {
- protected final static String ATT_CLASS = "class"; //$NON-NLS-1$
-
- protected final static String ATT_ID = "id"; //$NON-NLS-1$
-
- private static boolean DEBUG = false;
- protected final static String EXTENSION_POINT_ID = "adapterFactoryDescription"; //$NON-NLS-1$
- //
- protected final static String PLUGIN_ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
- protected final static String TAG_CONTENT_TYPE = "contentType"; //$NON-NLS-1$
-
- protected final static String TAG_NAME = "adapterFactoryDescription"; //$NON-NLS-1$
-
- public final static String UNKNOWN_CONTENT_TYPE = "unknown"; //$NON-NLS-1$
-
- /**
- * adds configuration element to contentTypeId map [contentTypeId ->
- * element2providerMap] | V [element -> provider]
- *
- * NOTE: this doesn't create the provider yet, that must be done on demand
- * and stored in the appropriate element2provider
- *
- * @param map
- * @param contentTypeId
- * @param element
- */
- private static void addElementForContentType(HashMap map, String contentTypeId, IConfigurationElement element) {
-
- Object o = map.get(contentTypeId);
- if (o == null) {
- HashMap element2provider = new HashMap();
- // don't create the executable extension yet
- element2provider.put(element, null);
- map.put(contentTypeId, element2provider);
-
- if (DEBUG)
- System.out.println("added " + element.getAttribute(ATT_CLASS) + ", but didn't create exec extension"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- // add element to unknown list (not executable ext yet...)
- HashMap element2provider = (HashMap) o;
- element2provider.put(element, null);
-
- if (DEBUG)
- System.out.println("added " + element.getAttribute(ATT_CLASS) + " to unknown list, but didn't create exec extension"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * the map passed in: [contentTypeId -> element2providerMap] | V [element ->
- * provider]
- *
- * @param element
- * @param map
- * @return
- */
- protected static AdapterFactoryProvider readElement(IConfigurationElement element, HashMap map) {
-
- AdapterFactoryProvider adapterFactoryProvider = null;
- if (element.getName().equals(TAG_NAME)) {
- try {
- IConfigurationElement[] children = element.getChildren();
- boolean specifiedContentType = false;
- if (children != null && children.length > 0) {
- // content types are specified
- for (int i = 0; i < children.length; i++) {
- if (children[i].getName().equals(TAG_CONTENT_TYPE)) {
- // it's possible to have non-contentType childrent
- specifiedContentType = true;
- String contentType = children[i].getAttribute(ATT_ID);
- addElementForContentType(map, contentType, element);
- }
- }
- }
- if (!specifiedContentType) {
- // no content type association
- addElementForContentType(map, UNKNOWN_CONTENT_TYPE, element);
- }
- } catch (Exception e) {
- // if the provider throws any exception, just log and continue
- Logger.logException(e);
- }
- }
- return adapterFactoryProvider;
- }
-
- /**
- * We simply require an 'add' method, of what ever it is we are to read
- * into
- */
- static void readRegistry(HashMap map) {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint point = registry.getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_ID);
- if (point != null) {
- IConfigurationElement[] elements = point.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- readElement(elements[i], map);
- }
- }
- }
-
- protected IConfigurationElement configElement = null;
-
- // protected final static String ADAPTER_CLASS = "adapterClass";
- // //$NON-NLS-1$
- // protected final static String DOC_TYPE_ID = "docTypeId"; //$NON-NLS-1$
- // protected final static String MIME_TYPE_LIST = "mimeTypeList";
- // //$NON-NLS-1$
- //
- /**
- * ContentTypeRegistryReader constructor comment.
- */
- AdapterFactoryRegistryReader() {
- super();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/AbstractLineStyleProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/AbstractLineStyleProvider.java
deleted file mode 100644
index 9194a577b8..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/AbstractLineStyleProvider.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.style;
-
-import java.util.Collection;
-import java.util.HashMap;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionCollection;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.sse.core.internal.util.Debug;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper;
-import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
-
-
-public abstract class AbstractLineStyleProvider {
- private class PropertyChangeListener implements IPropertyChangeListener {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- // have to do it this way so others can override the method
- handlePropertyChange(event);
- }
- }
-
- // protected IStructuredDocumentRegion currentStructuredDocumentRegion;
- // Note: the var=x.class contructs were put into this method
- // as a workaround for slow VAJava class lookups. They compiler
- // assigns them to a variable in the JDK, but Class.forName("x")
- // in VAJava. It is workaround specific for VAJava environment, so could
- // be simplified in future.
- static Class LineStyleProviderClass = LineStyleProvider.class;
-
- private IStructuredDocument fDocument;
- private Highlighter fHighlighter;
- private boolean fInitialized;
- private PropertyChangeListener fPreferenceListener = new PropertyChangeListener();
-
- /** Contains all text attributes pretaining to this line style provider */
- private HashMap fTextAttributes = null;
-
- // we keep track of LogMessage to avoid writing hundreds of messages,
- // but still give a hint that something is wrong with attributeProviders
- // and/or regions.
- // It's only written in the case of a program error, but there's no use
- // adding
- // salt to the wound.
- // private boolean wroteOneLogMessage;
- /**
- */
- protected AbstractLineStyleProvider() {
- }
-
- /**
- * Looks up the colorKey in the preference store and adds the style
- * information to list of TextAttributes
- *
- * @param colorKey
- */
- protected void addTextAttribute(String colorKey) {
- if (getColorPreferences() != null) {
- String prefString = getColorPreferences().getString(colorKey);
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- RGB foreground = ColorHelper.toRGB(stylePrefs[0]);
- RGB background = ColorHelper.toRGB(stylePrefs[1]);
- boolean bold = Boolean.valueOf(stylePrefs[2]).booleanValue();
- getTextAttributes().put(colorKey, createTextAttribute(foreground, background, bold));
- }
- }
- }
-
- protected void commonInit(IStructuredDocument document, Highlighter highlighter) {
-
- fDocument = document;
- fHighlighter = highlighter;
- }
-
- /**
- * this version does "trim" regions to match request
- */
- private StyleRange createStyleRange(ITextRegionCollection flatNode, ITextRegion region, TextAttribute attr, int startOffset, int length) {
- int start = flatNode.getStartOffset(region);
- if (start < startOffset)
- start = startOffset;
- int maxOffset = startOffset + length;
- int end = flatNode.getEndOffset(region); // use get length directly
- // instead of end-start?
- if (end > maxOffset)
- end = maxOffset;
- StyleRange result = new StyleRange(start, end - start, attr.getForeground(), attr.getBackground(), attr.getStyle());
- return result;
-
- }
-
- protected TextAttribute createTextAttribute(RGB foreground, RGB background, boolean bold) {
- return new TextAttribute((foreground != null) ? EditorUtility.getColor(foreground) : null, (background != null) ? EditorUtility.getColor(background) : null, bold ? SWT.BOLD : SWT.NORMAL);
- }
-
- abstract protected TextAttribute getAttributeFor(ITextRegion region);
-
- abstract protected IPreferenceStore getColorPreferences();
-
- protected IStructuredDocument getDocument() {
- return fDocument;
- }
-
- /**
- */
- protected Highlighter getHighlighter() {
- return fHighlighter;
- }
-
- /**
- * Returns the hashtable containing all the text attributes for this line
- * style provider. Lazily creates a hashtable if one has not already been
- * created.
- *
- * @return
- */
- protected HashMap getTextAttributes() {
- if (fTextAttributes == null) {
- fTextAttributes = new HashMap();
- loadColors();
- }
- return fTextAttributes;
- }
-
- protected void handlePropertyChange(PropertyChangeEvent event) {
- // force a full update of the text viewer
- fHighlighter.refreshDisplay();
- }
-
- public void init(IStructuredDocument structuredDocument, Highlighter highlighter) {
-
- commonInit(structuredDocument, highlighter);
-
- if (isInitialized())
- return;
-
- registerPreferenceManager();
-
- setInitialized(true);
- }
-
- /**
- * Allowing the INodeAdapter to compare itself against the type allows it
- * to return true in more than one case.
- */
- public boolean isAdapterForType(java.lang.Object type) {
- return type == LineStyleProviderClass;
- }
-
- /**
- * Returns the initialized.
- *
- * @return boolean
- */
- public boolean isInitialized() {
- return fInitialized;
- }
-
- abstract protected void loadColors();
-
- public boolean prepareRegions(ITypedRegion typedRegion, int lineRequestStart, int lineRequestLength, Collection holdResults) {
- final int partitionStartOffset = typedRegion.getOffset();
- final int partitionLength = typedRegion.getLength();
- IStructuredDocumentRegion structuredDocumentRegion = getDocument().getRegionAtCharacterOffset(partitionStartOffset);
- boolean handled = false;
-
- handled = prepareTextRegions(structuredDocumentRegion, partitionStartOffset, partitionLength, holdResults);
-
- return handled;
- }
-
- /**
- * @param region
- * @param start
- * @param length
- * @param holdResults
- * @return
- */
- private boolean prepareTextRegion(ITextRegionCollection blockedRegion, int partitionStartOffset, int partitionLength, Collection holdResults) {
- boolean handled = false;
- final int partitionEndOffset = partitionStartOffset + partitionLength - 1;
- ITextRegion region = null;
- ITextRegionList regions = blockedRegion.getRegions();
- int nRegions = regions.size();
- StyleRange styleRange = null;
- for (int i = 0; i < nRegions; i++) {
- region = regions.get(i);
- TextAttribute attr = null;
- TextAttribute previousAttr = null;
- if (blockedRegion.getStartOffset(region) > partitionEndOffset)
- break;
- if (blockedRegion.getEndOffset(region) <= partitionStartOffset)
- continue;
-
- if (region instanceof ITextRegionCollection) {
- handled = prepareTextRegion((ITextRegionCollection) region, partitionStartOffset, partitionLength, holdResults);
- } else {
-
- attr = getAttributeFor(region);
- if (attr != null) {
- handled = true;
- // if this region's attr is the same as previous one, then
- // just adjust the previous style range
- // instead of creating a new instance of one
- // note: to use 'equals' in this case is important, since
- // sometimes
- // different instances of attributes are associated with a
- // region, even the
- // the attribute has the same values.
- // TODO: this needs to be improved to handle readonly
- // regions correctly
- if ((styleRange != null) && (previousAttr != null) && (previousAttr.equals(attr))) {
- styleRange.length += region.getLength();
- } else {
- styleRange = createStyleRange(blockedRegion, region, attr, partitionStartOffset, partitionLength);
- holdResults.add(styleRange);
- // technically speaking, we don't need to update
- // previousAttr
- // in the other case, because the other case is when
- // it hasn't changed
- previousAttr = attr;
- }
- } else {
- previousAttr = null;
- }
- }
- }
- return handled;
- }
-
- private boolean prepareTextRegions(IStructuredDocumentRegion structuredDocumentRegion, int partitionStartOffset, int partitionLength, Collection holdResults) {
- boolean handled = false;
- final int partitionEndOffset = partitionStartOffset + partitionLength - 1;
- while (structuredDocumentRegion != null && structuredDocumentRegion.getStartOffset() <= partitionEndOffset) {
- ITextRegion region = null;
- ITextRegionList regions = structuredDocumentRegion.getRegions();
- int nRegions = regions.size();
- StyleRange styleRange = null;
- for (int i = 0; i < nRegions; i++) {
- region = regions.get(i);
- TextAttribute attr = null;
- TextAttribute previousAttr = null;
- if (structuredDocumentRegion.getStartOffset(region) > partitionEndOffset)
- break;
- if (structuredDocumentRegion.getEndOffset(region) <= partitionStartOffset)
- continue;
-
- if (region instanceof ITextRegionCollection) {
- handled = prepareTextRegion((ITextRegionCollection) region, partitionStartOffset, partitionLength, holdResults);
- } else {
-
- attr = getAttributeFor(region);
- if (attr != null) {
- handled = true;
- // if this region's attr is the same as previous one,
- // then just adjust the previous style range
- // instead of creating a new instance of one
- // note: to use 'equals' in this case is important,
- // since sometimes
- // different instances of attributes are associated
- // with a region, even the
- // the attribute has the same values.
- // TODO: this needs to be improved to handle readonly
- // regions correctly
- if ((styleRange != null) && (previousAttr != null) && (previousAttr.equals(attr))) {
- styleRange.length += region.getLength();
- } else {
- styleRange = createStyleRange(structuredDocumentRegion, region, attr, partitionStartOffset, partitionLength);
- holdResults.add(styleRange);
- // technically speaking, we don't need to update
- // previousAttr
- // in the other case, because the other case is
- // when it hasn't changed
- previousAttr = attr;
- }
- } else {
- previousAttr = null;
- }
- }
-
- if (Debug.syntaxHighlighting && !handled) {
- System.out.println("not handled in prepareRegions"); //$NON-NLS-1$
- }
- }
- structuredDocumentRegion = structuredDocumentRegion.getNext();
- }
- return handled;
- }
-
- private void registerPreferenceManager() {
- IPreferenceStore pref = getColorPreferences();
- if (pref != null) {
- pref.addPropertyChangeListener(fPreferenceListener);
- }
- }
-
- public void release() {
- unRegisterPreferenceManager();
- if (fTextAttributes != null) {
- fTextAttributes.clear();
- fTextAttributes = null;
- }
- }
-
- /**
- * Sets the initialized.
- *
- * @param initialized
- * The initialized to set
- */
- private void setInitialized(boolean initialized) {
- this.fInitialized = initialized;
- }
-
- private void unRegisterPreferenceManager() {
- IPreferenceStore pref = getColorPreferences();
- if (pref != null) {
- pref.removePropertyChangeListener(fPreferenceListener);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/Highlighter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/Highlighter.java
deleted file mode 100644
index a3ee678003..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/Highlighter.java
+++ /dev/null
@@ -1,906 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.style;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.IDocumentExtension3;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITextViewerExtension5;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.custom.LineStyleEvent;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.util.Debug;
-import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
-import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
-
-/**
- * This class is to directly mediate between the Structured Document data
- * structure and the text widget's text and events. It assumes there only the
- * model is interested in text events, and all other views will work from that
- * model. Changes to the text widgets input can cause changes in the model,
- * which in turn cause changes to the widget's display.
- *
- */
-public class Highlighter implements IHighlighter {
-
- /**
- * A utility class to do various color manipulations
- */
- private class YUV_RGBConverter {
- /**
- * This class "holds" the YUV values corresponding to RGB color
- */
- private class YUV {
-
- class NormalizedRGB {
- double blue;
- double green;
- private final double maxRGB = 256.0;
- double red;
-
- public NormalizedRGB(RGB rgb) {
- // first normalize to between 0 - 1
- red = rgb.red / maxRGB;
- green = rgb.green / maxRGB;
- blue = rgb.blue / maxRGB;
-
- red = gammaNormalized(red);
- green = gammaNormalized(green);
- blue = gammaNormalized(blue);
-
- }
- }
-
- private NormalizedRGB normalizedRGB;
-
- RGB originalRGB;
- private double u = -1;
- private double v = -1;
- private double y = -1;
-
- private YUV() {
- super();
- }
-
- public YUV(double y, double u, double v) {
- this();
- this.y = y;
- this.u = u;
- this.v = v;
- }
-
- public YUV(RGB rgb) {
- this();
- originalRGB = rgb;
- normalizedRGB = new NormalizedRGB(rgb);
- // force calculations
- getY();
- getV();
- getU();
- }
-
- /**
- * normalize to "average" gamma 2.2222 or 1/0.45
- */
- double gammaNormalized(double colorComponent) {
- if (colorComponent < 0.018) {
- return colorComponent * 0.45;
- }
- else {
- return 1.099 * Math.pow(colorComponent, 0.45) - 0.099;
- }
- }
-
- /**
- * @return RGB based on original RGB and current YUV values;
- */
- public RGB getRGB() {
- RGB result = null;
- double r = getY() + 1.14 * getV();
- double g = getY() - 0.395 * getU() - 0.58 * getV();
- double b = getY() + 2.032 * getU();
-
- int red = (int) (inverseGammaNormalized(r) * 256);
- int green = (int) (inverseGammaNormalized(g) * 256);
- int blue = (int) (inverseGammaNormalized(b) * 256);
- if (red < 0)
- red = 0;
- else if (red > 255)
- red = 255;
- if (green < 0)
- green = 0;
- else if (green > 255)
- green = 255;
- if (blue < 0)
- blue = 0;
- else if (blue > 255)
- blue = 255;
-
- result = new RGB(red, green, blue);
- return result;
- }
-
- public double getU() {
- if (u == -1) {
- u = 0.4949 * (normalizedRGB.blue - getY());
- }
- return u;
-
- }
-
- public double getV() {
- if (v == -1) {
- v = 0.877 * (normalizedRGB.red - getY());
- }
- return v;
- }
-
- public double getY() {
- if (y == -1) {
- y = 0.299 * normalizedRGB.red + 0.587 * normalizedRGB.green + 0.114 * normalizedRGB.blue;
- }
- return y;
- }
-
- double inverseGammaNormalized(double colorComponent) {
- if (colorComponent < 0.018) {
- return colorComponent * .222;
- }
- else {
- return Math.pow(((.9099 * colorComponent + 0.09)), 2.22);
- }
- }
-
- }
-
- public YUV_RGBConverter() {
- super();
- }
-
- public double calculateYComponent(Color targetColor) {
- return new YUV(targetColor.getRGB()).getY();
- }
-
- public RGB transformRGB(RGB originalRGB, double scaleFactor, double target) {
- RGB transformedRGB = null;
- // CCIR601 yuv = new CCIR601(originalRGB);
- YUV yuv = new YUV(originalRGB);
- double y = yuv.getY();
- // zero is black, one is white
- if (y < target) {
- // is "dark" make lighter
- y = y + ((target - y) * scaleFactor);
- }
- else {
- // is "light" make darker
- y = y - ((y - target) * scaleFactor);
- }
- // yuv.setY(y);
- YUV newYUV = new YUV(y, yuv.getU(), yuv.getV());
- // CCIR601 newYUV = new CCIR601(y, yuv.getCb601(),
- // yuv.getCr601());
- transformedRGB = newYUV.getRGB();
- return transformedRGB;
- }
-
- public RGB transformRGBToGrey(RGB originalRGB, double scaleFactor, double target) {
- RGB transformedRGB = null;
- // we left the "full" API method signature, but this
- // version does not take into account originalRGB, though
- // it might someday.
- // for now, we'll simply make the new RGB grey, either a little
- // lighter, or a little darker than background.
- double y = 0;
- double mid = 0.5;
- // zero is black, one is white
- if (target < mid) {
- // is "dark" make lighter
- y = target + scaleFactor;
- }
- else {
- // is "light" make darker
- y = target - scaleFactor;
- }
- int c = (int) Math.round(y * 255);
- // just to gaurd against mis-use, or scale's values greater
- // than mid point (and possibly rounding error)
- if (c > 255)
- c = 255;
- if (c < 0)
- c = 0;
- transformedRGB = new RGB(c, c, c);
- return transformedRGB;
- }
- }
-
- private final boolean DEBUG = false;
- private final StyleRange[] EMPTY_STYLE_RANGE = new StyleRange[0];
- private static final String LINE_STYLE_PROVIDER_EXTENDED_ID = "linestyleprovider"; //$NON-NLS-1$
- private static final int MAX_NUMBER_STYLES = 500;
- private static final int LEFT_STYLES_SIZE = 200;
- private static final int RIGHT_STYLES_SIZE = 200;
- private static final int MIDDLE_STYLES_SIZE = 1;
-
- private IPropertyChangeListener fForegroundScaleListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (EditorPreferenceNames.READ_ONLY_FOREGROUND_SCALE.equals(event.getProperty())) {
- IPreferenceStore editorStore = SSEUIPlugin.getDefault().getPreferenceStore();
- readOnlyForegroundScaleFactor = editorStore.getInt(EditorPreferenceNames.READ_ONLY_FOREGROUND_SCALE);
- disposeColorTable();
- refreshDisplay();
- }
- }
- };
- private List fHoldStyleResults;
- private String fPartitioning = IDocumentExtension3.DEFAULT_PARTITIONING;
-
- private int fSavedLength = -1;
- private int fSavedOffset = -1;
- private StyleRange[] fSavedRanges = null;
-
- private IStructuredDocument fStructuredDocument;
- private Map fTableOfProviders;
-
- private Map fExtendedProviders;
-
- protected final LineStyleProvider NOOP_PROVIDER = new LineStyleProviderForNoOp();
-
- private double readOnlyBackgroundScaleFactor = 10;
- private Hashtable readOnlyColorTable;
- double readOnlyForegroundScaleFactor = 30;
-
- private YUV_RGBConverter rgbConverter;
- private ITextViewer textViewer;
- private StyledText textWidget;
-
- public Highlighter() {
- super();
-
- // in the 'limitSize' method, we make this strong assumption, so, will check here,
- // so if tweaked in future, we'll get a quick reminder.
- if (LEFT_STYLES_SIZE + MIDDLE_STYLES_SIZE + RIGHT_STYLES_SIZE > MAX_NUMBER_STYLES) {
- throw new IllegalStateException("Highligher constants are not defined correctly"); //$NON-NLS-1$
- }
- }
-
- protected void addEmptyRange(int start, int length, Collection holdResults) {
- StyleRange result = new StyleRange();
- result.start = start;
- result.length = length;
- holdResults.add(result);
- }
-
- /**
- * Registers a given line style provider for a particular partition type.
- * If there is already a line style provider registered for this type, the
- * new line style provider is registered instead of the old one.
- *
- * @param partitionType
- * the partition type under which to register
- * @param the
- * line style provider to register, or <code>null</code> to
- * remove an existing one
- */
- public void addProvider(String partitionType, LineStyleProvider provider) {
- getTableOfProviders().put(partitionType, provider);
- }
-
- /**
- * Adjust the style ranges' start and length so that they refer to the
- * textviewer widget's range instead of the textviewer's document range.
- *
- * @param ranges
- * @param adjustment
- */
- protected void adjust(StyleRange[] ranges, int adjustment) {
- ITextViewer viewer = getTextViewer();
-
- if (adjustment != 0) {
- // just use the adjustment value
- // convert document regions back to widget regions
- for (int i = 0; i < ranges.length; i++) {
- // just adjust the range using the given adjustment
- ranges[i].start += adjustment;
- }
- }
- else if (viewer instanceof ITextViewerExtension5) {
- // use ITextViewerExtension5
- ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
-
- // convert document regions back to widget regions
- for (int i = 0; i < ranges.length; i++) {
- // get document range, taking into account folding
- // regions in viewer
- IRegion region = extension.modelRange2WidgetRange(new Region(ranges[i].start, ranges[i].length));
- if (region != null) {
- ranges[i].start = region.getOffset();
- ranges[i].length = region.getLength();
- } // else what happens if region is not found?!
- }
- }
- }
-
-
- /**
- * @deprecated - Read Only areas have unchanged background colors
- */
- void adjustBackground(StyleRange styleRange) {
- RGB oldRGB = null;
- Color oldColor = styleRange.background;
- if (oldColor == null) {
- oldColor = getTextWidget().getBackground();
- }
- oldRGB = oldColor.getRGB();
- Color newColor = getCachedColorFor(oldRGB);
- if (newColor == null) {
- double target = getRGBConverter().calculateYComponent(oldColor);
- // if background is "light" make it darker, and vice versa
- if (target < 0.5)
- target = 1.0;
- else
- target = 0.0;
- RGB newRGB = getRGBConverter().transformRGB(oldRGB, readOnlyBackgroundScaleFactor / 100.0, target);
-
- cacheColor(oldRGB, newRGB);
- newColor = getCachedColorFor(oldRGB);
- }
- styleRange.background = newColor;
- }
-
- private void adjustForeground(StyleRange styleRange) {
- RGB oldRGB = null;
- // Color oldColor = styleRange.foreground;
- Color oldColor = styleRange.background;
- if (oldColor == null) {
- // oldRGB = getTextWidget().getForeground().getRGB();
- oldColor = getTextWidget().getBackground();
- oldRGB = oldColor.getRGB();
- }
- else {
- oldRGB = oldColor.getRGB();
- }
- Color newColor = getCachedColorFor(oldRGB);
- if (newColor == null) {
- // make text "closer to" background lumanence
- double target = getRGBConverter().calculateYComponent(oldColor);
- RGB newRGB = getRGBConverter().transformRGBToGrey(oldRGB, readOnlyForegroundScaleFactor / 100.0, target);
-
- // save conversion, so calculations only need to be done once
- cacheColor(oldRGB, newRGB);
- newColor = getCachedColorFor(oldRGB);
- }
- styleRange.foreground = newColor;
- }
-
- /**
- * Cache read-only color.
- *
- * @param oldRGB
- * @param newColor
- */
- private void cacheColor(RGB oldRGB, RGB newColor) {
- if (readOnlyColorTable == null) {
- readOnlyColorTable = new Hashtable();
- }
- readOnlyColorTable.put(oldRGB, newColor);
- }
-
- /**
- * @param result
- * @return
- */
- private StyleRange[] convertReadOnlyRegions(StyleRange[] result, int start, int length) {
- IStructuredDocument structuredDocument = getDocument();
-
- /**
- * (dmw) For client/provider simplicity (and consistent look and feel)
- * we'll handle readonly regions in one spot, here in the Highlighter.
- * Currently it is a fair assumption that each readonly region will be
- * on an ITextRegion boundary, so we combine consecutive styles when
- * found to be equivalent. Plus, for now, we'll just adjust
- * foreground. Eventually will use a "dimming" algrorithm to adjust
- * color's satuation/brightness.
- */
- if (structuredDocument.containsReadOnly(start, length)) {
- // something is read-only in the line, so go through each style,
- // and adjust
- for (int i = 0; i < result.length; i++) {
- StyleRange styleRange = result[i];
- if (structuredDocument.containsReadOnly(styleRange.start, styleRange.length)) {
- adjustForeground(styleRange);
- }
- }
- }
- return result;
- }
-
- /**
- * Clear out the readOnlyColorTable
- */
- void disposeColorTable() {
- if (readOnlyColorTable != null) {
- readOnlyColorTable.clear();
- }
- readOnlyColorTable = null;
- }
-
- /**
- * This method is just to get existing read-only colors.
- */
- private Color getCachedColorFor(RGB oldRGB) {
- Color result = null;
-
- if (readOnlyColorTable != null) {
- RGB readOnlyRGB = (RGB) readOnlyColorTable.get(oldRGB);
- result = EditorUtility.getColor(readOnlyRGB);
- }
-
- return result;
- }
-
- protected IStructuredDocument getDocument() {
- return fStructuredDocument;
- }
-
- /**
- * Adjust the given widget offset and length so that they are the
- * textviewer document's offset and length, taking into account what is
- * actually visible in the document.
- *
- * @param offset
- * @param length
- * @return a region containing the offset and length within the
- * textviewer's document or null if the offset is not within the
- * document
- */
- private IRegion getDocumentRangeFromWidgetRange(int offset, int length) {
- IRegion styleRegion = null;
- ITextViewer viewer = getTextViewer();
- if (viewer instanceof ITextViewerExtension5) {
- // get document range, taking into account folding regions in
- // viewer
- ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
- styleRegion = extension.widgetRange2ModelRange(new Region(offset, length));
- }
- else {
- // get document range, taking into account viewer visible region
- // get visible region in viewer
- IRegion vr = null;
- if (viewer != null)
- vr = viewer.getVisibleRegion();
- else
- vr = new Region(0, getDocument().getLength());
-
- // if offset is not within visible region, then we don't really
- // care
- if (offset <= vr.getLength()) {
- // Adjust the offset to be within visible region
- styleRegion = new Region(offset + vr.getOffset(), length);
- }
- }
- return styleRegion;
- }
-
-
- private Map getExtendedProviders() {
- if (fExtendedProviders == null) {
- fExtendedProviders = new HashMap(3);
- }
- return fExtendedProviders;
- }
-
- /**
- * Method getProviderFor.
- *
- * @param typedRegion
- * @return LineStyleProvider
- */
- private LineStyleProvider getProviderFor(ITypedRegion typedRegion) {
- String type = typedRegion.getType();
- LineStyleProvider result = (LineStyleProvider) fTableOfProviders.get(type);
- if (result == null) {
- // NOT YET FINALIZED - DO NOT CONSIDER AS API
- synchronized (getExtendedProviders()) {
- if (!getExtendedProviders().containsKey(type)) {
- LineStyleProvider provider = (LineStyleProvider) ExtendedConfigurationBuilder.getInstance().getConfiguration(LINE_STYLE_PROVIDER_EXTENDED_ID, type);
- getExtendedProviders().put(type, provider);
- if (provider != null) {
- provider.init(getDocument(), this);
- }
- result = provider;
- }
- else {
- result = (LineStyleProvider) getExtendedProviders().get(type);
- }
- }
- }
- if (result == null) {
- result = NOOP_PROVIDER;
- }
- return result;
- }
-
- private YUV_RGBConverter getRGBConverter() {
- if (rgbConverter == null) {
- rgbConverter = new YUV_RGBConverter();
- }
- return rgbConverter;
- }
-
- private Map getTableOfProviders() {
- if (fTableOfProviders == null) {
- fTableOfProviders = new HashMap();
- }
- return fTableOfProviders;
- }
-
- /**
- * Returns the textViewer.
- *
- * @return ITextViewer
- */
- public ITextViewer getTextViewer() {
- return textViewer;
- }
-
- /**
- * @return
- */
- protected StyledText getTextWidget() {
- return textWidget;
- }
-
- /**
- * Installs highlighter support on the given text viewer.
- *
- * @param textViewer
- * the text viewer on which content assist will work
- */
- public void install(ITextViewer newTextViewer) {
- this.textViewer = newTextViewer;
-
- IPreferenceStore editorStore = SSEUIPlugin.getDefault().getPreferenceStore();
- editorStore.addPropertyChangeListener(fForegroundScaleListener);
- readOnlyForegroundScaleFactor = editorStore.getInt(EditorPreferenceNames.READ_ONLY_FOREGROUND_SCALE);
-
- if (textWidget != null) {
- textWidget.removeLineStyleListener(this);
- }
- textWidget = newTextViewer.getTextWidget();
- if (textWidget != null) {
- textWidget.addLineStyleListener(this);
- }
-
- refreshDisplay();
- }
-
- public StyleRange[] lineGetStyle(int eventLineOffset, int eventLineLength) {
- StyleRange[] eventStyles = EMPTY_STYLE_RANGE;
- try {
- if (getDocument() == null || eventLineLength == 0) {
- // getDocument() == null
- // during initialization, this is sometimes called before our
- // structured
- // is set, in which case we set styles to be the empty style
- // range
- // (event.styles can not be null)
-
- // eventLineLength == 0
- // we sometimes get odd requests from the very last CRLF in
- // the
- // document
- // it has no length, and there is no node for it!
- eventStyles = EMPTY_STYLE_RANGE;
- }
- else {
- /*
- * LineStyleProviders work using absolute document offsets. To
- * support visible regions, adjust the requested range up to
- * the full document offsets.
- */
- IRegion styleRegion = getDocumentRangeFromWidgetRange(eventLineOffset, eventLineLength);
- if (styleRegion != null) {
- int start = styleRegion.getOffset();
- int length = styleRegion.getLength();
-
- ITypedRegion[] partitions = TextUtilities.computePartitioning(getDocument(), fPartitioning, start, length, false);
- eventStyles = prepareStyleRangesArray(partitions, start, length);
-
- /*
- * If there is a subtext offset, the style ranges must be
- * adjusted to the expected offsets just check if
- * eventLineOffset is different than start then adjust,
- * otherwise u can leave it alone unless there is special
- * handling for itextviewerextension5?
- */
- if (start != eventLineOffset) {
- int offset = 0;
- // figure out visible region to use for adjustment
- // only adjust if need to
- if (!(getTextViewer() instanceof ITextViewerExtension5)) {
- IRegion vr = getTextViewer().getVisibleRegion();
- if (vr != null) {
- offset = vr.getOffset();
- }
- }
- adjust(eventStyles, -offset);
- }
-
- eventStyles = limitSize(eventStyles);
-
- // for debugging only
- if (DEBUG) {
- if (!valid(eventStyles, eventLineOffset, eventLineLength)) {
- Logger.log(Logger.WARNING, "Highlighter::lineGetStyle found invalid styles at offset " + eventLineOffset); //$NON-NLS-1$
- }
- }
- }
-
- }
-
- }
- catch (Exception e) {
- // if ANY exception occurs during highlighting,
- // just return "no highlighting"
- eventStyles = EMPTY_STYLE_RANGE;
- if (Debug.syntaxHighlighting) {
- System.out.println("Exception during highlighting!"); //$NON-NLS-1$
- }
- }
-
- return eventStyles;
- }
-
- /**
- * This method is to centralize the logic in limiting the overall number of style ranges
- * that make it to the styled text widget.
- *
- * Too many styles sent to StyledText results in apparent, but not real,
- * hangs of Eclipse Display thread. See
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=108806
- *
- * @param eventStyles
- * @return
- */
- private StyleRange[] limitSize(StyleRange[] eventStyles) {
-
- // quick return with same object if not modification needed
- if (eventStyles.length < MAX_NUMBER_STYLES) {
- return eventStyles;
- }
- else {
- // we could just take the easy way out and truncate, but will
- // be much better appearing if both the start of the line and the
- // end of the line are displayed with styles. Since these are both
- // the parts of the line a user is likely to look at. The middle of the
- // line will still be "plain". Presumably, the user would re-format the
- // file to avoid long lines, so unlikely to see the middle.
- StyleRange[] newRanges = new StyleRange[LEFT_STYLES_SIZE + RIGHT_STYLES_SIZE + MIDDLE_STYLES_SIZE];
- System.arraycopy(eventStyles, 0, newRanges, 0, LEFT_STYLES_SIZE);
- //
- // do end, before we do middle
- System.arraycopy(eventStyles, eventStyles.length-RIGHT_STYLES_SIZE, newRanges, LEFT_STYLES_SIZE + MIDDLE_STYLES_SIZE, RIGHT_STYLES_SIZE);
- //
- // technically, we should compute the exact middle as one big style range,
- // with default colors and styles, so if someone does actually type or work with
- // documnet as is, will still be correct.
- //
- StyleRange allBlank = new StyleRange();
- StyleRange lastKnown = newRanges[LEFT_STYLES_SIZE - 1];
- allBlank.start = lastKnown.start + lastKnown.length;
- StyleRange nextKnown = newRanges[LEFT_STYLES_SIZE + MIDDLE_STYLES_SIZE + 1];
- allBlank.length = nextKnown.start - allBlank.start;
- newRanges[LEFT_STYLES_SIZE] = allBlank;
- return newRanges;
- }
- }
-
- /**
- * A passthrough method that extracts relevant data from the
- * LineStyleEvent and passes it along. This method was separated for
- * performance testing purposes.
- *
- * @see org.eclipse.swt.custom.LineStyleListener#lineGetStyle(LineStyleEvent)
- */
- public void lineGetStyle(LineStyleEvent event) {
- int offset = event.lineOffset;
- int length = event.lineText.length();
-
- /*
- * For some reason, we are sometimes asked for the same style range
- * over and over again. This was found to happen during 'revert' of a
- * file with one line in it that is 40K long! So, while we don't know
- * root cause, caching the styled ranges in case the exact same
- * request is made multiple times seems like cheap insurance.
- */
- if (offset == fSavedOffset && length == fSavedLength && fSavedRanges != null) {
- event.styles = fSavedRanges;
- }
- else {
- // need to assign this array here, or else the field won't get
- // updated
- event.styles = lineGetStyle(offset, length);
- // now saved "cached data" for repeated requests which are exaclty
- // same
- fSavedOffset = offset;
- fSavedLength = length;
- fSavedRanges = event.styles;
- }
- }
-
- /**
- * Note: its very important this method never return null, which is why
- * the final null check is in a finally clause
- */
-
- protected StyleRange[] prepareStyleRangesArray(ITypedRegion[] partitions, int start, int length) {
-
- StyleRange[] result = EMPTY_STYLE_RANGE;
-
- if (fHoldStyleResults == null) {
- fHoldStyleResults = new ArrayList(partitions.length);
- }
- else {
- fHoldStyleResults.clear();
- }
-
- // TODO: make some of these instance variables to prevent creation on
- // stack
- LineStyleProvider currentLineStyleProvider = null;
- boolean handled = false;
- for (int i = 0; i < partitions.length; i++) {
- ITypedRegion currentPartition = partitions[i];
- currentLineStyleProvider = getProviderFor(currentPartition);
- currentLineStyleProvider.init(getDocument(), this);
- handled = currentLineStyleProvider.prepareRegions(currentPartition, currentPartition.getOffset(), currentPartition.getLength(), fHoldStyleResults);
- if (Debug.syntaxHighlighting && !handled) {
- System.out.println("Did not handle highlighting in Highlighter inner while"); //$NON-NLS-1$
- }
- }
-
- int resultSize = fHoldStyleResults.size();
- if (resultSize > 0) {
- result = (StyleRange[]) fHoldStyleResults.toArray(new StyleRange[fHoldStyleResults.size()]);
- }
- else {
- result = EMPTY_STYLE_RANGE;
- }
- result = convertReadOnlyRegions(result, start, length);
- return result;
- }
-
- public void refreshDisplay() {
- if (textWidget != null && !textWidget.isDisposed())
- textWidget.redraw();
- }
-
- /**
- */
- public void refreshDisplay(int start, int length) {
- if (textWidget != null && !textWidget.isDisposed())
- textWidget.redrawRange(start, length, true);
- }
-
- public void removeProvider(String partitionType) {
- getTableOfProviders().remove(partitionType);
- }
-
- public void setDocument(IStructuredDocument structuredDocument) {
- fStructuredDocument = structuredDocument;
- }
-
- public void setDocumentPartitioning(String partitioning) {
- if (partitioning != null) {
- fPartitioning = partitioning;
- }
- else {
- fPartitioning = IDocumentExtension3.DEFAULT_PARTITIONING;
- }
- }
-
- /**
- * Uninstalls highlighter support from the text viewer it has previously
- * be installed on.
- */
- public void uninstall() {
- if (textWidget != null && !textWidget.isDisposed()) {
- textWidget.removeLineStyleListener(this);
- }
- textWidget = null;
-
- Collection providers = getTableOfProviders().values();
- Iterator iterator = providers.iterator();
- while (iterator.hasNext()) {
- LineStyleProvider lineStyleProvider = (LineStyleProvider) iterator.next();
- lineStyleProvider.release();
- // this remove probably isn't strictly needed, since
- // typically highlighter instance as a whole will go
- // away ... but in case that ever changes, this seems like
- // a better style.
- iterator.remove();
- }
-
- synchronized (getExtendedProviders()) {
- providers = new ArrayList(getExtendedProviders().values());
- getExtendedProviders().clear();
- }
- iterator = providers.iterator();
- while (iterator.hasNext()) {
- LineStyleProvider lineStyleProvider = (LineStyleProvider) iterator.next();
- if (lineStyleProvider != null) {
- lineStyleProvider.release();
- iterator.remove();
- }
- }
-
- IPreferenceStore editorStore = SSEUIPlugin.getDefault().getPreferenceStore();
- editorStore.removePropertyChangeListener(fForegroundScaleListener);
- disposeColorTable();
-
- // clear out cached variables (d282894)
- fSavedOffset = -1;
- fSavedLength = -1;
- fSavedRanges = null;
- }
-
- /**
- * Purely a debugging aide.
- */
- private boolean valid(StyleRange[] eventStyles, int startOffset, int lineLength) {
- boolean result = false;
- if (eventStyles != null) {
- if (eventStyles.length > 0) {
- StyleRange first = eventStyles[0];
- StyleRange last = eventStyles[eventStyles.length - 1];
- if (startOffset > first.start) {
- result = false;
- }
- else {
- int lineEndOffset = startOffset + lineLength;
- int lastOffset = last.start + last.length;
- if (lastOffset > lineEndOffset) {
- result = false;
- }
- else {
- result = true;
- }
- }
- }
- else {
- // a zero length array is ok
- result = true;
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/IHighlighter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/IHighlighter.java
deleted file mode 100644
index 112ff1d0fe..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/IHighlighter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-package org.eclipse.wst.sse.ui.internal.provisional.style;
-
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.swt.custom.LineStyleListener;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-
-/**
- * @author davidw
- *
- */
-public interface IHighlighter extends LineStyleListener {
- void addProvider(String partitionType, LineStyleProvider provider);
-
- void install(ITextViewer viewer);
-
- void removeProvider(String partitionType);
-
- void setDocument(IStructuredDocument structuredDocument);
-
- void uninstall();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/LineStyleProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/LineStyleProvider.java
deleted file mode 100644
index 0e0cf460e7..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/LineStyleProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.style;
-
-import java.util.Collection;
-
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-
-public interface LineStyleProvider {
-
- /**
- * Initializes this provider for the given Highlighter and document. This
- * method will be called at least once before prepareRegions is called.
- *
- * @param document
- * @param highlighter
- */
- void init(IStructuredDocument document, Highlighter highlighter);
-
- /**
- * Optionally appends StyleRanges to the styleRanges Collection, in order,
- * and only covering the given range within the document.
- *
- * @param currentRegion -
- * the current document partition
- * @param start
- * @param length
- * @param styleRanges
- * @return whether this LineStyleProvider handled the request; handling
- * includes not adding StyleRanges if that is still the correct
- * behavior
- */
- boolean prepareRegions(ITypedRegion currentRegion, int start, int length, Collection styleRanges);
-
- /**
- * Instructs this provider to free up any "resources" it might be holding
- * on to (such as listening for preference changes). It is only called
- * once in the lifetime of this provider.
- */
- void release();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/LineStyleProviderForNoOp.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/LineStyleProviderForNoOp.java
deleted file mode 100644
index b9c51d70d6..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/provisional/style/LineStyleProviderForNoOp.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.provisional.style;
-
-
-
-import java.util.Collection;
-
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-
-/**
- * This class can be used by default, if no attribute provider is found for a
- * certain region type. Its probably an error in a factory somewhere if an
- * adapter is not found, but this class allows the logic to proceed basically
- * simply providing default colored syntax highlighting.
- *
- * Not to be subclassed.
- */
-final public class LineStyleProviderForNoOp implements LineStyleProvider {
-
- public void init(IStructuredDocument document, Highlighter highlighter) {
- // nothing to do
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.provisional.style.AbstractLineStyleProvider#prepareRegions(org.eclipse.jface.text.ITypedRegion,
- * int, int, java.util.Collection)
- */
- public boolean prepareRegions(ITypedRegion currentRegion, int start, int length, Collection holdResults) {
- // add nothing, but say handled.
- return true;
- }
-
- public void release() {
- // nothing to do
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/AbstractStructuredTextReconcilingStrategy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/AbstractStructuredTextReconcilingStrategy.java
deleted file mode 100644
index 7ae04ff5ad..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/AbstractStructuredTextReconcilingStrategy.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcileResult;
-import org.eclipse.jface.text.reconciler.IReconcileStep;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModelExtension;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.wst.sse.ui.internal.IReleasable;
-import org.eclipse.wst.sse.ui.internal.ITemporaryAnnotation;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.StructuredMarkerAnnotation;
-
-
-/**
- * A base ReconcilingStrategy. Subclasses must implement
- * createReconcileSteps(). This class should not know about
- * IStructuredDocument, only IDocument.
- *
- * @author pavery
- */
-public abstract class AbstractStructuredTextReconcilingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension, IReleasable {
-
- /** debug flag */
- protected static final boolean DEBUG;
- static {
- String value = Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerjob"); //$NON-NLS-1$
- DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
- // these limits are safetys for "runaway" validation cases
- // should be used to safeguard potentially dangerous loops or potentially
- // long annotations
- // (since the painter seems to affect performance when painting long
- // annotations)
- public static final int ANNOTATION_LENGTH_LIMIT = 25;
- public static final int ELEMENT_ERROR_LIMIT = 25;
-
- private IDocument fDocument = null;
- // private IReconcileStep fFirstStep = null;
- private IProgressMonitor fProgressMonitor = null;
- private ISourceViewer fSourceViewer = null;
-// private Comparator fComparator;
-
- // list of "validator" annotations
- // for gray/un-gray capability
- private HashSet fMarkerAnnotations = null;
-
- /**
- * Creates a new strategy. The editor parameter is for access to the
- * annotation model.
- *
- * @param editor
- */
- public AbstractStructuredTextReconcilingStrategy(ISourceViewer sourceViewer) {
- fSourceViewer = sourceViewer;
- init();
- }
-
- /**
- * This is where we add results to the annotationModel, doing any special
- * "extra" processing.
- */
- protected void addResultToAnnotationModel(IReconcileResult result) {
- if (!(result instanceof TemporaryAnnotation))
- return;
- // can be null when closing the editor
- if (getAnnotationModel() != null) {
- TemporaryAnnotation tempAnnotation = (TemporaryAnnotation) result;
-
- StructuredMarkerAnnotation sma = getCorrespondingMarkerAnnotation(tempAnnotation);
- if (sma != null) {
- // un-gray out the marker annotation
- sma.setGrayed(false);
- }
-
- getAnnotationModel().addAnnotation(tempAnnotation, tempAnnotation.getPosition());
- }
- }
-
- /**
- * @param object
- * @return if this strategy is responisble for adding this type of key
- */
- protected boolean canHandlePartition(String partition) {
- // String[] haystack = getPartitionTypes();
- // for (int i = 0; i < haystack.length; i++) {
- // if (haystack[i].equals(partition))
- // return true;
- // }
- // return false;
- return false;
- }
-
- // /**
- // * @param step
- // * @return
- // */
- // protected boolean containsStep(IReconcileStep step) {
- // if (fFirstStep instanceof StructuredReconcileStep)
- // return ((StructuredReconcileStep) fFirstStep).isSiblingStep(step);
- // return false;
- // }
-
- /**
- * This is where you should create the steps for this strategy
- */
- abstract public void createReconcileSteps();
-
- /**
- * Remove ALL temporary annotations that this strategy can handle.
- */
- protected TemporaryAnnotation[] getAllAnnotationsToRemove() {
- List removals = new ArrayList();
- IAnnotationModel annotationModel = getAnnotationModel();
- if (annotationModel != null) {
- Iterator i = annotationModel.getAnnotationIterator();
- while (i.hasNext()) {
- Object obj = i.next();
- if (!(obj instanceof ITemporaryAnnotation))
- continue;
-
- ITemporaryAnnotation annotation = (ITemporaryAnnotation) obj;
- ReconcileAnnotationKey key = (ReconcileAnnotationKey) annotation.getKey();
- // then if this strategy knows how to add/remove this
- // partition type
- if (canHandlePartition(key.getPartitionType()) /*
- * &&
- * containsStep(key.getStep())
- */)
- removals.add(annotation);
- }
- }
- return (TemporaryAnnotation[]) removals.toArray(new TemporaryAnnotation[removals.size()]);
- }
-
- protected IAnnotationModel getAnnotationModel() {
- IAnnotationModel model = null;
- if (fSourceViewer != null) {
- model = fSourceViewer.getAnnotationModel();
- }
- return model;
- }
-
- protected TemporaryAnnotation[] getAnnotationsToRemove(DirtyRegion dr, List stepsRun) {
-
- List remove = new ArrayList();
- IAnnotationModel annotationModel = getAnnotationModel();
- // can be null when closing the editor
- if (getAnnotationModel() != null) {
-
- // clear validator annotations
- getMarkerAnnotations().clear();
-
- Iterator i = annotationModel.getAnnotationIterator();
- while (i.hasNext()) {
-
- Object obj = i.next();
-
- // check if it's a validator marker annotation
- // if it is save it for comparision later (to "gray" icons)
- if (obj instanceof StructuredMarkerAnnotation) {
- StructuredMarkerAnnotation sma = (StructuredMarkerAnnotation) obj;
-
- if (sma.getAnnotationType() == TemporaryAnnotation.ANNOT_ERROR || sma.getAnnotationType() == TemporaryAnnotation.ANNOT_WARNING)
- fMarkerAnnotations.add(sma);
- }
-
- if (!(obj instanceof TemporaryAnnotation))
- continue;
-
- TemporaryAnnotation annotation = (TemporaryAnnotation) obj;
- ReconcileAnnotationKey key = (ReconcileAnnotationKey) annotation.getKey();
-
- // then if this strategy knows how to add/remove this
- // partition type
- if (canHandlePartition(key.getPartitionType()) && stepsRun.contains(key.getStep())) {
- if (key.getScope() == ReconcileAnnotationKey.PARTIAL && annotation.getPosition().overlapsWith(dr.getOffset(), dr.getLength())) {
- remove.add(annotation);
- }
- else if (key.getScope() == ReconcileAnnotationKey.TOTAL) {
- remove.add(annotation);
- }
- }
- }
- }
- return (TemporaryAnnotation[]) remove.toArray(new TemporaryAnnotation[remove.size()]);
- }
-
-
- protected abstract boolean containsStep(IReconcileStep step);
-
- /**
- * Gets partition types from all steps in this strategy.
- *
- * @return parition types from all steps
- */
- // public String[] getPartitionTypes() {
- // if (fFirstStep instanceof StructuredReconcileStep)
- // return ((StructuredReconcileStep) fFirstStep).getPartitionTypes();
- // return new String[0];
- // }
- public void init() {
- createReconcileSteps();
- }
-
- /**
- * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#initialReconcile()
- */
- public void initialReconcile() {
- // do nothing
- }
-
- /**
- * @return
- */
- protected boolean isCanceled() {
- if (DEBUG && (fProgressMonitor != null && fProgressMonitor.isCanceled()))
- System.out.println("** STRATEGY CANCELED **:" + this.getClass().getName()); //$NON-NLS-1$
- return fProgressMonitor != null && fProgressMonitor.isCanceled();
- }
-
- /**
- * Process the results from the reconcile steps in this strategy.
- *
- * @param results
- */
- private void process(final IReconcileResult[] results) {
- if (DEBUG)
- System.out.println("[trace reconciler] > STARTING PROCESS METHOD with (" + results.length + ") results"); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (results == null)
- return;
-
- for (int i = 0; i < results.length && i < ELEMENT_ERROR_LIMIT && !isCanceled(); i++) {
-
- if (isCanceled()) {
- if (DEBUG)
- System.out.println("[trace reconciler] >** PROCESS (adding) WAS CANCELLED **"); //$NON-NLS-1$
- return;
- }
- addResultToAnnotationModel(results[i]);
- }
-
- if (DEBUG) {
- StringBuffer traceString = new StringBuffer();
- for (int j = 0; j < results.length; j++)
- traceString.append("\n (+) :" + results[j] + ":\n"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("[trace reconciler] > PROCESSING (" + results.length + ") results in AbstractStructuredTextReconcilingStrategy " + traceString); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion,
- * org.eclipse.jface.text.IRegion)
- */
- public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
- // not used
- // we only have validator strategy now
-
- // // external files may be null
- // if (isCanceled() || fFirstStep == null)
- // return;
- //
- // TemporaryAnnotation[] annotationsToRemove = new
- // TemporaryAnnotation[0];
- // IReconcileResult[] annotationsToAdd = new IReconcileResult[0];
- // StructuredReconcileStep structuredStep = (StructuredReconcileStep)
- // fFirstStep;
- //
- // annotationsToRemove = getAnnotationsToRemove(dirtyRegion);
- // annotationsToAdd = structuredStep.reconcile(dirtyRegion,
- // subRegion);
- //
- // smartProcess(annotationsToRemove, annotationsToAdd);
- }
-
- /**
- * @param partition
- * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion)
- */
- public void reconcile(IRegion partition) {
- // not used, we use:
- // reconcile(DirtyRegion dirtyRegion, IRegion subRegion)
- }
-
- /**
- * Calls release() on all the steps in this strategy. Currently done in
- * StructuredRegionProcessor.SourceWidgetDisposeListener#widgetDisposed(...)
- */
- public void release() {
- // release steps (each step calls release on the next)
- // if (fFirstStep != null && fFirstStep instanceof IReleasable)
- // ((IReleasable) fFirstStep).release();
- // we don't to null out the steps, in case
- // it's reconfigured later
- }
-
- private void removeAnnotations(TemporaryAnnotation[] annotationsToRemove) {
-
- IAnnotationModel annotationModel = getAnnotationModel();
- // can be null when closing the editor
- if (annotationModel != null) {
- for (int i = 0; i < annotationsToRemove.length; i++) {
- if (isCanceled()) {
- if (DEBUG)
- System.out.println("[trace reconciler] >** REMOVAL WAS CANCELLED **"); //$NON-NLS-1$
- return;
- }
- StructuredMarkerAnnotation sma = getCorrespondingMarkerAnnotation(annotationsToRemove[i]);
- if (sma != null) {
- // gray out the marker annotation
- sma.setGrayed(true);
- }
- // remove the temp one
- annotationModel.removeAnnotation(annotationsToRemove[i]);
-
- }
- }
-
- if (DEBUG) {
- StringBuffer traceString = new StringBuffer();
- for (int i = 0; i < annotationsToRemove.length; i++)
- traceString.append("\n (-) :" + annotationsToRemove[i] + ":\n"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("[trace reconciler] > REMOVED (" + annotationsToRemove.length + ") annotations in AbstractStructuredTextReconcilingStrategy :" + traceString); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- private StructuredMarkerAnnotation getCorrespondingMarkerAnnotation(TemporaryAnnotation tempAnnotation) {
-
- Iterator it = getMarkerAnnotations().iterator();
- while (it.hasNext()) {
- StructuredMarkerAnnotation markerAnnotation = (StructuredMarkerAnnotation) it.next();
- String message = ""; //$NON-NLS-1$
- try {
- message = (String) markerAnnotation.getMarker().getAttribute(IMarker.MESSAGE);
- }
- catch (CoreException e) {
- if (DEBUG)
- Logger.logException(e);
- }
- // it would be nice to check line number here...
- if (message != null && message.equals(tempAnnotation.getText()))
- return markerAnnotation;
- }
- return null;
- }
-
- private void removeAllAnnotations() {
- removeAnnotations(getAllAnnotationsToRemove());
- }
-
- /**
- * Set the document for this strategy.
- *
- * @param document
- * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#setDocument(org.eclipse.jface.text.IDocument)
- */
- public void setDocument(IDocument document) {
-
- // remove all old annotations since it's a new document
- removeAllAnnotations();
-
- if (document == null)
- release();
-
- // if (getFirstStep() != null)
- // getFirstStep().setInputModel(new DocumentAdapter(document));
-
- fDocument = document;
- }
-
- public IDocument getDocument() {
- return fDocument;
- }
-
- /**
- * @param monitor
- * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void setProgressMonitor(IProgressMonitor monitor) {
- // fProgressMonitor = monitor;
- // if (fFirstStep != null)
- // fFirstStep.setProgressMonitor(fProgressMonitor);
- }
-
- /**
- * Check if the annotation is already there, if it is, no need to remove
- * or add again. This will avoid a lot of "flickering" behavior.
- *
- * @param annotationsToRemove
- * @param annotationsToAdd
- */
- protected void smartProcess(TemporaryAnnotation[] annotationsToRemove, IReconcileResult[] annotationsToAdd) {
-// Comparator comp = getTemporaryAnnotationComparator();
-// List sortedRemovals = Arrays.asList(annotationsToRemove);
-// Collections.sort(sortedRemovals, comp);
-//
-// List sortedAdditions = Arrays.asList(annotationsToAdd);
-// Collections.sort(sortedAdditions, comp);
-//
-// List filteredRemovals = new ArrayList(sortedRemovals);
-// List filteredAdditions = new ArrayList(sortedAdditions);
-//
-// boolean ignore = false;
-// int lastFoundAdded = 0;
-// for (int i = 0; i < sortedRemovals.size(); i++) {
-// TemporaryAnnotation removal = (TemporaryAnnotation) sortedRemovals.get(i);
-// for (int j = lastFoundAdded; j < sortedAdditions.size(); j++) {
-// TemporaryAnnotation addition = (TemporaryAnnotation) sortedAdditions.get(j);
-// // quick position check here
-// if (removal.getPosition().equals(addition.getPosition())) {
-// lastFoundAdded = j;
-// // remove performs TemporaryAnnotation.equals()
-// // which checks text as well
-// filteredAdditions.remove(addition);
-// ignore = true;
-// if (DEBUG)
-// System.out.println(" ~ smart process ignoring: " + removal.getPosition().getOffset()); //$NON-NLS-1$
-// break;
-// }
-// }
-// if (ignore) {
-// filteredRemovals.remove(removal);
-// }
-// ignore = false;
-// }
- if (getAnnotationModel() instanceof IAnnotationModelExtension) {
-// TemporaryAnnotation[] filteredRemovalArray = (TemporaryAnnotation[]) filteredRemovals.toArray(new TemporaryAnnotation[filteredRemovals.size()]);
-// // apply "grey"-ness
-// for (int i = 0; i < filteredRemovalArray.length; i++) {
-// if (isCanceled()) {
-// if (DEBUG)
-// System.out.println("[trace reconciler] >** replacing WAS CANCELLED **"); //$NON-NLS-1$
-// return;
-// }
-// StructuredMarkerAnnotation sma = getCorrespondingMarkerAnnotation(filteredRemovalArray[i]);
-// if (sma != null) {
-// // gray out the marker annotation
-// sma.setGrayed(true);
-// }
-// }
-// Map annotationsToAddMap = new HashMap();
-// for (int i = 0; i < filteredAdditions.size(); i++) {
-// TemporaryAnnotation temporaryAnnotation = (TemporaryAnnotation) filteredAdditions.get(i);
-// annotationsToAddMap.put(temporaryAnnotation, temporaryAnnotation.getPosition());
-// }
-// if (isCanceled()) {
-// if (DEBUG)
-// System.out.println("[trace reconciler] >** PROCESS (replacing) WAS CANCELLED **"); //$NON-NLS-1$
-// return;
-// }
-// /*
-// * Using the extension means we can't enforce the
-// * ELEMENT_ERROR_LIMIT limit.
-// */
-// ((IAnnotationModelExtension) getAnnotationModel()).replaceAnnotations(filteredRemovalArray, annotationsToAddMap);
-
- Map annotationsToAddMap = new HashMap();
- for (int i = 0; i < annotationsToAdd.length; i++) {
- TemporaryAnnotation temporaryAnnotation = (TemporaryAnnotation) annotationsToAdd[i];
- annotationsToAddMap.put(temporaryAnnotation, temporaryAnnotation.getPosition());
- }
- if (isCanceled()) {
- if (DEBUG)
- System.out.println("[trace reconciler] >** PROCESS (replacing) WAS CANCELLED **"); //$NON-NLS-1$
- return;
- }
- ((IAnnotationModelExtension) getAnnotationModel()).replaceAnnotations(annotationsToRemove, annotationsToAddMap);
- }
- else {
-// removeAnnotations((TemporaryAnnotation[]) filteredRemovals.toArray(new TemporaryAnnotation[filteredRemovals.size()]));
-// process((IReconcileResult[]) filteredAdditions.toArray(new IReconcileResult[filteredAdditions.size()]));
- removeAnnotations(annotationsToRemove);
- process(annotationsToAdd);
- }
- }
-
-// private Comparator getTemporaryAnnotationComparator() {
-// if (fComparator == null) {
-// fComparator = new Comparator() {
-// public int compare(Object arg0, Object arg1) {
-// TemporaryAnnotation ta1 = (TemporaryAnnotation) arg0;
-// TemporaryAnnotation ta2 = (TemporaryAnnotation) arg1;
-// int result = ta1.getPosition().getOffset() - ta2.getPosition().getOffset();
-// if(result != 0)
-// return result;
-// return Collator.getInstance().compare(ta1.getText(), ta2.getText());
-// }
-// };
-// }
-// return fComparator;
-// }
-
- public HashSet getMarkerAnnotations() {
- if (fMarkerAnnotations == null)
- fMarkerAnnotations = new HashSet();
- return fMarkerAnnotations;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DirtyRegionProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DirtyRegionProcessor.java
deleted file mode 100644
index 36ecb50818..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DirtyRegionProcessor.java
+++ /dev/null
@@ -1,776 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentEvent;
-import org.eclipse.jface.text.DocumentRewriteSessionEvent;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentExtension3;
-import org.eclipse.jface.text.IDocumentExtension4;
-import org.eclipse.jface.text.IDocumentListener;
-import org.eclipse.jface.text.IDocumentRewriteSessionListener;
-import org.eclipse.jface.text.ITextInputListener;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconciler;
-import org.eclipse.jface.text.reconciler.IReconcilerExtension;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-/**
- * This Job holds a queue of updates from the editor (DirtyRegions) to
- * process. When a new request comes in, the current run is canceled, the new
- * request is added to the queue, then the job is re-scheduled.
- *
- * @author pavery
- */
-public class DirtyRegionProcessor extends Job implements IReconciler, IReconcilerExtension, IConfigurableReconciler {
- class DocumentListener implements IDocumentListener {
- public void documentAboutToBeChanged(DocumentEvent event) {
- /*
- * if in rewrite session and already going to reprocess
- * entire document after rewrite session, do nothing
- */
- if (isInRewriteSession() && fReprocessAfterRewrite)
- return;
- // save partition type (to see if it changes in documentChanged())
- fLastPartitions = getPartitionRegions(event.getOffset(), event.getLength());
- }
-
- public void documentChanged(DocumentEvent event) {
- /*
- * if in rewrite session and already going to reprocess
- * entire document after rewrite session, do nothing
- */
- if (isInRewriteSession() && fReprocessAfterRewrite)
- return;
-
- if (partitionsChanged(event)) {
- // pa_TODO
- // this is a simple way to ensure old
- // annotations are removed when partition changes
-
- // it might be a performance hit though
- setEntireDocumentDirty(getDocument());
- }
- else {
- /*
- * Note that creating DirtyRegions *now* means that the wrong
- * text may be included
- */
- DirtyRegion dr = null;
- if (event.getLength() == 0) {
- /*
- * It's an insert-- we use text length though so that the
- * new region gets validated...
- */
- dr = createDirtyRegion(event.getOffset(), 0, DirtyRegion.INSERT);
- }
- else {
- if ("".equals(event.getText())) { //$NON-NLS-1$
- // it's a delete
- dr = createDirtyRegion(event.getOffset(), event.getLength(), DirtyRegion.REMOVE);
- }
- else {
- // it's a replace
- dr = createDirtyRegion(event.getOffset(), event.getLength(), DirtyRegion.INSERT);
- }
- }
- if (isInRewriteSession()) {
- /*
- * while in rewrite session, found a dirty region, so flag
- * that entire document needs to be reprocesed after rewrite
- * session
- */
- if (!fReprocessAfterRewrite && (dr != null)) {
- fReprocessAfterRewrite = true;
- }
- } else {
- processDirtyRegion(dr);
- }
- }
- }
-
- /**
- * Checks previous partitions from the span of the event w/ the new
- * partitions from the span of the event. If partitions changed,
- * return true, else return false
- *
- * @param event
- * @return
- */
- private boolean partitionsChanged(DocumentEvent event) {
- boolean changed = false;
- int length = event.getLength();
-
- if (event.getLength() == 0 && event.getText().length() > 0) {
- // it's an insert, we want partitions of the new text
- length = event.getText().length();
- }
-
- ITypedRegion[] newPartitions = getPartitionRegions(event.getOffset(), length);
- if (fLastPartitions != null) {
- if (fLastPartitions.length != newPartitions.length) {
- changed = true;
- }
- else {
- for (int i = 0; i < fLastPartitions.length; i++) {
- if (!fLastPartitions[i].getType().equals(newPartitions[i].getType())) {
- changed = true;
- break;
- }
- }
- }
- }
- return changed;
- }
-
-
- }
-
- /**
- * Reconciles the entire document when the document in the viewer is
- * changed. This happens when the document is initially opened, as well as
- * after a save-as.
- *
- * Also see processPostModelEvent(...) for similar behavior when document
- * for the model is changed.
- */
- class TextInputListener implements ITextInputListener {
- public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
- // do nothing
- }
-
- public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
- handleInputDocumentChanged(oldInput, newInput);
- }
- }
-
- class DocumentRewriteSessionListener implements IDocumentRewriteSessionListener {
- long time0 = 0;
-
- public void documentRewriteSessionChanged(DocumentRewriteSessionEvent event) {
- boolean oldValue = fInRewriteSession;
- fInRewriteSession = event != null && event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_START);
-
- if (event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_START)) {
- if(DEBUG) {
- time0 = System.currentTimeMillis();
- }
- flushDirtyRegionQueue();
- fReprocessAfterRewrite = false;
- }
- else if (event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_STOP)) {
- if (fInRewriteSession ^ oldValue && fDocument != null) {
- if(DEBUG) {
- Logger.log(Logger.INFO, "Rewrite session lasted " + (System.currentTimeMillis() - time0) + "ms");
- time0 = System.currentTimeMillis();
- }
- if (fReprocessAfterRewrite) {
- DirtyRegion entireDocument = createDirtyRegion(0, fDocument.getLength(), DirtyRegion.INSERT);
- processDirtyRegion(entireDocument);
- }
- if (DEBUG) {
- Logger.log(Logger.INFO, "Full document reprocess took " + (System.currentTimeMillis() - time0) + "ms");
- }
- fReprocessAfterRewrite = false;
- }
- }
- }
- }
-
- /** debug flag */
- protected static final boolean DEBUG;
- private static final long UPDATE_DELAY = 750;
-
- static {
- String value = Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerjob"); //$NON-NLS-1$
- DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
- private long fDelay;
-
-
- /** local queue of dirty regions (created here) to be reconciled */
- private List fDirtyRegionQueue = Collections.synchronizedList(new ArrayList());
-
- /** document that this reconciler works on */
- private IDocument fDocument = null;
-
- private IDocumentListener fDocumentListener = new DocumentListener();
- private IDocumentRewriteSessionListener fDocumentRewriteSessionListener = new DocumentRewriteSessionListener();
-
- /**
- * set true after first install to prevent duplicate work done in the
- * install method (since install gets called multiple times)
- */
- private boolean fIsInstalled = false;
-
- /**
- * so we can tell if a partition changed after the last edit
- */
- ITypedRegion[] fLastPartitions;
-
- List fNonIncrementalStrategiesAlreadyProcessed = new ArrayList(1);
-
- /**
- * The partitioning this reconciler uses.
- */
- private String fPartitioning;
-
- Map fReconcilingStrategies = null;
-
- /** for initial reconcile when document is opened */
- private TextInputListener fTextInputListener = null;
- /** the text viewer */
- private ITextViewer fViewer;
- boolean fInRewriteSession = false;
- /**
- * true if entire document needs to be reprocessed after
- * rewrite session
- */
- boolean fReprocessAfterRewrite = false;
-
- /**
- * Creates a new StructuredRegionProcessor
- */
- public DirtyRegionProcessor() {
- // init job stuff
- super(SSEUIMessages.proc_dirty_regions_0); //$NON-NLS-1$
- setPriority(Job.LONG);
- setSystem(true);
-
- // init reconciler stuff
- setDelay(UPDATE_DELAY);
- fReconcilingStrategies = new HashMap();
- }
-
- /**
- * Adds the given resource to the set of resources that need refreshing.
- * Synchronized in order to protect the collection during add.
- *
- * @param resource
- */
- private synchronized void addRequest(DirtyRegion newDirtyRegion) {
- // NOTE: This method is called a lot so make sure it's fast
- List dirtyRegionQueue = getDirtyRegionQueue();
- for (Iterator it = dirtyRegionQueue.iterator(); it.hasNext();) {
- // go through list of existing dirty regions and check if any
- // dirty regions need to be discarded
- DirtyRegion currentExisting = (DirtyRegion) it.next();
- DirtyRegion outer = getOuterRegion(currentExisting, newDirtyRegion);
- // if we already have a request which contains the new request,
- // discard the new request
- if (outer == currentExisting)
- return;
- // if new request contains any existing requests,
- // remove those
- if (outer == newDirtyRegion)
- it.remove();
- }
- dirtyRegionQueue.add(newDirtyRegion);
- }
-
- /**
- * Notifies subclasses that processing of multiple dirty regions has begun
- */
- protected void beginProcessing() {
- // do nothing by default
- }
-
- /**
- * @param dirtyRegion
- * @return
- */
- protected ITypedRegion[] computePartitioning(DirtyRegion dirtyRegion) {
- int drOffset = dirtyRegion.getOffset();
- int drLength = dirtyRegion.getLength();
-
- return computePartitioning(drOffset, drLength);
- }
-
- protected ITypedRegion[] computePartitioning(int drOffset, int drLength) {
- IDocument doc = getDocument();
- int docLength = doc.getLength();
-
- ITypedRegion[] tr = new ITypedRegion[0];
-
- if (drOffset > docLength) {
- drOffset = docLength;
- drLength = 0;
- }
- else if (drOffset + drLength > docLength) {
- drLength = docLength - drOffset;
- }
-
- try {
- // dirty region may span multiple partitions
- tr = TextUtilities.computePartitioning(doc, getDocumentPartitioning(), drOffset, drLength, true);
- }
- catch (BadLocationException e) {
- String info = "dr: [" + drOffset + ":" + drLength + "] doc: [" + docLength + "] "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- Logger.logException(info, e);
- tr = new ITypedRegion[0];
- }
- return tr;
- }
-
- /**
- * @deprecated use getOuterRegion() instead
- */
- protected boolean contains(DirtyRegion root, DirtyRegion possible) {
- // remove method post wtp 1.5.1
- return isContained(root, possible);
- }
-
- /**
- * Used to determine if one dirty region contains the other and if so,
- * which is the one that contains it.
- *
- * @param root
- * @param possible
- * @return the outer dirty region if it contains the other dirty region,
- * null otherwise
- */
- protected DirtyRegion getOuterRegion(DirtyRegion root, DirtyRegion possible) {
- DirtyRegion outer = null;
- if (isContained(root, possible))
- outer = root;
- else if (isContained(possible, root))
- outer = possible;
- return outer;
- }
-
- /**
- * Used to determine of a "possible" dirty region can be discarded in
- * favor of using just the "root" dirty region.
- *
- * @return if the root dirty region contains possible, return true,
- * otherwise return false
- */
- private boolean isContained(DirtyRegion root, DirtyRegion possible) {
- int rootStart = root.getOffset();
- int rootEnd = rootStart + root.getLength();
- int possStart = possible.getOffset();
- int possEnd = possStart + possible.getLength();
- if (rootStart <= possStart && rootEnd >= possEnd)
- return true;
- return false;
- }
-
- protected DirtyRegion createDirtyRegion(int offset, int length, String type) {
- DirtyRegion durty = null;
- IDocument doc = getDocument();
-
- if (doc != null) {
- // safety for BLE
- int docLen = doc.getLength();
- if (offset > docLen) {
- offset = docLen;
- length = 0;
- }
- else if (offset + length >= docLen)
- length = docLen - offset;
- try {
- durty = new DirtyRegion(offset, length, type, doc.get(offset, length));
- }
- catch (BadLocationException e) {
- String info = "dr: [" + offset + ":" + length + "] doc: [" + docLen + "] "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- Logger.logException(info, e);
- }
- }
- return durty;
- }
-
- protected DirtyRegion createDirtyRegion(ITypedRegion tr, String type) {
- return createDirtyRegion(tr.getOffset(), tr.getLength(), type);
- }
-
- protected void flushDirtyRegionQueue() {
- fDirtyRegionQueue.clear();
- }
-
- /**
- * Notifies subclasses that processing of multiple dirty regions has
- * ended, for now
- */
- protected void endProcessing() {
- // do nothing by default
- }
-
- /**
- * Delay between processing of DirtyRegions.
- *
- * @return
- */
- long getDelay() {
- return fDelay;
- }
-
- List getDirtyRegionQueue() {
- return fDirtyRegionQueue;
- }
-
- /**
- * The IDocument on which this reconciler operates
- *
- * @return
- */
- protected IDocument getDocument() {
- return fDocument;
- }
-
- public String getDocumentPartitioning() {
- if (fPartitioning == null)
- return IDocumentExtension3.DEFAULT_PARTITIONING;
- return fPartitioning;
- }
-
- protected String[] getPartitions(int drOffset, int drLength) {
-
- ITypedRegion[] regions = new ITypedRegion[0];
- int docLength = getDocument().getLength();
-
- if (drOffset > docLength) {
- drOffset = docLength;
- drLength = 0;
- }
- else if (drOffset + drLength > docLength) {
- drLength = docLength - drOffset;
- }
-
- try {
- regions = TextUtilities.computePartitioning(getDocument(), getDocumentPartitioning(), drOffset, drLength, true);
- }
- catch (BadLocationException e) {
- Logger.logException(e);
- regions = new ITypedRegion[0];
- }
- String[] partitions = new String[regions.length];
- for (int i = 0; i < regions.length; i++)
- partitions[i] = regions[i].getType();
- return partitions;
- }
-
- ITypedRegion[] getPartitionRegions(int drOffset, int drLength) {
-
- ITypedRegion[] regions = new ITypedRegion[0];
- int docLength = getDocument().getLength();
-
- if (drOffset > docLength) {
- drOffset = docLength;
- drLength = 0;
- }
- else if (drOffset + drLength > docLength) {
- drLength = docLength - drOffset;
- }
-
- try {
- regions = TextUtilities.computePartitioning(getDocument(), getDocumentPartitioning(), drOffset, drLength, true);
- }
- catch (BadLocationException e) {
- Logger.logException(e);
- regions = new ITypedRegion[0];
- }
- return regions;
- }
-
- /**
- * Returns the reconciling strategy registered with the reconciler for the
- * specified partition type.
- *
- * @param partitionType
- * the partition type for which to determine the reconciling
- * strategy
- *
- * @return the reconciling strategy registered for the given partition
- * type, or <code>null</code> if there is no such strategy
- *
- * @see org.eclipse.jface.text.reconciler.IReconciler#getReconcilingStrategy(java.lang.String)
- */
- public IReconcilingStrategy getReconcilingStrategy(String partitionType) {
- if (partitionType == null)
- return null;
- return (IReconcilingStrategy) fReconcilingStrategies.get(partitionType);
- }
-
- /**
- * This method also synchronized because it accesses the fRequests queue
- *
- * @return an array of the currently requested Nodes to refresh
- */
- private synchronized DirtyRegion[] getRequests() {
- DirtyRegion[] toRefresh = (DirtyRegion[]) fDirtyRegionQueue.toArray(new DirtyRegion[fDirtyRegionQueue.size()]);
- flushDirtyRegionQueue();
- return toRefresh;
- }
-
- /**
- * Returns the text viewer this reconciler is installed on.
- *
- * @return the text viewer this reconciler is installed on
- */
- protected ITextViewer getTextViewer() {
- return fViewer;
- }
-
- /**
- *
- * @param oldInput
- * @param newInput
- */
- void handleInputDocumentChanged(IDocument oldInput, IDocument newInput) {
- // don't bother if reconciler not installed
- if (isInstalled()) {
-
- reconcilerDocumentChanged(newInput);
- setDocument(newInput);
- setEntireDocumentDirty(newInput);
- }
- }
-
- /**
- * @see org.eclipse.jface.text.reconciler.IReconciler#install(ITextViewer)
- */
- public void install(ITextViewer textViewer) {
- // we might be called multiple times with the same viewe.r,
- // maybe after being uninstalled as well, so track separately
- if (!isInstalled()) {
- fViewer = textViewer;
- fTextInputListener = new TextInputListener();
- textViewer.addTextInputListener(fTextInputListener);
- setInstalled(true);
- }
- }
-
- /**
- * The viewer has been set on this Reconciler.
- *
- * @return true if the viewer has been set on this Reconciler, false
- * otherwise.
- */
- public boolean isInstalled() {
- return fIsInstalled;
- }
-
- boolean isInRewriteSession() {
- return fInRewriteSession;
- }
-
- /**
- * Subclasses should implement for specific handling of dirty regions. The
- * method is invoked for each dirty region in the Job's queue.
- *
- * @param dirtyRegion
- */
- protected void process(DirtyRegion dirtyRegion) {
- if (isInRewriteSession()) {
- return;
- }
- /*
- * Break the dirty region into a sequence of partitions and find the
- * corresponding strategy to reconcile those partitions. If a strategy
- * implements INonIncrementalReconcilingStrategy, only call it once
- * regardless of the number and types of partitions.
- */
- ITypedRegion[] partitions = computePartitioning(dirtyRegion);
- for (int i = 0; i < partitions.length; i++) {
- IReconcilingStrategy strategy = getReconcilingStrategy(partitions[i].getType());
- if (strategy != null) {
- strategy.reconcile(partitions[i]);
- }
- }
- }
-
- /**
- * Invoke dirty region processing.
- *
- * @param node
- */
- public final void processDirtyRegion(DirtyRegion dr) {
- if (dr == null)
- return;
-
- cancel();
- addRequest(dr);
- schedule(getDelay());
-
- if (DEBUG) {
- System.out.println("added request for: [" + dr.getText() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("queue size is now: " + getDirtyRegionQueue().size()); //$NON-NLS-1$
- }
- }
-
- /**
- * Reinitializes listeners and sets new document onall strategies.
- *
- * @see org.eclipse.jface.text.reconciler.AbstractReconciler#reconcilerDocumentChanged(IDocument)
- */
- void reconcilerDocumentChanged(IDocument newDocument) {
- IDocument currentDoc = getDocument();
-
- // unhook old document listener
- if (currentDoc != null)
- currentDoc.removeDocumentListener(fDocumentListener);
- // hook up new document listener
- if (newDocument != null)
- newDocument.addDocumentListener(fDocumentListener);
-
- // sets document on all strategies
- setDocument(newDocument);
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- try {
- DirtyRegion[] toRefresh = getRequests();
-
- beginProcessing();
-
- for (int i = 0; i < toRefresh.length; i++) {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- process(toRefresh[i]);
- }
- }
- catch (Exception e) {
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=103676
- // stop errors from popping up a dialog
- // from the job manager
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=106052
- // don't log OperationCanceledException
- if (!(e instanceof OperationCanceledException))
- Logger.logException("problem with reconciling", e); //$NON-NLS-1$
- }
- finally {
- endProcessing();
-
- monitor.done();
- }
- return status;
- }
-
- public void setDelay(long delay) {
- fDelay = delay;
- }
-
- public void setDocument(IDocument doc) {
- if (fDocument != null && fDocument instanceof IDocumentExtension4) {
- ((IDocumentExtension4) fDocument).removeDocumentRewriteSessionListener(fDocumentRewriteSessionListener);
- }
-
- fDocument = doc;
-
- if (fDocument != null && fDocument instanceof IDocumentExtension4) {
- ((IDocumentExtension4) fDocument).addDocumentRewriteSessionListener(fDocumentRewriteSessionListener);
- }
- }
-
- /**
- * Sets the document partitioning for this reconciler.
- *
- * @param partitioning
- * the document partitioning for this reconciler
- */
- public void setDocumentPartitioning(String partitioning) {
- fPartitioning = partitioning;
- }
-
- /**
- * Basically means process the entire document.
- *
- * @param document
- */
- protected void setEntireDocumentDirty(IDocument document) {
-
- // make the entire document dirty
- // this also happens on a "save as"
- if (document != null && isInstalled()) {
-
- // since we're marking the entire doc dirty
- flushDirtyRegionQueue();
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=199053
- *
- * Process the strategies for the last known-good partitions to
- * ensure all problem annotations are cleared if needed.
- */
- if (fLastPartitions != null && document.getLength() == 0) {
- for (int i = 0; i < fLastPartitions.length; i++) {
- IReconcilingStrategy strategy = getReconcilingStrategy(fLastPartitions[i].getType());
- if (strategy != null) {
- strategy.reconcile(fLastPartitions[i]);
- }
- }
- }
- else {
- DirtyRegion entireDocument = createDirtyRegion(0, document.getLength(), DirtyRegion.INSERT);
- processDirtyRegion(entireDocument);
- }
- }
- }
-
- /**
- * @param isInstalled
- * The isInstalled to set.
- */
- void setInstalled(boolean isInstalled) {
- fIsInstalled = isInstalled;
- }
-
- public void setReconcilingStrategy(String partitionType, IReconcilingStrategy strategy) {
- if (partitionType == null) {
- throw new IllegalArgumentException();
- }
-
- if (strategy == null) {
- fReconcilingStrategies.remove(partitionType);
- }
- else {
- fReconcilingStrategies.put(partitionType, strategy);
- }
- }
-
- /**
- * @see org.eclipse.jface.text.reconciler.IReconciler#uninstall()
- */
- public void uninstall() {
- if (isInstalled()) {
- // removes widget listener
- getTextViewer().removeTextInputListener(fTextInputListener);
- setInstalled(false);
- // removes document listeners
- reconcilerDocumentChanged(null);
- }
- setDocument(null);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentAdapter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentAdapter.java
deleted file mode 100644
index 4a09d274a6..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentAdapter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.reconciler.IReconcilableModel;
-
-/**
- * Adapts an <code>IDocument</code> to a <code>IReconcilableModel</code>.
- *
- */
-public class DocumentAdapter implements IReconcilableModel {
-
- private IDocument fDocument;
-
- /**
- * Creates a text model adapter for the given document.
- *
- * @param document
- */
- public DocumentAdapter(IDocument document) {
- fDocument = document;
- }
-
- /**
- * Returns this model's document.
- *
- * @return the model's input document
- */
- public IDocument getDocument() {
- return fDocument;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentRegionProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentRegionProcessor.java
deleted file mode 100644
index 876b1cbc2b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/DocumentRegionProcessor.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.wst.sse.ui.internal.IReleasable;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorBuilder;
-import org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorMetaData;
-import org.eclipse.wst.sse.ui.internal.reconcile.validator.ValidatorStrategy;
-import org.eclipse.wst.sse.ui.internal.spelling.SpellcheckStrategy;
-
-/**
- * Adds to DirtyRegionProcessor Job: - IDocumentListener - ValidatorStrategy -
- * Text viewer(dispose, input changed) listeners. - default, spelling, and
- * validator strategies - DirtyRegion processing logic.
- */
-public class DocumentRegionProcessor extends DirtyRegionProcessor {
-
- private static final boolean DEBUG_VALIDATORS = Boolean.TRUE.toString().equalsIgnoreCase(Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerValidators"));
- // //$NON-NLS-1$
-
- /**
- * A strategy to use the defined default Spelling service.
- */
- private SpellcheckStrategy fSpellcheckStrategy;
-
- /**
- * The strategy that runs validators contributed via
- * <code>org.eclipse.wst.sse.ui.extensions.sourcevalidation</code>
- * extension point
- */
- private ValidatorStrategy fValidatorStrategy;
-
- private final String SSE_UI_ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
-
-
- protected void beginProcessing() {
- super.beginProcessing();
- ValidatorStrategy validatorStrategy = getValidatorStrategy();
- if (validatorStrategy != null) {
- validatorStrategy.beginProcessing();
- }
- }
-
- protected void endProcessing() {
- super.endProcessing();
- ValidatorStrategy validatorStrategy = getValidatorStrategy();
- if (validatorStrategy != null) {
- validatorStrategy.endProcessing();
- }
- }
-
- protected String getContentType(IDocument doc) {
- if (doc == null)
- return null;
-
- String contentTypeId = null;
-
- // pa_TODO it would be nice to be able to get filename from
- // IDocument...
- // because it seems that getting content type from input stream
- // isn't all that accurate (eg. w/ a javascript file)
-
- // IContentType ct =
- // Platform.getContentTypeManager().findContentTypeFor("test.js");
- IContentType ct = null;
- try {
- IContentDescription desc = Platform.getContentTypeManager().getDescriptionFor(new ByteArrayInputStream(doc.get().getBytes()), null, IContentDescription.ALL);
- if (desc != null) {
- ct = desc.getContentType();
- if (ct != null)
- contentTypeId = ct.getId();
- }
- }
- catch (IOException e) {
- // just bail
- }
- return contentTypeId;
- }
-
- protected final StructuredTextReconcilingStrategy getSpellcheckStrategy() {
- if (fSpellcheckStrategy == null) {
- String contentTypeId = getContentType(getDocument());
- if (contentTypeId != null) {
- if (getTextViewer() instanceof ISourceViewer) {
- ISourceViewer viewer = (ISourceViewer) getTextViewer();
- fSpellcheckStrategy = new SpellcheckStrategy(viewer, contentTypeId);
- fSpellcheckStrategy.setDocument(getDocument());
- fSpellcheckStrategy.setDocumentPartitioning(getDocumentPartitioning());
- }
- }
- }
- return fSpellcheckStrategy;
- }
-
- /**
- * @return Returns the ValidatorStrategy.
- */
- protected ValidatorStrategy getValidatorStrategy() {
- if (fValidatorStrategy == null) {
- ValidatorStrategy validatorStrategy = null;
-
- if (getTextViewer() instanceof ISourceViewer) {
- ISourceViewer viewer = (ISourceViewer) getTextViewer();
- String contentTypeId = null;
-
- IDocument doc = viewer.getDocument();
- contentTypeId = getContentType(doc);
-
- if (contentTypeId != null) {
- validatorStrategy = new ValidatorStrategy(viewer, contentTypeId);
- ValidatorBuilder vBuilder = new ValidatorBuilder();
- ValidatorMetaData[] vmds = vBuilder.getValidatorMetaData(SSE_UI_ID);
- List enabledValidators = new ArrayList(1);
- /* if any "must" handle this content type, just add them */
- boolean foundSpecificContentTypeValidators = false;
- for (int i = 0; i < vmds.length; i++) {
- if (vmds[i].mustHandleContentType(contentTypeId)) {
- if (DEBUG_VALIDATORS)
- Logger.log(Logger.INFO, contentTypeId + " using specific validator " + vmds[i].getValidatorId()); //$NON-NLS-1$
- foundSpecificContentTypeValidators = true;
- enabledValidators.add(vmds[i]);
- }
- }
- if (!foundSpecificContentTypeValidators) {
- for (int i = 0; i < vmds.length; i++) {
- if (vmds[i].canHandleContentType(contentTypeId)) {
- if (DEBUG_VALIDATORS)
- Logger.log(Logger.INFO, contentTypeId + " using inherited(?) validator " + vmds[i].getValidatorId()); //$NON-NLS-1$
- enabledValidators.add(vmds[i]);
- }
- }
- }
- for (int i = 0; i < enabledValidators.size(); i++) {
- validatorStrategy.addValidatorMetaData((ValidatorMetaData) enabledValidators.get(i));
- }
- }
- }
- fValidatorStrategy = validatorStrategy;
- }
- return fValidatorStrategy;
- }
-
- /**
- * @param dirtyRegion
- */
- protected void process(DirtyRegion dirtyRegion) {
- if (!isInstalled() || isInRewriteSession())
- return;
-
- super.process(dirtyRegion);
-
- // Also call the validation and spell-check strategies
- ITypedRegion[] partitions = computePartitioning(dirtyRegion);
-
- DirtyRegion dirty = null;
- for (int i = 0; i < partitions.length; i++) {
- // [source]validator (extension) for this partition
- if (getValidatorStrategy() != null) {
- dirty = createDirtyRegion(partitions[i], DirtyRegion.INSERT);
- getValidatorStrategy().reconcile(partitions[i], dirty);
- }
- }
-
- // single spell-check for everything
- if (getSpellcheckStrategy() != null) {
- getSpellcheckStrategy().reconcile(dirtyRegion, dirtyRegion);
- }
- }
-
- public void setDocument(IDocument doc) {
- super.setDocument(doc);
- IReconcilingStrategy validatorStrategy = getValidatorStrategy();
- if (validatorStrategy != null) {
- validatorStrategy.setDocument(doc);
- }
- if (fSpellcheckStrategy != null) {
- fSpellcheckStrategy.setDocument(doc);
- }
- }
-
- protected void setEntireDocumentDirty(IDocument document) {
- super.setEntireDocumentDirty(document);
-
- // make the entire document dirty
- // this also happens on a "save as"
- if (document != null && isInstalled() && fLastPartitions != null && document.getLength() == 0) {
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=199053
- *
- * Process the strategies for the last known-good partitions.
- */
- for (int i = 0; i < fLastPartitions.length; i++) {
- getValidatorStrategy().reconcile(fLastPartitions[i], createDirtyRegion(fLastPartitions[i], DirtyRegion.REMOVE));
- }
- if (fSpellcheckStrategy != null) {
- fSpellcheckStrategy.reconcile(new Region(0, document.getLength()));
- }
- }
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor#uninstall()
- */
- public void uninstall() {
- if (isInstalled()) {
-
- cancel();
-
- IReconcilingStrategy validatorStrategy = getValidatorStrategy();
-
- if (validatorStrategy != null) {
- if (validatorStrategy instanceof IReleasable)
- ((IReleasable) validatorStrategy).release();
- }
- if (fSpellcheckStrategy != null) {
- fSpellcheckStrategy.setDocument(null);
- }
- }
- super.uninstall();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IConfigurableReconciler.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IConfigurableReconciler.java
deleted file mode 100644
index 6f8b28f06d..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IConfigurableReconciler.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-
-/**
- * A reconciler that allows IReconcilingStrategies to be assigned to partition
- * types. The reconciler will call the registered IReconcilingStrategy when
- * dirty regions which contain partitions of a specific type need to be
- * reconciled.
- *
- * @since 1.1
- */
-public interface IConfigurableReconciler {
- /**
- * Sets the reconciling strategy for the reconciler to use for the
- * specified content type.
- *
- * @param partitionType
- * the partition type
- * @param strategy
- * the reconciling strategy
- */
- void setReconcilingStrategy(String partitionType, IReconcilingStrategy strategy);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IReconcileAnnotationKey.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IReconcileAnnotationKey.java
deleted file mode 100644
index 052df0a46b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IReconcileAnnotationKey.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import org.eclipse.jface.text.reconciler.IReconcileStep;
-
-/**
- * Defines an annotation key that the
- * <code>AbstractStructuredTextReconcilingStrategy</code> knows how to
- * remove appropriately.
- *
- * @deprecated not API, this will probably just become an abstract class
- *
- * @author pavery
- */
-public interface IReconcileAnnotationKey {
- static final int PARTIAL = 1;
- static final int TOTAL = 0;
-
- String getPartitionType();
-
- //int getScope();
-
- IReconcileStep getStep();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IStructuredReconcileStep.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IStructuredReconcileStep.java
deleted file mode 100644
index 3abb5f99e0..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IStructuredReconcileStep.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcileResult;
-import org.eclipse.jface.text.reconciler.IReconcileStep;
-
-/**
- * @author pavery
- * @deprecated still working out API (or if anything here should be API)
- *
- * Interface for a step in StructuredRegionProcessor framework.
- */
-public interface IStructuredReconcileStep extends IReconcileStep {
- /**
- * Partitions for which this step can add/remove annotions
- *
- * @return an array of the partitions for which this step can add/remove
- * annotions
- */
- String[] getPartitionTypes();
-
- /**
- * Returns the scope for which this step adds annotations.
- *
- * @return the scope for which this step adds annotations
- */
- //int getScope();
-
- /**
- * Tells you if the step is equal to this step or any of the sibling
- * steps.
- *
- * @return
- */
- boolean isSiblingStep(IReconcileStep step);
-
- /**
- * Adds awareness that the Reconciler is reconciling the entire document
- * this call.
- *
- * @param dirtyRegion
- * @param subRegion
- * @param refreshAll
- * @return
- */
- IReconcileResult[] reconcile(DirtyRegion dirtyRegion, IRegion subRegion, boolean refreshAll);
-
- /**
- * Used to reset the state of the Strategy. For example: any flags that
- * need to be reset after a long running operation like processAll().
- */
- void reset();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IStructuredReconcilingStrategy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IStructuredReconcilingStrategy.java
deleted file mode 100644
index 8b441519e8..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/IStructuredReconcilingStrategy.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
-
-
-/**
- * Interface for structured reconciling strategies.
- *
- * @deprecated doesn't need to be API and might go away
- *
- * @author pavery
- */
-public interface IStructuredReconcilingStrategy extends IReconcilingStrategy {
- /**
- * Adds awareness that the reconciler is processing the entire document
- * via refreshAll flag.
- *
- * @param dirtyRegion
- * @param subRegion
- * @param refreshAll
- */
- public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion, boolean refreshAll);
-
- /**
- * Used to reset the state of the Strategy. For example: any flags that
- * need to be reset after a long running operation like processAll().
- */
- public void reset();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/ReconcileAnnotationKey.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/ReconcileAnnotationKey.java
deleted file mode 100644
index fa89e2d4ba..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/ReconcileAnnotationKey.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import org.eclipse.jface.text.reconciler.IReconcileStep;
-
-
-/**
- * Implementation of <code>IReconcileAnnotationKey</code> note: clients
- * should use the method StructuredReconcileStep#createKey(String
- * partitionType, int scope)
- *
- * @author pavery
- */
-public class ReconcileAnnotationKey {
-
- public static final int PARTIAL = 1;
- public static final int TOTAL = 0;
-
- private String fPartitionType = null;
-
- private IReconcileStep fReconcileStep = null;
- private int fScope;
-
- public ReconcileAnnotationKey(IReconcileStep step, String partitionType, int scope) {
- fReconcileStep = step;
- fPartitionType = partitionType;
- fScope = scope;
- }
-
- public String getPartitionType() {
- return fPartitionType;
- }
-
- public int getScope() {
- return fScope;
- }
-
- public IReconcileStep getStep() {
- return fReconcileStep;
- }
-
- public String toString() {
- return this.getClass() + "\r\nid: " + fPartitionType; //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredReconcileStep.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredReconcileStep.java
deleted file mode 100644
index e6a88754b0..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredReconcileStep.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.reconciler.AbstractReconcileStep;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcilableModel;
-import org.eclipse.jface.text.reconciler.IReconcileResult;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitioning;
-import org.eclipse.wst.sse.core.text.IStructuredPartitions;
-import org.eclipse.wst.sse.ui.internal.IReleasable;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-
-/**
- * ReconcileStep that knows about the annotation that it adds to the
- * AnnotationModel. It knows how to create an annotation key (for smart
- * removal later) It knows the partition types on which it can operate. It
- * knows the scope on which it operates (for short circuiting) It knows if the
- * Reconciler is reconciling the entire document.
- *
- * Clients must subclass this class.
- *
- * @author pavery
- */
-public abstract class StructuredReconcileStep extends AbstractReconcileStep implements IReleasable {
-
- /** debug flag */
- protected static final boolean DEBUG;
- static {
- String value = Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerjob"); //$NON-NLS-1$
- DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
- protected final IReconcileResult[] EMPTY_RECONCILE_RESULT_SET = new IReconcileResult[0];
-
- /**
- * It's possible for a partial step to get called on the same area twice
- * (as w/ a full document reconcile) this list keeps track of area already
- * covered. Should be reset() after the "batch" of reconciling is
- * finished.
- */
- private HashSet fPartitionTypes = null;
-
- public StructuredReconcileStep() {
- super();
- fPartitionTypes = new HashSet();
- }
-
- public ReconcileAnnotationKey createKey(IStructuredDocumentRegion sdRegion, int scope) {
-
- ITypedRegion tr = getPartition(sdRegion);
- String partitionType = (tr != null) ? tr.getType() : IStructuredPartitions.UNKNOWN_PARTITION;
- return createKey(partitionType, scope);
- }
-
- /**
- * @param sdRegion
- * @return
- */
- protected ITypedRegion getPartition(IStructuredDocumentRegion sdRegion) {
- ITypedRegion tr = null;
- if (!sdRegion.isDeleted())
- tr = getPartition(sdRegion.getParentDocument(), sdRegion.getStartOffset());
- return tr;
- }
-
- private ITypedRegion getPartition(IDocument doc, int offset) {
- ITypedRegion tr = null;
- // not sure why document would ever be null, but put in this
- // guard for
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86069
- if (doc != null) {
- try {
- tr = TextUtilities.getPartition(doc, IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING, offset, false);
- } catch (BadLocationException e) {
- if (DEBUG)
- Logger.logException("problem getting partition at: " + offset, e); //$NON-NLS-1$
- }
- }
- return tr;
- }
-
- /**
- * Clients should use this method to create annotation keys as it
- * registers the key for removal later.
- *
- * @param partitionType
- * @param scope
- * @return
- */
- public ReconcileAnnotationKey createKey(String partitionType, int scope) {
- fPartitionTypes.add(partitionType);
- return new ReconcileAnnotationKey(this, partitionType, scope);
- }
-
- protected IDocument getDocument() {
- IDocument doc = null;
- IReconcilableModel rModel = getModel();
- if (rModel instanceof DocumentAdapter) {
- doc = ((DocumentAdapter) rModel).getDocument();
- }
- return doc;
- }
-
- public IReconcilableModel getModel() {
- return getInputModel();
- }
-
- public String getPartitionType(IDocument doc, int offset) {
- ITypedRegion tr = getPartition(doc, offset);
- return (tr != null) ? tr.getType() : IStructuredPartitions.UNKNOWN_PARTITION;
- }
-
- public String[] getPartitionTypes() {
- // using hash set to automatically get rid of dupes
- HashSet tempResults = new HashSet();
- // add these partition types
- tempResults.addAll(fPartitionTypes);
- return (String[]) tempResults.toArray(new String[tempResults.size()]);
- }
-
- protected IStructuredDocument getStructuredDocument() {
- IStructuredDocument sDoc = null;
- IDocument doc = getDocument();
- if (doc instanceof IStructuredDocument)
- sDoc = (IStructuredDocument) getDocument();
- return sDoc;
- }
-
- /**
- * Removes duplicates.
- *
- * @param results1
- * @param results2
- * @return
- */
- protected IReconcileResult[] merge(IReconcileResult[] results1, IReconcileResult[] results2) {
- if (results1 == null)
- return results2;
- if (results2 == null)
- return results1;
-
- List results = new ArrayList();
- results.addAll(Arrays.asList(results1));
- for (int i = 0; i < results2.length; i++) {
- results.add(results2[i]);
- }
- return (IReconcileResult[]) results.toArray(new IReconcileResult[results.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.reconciler.AbstractReconcileStep#reconcileModel(org.eclipse.jface.text.reconciler.DirtyRegion,
- * org.eclipse.jface.text.IRegion)
- */
- protected IReconcileResult[] reconcileModel(DirtyRegion dirtyRegion, IRegion subRegion) {
- return EMPTY_RECONCILE_RESULT_SET;
- }
-
- /**
- * Release resources used by the step here as needed. Be sure to call
- * super.release() when you override this method as to propagate the
- * release through all steps.
- */
- public void release() {
- //
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredRegionProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredRegionProcessor.java
deleted file mode 100644
index b75dc63e54..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredRegionProcessor.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.model.ModelLifecycleEvent;
-import org.eclipse.wst.sse.core.internal.provisional.IModelLifecycleListener;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-
-/**
- * An IStructuredModel aware Region Processor. Adds ModelLifecycle listener.
- * ModelLifecycle listener notifies us that some reinitialization needs to
- * take place.
- *
- * Model aware "process()" Implements a IndexedRegion-based "contains()"
- * method using IStructuredModel.
- *
- */
-public class StructuredRegionProcessor extends DocumentRegionProcessor {
-
- class ModelLifecycleListener implements IModelLifecycleListener {
- /**
- * @see org.eclipse.wst.sse.core.internal.provisional.IModelLifecycleListener#processPostModelEvent(org.eclipse.wst.sse.core.internal.model.ModelLifecycleEvent)
- */
- public void processPostModelEvent(ModelLifecycleEvent event) {
-
- // if underlying StructuredDocument changed, need to reconnect it
- // here...
- // ex. file is modified outside the workbench
- if (event.getType() == ModelLifecycleEvent.MODEL_DOCUMENT_CHANGED) {
-
- // check that it's this model that changed
- IStructuredModel thisModel = getStructuredModelForRead(getDocument());
- try {
- if (thisModel != null && event.getModel().equals(thisModel)) {
-
- IStructuredDocument sDoc = event.getModel().getStructuredDocument();
-
- if (DEBUG) {
- System.out.println("======================================================"); //$NON-NLS-1$
- System.out.println("StructuredRegionProcessor: DOCUMENT MODEL CHANGED TO: "); //$NON-NLS-1$
- System.out.println(sDoc.get());
- System.out.println("======================================================"); //$NON-NLS-1$
- }
- setDocument(sDoc);
- // propagate document change
- // setDocumentOnAllStrategies(sDoc);
- // ensure that the document is re-reconciled
- setEntireDocumentDirty(sDoc);
- }
- }
- finally {
- if (thisModel != null)
- thisModel.releaseFromRead();
- }
- }
- }
-
- /**
- * @see org.eclipse.wst.sse.core.internal.provisional.IModelLifecycleListener#processPreModelEvent(org.eclipse.wst.sse.core.internal.model.ModelLifecycleEvent)
- */
- public void processPreModelEvent(ModelLifecycleEvent event) {
-
- if (event.getType() == ModelLifecycleEvent.MODEL_DOCUMENT_CHANGED) {
-
- flushDirtyRegionQueue();
- // note: old annotations are removed via the strategies on
- // AbstractStructuredTextReconcilingStrategy#setDocument(...)
- }
- }
- }
-
- private IModelLifecycleListener fLifeCycleListener = new ModelLifecycleListener();
-
- /**
- * @deprecated use getOuterRegion() instead
- */
- protected boolean contains(DirtyRegion root, DirtyRegion possible) {
- // remove method post wtp 1.5.1
- // this method is a performance hit
- // look for alternatives
-
- // call super to just check if possible is already contained within
- // root based on offsets
- boolean contains = super.contains(root, possible);
- if (!contains) {
- IStructuredModel sModel = getStructuredModelForRead(getDocument());
- try {
- if (sModel != null) {
- // first just check if possregion appears after rootregion
- IndexedRegion rootRegion = sModel.getIndexedRegion(root.getOffset());
- IndexedRegion possRegion = sModel.getIndexedRegion(possible.getOffset());
- if (rootRegion != null && possRegion != null) {
- int rootStart = rootRegion.getStartOffset();
- int possStart = possRegion.getStartOffset();
- if (rootStart <= possStart) {
- // then check if rootregion's end appears after
- // possregion's end
- IndexedRegion rootRegion2 = sModel.getIndexedRegion(root.getOffset() + root.getLength());
- int rootEnd = rootRegion2 != null ? rootRegion2.getEndOffset() : getDocument().getLength();
- IndexedRegion possRegion2 = sModel.getIndexedRegion(possible.getOffset() + possible.getLength());
- int possEnd = possRegion2 != null ? possRegion2.getEndOffset() : getDocument().getLength();
-
- if (rootEnd >= possEnd) {
- contains = true;
- }
- if (DEBUG)
- System.out.println("checking if [" + rootStart + ":" + rootEnd + "] contains [" + possStart + ":" + possEnd + "] ... " + contains); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
- }
- }
- }
- finally {
- if (sModel != null)
- sModel.releaseFromRead();
- }
- }
- return contains;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor#getOuterRegion(org.eclipse.jface.text.reconciler.DirtyRegion,
- * org.eclipse.jface.text.reconciler.DirtyRegion)
- */
- protected DirtyRegion getOuterRegion(DirtyRegion root, DirtyRegion possible) {
- // first try simple region check if one region contains the other
- DirtyRegion outer = super.getOuterRegion(root, possible);
- if (outer == null) {
- // now compare nodes
- IStructuredModel sModel = getStructuredModelForRead(getDocument());
- try {
- if (sModel != null) {
- IndexedRegion rootRegion = sModel.getIndexedRegion(root.getOffset());
- IndexedRegion possRegion = sModel.getIndexedRegion(possible.getOffset());
- if (rootRegion != null && possRegion != null) {
- int rootStart = rootRegion.getStartOffset();
- int possStart = possRegion.getStartOffset();
- // first just check if rootregion starts before
- // possregion
- if (rootStart <= possStart) {
- // check if possregion is inside rootregion
- outer = _getOuterRegion(root, possible, sModel, rootStart, possStart);
- }
- else {
- // otherwise if rootregion is inside possregion
- outer = _getOuterRegion(possible, root, sModel, possStart, rootStart);
- }
- }
- }
- }
- finally {
- if (sModel != null)
- sModel.releaseFromRead();
- }
- }
- return outer;
- }
-
- /**
- * Assumes that when this method is called, region1's node start offset >=
- * region2's node start offset. Determines if region1 contains region2 or
- * vice versa. Returns region1 if:
- * <ul>
- * <li>region1's node region == region2's node region</li>
- * <li>region1's node region contains region2's node region</li>
- * </ul>
- * Returns region2 if:
- * <ul>
- * <li>region1's node region and region2's node region starts at same
- * offset but region2's node region is longer</li>
- * </ul>
- * Returns null otherwise.
- *
- * @param region1
- * @param region2
- * @param sModel
- * @param region1NodeStart
- * @param region2NodeStart
- * @return outer dirty region or null if none exists.
- */
- private DirtyRegion _getOuterRegion(DirtyRegion region1, DirtyRegion region2, IStructuredModel sModel, int region1NodeStart, int region2NodeStart) {
- DirtyRegion outer = null;
- int region1NodeEnd = -1;
- int region2NodeEnd = -1;
- // then check if region1's end appears after
- // region2's end
- IndexedRegion region1EndNode = sModel.getIndexedRegion(region1.getOffset() + region1.getLength());
- if (region1EndNode == null) {
- // if no end, just assume region spans all the
- // way to the end so it includes other region
- outer = region1;
- }
- else {
- region1NodeEnd = region1EndNode.getEndOffset();
- IndexedRegion region2EndNode = sModel.getIndexedRegion(region2.getOffset() + region2.getLength());
- region2NodeEnd = region2EndNode != null ? region2EndNode.getEndOffset() : getDocument().getLength();
- if (region1NodeEnd >= region2NodeEnd) {
- // root contains or is equal to possible
- outer = region1;
- }
- else if (region1NodeStart == region2NodeStart && region2NodeEnd >= region1NodeEnd) {
- // possible contains root because they
- // both start at same place but possible
- // is longer
- outer = region2;
- }
- }
- if (DEBUG) {
- if (outer != null)
- System.out.println("checking if [" + region1NodeStart + ":" + region1NodeEnd + "] contains [" + region2NodeStart + ":" + region2NodeEnd + "] ... " + outer.toString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- else
- System.out.println("checking if [" + region1NodeStart + ":" + region1NodeEnd + "] contains [" + region2NodeStart + ":" + region2NodeEnd + "] ... NO CONTAIN"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
- return outer;
- }
-
- /**
- * We already know content type from when we created the model, so just
- * use that.
- */
- protected String getContentType(IDocument doc) {
-
- String contentTypeId = null;
- IStructuredModel sModel = null;
- try {
- sModel = StructuredModelManager.getModelManager().getExistingModelForRead(doc);
- if (sModel != null) {
- contentTypeId = sModel.getContentTypeIdentifier();
- }
- }
- finally {
- if (sModel != null)
- sModel.releaseFromRead();
- }
- return contentTypeId;
- }
-
-
- /**
- * Remember to release model after use!!
- *
- * @return
- */
- private IStructuredModel getStructuredModelForRead(IDocument doc) {
- IStructuredModel sModel = null;
- if (doc != null)
- sModel = StructuredModelManager.getModelManager().getExistingModelForRead(doc);
- return sModel;
- }
-
- /**
- * @param document
- */
- private void hookUpModelLifecycleListener(IDocument document) {
- IStructuredModel sModel = getStructuredModelForRead(document);
- try {
- if (sModel != null) {
- sModel.addModelLifecycleListener(fLifeCycleListener);
- }
- }
- finally {
- if (sModel != null)
- sModel.releaseFromRead();
- }
- }
-
- protected void process(DirtyRegion dirtyRegion) {
- if (getDocument() == null || isInRewriteSession())
- return;
-
- // use structured model to determine area to process
- IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
- try {
- if (sModel != null) {
- int start = dirtyRegion.getOffset();
- int end = start + dirtyRegion.getLength();
- IndexedRegion irStart = sModel.getIndexedRegion(start);
- IndexedRegion irEnd = sModel.getIndexedRegion(end);
-
- if (irStart != null) {
- start = Math.min(start, irStart.getStartOffset());
- }
- if (irEnd != null) {
- end = Math.max(end, irEnd.getEndOffset());
- }
- super.process(createDirtyRegion(start, end - start, DirtyRegion.INSERT));
- }
- }
- finally {
- if (sModel != null)
- sModel.releaseFromRead();
- }
- }
-
- /**
- * Reinitializes listeners and sets new document onall strategies.
- *
- * @see org.eclipse.jface.text.reconciler.AbstractReconciler#reconcilerDocumentChanged(IDocument)
- */
- protected void reconcilerDocumentChanged(IDocument newDocument) {
-
- IDocument currentDoc = getDocument();
-
- // unhook old lifecycle listner
- unhookModelLifecycleListener(currentDoc);
- // add new lifecycle listener
- if (newDocument != null)
- hookUpModelLifecycleListener(newDocument);
-
- super.reconcilerDocumentChanged(newDocument);
- }
-
- /**
- * @param document
- */
- private void unhookModelLifecycleListener(IDocument document) {
- IStructuredModel sModel = getStructuredModelForRead(document);
- try {
- if (sModel != null)
- sModel.removeModelLifecycleListener(fLifeCycleListener);
-
- }
- finally {
- if (sModel != null)
- sModel.releaseFromRead();
- }
- }
-
- public void uninstall() {
-
- // removes model listeners
- unhookModelLifecycleListener(getDocument());
- super.uninstall();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredTextReconcilingStrategy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredTextReconcilingStrategy.java
deleted file mode 100644
index bceefd4652..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/StructuredTextReconcilingStrategy.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-
-/**
- * Uses IStructuredModel nodes to check "overlaps()" when getting annotations to remove.
- */
-public abstract class StructuredTextReconcilingStrategy extends AbstractStructuredTextReconcilingStrategy {
-
-
- public StructuredTextReconcilingStrategy(ISourceViewer sourceViewer) {
- super(sourceViewer);
- }
-
- /**
- * Checks if this position overlaps any of the StructuredDocument regions'
- * correstponding IndexedRegion.
- *
- * @param pos
- * @param dr
- * @return true if the position overlaps any of the regions, otherwise
- * false.
- */
- protected boolean overlaps(Position pos, IStructuredDocumentRegion[] sdRegions) {
- int start = -1;
- int end = -1;
- for (int i = 0; i < sdRegions.length; i++) {
- if(!sdRegions[i].isDeleted()) {
- IndexedRegion corresponding = getCorrespondingNode(sdRegions[i]);
- if(corresponding != null) {
- if (start == -1 || start > corresponding.getStartOffset())
- start = corresponding.getStartOffset();
- if (end == -1 || end < corresponding.getEndOffset())
- end = corresponding.getEndOffset();
- }
- }
- }
- return pos.overlapsWith(start, end - start);
- }
-
- /**
- * Returns the corresponding node for the StructuredDocumentRegion.
- *
- * @param sdRegion
- * @return the corresponding node for sdRegion
- */
- protected IndexedRegion getCorrespondingNode(IStructuredDocumentRegion sdRegion) {
- IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
- IndexedRegion indexedRegion = null;
- try {
- if (sModel != null)
- indexedRegion = sModel.getIndexedRegion(sdRegion.getStart());
- } finally {
- if (sModel != null)
- sModel.releaseFromRead();
- }
- return indexedRegion;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/TemporaryAnnotation.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/TemporaryAnnotation.java
deleted file mode 100644
index 21a05c8d65..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/TemporaryAnnotation.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile;
-
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.reconciler.IReconcileResult;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationAccessExtension;
-import org.eclipse.jface.text.source.IAnnotationPresentation;
-import org.eclipse.jface.text.source.ImageUtilities;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.texteditor.AnnotationPreference;
-import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
-import org.eclipse.wst.sse.ui.internal.ITemporaryAnnotation;
-
-
-/**
- * An implementation of ITemporaryAnnotation @
- * @author pavery
- */
-public class TemporaryAnnotation extends Annotation implements ITemporaryAnnotation, IReconcileResult, IAnnotationPresentation {
- // remember to change these if it changes in the extension point
- // may need a different home for them in the future, but they're here for
- // now
- public final static String ANNOT_ERROR = "org.eclipse.wst.sse.ui.temp.error"; //$NON-NLS-1$
- public final static String ANNOT_INFO = "org.eclipse.wst.sse.ui.temp.info"; //$NON-NLS-1$
-
- // pa_TODO what should the ID be for this?
- public final static String ANNOT_UNKNOWN = Annotation.TYPE_UNKNOWN;
- public final static String ANNOT_WARNING = "org.eclipse.wst.sse.ui.temp.warning"; //$NON-NLS-1$
-
- // copied from CompilationUnitDocumentProvider.ProblemAnnotation
- //XXX: To be fully correct these constants should be non-static
-
- private static final int INFO_LAYER;
-
- private static final int WARNING_LAYER;
-
- private static final int ERROR_LAYER;
-
- static {
- AnnotationPreferenceLookup lookup= EditorsUI.getAnnotationPreferenceLookup();
- INFO_LAYER= computeLayer("org.eclipse.wst.sse.ui.temp.info", lookup); //$NON-NLS-1$
- WARNING_LAYER= computeLayer("org.eclipse.wst.sse.ui.temp.warning", lookup); //$NON-NLS-1$
- ERROR_LAYER= computeLayer("org.eclipse.wst.sse.ui.temp.error", lookup); //$NON-NLS-1$
- }
-
- private static int computeLayer(String annotationType, AnnotationPreferenceLookup lookup) {
- Annotation annotation= new Annotation(annotationType, false, null);
- AnnotationPreference preference= lookup.getAnnotationPreference(annotation);
- if (preference != null)
- return preference.getPresentationLayer() + 1;
- else
- return IAnnotationAccessExtension.DEFAULT_LAYER + 1;
- }
-
-
- private Object fAdditionalFixInfo = null;
-
- private Object fKey = null;
- private Position fPosition = null;
-
- private int fProblemID;
-
- private int fLayer = DEFAULT_LAYER;
-
- private Image fImage = null;
-
- public TemporaryAnnotation(Position p, String type, String message, ReconcileAnnotationKey key) {
- super();
- fPosition = p;
- setType(type);
- fKey = key;
- setText(message);
- initLayer();
- initImage();
- }
-
- public TemporaryAnnotation(Position p, String type, String message, ReconcileAnnotationKey key, int problemId) {
- super();
- fPosition = p;
- fKey = key;
- setType(type);
- setText(message);
- fProblemID = problemId;
- initLayer();
- initImage();
- }
-
- private void initLayer() {
-
- String type = getType();
- if(type.equals(ANNOT_ERROR)) {
- fLayer = ERROR_LAYER;
- }
- else if(type.equals(ANNOT_WARNING)) {
- fLayer = WARNING_LAYER;
- }
- else if(type.equals(ANNOT_INFO)) {
- fLayer = INFO_LAYER;
- }
- }
-
- private void initImage() {
- // later we can add support for quick fix images.
- String type = getType();
- if(type.equals(ANNOT_ERROR)) {
- fImage = null;
- }
- else if(type.equals(ANNOT_WARNING)) {
- fImage = null;
- }
- else if(type.equals(ANNOT_INFO)) {
- fImage = null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- // this check doesn't take into consideration that annotation
- // positions that change from a text edit before it
- // we should be checking if the annotation is still on the same line,
- // and the distance from the start of the line is the same
- if (obj instanceof TemporaryAnnotation) {
-
- TemporaryAnnotation ta = (TemporaryAnnotation) obj;
-
- boolean samePosition = ta.getPosition().equals(this.getPosition());
- boolean sameText = false;
-
- if(ta.getText() != null && this.getText() != null && ta.getText().equals(this.getText()))
- sameText = true;
- else if(ta.getText( )== null && this.getText() == null)
- sameText = true;
-
- return sameText && samePosition;
- }
- return super.equals(obj);
- }
-
- /**
- * Additional info required to fix this problem.
- *
- * @return an Object that contains additional info on how to fix this
- * problem, or null if there is none
- */
- public Object getAdditionalFixInfo() {
- return fAdditionalFixInfo;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.ITemporaryAnnotation#getDescription()
- */
- public String getDescription() {
- return getText();
- }
-
- public Object getKey() {
- return fKey;
- }
-
- public Position getPosition() {
- return fPosition;
- }
-
- /**
- * @return Returns the problemID.
- */
- public int getProblemID() {
- return fProblemID;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.source.Annotation#isPersistent()
- */
- public boolean isPersistent() {
- return false;
- }
-
- /**
- * Sets additional information useful to fixing this problem.
- *
- * @param an
- * Object that contains additional info on how to fix this
- * problem
- */
- public void setAdditionalFixInfo(Object info) {
- fAdditionalFixInfo = info;
- }
-
- public int getLayer() {
- return fLayer;
- }
-
- /*
- * @see Annotation#paint
- */
- public void paint(GC gc, Canvas canvas, Rectangle r) {
- //initializeImages();
- if (fImage != null)
- ImageUtilities.drawImage(fImage, gc, canvas, r, SWT.CENTER, SWT.TOP);
- }
-
- public String toString() {
- return "" + fPosition.getOffset() + ':' + fPosition.getLength() + ": " + getText(); //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/AnnotationInfo.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/AnnotationInfo.java
deleted file mode 100644
index 609420e136..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/AnnotationInfo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.wst.sse.ui.internal.reconcile.validator;
-
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * Holds info to create a TemporaryAnnotation.
- *
- * @since 1.0
- */
-public class AnnotationInfo {
-
- public static final int NO_PROBLEM_ID = -1;
- private IMessage fMessage = null;
- private Object fAdditionalFixInfo = null;
- private int fProblemId = NO_PROBLEM_ID;
-
- public AnnotationInfo(IMessage message) {
- fMessage = message;
-
- }
- public AnnotationInfo(IMessage message, int problemId, Object additionalFixInfo) {
- this(message);
- fProblemId = problemId;
- fAdditionalFixInfo = additionalFixInfo;
- }
-
- public final IMessage getMessage() {
- return fMessage;
- }
-
- public final Object getAdditionalFixInfo() {
- return fAdditionalFixInfo;
- }
-
- public final int getProblemId() {
- return fProblemId;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ISourceValidator.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ISourceValidator.java
deleted file mode 100644
index 1e09976ca9..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ISourceValidator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.wst.sse.ui.internal.reconcile.validator;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-
-/**
- * Interface to allow for "partial document" as you type validation.
- *
- */
-public interface ISourceValidator {
-
- /**
- * As you type validation is getting "hooked up" to this IDocument.
- * This is the instance of IDocument that the validator should
- * operate on for each validate call.
- *
- * @param document
- */
- void connect(IDocument document);
-
- /**
- * The same IDocument passed in from the connect() method.
- * This indicates that as you type validation is "shutting down"
- * for this IDocument.
- *
- * @param document
- */
- void disconnect(IDocument document);
-
- /**
- * Like IValidator#validate(IValidationContext helper, IReporter reporter)
- * except passes the dirty region, so document validation can be better
- * optimized.
- *
- * @param dirtyRegion
- * @param helper
- * @param reporter
- */
- void validate(IRegion dirtyRegion, IValidationContext helper, IReporter reporter);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/IncrementalHelper.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/IncrementalHelper.java
deleted file mode 100644
index 7b3ce3402a..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/IncrementalHelper.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile.validator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-
-
-
-public class IncrementalHelper implements IValidationContext {
- private IProject fProject;
-
- private String fURI = null;
-
- public IncrementalHelper(IDocument sourceDocument, IProject project) {
- super();
- fProject = project;
- }
-
- public String getPortableName(IResource resource) {
- return resource.getProjectRelativePath().toString();
- }
-
- public IProject getProject() {
- return fProject;
- }
-
- public Object loadModel(String symbolicName) {
- return null;
- }
-
- public Object loadModel(String symbolicName, Object[] parms) {
- return null;
- }
-
- void setURI(String uri) {
- fURI = uri;
- }
-
- public String[] getURIs() {
- if(fURI != null)
- return new String[]{fURI};
- return new String[0];
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/IncrementalReporter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/IncrementalReporter.java
deleted file mode 100644
index f67dae7ae8..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/IncrementalReporter.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile.validator;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-
-
-/**
- * Right now we'll only use one reporter per validator.
- */
-public class IncrementalReporter implements IReporter {
- private IProgressMonitor fProgressMonitor;
- private HashMap messages = new HashMap();
-
- public IncrementalReporter(IProgressMonitor progressMonitor) {
- super();
- fProgressMonitor = progressMonitor;
- }
-
- public void addMessage(IValidator validator, IMessage message) {
- AnnotationInfo info = new AnnotationInfo(message);
- addAnnotationInfo(validator, info);
- }
-
- public final void addAnnotationInfo(IValidator validator, AnnotationInfo info) {
- Object existingValue = messages.get(validator);
- if (existingValue != null) {
- ((HashSet) existingValue).add(info);
- }
- else {
- HashSet newValue = new HashSet(1);
- newValue.add(info);
- messages.put(validator, newValue);
- }
- }
-
- public void displaySubtask(IValidator validator, IMessage message) {
- if ((message == null) || (message.equals(""))) { //$NON-NLS-1$
- return;
- }
- if (fProgressMonitor != null) {
- fProgressMonitor.subTask(message.getText(validator.getClass().getClassLoader()));
- }
- }
-
- public List getMessages() {
- List result = new ArrayList();
- // messages is a list of:
- // validators => HashSet(AnnotationInfo1, AnnotationInfo2, ...)
- // (one HashSet per validator...)
- Object[] lists = messages.values().toArray();
- for (int i = 0; i < lists.length; i++) {
- Iterator it = ((HashSet)lists[i]).iterator();
- while (it.hasNext()) {
- AnnotationInfo info = (AnnotationInfo) it.next();
- result.add(info.getMessage());
- }
- }
- return result;
- }
-
- public AnnotationInfo[] getAnnotationInfo() {
- List result = new ArrayList();
- Object[] infos = messages.values().toArray();
- for (int i = 0; i < infos.length; i++) {
- result.addAll((HashSet)infos[i]);
- }
- return (AnnotationInfo[])result.toArray(new AnnotationInfo[result.size()]);
- }
-
- public boolean isCancelled() {
- if (fProgressMonitor == null)
- return false;
- return fProgressMonitor.isCanceled();
- }
-
- public void removeAllMessages(IValidator validator) {
- Object o = messages.get(validator);
- if(o != null && o instanceof HashSet) {
- ((HashSet)o).clear();
- }
- }
-
- public void removeAllMessages(IValidator validator, Object object) {
- removeAllMessages(validator);
- }
-
- // group names are unsupported
- public void removeMessageSubset(IValidator validator, Object obj, String groupName) {
- removeAllMessages(validator);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ReconcileStepForValidator.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ReconcileStepForValidator.java
deleted file mode 100644
index 306d329b53..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ReconcileStepForValidator.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile.validator;
-
-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.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcilableModel;
-import org.eclipse.jface.text.reconciler.IReconcileResult;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.reconcile.DocumentAdapter;
-import org.eclipse.wst.sse.ui.internal.reconcile.ReconcileAnnotationKey;
-import org.eclipse.wst.sse.ui.internal.reconcile.StructuredReconcileStep;
-import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-
-
-/**
- * A reconcile step for an IValidator for reconcile. Used the reconcile
- * framework to create TemporaryAnnotations from the validator messages.
- *
- * @author pavery
- */
-public class ReconcileStepForValidator extends StructuredReconcileStep {
-
- /** debug flag */
- protected static final boolean DEBUG;
- static {
- String value = Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerjob"); //$NON-NLS-1$
- DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
-
- private final IReconcileResult[] EMPTY_RECONCILE_RESULT_SET = new IReconcileResult[0];
- private IncrementalHelper fHelper = null;
- private IncrementalReporter fReporter = null;
- private int fScope = -1;
- private IValidator fValidator = null;
-
-
- public ReconcileStepForValidator(IValidator v, int scope) {
- super();
-
- if (v == null)
- throw new IllegalArgumentException("validator cannot be null"); //$NON-NLS-1$
-
- fValidator = v;
- fScope = scope;
- }
-
- /**
- * Converts a map of IValidatorForReconcile to List to annotations based
- * on those messages
- *
- * @param messages
- * @return
- */
-// protected IReconcileResult[] createAnnotations(List messageList) {
-// List annotations = new ArrayList();
-// for (int i = 0; i < messageList.size(); i++) {
-// IMessage validationMessage = (IMessage) messageList.get(i);
-//
-// int offset = validationMessage.getOffset();
-//
-// if (offset < 0)
-// continue;
-//
-// String messageText = null;
-// try {
-// messageText = validationMessage.getText(validationMessage.getClass().getClassLoader());
-// }
-// catch (Exception t) {
-// Logger.logException("exception reporting message from validator", t); //$NON-NLS-1$
-// continue;
-// }
-//
-// String type = getSeverity(validationMessage);
-// // this position seems like it would be possibly be the wrong
-// // length
-// int length = validationMessage.getLength();
-// if (length >= 0) {
-// Position p = new Position(offset, length);
-// ReconcileAnnotationKey key = createKey(getPartitionType(getDocument(), offset), getScope());
-// annotations.add(new TemporaryAnnotation(p, type, messageText, key));
-// }
-// }
-//
-// return (IReconcileResult[]) annotations.toArray(new IReconcileResult[annotations.size()]);
-// }
-
- /**
- * Converts a map of IValidatorForReconcile to List to annotations based
- * on those messages
- *
- * @param messages
- * @return
- */
- protected IReconcileResult[] createAnnotations(AnnotationInfo[] infos) {
-
-
- List annotations = new ArrayList();
- for (int i = 0; i < infos.length; i++) {
-
- AnnotationInfo info = infos[i];
-
- IMessage validationMessage = info.getMessage();
- int offset = validationMessage.getOffset();
- if (offset < 0)
- continue;
-
- String messageText = null;
- try {
- messageText = validationMessage.getText(validationMessage.getClass().getClassLoader());
- }
- catch (Exception t) {
- Logger.logException("exception reporting message from validator", t); //$NON-NLS-1$
- continue;
- }
- String type = getSeverity(validationMessage);
- // this position seems like it would be possibly be the wrong
- // length
- int length = validationMessage.getLength();
- if (length >= 0) {
-
- Position p = new Position(offset, length);
- ReconcileAnnotationKey key = createKey(getPartitionType(getDocument(), offset), getScope());
-
- if(info.getProblemId() == AnnotationInfo.NO_PROBLEM_ID) {
- // create an annotation w/ no fix info
- annotations.add(new TemporaryAnnotation(p, type, messageText, key));
- }
- else {
- // create an annotation w/ problem ID and fix info
- TemporaryAnnotation annotation = new TemporaryAnnotation(p, type, messageText, key, info.getProblemId());
- annotation.setAdditionalFixInfo(info.getAdditionalFixInfo());
- annotations.add(annotation);
- }
- }
- }
- return (IReconcileResult[]) annotations.toArray(new IReconcileResult[annotations.size()]);
- }
-
- private String getSeverity(IMessage validationMessage) {
- String type = TemporaryAnnotation.ANNOT_INFO;
- switch (validationMessage.getSeverity()) {
- case IMessage.HIGH_SEVERITY :
- type = TemporaryAnnotation.ANNOT_ERROR;
- break;
- case IMessage.NORMAL_SEVERITY :
- type = TemporaryAnnotation.ANNOT_WARNING;
- break;
- case IMessage.LOW_SEVERITY :
- type = TemporaryAnnotation.ANNOT_WARNING;
- break;
- case IMessage.ERROR_AND_WARNING :
- type = TemporaryAnnotation.ANNOT_WARNING;
- break;
- }
- return type;
- }
-
- private IFile getFile() {
- IStructuredModel model = null;
- IFile file = null;
- try {
- model = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
- if (model != null) {
- String baseLocation = model.getBaseLocation();
- // The baseLocation may be a path on disk or relative to the
- // workspace root. Don't translate on-disk paths to
- // in-workspace resources.
- IPath basePath = new Path(baseLocation);
- if (basePath.segmentCount() > 1 && !basePath.toFile().exists()) {
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
- }
- }
- }
- finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- return file;
- }
-
- private IncrementalHelper getHelper(IProject project) {
- if (fHelper == null)
- fHelper = new IncrementalHelper(getDocument(), project);
- return fHelper;
- }
-
- private IncrementalReporter getReporter() {
- if (fReporter == null)
- fReporter = new IncrementalReporter(getProgressMonitor());
- return fReporter;
- }
-
- /**
- * If this validator is partial or total
- * @return
- */
- public int getScope() {
- return fScope;
- }
-
- public void initialReconcile() {
- // do nothing
- }
-
- protected IReconcileResult[] reconcileModel(DirtyRegion dirtyRegion, IRegion subRegion) {
- if (DEBUG)
- System.out.println("[trace reconciler] > reconciling model in VALIDATOR step w/ dirty region: [" + dirtyRegion.getText() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
-
- IReconcileResult[] results = EMPTY_RECONCILE_RESULT_SET;
- if (dirtyRegion != null) {
- try {
- if(fValidator instanceof ISourceValidator) {
- results = validate(dirtyRegion, subRegion);
- }
- else {
- results = validate();
- }
- }
- catch (Exception ex) {
- Logger.logException("EXEPTION IN RECONCILE STEP FOR VALIDATOR", ex); //$NON-NLS-1$
- }
- }
-
- if (DEBUG)
- System.out.println("[trace reconciler] > VALIDATOR step done"); //$NON-NLS-1$
-
- return results;
- }
-
- public String toString() {
- StringBuffer debugString = new StringBuffer("ValidatorStep: "); //$NON-NLS-1$
- if (fValidator != null)
- debugString.append(fValidator.getClass().toString());
- return debugString.toString();
- }
-
- protected IReconcileResult[] validate() {
- IReconcileResult[] results = EMPTY_RECONCILE_RESULT_SET;
-
- IFile file = getFile();
-
- try {
- IncrementalHelper helper = getHelper(file != null ? file.getProject() : null);
- IncrementalReporter reporter = getReporter();
-
- if (file != null && file.exists()) {
- helper.setURI(file.getFullPath().toString());
- }
-
- fValidator.validate(helper, reporter);
-
- // results = createAnnotations(reporter.getMessages());
- results = createAnnotations(reporter.getAnnotationInfo());
- reporter.removeAllMessages(fValidator);
-
- fValidator.cleanup(reporter);
- }
- catch (Exception e) {
- Logger.logException(e);
- }
- return results;
- }
-
- public void setInputModel(IReconcilableModel inputModel) {
- if(inputModel instanceof DocumentAdapter) {
- IDocument document = ((DocumentAdapter)inputModel).getDocument();
- if(document != null) {
- if(fValidator instanceof ISourceValidator) {
- // notify that document connecting
- ((ISourceValidator)fValidator).connect(document);
- }
- }
- }
- super.setInputModel(inputModel);
- }
-
- public void release() {
- if(fValidator instanceof ISourceValidator) {
- IDocument document = getDocument();
- if(document != null) {
- // notify that document disconnecting
- ((ISourceValidator)fValidator).disconnect(document);
- }
- fValidator.cleanup(getReporter());
- }
- super.release();
- }
-
- protected IReconcileResult[] validate(DirtyRegion dirtyRegion, IRegion subRegion) {
- IReconcileResult[] results = EMPTY_RECONCILE_RESULT_SET;
-
- IFile file = getFile();
-
- try {
- IncrementalHelper helper = getHelper(file != null ? file.getProject() : null);
- /*
- * Setting the URI isn't necessary for all source validators, we
- * can still continue without it
- */
- if (file != null && file.exists()) {
- helper.setURI(file.getFullPath().toString());
- }
-
- if (fValidator instanceof ISourceValidator) {
- IncrementalReporter reporter = getReporter();
- ((ISourceValidator) fValidator).validate(dirtyRegion, helper, reporter);
- // call IValidator.cleanup() during release()
- // results = createAnnotations(reporter.getMessages());
- results = createAnnotations(reporter.getAnnotationInfo());
- reporter.removeAllMessages(fValidator);
- }
- }
- catch (Exception e) {
- Logger.logException(e);
- }
- return results;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorBuilder.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorBuilder.java
deleted file mode 100644
index 411f084bd6..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorBuilder.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile.validator;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.extension.RegistryReader;
-
-
-/**
- * Based off of TransferBuilder. Reads the extension point for
- * <code>org.eclipse.wst.sse.ui.extensions.sourcevalidation</code>
- */
-public class ValidatorBuilder extends RegistryReader {
-
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
- public static final String ATT_ID = "id"; //$NON-NLS-1$
- public static final String ATT_SCOPE = "scope"; //$NON-NLS-1$
-
- public static final ValidatorMetaData[] EMTPY_VMD_ARRAY = new ValidatorMetaData[0];
-
- // extension point ID
- public static final String PL_SOURCE_VALIDATION = "sourcevalidation"; //$NON-NLS-1$
-
- public static final String PLUGIN_ID = "org.eclipse.wst.sse.ui"; //$NON-NLS-1$
- public static final String TAG_CONTENT_TYPE_IDENTIFIER = "contentTypeIdentifier"; //$NON-NLS-1$
- public static final String TAG_PARTITION_TYPE = "partitionType"; //$NON-NLS-1$
-
- public static final String TAG_VALIDATOR = "validator"; //$NON-NLS-1$
-
- public static final String TRACE_FILTER = "reconcile_validator"; //$NON-NLS-1$
-
- public static final String TRUE = "true"; //$NON-NLS-1$
- private String fCurrentCTID;
- private ValidatorMetaData fCurrentVMD = null;
- private List fVmds = new ArrayList();
- protected String targetContributionTag;
- protected String targetID;
-
- private final String UNKNOWN = "???"; //$NON-NLS-1$
-
- /**
- * Returns the name of the part ID attribute that is expected in the
- * target extension.
- *
- * @param element
- * @return String
- */
- protected String getID(IConfigurationElement element) {
- String value = element.getAttribute(ATT_ID);
- return value != null ? value : UNKNOWN; //$NON-NLS-1$
- }
-
- protected String getValidatorClass(IConfigurationElement element) {
- String value = element.getAttribute(ATT_CLASS);
- return value != null ? value : UNKNOWN; //$NON-NLS-1$
- }
-
- /**
- * @param editorId
- * @return Transfer[]
- */
- public ValidatorMetaData[] getValidatorMetaData(String editorId) {
- readContributions(editorId, TAG_VALIDATOR, PL_SOURCE_VALIDATION);
- return (ValidatorMetaData[]) fVmds.toArray(new ValidatorMetaData[fVmds.size()]);
- }
-
- protected String getValidatorScope(IConfigurationElement element) {
- String value = element.getAttribute(ATT_SCOPE);
- return value != null ? value : UNKNOWN; //$NON-NLS-1$
- }
-
- /**
- * Reads the contributions from the registry for the provided workbench
- * part and the provided extension point ID.
- *
- * @param id
- * @param tag
- * @param extensionPoint
- */
- protected void readContributions(String id, String tag, String extensionPoint) {
- targetID = id;
- targetContributionTag = tag;
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- readRegistry(registry, PLUGIN_ID, extensionPoint);
- }
-
- protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
- //ie. targetContributionTag == validator
- if (tag.equals(targetContributionTag)) {
- String vId = getID(element);
- String vClass = getValidatorClass(element);
- String vScope = getValidatorScope(element);
-
- if (vId == null) {
- // This is not of interest to us - don't go deeper
- return true;
- }
- // start building a VMD
- fCurrentVMD = new ValidatorMetaData(element, vId, vClass, vScope);
- fVmds.add(fCurrentVMD);
-
- if (Logger.isTracing(ValidatorBuilder.TRACE_FILTER))
- System.out.println("added reconcile validator: " + vId + ":" + vClass + ":" + vScope); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- } else if (tag.equals(TAG_CONTENT_TYPE_IDENTIFIER)) {
- // add to current VMD
- fCurrentCTID = getID(element);
- fCurrentVMD.addContentTypeId(fCurrentCTID);
- } else if (tag.equals(TAG_PARTITION_TYPE)) {
- // add to current VMD
- String partitionType = getID(element);
- fCurrentVMD.addParitionType(fCurrentCTID, partitionType);
-
- return true;
- } else {
- return false;
- }
-
- readElementChildren(element);
- return true;
- }
-}
-
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorMetaData.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorMetaData.java
deleted file mode 100644
index 47bcdcb6d9..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorMetaData.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile.validator;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.reconcile.ReconcileAnnotationKey;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-import org.osgi.framework.Bundle;
-
-
-/**
- * Object that holds information relevant to the creation of a validator for
- * the reconciling framework.
- *
- * @author pavery,nitind
- */
-public class ValidatorMetaData {
- private String fClass = null;
- private IConfigurationElement fConfigurationElement = null;
- private String fId = null;
- private String fScope;
-
- // a hash map of explicitly declared content type Ids (String) that points to lists of
- // partition types (List of Strings)
- // contentTypeId -> List(paritionType, paritionType, partitionType, ...)
- // contentTypeId2 -> List(partitionType, partitionType, ...)
- // ...
- private HashMap fMatrix = null;
-
- public ValidatorMetaData(IConfigurationElement element, String vId, String vClass, String vScope) {
- fId = vId;
- fClass = vClass;
- fConfigurationElement = element;
- fScope = vScope;
- fMatrix = new HashMap();
- }
-
- /**
- * TODO: This exact method is also in ValidatorStrategy. Should be in a common place.
- *
- * @param contentTypeId
- * @return
- */
- private String[] calculateParentContentTypeIds(String contentTypeId) {
-
- Set parentTypes = new HashSet();
-
- IContentTypeManager ctManager = Platform.getContentTypeManager();
- IContentType ct = ctManager.getContentType(contentTypeId);
- String id = contentTypeId;
-
- while(ct != null && id != null) {
-
- parentTypes.add(id);
- ct = ctManager.getContentType(id);
- if(ct != null) {
- IContentType baseType = ct.getBaseType();
- id = (baseType != null) ? baseType.getId() : null;
- }
- }
- return (String[])parentTypes.toArray(new String[parentTypes.size()]);
- }
-
- public void addContentTypeId(String contentTypeId) {
- if (!fMatrix.containsKey(contentTypeId))
- fMatrix.put(contentTypeId, new ArrayList());
- }
-
- public void addParitionType(String contentTypeId, String partitionType) {
- if (!fMatrix.containsKey(contentTypeId))
- fMatrix.put(contentTypeId, new ArrayList());
-
- List partitionList = (List) fMatrix.get(contentTypeId);
- partitionList.add(partitionType);
- }
-
- /**
- * @param contentType
- * @return whether this validator explicitly declared that it could handle
- * this content type or any of its parent content types
- */
- public boolean canHandleContentType(String contentType) {
- // need to iterate hierarchy
- String[] contentHierarchy = calculateParentContentTypeIds(contentType);
- for (int i = 0; i < contentHierarchy.length; i++) {
- if(fMatrix.containsKey(contentHierarchy[i]))
- return true;
- }
- return false;
- }
-
- /**
- * @param contentType
- * @return whether this validator explicitly declared that it could handle
- * this content type
- */
- public boolean mustHandleContentType(String contentType) {
- return fMatrix.containsKey(contentType);
- }
-
- /**
- * @param contentTypeIds
- * @param partitionType
- * @return whether this validator declared that it could handle this
- * content type, or one of its parent content types, and partition
- * type
- */
- public boolean canHandlePartitionType(String contentTypeIds[], String paritionType) {
- for(int i=0; i<contentTypeIds.length; i++) {
- if (fMatrix.containsKey(contentTypeIds[i])) {
- List partitions = (List) fMatrix.get(contentTypeIds[i]);
- for (int j = 0; j < partitions.size(); j++) {
- if (paritionType.equals(partitions.get(j)))
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * @param element
- * @param classAttribute
- * @return Object
- * @throws CoreException
- */
- Object createExecutableExtension(final IConfigurationElement element, final String classAttribute) throws CoreException {
- Object obj = null;
- obj = element.createExecutableExtension(classAttribute);
- return obj;
- }
-
- /**
- * Creates an extension. If the extension plugin has not been loaded a
- * busy cursor will be activated during the duration of the load.
- *
- * @param element
- * @param classAttribute
- * @return Object
- * @throws CoreException
- */
- public Object createExtension() {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- final IConfigurationElement element = getConfigurationElement();
- final Object[] result = new Object[1];
- String pluginId = element.getDeclaringExtension().getNamespace();
- Bundle bundle = Platform.getBundle(pluginId);
- if (bundle.getState() == Bundle.ACTIVE) {
- try {
- return createExecutableExtension(element, "class"); //$NON-NLS-1$
- } catch (CoreException e) {
- handleCreateExecutableException(result, e);
- }
- } else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = createExecutableExtension(element, "class"); //$NON-NLS-1$
- } catch (Exception e) {
- handleCreateExecutableException(result, e);
- }
- }
- });
- }
- return result[0];
- }
-
- /**
- * @return a validator instance based on this ValidatorMetaData instance
- */
- public IValidator createValidator() {
- Object obj = null;
- obj = createExtension();
- if (obj == null) {
- return null;
- }
- return (obj instanceof IValidator) ? (IValidator) obj : null;
- }
-
- public IConfigurationElement getConfigurationElement() {
- return fConfigurationElement;
- }
-
- public String getValidatorClass() {
- return fClass;
- }
-
- public String getValidatorId() {
- return fId;
- }
-
- /**
- * @param result
- * @param e
- */
- void handleCreateExecutableException(Object[] result, Throwable e) {
- Logger.logException(e);
- e.printStackTrace();
- result[0] = null;
- }
- /**
- * ReconcileAnnotationKey.TOTAL or ReconcileAnnotationKey.PARTIAL
- * @return
- */
- public int getValidatorScope() {
- return fScope.equalsIgnoreCase("total") ? ReconcileAnnotationKey.TOTAL : ReconcileAnnotationKey.PARTIAL; //$NON-NLS-1$
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- StringBuffer debugString = new StringBuffer("ValidatorMetaData:"); //$NON-NLS-1$
- if (fId != null)
- debugString.append(" [id:" + fId + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- return debugString.toString();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorStrategy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorStrategy.java
deleted file mode 100644
index c069bdae6e..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/reconcile/validator/ValidatorStrategy.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.reconcile.validator;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.content.IContentTypeManager;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcileResult;
-import org.eclipse.jface.text.reconciler.IReconcileStep;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.IReleasable;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.reconcile.DocumentAdapter;
-import org.eclipse.wst.sse.ui.internal.reconcile.ReconcileAnnotationKey;
-import org.eclipse.wst.sse.ui.internal.reconcile.StructuredTextReconcilingStrategy;
-import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
-import org.eclipse.wst.validation.internal.ConfigurationManager;
-import org.eclipse.wst.validation.internal.ProjectConfiguration;
-import org.eclipse.wst.validation.internal.ValidationRegistryReader;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-
-
-/**
- * Special validator strategy. Runs validator steps contributed via the
- * <code>org.eclipse.wst.sse.ui.extensions.sourcevalidation</code> extension
- * point
- *
- * @author pavery
- */
-public class ValidatorStrategy extends StructuredTextReconcilingStrategy {
-
- private String[] fContentTypeIds = null;
- private List fMetaData = null;
- /** validator id (as declared in ext point) -> ReconcileStepForValidator * */
- private HashMap fVidToVStepMap = null;
- private ProjectConfiguration fProjectConfiguration = null;
-
- /*
- * List of ValidatorMetaDatas of total scope validators that have been run
- * since beginProcessing() was called.
- */
- private List fTotalScopeValidatorsAlreadyRun;
-
- public ValidatorStrategy(ISourceViewer sourceViewer, String contentType) {
- super(sourceViewer);
- fMetaData = new ArrayList();
- fContentTypeIds = calculateParentContentTypeIds(contentType);
- fVidToVStepMap = new HashMap();
- }
-
- public void addValidatorMetaData(ValidatorMetaData vmd) {
- fMetaData.add(vmd);
- }
-
- public void beginProcessing() {
- if (fTotalScopeValidatorsAlreadyRun == null)
- fTotalScopeValidatorsAlreadyRun = new ArrayList();
- else
- fTotalScopeValidatorsAlreadyRun.clear();
- }
-
- /**
- * The content type passed in should be the most specific one. TODO: This
- * exact method is also in ValidatorMetaData. Should be in a common place.
- *
- * @param contentType
- * @return
- */
- private String[] calculateParentContentTypeIds(String contentTypeId) {
-
- Set parentTypes = new HashSet();
-
- IContentTypeManager ctManager = Platform.getContentTypeManager();
- IContentType ct = ctManager.getContentType(contentTypeId);
- String id = contentTypeId;
-
- while (ct != null && id != null) {
-
- parentTypes.add(id);
- ct = ctManager.getContentType(id);
- if (ct != null) {
- IContentType baseType = ct.getBaseType();
- id = (baseType != null) ? baseType.getId() : null;
- }
- }
- return (String[]) parentTypes.toArray(new String[parentTypes.size()]);
- }
-
- protected boolean canHandlePartition(String partitionType) {
- ValidatorMetaData vmd = null;
- for (int i = 0; i < fMetaData.size(); i++) {
- vmd = (ValidatorMetaData) fMetaData.get(i);
- if (vmd.canHandlePartitionType(getContentTypeIds(), partitionType))
- return true;
- }
- return false;
- }
-
- protected boolean containsStep(IReconcileStep step) {
- return fVidToVStepMap.containsValue(step);
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.provisional.reconcile.AbstractStructuredTextReconcilingStrategy#createReconcileSteps()
- */
- public void createReconcileSteps() {
- // do nothing, steps are created
- }
-
- public void endProcessing() {
- fTotalScopeValidatorsAlreadyRun.clear();
- }
-
- /**
- * All content types on which this ValidatorStrategy can run
- *
- * @return
- */
- public String[] getContentTypeIds() {
- return fContentTypeIds;
- }
-
- /**
- * @param tr
- * Partition of the region to reconcile.
- * @param dr
- * Dirty region representation of the typed region
- */
- public void reconcile(ITypedRegion tr, DirtyRegion dr) {
-
- if (isCanceled())
- return;
-
- IDocument doc = getDocument();
- // for external files, this can be null
- if (doc == null)
- return;
-
- String partitionType = tr.getType();
-
- ValidatorMetaData vmd = null;
- List annotationsToAdd = new ArrayList();
- List stepsRanOnThisDirtyRegion = new ArrayList(1);
- /*
- * Loop through all of the relevant validator meta data to find
- * supporting validators for this partition type. Don't check
- * this.canHandlePartition() before-hand since it just loops through
- * and calls vmd.canHandlePartitionType()...which we're already doing
- * here anyway to find the right vmd.
- */
- for (int i = 0; i < fMetaData.size() && !isCanceled(); i++) {
- vmd = (ValidatorMetaData) fMetaData.get(i);
- if (vmd.canHandlePartitionType(getContentTypeIds(), partitionType)) {
- /*
- * Check if validator is enabled according to validation
- * preferences before attempting to create/use it
- */
- if (isValidatorEnabled(vmd)) {
- int validatorScope = vmd.getValidatorScope();
- ReconcileStepForValidator validatorStep = null;
- // get step for partition type
- Object o = fVidToVStepMap.get(vmd.getValidatorId());
- if (o != null) {
- validatorStep = (ReconcileStepForValidator) o;
- }
- else {
- // if doesn't exist, create one
- IValidator validator = vmd.createValidator();
-
- validatorStep = new ReconcileStepForValidator(validator, validatorScope);
- validatorStep.setInputModel(new DocumentAdapter(doc));
-
- fVidToVStepMap.put(vmd.getValidatorId(), validatorStep);
- }
-
- if (!fTotalScopeValidatorsAlreadyRun.contains(vmd)) {
- annotationsToAdd.addAll(Arrays.asList(validatorStep.reconcile(dr, dr)));
- stepsRanOnThisDirtyRegion.add(validatorStep);
-
- if (validatorScope == ReconcileAnnotationKey.TOTAL) {
- // mark this validator as "run"
- fTotalScopeValidatorsAlreadyRun.add(vmd);
- }
- }
- }
- }
- }
-
- TemporaryAnnotation[] annotationsToRemove = getAnnotationsToRemove(dr, stepsRanOnThisDirtyRegion);
- if (annotationsToRemove.length + annotationsToAdd.size() > 0)
- smartProcess(annotationsToRemove, (IReconcileResult[]) annotationsToAdd.toArray(new IReconcileResult[annotationsToAdd.size()]));
- }
-
- public void release() {
- super.release();
- Iterator it = fVidToVStepMap.values().iterator();
- IReconcileStep step = null;
- while (it.hasNext()) {
- step = (IReconcileStep) it.next();
- if (step instanceof IReleasable)
- ((IReleasable) step).release();
- }
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.reconcile.AbstractStructuredTextReconcilingStrategy#setDocument(org.eclipse.jface.text.IDocument)
- */
- public void setDocument(IDocument document) {
-
- super.setDocument(document);
-
- // validator steps are in "fVIdToVStepMap" (as opposed to fFirstStep >
- // next step etc...)
- Iterator it = fVidToVStepMap.values().iterator();
- IReconcileStep step = null;
- while (it.hasNext()) {
- step = (IReconcileStep) it.next();
- step.setInputModel(new DocumentAdapter(document));
- }
- }
-
- /**
- * Checks if validator is enabled according to Validation preferences
- *
- * @param vmd
- * @return
- */
- private boolean isValidatorEnabled(ValidatorMetaData vmd) {
- boolean enabled = true;
- ProjectConfiguration configuration = getProjectConfiguration();
- org.eclipse.wst.validation.internal.ValidatorMetaData metadata = ValidationRegistryReader.getReader().getValidatorMetaData(vmd.getValidatorClass());
- if (configuration != null && metadata != null) {
- if (!configuration.isBuildEnabled(metadata) && !configuration.isManualEnabled(metadata))
- enabled = false;
- }
- return enabled;
- }
-
- /**
- * Gets current validation project configuration based on current project
- * (which is based on current document)
- *
- * @return ProjectConfiguration
- */
- private ProjectConfiguration getProjectConfiguration() {
- if (fProjectConfiguration == null) {
- IFile file = getFile();
- if (file != null) {
- IProject project = file.getProject();
- if (project != null) {
- try {
- fProjectConfiguration = ConfigurationManager.getManager().getProjectConfiguration(project);
- }
- catch (InvocationTargetException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- }
- }
- }
-
- return fProjectConfiguration;
- }
-
- /**
- * Gets IFile from current document
- *
- * @return IFile the IFile, null if no such file exists
- */
- private IFile getFile() {
- IStructuredModel model = null;
- IFile file = null;
- try {
- model = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
- if (model != null) {
- String baseLocation = model.getBaseLocation();
- // The baseLocation may be a path on disk or relative to the
- // workspace root. Don't translate on-disk paths to
- // in-workspace resources.
- IPath basePath = new Path(baseLocation);
- if (basePath.segmentCount() > 1) {
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
- /*
- * If the IFile doesn't exist, make sure it's not
- * returned
- */
- if (!file.exists())
- file = null;
- }
- }
- }
- finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- return file;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicSearchLabelProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicSearchLabelProvider.java
deleted file mode 100644
index 3c3d540adb..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicSearchLabelProvider.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.search;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImageHelper;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImages;
-
-
-
-/**
- * Basic label provider that just provides an image and default text.
- *
- * @author pavery
- */
-public class BasicSearchLabelProvider implements ILabelProvider {
-
- public void addListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Image getImage(Object element) {
- return EditorPluginImageHelper.getInstance().getImage(EditorPluginImages.IMG_OBJ_OCC_MATCH);
- }
-
- public String getText(Object element) {
-
- StringBuffer text = new StringBuffer();
- if (element instanceof Match) {
- Match m = (Match) element;
-
- IMarker marker = (IMarker) m.getElement();
- if (marker.exists()) {
- String resultText = ""; //$NON-NLS-1$
- try {
- resultText = (String) marker.getAttribute(IMarker.MESSAGE);
- } catch (CoreException e) {
- Logger.logException(e);
- }
- text.append(resultText);
- }
- } else {
- text.append(element.toString());
- }
- return text.toString();
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- // do nothing
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicSearchQuery.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicSearchQuery.java
deleted file mode 100644
index be29c233ab..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicSearchQuery.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.search;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResult;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-
-/**
- * @author pavery
- */
-public class BasicSearchQuery implements ISearchQuery {
-
- /** attribute to identify markers added by find occurrences */
- public static final String ATTR_OCCURRENCES_MARKER = "occurrences_marker"; //$NON-NLS-1$
-
- private static int LINE_LENGTH_LIMIT = 200;
-
- /** the file we're searching * */
- private IFile fFile = null;
- /** occurrence search matches * */
- private List fMatches = null;
-
- public BasicSearchQuery(IFile file) {
- this.fFile = file;
- this.fMatches = new ArrayList();
- }
-
- public void addMatch(IDocument document, int matchStart, int matchEnd) {
-
- try {
- int lineNumber = document.getLineOfOffset(matchStart);
- int lineStart = document.getLineOffset(lineNumber);
- int lineLength = document.getLineLength(lineNumber);
-
- String searchResultString = document.get().substring(lineStart, lineStart + lineLength).trim();
-
- // create search marker (so annotations show up in editor)
- IMarker marker = createSearchMarker(matchStart, matchEnd, lineNumber, searchResultString);
-
- addMatch(new Match(marker, Match.UNIT_CHARACTER, matchStart, matchStart + matchEnd));
-
- } catch (BadLocationException e) {
- Logger.logException(e);
- }
- }
-
- private void addMatch(Match match) {
- if (match != null)
- this.fMatches.add(match);
- }
-
- /**
- * @see org.eclipse.search.ui.ISearchQuery#canRerun()
- */
- public boolean canRerun() {
- return false;
- }
-
- /**
- * @see org.eclipse.search.ui.ISearchQuery#canRunInBackground()
- */
- public boolean canRunInBackground() {
- return true;
- }
-
- public void clearMatches() {
- this.fMatches.clear();
- }
-
- protected IMarker createSearchMarker(int matchStart, int matchEnd, int lineNumber, String searchResultString) {
-
- IMarker marker = null;
- try {
- if (getFile() != null) {
-
- marker = getFile().createMarker(NewSearchUI.SEARCH_MARKER);
- HashMap attributes = new HashMap(6);
-
- MarkerUtilities.setCharStart(attributes, matchStart);
- MarkerUtilities.setCharEnd(attributes, matchEnd);
- MarkerUtilities.setLineNumber(attributes, lineNumber);
-
- // this might be bad if line of text is VERY long?
- if (searchResultString.length() > LINE_LENGTH_LIMIT)
- searchResultString = searchResultString.substring(0, LINE_LENGTH_LIMIT) + "..."; //$NON-NLS-1$
- MarkerUtilities.setMessage(attributes, searchResultString);
-
- // so we can remove them later
- attributes.put(ATTR_OCCURRENCES_MARKER, new Boolean(true));
-
- marker.setAttributes(attributes);
- }
- } catch (CoreException e) {
- Logger.logException(e);
- }
- return marker;
- }
-
- private void deleteOccurrencesMarkers() {
-
- final List removals = new ArrayList();
- try {
- // clear all old find occurrences markers
- IMarker[] searchMarkers = fFile.findMarkers(NewSearchUI.SEARCH_MARKER, false, IResource.DEPTH_ZERO);
- for (int i = 0; i < searchMarkers.length; i++) {
- Object o = searchMarkers[i].getAttribute(BasicSearchQuery.ATTR_OCCURRENCES_MARKER);
- if (o != null && ((Boolean) o).booleanValue() == true)
- removals.add(searchMarkers[i]);
-
- }
-
- if (removals.size() > 0) {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < removals.size(); i++)
- ((IMarker) removals.get(i)).delete();
- }
- };
- // BUG158846 - deadlock if lock up entire workspace, so only lock
- // up the file we are searching on
- ISchedulingRule markerRule = ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(fFile);
- ResourcesPlugin.getWorkspace().run(runnable, markerRule, IWorkspace.AVOID_UPDATE, null);
- }
- } catch (CoreException e) {
- Logger.logException(e);
- }
- }
-
- /**
- * The acutal work of the query. Will be run in a background Job
- * automatically if canRunInBackground(..) returns true.
- *
- * @return
- */
- protected IStatus doQuery() {
- return Status.OK_STATUS;
- }
-
- /*
- * public to avoid synthetic method access from inner class
- */
- public IFile getFile() {
- return this.fFile;
- }
-
- /**
- * @see org.eclipse.search.ui.ISearchQuery#getLabel()
- */
- public String getLabel() {
- return ""; //$NON-NLS-1$
- }
-
- public Match[] getMatches() {
- // get rid of the old markers
- if(fFile.exists()) {
- deleteOccurrencesMarkers();
- doQuery();
- }
- return (Match[]) this.fMatches.toArray(new Match[this.fMatches.size()]);
- }
-
- /**
- * @see org.eclipse.search.ui.ISearchQuery#getSearchResult()
- */
- public ISearchResult getSearchResult() {
- return null;
- }
-
- /**
- * used in search result display labels
- *
- * @return
- */
- protected String getSearchText() {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.search.ui.ISearchQuery#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public IStatus run(IProgressMonitor monitor) {
- // defer to "get(...)"
- return Status.OK_STATUS;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionDelegate.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionDelegate.java
deleted file mode 100644
index f8bb41c8be..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionDelegate.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- *
- *******************************************************************************/
-
-package org.eclipse.wst.sse.ui.internal.search;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IActionDelegate2;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil;
-
-/**
- * Performs the appropriate FindOccurrencesProcessor action call based on
- * selection. Clients can add processors for different partitions via
- * <code>getProcessors</code>
- *
- */
-abstract public class FindOccurrencesActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
- private IEditorPart fEditor;
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- fEditor = targetEditor;
- }
-
- public void dispose() {
- // nulling out just in case
- fEditor = null;
- }
-
- public void init(IAction action) {
- if (action != null) {
- action.setText(SSEUIMessages.FindOccurrences_label);
- }
- }
-
- public void runWithEvent(IAction action, Event event) {
- run(action);
- }
-
- public void run(IAction action) {
- boolean okay = false;
- if (fEditor instanceof ITextEditor) {
- ITextEditor textEditor = (ITextEditor) fEditor;
- IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
- if (document != null) {
- ITextSelection textSelection = getTextSelection(textEditor);
- FindOccurrencesProcessor findOccurrenceProcessor = getProcessorForCurrentSelection(document, textSelection);
- if (findOccurrenceProcessor != null) {
- if (textEditor.getEditorInput() instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput) textEditor.getEditorInput()).getFile();
- okay = findOccurrenceProcessor.findOccurrences(document, textSelection, file);
- }
- }
- }
- }
- if (okay) {
- // clear status message
- PlatformStatusLineUtil.clearStatusLine();
- }
- else {
- String errorMessage = SSEUIMessages.FindOccurrencesActionProvider_0; //$NON-NLS-1$
- PlatformStatusLineUtil.displayErrorMessage(errorMessage);
- PlatformStatusLineUtil.addOneTimeClearListener();
- }
- }
-
- public void init(IViewPart view) {
- // do nothing
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // clear status message
- PlatformStatusLineUtil.clearStatusLine();
- }
-
- /**
- * Get the appropriate find occurrences processor
- *
- * @param document -
- * assumes not null
- * @param textSelection
- * @return
- */
- private FindOccurrencesProcessor getProcessorForCurrentSelection(IDocument document, ITextSelection textSelection) {
- // check if we have an action that's enabled on the current partition
- ITypedRegion tr = getPartition(document, textSelection);
- String partition = tr != null ? tr.getType() : ""; //$NON-NLS-1$
-
- Iterator it = getProcessors().iterator();
- FindOccurrencesProcessor action = null;
- while (it.hasNext()) {
- action = (FindOccurrencesProcessor) it.next();
- // we just choose the first action that can handle the partition
- if (action.enabledForParitition(partition))
- return action;
- }
- return null;
- }
-
- private ITypedRegion getPartition(IDocument document, ITextSelection textSelection) {
- ITypedRegion region = null;
- if (textSelection != null) {
- try {
- region = document.getPartition(textSelection.getOffset());
- }
- catch (BadLocationException e) {
- region = null;
- }
- }
- return region;
- }
-
- private ITextSelection getTextSelection(ITextEditor textEditor) {
- ITextSelection textSelection = null;
- ISelection selection = textEditor.getSelectionProvider().getSelection();
- if (selection instanceof ITextSelection && !selection.isEmpty()) {
- textSelection = (ITextSelection) selection;
- }
- return textSelection;
- }
-
- abstract protected List getProcessors();
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesProcessor.java
deleted file mode 100644
index 0c9d09ff6e..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesProcessor.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- *
- *******************************************************************************/
-
-package org.eclipse.wst.sse.ui.internal.search;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-
-/**
- * <p>
- * Finds occurrences of a specified region type w/ region text in an
- * IStructuredDocument. Clients must implement getPartitionTypes() and
- * getRegionTypes() to indicate which partition types and region types it can
- * operate on.
- * </p>
- *
- * <p>
- * Clients should override <code>getSearchQuery()</code> in order to provide
- * their own type of "search" (eg. searching for XML start tags, searching for
- * Java elements, etc...)
- * </p>
- *
- */
-abstract public class FindOccurrencesProcessor {
- public boolean findOccurrences(IDocument document, ITextSelection textSelection, IFile file) {
- boolean findOccurrences = false;
-
- // determine if action should be enabled or not
- if (document instanceof IStructuredDocument) {
- IStructuredDocument structuredDocument = (IStructuredDocument) document;
- IStructuredDocumentRegion sdRegion = structuredDocument.getRegionAtCharacterOffset(textSelection.getOffset());
- if (sdRegion != null) {
- ITextRegion r = sdRegion.getRegionAtCharacterOffset(textSelection.getOffset());
- if (r != null) {
- String type = r.getType();
- if (enabledForRegionType(type)) {
- String matchText = sdRegion.getText(r);
-
- // first of all activate the view
- NewSearchUI.activateSearchResultView();
-
- if (matchText != null && type != null) {
- ISearchQuery searchQuery = getSearchQuery(file, structuredDocument, matchText, type, textSelection);
- if (searchQuery != null) {
- if (searchQuery.canRunInBackground())
- NewSearchUI.runQueryInBackground(searchQuery);
- else
- NewSearchUI.runQueryInForeground(null, searchQuery);
- }
- findOccurrences = true;
- }
- }
- }
- }
- }
- return findOccurrences;
- }
-
- /**
- * @param regionType
- * @return <code>true</code> if this action can operate on this region
- * type (ITextRegion), otherwise false.
- */
- private boolean enabledForRegionType(String regionType) {
-
- String[] accept = getRegionTypes();
- for (int i = 0; i < accept.length; i++) {
- if (regionType.equals(accept[i]))
- return true;
- }
- return false;
- }
-
- /**
- * Clients should override this to enable find occurrences on certain
- * partition(s).
- */
- abstract protected String[] getPartitionTypes();
-
- /**
- * Clients should override this to enable find occurrences on different
- * region type(s).
- */
- abstract protected String[] getRegionTypes();
-
- /**
- * Clients should override to provide their own search for the file.
- */
- protected ISearchQuery getSearchQuery(IFile file, IStructuredDocument document, String regionText, String regionType, ITextSelection textSelection) {
- return new OccurrencesSearchQuery(file, document, regionText, regionType);
- }
-
- /**
- * @param partitionType
- * @return <code>true</code> if this action can operate on this type of
- * partition, otherwise <code>false</code>.
- */
- public boolean enabledForParitition(String partitionType) {
- String[] accept = getPartitionTypes();
- for (int i = 0; i < accept.length; i++) {
- if (partitionType.equals(accept[i]))
- return true;
- }
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesContentProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesContentProvider.java
deleted file mode 100644
index 11251fd321..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesContentProvider.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.search;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * @author pavery
- */
-public class OccurrencesContentProvider implements IStructuredContentProvider {
-
- protected final Object[] EMPTY_ARRAY = new Object[0];
- private OccurrencesSearchResult fResult = null;
- private TableViewer fTableViewer = null;
-
- public void clear() {
- if (this.fResult != null)
- this.fResult.clearMatches();
- if (this.fTableViewer != null)
- this.fTableViewer.refresh();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- // do nothing
- }
-
- public void elementsChanged(Object[] updatedElements) {
-
- //TODO: copied from JavaSearchTableContentProvider
- int addCount = 0;
- int removeCount = 0;
- for (int i = 0; i < updatedElements.length; i++) {
- if (this.fResult.getMatchCount(updatedElements[i]) > 0) {
- if (this.fTableViewer.testFindItem(updatedElements[i]) != null)
- this.fTableViewer.refresh(updatedElements[i]);
- else
- this.fTableViewer.add(updatedElements[i]);
- addCount++;
- } else {
- this.fTableViewer.remove(updatedElements[i]);
- removeCount++;
- }
- }
- }
-
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
-
- this.fResult = (OccurrencesSearchResult) inputElement;
- return this.fResult.getMatches();
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- if (viewer instanceof TableViewer)
- this.fTableViewer = (TableViewer) viewer;
- this.fResult = (OccurrencesSearchResult) newInput;
- }
-
- public void refresh() {
-
- if (this.fTableViewer != null)
- this.fTableViewer.refresh();
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchQuery.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchQuery.java
deleted file mode 100644
index cf1e48fbc5..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchQuery.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.search;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.search.ui.ISearchResult;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-
-/**
- * Basic ISearchQuery that finds matches of region type and region text.
- *
- * @author pavery
- */
-public class OccurrencesSearchQuery extends BasicSearchQuery {
-
- /**
- * We need a runnable so that the search markers show up in the live
- * document.
- */
- private class FindRegions implements IWorkspaceRunnable {
-
- private IStructuredDocument fFindRegionsDocument = null;
- private String fMatchName = null;
- private String fMatchRegionType = null;
-
- public FindRegions(IStructuredDocument document, String matchText, String matchRegionType) {
-
- this.fFindRegionsDocument = document;
- this.fMatchName = matchText;
- this.fMatchRegionType = matchRegionType;
- }
-
- private void findOccurrences(IProgressMonitor monitor) {
-
- if (!isCanceled(monitor)) {
-
- int matchStart = -1;
- int matchEnd = -1;
- String findRegionText = ""; //$NON-NLS-1$
-
- ITextRegion r = null;
- ITextRegionList regions = null;
- IStructuredDocumentRegion current = this.fFindRegionsDocument.getFirstStructuredDocumentRegion();
-
- // this is the main loop that iterates the document
- while (current != null && !isCanceled(monitor)) {
- regions = current.getRegions();
- for (int i = 0; i < regions.size() && !isCanceled(monitor); i++) {
-
- r = regions.get(i);
-
- // maybe this is the equals check where some valid
- // matches are failing (like searching on end tag)
- if (r.getType().equals(this.fMatchRegionType) && current.getText(r).equals(this.fMatchName)) {
-
- findRegionText = current.getText(r);
-
- // region found
- matchStart = current.getStartOffset(r);
- matchEnd = matchStart + findRegionText.trim().length();
-
- addMatch(this.fFindRegionsDocument, matchStart, matchEnd);
- }
- }
- current = current.getNext();
- }
- }
- }
-
- private boolean isCanceled(IProgressMonitor monitor) {
- return monitor != null && monitor.isCanceled();
- }
-
- public void run(IProgressMonitor monitor) throws CoreException {
-
- try {
- findOccurrences(monitor);
- } catch (Exception e) {
- Logger.logException(e);
- }
- }
- }
-
- // end inner class FindRegions
-
-
- private IStructuredDocument fDocument = null;
- private String fRegionText = null;
- private String fRegionType = null;
-
- public OccurrencesSearchQuery(IFile file, IStructuredDocument document, String regionText, String regionType) {
- super(file);
- this.fDocument = document;
- this.fRegionText = regionText;
- this.fRegionType = regionType;
- }
-
- public boolean canRerun() {
- return false;
- }
-
- public boolean canRunInBackground() {
- // pa_TODO investigate what is required to do this safely
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.internal.search.BasicSearchQuery#doQuery()
- */
- protected IStatus doQuery() {
-
- clearMatches();
-
- IStatus status = Status.OK_STATUS;
- FindRegions findRegions = new FindRegions(this.fDocument, this.fRegionText, this.fRegionType);
- try {
- // BUG158846 - deadlock if lock up entire workspace, so only lock
- // up the file we are searching on
- ISchedulingRule markerRule = ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(getFile());
- ResourcesPlugin.getWorkspace().run(findRegions, markerRule, IWorkspace.AVOID_UPDATE, null);
- } catch (CoreException e) {
- status = new Status(IStatus.ERROR, SSEUIPlugin.ID, IStatus.OK, "", null); //$NON-NLS-1$
- }
- return status;
- }
-
- private String getFilename() {
- String filename = SSEUIMessages.OccurrencesSearchQuery_2; //$NON-NLS-1$ "file"
- if (getFile() != null)
- filename = getFile().getName().toString();
- return filename;
- }
-
- public String getLabel() {
- String label = SSEUIMessages.OccurrencesSearchQuery_0; //$NON-NLS-1$
- String[] args = {getSearchText(), getOccurrencesCountText(), getFilename()};
- return MessageFormat.format(label, args);
- }
-
- /**
- * @return
- */
- private String getOccurrencesCountText() {
- String count = ""; //$NON-NLS-1$
- // pa_TODO dynamically change count
- return count;
- }
-
- public ISearchResult getSearchResult() {
- return new OccurrencesSearchResult(this);
- }
-
- protected String getSearchText() {
- return this.fRegionText;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchResult.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchResult.java
deleted file mode 100644
index 2f7f7129a4..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchResult.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.search;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
-import org.eclipse.search.ui.text.IEditorMatchAdapter;
-import org.eclipse.search.ui.text.IFileMatchAdapter;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImageHelper;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImages;
-
-
-/**
- * @author pavery
- */
-public class OccurrencesSearchResult extends AbstractTextSearchResult implements IEditorMatchAdapter, IFileMatchAdapter {
-
- private ISearchQuery fQuery = null;
- private final Match[] NO_MATCHES = new Match[0];
-
- public OccurrencesSearchResult(ISearchQuery query) {
- this.fQuery = query;
- }
-
- public void clearMatches() {
- if (getQuery() instanceof OccurrencesSearchQuery)
- ((OccurrencesSearchQuery) getQuery()).clearMatches();
- }
-
- /**
- * @see org.eclipse.search.ui.text.IEditorMatchAdapter#computeContainedMatches(org.eclipse.search.ui.text.AbstractTextSearchResult,
- * org.eclipse.ui.IEditorPart)
- */
- public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) {
-
- IEditorInput editorInput = editor.getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
- return computeContainedMatches(result, fileEditorInput.getFile());
- }
- return this.NO_MATCHES;
- }
-
- /**
- * @see org.eclipse.search.ui.text.IFileMatchAdapter#computeContainedMatches(org.eclipse.search.ui.text.AbstractTextSearchResult,
- * org.eclipse.core.resources.IFile)
- */
- public Match[] computeContainedMatches(AbstractTextSearchResult result, IFile file) {
- return getMatches();
- }
-
- public IEditorMatchAdapter getEditorMatchAdapter() {
- return this;
- }
-
- /**
- * @see org.eclipse.search.ui.text.IFileMatchAdapter#getFile(java.lang.Object)
- */
- public IFile getFile(Object element) {
- // return the file for the match
- IFile file = null;
- //System.out.println("get file for:"+element);
- if (element instanceof IMarker) {
- IResource r = ((IMarker) element).getResource();
- if (r instanceof IFile) {
- file = (IFile) r;
- }
- }
- return file;
- }
-
- public IFileMatchAdapter getFileMatchAdapter() {
- return this;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_OBJ_OCC_MATCH);
- }
-
- /**
- * This label shows up in the search history
- */
- public String getLabel() {
- return getQuery().getLabel();
- }
-
- public Match[] getMatches() {
- // ensure that query is done running
- return ((OccurrencesSearchQuery) getQuery()).getMatches();
- }
-
- public ISearchQuery getQuery() {
- return this.fQuery;
- }
-
- public String getTooltip() {
- return getLabel();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.search.ui.text.IEditorMatchAdapter#isShownInEditor(org.eclipse.search.ui.text.Match,
- * org.eclipse.ui.IEditorPart)
- */
- public boolean isShownInEditor(Match match, IEditorPart editor) {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchViewPage.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchViewPage.java
deleted file mode 100644
index 2d54131c92..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/OccurrencesSearchViewPage.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.search;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-
-/**
- * Base page for Occurrences in file search results.
- *
- * @author pavery
- */
-public class OccurrencesSearchViewPage extends AbstractTextSearchViewPage {
-
- private OccurrencesContentProvider fContentProvider = null;
-
- public OccurrencesSearchViewPage() {
- super(AbstractTextSearchViewPage.FLAG_LAYOUT_FLAT);
- }
-
- /**
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#clear()
- */
- protected void clear() {
- if (this.fContentProvider != null)
- this.fContentProvider.clear();
- }
-
- /**
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#configureTableViewer(org.eclipse.jface.viewers.TableViewer)
- */
- protected void configureTableViewer(TableViewer viewer) {
-
- // pa_TODO need sorter?
- viewer.setLabelProvider(new BasicSearchLabelProvider());
- this.fContentProvider = new OccurrencesContentProvider();
- viewer.setContentProvider(this.fContentProvider);
- }
-
- /**
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#configureTreeViewer(org.eclipse.jface.viewers.TreeViewer)
- */
- protected void configureTreeViewer(TreeViewer viewer) {
- // not supported at the moment
- }
-
- /**
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#elementsChanged(java.lang.Object[])
- */
- protected void elementsChanged(Object[] objects) {
- if (this.fContentProvider != null) {
- this.fContentProvider.elementsChanged(objects);
- }
- }
-
- public void forceRefresh() {
- this.fContentProvider.refresh();
- }
-
- private IWorkbenchPage getActivePage() {
-
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- if (window == null)
- return null;
- return workbench.getActiveWorkbenchWindow().getActivePage();
- }
-
- /**
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#getDisplayedMatches(java.lang.Object)
- */
- public Match[] getDisplayedMatches(Object element) {
- // https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=2640
- // we only ever show one at a time, the element passed in is the match
- // super was returning null
- return new Match[]{(Match) element};
- }
-
- private void show(IMarker marker) {
-
- IResource resource = marker.getResource();
- if (resource == null || !resource.exists())
- return;
-
- IWorkbenchPage activePage = getActivePage();
- try {
- if (activePage != null) {
-
- // open editor if needed
- IDE.openEditor(getActivePage(), marker);
-
- IEditorPart editor = activePage.getActiveEditor();
- if (editor != null) {
- IGotoMarker gotoMarker = (IGotoMarker) editor.getAdapter(IGotoMarker.class);
- if (gotoMarker != null)
- gotoMarker.gotoMarker(marker);
- }
-
- }
- } catch (PartInitException e) {
- // possible exception trying to open editor
- Logger.logException(e);
- }
- }
-
- /**
- * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#showMatch(org.eclipse.search.ui.text.Match,
- * int, int)
- */
- protected void showMatch(Match match, int currentOffset, int currentLength) throws PartInitException {
- Object o = match.getElement();
- if (o instanceof IMarker) {
- show((IMarker) o);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/SelectionHistory.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/SelectionHistory.java
deleted file mode 100644
index a235234a8b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/SelectionHistory.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.selection;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-public class SelectionHistory {
- private ITextEditor fEditor;
- private List fHistory;
- private List fHistoryActions;
- private int fSelectionChangeListenerCounter;
- private ISelectionChangedListener fSelectionListener;
-
- public SelectionHistory(ITextEditor editor) {
- Assert.isNotNull(editor);
- fEditor = editor;
- fHistory = new ArrayList(3);
- fSelectionListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (fSelectionChangeListenerCounter == 0)
- flush();
- }
- };
- fEditor.getSelectionProvider().addSelectionChangedListener(fSelectionListener);
- }
-
- public void dispose() {
- fEditor.getSelectionProvider().removeSelectionChangedListener(fSelectionListener);
- fEditor = null;
- if (fHistory != null && !fHistory.isEmpty()) {
- fHistory.clear();
- }
- if (fHistoryActions != null && !fHistoryActions.isEmpty()) {
- fHistoryActions.clear();
- }
- }
-
- public void flush() {
- if (fHistory.isEmpty())
- return;
- fHistory.clear();
- updateHistoryAction();
- }
-
- public IRegion getLast() {
- if (isEmpty())
- return null;
- int size = fHistory.size();
- IRegion result = (IRegion) fHistory.remove(size - 1);
- updateHistoryAction();
- return result;
- }
-
- public void ignoreSelectionChanges() {
- fSelectionChangeListenerCounter++;
- }
-
- public boolean isEmpty() {
- return fHistory.isEmpty();
- }
-
- public void listenToSelectionChanges() {
- fSelectionChangeListenerCounter--;
- }
-
- public void remember(IRegion region) {
- fHistory.add(region);
- updateHistoryAction();
- }
-
- public void setHistoryAction(IAction action) {
- Assert.isNotNull(action);
-
- if (fHistoryActions == null)
- fHistoryActions = new ArrayList();
- if (!fHistoryActions.contains(action))
- fHistoryActions.add(action);
-
- // update action
- if (fHistory != null && !fHistory.isEmpty())
- action.setEnabled(true);
- else
- action.setEnabled(false);
- }
-
- private void updateHistoryAction() {
- if (fHistoryActions != null && !fHistoryActions.isEmpty()) {
- boolean enabled = false;
- if (fHistory != null && !fHistory.isEmpty())
- enabled = true;
-
- Iterator iter = fHistoryActions.iterator();
- while (iter.hasNext()) {
- ((IAction)iter.next()).setEnabled(enabled);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectAction.java
deleted file mode 100644
index 7c8f2f20ea..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectAction.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.selection;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.w3c.dom.Node;
-
-/**
- * @deprecated use StructuredSelectActionDelegate instead
- */
-
-public abstract class StructureSelectAction extends Action {
- protected StructuredTextEditor fEditor = null;
- protected SelectionHistory fHistory;
- protected IStructuredModel fModel = null;
- protected StructuredTextViewer fViewer = null;
-
- public StructureSelectAction(StructuredTextEditor editor) {
- super();
-
- Assert.isNotNull(editor);
- fEditor = editor;
- fHistory = (SelectionHistory) editor.getAdapter(SelectionHistory.class);
- fViewer = editor.getTextViewer();
- fModel = editor.getModel();
- Assert.isNotNull(fViewer);
- }
-
- abstract protected IndexedRegion getCursorIndexedRegion();
-
- protected IndexedRegion getIndexedRegion(int offset) {
- IndexedRegion indexedRegion = null;
-
- int lastOffset = offset;
- IDocument document = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
- IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
- if (model != null) {
- try {
- indexedRegion = model.getIndexedRegion(lastOffset);
- while (indexedRegion == null && lastOffset >= 0) {
- lastOffset--;
- indexedRegion = model.getIndexedRegion(lastOffset);
- }
- }
- finally {
- model.releaseFromRead();
- }
- }
-
- return indexedRegion;
- }
-
- abstract protected Region getNewSelectionRegion(Node node, Region region);
-
- public void run() {
- Region currentRegion = new Region(fViewer.getSelectedRange().x, fViewer.getSelectedRange().y);
- if (currentRegion.getLength() == fViewer.getDocument().getLength())
- return;
-
- IndexedRegion cursorIndexedRegion = getCursorIndexedRegion();
- if (cursorIndexedRegion instanceof Node) {
- Node cursorNode = (Node) cursorIndexedRegion;
-
- // use parent node for empty text node
- if (cursorNode.getNodeType() == Node.TEXT_NODE && cursorNode.getNodeValue().trim().length() == 0) {
- cursorNode = cursorNode.getParentNode();
-
- if (cursorNode instanceof IndexedRegion)
- cursorIndexedRegion = (IndexedRegion) cursorNode;
- }
-
- Region cursorNodeRegion = new Region(cursorIndexedRegion.getStartOffset(), cursorIndexedRegion.getEndOffset() - cursorIndexedRegion.getStartOffset());
-
- Region newRegion = null;
- if (cursorNodeRegion.getOffset() >= currentRegion.getOffset() && cursorNodeRegion.getOffset() <= currentRegion.getOffset() + currentRegion.getLength() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentRegion.getOffset() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentRegion.getOffset() + currentRegion.getLength())
- newRegion = getNewSelectionRegion(cursorNode, currentRegion);
- else
- newRegion = cursorNodeRegion;
-
- if (newRegion != null) {
- fHistory.remember(currentRegion);
- try {
- fHistory.ignoreSelectionChanges();
- fEditor.selectAndReveal(newRegion.getOffset(), newRegion.getLength());
- }
- finally {
- fHistory.listenToSelectionChanges();
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectHistoryAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectHistoryAction.java
deleted file mode 100644
index c697450bae..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectHistoryAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.selection;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.ui.texteditor.IUpdate;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.w3c.dom.Node;
-
-public class StructureSelectHistoryAction extends StructureSelectAction implements IUpdate {
- public StructureSelectHistoryAction(StructuredTextEditor editor) {
- super(editor);
- setText(SSEUIMessages.StructureSelectHistory_label); //$NON-NLS-1$
- setToolTipText(SSEUIMessages.StructureSelectHistory_tooltip); //$NON-NLS-1$
- setDescription(SSEUIMessages.StructureSelectHistory_description); //$NON-NLS-1$
-
- update();
- }
-
- protected IndexedRegion getCursorIndexedRegion() {
- return null;
- }
-
- protected Region getNewSelectionRegion(Node node, Region region) {
- return null;
- }
-
- public void run() {
- IRegion old = fHistory.getLast();
- if (old != null) {
- try {
- fHistory.ignoreSelectionChanges();
- fEditor.selectAndReveal(old.getOffset(), old.getLength());
- } finally {
- fHistory.listenToSelectionChanges();
- }
- }
- }
-
- public void update() {
- setEnabled(!fHistory.isEmpty());
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectActionDelegate.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectActionDelegate.java
deleted file mode 100644
index 850c24b8f1..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectActionDelegate.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- *
- *******************************************************************************/
-
-package org.eclipse.wst.sse.ui.internal.selection;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IActionDelegate2;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-
-abstract public class StructuredSelectActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
- private IEditorPart fEditor;
- private SelectionHistory fHistory;
-
- public void dispose() {
- fEditor = null;
- fHistory = null;
- }
-
- public void init(IViewPart view) {
- // do nothing
- }
-
- public void runWithEvent(IAction action, Event event) {
- run(action);
- }
-
- public void run(IAction action) {
- if (fEditor instanceof ITextEditor) {
- ITextEditor textEditor = (ITextEditor) fEditor;
-
- ISelection selection = textEditor.getSelectionProvider().getSelection();
- IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
- // determine current text selection
- if (selection instanceof ITextSelection && document != null) {
- ITextSelection textSelection = (ITextSelection) selection;
-
- if (textSelection.getLength() < document.getLength()) {
- // get current indexed region
- IndexedRegion cursorIndexedRegion = getCursorIndexedRegion(document, textSelection);
-
- // determine new selection based on current indexed region
- Region newSelectionRegion = getNewSelectionRegion(cursorIndexedRegion, textSelection);
-
- // select new selection
- if (newSelectionRegion != null) {
- fHistory.remember(new Region(textSelection.getOffset(), textSelection.getLength()));
- try {
- fHistory.ignoreSelectionChanges();
- textEditor.selectAndReveal(newSelectionRegion.getOffset(), newSelectionRegion.getLength());
- }
- finally {
- fHistory.listenToSelectionChanges();
- }
- }
- }
- }
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- fEditor = targetEditor;
- if (fEditor != null)
- fHistory = (SelectionHistory) fEditor.getAdapter(SelectionHistory.class);
- else
- fHistory = null;
- }
-
- abstract protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection);
-
- abstract protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection);
-
- /**
- * This method will probably be removed and replaced by using new selection provider
- * @param document
- * @param offset
- * @return
- */
- protected IndexedRegion getIndexedRegion(IDocument document, int offset) {
- IndexedRegion indexedRegion = null;
-
- int lastOffset = offset;
- IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
- if (model != null) {
- try {
- indexedRegion = model.getIndexedRegion(lastOffset);
- while (indexedRegion == null && lastOffset >= 0) {
- lastOffset--;
- indexedRegion = model.getIndexedRegion(lastOffset);
- }
- }
- finally {
- model.releaseFromRead();
- }
- }
-
- return indexedRegion;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectHistoryActionDelegate.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectHistoryActionDelegate.java
deleted file mode 100644
index 47dc5c8964..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectHistoryActionDelegate.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- *
- *******************************************************************************/
-
-package org.eclipse.wst.sse.ui.internal.selection;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IActionDelegate2;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-/**
- * Selection history action delegate. Keeps track of selection within editor.
- */
-public class StructuredSelectHistoryActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
- private IEditorPart fEditor;
- private SelectionHistory fHistory;
-
- public void dispose() {
- fEditor = null;
- fHistory = null;
- }
-
- public void init(IAction action) {
- if (action != null) {
- action.setText(SSEUIMessages.StructureSelectHistory_label);
- action.setToolTipText(SSEUIMessages.StructureSelectHistory_tooltip);
- action.setDescription(SSEUIMessages.StructureSelectHistory_description);
- }
- }
-
- public void init(IViewPart view) {
- // do nothing
- }
-
- public void run(IAction action) {
- IRegion old = fHistory.getLast();
- if (old != null) {
- try {
- fHistory.ignoreSelectionChanges();
- if (fEditor instanceof ITextEditor)
- ((ITextEditor) fEditor).selectAndReveal(old.getOffset(), old.getLength());
- }
- finally {
- fHistory.listenToSelectionChanges();
- }
- }
- }
-
- public void runWithEvent(IAction action, Event event) {
- run(action);
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- fEditor = targetEditor;
- if (fEditor != null)
- fHistory = (SelectionHistory) fEditor.getAdapter(SelectionHistory.class);
- else
- fHistory = null;
- if (fHistory != null) {
- fHistory.setHistoryAction(action);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java
deleted file mode 100644
index 692779a5f0..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/spelling/SpellcheckStrategy.java
+++ /dev/null
@@ -1,424 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.spelling;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentExtension3;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.reconciler.IReconcileResult;
-import org.eclipse.jface.text.reconciler.IReconcileStep;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.IAnnotationModelExtension;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-import org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector;
-import org.eclipse.ui.texteditor.spelling.SpellingContext;
-import org.eclipse.ui.texteditor.spelling.SpellingEngineDescriptor;
-import org.eclipse.ui.texteditor.spelling.SpellingProblem;
-import org.eclipse.ui.texteditor.spelling.SpellingService;
-import org.eclipse.wst.sse.core.internal.parser.ForeignRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.reconcile.DocumentAdapter;
-import org.eclipse.wst.sse.ui.internal.reconcile.ReconcileAnnotationKey;
-import org.eclipse.wst.sse.ui.internal.reconcile.StructuredReconcileStep;
-import org.eclipse.wst.sse.ui.internal.reconcile.StructuredTextReconcilingStrategy;
-import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
-
-/**
- * A reconciling strategy that queries the SpellingService using its default
- * engine. Results are show as temporary annotations.
- *
- * @since 1.5
- */
-public class SpellcheckStrategy extends StructuredTextReconcilingStrategy {
-
- class SpellCheckPreferenceListener implements IPropertyChangeListener {
- private boolean isInterestingProperty(Object property) {
- return SpellingService.PREFERENCE_SPELLING_ENABLED.equals(property) || SpellingService.PREFERENCE_SPELLING_ENGINE.equals(property);
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- if (isInterestingProperty(event.getProperty())) {
- if (event.getOldValue() == null || event.getNewValue() == null || !event.getNewValue().equals(event.getOldValue())) {
- reconcile();
- }
- }
- }
- }
-
- private class SpellingProblemCollector implements ISpellingProblemCollector {
- List annotations = new ArrayList();
-
- public void accept(SpellingProblem problem) {
- if (!isInterestingProblem(problem))
- return;
-
- TemporaryAnnotation annotation = new TemporaryAnnotation(new Position(problem.getOffset(), problem.getLength()), TemporaryAnnotation.ANNOT_WARNING, problem.getMessage(), fReconcileAnnotationKey);
- /*
- * TODO: create and use an IQuickFixProcessor that uses
- * problem.getProposals() for fixes [note, the default engine
- * doesn't propose fixes, at least without a dictionary].
- */
- annotation.setAdditionalFixInfo(problem);
- annotations.add(annotation);
- if (_DEBUG_SPELLING) {
- Logger.log(Logger.INFO_DEBUG, problem.getMessage());
- }
- }
-
- public void beginCollecting() {
- }
-
- void clear() {
- annotations.clear();
- }
-
- public void endCollecting() {
- }
-
- /**
- * Judge whether a spelling problem is "interesting". Accept any
- * regions that are explictly allowed, and since valid prose areas are
- * rarely in a complicated document region, accept any document region
- * with more than one text region and reject any document regions
- * containing foreign text regions.
- *
- * @param problem
- * a SpellingProblem
- * @return whether the collector should accept the given
- * SpellingProblem
- */
- boolean isInterestingProblem(SpellingProblem problem) {
- if (getDocument() instanceof IStructuredDocument) {
- IStructuredDocumentRegion documentRegion = ((IStructuredDocument) getDocument()).getRegionAtCharacterOffset(problem.getOffset());
- if (documentRegion != null) {
- ITextRegion textRegion = documentRegion.getRegionAtCharacterOffset(problem.getOffset());
- if (textRegion != null) {
- return true;
- }
- if (documentRegion.getFirstRegion() instanceof ForeignRegion)
- return false;
- if (documentRegion.getRegions().size() == 1)
- return true;
- return false;
- }
- }
- return true;
- }
-
- IReconcileResult[] getResults() {
- return (IReconcileResult[]) annotations.toArray(new IReconcileResult[annotations.size()]);
- }
- }
-
- private class SpellingStep extends StructuredReconcileStep {
- protected IReconcileResult[] reconcileModel(final DirtyRegion dirtyRegion, IRegion subRegion) {
- SpellingService service = getSpellingService(fContentTypeId + "." + SpellingService.PREFERENCE_SPELLING_ENGINE); //$NON-NLS-1$
- if (_DEBUG_SPELLING) {
- Logger.log(Logger.INFO_DEBUG, "Spell checking [" + subRegion.getOffset() + "-" + (subRegion.getOffset() + subRegion.getLength()) + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- if (getDocument() != null) {
- service.check(getDocument(), new IRegion[]{subRegion}, fSpellingContext, fProblemCollector, getProgressMonitor());
- }
- IReconcileResult[] results = fProblemCollector.getResults();
- fProblemCollector.clear();
- return results;
- }
- }
-
- static final boolean _DEBUG_SPELLING = Boolean.valueOf(Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerSpelling")).booleanValue(); //$NON-NLS-1$
-
- static final String ANNOTATION_TYPE = "org.eclipse.wst.sse.ui.temp.spelling"; //$NON-NLS-1$
-
- private static final String EXTENDED_BUILDER_TYPE = "spellingsupport"; //$NON-NLS-1$
- static final String KEY_CONTENT_TYPE = "org.eclipse.wst.sse.ui.temp.spelling"; //$NON-NLS-1$
-
- private String fContentTypeId = null;
-
- private String fDocumentPartitioning;
-
- SpellingProblemCollector fProblemCollector = new SpellingProblemCollector();
-
- /*
- * Keying our Temporary Annotations based on the partition doesn't help
- * this strategy to only remove its own TemporaryAnnotations since it's
- * possibly run on all partitions. Instead, set the key to use an
- * arbitrary partition type that we can check for using our own
- * implementation of getAnnotationsToRemove(DirtyRegion).
- *
- * Value initialized through
- *
- * super(ISourceViewer)->super.init()->createReconcileSteps()
- */
- ReconcileAnnotationKey fReconcileAnnotationKey;
- private IPropertyChangeListener fSpellCheckPreferenceListener;
-
- SpellingContext fSpellingContext;
-
- /*
- * Value initialized through
- *
- * super(ISourceViewer)->super.init()->createReconcileSteps()
- */
- IReconcileStep fSpellingStep;
-
- String[] fSupportedPartitionTypes;
-
- public SpellcheckStrategy(ISourceViewer viewer, String contentTypeId) {
- super(viewer);
- fContentTypeId = contentTypeId;
-
- fSpellingContext = new SpellingContext();
- fSpellingContext.setContentType(Platform.getContentTypeManager().getContentType(fContentTypeId));
- fReconcileAnnotationKey = new ReconcileAnnotationKey(fSpellingStep, KEY_CONTENT_TYPE, ReconcileAnnotationKey.PARTIAL);
-
- String[] definitions = ExtendedConfigurationBuilder.getInstance().getDefinitions(EXTENDED_BUILDER_TYPE, fContentTypeId);
- List defs = new ArrayList();
- for (int i = 0; i < definitions.length; i++) {
- defs.addAll(Arrays.asList(StringUtils.unpack(definitions[i])));
- }
- fSupportedPartitionTypes = (String[]) defs.toArray(new String[defs.size()]);
-
- fSpellCheckPreferenceListener = new SpellCheckPreferenceListener();
- }
-
- protected boolean containsStep(IReconcileStep step) {
- return fSpellingStep.equals(step);
- }
-
- public void createReconcileSteps() {
- fSpellingStep = new SpellingStep();
- }
-
- String getDocumentPartitioning() {
- return fDocumentPartitioning == null ? IDocumentExtension3.DEFAULT_PARTITIONING : fDocumentPartitioning;
- }
-
- private TemporaryAnnotation[] getSpellingAnnotationsToRemove(IRegion region) {
- List toRemove = new ArrayList();
- IAnnotationModel annotationModel = getAnnotationModel();
- // can be null when closing the editor
- if (getAnnotationModel() != null) {
- Iterator i = annotationModel.getAnnotationIterator();
- while (i.hasNext()) {
- Object obj = i.next();
- if (!(obj instanceof TemporaryAnnotation))
- continue;
-
- TemporaryAnnotation annotation = (TemporaryAnnotation) obj;
- ReconcileAnnotationKey key = (ReconcileAnnotationKey) annotation.getKey();
-
- // then if this strategy knows how to add/remove this
- // partition type
- if (key != null && key.equals(fReconcileAnnotationKey)) {
- Position position = annotation.getPosition();
- if (key.getScope() == ReconcileAnnotationKey.PARTIAL && position.overlapsWith(region.getOffset(), region.getLength())) {
- toRemove.add(annotation);
- }
- else if (key.getScope() == ReconcileAnnotationKey.TOTAL) {
- toRemove.add(annotation);
- }
- }
- }
- }
-
- return (TemporaryAnnotation[]) toRemove.toArray(new TemporaryAnnotation[toRemove.size()]);
- }
-
- /**
- * @param engineID
- * @return the SpellingService with the preferred engine
- */
- SpellingService getSpellingService(String engineID) {
- SpellingService defaultService = EditorsUI.getSpellingService();
-
- SpellingService preferredService = defaultService;
-
- if (engineID != null) {
- /*
- * Set up a preference store indicating that the given engine
- * should be used instead of the default preference store's
- * default
- */
- SpellingEngineDescriptor[] descriptors = defaultService.getSpellingEngineDescriptors();
- for (int i = 0; i < descriptors.length; i++) {
- if (engineID.equals(descriptors[i].getId())) {
- IPreferenceStore store = new ScopedPreferenceStore(new InstanceScope(), SSEUIPlugin.getDefault().getBundle().getSymbolicName());
- store.setValue(SpellingService.PREFERENCE_SPELLING_ENGINE, engineID);
- preferredService = new SpellingService(store);
- break;
- }
- }
- }
- return preferredService;
- }
-
- private boolean isSupportedPartitionType(String type) {
- boolean supported = false;
- if (fSupportedPartitionTypes == null || fSupportedPartitionTypes.length == 0) {
- supported = true;
- }
- else {
- for (int i = 0; i < fSupportedPartitionTypes.length; i++) {
- if (type.equals(fSupportedPartitionTypes[i])) {
- supported = true;
- break;
- }
- }
- }
- return supported;
- }
-
- void reconcile() {
- IDocument document = getDocument();
- if (document != null) {
- IRegion documentRegion = new Region(0, document.getLength());
- reconcile(documentRegion);
- }
- }
-
- /**
- * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion,
- * org.eclipse.jface.text.IRegion)
- */
- public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
- if (isCanceled())
- return;
-
- IAnnotationModel annotationModel = getAnnotationModel();
-
- IDocument document = getDocument();
- if (document != null) {
- try {
- /**
- * Apparently the default spelling engine has noticeable
- * overhead for each call made to it, as well as the
- * IAnnotatioModel updates we would perform for each. It's
- * faster to check the entire dirty region at once if we know
- * that we're not differentiating by partition.
- *
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=192530
- */
- if (checkByPartitions()) {
- ITypedRegion[] partitions = TextUtilities.computePartitioning(document, getDocumentPartitioning(), dirtyRegion.getOffset(), dirtyRegion.getLength(), true);
- for (int i = 0; i < partitions.length; i++) {
- if (isSupportedPartitionType(partitions[i].getType())) {
- spellCheck(dirtyRegion, partitions[i], annotationModel);
- }
- }
- }
- else {
- spellCheck(dirtyRegion, dirtyRegion, annotationModel);
- }
- }
- catch (BadLocationException e) {
- }
- }
- }
-
- boolean checkByPartitions() {
- return (fSupportedPartitionTypes != null && fSupportedPartitionTypes.length > 0);
- }
-
- private void spellCheck(DirtyRegion dirtyRegion, IRegion regionToBeChecked, IAnnotationModel annotationModel) {
- StructuredReconcileStep structuredStep = (StructuredReconcileStep) fSpellingStep;
-
- TemporaryAnnotation[] annotationsToRemove;
- IReconcileResult[] annotationsToAdd;
- annotationsToRemove = getSpellingAnnotationsToRemove(regionToBeChecked);
- annotationsToAdd = structuredStep.reconcile(dirtyRegion, regionToBeChecked);
-
- if (annotationModel instanceof IAnnotationModelExtension) {
- IAnnotationModelExtension modelExtension = (IAnnotationModelExtension) annotationModel;
- Map annotationsToAddMap = new HashMap();
- for (int i = 0; i < annotationsToAdd.length; i++) {
- annotationsToAddMap.put(annotationsToAdd[i], ((TemporaryAnnotation) annotationsToAdd[i]).getPosition());
- }
- modelExtension.replaceAnnotations(annotationsToRemove, annotationsToAddMap);
- }
-
- else {
- for (int j = 0; j < annotationsToAdd.length; j++) {
- annotationModel.addAnnotation((TemporaryAnnotation) annotationsToAdd[j], ((TemporaryAnnotation) annotationsToAdd[j]).getPosition());
- }
- for (int j = 0; j < annotationsToRemove.length; j++) {
- annotationModel.removeAnnotation(annotationsToRemove[j]);
- }
- }
- }
-
- /**
- * @param partition
- * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion)
- */
-
- public void reconcile(IRegion partition) {
- DirtyRegion region = null;
- IDocument document = getDocument();
- if (document != null) {
- try {
- region = new DirtyRegion(partition.getOffset(), partition.getLength(), DirtyRegion.INSERT, document.get(partition.getOffset(), partition.getLength()));
- reconcile(region, region);
- }
- catch (BadLocationException e) {
- Logger.logException(e);
- }
- }
- }
-
- public void setDocument(IDocument document) {
- if (getDocument() != null) {
- EditorsUI.getPreferenceStore().removePropertyChangeListener(fSpellCheckPreferenceListener);
- }
-
- super.setDocument(document);
- if (document != null) {
- if (fSpellingStep == null) {
- createReconcileSteps();
- }
- fSpellingStep.setInputModel(new DocumentAdapter(document));
- }
-
- if (getDocument() != null) {
- EditorsUI.getPreferenceStore().addPropertyChangeListener(fSpellCheckPreferenceListener);
- }
- }
-
- public void setDocumentPartitioning(String partitioning) {
- fDocumentPartitioning = partitioning;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/AbstractHoverProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/AbstractHoverProcessor.java
deleted file mode 100644
index 0ea279fe85..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/AbstractHoverProcessor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.taginfo;
-
-import org.eclipse.jface.bindings.TriggerSequence;
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.ITextHoverExtension;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.keys.IBindingService;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
-import org.eclipse.wst.sse.ui.internal.derived.HTMLTextPresenter;
-
-/**
- * Abstract class for providing hover information for Source editor. Includes
- * a hover control creator which has the "Press F2 for focus" message built
- * in.
- *
- * @since WTP 1.5
- */
-abstract public class AbstractHoverProcessor implements ITextHover, ITextHoverExtension {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.ITextHoverExtension#getHoverControlCreator()
- */
- public IInformationControlCreator getHoverControlCreator() {
- return new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, SWT.NONE, new HTMLTextPresenter(true), getTooltipAffordanceString());
- }
- };
- }
-
- /**
- * Returns the short cut assigned to the sub menu or <code>null</code>
- * if no short cut is assigned.
- *
- * @return the short cut as a human readable string or <code>null</code>
- */
- private String getShortCutString() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- final IBindingService bindingService = (IBindingService) workbench.getAdapter(IBindingService.class);
- final TriggerSequence[] activeBindings = bindingService.getActiveBindingsFor(ActionDefinitionIds.INFORMATION);
- if (activeBindings.length > 0) {
- return activeBindings[0].format();
- }
-
- return null;
- }
-
- /**
- * Returns the tool tip affordance string.
- *
- * @return the affordance string or <code>null</code> if disabled or no
- * key binding is defined
- * @since 3.0
- */
- private String getTooltipAffordanceString() {
- String sticky = null;
- String keySequence = getShortCutString();
- if (keySequence != null) {
- sticky = NLS.bind(SSEUIMessages.textHoverMakeStickyHint, keySequence);
- }
- return sticky;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/AnnotationHoverProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/AnnotationHoverProcessor.java
deleted file mode 100644
index 5e8475ac55..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/AnnotationHoverProcessor.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.taginfo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.ui.editors.text.EditorsUI;
-import org.eclipse.ui.texteditor.AnnotationPreference;
-import org.eclipse.ui.texteditor.ChainedPreferenceStore;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.sse.ui.internal.ITemporaryAnnotation;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-
-/**
- * Hover help that displays annotations shown in text of editor. Currently,
- * this text hover is used in conjunction with AbstractTextHoverProcessor.
- *
- * @author amywu
- */
-public class AnnotationHoverProcessor extends AbstractHoverProcessor {
- private final static String LIST_BEGIN = "<ul>"; //$NON-NLS-1$
- private final static String LIST_ELEMENT = "<li>"; //$NON-NLS-1$
- private final static String PARAGRAPH_END = "</p>"; //$NON-NLS-1$
- private final static String PARAGRAPH_START = "<p>"; //$NON-NLS-1$
-
- private IPreferenceStore fPreferenceStore = null;
-
- /**
- *
- */
- public AnnotationHoverProcessor() {
- super();
- }
-
- /**
- * Formats a msg to a proper html message
- *
- * @param msg -
- * assumes msg is neither null nor empty string
- * @return
- */
- private String formatMessage(String msg) {
- StringBuffer buf = new StringBuffer();
- buf.append(PARAGRAPH_START);
- buf.append(StringUtils.convertToHTMLContent(msg));
- buf.append(PARAGRAPH_END);
- return buf.toString();
- }
-
- /**
- * Formats multiple messages into proper html message
- *
- * @param messages
- * @return
- */
- private String formatMessages(List messages) {
- StringBuffer buffer = new StringBuffer();
- buffer.append(PARAGRAPH_START);
- buffer.append(SSEUIMessages.Multiple_errors); //$NON-NLS-1$
- buffer.append(LIST_BEGIN);
-
- Iterator e = messages.iterator();
- while (e.hasNext()) {
- buffer.append(LIST_ELEMENT);
- buffer.append(StringUtils.convertToHTMLContent((String) e.next()));
- }
- buffer.append(PARAGRAPH_END);
- return buffer.toString();
- }
-
- /**
- * Returns the annotation preference for the given annotation. (copied
- * from org.eclipse.jdt.internal.ui.text.java.hover.AnnotationHover)
- *
- * @param annotation
- * the annotation
- * @return the annotation preference or <code>null</code> if none
- */
- private AnnotationPreference getAnnotationPreference(Annotation annotation) {
-
- if (annotation.isMarkedDeleted())
- return null;
- return EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
- }
-
- public String getHoverInfo(ITextViewer viewer, IRegion hoverRegion) {
- IAnnotationModel model = ((SourceViewer) viewer).getAnnotationModel();
- if (model != null) {
- List messages = new ArrayList();
- Iterator e = model.getAnnotationIterator();
- while (e.hasNext()) {
- Annotation a = (Annotation) e.next();
- if (!isAnnotationValid(a))
- continue;
-
- Position p = model.getPosition(a);
- // check if this is an annotation in the region we are
- // concerned with
- if (p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
- String msg = a.getText();
- if ((msg != null) && msg.trim().length() > 0) {
- // it is possible for temporary annotations to
- // duplicate other annotations so make sure not to add
- // dups
- if (a instanceof ITemporaryAnnotation) {
- boolean duplicated = false;
- int j = 0;
- while (j < messages.size() && !duplicated) {
- duplicated = messages.get(j).equals(msg);
- ++j;
- }
- if (!duplicated) {
- messages.add(msg);
- }
- }
- else {
- messages.add(msg);
- }
- }
- }
- }
- if (messages.size() > 1) {
- return formatMessages(messages);
- }
- else if (messages.size() > 0) {
- return formatMessage(messages.get(0).toString());
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer,
- * int)
- */
- public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
- IAnnotationModel model = ((SourceViewer) textViewer).getAnnotationModel();
- Region hoverRegion = null;
-
- if (model != null) {
- Iterator e = model.getAnnotationIterator();
- while (e.hasNext()) {
- Annotation a = (Annotation) e.next();
- if (!isAnnotationValid(a))
- continue;
- Position p = model.getPosition(a);
- if (p.includes(offset)) {
- // find the smallest region containing offset
- if ((hoverRegion == null) || (hoverRegion.getLength() > p.getLength())) {
- hoverRegion = new Region(p.getOffset(), p.getLength());
- }
- }
- }
- }
- return hoverRegion;
- }
-
- /**
- * Retreives the preference store If no preference store is currently
- * stored, retreive the appropriate preference store
- */
- private IPreferenceStore getPreferenceStore() {
- if (fPreferenceStore == null) {
- IPreferenceStore sseEditorPrefs = SSEUIPlugin.getDefault().getPreferenceStore();
- IPreferenceStore baseEditorPrefs = EditorsUI.getPreferenceStore();
- fPreferenceStore = new ChainedPreferenceStore(new IPreferenceStore[]{sseEditorPrefs, baseEditorPrefs});
- }
- return fPreferenceStore;
- }
-
- boolean isAnnotationValid(Annotation a) {
- AnnotationPreference preference = getAnnotationPreference(a);
- if (preference == null)
- return false;
- String textPreferenceKey = preference.getTextPreferenceKey();
- String highlightPreferenceKey = preference.getHighlightPreferenceKey();
- if (textPreferenceKey == null || !(getPreferenceStore().getBoolean(textPreferenceKey)) || highlightPreferenceKey == null || getPreferenceStore().getBoolean(highlightPreferenceKey))
- return false;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/BestMatchHover.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/BestMatchHover.java
deleted file mode 100644
index 3e1c66c9a1..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/BestMatchHover.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.taginfo;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.ITextHoverExtension;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-/**
- * Provides the best hover help documentation (by using other hover help
- * processors) Priority of hover help processors is: ProblemHoverProcessor,
- * TagInfoProcessor, AnnotationHoverProcessor
- */
-public class BestMatchHover implements ITextHover, ITextHoverExtension {
- private ITextHover fBestMatchHover; // current best match text hover
- private ITextHover fTagInfoHover; // documentation/information hover
- private List fTextHovers; // list of text hovers to consider in best
- // match
-
- public BestMatchHover(ITextHover infotaghover) {
- fTagInfoHover = infotaghover;
- }
-
- /**
- * Create a list of text hovers applicable to this best match hover
- * processor
- *
- * @return List of ITextHover - in abstract class this is empty list
- */
- private List createTextHoversList() {
- List hoverList = new ArrayList();
- // if currently debugging, then add the debug hover to the list of
- // best match
- if (Logger.isTracing(DebugInfoHoverProcessor.TRACEFILTER)) {
- hoverList.add(new DebugInfoHoverProcessor());
- }
-
- hoverList.add(new ProblemAnnotationHoverProcessor());
- if (fTagInfoHover != null) {
- hoverList.add(fTagInfoHover);
- }
- hoverList.add(new AnnotationHoverProcessor());
- return hoverList;
- }
-
- public IInformationControlCreator getHoverControlCreator() {
- IInformationControlCreator creator = null;
-
- if (fBestMatchHover instanceof ITextHoverExtension) {
- creator = ((ITextHoverExtension) fBestMatchHover).getHoverControlCreator();
- }
- return creator;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer,
- * org.eclipse.jface.text.IRegion)
- */
- public String getHoverInfo(ITextViewer viewer, IRegion hoverRegion) {
- String displayText = null;
-
- // already have a best match hover picked out from getHoverRegion call
- if (fBestMatchHover != null) {
- displayText = fBestMatchHover.getHoverInfo(viewer, hoverRegion);
- }
- // either had no best match hover or best match hover returned null
- if (displayText == null) {
- // go through list of text hovers and return first display string
- Iterator i = getTextHovers().iterator();
- while ((i.hasNext()) && (displayText == null)) {
- ITextHover hover = (ITextHover) i.next();
- displayText = hover.getHoverInfo(viewer, hoverRegion);
- }
- }
- return displayText;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer,
- * int)
- */
- public IRegion getHoverRegion(ITextViewer viewer, int offset) {
- IRegion hoverRegion = null;
-
- // go through list of text hovers and return first hover region
- ITextHover hover = null;
- Iterator i = getTextHovers().iterator();
- while ((i.hasNext()) && (hoverRegion == null)) {
- hover = (ITextHover) i.next();
- hoverRegion = hover.getHoverRegion(viewer, offset);
- }
-
- // store the text hover processor that found region
- if (hoverRegion != null)
- fBestMatchHover = hover;
- else
- fBestMatchHover = null;
-
- return hoverRegion;
- }
-
- private List getTextHovers() {
- if (fTextHovers == null) {
- fTextHovers = createTextHoversList();
- }
- return fTextHovers;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/DebugInfoHoverProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/DebugInfoHoverProcessor.java
deleted file mode 100644
index 2e292a5433..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/DebugInfoHoverProcessor.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.taginfo;
-
-
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.ITypedRegion;
-
-/**
- * Provides debug hover help
- *
- * @see org.eclipse.jface.text.ITextHover
- */
-public class DebugInfoHoverProcessor extends AbstractHoverProcessor {
- public static final String TRACEFILTER = "debuginfohover"; //$NON-NLS-1$
- protected IPreferenceStore fPreferenceStore = null;
-
- public DebugInfoHoverProcessor() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer,
- * org.eclipse.jface.text.IRegion)
- */
- public String getHoverInfo(ITextViewer viewer, IRegion hoverRegion) {
- String displayText = null;
- if ((hoverRegion == null) || (viewer == null) || (viewer.getDocument() == null)) {
- displayText = null;
- }
- else {
- int offset = hoverRegion.getOffset();
-
- ITypedRegion region;
- try {
- region = viewer.getDocument().getPartition(offset);
- if (region != null) {
- displayText = region.getType();
- }
- else {
- displayText = "Null Region was returned?!"; //$NON-NLS-1$
- }
- }
- catch (BadLocationException e) {
- displayText = "BadLocationException Occurred!?"; //$NON-NLS-1$
- }
-
- }
- return displayText;
- }
-
- /**
- * Returns the region to hover the text over based on the offset.
- *
- * @param textViewer
- * @param offset
- *
- * @return IRegion region to hover over if offset is not over invalid
- * whitespace. otherwise, returns <code>null</code>
- *
- * @see ITextHover#getHoverRegion(ITextViewer, int)
- */
- public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
- ITypedRegion region = null;
- if ((textViewer == null) || (textViewer.getDocument() == null)) {
- region = null;
- }
- else {
-
- try {
- region = textViewer.getDocument().getPartition(offset);
- }
- catch (BadLocationException e) {
- region = null;
- }
- }
- return region;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/ProblemAnnotationHoverProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/ProblemAnnotationHoverProcessor.java
deleted file mode 100644
index d9a4c03a71..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/ProblemAnnotationHoverProcessor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.taginfo;
-
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
-
-/**
- * Hover help that displays problem annotations when shown in text of editor.
- *
- * @author amywu
- */
-public class ProblemAnnotationHoverProcessor extends AnnotationHoverProcessor {
-
- // these strings are derived from the annotationTypes extension in
- // org.eclipse.ui.editors plugin
- // if those strings change, then these strings need to change as well
- final private String ANNOTATION_ERROR = "org.eclipse.wst.sse.ui.temp.error"; //$NON-NLS-1$
- final private String ANNOTATION_WARNING = "org.eclipse.wst.sse.ui.temp.warning"; //$NON-NLS-1$
- private DefaultMarkerAnnotationAccess fAnnotationAccess = new DefaultMarkerAnnotationAccess();
-
- /**
- *
- */
- public ProblemAnnotationHoverProcessor() {
- super();
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.taginfo.AnnotationHoverProcessor#isAnnotationValid(org.eclipse.jface.text.source.Annotation)
- */
- protected boolean isAnnotationValid(Annotation a) {
- String type = a.getType();
- if (fAnnotationAccess.isSubtype(type, ANNOTATION_ERROR) || fAnnotationAccess.isSubtype(type, ANNOTATION_WARNING))
- return super.isAnnotationValid(a);
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/TextHoverManager.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/TextHoverManager.java
deleted file mode 100644
index b29af22726..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/taginfo/TextHoverManager.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.taginfo;
-
-import java.util.HashMap;
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.preferences.EditorPreferenceNames;
-
-/**
- * Manages text hovers for Structured Text editors
- *
- * @author amywu
- */
-public class TextHoverManager {
- /**
- * Contains description of a text hover
- */
- public class TextHoverDescriptor {
- private String fDescription;
- private boolean fEnabled;
- private String fId;
- private String fLabel;
- private String fModifierString;
-
- /**
- * @param id
- * @param label
- * @param desc
- */
- public TextHoverDescriptor(String id, String label, String desc) {
- fId = id;
- fLabel = label;
- fDescription = desc;
- }
-
- /**
- * @param id
- * @param label
- * @param desc
- * @param enabled
- * @param modifierString
- */
- public TextHoverDescriptor(String id, String label, String desc, boolean enabled, String modifierString) {
- fId = id;
- fLabel = label;
- fDescription = desc;
- fEnabled = enabled;
- fModifierString = modifierString;
- }
-
- /**
- * @return Returns the fDescription.
- */
- public String getDescription() {
- return fDescription;
- }
-
- /**
- * @return Returns the fId.
- */
- public String getId() {
- return fId;
- }
-
- /**
- * @return Returns the fLabel
- */
- public String getLabel() {
- return fLabel;
- }
-
- /**
- * @return Returns the fModifierString.
- */
- public String getModifierString() {
- return fModifierString;
- }
-
- /**
- * @return Returns the fEnabled.
- */
- public boolean isEnabled() {
- return fEnabled;
- }
-
- /**
- * @param enabled
- * The fEnabled to set.
- */
- public void setEnabled(boolean enabled) {
- fEnabled = enabled;
- }
-
- /**
- * @param modifierString
- * The fModifierString to set.
- */
- public void setModifierString(String modifierString) {
- fModifierString = modifierString;
- }
- }
-
- public static final String ANNOTATION_HOVER = "annotationHover"; //$NON-NLS-1$
-
- // list of different types of Source editor hovers
- public static final String COMBINATION_HOVER = "combinationHover"; //$NON-NLS-1$
- // hover descriptions are in .properties file with the key in the form of
- // "[id]_desc"
- private static final String DESCRIPTION_KEY = "_desc"; //$NON-NLS-1$
- public static final String DOCUMENTATION_HOVER = "documentationHover"; //$NON-NLS-1$
- public static final String HOVER_ATTRIBUTE_SEPARATOR = "|"; //$NON-NLS-1$
- public static final String HOVER_SEPARATOR = ";"; //$NON-NLS-1$
-
- // hover labels are in .properties file with the key in the form of
- // "[id]_label"
- private static final String LABEL_KEY = "_label"; //$NON-NLS-1$
-
- public static final String NO_MODIFIER = "0"; //$NON-NLS-1$
- public static final String PROBLEM_HOVER = "problemHover"; //$NON-NLS-1$
- public static final String[] TEXT_HOVER_IDS = new String[]{COMBINATION_HOVER, PROBLEM_HOVER, DOCUMENTATION_HOVER, ANNOTATION_HOVER};
- /**
- * Current list of Structured Text editor text hovers
- */
- private TextHoverDescriptor[] fTextHovers;
-
- public TextHoverManager() {
- super();
- }
-
- /**
- * Create a best match hover with the give text hover as the documentation
- * hover
- *
- * @param infoHover
- * @return ITextHover
- */
- public ITextHover createBestMatchHover(ITextHover infoHover) {
- return new BestMatchHover(infoHover);
- }
-
- /**
- * Generate a list of text hover descriptors from the given delimited
- * string
- *
- * @param textHoverStrings
- * @return
- */
- public TextHoverDescriptor[] generateTextHoverDescriptors(String textHoverStrings) {
- StringTokenizer st = new StringTokenizer(textHoverStrings, HOVER_SEPARATOR);
-
- // read from preference and load id-descriptor mapping to a hash table
- HashMap idToModifier = new HashMap(st.countTokens());
- while (st.hasMoreTokens()) {
- String textHoverString = st.nextToken();
- StringTokenizer st2 = new StringTokenizer(textHoverString, HOVER_ATTRIBUTE_SEPARATOR);
- if (st2.countTokens() == 3) {
- String id = st2.nextToken();
- boolean enabled = Boolean.valueOf(st2.nextToken()).booleanValue();
- String modifierString = st2.nextToken();
- if (modifierString.equals(NO_MODIFIER))
- modifierString = ""; //$NON-NLS-1$
-
- String label = null;
- String description = null;
- try {
- label = SSEUIMessages.getResourceBundle().getString(id + LABEL_KEY);
- description = SSEUIMessages.getResourceBundle().getString(id + DESCRIPTION_KEY);
- }
- catch (Exception e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- TextHoverDescriptor descriptor = new TextHoverDescriptor(id, label, description, enabled, modifierString);
- // should check to see if ids appear more than once
- idToModifier.put(id, descriptor);
- }
- }
-
- // go through all defined text hovers and match with their preference
- TextHoverDescriptor[] descriptors = new TextHoverDescriptor[TEXT_HOVER_IDS.length];
- for (int i = 0; i < TEXT_HOVER_IDS.length; i++) {
- TextHoverDescriptor desc = (TextHoverDescriptor) idToModifier.get(TEXT_HOVER_IDS[i]);
- if (desc != null) {
- descriptors[i] = desc;
- }
- else {
- String label = null;
- String description = null;
- try {
- label = SSEUIMessages.getResourceBundle().getString(TEXT_HOVER_IDS[i] + LABEL_KEY);
- description = SSEUIMessages.getResourceBundle().getString(TEXT_HOVER_IDS[i] + DESCRIPTION_KEY);
- }
- catch (Exception e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- descriptors[i] = new TextHoverDescriptor(TEXT_HOVER_IDS[i], label, description);
- }
- }
- return descriptors;
- }
-
- private IPreferenceStore getPreferenceStore() {
- return SSEUIPlugin.getDefault().getPreferenceStore();
- }
-
-
- /**
- * Returns the text hovers for Structured Text editor. If fTextHover has
- * not been initialied, it will be initialized.
- *
- * @return Returns the fTextHovers.
- */
- public TextHoverDescriptor[] getTextHovers() {
- if (fTextHovers == null) {
- String textHoverStrings = getPreferenceStore().getString(EditorPreferenceNames.EDITOR_TEXT_HOVER_MODIFIERS);
- fTextHovers = generateTextHoverDescriptors(textHoverStrings);
- }
- return fTextHovers;
- }
-
- /**
- * Sets fTextHovers to null so that next time getTextHovers is called,
- * fTextHovers will be populated with the latest preferences.
- */
- public void resetTextHovers() {
- fTextHovers = null;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/text/DocumentRegionEdgeMatcher.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/text/DocumentRegionEdgeMatcher.java
deleted file mode 100644
index 48d20e12f9..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/text/DocumentRegionEdgeMatcher.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.text;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.source.ICharacterPairMatcher;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-
-
-/**
- * Matches the start and ending characters of IStructuredDocumentRegions with
- * the given allowed types. Note that Eclipse R3M8 only paints single
- * character-wide matches and this isn't true pair matching behavior. See RFE
- * #56836 at https://bugs.eclipse.org/bugs/show_bug.cgi?id=56836.
- */
-public class DocumentRegionEdgeMatcher implements ICharacterPairMatcher {
-
- public static final String ID = "characterpairmatcher"; //$NON-NLS-1$
-
- protected int fAnchor;
-
- protected ICharacterPairMatcher fNextMatcher;
-
- protected List fRegionTypes;
-
- public DocumentRegionEdgeMatcher(String[] validContexts, ICharacterPairMatcher nextMatcher) {
- fRegionTypes = Arrays.asList(validContexts);
- fNextMatcher = nextMatcher;
- }
-
- /*
- * @see org.eclipse.jface.text.source.ICharacterPairMatcher#clear()
- */
- public void clear() {
- if (fNextMatcher != null)
- fNextMatcher.clear();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.source.ICharacterPairMatcher#dispose()
- */
- public void dispose() {
- if (fNextMatcher != null)
- fNextMatcher.dispose();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.source.ICharacterPairMatcher#getAnchor()
- */
- public int getAnchor() {
- if (fAnchor < 0 && fNextMatcher != null)
- return fNextMatcher.getAnchor();
- return fAnchor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.source.ICharacterPairMatcher#match(org.eclipse.jface.text.IDocument,
- * int)
- */
- public IRegion match(IDocument document, int offset) {
- if(offset < 0 || offset >= document.getLength())
- return null;
-
- IRegion match = null;
- if (!fRegionTypes.isEmpty() && document instanceof IStructuredDocument) {
- IStructuredDocumentRegion docRegion = ((IStructuredDocument) document).getRegionAtCharacterOffset(offset);
- if (docRegion != null) {
- // look at the previous document region first since its end ==
- // this one's start
- if (docRegion.getPrevious() != null && docRegion.getPrevious().getEndOffset() == offset && fRegionTypes.contains(docRegion.getPrevious().getType())) {
- fAnchor = ICharacterPairMatcher.RIGHT;
- match = new Region(docRegion.getPrevious().getStartOffset(), 1);
- }
- // check for offset in the last text region for a match to
- // document region start offset
- else if (fRegionTypes.contains(docRegion.getType()) && docRegion.getStartOffset(docRegion.getLastRegion()) <= offset && offset <= docRegion.getEndOffset(docRegion.getLastRegion())) {
- fAnchor = ICharacterPairMatcher.RIGHT;
- match = new Region(docRegion.getStartOffset(), 1);
- }
- // check for offset in the first text region for a match to
- // document region end offset
- else if (fRegionTypes.contains(docRegion.getType())) {
- if (docRegion.getStartOffset(docRegion.getFirstRegion()) <= offset && offset <= docRegion.getEndOffset(docRegion.getFirstRegion())) {
- fAnchor = ICharacterPairMatcher.LEFT;
- match = new Region(docRegion.getEndOffset() - 1, 1);
- }
- }
- }
- }
- if (match == null && fNextMatcher != null) {
- fAnchor = -1;
- match = fNextMatcher.match(document, offset);
- }
- return match;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ui/OffsetStatusLineContributionItem.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ui/OffsetStatusLineContributionItem.java
deleted file mode 100644
index 6fa7bf1ed3..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ui/OffsetStatusLineContributionItem.java
+++ /dev/null
@@ -1,1039 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.ui;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IDocumentExtension3;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.jface.text.reconciler.IReconcileStep;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Sash;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.MarkerAnnotation;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
-import org.eclipse.ui.texteditor.StatusLineContributionItem;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.IPropertySourceProvider;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitioning;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionCollection;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.sse.core.internal.util.Utilities;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter;
-import org.eclipse.wst.sse.ui.internal.reconcile.ReconcileAnnotationKey;
-import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
-
-/**
- * @author nsd A Status Line contribution intended to display the selected
- * offsets in an editor. Double-clicking shows information about
- * partitions, document regions, annotations, and selection.
- */
-public class OffsetStatusLineContributionItem extends StatusLineContributionItem {
-
- class AnnotationPropertySource implements IPropertySource {
- Annotation fAnnotation = null;
- IPropertyDescriptor[] fDescriptors = null;
- String[] TEMPORARY_ANNOTATION_KEYS = new String[]{"Partition Type", "Step", "Scope", "Offset", "Length", "Description"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-
- public AnnotationPropertySource(Annotation annotation) {
- super();
- fAnnotation = annotation;
- }
-
- public Object getEditableValue() {
- return null;
- }
-
- public IPropertyDescriptor[] getPropertyDescriptors() {
- if (fDescriptors == null) {
- try {
- if (fAnnotation instanceof SimpleMarkerAnnotation) {
- Map attrs = ((SimpleMarkerAnnotation) fAnnotation).getMarker().getAttributes();
- Object[] keys = attrs.keySet().toArray();
-
- fDescriptors = new IPropertyDescriptor[keys.length];
- for (int i = 0; i < keys.length; i++) {
- TextPropertyDescriptor descriptor = new TextPropertyDescriptor(keys[i].toString(), keys[i].toString());
- fDescriptors[i] = descriptor;
- }
- }
- else if (fAnnotation instanceof TemporaryAnnotation) {
- Object key = ((TemporaryAnnotation) fAnnotation).getKey();
- if (key != null && key instanceof ReconcileAnnotationKey) {
- String[] keys = TEMPORARY_ANNOTATION_KEYS;
- fDescriptors = new IPropertyDescriptor[keys.length];
- for (int i = 0; i < keys.length; i++) {
- TextPropertyDescriptor descriptor = new TextPropertyDescriptor(keys[i].toString(), keys[i].toString());
- fDescriptors[i] = descriptor;
- }
- }
- }
- }
- catch (CoreException e) {
- e.printStackTrace();
- }
- }
- if (fDescriptors == null)
- fDescriptors = new IPropertyDescriptor[0];
- return fDescriptors;
- }
-
- public Object getPropertyValue(Object id) {
- String value = null;
- if (fAnnotation instanceof SimpleMarkerAnnotation) {
- Object o;
- try {
- o = ((SimpleMarkerAnnotation) fAnnotation).getMarker().getAttributes().get(id);
- if (o != null) {
- value = o.toString();
- }
- }
- catch (CoreException e) {
- }
- }
- else if (fAnnotation instanceof TemporaryAnnotation) {
- if (TEMPORARY_ANNOTATION_KEYS[0].equals(id)) {
- Object key = ((TemporaryAnnotation) fAnnotation).getKey();
- if (key != null && key instanceof ReconcileAnnotationKey) {
- value = ((ReconcileAnnotationKey) key).getPartitionType();
- }
- }
- else if (TEMPORARY_ANNOTATION_KEYS[1].equals(id)) {
- Object key = ((TemporaryAnnotation) fAnnotation).getKey();
- if (key != null && key instanceof ReconcileAnnotationKey) {
- IReconcileStep step = ((ReconcileAnnotationKey) key).getStep();
- if (step != null) {
- value = step.getClass().getName();
- }
- }
- }
- else if (TEMPORARY_ANNOTATION_KEYS[2].equals(id)) {
- Object key = ((TemporaryAnnotation) fAnnotation).getKey();
- if (key != null && key instanceof ReconcileAnnotationKey) {
- int scope = ((ReconcileAnnotationKey) key).getScope();
- if (scope == ReconcileAnnotationKey.PARTIAL) {
- value = "PARTIAL"; //$NON-NLS-1$
- }
- if (scope == ReconcileAnnotationKey.TOTAL) {
- value = "TOTAL"; //$NON-NLS-1$
- }
- }
- }
- else if (TEMPORARY_ANNOTATION_KEYS[3].equals(id)) {
- IAnnotationModel annotationModel = fTextEditor.getDocumentProvider().getAnnotationModel(fTextEditor.getEditorInput());
- Position p = annotationModel.getPosition(fAnnotation);
- if (p != null) {
- value = String.valueOf(p.getOffset());
- }
- }
- else if (TEMPORARY_ANNOTATION_KEYS[4].equals(id)) {
- IAnnotationModel annotationModel = fTextEditor.getDocumentProvider().getAnnotationModel(fTextEditor.getEditorInput());
- Position p = annotationModel.getPosition(fAnnotation);
- if (p != null) {
- value = String.valueOf(p.getLength());
- }
- }
- else if (TEMPORARY_ANNOTATION_KEYS[5].equals(id)) {
- value = ((TemporaryAnnotation) fAnnotation).getDescription();
- }
- }
- return value;
- }
-
- public boolean isPropertySet(Object id) {
- return false;
- }
-
- public void resetPropertyValue(Object id) {
- try {
- if (fAnnotation instanceof SimpleMarkerAnnotation) {
- ((SimpleMarkerAnnotation) fAnnotation).getMarker().getAttributes().remove(id);
- }
- else if (fAnnotation instanceof TemporaryAnnotation) {
- }
- }
- catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- public void setPropertyValue(Object id, Object value) {
- try {
- if (fAnnotation instanceof SimpleMarkerAnnotation) {
- ((MarkerAnnotation) fAnnotation).getMarker().setAttribute(id.toString(), value);
- }
- else if (fAnnotation instanceof TemporaryAnnotation) {
- }
- }
- catch (CoreException e) {
- e.printStackTrace();
- }
- }
- }
-
- class InformationDialog extends Dialog {
-
- IDocument fDocument = fTextEditor.getDocumentProvider().getDocument(fTextEditor.getEditorInput());
-
- public InformationDialog(Shell parentShell) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- private void createAnnotationTabContents(Composite annotationsTabComposite) {
- annotationsTabComposite.setLayout(new GridLayout());
- annotationsTabComposite.setLayoutData(new GridData());
-
- final Composite annotationsComposite = new Composite(annotationsTabComposite, SWT.NONE);
- annotationsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- final TableViewer annotationsTable = new TableViewer(annotationsComposite, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- annotationsTable.setContentProvider(new ArrayContentProvider());
- annotationsTable.getTable().setHeaderVisible(true);
- annotationsTable.getTable().setLinesVisible(true);
- String[] columns = new String[]{"Line", "Owner", "Type", "Class", "Message"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- annotationsTable.setLabelProvider(new ITableLabelProvider() {
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- Annotation annotation = (Annotation) element;
- String text = null;
- switch (columnIndex) {
- case 0 :
- text = getLineNumber(annotation);
- break;
- case 1 :
- text = getOwner(annotation);
- break;
- case 2 :
- text = getType(annotation); //$NON-NLS-1$
- break;
- case 3 :
- text = annotation.getClass().getName();
- break;
- case 4 :
- text = annotation.getText();
- break;
- }
- if (text == null)
- text = ""; //$NON-NLS-1$
- return text;
- }
-
-
- private String getOwner(Annotation annotation) {
- String owner = null;
- if (annotation instanceof MarkerAnnotation) {
- owner = ((MarkerAnnotation) annotation).getMarker().getAttribute("owner", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- else if (annotation instanceof TemporaryAnnotation) {
- Object key = ((TemporaryAnnotation) annotation).getKey();
- if (key != null) {
- if (key instanceof ReconcileAnnotationKey) {
- key = key.getClass().getName();
- }
- if (key != null)
- owner = key.toString();
- }
- }
- return owner;
- }
-
- private String getType(Annotation annotation) {
- String type = null;
- if (annotation instanceof MarkerAnnotation) {
- type = MarkerUtilities.getMarkerType(((MarkerAnnotation) annotation).getMarker());
- }
- else {
- type = annotation.getType();
- }
- if (type == null)
- type = ""; //$NON-NLS-1$
- return type;
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return true;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
- });
-
- TableLayout tlayout = new TableLayout();
- CellEditor[] cellEditors = new CellEditor[columns.length];
- int columnWidths[] = new int[]{Display.getCurrent().getBounds().width / 14, Display.getCurrent().getBounds().width / 7, Display.getCurrent().getBounds().width / 7, Display.getCurrent().getBounds().width / 14, Display.getCurrent().getBounds().width / 7};
- for (int i = 0; i < columns.length; i++) {
- tlayout.addColumnData(new ColumnWeightData(1));
- TableColumn tc = new TableColumn(annotationsTable.getTable(), SWT.NONE);
- tc.setText(columns[i]);
- tc.setResizable(true);
- tc.setWidth(columnWidths[i]);
- }
- annotationsTable.setCellEditors(cellEditors);
- annotationsTable.setColumnProperties(columns);
- List matchingAnnotations = new ArrayList(0);
- if (fTextEditor != null) {
- IAnnotationModel annotationModel = fTextEditor.getDocumentProvider().getAnnotationModel(fTextEditor.getEditorInput());
- if (annotationModel != null) {
- Iterator iterator = annotationModel.getAnnotationIterator();
- while (iterator.hasNext()) {
- Annotation element = (Annotation) iterator.next();
- if (true) {
- matchingAnnotations.add(element);
- }
- }
- }
- }
- annotationsTable.setSorter(new ViewerSorter());
- annotationsTable.setInput(matchingAnnotations);
-
- final Sash sash = new Sash(annotationsComposite, SWT.HORIZONTAL);
-
- final PropertySheetPage propertySheet = new PropertySheetPage();
- propertySheet.createControl(annotationsComposite);
- propertySheet.setPropertySourceProvider(new IPropertySourceProvider() {
- public IPropertySource getPropertySource(Object object) {
- if (object instanceof Annotation) {
- IPropertySource annotationPropertySource = new AnnotationPropertySource(((Annotation) object));
- return annotationPropertySource;
- }
- return null;
- }
- });
-
- annotationsTable.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- propertySheet.selectionChanged(null, event.getSelection());
- }
- });
-
- final FormLayout form = new FormLayout();
- annotationsComposite.setLayout(form);
-
- FormData tableData = new FormData();
- tableData.top = new FormAttachment(0, 0);
- tableData.bottom = new FormAttachment(sash, 2);
- tableData.left = new FormAttachment(0, 0);
- tableData.right = new FormAttachment(100, 0);
- annotationsTable.getControl().setLayoutData(tableData);
-
- FormData propertiesData = new FormData();
- propertiesData.top = new FormAttachment(sash, 2);
- propertiesData.left = new FormAttachment(0, 0);
- propertiesData.right = new FormAttachment(100, 0);
- propertiesData.bottom = new FormAttachment(100, 0);
- propertySheet.getControl().setLayoutData(propertiesData);
-
- final FormData sashData = new FormData();
- sashData.top = new FormAttachment(60, 0);
- sashData.left = new FormAttachment(0, 0);
- sashData.right = new FormAttachment(100, 0);
- sash.setLayoutData(sashData);
- sash.addListener(SWT.Selection, new org.eclipse.swt.widgets.Listener() {
- public void handleEvent(Event e) {
- sashData.top = new FormAttachment(0, e.y);
- annotationsComposite.layout();
- }
- });
- annotationsComposite.pack(true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
- ISelection sel = fTextEditor.getSelectionProvider().getSelection();
- ITextSelection textSelection = (ITextSelection) sel;
- parent.getShell().setText(SSEUIMessages.OffsetStatusLineContributionItem_0 + textSelection.getOffset() + "-" + (textSelection.getOffset() + textSelection.getLength())); //$NON-NLS-1$ //$NON-NLS-2$
- Composite composite = (Composite) super.createDialogArea(parent);
-
- Text documentTypeLabel = new Text(composite, SWT.SINGLE | SWT.READ_ONLY);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.horizontalSpan = 2;
- documentTypeLabel.setLayoutData(gd);
- documentTypeLabel.setText(SSEUIMessages.OffsetStatusLineContributionItem_6 + fDocument.getClass().getName()); //$NON-NLS-1$
-
- Text documentProviderLabel = new Text(composite, SWT.SINGLE | SWT.READ_ONLY);
- gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.horizontalSpan = 2;
- documentProviderLabel.setLayoutData(gd);
- documentProviderLabel.setText(SSEUIMessages.OffsetStatusLineContributionItem_7 + fTextEditor.getDocumentProvider().getClass().getName()); //$NON-NLS-1$
-
- Text editorInputLabel = new Text(composite, SWT.SINGLE | SWT.READ_ONLY);
- gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.horizontalSpan = 2;
- editorInputLabel.setLayoutData(gd);
- editorInputLabel.setText(SSEUIMessages.OffsetStatusLineContributionItem_12 + fTextEditor.getEditorInput().getClass().getName()); //$NON-NLS-1$
-
- IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(fDocument);
- if (model != null) {
- Text modelContentTypeLabel = new Text(composite, SWT.SINGLE | SWT.READ_ONLY);
- gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.horizontalSpan = 2;
- modelContentTypeLabel.setLayoutData(gd);
- modelContentTypeLabel.setText(SSEUIMessages.OffsetStatusLineContributionItem_4 + model.getContentTypeIdentifier()); //$NON-NLS-1$
-
- Text modelHandlerContentTypeLabel = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
- gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.horizontalSpan = 2;
- modelHandlerContentTypeLabel.setLayoutData(gd);
- modelHandlerContentTypeLabel.setText(SSEUIMessages.OffsetStatusLineContributionItem_5 + model.getModelHandler() + " (" + model.getModelHandler().getAssociatedContentTypeId() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- Label blankRow = new Label(composite, SWT.NONE);
- gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.horizontalSpan = 2;
- blankRow.setLayoutData(gd);
- }
- if (model != null) {
- model.releaseFromRead();
- }
-
- TabFolder tabfolder = new TabFolder(composite, SWT.NONE);
- tabfolder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- TabItem partitionTab = new TabItem(tabfolder, SWT.BORDER);
- partitionTab.setText(SSEUIMessages.OffsetStatusLineContributionItem_2); //$NON-NLS-1$
- Composite partitions = new Composite(tabfolder, SWT.NONE);
- partitionTab.setControl(partitions);
- createPartitionTabContents(partitions);
-
- TabItem annotationsTab = new TabItem(tabfolder, SWT.BORDER);
- annotationsTab.setText("Annotations"); //$NON-NLS-1$
- Composite annotations = new Composite(tabfolder, SWT.NONE);
- annotationsTab.setControl(annotations);
- createAnnotationTabContents(annotations);
-
- // only create the ITextRegions tab for IStructuredDocuments
- if (fDocument instanceof IStructuredDocument) {
- TabItem regionTab = new TabItem(tabfolder, SWT.BORDER);
- regionTab.setText(SSEUIMessages.OffsetStatusLineContributionItem_3); //$NON-NLS-1$
- SashForm regions = new SashForm(tabfolder, SWT.NONE);
- regions.setOrientation(SWT.HORIZONTAL);
- regionTab.setControl(regions);
- createRegionTabContents(regions);
- }
-
- TabItem editorSelectionTab = new TabItem(tabfolder, SWT.BORDER);
- editorSelectionTab.setText(SSEUIMessages.OffsetStatusLineContributionItem_14);
- Composite editorSelectionComposite = new Composite(tabfolder, SWT.NONE);
- editorSelectionTab.setControl(editorSelectionComposite);
- fillSelectionTabContents(editorSelectionComposite, fTextEditor.getSelectionProvider().getSelection());
-
- IEditorSite site = fTextEditor.getEditorSite();
- if (site != null) {
- IWorkbenchWindow window = site.getWorkbenchWindow();
- if (window != null) {
- ISelectionService service = window.getSelectionService();
- if (service != null && !service.getSelection().equals(fTextEditor.getSelectionProvider().getSelection())) {
- TabItem selectionServiceTab = new TabItem(tabfolder, SWT.BORDER);
- selectionServiceTab.setText(SSEUIMessages.OffsetStatusLineContributionItem_19);
- Composite selectionServiceComposite = new Composite(tabfolder, SWT.NONE);
- selectionServiceTab.setControl(selectionServiceComposite);
- fillSelectionTabContents(selectionServiceComposite, service.getSelection());
- }
- }
- }
-
- return composite;
- }
-
- /**
- * @param area
- */
- private void createPartitionTabContents(Composite area) {
- area.setLayout(new GridLayout());
- area.setLayoutData(new GridData());
-
- Composite partioningComposite = new Composite(area, SWT.NONE);
- partioningComposite.setLayout(new GridLayout(2, false));
- partioningComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Label label = new Label(partioningComposite, SWT.SINGLE);
- label.setText(SSEUIMessages.OffsetStatusLineContributionItem_8); //$NON-NLS-1$
- label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- final Combo partitioningCombo = new Combo(partioningComposite, SWT.READ_ONLY);
- partitioningCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
- final Label partitionerInstanceLabel = new Label(partioningComposite, SWT.SINGLE);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.horizontalSpan = 2;
- partitionerInstanceLabel.setLayoutData(gd);
-
- final TableViewer fPartitionTable = new TableViewer(partioningComposite, SWT.FULL_SELECTION);
- gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.horizontalSpan = 2;
- fPartitionTable.getControl().setLayoutData(gd);
- fPartitionTable.setContentProvider(new ArrayContentProvider());
- fPartitionTable.getTable().setHeaderVisible(true);
- fPartitionTable.getTable().setLinesVisible(true);
- String[] columns = new String[]{SSEUIMessages.OffsetStatusLineContributionItem_9, SSEUIMessages.OffsetStatusLineContributionItem_10, SSEUIMessages.OffsetStatusLineContributionItem_11}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- fPartitionTable.setLabelProvider(new ITableLabelProvider() {
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- ITypedRegion partition = (ITypedRegion) element;
- String text = null;
- switch (columnIndex) {
- case 0 :
- text = Integer.toString(partition.getOffset());
- break;
- case 1 :
- text = Integer.toString(partition.getLength());
- break;
- case 2 :
- text = partition.getType();
- break;
- }
- if (text == null)
- text = ""; //$NON-NLS-1$
- return text;
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
- });
- TableLayout tlayout = new TableLayout();
- CellEditor[] cellEditors = new CellEditor[columns.length];
- int columnWidths[] = new int[]{Display.getCurrent().getBounds().width / 14, Display.getCurrent().getBounds().width / 14, Display.getCurrent().getBounds().width / 5};
- for (int i = 0; i < columns.length; i++) {
- tlayout.addColumnData(new ColumnWeightData(1));
- TableColumn tc = new TableColumn(fPartitionTable.getTable(), SWT.NONE);
- tc.setText(columns[i]);
- tc.setResizable(true);
- tc.setWidth(columnWidths[i]);
- }
- fPartitionTable.setCellEditors(cellEditors);
- fPartitionTable.setColumnProperties(columns);
- final String[] partitionings = (fDocument instanceof IDocumentExtension3) ? ((IDocumentExtension3) fDocument).getPartitionings() : new String[]{IDocumentExtension3.DEFAULT_PARTITIONING};
- partitioningCombo.setItems(partitionings);
- partitioningCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ISelection sel = fTextEditor.getSelectionProvider().getSelection();
- ITextSelection textSelection = (ITextSelection) sel;
- try {
- String partitionerText = fDocument instanceof IDocumentExtension3 ? ((IDocumentExtension3) fDocument).getDocumentPartitioner(partitioningCombo.getItem(partitioningCombo.getSelectionIndex())).toString() : ("" + fDocument.getDocumentPartitioner()); //$NON-NLS-1$
- partitionerInstanceLabel.setText(SSEUIMessages.OffsetStatusLineContributionItem_13 + partitionerText); //$NON-NLS-1$
- fPartitionTable.setInput(TextUtilities.computePartitioning(fDocument, partitioningCombo.getItem(partitioningCombo.getSelectionIndex()), textSelection.getOffset(), textSelection.getLength(), true));
- }
- catch (BadLocationException e1) {
- fPartitionTable.setInput(new ITypedRegion[0]);
- }
- }
- });
- try {
- if (partitionings.length > 0) {
- String selectedPartitioning = partitioningCombo.getItem(0);
- if (Utilities.contains(partitionings, IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING)) {
- selectedPartitioning = IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING;
- for (int i = 0; i < partitionings.length; i++) {
- if (partitionings[i].equals(IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING)) {
- partitioningCombo.select(i);
- }
- }
- }
- else {
- partitioningCombo.select(0);
- }
- ISelection sel = fTextEditor.getSelectionProvider().getSelection();
- ITextSelection textSelection = (ITextSelection) sel;
- ITypedRegion[] partitions = TextUtilities.computePartitioning(fDocument, selectedPartitioning, textSelection.getOffset(), textSelection.getLength(), true);
- fPartitionTable.setInput(partitions);
- String partitionerText = fDocument instanceof IDocumentExtension3 ? ((IDocumentExtension3) fDocument).getDocumentPartitioner(partitioningCombo.getItem(partitioningCombo.getSelectionIndex())).toString() : ("" + fDocument.getDocumentPartitioner()); //$NON-NLS-1$
- partitionerInstanceLabel.setText(SSEUIMessages.OffsetStatusLineContributionItem_13 + partitionerText); //$NON-NLS-1$
- }
- else {
- ISelection sel = fTextEditor.getSelectionProvider().getSelection();
- ITextSelection textSelection = (ITextSelection) sel;
- fPartitionTable.setInput(fDocument.computePartitioning(textSelection.getOffset(), textSelection.getLength()));
- }
- }
- catch (BadLocationException e1) {
- fPartitionTable.setInput(new ITypedRegion[0]);
- }
- partitioningCombo.setFocus();
- }
-
- /**
- * @param composite
- * @return
- */
- private Composite createRegionTabContents(SashForm sashForm) {
- ISelection sel = fTextEditor.getSelectionProvider().getSelection();
- final ITextSelection textSelection = (ITextSelection) sel;
- final List documentRegions = new ArrayList();
- if (fDocument instanceof IStructuredDocument) {
- IStructuredDocument structuredDocument = (IStructuredDocument) fDocument;
- int pos = textSelection.getOffset();
- int end = textSelection.getOffset() + textSelection.getLength();
- IStructuredDocumentRegion docRegion = structuredDocument.getRegionAtCharacterOffset(pos);
- IStructuredDocumentRegion endRegion = structuredDocument.getRegionAtCharacterOffset(end);
- if (pos < end) {
- while (docRegion != endRegion) {
- documentRegions.add(docRegion);
- docRegion = docRegion.getNext();
- }
- }
- documentRegions.add(docRegion);
- }
-
- final TreeViewer tree = new TreeViewer(sashForm, SWT.V_SCROLL | SWT.H_SCROLL);
- final String START = SSEUIMessages.OffsetStatusLineContributionItem_15; //$NON-NLS-1$
- final String LENGTH = SSEUIMessages.OffsetStatusLineContributionItem_16; //$NON-NLS-1$
- final String TEXTLENGTH = SSEUIMessages.OffsetStatusLineContributionItem_17; //$NON-NLS-1$
- final String CONTEXT = SSEUIMessages.OffsetStatusLineContributionItem_18; //$NON-NLS-1$
- tree.setContentProvider(new ITreeContentProvider() {
- public void dispose() {
- }
-
- public Object[] getChildren(Object parentElement) {
- List children = new ArrayList(0);
- if (parentElement instanceof ITextSelection) {
- children.addAll(documentRegions);
- }
- if (parentElement instanceof ITextRegionCollection) {
- children.add(((ITextRegionCollection) parentElement).getRegions().toArray());
- }
- if (parentElement instanceof ITextRegion) {
- children.add(new KeyValuePair(CONTEXT, ((ITextRegion) parentElement).getType()));
- children.add(new KeyValuePair(START, Integer.toString(((ITextRegion) parentElement).getStart())));
- children.add(new KeyValuePair(TEXTLENGTH, Integer.toString(((ITextRegion) parentElement).getTextLength())));
- children.add(new KeyValuePair(LENGTH, Integer.toString(((ITextRegion) parentElement).getLength())));
- }
- if (parentElement instanceof ITextRegionList) {
- children.add(Arrays.asList(((ITextRegionList) parentElement).toArray()));
- }
- if (parentElement instanceof Collection) {
- children.addAll((Collection) parentElement);
- }
- if (parentElement instanceof Object[]) {
- children.addAll(Arrays.asList((Object[]) parentElement));
- }
- return children.toArray();
- }
-
- public Object[] getElements(Object inputElement) {
- return new Object[]{textSelection};
- }
-
- public Object getParent(Object element) {
- if (element instanceof IStructuredDocumentRegion)
- return ((IStructuredDocumentRegion) element).getParentDocument();
- if (element instanceof ITextRegionContainer) {
- return ((ITextRegionContainer) element).getParent();
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return !(element instanceof KeyValuePair);
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- });
- tree.setLabelProvider(new LabelProvider() {
- public String getText(Object element) {
- if (element instanceof KeyValuePair)
- return ((KeyValuePair) element).fKey.toString().toLowerCase() + ": " + ((KeyValuePair) element).fValue; //$NON-NLS-1$
- if (element instanceof IStructuredDocumentRegion) {
- IStructuredDocumentRegion documentRegion = (IStructuredDocumentRegion) element;
- int packageNameLength = documentRegion.getClass().getPackage().getName().length();
- if (packageNameLength > 0)
- packageNameLength++;
- String name = documentRegion.getClass().getName().substring(packageNameLength);
- String text = "[" + documentRegion.getStartOffset() + "-" + documentRegion.getEndOffset() + "] " + name + "@" + element.hashCode() + " " + documentRegion.getType(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- return text;
- }
- if (element instanceof ITextRegion) {
- ITextRegion textRegion = (ITextRegion) element;
- int packageNameLength = textRegion.getClass().getPackage().getName().length();
- if (packageNameLength > 0)
- packageNameLength++;
- String name = textRegion.getClass().getName().substring(packageNameLength);
- String text = "[" + textRegion.getStart() + "-" + textRegion.getEnd() + "] " + name + "@" + element.hashCode() + " " + textRegion.getType(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- return text;
- }
- return super.getText(element);
- }
- });
- tree.setInput(fDocument);
-
-
- final Text displayText = new Text(sashForm, SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY | SWT.BORDER);
- displayText.setBackground(sashForm.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- tree.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelection() instanceof IStructuredSelection) {
- Object o = ((IStructuredSelection) event.getSelection()).getFirstElement();
- if (o instanceof KeyValuePair)
- displayText.setText(((KeyValuePair) o).fValue.toString());
- else if (o instanceof ITextSelection) {
- ITextSelection text = (ITextSelection) o;
- try {
- displayText.setText(fDocument.get(text.getOffset(), text.getLength()));
- }
- catch (BadLocationException e) {
- displayText.setText(""); //$NON-NLS-1$
- }
- }
- else if (o instanceof ITextRegionCollection) {
- ITextRegionCollection region = (ITextRegionCollection) o;
- displayText.setText(region.getFullText());
- }
- else
- displayText.setText("" + o); //$NON-NLS-1$
- }
- }
- });
- sashForm.setWeights(new int[]{3, 2});
- return sashForm;
- }
-
- private void fillSelectionTabContents(Composite area, ISelection sel) {
- area.setLayout(new GridLayout());
- area.setLayoutData(new GridData());
-
- Label typeName = new Label(area, SWT.WRAP);
- typeName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- typeName.setText("Class: " + sel.getClass().getName()); //$NON-NLS-1$
-
- if (sel instanceof IStructuredSelection) {
- (new Label(area, SWT.NONE)).setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- SashForm structuredSashForm = new SashForm(area, SWT.NONE);
- structuredSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- structuredSashForm.setOrientation(SWT.VERTICAL);
-
- final TableViewer structuredSelectionTable = new TableViewer(structuredSashForm, SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
-
- structuredSelectionTable.getTable().setHeaderVisible(true);
- structuredSelectionTable.getTable().setLinesVisible(true);
-
- structuredSelectionTable.setLabelProvider(new ITableLabelProvider() {
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- String text = null;
- if (element != null) {
- switch (columnIndex) {
- case 0 : {
- text = String.valueOf(((List) structuredSelectionTable.getInput()).indexOf(element));
- }
- break;
- case 1 : {
- text = element.getClass().getName();
- }
- break;
- case 2 : {
- text = element.toString();
- }
- break;
- default :
- text = ""; //$NON-NLS-1$
- }
- }
- return text;
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
- });
-
- TableLayout tlayout = new TableLayout();
- tlayout.addColumnData(new ColumnWeightData(7, true));
- tlayout.addColumnData(new ColumnWeightData(28, true));
- tlayout.addColumnData(new ColumnWeightData(50, true));
- structuredSelectionTable.getTable().setLayout(tlayout);
-
- TableColumn tc = new TableColumn(structuredSelectionTable.getTable(), SWT.NONE);
- tc.setText("Item"); //$NON-NLS-1$
- tc.setResizable(true);
- tc.setWidth(40);
-
- tc = new TableColumn(structuredSelectionTable.getTable(), SWT.NONE);
- tc.setText("Class"); //$NON-NLS-1$
- tc.setResizable(true);
- tc.setWidth(40);
-
- tc = new TableColumn(structuredSelectionTable.getTable(), SWT.NONE);
- tc.setText("Text"); //$NON-NLS-1$
- tc.setResizable(true);
- tc.setWidth(40);
-
- structuredSelectionTable.setContentProvider(new ArrayContentProvider());
- final List input = ((IStructuredSelection) sel).toList();
- structuredSelectionTable.setInput(input);
-
- final TreeViewer infoTree = new TreeViewer(structuredSashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- infoTree.setLabelProvider(new LabelProvider() {
- public Image getImage(Object element) {
- if (element instanceof TreeViewer && infoTree.getInput() instanceof INodeNotifier) {
- INodeAdapter adapterFor = ((INodeNotifier) infoTree.getInput()).getAdapterFor(IJFaceNodeAdapter.class);
- if (adapterFor != null && adapterFor instanceof IJFaceNodeAdapter) {
- IJFaceNodeAdapter adapter = (IJFaceNodeAdapter) adapterFor;
- return adapter.getLabelImage((infoTree.getInput()));
- }
- }
- return super.getImage(element);
- }
-
- public String getText(Object element) {
- if (element instanceof Class) {
- return "Class: " + ((Class) element).getName(); //$NON-NLS-1$
- }
- if (element instanceof Collection) {
- return "Registered Adapters:"; //$NON-NLS-1$
- }
- if (element instanceof IRegion) {
- return "Indexed Region offset span: [" + ((IRegion) element).getOffset() + "-" + ((IRegion) element).getLength() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- if (element instanceof TreeViewer && infoTree.getInput() instanceof INodeNotifier) {
- IJFaceNodeAdapter adapter = (IJFaceNodeAdapter) ((INodeNotifier) infoTree.getInput()).getAdapterFor(IJFaceNodeAdapter.class);
- if (adapter != null) {
- return adapter.getLabelText((infoTree.getInput()));
- }
- }
- return super.getText(element);
- }
- });
- infoTree.setContentProvider(new ITreeContentProvider() {
- public void dispose() {
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Collection)
- return ((Collection) parentElement).toArray();
- return new Object[0];
- }
-
- public Object[] getElements(Object inputElement) {
- List elements = new ArrayList(4);
- if (inputElement != null) {
- if (inputElement instanceof INodeNotifier && ((INodeNotifier) inputElement).getAdapterFor(IJFaceNodeAdapter.class) != null) {
- elements.add(infoTree);
- }
- elements.add(inputElement.getClass());
- if (inputElement instanceof IndexedRegion) {
- elements.add(new Region(((IndexedRegion) inputElement).getStartOffset(), ((IndexedRegion) inputElement).getEndOffset()));
- }
- if (inputElement instanceof INodeNotifier) {
- elements.add(((INodeNotifier) inputElement).getAdapters());
- }
- }
- return elements.toArray();
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return element instanceof Collection;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- });
-
- structuredSelectionTable.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- int selectionIndex = structuredSelectionTable.getTable().getSelectionIndex();
- if (selectionIndex != -1) {
- infoTree.setInput(input.get(selectionIndex));
- }
- else {
- infoTree.setInput(event.getSelectionProvider().getSelection());
- }
- infoTree.expandToLevel(2);
- }
- });
-
- structuredSashForm.setWeights(new int[]{3, 2});
- }
- }
-
- private String getLineNumber(Annotation annotation) {
- int line = -1;
- if (annotation instanceof MarkerAnnotation) {
- line = MarkerUtilities.getLineNumber(((MarkerAnnotation) annotation).getMarker());//$NON-NLS-1$
- }
- else {
- IAnnotationModel annotationModel = fTextEditor.getDocumentProvider().getAnnotationModel(fTextEditor.getEditorInput());
- Position p = annotationModel.getPosition(annotation);
- if (p != null && !p.isDeleted()) {
- try {
- line = fDocument.getLineOfOffset(p.getOffset());
- }
- catch (BadLocationException e) {
- }
- }
- }
- return Integer.toString(line);
- }
- }
-
- static class KeyValuePair {
- Object fKey;
- String fValue;
-
- public KeyValuePair(Object key, String value) {
- fKey = key;
- fValue = value;
- }
- }
-
- class ShowEditorInformationAction extends Action {
- public ShowEditorInformationAction() {
- super();
- }
-
- public void run() {
- /**
- * TODO: Provide a more useful control, maybe a table where the
- * selection shows you the partition's text in a StyledText pane
- * beneath it.
- */
- super.run();
- new InformationDialog(((Control) fTextEditor.getAdapter(Control.class)).getShell()).open();
- }
- }
-
- IAction fShowEditorInformationAction = new ShowEditorInformationAction();
-
- ITextEditor fTextEditor = null;
-
- /**
- * @param id
- */
- public OffsetStatusLineContributionItem(String id) {
- super(id);
- }
-
- /**
- * @param id
- * @param visible
- * @param widthInChars
- */
- public OffsetStatusLineContributionItem(String id, boolean visible, int widthInChars) {
- super(id, visible, widthInChars);
- }
-
- public void setActiveEditor(ITextEditor textEditor) {
- fTextEditor = textEditor;
- setActionHandler(fShowEditorInformationAction);
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ui/StructuredTextAnnotationImageProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ui/StructuredTextAnnotationImageProvider.java
deleted file mode 100644
index b835eda0e0..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/ui/StructuredTextAnnotationImageProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.ui;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.texteditor.IAnnotationImageProvider;
-
-/**
- * Image provider for structured text editor annotations.
- *
- * @author pavery
- */
-public class StructuredTextAnnotationImageProvider implements IAnnotationImageProvider {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IAnnotationImageProvider#getImageDescriptor(java.lang.String)
- */
- public ImageDescriptor getImageDescriptor(String imageDescritporId) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IAnnotationImageProvider#getImageDescriptorId(org.eclipse.jface.text.source.Annotation)
- */
- public String getImageDescriptorId(Annotation annotation) {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IAnnotationImageProvider#getManagedImage(org.eclipse.jface.text.source.Annotation)
- */
- public Image getManagedImage(Annotation annotation) {
- // future return different types of managed images as JDT does
- // eg. overlay icon images, "grayed" images, quick fixable, etc...
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/Assert.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/Assert.java
deleted file mode 100644
index d42a5b2792..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/Assert.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.util;
-
-
-/**
- * <code>Assert</code> is useful for for embedding runtime sanity checks in
- * code. The predicate methods all test a condition and throw some type of
- * unchecked exception if the condition does not hold.
- * <p>
- * Assertion failure exceptions, like most runtime exceptions, are thrown when
- * something is misbehaving. Assertion failures are invariably unspecified
- * behavior; consequently, clients should never rely on these being thrown
- * (and certainly should not being catching them specifically).
- * </p>
- */
-public final class Assert {
-
- /**
- * <code>AssertionFailedException</code> is a runtime exception thrown
- * by some of the methods in <code>Assert</code>.
- * <p>
- * This class is not declared public to prevent some misuses; programs
- * that catch or otherwise depend on assertion failures are susceptible to
- * unexpected breakage when assertions in the code are added or removed.
- * </p>
- */
- class AssertionFailedException extends RuntimeException {
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructs a new exception.
- */
- public AssertionFailedException() {
- super();
- }
-
- /**
- * Constructs a new exception with the given message.
- */
- public AssertionFailedException(String detail) {
- super(detail);
- }
- }
-
- /**
- * Asserts that an argument is legal. If the given boolean is not
- * <code>true</code>, an <code>IllegalArgumentException</code> is
- * thrown. The given message is included in that exception, to aid
- * debugging.
- *
- * @param expression
- * the outcode of the check
- * @param message
- * the message to include in the exception
- * @return <code>true</code> if the check passes (does not return if the
- * check fails)
- * @exception IllegalArgumentException
- * if the legality test failed
- */
- public static boolean isLegal(boolean expression, String message) {
- if (!expression)
- throw new IllegalArgumentException(message);
- return expression;
- }
-
- /**
- * Asserts that the given object is not <code>null</code>. If this is
- * not the case, some kind of unchecked exception is thrown. The given
- * message is included in that exception, to aid debugging.
- *
- * @param object
- * the value to test
- * @param message
- * the message to include in the exception
- * @exception IllegalArgumentException
- * if the object is <code>null</code>
- */
- public static void isNotNull(Object object, String message) {
- if (object == null) {
- throw new Assert().new AssertionFailedException(message);
- }
- }
-
- /**
- * Asserts that the given boolean is <code>true</code>. If this is not
- * the case, some kind of unchecked exception is thrown. The given message
- * is included in that exception, to aid debugging.
- *
- * @param expression
- * the outcode of the check
- * @param message
- * the message to include in the exception
- * @return <code>true</code> if the check passes (does not return if the
- * check fails)
- */
- public static boolean isTrue(boolean expression, String message) {
- if (!expression) {
- throw new Assert().new AssertionFailedException(message);
- }
- return expression;
- }
-
- /* This class is not intended to be instantiated. */
- private Assert() {
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/EditorUtility.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/EditorUtility.java
deleted file mode 100644
index c45021ae49..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/EditorUtility.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.util;
-
-
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-
-/**
- * Helpful methods to be used with the Source Editor
- */
-public class EditorUtility {
-
- /**
- * Appends to modifier string of the given SWT modifier bit to the given
- * modifierString.
- *
- * @param modifierString
- * the modifier string
- * @param modifier
- * an int with SWT modifier bit
- * @return the concatenated modifier string
- */
- private static String appendModifierString(String modifierString, int modifier) {
- if (modifierString == null)
- modifierString = ""; //$NON-NLS-1$
- String newModifierString = Action.findModifierString(modifier);
- if (modifierString.length() == 0)
- return newModifierString;
- return modifierString + " + " + newModifierString; //$NON-NLS-1$
- }
-
- /**
- * Computes the state mask for the given modifier string.
- *
- * @param modifiers
- * the string with the modifiers, separated by '+', '-', ';',
- * ',' or '.'
- * @return the state mask or -1 if the input is invalid
- */
- public static int computeStateMask(String modifiers) {
- if (modifiers == null)
- return -1;
-
- if (modifiers.length() == 0)
- return SWT.NONE;
-
- int stateMask = 0;
- StringTokenizer modifierTokenizer = new StringTokenizer(modifiers, ",;.:+-* "); //$NON-NLS-1$
- while (modifierTokenizer.hasMoreTokens()) {
- int modifier = EditorUtility.findLocalizedModifier(modifierTokenizer.nextToken());
- if (modifier == 0 || (stateMask & modifier) == modifier)
- return -1;
- stateMask = stateMask | modifier;
- }
- return stateMask;
- }
-
- /**
- * Maps the localized modifier name to a code in the same manner as
- * #findModifier.
- *
- * @return the SWT modifier bit, or <code>0</code> if no match was found
- * @see findModifier
- */
- public static int findLocalizedModifier(String token) {
- if (token == null)
- return 0;
-
- if (token.equalsIgnoreCase(Action.findModifierString(SWT.CTRL)))
- return SWT.CTRL;
- if (token.equalsIgnoreCase(Action.findModifierString(SWT.SHIFT)))
- return SWT.SHIFT;
- if (token.equalsIgnoreCase(Action.findModifierString(SWT.ALT)))
- return SWT.ALT;
- if (token.equalsIgnoreCase(Action.findModifierString(SWT.COMMAND)))
- return SWT.COMMAND;
-
- return 0;
- }
-
- /**
- * Temporary method to help migrate from using StructuredTextColors to
- * using base ColorRegistry. Instead of using symbolic names in the color
- * registry, we are currently mapping the rgb.toString value to
- * corresponding color.
- *
- * @param rgb
- * @return Color
- */
- public static Color getColor(RGB rgb) {
- if (rgb == null)
- return null;
-
- // get the color from the platform color registry
- Color color = JFaceResources.getColorRegistry().get(rgb.toString());
-
- // if the platform color registry does not have this color yet, add to
- // the registry
- if (color == null) {
- JFaceResources.getColorRegistry().put(rgb.toString(), rgb);
- color = JFaceResources.getColorRegistry().get(rgb.toString());
- }
- return color;
- }
-
- /**
- * Returns the modifier string for the given SWT modifier modifier bits.
- *
- * @param stateMask
- * the SWT modifier bits
- * @return the modifier string
- */
- public static String getModifierString(int stateMask) {
- String modifierString = ""; //$NON-NLS-1$
- if ((stateMask & SWT.CTRL) == SWT.CTRL)
- modifierString = appendModifierString(modifierString, SWT.CTRL);
- if ((stateMask & SWT.ALT) == SWT.ALT)
- modifierString = appendModifierString(modifierString, SWT.ALT);
- if ((stateMask & SWT.SHIFT) == SWT.SHIFT)
- modifierString = appendModifierString(modifierString, SWT.SHIFT);
- if ((stateMask & SWT.COMMAND) == SWT.COMMAND)
- modifierString = appendModifierString(modifierString, SWT.COMMAND);
-
- return modifierString;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/PlatformStatusLineUtil.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/PlatformStatusLineUtil.java
deleted file mode 100644
index 83344e421d..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/PlatformStatusLineUtil.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.util;
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.custom.VerifyKeyListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * Utility to display (and/or clear) messages on the status line.
- *
- * @author pavery
- */
-public class PlatformStatusLineUtil {
-
- private static class ClearErrorMessage implements Runnable {
- public void run() {
- displayMessage(null);
- }
- }
-
- /**
- * Used to clear message on focus loss, change of selection, key type,
- * etc...
- */
- private static class OneTimeListener extends FocusAdapter implements VerifyKeyListener, SelectionListener, MouseListener {
-
- private Runnable fRunner = null;
- private StyledText fStyledText;
-
- public OneTimeListener(StyledText target, Runnable r) {
- fStyledText = target;
- fRunner = r;
- fStyledText.addVerifyKeyListener(this);
- fStyledText.addFocusListener(this);
- fStyledText.addSelectionListener(this);
- fStyledText.addMouseListener(this);
- }
-
- public void focusLost(FocusEvent e) {
- unhookAndRun();
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- unhookAndRun();
- }
-
- public void mouseDown(MouseEvent e) {
- unhookAndRun();
- }
-
- public void mouseUp(MouseEvent e) {
- //
- }
-
- private void unhookAndRun() {
- fStyledText.removeVerifyKeyListener(this);
- fStyledText.removeFocusListener(this);
- fStyledText.removeSelectionListener(this);
- fStyledText.removeMouseListener(this);
- fStyledText.getDisplay().asyncExec(fRunner);
- }
-
- public void verifyKey(VerifyEvent event) {
- unhookAndRun();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- unhookAndRun();
- }
-
- public void widgetSelected(SelectionEvent e) {
- unhookAndRun();
- }
- }
-
- /**
- * Status line will be cleared w/ key type, or selection change
- *
- * @param widget
- */
- public static void addOneTimeClearListener() {
- IEditorPart editor = getActiveEditor();
- boolean added = false;
- if (editor != null) {
- Control control = (Control) editor.getAdapter(Control.class);
- if (control instanceof StyledText) {
- addOneTimeClearListener(((StyledText) control));
- added = true;
- }
- }
- if (!added) {
- // clear the error message immediately
- displayMessage(null);
- }
- }
-
- private static void addOneTimeClearListener(StyledText widget) {
- new OneTimeListener(widget, new ClearErrorMessage());
- }
-
- /**
- * Clears the status line immediately
- */
- public static void clearStatusLine() {
- displayMessage(null);
- }
-
- /**
- * Display a message on the status line (with a beep)
- *
- * @param msg
- */
- public static void displayErrorMessage(String msg) {
- displayMessage(msg);
- PlatformUI.getWorkbench().getDisplay().beep();
- }
-
- /**
- * Display a message on the status line (no beep)
- *
- * @param msg
- */
- public static void displayMessage(String msg) {
- IEditorPart editor = getActiveEditor();
- if (editor != null) {
- editor.getEditorSite().getActionBars().getStatusLineManager().setErrorMessage(msg);
- }
-
- }
-
- private static IEditorPart getActiveEditor() {
- IEditorPart editor = null;
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- }
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null)
- editor = page.getActiveEditor();
- }
- return editor;
- }
-
- private PlatformStatusLineUtil() {
- // force use of singleton
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/RegistryReader.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/RegistryReader.java
deleted file mode 100644
index b68597e214..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/RegistryReader.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.util;
-
-
-
-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.IPluginRegistry;
-import org.eclipse.wst.sse.ui.internal.Logger;
-
-
-/**
- * Template implementation of a registry reader that creates objects
- * representing registry contents. Typically, an extension contains one
- * element, but this reader handles multiple elements per extension.
- *
- * To start reading the extensions from the registry for an extension point,
- * call the method <code>readRegistry</code>.
- *
- * To read children of an IConfigurationElement, call the method
- * <code>readElementChildren</code> from your implementation of the method
- * <code>readElement</code>, as it will not be done by default.
- */
-public abstract class RegistryReader {
-
-
- protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
-
- /**
- * The constructor.
- */
- protected RegistryReader() {
- }
-
- /**
- * This method extracts description as a subelement of the given element.
- *
- * @return description string if defined, or empty string if not.
- */
- protected String getDescription(IConfigurationElement config) {
- IConfigurationElement[] children = config.getChildren(TAG_DESCRIPTION);
- if (children.length >= 1) {
- return children[0].getValue();
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Logs the error in the workbench log using the provided text and the
- * information in the configuration element.
- */
- protected void logError(IConfigurationElement element, String text) {
- IExtension extension = element.getDeclaringExtension();
- StringBuffer buf = new StringBuffer();
- buf.append("Plugin " + extension.getNamespace() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-2$//$NON-NLS-1$
- buf.append("\n" + text); //$NON-NLS-1$
- Logger.log(Logger.ERROR, buf.toString());
- }
-
- /**
- * Logs a very common registry error when a required attribute is missing.
- */
- protected void logMissingAttribute(IConfigurationElement element, String attributeName) {
- logError(element, "Required attribute '" + attributeName + "' not defined"); //$NON-NLS-2$//$NON-NLS-1$
- }
-
- /**
- * Logs a registry error when the configuration element is unknown.
- */
- protected void logUnknownElement(IConfigurationElement element) {
- logError(element, "Unknown extension tag found: " + element.getName()); //$NON-NLS-1$
- }
-
- /**
- * Apply a reproducable order to the list of extensions provided, such
- * that the order will not change as extensions are added or removed.
- */
- protected IExtension[] orderExtensions(IExtension[] extensions) {
- // By default, the order is based on plugin id sorted
- // in ascending order. The order for a plugin providing
- // more than one extension for an extension point is
- // dependent in the order listed in the XML file.
- Sorter sorter = new Sorter() {
- public boolean compare(Object extension1, Object extension2) {
- String s1 = ((IExtension) extension1).getNamespace().toUpperCase();
- String s2 = ((IExtension) extension2).getNamespace().toUpperCase();
- //Return true if elementTwo is 'greater than' elementOne
- return s2.compareTo(s1) > 0;
- }
- };
-
- Object[] sorted = sorter.sort(extensions);
- IExtension[] sortedExtension = new IExtension[sorted.length];
- System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length);
- return sortedExtension;
- }
-
- /**
- * Implement this method to read element's attributes. If children should
- * also be read, then implementor is responsible for calling
- * <code>readElementChildren</code>. Implementor is also responsible
- * for logging missing attributes.
- *
- * @return true if element was recognized, false if not.
- */
- protected abstract boolean readElement(IConfigurationElement element);
-
- /**
- * Read the element's children. This is called by the subclass'
- * readElement method when it wants to read the children of the element.
- */
- protected void readElementChildren(IConfigurationElement element) {
- readElements(element.getChildren());
- }
-
- /**
- * Read each element one at a time by calling the subclass implementation
- * of <code>readElement</code>.
- *
- * Logs an error if the element was not recognized.
- */
- protected void readElements(IConfigurationElement[] elements) {
- for (int i = 0; i < elements.length; i++) {
- if (!readElement(elements[i]))
- logUnknownElement(elements[i]);
- }
- }
-
- /**
- * Read one extension by looping through its configuration elements.
- */
- protected void readExtension(IExtension extension) {
- readElements(extension.getConfigurationElements());
- }
-
- /**
- * @deprecated use readRegistry(IExtensionRegistry registry, String pluginId, String extensionPoint)
- */
- protected void readRegistry(IPluginRegistry registry, String pluginId, String extensionPoint) {
- IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- extensions = orderExtensions(extensions);
- for (int i = 0; i < extensions.length; i++)
- readExtension(extensions[i]);
- }
- }
-
- /**
- * Start the registry reading process using the supplied plugin ID and
- * extension point.
- */
- protected void readRegistry(IExtensionRegistry registry, String pluginId, String extensionPoint) {
- IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- extensions = orderExtensions(extensions);
- for (int i = 0; i < extensions.length; i++)
- readExtension(extensions[i]);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/Sorter.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/Sorter.java
deleted file mode 100644
index 6cee01a9cc..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/util/Sorter.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.util;
-
-
-
-/**
- * The SortOperation takes a collection of objects and returns a sorted
- * collection of these objects. Concrete instances of this class provide the
- * criteria for the sorting of the objects based on the type of the objects.
- */
-public abstract class Sorter {
-
- /**
- * Returns true if elementTwo is 'greater than' elementOne This is the
- * 'ordering' method of the sort operation. Each subclass overides this
- * method with the particular implementation of the 'greater than' concept
- * for the objects being sorted.
- */
- public abstract boolean compare(Object elementOne, Object elementTwo);
-
- /**
- * Sort the objects in sorted collection and return that collection.
- */
- private Object[] quickSort(Object[] sortedCollection, int left, int right) {
- int originalLeft = left;
- int originalRight = right;
- Object mid = sortedCollection[(left + right) / 2];
-
- do {
- while (compare(sortedCollection[left], mid))
- left++;
- while (compare(mid, sortedCollection[right]))
- right--;
- if (left <= right) {
- Object tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
-
- if (originalLeft < right)
- sortedCollection = quickSort(sortedCollection, originalLeft, right);
- if (left < originalRight)
- sortedCollection = quickSort(sortedCollection, left, originalRight);
-
- return sortedCollection;
- }
-
- /**
- * Return a new sorted collection from this unsorted collection. Sort
- * using quick sort.
- */
- public Object[] sort(Object[] unSortedCollection) {
- int size = unSortedCollection.length;
- Object[] sortedCollection = new Object[size];
-
- //copy the array so can return a new sorted collection
- System.arraycopy(unSortedCollection, 0, sortedCollection, 0, size);
- if (size > 1)
- quickSort(sortedCollection, 0, size - 1);
-
- return sortedCollection;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/CaretEvent.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/CaretEvent.java
deleted file mode 100644
index 6c8fa1a651..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/CaretEvent.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.view.events;
-
-/**
- * @deprecated - use base selection notification
- *
- * Simply holds data to be passed to CaretEventListeners
- */
-public class CaretEvent extends java.util.EventObject {
-
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 1L;
- // initialize to impossible location
- int fPosition = -1;
-
- /**
- * doesnt't make sense to have a CaretEvent without the Caret postion, so
- * use other constructor
- */
- protected CaretEvent(Object source) {
- super(source);
- }
-
- /**
- * This is the preferred constructor.
- */
- public CaretEvent(Object source, int position) {
- super(source);
- setPosition(position);
- }
-
- public int getPosition() {
- return fPosition;
- }
-
- void setPosition(int newPosition) {
- fPosition = newPosition;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/ICaretListener.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/ICaretListener.java
deleted file mode 100644
index 90b19ec5be..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/ICaretListener.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.view.events;
-
-/**
- * @deprecated - use base selection notification
- */
-public interface ICaretListener extends java.util.EventListener {
- public void caretMoved(CaretEvent event);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/INodeSelectionListener.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/INodeSelectionListener.java
deleted file mode 100644
index fc5c0ed8e5..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/INodeSelectionListener.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.view.events;
-
-
-/**
- * @deprecated - use base selection notification
- */
-
-public interface INodeSelectionListener {
- void nodeSelectionChanged(NodeSelectionChangedEvent event);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/ITextSelectionListener.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/ITextSelectionListener.java
deleted file mode 100644
index 4683bbb20f..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/ITextSelectionListener.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.view.events;
-
-/**
- * @deprecated - use base selection notification
- */
-public interface ITextSelectionListener {
- void textSelectionChanged(TextSelectionChangedEvent event);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/NodeSelectionChangedEvent.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/NodeSelectionChangedEvent.java
deleted file mode 100644
index 2940a7fa42..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/NodeSelectionChangedEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.view.events;
-
-import java.util.List;
-
-/**
- * @deprecated - use base selection notification
- */
-public class NodeSelectionChangedEvent extends java.util.EventObject {
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 1L;
-
- int fCaretPosition;
-
- List fSelectedNodes;
-
- public NodeSelectionChangedEvent(Object source, List selectedNodes, int caretPosition) {
- super(source);
- fSelectedNodes = selectedNodes;
- fCaretPosition = caretPosition;
- }
-
- public int getCaretPosition() {
- return fCaretPosition;
- }
-
- public List getSelectedNodes() {
- return fSelectedNodes;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/TextSelectionChangedEvent.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/TextSelectionChangedEvent.java
deleted file mode 100644
index 09dbf4c00c..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/view/events/TextSelectionChangedEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.view.events;
-
-/**
- * @deprecated - use base selection notification
- */
-public class TextSelectionChangedEvent extends java.util.EventObject {
- /**
- * Comment for <code>serialVersionUID</code>
- */
- private static final long serialVersionUID = 1L;
-
- int fTextSelectionEnd;
-
- int fTextSelectionStart;
-
- public TextSelectionChangedEvent(Object source, int textSelectionStart, int textSelectionEnd) {
- super(source);
- fTextSelectionStart = textSelectionStart;
- fTextSelectionEnd = textSelectionEnd;
- }
-
- public int getTextSelectionEnd() {
- return fTextSelectionEnd;
- }
-
- public int getTextSelectionStart() {
- return fTextSelectionStart;
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/contentoutline/ContentOutlineConfiguration.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/contentoutline/ContentOutlineConfiguration.java
deleted file mode 100644
index 07f0d629f5..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/contentoutline/ContentOutlineConfiguration.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.views.contentoutline;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.TransferDragSourceListener;
-import org.eclipse.jface.util.TransferDropTargetListener;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateAction;
-import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateActionContributionItem;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImageHelper;
-import org.eclipse.wst.sse.ui.internal.editor.EditorPluginImages;
-
-/**
- * Basic Configuration class for Outline Pages
- *
- * @since 1.0
- */
-public abstract class ContentOutlineConfiguration {
- /**
- * Add a collapse action to help with navigation.
- */
- private class CollapseTreeAction extends Action {
- private TreeViewer fTreeViewer = null;
-
- public CollapseTreeAction(TreeViewer viewer) {
- super(SSEUIMessages.ContentOutlineConfiguration_0, AS_PUSH_BUTTON); //$NON-NLS-1$
- setImageDescriptor(COLLAPSE_E);
- setDisabledImageDescriptor(COLLAPSE_D);
- setToolTipText(getText());
- fTreeViewer = viewer;
- }
-
- public void run() {
- super.run();
- fTreeViewer.collapseAll();
- }
- }
-
- /**
- * Toggles whether incoming selection notification affects us
- */
- private class ToggleLinkAction extends PropertyChangeUpdateAction {
- public ToggleLinkAction(IPreferenceStore store, String preference) {
- super(SSEUIMessages.ContentOutlineConfiguration_1, store, preference, true); //$NON-NLS-1$
- setToolTipText(getText());
- setDisabledImageDescriptor(SYNCED_D);
- setImageDescriptor(SYNCED_E);
- update();
- }
-
- public void update() {
- super.update();
- setLinkWithEditor(isChecked());
- }
- }
-
- ImageDescriptor COLLAPSE_D = EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_DLCL_COLLAPSEALL);
- ImageDescriptor COLLAPSE_E = EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_ELCL_COLLAPSEALL);
-
- private boolean fIsLinkWithEditor = false;
-
- private ILabelProvider fLabelProvider;
- private IContributionItem[] fMenuContributions = null;
- private IContributionItem[] fToolbarContributions = null;
- private final String OUTLINE_LINK_PREF = "outline-link-editor"; //$NON-NLS-1$
- ImageDescriptor SYNCED_D = EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_DLCL_SYNCED);
- ImageDescriptor SYNCED_E = EditorPluginImageHelper.getInstance().getImageDescriptor(EditorPluginImages.IMG_ELCL_SYNCED);
-
- /**
- * Create new instance of ContentOutlineConfiguration
- */
- public ContentOutlineConfiguration() {
- // Must have empty constructor to createExecutableExtension
- super();
- }
-
- /**
- * Creates the contributions for the view's local menu. Subclasses should
- * merge their contributions with these.
- *
- * @param viewer
- * the TreeViewer associated with this configuration
- * @return menu contributions
- */
- protected IContributionItem[] createMenuContributions(TreeViewer viewer) {
- IContributionItem toggleLinkItem = new PropertyChangeUpdateActionContributionItem(new ToggleLinkAction(getPreferenceStore(), OUTLINE_LINK_PREF));
- IContributionItem[] items = new IContributionItem[]{toggleLinkItem};
- return items;
- }
-
- /**
- * Creates the toolbar contributions. Subclasses should merge their
- * contributions with these.
- *
- * @param viewer
- * the TreeViewer associated with this configuration
- * @return toolbar contributions
- */
- protected IContributionItem[] createToolbarContributions(TreeViewer viewer) {
- IContributionItem collapseAllItem = new ActionContributionItem(new CollapseTreeAction(viewer));
- IContributionItem[] items = new IContributionItem[]{collapseAllItem};
- return items;
- }
-
- /**
- * Returns the ContentProvider to use with the given viewer.
- *
- * @param viewer
- * the TreeViewer associated with this configuration
- * @return the IContentProvider to use with this viewer
- */
- public abstract IContentProvider getContentProvider(TreeViewer viewer);
-
- /**
- * Returns an array of KeyListeners to attach to the given viewer's
- * control or null.
- *
- * @param viewer
- * the TreeViewer associated with this configuration
- * @return an array of KeyListeners to attach to the TreeViewer's Control,
- * or null. The listeners should adhere to the KeyEvent.doit field
- * to ensure proper behaviors. Ordering of the event notifications
- * is dependent on the Control in the TreeViewer.
- */
- public KeyListener[] getKeyListeners(TreeViewer viewer) {
- return null;
- }
-
- /**
- * Returns the LabelProvider for the items within the given viewer.
- *
- * @param viewer
- * the TreeViewer associated with this configuration
- * @return the ILabelProvider for items within the viewer
- */
- public ILabelProvider getLabelProvider(TreeViewer viewer) {
- if (fLabelProvider == null)
- fLabelProvider = new LabelProvider();
- return fLabelProvider;
- }
-
- /**
- * Returns the menu contribution items for the local menu in the outline.
- *
- * @param viewer
- * the TreeViewer associated with this configuration
- * @return IContributionItem[] for the local menu
- */
- public final IContributionItem[] getMenuContributions(TreeViewer viewer) {
- if (fMenuContributions == null) {
- fMenuContributions = createMenuContributions(viewer);
- }
- return fMenuContributions;
- }
-
- /**
- * Returns the menu listener to notify when the given viewer's context
- * menu is about to be shown or null.
- *
- * @param viewer
- * the TreeViewer associated with this configuration
- * @return the IMenuListener to notify when the viewer's context menu is
- * about to be shown, or null
- */
- public IMenuListener getMenuListener(TreeViewer viewer) {
- return null;
- }
-
- /**
- * Returns the PreferenceStore to use for this configuration.
- *
- * @return the preference store in which to remember preferences (such as
- * the link-with-editor toggle state)
- */
- protected IPreferenceStore getPreferenceStore() {
- return SSEUIPlugin.getInstance().getPreferenceStore();
- }
-
- /**
- * Returns the (filtered) selection from the given selection.
- *
- * @param selection
- * model selection
- * @param viewer
- * the TreeViewer associated with this configuration
- * @return The (filtered) selection from this event. Uses include mapping
- * model selection onto elements provided by the content provider.
- * Should only return elements that will be shown in the Tree
- * Control.
- */
- public ISelection getSelection(TreeViewer viewer, ISelection selection) {
- return selection;
- }
-
- /**
- * Returns contribution items for the local toolbar in the outline.
- *
- * @param viewer
- * the TreeViewer associated with this configuration
- * @return IContributionItem[] for the local toolbar
- */
- public final IContributionItem[] getToolbarContributions(TreeViewer viewer) {
- if (fToolbarContributions == null) {
- fToolbarContributions = createToolbarContributions(viewer);
- }
- return fToolbarContributions;
- }
-
- /**
- * Adopted since you can't easily removeDragSupport from
- * StructuredViewers.
- *
- * @param treeViewer
- * the TreeViewer associated with this configuration
- * @return an array of TransferDragSourceListeners
- */
- public TransferDragSourceListener[] getTransferDragSourceListeners(TreeViewer treeViewer) {
- return new TransferDragSourceListener[0];
- }
-
- /**
- * Adopted since you can't easily removeDropSupport from
- * StructuredViewers.
- *
- * @param treeViewer
- * the TreeViewer associated with this configuration
- * @return an array of TransferDropTargetListeners
- */
- public TransferDropTargetListener[] getTransferDropTargetListeners(TreeViewer treeViewer) {
- return new TransferDropTargetListener[0];
- }
-
- /**
- * Returns true if node selection changes affect selection in the
- * TreeViewer.
- *
- * @param treeViewer
- * the TreeViewer associated with this configuration
- * @return true if outline is currently linked to selection in editor,
- * false otherwise
- */
- public boolean isLinkedWithEditor(TreeViewer treeViewer) {
- return fIsLinkWithEditor;
- }
-
- /**
- * Sets whether or not outline view should be linked with selection in
- * editor.
- *
- * @param isLinkWithEditor
- * The isLinkWithEditor to set.
- */
- void setLinkWithEditor(boolean isLinkWithEditor) {
- fIsLinkWithEditor = isLinkWithEditor;
- }
-
- /**
- * General hook for resource releasing and listener removal when
- * configurations change or the viewer is disposed of. This implementation
- * stops of any remaining PropertyChangeUpdateActionContributionItem from
- * preference listening.
- *
- * @param viewer
- * the TreeViewer associated with this configuration
- */
- public void unconfigure(TreeViewer viewer) {
- if (fToolbarContributions != null) {
- for (int i = 0; i < fToolbarContributions.length; i++) {
- if (fToolbarContributions[i] instanceof PropertyChangeUpdateActionContributionItem) {
- ((PropertyChangeUpdateActionContributionItem) fToolbarContributions[i]).disconnect();
- }
- }
- fToolbarContributions = null;
- }
- if (fMenuContributions != null) {
- for (int i = 0; i < fMenuContributions.length; i++) {
- if (fMenuContributions[i] instanceof PropertyChangeUpdateActionContributionItem) {
- ((PropertyChangeUpdateActionContributionItem) fMenuContributions[i]).disconnect();
- }
- }
- fMenuContributions = null;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/IPropertySourceExtension.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/IPropertySourceExtension.java
deleted file mode 100644
index d74eee9c90..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/IPropertySourceExtension.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.views.properties;
-
-/**
- * Declares that this IPropertySource might support outright removal of a
- * property
- *
- * @since 1.0
- */
-public interface IPropertySourceExtension {
-
- /**
- * Returns true if the property matching the given name can be removed,
- * false otherwise.
- *
- * @param name
- * the name of the property
- * @return whether the property matching this name can be removed
- */
- boolean isPropertyRemovable(Object name);
-
- /**
- * Removes the property with the given displayed name. If no such property
- * exists, nothing is done.
- *
- * @param name
- * the displayed name of the property
- */
- void removeProperty(Object name);
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/PropertySheetConfiguration.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/PropertySheetConfiguration.java
deleted file mode 100644
index f89e38d8af..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/views/properties/PropertySheetConfiguration.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.views.properties;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.IPropertySourceProvider;
-
-
-/**
- * Configuration class for Property Sheet Pages. Not finalized.
- *
- * @since 1.0
- */
-public abstract class PropertySheetConfiguration {
- /**
- * Create new instance of PropertySheetConfiguration
- */
- public PropertySheetConfiguration() {
- // Must have empty constructor to createExecutableExtension
- super();
- }
-
- /**
- * Adds contribution menu items to the given menuManager, toolbarManager,
- * statusLineManager.
- *
- * @param menuManager
- * the local menu manager of the property sheet
- * @param toolBarManager
- * the local toolbar manager of the property sheet
- * @param statusLineManager
- * the status line manager of the property sheet
- */
- public void addContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
- // do nothing
- }
-
- /**
- * Allows for filteration of selection before being sent to the viewer.
- *
- * @param selectingPart
- * may be null
- * @param selection
- * model selection
- * @return the (filtered) selection to be sent to the viewer
- */
- public ISelection getInputSelection(IWorkbenchPart selectingPart, ISelection selection) {
- ISelection preferredSelection = selection;
- if (selection instanceof IStructuredSelection) {
- // don't support more than one selected node
- if (((IStructuredSelection) selection).size() > 1)
- preferredSelection = StructuredSelection.EMPTY;
- }
- return preferredSelection;
- }
-
- /**
- * Returns the correct IPropertySourceProvider.
- *
- * @param page
- * the page to be configured by this configuration
- * @return the IPropertySourceProvider for the given page
- */
- public abstract IPropertySourceProvider getPropertySourceProvider(IPropertySheetPage page);
-
- /**
- * Removes contribution menu items from the given menuManager,
- * toolbarManager, statusLineManager.
- *
- * @param menuManager
- * the local menu manager of the property sheet
- * @param toolBarManager
- * the local toolbar manager of the property sheet
- * @param statusLineManager
- * the status line manager of the property sheet
- */
- public void removeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
- // do nothing
- }
-
- /**
- * General hook for resource releasing and listener removal when
- * configurations change.
- */
- public void unconfigure() {
- }
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/testToc.xml b/bundles/org.eclipse.wst.sse.ui/testToc.xml
deleted file mode 100644
index 6142b90182..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/testToc.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?NLS TYPE="org.eclipse.help.toc"?>
-
-<toc
- label="Test TOC"
- topic="html/toc.html">
- <link toc="toc.xml" />
-</toc> \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.sse.ui/toc.xml b/bundles/org.eclipse.wst.sse.ui/toc.xml
deleted file mode 100644
index a5c0bb6c2b..0000000000
--- a/bundles/org.eclipse.wst.sse.ui/toc.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?NLS TYPE="org.eclipse.help.toc"?>
-
-<toc label="Sample Table of Contents">
- <topic
- label="Main Topic"
- href="html/maintopic.html">
- <topic
- label="Sub Topic"
- href="html/subtopic.html" />
- </topic>
- <topic label="Main Topic 2" />
-</toc>

Back to the top