Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.wst.server.ui/serverui')
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerLaunchConfigurationTab.java291
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerUICore.java42
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerUIUtil.java41
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/IServerEditorPartInput.java36
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/ServerEditorPart.java302
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/ServerEditorSection.java156
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/package.html22
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/package.xml22
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ContextIds.java80
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultMonitorDelegate.java76
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerImageDescriptor.java106
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerLabelDecorator.java104
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DeleteServerDialog.java256
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/EclipseUtil.java221
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ImageResource.java363
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/LaunchClientJob.java87
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.java307
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.properties434
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/OverlayImageDescriptor.java115
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ProgressUtil.java69
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ProjectPropertyPage.java205
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/RuntimePreferencePage.java386
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/SWTUtil.java88
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerAdapterFactory.java41
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLabelProvider.java195
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLaunchShortcut.java65
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPreferencePage.java362
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPropertyTester.java98
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPlugin.java756
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPreferences.java206
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Startup.java67
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/TerminationDialog.java81
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Trace.java80
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/WebLaunchableClient.java45
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AbstractServerActionDelegate.java88
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DebugOnServerAction.java52
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DebugOnServerActionDelegate.java24
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DeleteActionDelegate.java86
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/LaunchWizardAction.java59
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewServerAction.java64
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewServerWizardAction.java54
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewWizardAction.java66
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/ProfileOnServerAction.java52
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/ProfileOnServerActionDelegate.java24
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerAction.java52
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java504
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/Audio.java57
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioCore.java694
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioPreferencePage.java469
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioTableContentProvider.java184
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioTableLabelProvider.java156
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/CategoryTableViewer.java53
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/Sound.java110
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/XMLMemento.java334
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/ServerCommand.java52
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerAutoPublishDefaultCommand.java50
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerAutoPublishTimeCommand.java50
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerConfigurationFolderCommand.java48
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerHostnameCommand.java47
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerNameCommand.java47
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerRuntimeCommand.java48
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java695
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IOrdered.java33
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorActionFactory.java64
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorInput.java31
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPageSectionFactory.java54
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPartFactory.java68
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java730
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java957
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionBarContributor.java113
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionFactory.java164
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorCore.java223
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInput.java182
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInputFactory.java55
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPageSectionFactory.java205
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartFactory.java243
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartInput.java83
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java98
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/StatusLineContributionItem.java91
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/TextAction.java246
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ConnectedUIDecorator.java107
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ManagedUIDecorator.java102
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/PublishedUIDecorator.java102
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ServerEditorActionFactoryDelegate.java44
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/UIDecorator.java56
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/UIDecoratorManager.java21
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/AbstractServerAction.java83
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/DeleteAction.java90
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModifyModulesAction.java113
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleServer.java78
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleSloshAction.java90
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerAction.java44
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerDialog.java88
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerPortAction.java73
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/OpenAction.java46
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/PublishAction.java56
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RemoveModuleAction.java57
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RestartAction.java72
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RestartModuleAction.java42
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerAction.java59
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerActionHelper.java247
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableLabelProvider.java276
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableViewer.java493
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServersView.java419
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServersViewDropAdapter.java123
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/StartAction.java81
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/StopAction.java65
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/SwitchServerLocationAction.java48
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/UpdateStatusAction.java40
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTableComposite.java79
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeComposite.java192
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeContentProvider.java223
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeLabelProvider.java63
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/BaseLabelProvider.java74
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/DefaultViewerSorter.java90
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ILockedLabelProvider.java28
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InitialSelectionProvider.java112
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerComposite.java102
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerContentProvider.java62
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerLabelProvider.java41
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/LockedCheckboxTableViewer.java57
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/LockedTableViewer.java68
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorComposite.java227
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorContentProvider.java40
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorDialog.java247
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorLabelProvider.java77
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/PortContentProvider.java39
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/PortLabelProvider.java42
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeComposite.java178
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeContentProvider.java62
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTableLabelProvider.java69
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTreeContentProvider.java71
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTreeLabelProvider.java81
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeComposite.java122
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java103
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeLabelProvider.java42
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/SView.java277
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerComposite.java127
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTreeContentProvider.java118
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTreeLabelProvider.java42
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeComposite.java147
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java146
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeLabelProvider.java42
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/InternetPreferencePage.java72
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/OpenBrowserWorkbenchAction.java81
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/SwitchBrowserWorkbenchAction.java150
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/SwitchDefaultBrowserAction.java57
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/AbstractWizard.java49
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/ClosableWizardDialog.java35
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/ModifyModulesWizard.java57
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewInstallableServerWizard.java80
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewRuntimeWizard.java48
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewServerWizard.java79
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/RunOnServerWizard.java92
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/SelectClientWizard.java57
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/SelectTasksWizard.java68
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizard.java562
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizardPage.java122
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/WizardTaskUtil.java174
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/ModifyModulesWizardFragment.java121
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewInstallableServerWizardFragment.java48
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewRuntimeWizardFragment.java70
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewServerWizardFragment.java140
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/ServerConfigurationWizardFragment.java56
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/TasksWizardFragment.java249
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ElementCreationCache.java99
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/FixedTableLayout.java50
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/HostnameComposite.java121
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java633
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewDetectServerComposite.java230
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewInstallableServerComposite.java76
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java429
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewRuntimeComposite.java123
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewServerComposite.java487
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/SelectClientComposite.java161
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksComposite.java135
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksLayout.java59
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/WizardUtil.java245
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/WorkspaceRunnableAdapter.java40
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/package.html38
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/package.xml28
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/IWizardHandle.java70
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/WizardFragment.java214
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/package.html22
-rw-r--r--plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/package.xml22
185 files changed, 0 insertions, 26118 deletions
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerLaunchConfigurationTab.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerLaunchConfigurationTab.java
deleted file mode 100644
index 477733fc7..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerLaunchConfigurationTab.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-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.Label;
-import org.eclipse.ui.PlatformUI;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.ui.internal.*;
-/**
- * Server launch configuration tab.
- *
- * @since 1.0
- */
-public class ServerLaunchConfigurationTab extends AbstractLaunchConfigurationTab {
- private String[] serverTypeIds;
-
- private Combo serverCombo;
-
- private Label runtimeLabel;
- private Label hostname;
-
- private IServer server;
-
- // list of servers that are in combo
- private List servers;
-
- // flag to be used to decide whether to enable combo in launch config dialog
- // after the user requests a launch, they cannot change it
- private static final String READ_ONLY = "read-only";
-
- /**
- * Create a new server launch configuration tab.
- */
- public ServerLaunchConfigurationTab() {
- this(new String[] {"*"});
- }
-
- /**
- * Create a new server launch configuration tab with the given server type ids.
- *
- * @param serverTypeIds an array of server type ids
- */
- public ServerLaunchConfigurationTab(String[] serverTypeIds) {
- this.serverTypeIds = serverTypeIds;
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 5;
- layout.marginHeight = 5;
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- //GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- //data.widthHint = 200;
- //composite.setLayoutData(data);
-
- Label label = new Label(composite, SWT.WRAP);
- label.setText(Messages.serverLaunchDescription);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- data.grabExcessHorizontalSpace = false;
- data.widthHint = 300;
- label.setLayoutData(data);
-
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.serverLaunchServer);
- serverCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- serverCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- serverCombo.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- public void widgetSelected(SelectionEvent e) {
- handleServerSelection();
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(serverCombo, ContextIds.LAUNCH_CONFIGURATION_SERVER_COMBO);
-
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.serverLaunchRuntime);
- runtimeLabel = new Label(composite, SWT.NONE);
- runtimeLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.serverLaunchHost);
- hostname = new Label(composite, SWT.NONE);
- hostname.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // initialize
- IServer[] servers2 = ServerCore.getServers();
- servers = new ArrayList();
- if (servers2 != null) {
- int size = servers2.length;
- for (int i = 0; i < size; i++) {
- IServer server2 = servers2[i];
- if (server2.getServerType() != null && isSupportedServer(server2.getServerType().getId())) {
- serverCombo.add(server2.getName());
- servers.add(server2);
- }
- }
- }
-
- // select first item in list
- if (serverCombo.getItemCount() > 0)
- serverCombo.select(0);
-
- handleServerSelection();
-
- serverCombo.forceFocus();
-
- Dialog.applyDialogFont(composite);
- setControl(composite);
- }
-
- private boolean isSupportedServer(String serverTypeId) {
- if (serverTypeIds == null)
- return true;
- int size = serverTypeIds.length;
- for (int i = 0; i < size; i++) {
- if (matches(serverTypeId, serverTypeIds[i]))
- return true;
- }
- return false;
- }
-
- private static boolean matches(String a, String b) {
- if (a == null || b == null || "*".equals(a) || "*".equals(b) || a.startsWith(b) || b.startsWith(a))
- return true;
- return false;
- }
-
- /**
- * Called when a server is selected.
- * This method should not be called directly.
- */
- protected void handleServerSelection() {
- if (servers.isEmpty())
- server = null;
- else
- server = (IServer) servers.get(serverCombo.getSelectionIndex());
- IRuntime runtime = null;
- if (server != null) {
- runtime = server.getRuntime();
- hostname.setText(server.getHost());
- } else
- hostname.setText("");
-
- if (runtime != null)
- runtimeLabel.setText(runtime.getName());
- else
- runtimeLabel.setText("");
-
- if (server == null)
- setErrorMessage(Messages.errorNoServerSelected);
- else if (server.getServerState() != IServer.STATE_STOPPED)
- setErrorMessage(Messages.errorServerAlreadyRunning);
- else
- setErrorMessage(null);
- /*if (server != null) {
- server.setLaunchDefaults(configuration);
- }*/
- updateLaunchConfigurationDialog();
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(ILaunchConfigurationWorkingCopy)
- */
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- setErrorMessage(null);
- if (serverCombo != null) {
- serverCombo.setEnabled(true);
- if (serverCombo.getItemCount() > 0)
- serverCombo.select(0);
- }
-
- if (servers != null) {
- server = (IServer) servers.get(serverCombo.getSelectionIndex());
- if (server != null)
- ((Server) server).setupLaunchConfiguration(configuration, null);
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(ILaunchConfiguration)
- */
- public void initializeFrom(ILaunchConfiguration configuration) {
- serverCombo.setEnabled(true);
- //remove error message that other instances may have set
- setErrorMessage(null);
-
- try {
- String serverId = configuration.getAttribute(Server.ATTR_SERVER_ID, "");
- if (serverId != null && !serverId.equals("")) {
- server = ServerCore.findServer(serverId);
-
- if (server == null) { //server no longer exists
- setErrorMessage(Messages.errorInvalidServer);
- //serverCombo.clearSelection(); //appears to be broken...doesn't work with read only?
- serverCombo.setEnabled(false);
- return;
- }
-
- serverCombo.setText(server.getName());
- if (server.getServerState() != IServer.STATE_STOPPED)
- setErrorMessage(Messages.errorServerAlreadyRunning);
- } else {
- if (serverCombo.getItemCount() > 0)
- serverCombo.select(0);
- }
- //flag should only be set if launch has been attempted on the config
- if (configuration.getAttribute(READ_ONLY, false))
- serverCombo.setEnabled(false);
- } catch (CoreException e) {
- // ignore
- }
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy)
- */
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- if (server != null)
- configuration.setAttribute(Server.ATTR_SERVER_ID, server.getId());
- else
- configuration.setAttribute(Server.ATTR_SERVER_ID, (String)null);
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(ILaunchConfiguration)
- */
- public boolean isValid(ILaunchConfiguration launchConfig) {
- try {
- String id = launchConfig.getAttribute(Server.ATTR_SERVER_ID, "");
- if (id != null && !id.equals("")) {
- IServer server2 = ServerCore.findServer(id);
- if (server2 == null)
- return false;
- if (server2.getServerState() == IServer.STATE_STOPPED)
- return true;
- }
- } catch (CoreException e) {
- // ignore
- }
- return false;
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage()
- */
- public Image getImage() {
- return ImageResource.getImage(ImageResource.IMG_SERVER);
- }
-
- /**
- * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
- */
- public String getName() {
- return Messages.serverLaunchConfigurationTab;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerUICore.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerUICore.java
deleted file mode 100644
index 5a1bc0e58..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerUICore.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-
-import org.eclipse.wst.server.ui.internal.ServerLabelProvider;
-/**
- * Server UI core.
- *
- * @since 1.0
- */
-public class ServerUICore {
- private static ServerLabelProvider labelProvider;
-
- /**
- * ServerUICore constructor comment.
- */
- private ServerUICore() {
- super();
- }
-
- /**
- * Returns a label provider that can be used for all server
- * objects in the UI.
- *
- * @return a label provider
- */
- public static ILabelProvider getLabelProvider() {
- if (labelProvider == null)
- labelProvider = new ServerLabelProvider();
- return labelProvider;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerUIUtil.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerUIUtil.java
deleted file mode 100644
index 927eb8464..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/ServerUIUtil.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui;
-
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-
-import org.eclipse.swt.widgets.Shell;
-/**
- * Server UI utility methods.
- *
- * @since 1.0
- */
-public class ServerUIUtil {
- /**
- * ServerUIUtil constructor comment.
- */
- private ServerUIUtil() {
- super();
- }
-
- /**
- * Open the new runtime wizard.
- *
- * @param shell a shell to use when creating the wizard
- * @param type the type of module to create a runtime for
- * @param version the version of module to create a runtime for
- * @return <code>true</code> if a runtime was created, or
- * <code>false</code> otherwise
- */
- public static boolean showNewRuntimeWizard(Shell shell, final String type, final String version) {
- return ServerUIPlugin.showNewRuntimeWizard(shell, type, version, null);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/IServerEditorPartInput.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/IServerEditorPartInput.java
deleted file mode 100644
index 114c9d75a..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/IServerEditorPartInput.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.editor;
-
-import org.eclipse.ui.IEditorInput;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-/**
- * An input into a server part or section editor.
- *
- * @since 1.0
- */
-public interface IServerEditorPartInput extends IEditorInput {
- /**
- * Returns the server to be edited.
- *
- * @return a working copy of the server
- */
- public IServerWorkingCopy getServer();
-
- /**
- * Returns true if the server is read-only.
- *
- * @return boolean <code>true</code> if the server is read-only,
- * and <code>false</code> otherwise
- */
- public boolean isServerReadOnly();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/ServerEditorPart.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/ServerEditorPart.java
deleted file mode 100644
index 6516e2c65..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/ServerEditorPart.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.editor;
-
-import java.util.*;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.part.EditorPart;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.editor.*;
-/**
- * An abstract server editor which implements the most common methods
- * from IEditorPart.
- *
- * This class also provides each editor page with an error message which
- * will be displayed on the status bar of the editor.
- *
- * @since 1.0
- */
-public abstract class ServerEditorPart extends EditorPart {
- /**
- * Property change id for the error message.
- */
- public static final int PROP_ERROR = 5;
-
- private String errorMessage = null;
- private Map sectionToInsertionId = null;
- private List sections = null;
- private ServerResourceCommandManager commandManager;
- private FormToolkit toolkit;
-
- /**
- * The server currently being edited.
- */
- protected IServerWorkingCopy server;
-
- /**
- * <code>true</code> if the server is read-only, and <code>false</code>
- * otherwise.
- */
- protected boolean readOnly;
-
- /**
- * Create a new server editor part.
- */
- public ServerEditorPart() {
- super();
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#doSave(IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor) {
- // do nothing
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#doSaveAs()
- */
- public void doSaveAs() {
- // do nothing
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#isDirty()
- */
- public boolean isDirty() {
- return false;
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /**
- * Set an error message for this page.
- *
- * @param error java.lang.String
- */
- public void setErrorMessage(String error) {
- if (error == null && errorMessage == null)
- return;
-
- if (error != null && error.equals(errorMessage))
- return;
-
- errorMessage = error;
- super.firePropertyChange(PROP_ERROR);
- }
-
- /**
- * Updates the error message shown in the editor.
- */
- public void updateErrorMessage() {
- super.firePropertyChange(PROP_ERROR);
- }
-
- /**
- * Return the error message for this page.
- *
- * @return java.lang.String
- */
- public String getErrorMessage() {
- if (errorMessage == null) {
- Iterator iterator = getSections().iterator();
- while (iterator.hasNext()) {
- ServerEditorSection section = (ServerEditorSection) iterator.next();
- String error = section.getErrorMessage();
- if (error != null)
- return error;
- }
- }
- return errorMessage;
- }
-
- /**
- * Returns error or status messages that will be displayed when the
- * server resource is saved. If there are any error messages, the
- * user will be unable to save the editor.
- *
- * @return org.eclipse.core.runtime.IStatus
- */
- public IStatus[] getSaveStatus() {
- Iterator iterator = getSections().iterator();
- List list = new ArrayList();
- while (iterator.hasNext()) {
- ServerEditorSection section = (ServerEditorSection) iterator.next();
- IStatus[] status = section.getSaveStatus();
- if (status != null) {
- int size = status.length;
- for (int i = 0; i < size; i++)
- list.add(status[i]);
- }
- }
-
- int size = list.size();
- IStatus[] status = new IStatus[size];
- list.toArray(status);
- return status;
- }
-
- private List getSections() {
- if (sections == null) {
- sections = new ArrayList();
- sectionToInsertionId = new HashMap();
- Iterator iterator = ServerEditorCore.getServerEditorPageSectionFactories().iterator();
- while (iterator.hasNext()) {
- IServerEditorPageSectionFactory factory = (IServerEditorPageSectionFactory) iterator.next();
- String insertionId = factory.getInsertionId();
-
- IServerEditorPartFactory pageFactory = ServerEditor.getPageFactory(this);
- if (pageFactory.supportsInsertionId(insertionId)) {
- String serverTypeId = null;
- if (server != null)
- serverTypeId = server.getServerType().getId();
- if (serverTypeId != null && factory.supportsType(serverTypeId)
- && factory.shouldCreateSection(server)) {
- ServerEditorSection section = factory.createSection();
- if (section != null) {
- section.setServerEditorPart(this);
- sections.add(section);
- List list = null;
- try {
- list = (List) sectionToInsertionId.get(insertionId);
- } catch (Exception e) {
- // ignore
- }
- if (list == null)
- list = new ArrayList();
- list.add(section);
- sectionToInsertionId.put(insertionId, list);
- }
- }
- }
- }
- }
- return sections;
- }
-
- private List getSections(String insertionId) {
- if (insertionId == null)
- return null;
-
- getSections();
- List list = new ArrayList();
- try {
- List sections2 = (List) sectionToInsertionId.get(insertionId);
- if (sections2 != null) {
- Iterator iterator = sections2.iterator();
- while (iterator.hasNext()) {
- list.add(iterator.next());
- }
- }
- } catch (Exception e) {
- // ignore
- }
- return list;
- }
-
- /**
- * @see org.eclipse.ui.IEditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- */
- public void init(IEditorSite site, IEditorInput input) {
- setSite(site);
- setInput(input);
- if (input instanceof IServerEditorPartInput) {
- IServerEditorPartInput sepi = (IServerEditorPartInput) input;
- server = sepi.getServer();
- commandManager = ((ServerEditorPartInput) sepi).getServerCommandManager();
- readOnly = sepi.isServerReadOnly();
- }
-
- Iterator iterator = getSections().iterator();
- while (iterator.hasNext()) {
- ServerEditorSection section = (ServerEditorSection) iterator.next();
- section.init(site, input);
- }
- }
-
- /**
- * Executes the given operation and adds it to the operation history
- * with the correct context.
- *
- * @param operation an operation ready to be executed
- */
- public void execute(IUndoableOperation operation) {
- commandManager.execute(operation);
- }
-
- /**
- * Return the server that is being editted.
- *
- * @return a server working copy
- */
- public IServerWorkingCopy getServer() {
- return server;
- }
-
- /**
- * Inserts editor sections into the given composite.
- *
- * @param parent the composite to add the section(s) to
- * @param id the section insertion id
- */
- public void insertSections(Composite parent, String id) {
- if (id == null)
- return;
-
- Iterator iterator = getSections(id).iterator();
- while (iterator.hasNext()) {
- ServerEditorSection section = (ServerEditorSection) iterator.next();
- section.createSection(parent);
- }
- }
-
- /**
- * Dispose of the editor.
- */
- public void dispose() {
- super.dispose();
-
- Iterator iterator = getSections().iterator();
- while (iterator.hasNext()) {
- ServerEditorSection section = (ServerEditorSection) iterator.next();
- section.dispose();
- }
-
- if (toolkit != null)
- toolkit.dispose();
- }
-
- /**
- * Get a form toolkit to create widgets. It will automatically be disposed
- * when the editor is disposed.
- *
- * @param display the display
- * @return FormToolkit
- */
- protected FormToolkit getFormToolkit(Display display) {
- if (toolkit == null)
- toolkit = new FormToolkit(display);
- return toolkit;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/ServerEditorSection.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/ServerEditorSection.java
deleted file mode 100644
index 218d92231..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/ServerEditorSection.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.editor;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.editor.ServerEditorPartInput;
-import org.eclipse.wst.server.ui.internal.editor.ServerResourceCommandManager;
-/**
- * An abstract server editor section.
- *
- * @since 1.0
- */
-public abstract class ServerEditorSection {
- private String errorMessage = null;
-
- private ServerResourceCommandManager commandManager;
-
- private Composite parentComp;
- private ServerEditorPart editor;
-
- /**
- * The server currently being edited.
- */
- protected IServerWorkingCopy server;
-
- /**
- * <code>true</code> if the server is read-only, and <code>false</code>
- * otherwise.
- */
- protected boolean readOnly;
-
- /**
- * Initialize the section.
- *
- * @param site the editor site
- * @param input the editor input
- */
- public void init(IEditorSite site, IEditorInput input) {
- if (input instanceof IServerEditorPartInput) {
- IServerEditorPartInput sepi = (IServerEditorPartInput) input;
- server = sepi.getServer();
- commandManager = ((ServerEditorPartInput) sepi).getServerCommandManager();
- readOnly = sepi.isServerReadOnly();
- }
- }
-
- /**
- * Executes the given operation and adds it to the operation history
- * with the correct context.
- *
- * @param operation an operation ready to be executed
- */
- public void execute(IUndoableOperation operation) {
- commandManager.execute(operation);
- }
-
- /**
- * Create the section.
- *
- * @param parent the parent composite
- */
- public void createSection(Composite parent) {
- this.parentComp = parent;
- }
-
- /**
- * Return the shell of the section.
- *
- * @return the shell
- */
- public Shell getShell() {
- return parentComp.getShell();
- }
-
- /**
- * Return the error message for this page.
- *
- * @return the error message
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Returns error or status messages that will be displayed when the
- * server resource is saved. If there are any error messages, the
- * user will be unable to save the editor.
- *
- * @return a status object with code <code>IStatus.OK</code> if this
- * server can be saved, otherwise a status object indicating why
- * it can't be
- */
- public IStatus[] getSaveStatus() {
- return null;
- }
-
- /**
- * Set the editor part that this section belongs to.
- *
- * @param editor the editor
- */
- public void setServerEditorPart(ServerEditorPart editor) {
- this.editor = editor;
- }
-
- /**
- * Set an error message for this page.
- *
- * @param error an error message
- */
- public void setErrorMessage(String error) {
- if (error == null && errorMessage == null)
- return;
-
- if (error != null && error.equals(errorMessage))
- return;
-
- errorMessage = error;
- if (editor != null)
- editor.updateErrorMessage();
- }
-
- /**
- * Get a form toolkit to create widgets. It will automatically be disposed
- * when the editor is disposed.
- *
- * @param display the display
- * @return FormToolkit
- */
- protected FormToolkit getFormToolkit(Display display) {
- return editor.getFormToolkit(display);
- }
-
- /**
- * Disposes of the section.
- */
- public void dispose() {
- // ignore
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/package.html b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/package.html
deleted file mode 100644
index b464c187b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/package.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="../../../../../..//apistyles.css" type="text/css">
-<title>WTP API overview</title>
-</head>
-<body>
-<p>Provides editor support for the server tools UI.</p>
-<table width="500">
-<tr>
-<td>
-<p>Using extension points, clients can provide pages, sections, and
-actions to be added to the editor for a specific server type. This
-package contains the delegate classes for these extension points, as
-well as the API that they can use to put commands on the shared
-editor command history stack and interact with the editing framework.</p>
-</td>
-</tr>
-</table>
-</body>
-</html>
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/package.xml b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/package.xml
deleted file mode 100644
index 024c4a2bc..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/editor/package.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
-<head>
- <!-- Escape to the root of your source folder -->
- <meta
- name="root"
- content="../../../../../../" />
- <title>WTP API overview</title>
-</head>
-
-<body>
-
-<abstract>Provides editor support for the server tools UI.</abstract>
-
-<p>Using extension points, clients can provide pages, sections, and
-actions to be added to the editor for a specific server type. This
-package contains the delegate classes for these extension points, as
-well as the API that they can use to put commands on the shared
-editor command history stack and interact with the editing framework.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ContextIds.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ContextIds.java
deleted file mode 100644
index 8ef317db0..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ContextIds.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-/**
- * Context help id constants.
- */
-public interface ContextIds {
- public static final String SELECT_SERVER_WIZARD = ServerUIPlugin.PLUGIN_ID + ".swsi0000";
- public static final String SELECT_SERVER_EXISTING = ServerUIPlugin.PLUGIN_ID + ".swsi0002";
- public static final String SELECT_SERVER_EXISTING_TABLE = ServerUIPlugin.PLUGIN_ID + ".swsi0004";
- public static final String SELECT_SERVER_CREATE = ServerUIPlugin.PLUGIN_ID + ".swsi0010";
- public static final String SELECT_SERVER_CREATE_TABLE = ServerUIPlugin.PLUGIN_ID + ".swsi0012";
- public static final String SELECT_SERVER_PREFERENCE = ServerUIPlugin.PLUGIN_ID + ".swsi0014";
-
- public static final String SELECT_CLIENT_WIZARD = ServerUIPlugin.PLUGIN_ID + ".swsc0000";
- public static final String SELECT_CLIENT = ServerUIPlugin.PLUGIN_ID + ".swsc0002";
-
- public static final String NEW_SERVER_WIZARD = ServerUIPlugin.PLUGIN_ID + ".swns0000";
- public static final String NEW_SERVER_TYPE = ServerUIPlugin.PLUGIN_ID + ".swns0006";
-
- public static final String LAUNCH_CONFIGURATION_SERVER_COMBO = ServerUIPlugin.PLUGIN_ID + ".swsl0000";
-
- public static final String SELECT_TASK_WIZARD = ServerUIPlugin.PLUGIN_ID + ".sstw0000";
-
- /*public static final String IMPORT_CONFIGURATION_WIZARD = ServerUIPlugin.PLUGIN_ID + ".swic0000";
- public static final String IMPORT_CONFIGURATION_NAME = ServerUIPlugin.PLUGIN_ID + ".swic0002";
- public static final String IMPORT_CONFIGURATION_FOLDER = ServerUIPlugin.PLUGIN_ID + ".swic0004";
- public static final String IMPORT_CONFIGURATION_FACTORY = ServerUIPlugin.PLUGIN_ID + ".swic0006";
- public static final String IMPORT_CONFIGURATION_LOCATION = ServerUIPlugin.PLUGIN_ID + ".swic0008";
- public static final String IMPORT_CONFIGURATION_LOCATION_BROWSE = ServerUIPlugin.PLUGIN_ID + ".swic0010";*/
-
- public static final String MODIFY_MODULES_COMPOSITE = ServerUIPlugin.PLUGIN_ID + ".swmm0000";
-
- public static final String TERMINATE_SERVER_DIALOG = ServerUIPlugin.PLUGIN_ID + ".sdti0000";
-
- public static final String PREF_GENERAL = ServerUIPlugin.PLUGIN_ID + ".spge0000";
- public static final String PREF_GENERAL_AUTOPUBLISH_LOCAL = ServerUIPlugin.PLUGIN_ID + ".spge0002";
- public static final String PREF_GENERAL_AUTOPUBLISH_REMOTE = ServerUIPlugin.PLUGIN_ID + ".spge0006";
- public static final String PREF_GENERAL_PUBLISH_BEFORE_START = ServerUIPlugin.PLUGIN_ID + ".spge0012";
- public static final String PREF_GENERAL_AUTO_RESTART = ServerUIPlugin.PLUGIN_ID + ".spge0014";
- public static final String PREF_GENERAL_PROMPT_IRREVERSIBLE = ServerUIPlugin.PLUGIN_ID + ".spge0020";
- public static final String PREF_GENERAL_SHOW_ON_ACTIVITY = ServerUIPlugin.PLUGIN_ID + ".spge0022";
- public static final String PREF_GENERAL_SAVE_EDITORS = ServerUIPlugin.PLUGIN_ID + ".spge0024";
- public static final String PREF_GENERAL_TIMEOUT_DELAY = ServerUIPlugin.PLUGIN_ID + ".spge0026";
- public static final String PREF_GENERAL_SYNC_STARTUP = ServerUIPlugin.PLUGIN_ID + ".spge0028";
-
- public static final String VIEW_SERVERS = ServerUIPlugin.PLUGIN_ID + ".svcp0000";
-
- public static final String PUBLISH_DETAILS_DIALOG = ServerUIPlugin.PLUGIN_ID + ".sdpd0000";
- public static final String PUBLISH_DETAILS_DIALOG_STATUS = ServerUIPlugin.PLUGIN_ID + ".sdpd0002";
- public static final String PUBLISH_DETAILS_DIALOG_DETAILS_BUTTON = ServerUIPlugin.PLUGIN_ID + ".sdpd0004";
- public static final String PUBLISH_DETAILS_DIALOG_DETAILS = ServerUIPlugin.PLUGIN_ID + ".sdpd0006";
-
- public static final String PROMPT_IRREVERSIBLE_DIALOG = ServerUIPlugin.PLUGIN_ID + ".sdpi0000";
-
- public static final String EDITOR_OVERVIEW_PAGE = ServerUIPlugin.PLUGIN_ID + ".seop0000";
- public static final String EDITOR_SERVER = ServerUIPlugin.PLUGIN_ID + ".seop0002";
- public static final String EDITOR_CONFIGURATION = ServerUIPlugin.PLUGIN_ID + ".seop0004";
- public static final String EDITOR_HOSTNAME = ServerUIPlugin.PLUGIN_ID + ".seop0006";
- public static final String EDITOR_RUNTIME = ServerUIPlugin.PLUGIN_ID + ".seop0008";
- public static final String EDITOR_AUTOPUBLISH_DEFAULT = ServerUIPlugin.PLUGIN_ID + ".seop0010";
- public static final String EDITOR_AUTOPUBLISH_OVERRIDE = ServerUIPlugin.PLUGIN_ID + ".seop0012";
- public static final String EDITOR_AUTOPUBLISH_DISABLE = ServerUIPlugin.PLUGIN_ID + ".seop0016";
-
- public static final String AUDIO_PREFERENCES = ServerUIPlugin.PLUGIN_ID + ".aupr0000";
- public static final String AUDIO_PREFERENCES_ENABLE = ServerUIPlugin.PLUGIN_ID + ".aupr0002";
- public static final String AUDIO_PREFERENCES_VOLUME = ServerUIPlugin.PLUGIN_ID + ".aupr0004";
- public static final String AUDIO_PREFERENCES_SOUNDS_TABLE = ServerUIPlugin.PLUGIN_ID + ".aupr0006";
- public static final String AUDIO_PREFERENCES_PLAY = ServerUIPlugin.PLUGIN_ID + ".aupr0008";
- public static final String AUDIO_PREFERENCES_BROWSE = ServerUIPlugin.PLUGIN_ID + ".aupr0010";
- public static final String AUDIO_PREFERENCES_RESET = ServerUIPlugin.PLUGIN_ID + ".aupr0012";
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultMonitorDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultMonitorDelegate.java
deleted file mode 100644
index 0eede40f2..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultMonitorDelegate.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitor;
-import org.eclipse.wst.internet.monitor.core.internal.provisional.IMonitorWorkingCopy;
-import org.eclipse.wst.internet.monitor.core.internal.provisional.MonitorCore;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-import org.eclipse.wst.server.core.internal.ServerMonitorDelegate;
-import org.eclipse.wst.server.core.util.SocketUtil;
-/**
- *
- */
-public class DefaultMonitorDelegate extends ServerMonitorDelegate {
- protected Map monitors = new HashMap();
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.ServerMonitorDelegate#startMonitoring(org.eclipse.wst.server.core.ServerPort)
- */
- public int startMonitoring(IServer server, ServerPort port, int monitorPort) throws CoreException {
- try {
- IMonitor monitor = (IMonitor) monitors.get(port);
- int mport = -1;
- if (monitor == null) {
- mport = monitorPort;
- if (mport == -1)
- mport = SocketUtil.findUnusedPort(5000, 15000);
-
- // should search for a monitor first ..
- IMonitorWorkingCopy wc = MonitorCore.createMonitor();
- wc.setLocalPort(mport);
- wc.setRemoteHost(server.getHost());
- wc.setRemotePort(port.getPort());
- if ("HTTP".equals(port.getProtocol()))
- wc.setProtocol("HTTP");
- monitor = wc.save();
- } else
- mport = monitor.getLocalPort();
- monitor.start();
- monitors.put(port, monitor);
- return mport;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not start monitoring", e);
- throw new CoreException(new Status(IStatus.ERROR, ServerUIPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorStartingMonitor, e.getLocalizedMessage()), null));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.core.model.ServerMonitorDelegate#stopMonitoring(org.eclipse.wst.server.core.ServerPort)
- */
- public void stopMonitoring(IServer server, ServerPort port) {
- try {
- IMonitor monitor = (IMonitor) monitors.get(port);
- if (monitor != null)
- monitor.stop();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not stop monitoring", e);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerImageDescriptor.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerImageDescriptor.java
deleted file mode 100644
index 3c25b6afd..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerImageDescriptor.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-/**
- * A OverlayImageDescriptor consists of a main icon and one or more overlays.
- * The overlays are computed according to flags set on creation of the descriptor.
- */
-public class DefaultServerImageDescriptor extends CompositeImageDescriptor {
- private Image fBaseImage;
- private Point fSize;
- private Image overlay;
-
- /**
- * Create a new OverlayImageDescriptor.
- *
- * @param baseImage an image descriptor used as the base image
- */
- public DefaultServerImageDescriptor(Image baseImage) {
- this(baseImage, ImageResource.getImage(ImageResource.IMG_DEFAULT_SERVER_OVERLAY));
- }
-
- /**
- *
- * @param baseImage
- * @param overlay
- */
- public DefaultServerImageDescriptor(Image baseImage, Image overlay) {
- setBaseImage(baseImage);
- this.overlay = overlay;
- }
-
- /**
- * @see CompositeImageDescriptor#getSize()
- */
- protected Point getSize() {
- if (fSize == null) {
- ImageData data = getBaseImage().getImageData();
- setSize(new Point(data.width, data.height));
- }
- return fSize;
- }
-
- /**
- * @see Object#equals(java.lang.Object)
- */
- public boolean equals(Object object) {
- if (!(object instanceof DefaultServerImageDescriptor))
- return false;
-
- DefaultServerImageDescriptor other = (DefaultServerImageDescriptor) object;
- return (getBaseImage().equals(other.getBaseImage()));
- }
-
- /**
- * @see Object#hashCode()
- */
- public int hashCode() {
- return getBaseImage().hashCode();
- }
-
- /**
- * @see CompositeImageDescriptor#drawCompositeImage(int, int)
- */
- protected void drawCompositeImage(int width, int height) {
- ImageData bg = getBaseImage().getImageData();
- if (bg == null)
- bg = DEFAULT_IMAGE_DATA;
-
- drawImage(bg, 0, 0);
- drawOverlays();
- }
-
- /**
- * Add any overlays to the image as specified in the flags.
- */
- protected void drawOverlays() {
- ImageData data = overlay.getImageData();
- int x = getSize().x - data.width;
- drawImage(data, x, 0);
- }
-
- protected Image getBaseImage() {
- return fBaseImage;
- }
-
- protected void setBaseImage(Image baseImage) {
- fBaseImage = baseImage;
- }
-
- protected void setSize(Point size) {
- fSize = size;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerLabelDecorator.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerLabelDecorator.java
deleted file mode 100644
index c1768c63a..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DefaultServerLabelDecorator.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.wst.server.core.internal.Server;
-/**
- *
- */
-public class DefaultServerLabelDecorator implements ILabelDecorator {
- protected Map map = new HashMap();
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelDecorator#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
- */
- public Image decorateImage(Image image, Object element) {
- try {
- Image img = (Image) map.get(element);
- if (img != null)
- return img;
- } catch (Exception e) {
- // ignore
- }
-
- DefaultServerImageDescriptor dsid = null;
- if (element instanceof Server) {
- IStatus status = ((Server) element).getServerStatus();
- if (status != null) {
- ISharedImages sharedImages = ServerUIPlugin.getInstance().getWorkbench().getSharedImages();
- if (status.getSeverity() == IStatus.ERROR)
- dsid = new DefaultServerImageDescriptor(image, sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK));
- else if (status.getSeverity() == IStatus.WARNING)
- dsid = new DefaultServerImageDescriptor(image, sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK));
- else if (status.getSeverity() == IStatus.INFO)
- dsid = new DefaultServerImageDescriptor(image, sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK));
- }
- }
-
- if (dsid == null)
- dsid = new DefaultServerImageDescriptor(image);
- Image image2 = dsid.createImage();
- map.put(element, image2);
- return image2;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.String, java.lang.Object)
- */
- public String decorateText(String text, Object element) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- try {
- Iterator iterator = map.values().iterator();
- while (iterator.hasNext()) {
- Image image = (Image) iterator.next();
- image.dispose();
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not dispose images", e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DeleteServerDialog.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DeleteServerDialog.java
deleted file mode 100644
index 0de5140f9..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/DeleteServerDialog.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.osgi.util.NLS;
-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.Shell;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServer.IOperationListener;
-/**
- * Dialog that prompts a user to delete server(s) and/or server configuration(s).
- */
-public class DeleteServerDialog extends Dialog {
- protected IServer[] servers;
- protected IFolder[] configs;
-
- protected List runningServersList;
-
- protected Button checkDeleteConfigs;
- protected Button checkDeleteRunning;
- protected Button checkDeleteRunningStop;
-
- /**
- * DeleteServerDialog constructor comment.
- *
- * @param parentShell a shell
- * @param servers an array of servers
- * @param configs an array of server configurations
- */
- public DeleteServerDialog(Shell parentShell, IServer[] servers, IFolder[] configs) {
- super(parentShell);
-
- if (servers == null || configs == null)
- throw new IllegalArgumentException();
-
- this.servers = servers;
- this.configs = configs;
-
- runningServersList = new ArrayList();
- for (int i = 0 ; i < servers.length ; ++i) {
- if (servers[i].getServerState() != IServer.STATE_STOPPED)
- runningServersList.add(servers[i]);
- }
-
- setBlockOnOpen(true);
- }
-
- /**
- *
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Messages.deleteServerDialogTitle);
- }
-
- /**
- *
- */
- protected Control createDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
- //WorkbenchHelp.setHelp(composite, ContextIds.TERMINATE_SERVER_DIALOG);
-
- Label label = new Label(composite, SWT.NONE);
- if (servers.length == 1)
- label.setText(NLS.bind(Messages.deleteServerDialogMessage, servers[0].getName()));
- else
- label.setText(NLS.bind(Messages.deleteServerDialogMessageMany, servers.length + ""));
- //label.setLayoutData(new GridData());
-
- if (configs.length > 0) {
- checkDeleteConfigs = new Button(composite, SWT.CHECK);
- checkDeleteConfigs.setText(NLS.bind(Messages.deleteServerDialogLooseConfigurations, configs[0].getName()));
- checkDeleteConfigs.setSelection(true);
- }
-
- // prompt for stopping running servers
- int size = runningServersList.size();
- if (size > 0) {
- checkDeleteRunning = new Button(composite, SWT.CHECK);
- checkDeleteRunning.setText(NLS.bind(Messages.deleteServerDialogRunningServer, ((IServer)runningServersList.get(0)).getName()));
- checkDeleteRunning.setSelection(true);
-
- checkDeleteRunningStop = new Button(composite, SWT.CHECK);
- checkDeleteRunningStop.setText(NLS.bind(Messages.deleteServerDialogRunningServerStop, ((IServer)runningServersList.get(0)).getName()));
- checkDeleteRunningStop.setSelection(true);
- GridData data = new GridData();
- data.horizontalIndent = 15;
- checkDeleteRunningStop.setLayoutData(data);
-
- checkDeleteRunning.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- checkDeleteRunningStop.setEnabled(checkDeleteRunning.getSelection());
- }
- });
- }
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- protected void okPressed() {
- final boolean checked = (checkDeleteConfigs != null && checkDeleteConfigs.getSelection());
- final boolean deleteRunning = (checkDeleteRunning != null && checkDeleteRunning.getSelection());
- final boolean deleteRunningStop = (checkDeleteRunningStop != null && checkDeleteRunningStop.getSelection());
-
- if (runningServersList.size() > 0) {
- // stop servers and/or updates servers' list
- prepareForDeletion(deleteRunning, deleteRunningStop);
- //monitor.worked(1);
- }
-
- try {
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- // since stopping can be long, let's animate progessDialog
- monitor.beginTask(Messages.deleteServerTask, 2);
-
- if (servers.length == 0) {
- // all servers have been deleted from list
- return;
- }
- try {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- servers[i].delete();
- }
-
- if (checked) {
- size = configs.length;
- for (int i = 0; i < size; i++) {
- configs[i].delete(true, true, monitor);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error while deleting resources", e);
- }
- }
- };
- new ProgressMonitorDialog(getShell()).run(true, true, op);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error deleting resources", e);
- }
-
- super.okPressed();
- }
-
- /**
- * Updates servers' & configs' lists. If <code>deleteRunning</code> is <code>true</code>
- * and a server can't be stopped, it isn't removed.
- * @param deleteRunning if <code>true</code> running servers will be stopped
- * before being deleted, if <code>false</code> running servers will be removed
- * from deletion list.
- */
- protected void prepareForDeletion(boolean deleteRunning, boolean stopRunning) {
- // converts servers & configs to list to facilitate removal
- List serversList = new LinkedList(Arrays.asList(servers));
- List configsList = new LinkedList(Arrays.asList(configs));
- if (deleteRunning == false) {
- // don't delete servers or configurations
- int size = runningServersList.size();
- for (int i = 0; i < size; i++) {
- IServer server = (IServer) runningServersList.get(i);
- serversList.remove(server);
- if (server.getServerConfiguration() != null)
- configsList.remove(server.getServerConfiguration());
- }
- } else {
- if (stopRunning) {
- // stop running servers and wait for them (stop is asynchronous)
- IServer s;
- MultiServerStopListener listener = new MultiServerStopListener();
- int expected = 0;
- Iterator iter = runningServersList.iterator();
- while (iter.hasNext()) {
- s = (IServer) iter.next();
- if (s.canStop().isOK()) {
- ++expected;
- s.stop(false, listener);
- } else {
- // server can't be stopped, don't delete it
- serversList.remove(s);
- configsList.remove(s.getServerConfiguration());
- }
- }
- try {
- while (expected != listener.getNumberStopped()) {
- Thread.sleep(100);
- }
- } catch (InterruptedException e) {
- Trace.trace(Trace.WARNING, "Interrupted while waiting for servers stop");
- }
- }
- }
- servers = new IServer[serversList.size()];
- serversList.toArray(servers);
- configs = new IFolder[configsList.size()];
- configsList.toArray(configs);
- }
-
- /**
- * Class used to wait all servers stop. Use one instance
- * for a group of servers and loop to see if the number stopped
- * equals the number of servers waiting to stop.
- */
- class MultiServerStopListener implements IOperationListener {
- protected int num;
-
- public void done(IStatus result) {
- num++;
- }
-
- public int getNumberStopped() {
- return num;
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/EclipseUtil.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/EclipseUtil.java
deleted file mode 100644
index dcdabd926..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/EclipseUtil.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-/**
- * Eclipse utility methods.
- */
-public class EclipseUtil {
- /**
- * EclipseUtil constructor comment.
- */
- private EclipseUtil() {
- super();
- }
-
- /**
- * Creates a new server project with the given name. If path is
- * null, it will be created in the default location.
- *
- * @param name java.lang.String
- * @param path org.eclipse.core.resource.IPath
- * @param monitor
- * @return org.eclipse.core.runtime.IStatus
- */
- private static IStatus createServerProject(String name, IPath path, IProgressMonitor monitor) {
- //monitor = ProgressUtil.getMonitorFor(monitor);
- //monitor.beginTask(ServerPlugin.getResource("%createServerProjectTask"), 3000);
-
- try {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(name);
-
- // get a project descriptor
- IProjectDescription description = workspace.newProjectDescription(name);
- description.setLocation(path);
-
- project.create(description, ProgressUtil.getSubMonitorFor(monitor, 1000));
- if (monitor.isCanceled())
- return null;
- project.open(ProgressUtil.getSubMonitorFor(monitor, 1000));
- if (monitor.isCanceled())
- return null;
-
- // add the server project nature
- ServerPlugin.getProjectProperties(project).setServerProject(true, monitor);
-
- if (monitor.isCanceled())
- return null;
-
- return Status.OK_STATUS;
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Could not create server project named " + name, ce);
- return new Status(IStatus.ERROR, ServerUIPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorCouldNotCreateServerProjectStatus, ce.getMessage()), ce);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not create server project (2) named " + name, e);
- return new Status(IStatus.ERROR, ServerUIPlugin.PLUGIN_ID, 0, Messages.errorCouldNotCreateServerProject, e);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Creates a new server project with the given name. If path is
- * null, it will be created in the default location.
- *
- * @param shell a shell
- * @param name a name
- * @param path a path
- * @param monitor a progress monitor, or null
- */
- public static void createNewServerProject(final Shell shell, String name, IPath path, IProgressMonitor monitor) {
- final IStatus status = createServerProject(name, path, monitor);
- if (!status.isOK()) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- Shell shell2 = shell;
- if (shell == null)
- shell2 = getShell();
- openError(shell2, Messages.errorCouldNotCreateServerProject, status);
- }
- });
- }
- }
-
- /**
- * Returns the image for a project.
- *
- * @param project org.eclipse.core.resources.IProject
- * @return org.eclipse.jface.resource.ImageDescriptor
- */
- public static ImageDescriptor getProjectImageDescriptor(IProject project) {
- if (project == null)
- return null;
-
- IWorkbenchAdapter adapter = (IWorkbenchAdapter) project.getAdapter(IWorkbenchAdapter.class);
-
- if (adapter != null)
- return adapter.getImageDescriptor(project);
-
- return null;
- }
-
- /**
- * Return a shell for the workbench.
- *
- * @return org.eclipse.swt.widgets.Shell
- */
- public static Shell getShell() {
- return getStandardDisplay().getActiveShell();
- }
-
- /**
- * Returns the standard display to be used. The method first checks, if
- * the thread calling this method has an associated display. If so, this
- * display is returned. Otherwise the method returns the default display.
- *
- * @return the display
- */
- public static Display getStandardDisplay() {
- Display display = Display.getCurrent();
- if (display == null)
- display = Display.getDefault();
-
- return display;
- }
-
- /**
- * Open a dialog window.
- *
- * @param message java.lang.String
- */
- public static void openError(final String message) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- Shell shell = getShell();
- MessageDialog.openError(shell, Messages.errorDialogTitle, message);
- }
- });
- }
-
- /**
- * Open a dialog window.
- *
- * @param message java.lang.String
- * @param status IStatus
- */
- public static void openError(final String message, final IStatus status) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- Shell shell = getShell();
- ErrorDialog.openError(shell, Messages.errorDialogTitle, message, status);
- }
- });
- }
-
- /**
- * Open a dialog window.
- *
- * @param shell the shell
- * @param message the message
- */
- public static void openError(Shell shell, String message) {
- MessageDialog.openError(shell, Messages.errorDialogTitle, message);
- }
-
- /**
- * Open a dialog window.
- *
- * @param shell a shell
- * @param message a message
- * @param status a status
- */
- public static void openError(Shell shell, String message, IStatus status) {
- ErrorDialog.openError(shell, Messages.errorDialogTitle, message, status);
- }
-
- /**
- * Do a validateEdit() on the given server.
- *
- * @param shell a shell
- * @param server a server
- * @return true if validate edit worked
- */
- public static boolean validateEdit(Shell shell, IServer server) {
- IStatus status = ServerUtil.validateEdit(shell, server);
- return validateEdit(shell, status);
- }
-
- protected static boolean validateEdit(Shell shell, IStatus status) {
- if (status != null && status.getSeverity() == IStatus.ERROR) {
- // inform user
- String message = Messages.editorValidateEditFailureMessage;
- ErrorDialog.openError(shell, Messages.errorDialogTitle, message, status);
-
- // do not execute command
- return false;
- }
- return true;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ImageResource.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ImageResource.java
deleted file mode 100644
index b3bbb928e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ImageResource.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionDelta;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-/**
- * Utility class to handle image resources.
- */
-public class ImageResource {
- // the image registry
- private static ImageRegistry imageRegistry;
-
- // map of image descriptors since these
- // will be lost by the image registry
- private static Map imageDescriptors;
-
- // base urls for images
- private static URL ICON_BASE_URL;
-
- static {
- try {
- String pathSuffix = "icons/";
- ICON_BASE_URL = ServerUIPlugin.getInstance().getBundle().getEntry(pathSuffix);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not set icon base URL", e);
- }
- }
-
- private static final String URL_CLCL = "clcl16/";
- private static final String URL_CTOOL = "ctool16/";
-
- private static final String URL_ELCL = "elcl16/";
- private static final String URL_ETOOL = "etool16/";
-
- private static final String URL_DLCL = "dlcl16/";
- private static final String URL_DTOOL = "dtool16/";
-
- private static final String URL_OBJ = "obj16/";
-
- private static final String URL_OVR = "ovr16/";
-
- private static final String URL_WIZBAN = "wizban/";
-
- // --- constants for images ---
-
- // Server State Images
- public static final String IMG_CLCL_START = "IMG_CLCL_START";
- public static final String IMG_CLCL_START_DEBUG = "IMG_CLCL_START_DEBUG";
- public static final String IMG_CLCL_START_PROFILE = "IMG_CLCL_START_PROFILE";
- public static final String IMG_CLCL_RESTART = "IMG_CLCL_RESTART";
- public static final String IMG_CLCL_STOP = "IMG_CLCL_STOP";
- public static final String IMG_CLCL_PUBLISH = "IMG_CLCL_PUBLISH";
- public static final String IMG_CLCL_DISCONNECT = "IMG_CLCL_DISCONNECT";
-
- public static final String IMG_ELCL_START = "IMG_ELCL_START";
- public static final String IMG_ELCL_START_DEBUG = "IMG_ELCL_START_DEBUG";
- public static final String IMG_ELCL_START_PROFILE = "IMG_ELCL_START_PROFILE";
- public static final String IMG_ELCL_RESTART = "IMG_ELCL_RESTART";
- public static final String IMG_ELCL_STOP = "IMG_ELCL_STOP";
- public static final String IMG_ELCL_PUBLISH = "IMG_ELCL_PUBLISH";
- public static final String IMG_ELCL_DISCONNECT = "IMG_ELCL_DISCONNECT";
-
- public static final String IMG_DLCL_START = "IMG_DLCL_START";
- public static final String IMG_DLCL_START_DEBUG = "IMG_DLCL_START_DEBUG";
- public static final String IMG_DLCL_START_PROFILE = "IMG_DLCL_START_PROFILE";
- public static final String IMG_DLCL_RESTART = "IMG_DLCL_RESTART";
- public static final String IMG_DLCL_STOP = "IMG_DLCL_STOP";
- public static final String IMG_DLCL_PUBLISH = "IMG_DLCL_PUBLISH";
- public static final String IMG_DLCL_DISCONNECT = "IMG_DLCL_DISCONNECT";
-
- // Wizard Banner Images
- public static final String IMG_WIZBAN_NEW_RUNTIME = "newServerWiz";
- public static final String IMG_WIZBAN_NEW_SERVER = "newServerWiz";
- public static final String IMG_WIZBAN_SELECT_SERVER_CLIENT = "wizClient";
- public static final String IMG_WIZBAN_SELECT_SERVER = "selectServer";
- public static final String IMG_WIZBAN_IMPORT_SERVER_CONFIGURATION = "importConfigWiz";
-
- public static final String IMG_SERVER_STATE_STARTED = "stateStarted";
- public static final String IMG_SERVER_STATE_STARTED_DEBUG = "stateStartedDebug";
- public static final String IMG_SERVER_STATE_STARTED_PROFILE = "stateStartedProfile";
- public static final String IMG_SERVER_STATE_STOPPED = "stateStopped";
-
- public static final String IMG_SERVER_STATE_STARTING_1 = "stateStarting1";
- public static final String IMG_SERVER_STATE_STARTING_2 = "stateStarting2";
- public static final String IMG_SERVER_STATE_STARTING_3 = "stateStarting3";
-
- public static final String IMG_SERVER_STATE_STOPPING_1 = "stateStopping1";
- public static final String IMG_SERVER_STATE_STOPPING_2 = "stateStopping2";
- public static final String IMG_SERVER_STATE_STOPPING_3 = "stateStopping3";
-
- // Server Client Images
- public static final String IMG_CTOOL_RUN_ON_SERVER = "IMG_CTOOL_CLIENT";
- public static final String IMG_CTOOL_DEBUG_ON_SERVER = "IMG_CTOOL_CLIENT2";
- public static final String IMG_CTOOL_PROFILE_ON_SERVER = "IMG_CTOOL_CLIENT3";
- public static final String IMG_CTOOL_NEW_SERVER = "IMG_CTOOL_NEW_SERVER";
- public static final String IMG_CTOOL_NEW_SERVER_INSTANCE = "IMG_CTOOL_NEW_SERVER_INSTANCE";
- public static final String IMG_CTOOL_MODIFY_MODULES = "IMG_CTOOL_MODIFY_MODULES";
-
- public static final String IMG_ETOOL_RUN_ON_SERVER = "IMG_ETOOL_CLIENT";
- public static final String IMG_ETOOL_DEBUG_ON_SERVER = "IMG_ETOOL_CLIENT2";
- public static final String IMG_ETOOL_PROFILE_ON_SERVER = "IMG_ETOOL_CLIENT3";
- public static final String IMG_ETOOL_MODIFY_MODULES = "IMG_ETOOL_MODIFY_MODULES";
-
- public static final String IMG_DTOOL_RUN_ON_SERVER = "IMG_DTOOL_CLIENT";
- public static final String IMG_DTOOL_DEBUG_ON_SERVER = "IMG_DTOOL_CLIENT2";
- public static final String IMG_DTOOL_PROFILE_ON_SERVER = "IMG_DTOOL_CLIENT3";
- public static final String IMG_DTOOL_MODIFY_MODULES = "IMG_DTOOL_MODIFY_MODULES";
-
- // General Object Images
- public static final String IMG_SERVER = "server";
- public static final String IMG_SERVER_CONFIGURATION_NONE = "noConfiguration";
- public static final String IMG_SERVER_CONFIGURATION_MISSING = "configurationMissing";
- public static final String IMG_PROJECT_MISSING = "projectMissing";
- public static final String IMG_REPAIR_CONFIGURATION = "repairConfiguration";
-
- public static final String IMG_PUBLISH_ENABLED = "publishEnabled";
- public static final String IMG_PUBLISH_DISABLED = "publishDisabled";
-
- public static final String IMG_MONITOR_ON = "monitorOn";
- public static final String IMG_MONITOR_OFF = "monitorOff";
-
- public static final String IMG_DEFAULT_SERVER_OVERLAY = "defaultServerOverlay";
-
- // Audio images
- public static final String IMG_AUDIO_SOUND = "sound";
- public static final String IMG_AUDIO_CATEGORY = "category";
-
- /**
- * Cannot construct an ImageResource. Use static methods only.
- */
- private ImageResource() {
- // do nothing
- }
-
- /**
- * Dispose of element images that were created.
- */
- protected static void dispose() {
- // do nothing
- }
-
- /**
- * Return the image with the given key.
- *
- * @param key java.lang.String
- * @return org.eclipse.swt.graphics.Image
- */
- public static Image getImage(String key) {
- if (imageRegistry == null)
- initializeImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null) {
- imageRegistry.put(key, ImageDescriptor.getMissingImageDescriptor());
- image = imageRegistry.get(key);
- }
- return image;
- }
-
- /**
- * Return the image descriptor with the given key.
- *
- * @param key java.lang.String
- * @return org.eclipse.jface.resource.ImageDescriptor
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- if (imageRegistry == null)
- initializeImageRegistry();
- ImageDescriptor id = (ImageDescriptor) imageDescriptors.get(key);
- if (id != null)
- return id;
-
- return ImageDescriptor.getMissingImageDescriptor();
- }
-
- /**
- * Initialize the image resources.
- */
- protected static void initializeImageRegistry() {
- imageRegistry = new ImageRegistry();
- imageDescriptors = new HashMap();
-
- // wizard banners
- registerImage(IMG_WIZBAN_NEW_SERVER, URL_WIZBAN + "new_server_wiz.gif");
- registerImage(IMG_WIZBAN_IMPORT_SERVER_CONFIGURATION, URL_WIZBAN + "import_configuration_wiz.gif");
- registerImage(IMG_WIZBAN_SELECT_SERVER_CLIENT, URL_WIZBAN + "select_client_wiz.gif");
- registerImage(IMG_WIZBAN_SELECT_SERVER, URL_WIZBAN + "select_server_wiz.gif");
-
- // client images
- registerImage(IMG_ETOOL_RUN_ON_SERVER, URL_ETOOL + "run_on_server.gif");
- registerImage(IMG_ETOOL_DEBUG_ON_SERVER, URL_ETOOL + "debug_on_server.gif");
- registerImage(IMG_ETOOL_PROFILE_ON_SERVER, URL_ETOOL + "profile_on_server.gif");
- registerImage(IMG_ETOOL_MODIFY_MODULES, URL_ETOOL + "wiz_modify_modules.gif");
-
- registerImage(IMG_CTOOL_RUN_ON_SERVER, URL_CTOOL + "run_on_server.gif");
- registerImage(IMG_CTOOL_DEBUG_ON_SERVER, URL_CTOOL + "debug_on_server.gif");
- registerImage(IMG_CTOOL_PROFILE_ON_SERVER, URL_CTOOL + "profile_on_server.gif");
- registerImage(IMG_CTOOL_NEW_SERVER, URL_CTOOL + "wiz_new_server.gif");
- registerImage(IMG_CTOOL_NEW_SERVER_INSTANCE, URL_CTOOL + "wiz_new_instance.gif");
- registerImage(IMG_CTOOL_MODIFY_MODULES, URL_CTOOL + "wiz_modify_modules.gif");
-
- registerImage(IMG_DTOOL_RUN_ON_SERVER, URL_DTOOL + "run_on_server.gif");
- registerImage(IMG_DTOOL_DEBUG_ON_SERVER, URL_DTOOL + "debug_on_server.gif");
- registerImage(IMG_DTOOL_PROFILE_ON_SERVER, URL_DTOOL + "profile_on_server.gif");
- registerImage(IMG_DTOOL_MODIFY_MODULES, URL_DTOOL + "wiz_modify_modules.gif");
-
- // load server state images
- registerImage(IMG_SERVER_STATE_STARTED, URL_OBJ + "server_started.gif");
- registerImage(IMG_SERVER_STATE_STARTED_DEBUG, URL_OBJ + "server_started_debug.gif");
- registerImage(IMG_SERVER_STATE_STARTED_PROFILE, URL_OBJ + "server_started_profile.gif");
- registerImage(IMG_SERVER_STATE_STOPPED, URL_OBJ + "server_stopped.gif");
-
- registerImage(IMG_SERVER_STATE_STARTING_1, URL_OBJ + "server_starting1.gif");
- registerImage(IMG_SERVER_STATE_STARTING_2, URL_OBJ + "server_starting2.gif");
- registerImage(IMG_SERVER_STATE_STARTING_3, URL_OBJ + "server_starting3.gif");
-
- registerImage(IMG_SERVER_STATE_STOPPING_1, URL_OBJ + "server_stopping1.gif");
- registerImage(IMG_SERVER_STATE_STOPPING_2, URL_OBJ + "server_stopping2.gif");
- registerImage(IMG_SERVER_STATE_STOPPING_3, URL_OBJ + "server_stopping3.gif");
-
- // load action images
- registerImage(IMG_ELCL_PUBLISH, URL_ELCL + "launch_publish.gif");
- registerImage(IMG_ELCL_START, URL_ELCL + "launch_run.gif");
- registerImage(IMG_ELCL_START_DEBUG, URL_ELCL + "launch_debug.gif");
- registerImage(IMG_ELCL_START_PROFILE, URL_ELCL + "launch_profile.gif");
- registerImage(IMG_ELCL_RESTART, URL_ELCL + "launch_restart.gif");
- registerImage(IMG_ELCL_STOP, URL_ELCL + "launch_stop.gif");
- registerImage(IMG_ELCL_DISCONNECT, URL_ELCL + "launch_disconnect.gif");
-
- registerImage(IMG_CLCL_PUBLISH, URL_CLCL + "launch_publish.gif");
- registerImage(IMG_CLCL_START, URL_CLCL + "launch_run.gif");
- registerImage(IMG_CLCL_START_DEBUG, URL_CLCL + "launch_debug.gif");
- registerImage(IMG_CLCL_START_PROFILE, URL_CLCL + "launch_profile.gif");
- registerImage(IMG_CLCL_RESTART, URL_CLCL + "launch_restart.gif");
- registerImage(IMG_CLCL_STOP, URL_CLCL + "launch_stop.gif");
- registerImage(IMG_CLCL_DISCONNECT, URL_CLCL + "launch_disconnect.gif");
-
- registerImage(IMG_DLCL_PUBLISH, URL_DLCL + "launch_publish.gif");
- registerImage(IMG_DLCL_START, URL_DLCL + "launch_run.gif");
- registerImage(IMG_DLCL_START_DEBUG, URL_DLCL + "launch_debug.gif");
- registerImage(IMG_DLCL_START_PROFILE, URL_DLCL + "launch_profile.gif");
- registerImage(IMG_DLCL_RESTART, URL_DLCL + "launch_restart.gif");
- registerImage(IMG_DLCL_STOP, URL_DLCL + "launch_stop.gif");
- registerImage(IMG_DLCL_DISCONNECT, URL_DLCL + "launch_disconnect.gif");
-
- // load general object images
- registerImage(IMG_SERVER, URL_OBJ + "server.gif");
- registerImage(IMG_SERVER_CONFIGURATION_NONE, URL_OBJ + "configuration_none.gif");
- registerImage(IMG_SERVER_CONFIGURATION_MISSING, URL_OBJ + "configuration_missing.gif");
- registerImage(IMG_PROJECT_MISSING, URL_OBJ + "project_missing.gif");
- registerImage(IMG_REPAIR_CONFIGURATION, URL_OBJ + "repair_config.gif");
-
- registerImage(IMG_PUBLISH_ENABLED, URL_OBJ + "publish_enabled.gif");
- registerImage(IMG_PUBLISH_DISABLED, URL_OBJ + "publish_disabled.gif");
-
- registerImage(IMG_MONITOR_ON, URL_OBJ + "monitorOn.gif");
- registerImage(IMG_MONITOR_OFF, URL_OBJ + "monitorOff.gif");
-
- registerImage(IMG_DEFAULT_SERVER_OVERLAY, URL_OVR + "default_server_ovr.gif");
-
- // audio images
- registerImage(IMG_AUDIO_SOUND, URL_OBJ + "audio_sound.gif");
- registerImage(IMG_AUDIO_CATEGORY, URL_OBJ + "audio_category.gif");
-
- loadServerImages();
-
- PlatformUI.getWorkbench().getProgressService().registerIconForFamily(
- getImageDescriptor(IMG_SERVER), ServerPlugin.PLUGIN_ID);
- }
-
- /**
- * Register an image with the registry.
- *
- * @param key java.lang.String
- * @param partialURL java.lang.String
- */
- private static void registerImage(String key, String partialURL) {
- try {
- ImageDescriptor id = ImageDescriptor.createFromURL(new URL(ICON_BASE_URL, partialURL));
- imageRegistry.put(key, id);
- imageDescriptors.put(key, id);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error registering image " + key + " from " + partialURL, e);
- }
- }
-
- /**
- * Load the server images.
- */
- private static void loadServerImages() {
- Trace.trace(Trace.CONFIG, "->- Loading .serverImages extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- loadServerImages(registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, ServerUIPlugin.EXTENSION_SERVER_IMAGES));
- ServerUIPlugin.addRegistryListener();
- Trace.trace(Trace.CONFIG, "-<- Done loading .serverImages extension point -<-");
- }
-
- /**
- * Load the server images.
- */
- private static void loadServerImages(IConfigurationElement[] cf) {
- int size = cf.length;
- for (int i = 0; i < size; i++) {
- try {
- String pluginId = cf[i].getDeclaringExtension().getNamespace();
- String iconPath = cf[i].getAttribute("icon");
- ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, iconPath);
- if (imageDescriptor == null && iconPath != null && iconPath.length() > 0)
- imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
-
- if (imageDescriptor != null) {
- String typeId = cf[i].getAttribute("typeIds");
- if (typeId == null)
- typeId = cf[i].getAttribute("moduleId");
- imageRegistry.put(typeId, imageDescriptor);
- imageDescriptors.put(typeId, imageDescriptor);
- }
- Trace.trace(Trace.CONFIG, " Loaded serverImage: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load serverImage: " + cf[i].getAttribute("id"), t);
- }
- }
- }
-
- protected static void handleServerImageDelta(IExtensionDelta delta) {
- if (imageRegistry == null) // not loaded yet
- return;
-
- IConfigurationElement[] cf = delta.getExtension().getConfigurationElements();
-
- if (delta.getKind() == IExtensionDelta.ADDED)
- loadServerImages(cf);
- else {
- int size = cf.length;
- for (int i = 0; i < size; i++) {
- String typeId = cf[i].getAttribute("typeIds");
- imageRegistry.remove(typeId);
- imageDescriptors.remove(typeId);
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/LaunchClientJob.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/LaunchClientJob.java
deleted file mode 100644
index 4513bef29..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/LaunchClientJob.java
+++ /dev/null
@@ -1,87 +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.server.ui.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.*;
-/**
- *
- */
-public class LaunchClientJob extends ChainedJob {
- protected IModule[] module;
- protected IClient client;
- protected ILaunchableAdapter launchableAdapter;
- protected String launchMode;
- protected IModuleArtifact moduleArtifact;
-
- public LaunchClientJob(IServer server, IModule[] module, String launchMode, IModuleArtifact moduleArtifact, ILaunchableAdapter launchableAdapter, IClient client) {
- super(Messages.launchingClientTask, server);
- this.module = module;
- this.launchMode = launchMode;
- this.moduleArtifact = moduleArtifact;
- this.launchableAdapter = launchableAdapter;
- this.client = client;
- setRule(new ServerSchedulingRule(server));
- }
-
- /** (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- Trace.trace(Trace.FINER, "LaunchClient job");
- IStatus status = Status.OK_STATUS;
-
- // wait for up to 5 minutes
- final Server server = (Server) getServer();
- int state = server.getModuleState(module);
- int count = ServerPreferences.getInstance().getModuleStartTimeout();
- while (state == IServer.STATE_STARTING && count > 0) {
- if (monitor.isCanceled())
- return status;
- try {
- Thread.sleep(2000);
- } catch (Exception e) {
- // ignore
- }
- count -= 2000;
- state = server.getModuleState(module);
- }
-
- Trace.trace(Trace.FINER, "LaunchClient job 2 " + state);
-
- if (monitor.isCanceled())
- return status;
-
- if (state == IServer.STATE_STARTING)
- return status;
-
- Trace.trace(Trace.FINER, "LaunchClient job 3");
-
- // display client on UI thread
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- Trace.trace(Trace.FINEST, "Attempting to load client: " + client);
- try {
- Object launchable = launchableAdapter.getLaunchable(server, moduleArtifact);
- client.launch(server, launchable, launchMode, server.getExistingLaunch());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Server client failed", e);
- }
- }
- });
- Trace.trace(Trace.FINER, "LaunchClient job 4");
- return status;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.java
deleted file mode 100644
index c30270c24..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.java
+++ /dev/null
@@ -1,307 +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.server.ui.internal;
-
-import org.eclipse.osgi.util.NLS;
-/**
- * Translated messages.
- */
-public class Messages extends NLS {
- public static String dialogMonitorDescription;
- public static String dialogMonitorAddDescription;
- public static String errorVersionLevel;
- public static String loadingTask;
- public static String createServerProjectDialogMessage;
- public static String defaultServerProjectName;
- public static String terminateServerDialogMessage;
- public static String actionMonitorPort;
- public static String deleteServerDialogTitle;
- public static String deleteServerDialogMessage;
- public static String deleteServerDialogMessageMany;
- public static String deleteServerDialogLooseConfigurations;
- public static String deleteServerDialogRunningServer;
- public static String deleteServerDialogRunningServerStop;
- public static String deleteServerTask;
- public static String errorCouldNotCreateServerProjectStatus;
- public static String dialogStoppingServer;
- public static String savingTask;
- public static String editorSaveErrorDialog;
- public static String editorSaveErrorMessage;
- public static String editorReadOnlyFiles;
- public static String errorEditor;
- public static String editorUndoDisabled;
- public static String editorUndoEnabled;
- public static String editorRedoDisabled;
- public static String editorRedoEnabled;
- public static String editorResourceDeleteTitle;
- public static String editorResourceDeleteServerMessage;
- public static String editorResourceDeleteSave;
- public static String resourceDirtyDialogMessage;
- public static String wizSelectClientTitle;
- public static String wizSelectClientDescription;
- public static String resourceDirtyDialogTitle;
- public static String resourceDirtyDialogContinue;
- public static String wizNewRuntimeWizardTitle;
- public static String serverLaunchDescription;
- public static String serverLaunchServer;
- public static String serverLaunchHost;
- public static String serverLaunchRuntime;
- public static String errorNoServerSelected;
- public static String errorServerAlreadyRunning;
- public static String errorInvalidServer;
- public static String serverLaunchConfigurationTab;
- public static String wizSelectClientMessage;
- public static String errorCouldNotCreateServerProject;
- public static String errorDialogTitle;
- public static String editorValidateEditFailureMessage;
- public static String prefProjectDescription;
- public static String prefProjectNotModule;
- public static String prefProject;
- public static String prefProjectDefaultServer;
- public static String prefProjectNotConfigured;
- public static String prefProjectNoServer;
- public static String errorCouldNotSavePreference;
- public static String preferenceRuntimesDescription;
- public static String add;
- public static String edit;
- public static String remove;
- public static String search;
- public static String dialogRuntimeSearchMessage;
- public static String dialogRuntimeSearchTitle;
- public static String dialogRuntimeSearchProgress;
- public static String infoNoRuntimesFound;
- public static String wizEditRuntimeWizardTitle;
- public static String preferenceRuntimesTable;
- public static String dialogRuntimeInUse;
- public static String defaultDialogTitle;
- public static String preferenceRuntimesTitleLong;
- public static String runtimeTargetCombo;
- public static String runtimeTargetNone;
- public static String runtimeTargetNewRuntime;
- public static String runtimeTargetChildren;
- public static String runtimeTargetRuntimePreferences;
- public static String prefAutoPublish;
- public static String prefAutoPublishLocal;
- public static String prefAutoPublishLocalTime;
- public static String prefAutoPublishRemote;
- public static String prefAutoPublishRemoteTime;
- public static String prefAutoRestart;
- public static String prefPromptIrreversible;
- public static String prefShowOnActivity;
- public static String prefSyncStartup;
- public static String prefSaveEditorsGroup;
- public static String prefSaveEditorsNever;
- public static String prefSaveEditorsPrompt;
- public static String prefSaveEditorsAutosave;
- public static String prefMachineSpeed;
- public static String prefMachineSpeedVerySlow;
- public static String prefMachineSpeedSlow;
- public static String prefMachineSpeedAverage;
- public static String prefMachineSpeedFast;
- public static String prefMachineSpeedVeryFast;
- public static String actionNew;
- public static String actionNewServer;
- public static String actionDebugToolTip;
- public static String actionDebug;
- public static String actionStartToolTip;
- public static String actionStart;
- public static String actionProfileToolTip;
- public static String actionProfile;
- public static String actionRestartToolTip;
- public static String actionRestart;
- public static String actionPublishToolTip;
- public static String actionPublish;
- public static String actionDelete;
- public static String actionRemove;
- public static String dialogRemoveModuleConfirm;
- public static String terminateServerDialogTitle;
- public static String actionDebugOnServer;
- public static String actionProfileOnServer;
- public static String actionRunOnServer;
- public static String actionRestartModule;
- public static String actionUpdateStatus;
- public static String actionMoveServerToMetadata;
- public static String actionMoveServerToWorkspace;
- public static String dialogAddRemoveModulesNone;
- public static String actionSetNewServer;
- public static String errorNoModules;
- public static String dialogModeWarningDebug;
- public static String dialogModeWarningProfile;
- public static String errorNoServer;
- public static String errorNoClient;
- public static String dialogModeWarningRestart;
- public static String dialogModeWarningContinue;
- public static String hostname;
- public static String wizModuleTitle;
- public static String wizModuleDescription;
- public static String wizModuleMessage;
- public static String wizModuleAvailableList;
- public static String wizModuleDeployedList;
- public static String wizModuleAdd;
- public static String wizModuleRemove;
- public static String wizModuleAddAll;
- public static String wizModuleRemoveAll;
- public static String wizTaskTitle;
- public static String wizTaskDescription;
- public static String wizTaskNone;
- public static String wizErrorInvalidFolder;
- public static String wizErrorClosedProject;
- public static String createServerProjectDialogTitle;
- public static String wizNewServerTitle;
- public static String wizNewServerDescription;
- public static String wizNewServerSelect;
- public static String wizNewServerManual;
- public static String wizSelectServerPreferred;
- public static String wizNewServerExisting;
- public static String wizNewServerRuntime;
- public static String wizNewServerRuntimeCreate;
- public static String wizErrorServerCreationError;
- public static String wizRunOnServerTitle;
- public static String wizDebugOnServerTitle;
- public static String wizProfileOnServerTitle;
- public static String wizNewRuntimeTitle;
- public static String wizNewRuntimeDescription;
- public static String performingTasks;
- public static String wizModuleWizardTitle;
- public static String wizNewServerWizardTitle;
- public static String wizSelectClientWizardTitle;
- public static String wizTaskWizardTitle;
- public static String viewBy;
- public static String wizDescription;
- public static String dialogMonitorColumnStatus;
- public static String dialogMonitorColumnType;
- public static String dialogMonitorColumnPort;
- public static String dialogMonitorColumnMonitorPort;
- public static String dialogMonitorColumnContentType;
- public static String start;
- public static String stop;
- public static String dialogMonitorTitle;
- public static String dialogMonitorMonitorPort;
- public static String dialogMonitorContentType;
- public static String dialogMonitorContentTypeAll;
- public static String started;
- public static String stopped;
- public static String dialogMonitorContentTypeWeb;
- public static String dialogMonitorContentTypeWebServices;
- public static String columnName;
- public static String columnType;
- public static String runtimeTypeCompTree;
- public static String runtimeTypeCompDescription;
- public static String name;
- public static String vendor;
- public static String version;
- public static String moduleSupport;
- public static String installedRuntimes;
- public static String wizNewServerSelectExisting;
- public static String host;
- public static String elementUnknownName;
- public static String serverTypeCompLabel;
- public static String viewServers;
- public static String viewNoModules;
- public static String actionMonitorProperties;
- public static String actionOpen;
- public static String viewServer;
- public static String viewStatus;
- public static String viewSync;
- public static String actionStopToolTip;
- public static String actionStop;
- public static String actionModifyModulesToolTip;
- public static String actionModifyModules;
- public static String actionMonitor;
- public static String viewSyncOkay;
- public static String viewSyncRestart;
- public static String viewSyncPublish;
- public static String viewSyncRestartPublish;
- public static String viewSyncPublishing;
- public static String viewSyncOkay2;
- public static String viewSyncRestart2;
- public static String viewSyncPublish2;
- public static String viewSyncRestartPublish2;
- public static String viewSyncPublishing2;
- public static String editorServerEditor;
- public static String editorPromptIrreversible;
- public static String editorRenameFiles;
- public static String errorEditorCantSave;
- public static String editorReadOnly;
- public static String editorWritable;
- public static String editorResourceModifiedTitle;
- public static String editorReadOnlyMessage;
- public static String editorServerModifiedMessage;
- public static String editorResourceWarnTitle;
- public static String editorResourceWarnMessage;
- public static String serverEditorOverviewPageTitle;
- public static String serverEditorOverviewGeneralSection;
- public static String serverEditorOverviewGeneralDescription;
- public static String serverEditorOverviewServerName;
- public static String serverEditorOverviewServerHostname;
- public static String serverEditorOverviewRuntime;
- public static String serverEditorOverviewRuntimeEdit;
- public static String serverEditorOverviewServerConfigurationPath;
- public static String serverEditorOverviewServerConfigurationBrowse;
- public static String serverEditorOverviewServerConfigurationBrowseMessage;
- public static String serverEditorOverviewAutoPublishSection;
- public static String serverEditorOverviewAutoPublishDescription;
- public static String serverEditorOverviewAutoPublishDefault;
- public static String serverEditorOverviewAutoPublishDefaultEdit;
- public static String serverEditorOverviewAutoPublishDisable;
- public static String serverEditorOverviewAutoPublishOverride;
- public static String serverEditorOverviewAutoPublishOverrideInterval;
- public static String serverEditorOverviewAutoPublishCommand;
- public static String serverEditorOverviewAutoPublishInvalid;
- public static String serverEditorOverviewServerHostnameCommand;
- public static String serverEditorOverviewServerNameCommand;
- public static String serverEditorOverviewRuntimeCommand;
- public static String serverEditorOverviewOpenLaunchConfiguration;
- public static String errorMissingConfiguration;
- public static String viewStatusStarting4;
- public static String viewStatusStarted2;
- public static String viewStatusStopping4;
- public static String viewStatusStopped2;
- public static String viewStatusStarting1;
- public static String viewStatusStarting2;
- public static String viewStatusStarting3;
- public static String viewStatusStopping1;
- public static String viewStatusStopping2;
- public static String viewStatusStopping3;
- public static String viewStatusStartedDebug;
- public static String viewStatusStartedProfile;
- public static String viewStatusStarted;
- public static String viewStatusStopped;
- public static String actionStopToolTip2;
- public static String actionStop2;
- public static String launchingClientTask;
- public static String wizNewInstallableServerTitle;
- public static String wizNewInstallableServerDescription;
- public static String wizNewInstallableServerRestart;
- public static String installableServerCompTree;
- public static String installableServerLink;
-
- public static String errorStartingMonitor;
- public static String audioPrefSelectFile;
- public static String audioPrefEnable;
- public static String audioPrefVolume;
- public static String audioPrefSounds;
- public static String audioPrefSound;
- public static String audioPrefFile;
- public static String audioPrefPlay;
- public static String audioPrefBrowse;
- public static String audioPrefReset;
- public static String audioUnknown;
- public static String audioNone;
- public static String audioDefault;
-
- public static String preferenceInternetDescription;
- public static String internalWebBrowserName;
-
- static {
- NLS.initializeMessages(ServerUIPlugin.PLUGIN_ID + ".internal.Messages", Messages.class);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.properties b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.properties
deleted file mode 100644
index 475da096e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Messages.properties
+++ /dev/null
@@ -1,434 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 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
-###############################################################################
-
-# --------------- Wizards ---------------
-# (If the first two lines in a group do not start with "wiz", it is because
-# those lines are displayed in the workbench "New" wizard. The rest of the
-# text is displayed in each actual wizard)
-
-# New Server (and Configuration) Wizard
-wizNewServerWizardTitle=New Server
-wizNewServerTitle=Define a New Server
-wizNewServerDescription=Choose the type of server to create
-wizNewServerRuntime=Server &runtime:
-wizNewServerRuntimeCreate=Create a new runtime
-
-wizNewServerSelect=How do you want to select the server?
-wizNewServerExisting=Choose an e&xisting server
-wizNewServerManual=&Manually define a new server
-wizNewServerSelectExisting=Select the server that you want to use:
-
-# Select Server wizard
-wizRunOnServerTitle=Run On Server
-wizDebugOnServerTitle=Debug On Server
-wizProfileOnServerTitle=Profile On Server
-wizSelectServerPreferred=Set server as project &default (do not ask again)
-
-# Select Server Client Wizard
-wizSelectClientWizardTitle=Select a Server Client
-wizSelectClientTitle=Select a server client
-wizSelectClientDescription=Select a client to use with this server.
-wizSelectClientMessage=Multiple clients can run on the current selection. Select a client from the list below:
-
-# Task Wizard
-wizTaskWizardTitle=Select Tasks
-wizTaskTitle=Select Tasks
-wizTaskDescription=Select the tasks to perform on the server.
-wizTaskNone=There are currently no tasks that need to be performed.
-
-# New Runtime Wizard
-wizNewRuntimeWizardTitle=New Server Runtime
-wizNewRuntimeTitle=New Server Runtime
-wizNewRuntimeDescription=Define a new installed server runtime environment
-wizEditRuntimeWizardTitle=Edit Server Runtime
-
-# New Installable Server Wizard
-wizNewInstallableServerTitle=Install New Server
-wizNewInstallableServerDescription=Download and install support for a new server. The workbench must be restarted for the changes to take effect.
-wizNewInstallableServerRestart=Installation complete. The new server will not be available until after the workbench is restarted. Do you want to restart now?
-
-# Add/Remove Modules
-wizModuleWizardTitle=Add and Remove Projects
-wizModuleTitle=Add and Remove Projects
-wizModuleDescription=Modify the projects that are configured on the server
-wizModuleMessage=Move projects to the right to configure them on the server
-wizModuleAvailableList=&Available projects:
-wizModuleDeployedList=&Configured projects:
-wizModuleAdd=A&dd >
-wizModuleAddAll=Add A&ll >>
-wizModuleRemove=< &Remove
-wizModuleRemoveAll=<< Re&move All
-
-# General text used in multiple wizards
-wizDescription=Description:
-
-# Wizard info and error messages
-wizErrorInvalidFolder=The folder must be a server project or a folder within a server project
-wizErrorClosedProject=The folder must not be in a closed project
-wizErrorServerCreationError=Cannot create a server using the selected type
-
-
-# --------------- Views ---------------
-
-# --- Server Configuration view ---
-viewServers=Servers
-
-viewNoModules=Nothing deployed
-
-# Actions
-actionDelete=Delete
-actionRemove=Remove
-actionOpen=Open
-actionMonitor=Monitoring
-actionMonitorPort=Monitor port {0} ({1})
-actionMonitorProperties=Properties
-actionNew=New
-actionNewServer=Server
-
-# --- Servers view ---
-# Column titles
-viewServer=Server
-viewStatus=Status
-viewSync=State
-
-# Actions
-actionStart=Start
-actionStartToolTip=Start the server
-actionDebug=Debug
-actionDebugToolTip=Start the server in debug mode
-actionProfile=Profile
-actionProfileToolTip=Start the server in profiling mode
-actionStop=Stop
-actionStopToolTip=Stop the server
-actionRestart=Restart
-actionRestartToolTip=Restart the server
-actionPublish=Publish
-actionPublishToolTip=Publish to the server
-actionModifyModules=Add and Remove Projects...
-actionModifyModulesToolTip=Add and remove projects
-actionRestartModule=Restart {0}
-actionUpdateStatus=Refresh Status
-actionMoveServerToMetadata=Move to Metadata
-actionMoveServerToWorkspace=Move to Workspace
-
-# Status column text
-viewStatusStarted=Started
-viewStatusStartedDebug=Debugging
-viewStatusStartedProfile=Profiling
-viewStatusStopped=Stopped
-
-viewStatusStarting1=Starting.
-viewStatusStarting2=Starting..
-viewStatusStarting3=Starting...
-
-viewStatusStopping1=Stopping.
-viewStatusStopping2=Stopping..
-viewStatusStopping3=Stopping...
-
-# Server State text
-viewSyncOkay=Synchronized
-viewSyncRestart=Restart
-viewSyncPublish=Republish
-viewSyncRestartPublish=Restart & republish
-viewSyncPublishing=Publishing...
-
-# --- set 2 ---
-# Actions
-actionStop2=Disconnect
-actionStopToolTip2=Disconnect from the server
-
-# Status column text
-viewStatusStarting4=Connecting
-viewStatusStarted2=Connected
-viewStatusStopping4=Disconnecting
-viewStatusStopped2=Disconnected
-
-# Server State text
-viewSyncOkay2=Synchronized
-viewSyncRestart2=Reconnect
-viewSyncPublish2=Republish
-viewSyncRestartPublish2=Reconnect and republish
-viewSyncPublishing2=Publishing...
-
-
-# --------------- Action Sets (toolbar icon groups) ---------------
-
-# Servers action set
-actionSetNewServer=Create Server
-
-# Run on Server actions
-actionRunOnServer=Run on Server...
-actionDebugOnServer=Debug on Server...
-actionProfileOnServer=Profile on Server...
-
-
-# --------------- Preferences ---------------
-
-# Names of the preference pages
-preferenceRuntimesTitleLong=Installed Server Runtime Environments
-
-# Server preferences
-prefAutoPublish=Automatically p&ublish when starting servers
-prefAutoPublishLocal=Automatically publish to &local servers
-prefAutoPublishLocalTime=Publishing inter&val (in seconds):
-prefAutoPublishRemote=Automatically publish to rem&ote servers
-prefAutoPublishRemoteTime=Publishing interv&al (in seconds):
-prefAutoRestart=Automatically &restart servers when necessary
-prefPromptIrreversible=Prompt before making &irreversible changes within an editor
-prefShowOnActivity=Show &Servers view when server state changes
-prefMachineSpeed=Server &timeout delay:
-prefMachineSpeedVerySlow=Longer
-prefMachineSpeedSlow=Long
-prefMachineSpeedAverage=Normal
-prefMachineSpeedFast=Short
-prefMachineSpeedVeryFast=Shorter
-prefSyncStartup=S&ynchronize servers on startup
-
-prefSaveEditorsGroup=Save dirty editors before starting server
-prefSaveEditorsNever=&Never
-prefSaveEditorsPrompt=Pro&mpt
-prefSaveEditorsAutosave=Auto-sav&e
-
-# Project properties preferences
-prefProjectDescription=Set the runtime target and the default server for the project.
-prefProject=Project:
-prefProjectDefaultServer=De&fault server:
-prefProjectNotModule=This project cannot be deployed to a server.
-prefProjectNotConfigured=Not currently deployed to any servers
-prefProjectNoServer=<None>
-
-# Installed runtimes
-preferenceRuntimesDescription=Add, remove, or edit installed server runtime definitions.\nThe checked runtime will be used by default when creating new projects.
-preferenceRuntimesTable=&Installed server runtimes:
-
-
-# --------------- Tasks (progress monitors) ---------------
-
-# General tasks
-savingTask=Saving {0}.
-loadingTask=Loading {0}.
-performingTasks=Performing tasks.
-launchingClientTask=Launching client
-
-# --------------- Dialogs ---------------
-
-# Delete Server dialog
-deleteServerDialogTitle=Delete Server
-deleteServerDialogMessage=Are you sure you want to delete {0}?
-deleteServerDialogMessageMany=Are you sure you want to delete the {0} servers?
-deleteServerDialogLooseConfigurations=Delete unused server configuration(s)
-deleteServerDialogRunningServer=Delete running server(s)
-deleteServerDialogRunningServerStop=Stop server(s) before deleting
-deleteServerTask=Deleting server(s)...
-
-# Create Server Project dialog
-createServerProjectDialogTitle=Create Server Project
-createServerProjectDialogMessage=Do you want to create a new server project with the name {0}?
-
-# Terminate Server dialog
-terminateServerDialogTitle=Terminate Server
-terminateServerDialogMessage=Server {0} is not responding. Do you want to terminate this server? Click OK to terminate the server or click Cancel to continue waiting.
-
-# Server resource dirty dialog
-resourceDirtyDialogTitle=Server Resource Dirty
-resourceDirtyDialogMessage=The server resource {0} has unsaved changes. Do you want to continue?
-resourceDirtyDialogContinue=Continue
-
-runtimeTargetCombo=&Target runtime:
-runtimeTargetNone=<None>
-runtimeTargetNewRuntime=&New...
-runtimeTargetRuntimePreferences=Configure &Installed Runtimes...
-runtimeTargetChildren=Target contained projects
-
-# General dialogs
-defaultDialogTitle=Server
-dialogStoppingServer=Stopping server {0}.
-
-# restart warning dialog
-dialogModeWarningDebug=The server is not running in debug mode. You may restart the server in debug mode, continue without debugging, or cancel the operation.
-dialogModeWarningProfile=The server is not running in profiling mode. You may restart the server in profiling mode, continue without profiling, or cancel the operation.
-dialogModeWarningRestart=Restart
-dialogModeWarningContinue=Continue
-
-# Monitor dialog
-dialogMonitorTitle=Monitoring Ports
-dialogMonitorDescription=The following ports are being monitored on server {0}:
-dialogMonitorAddDescription=The server {0} has the following ports that can be monitored:
-dialogMonitorColumnPort=Server Port
-dialogMonitorColumnType=Type
-dialogMonitorColumnMonitorPort=Monitor Port
-dialogMonitorColumnContentType=Content Type
-dialogMonitorColumnStatus=Status
-dialogMonitorMonitorPort=Monitor port:
-dialogMonitorContentType=Content type:
-dialogMonitorContentTypeAll=All
-dialogMonitorContentTypeWeb=Web
-dialogMonitorContentTypeWebServices=WebServices
-
-start=Start
-stop=Stop
-started=Started
-stopped=Stopped
-
-# Confirm runtime removal
-dialogRuntimeInUse=The runtime is currently being used and deleting it will cause compilation or runtime problems. Delete the runtime anyway?
-
-# runtime locator search dialog
-dialogRuntimeSearchTitle=Search For Runtimes
-dialogRuntimeSearchMessage=Select the directory in which to search for server runtimes:
-dialogRuntimeSearchProgress=Searching for server runtime environments...
-
-# Can't add remove
-dialogAddRemoveModulesNone=There are no projects that can be added or removed from the server.
-
-dialogRemoveModuleConfirm=Are you sure you want to remove the project from the server?
-
-# --------------- Misc UI ---------------
-
-# runtime composite
-runtimeTypeCompDescription=Runtimes are used at build time to compile projects.
-runtimeTypeCompTree=Select the type of &runtime that you want to define:
-serverTypeCompLabel=Select the &server type:
-name=Name
-vendor=Vendor
-version=Version
-host=Host name
-moduleSupport=Module Support
-viewBy=&View By:
-installedRuntimes=&Installed Runtimes...
-
-# installable server composite
-installableServerCompTree=Select the &server support to install:
-installableServerLink=Don't see your server listed? Click here
-
-# misc composites
-hostname=Server's &host name:
-
-# Server launch configuration tab
-serverLaunchDescription=This launch configuration can be used to launch the server specified below. To access further options for configuring the server, open the server's editor from the Servers view.
-serverLaunchConfigurationTab=Server
-serverLaunchServer=Server:
-serverLaunchRuntime=Runtime:
-serverLaunchHost=Host name:
-
-# Error Messages
-errorDialogTitle=Server Error
-errorServerAlreadyRunning=Server already running
-errorNoServerSelected=No server selected
-errorInvalidServer=Invalid server
-errorCouldNotCreateServerProject=Could not create server project
-errorCouldNotCreateServerProjectStatus=Could not create server project: {0}
-errorNoModules=No launchable artifact could be found in the selection
-errorNoServer=Could not find a server to run the selection
-errorNoClient=Could not find a client that is able to launch the selection
-errorCouldNotSavePreference=Could not save server preference information.
-errorEditorCantSave=Can't save the server resource for the following reason(s):
-errorEditor=Could not open editor because {0} is not a valid server or server configuration.
-errorVersionLevel=The server does not support version {1} of the {0} specification.
-errorMissingConfiguration=The server configuration is missing or invalid
-
-# Info messages
-infoNoRuntimesFound=No server runtimes were found.
-
-# Default server creation names
-# {0} will be replaced by a number if the given name is already being used
-defaultServerProjectName=Servers{0}
-
-# Used when a name can't be found
-elementUnknownName=<unknown>
-
-columnName=Name
-columnType=Type
-
-add=&Add...
-edit=&Edit...
-remove=&Remove
-search=&Search...
-
-# --------------- Editor support ---------------
-
-serverEditorOverviewPageTitle=Server Overview
-serverEditorOverviewGeneralSection=General
-serverEditorOverviewGeneralDescription=Specify the host name and other common settings.
-serverEditorOverviewServerName=Server name:
-serverEditorOverviewServerNameCommand=set server name
-serverEditorOverviewServerConfigurationPath=Configuration path:
-serverEditorOverviewServerConfigurationBrowse=Browse
-serverEditorOverviewServerConfigurationBrowseMessage=Specify the location of the server configuration.
-serverEditorOverviewServerHostname=Host name:
-serverEditorOverviewServerHostnameCommand=set host name
-serverEditorOverviewRuntime=Runtime:
-serverEditorOverviewRuntimeEdit=Edit
-serverEditorOverviewRuntimeCommand=set runtime
-
-serverEditorOverviewAutoPublishSection=Automatic Publishing
-serverEditorOverviewAutoPublishDescription=Override when the server is automatically published to.
-serverEditorOverviewAutoPublishDefault=Use default publishing settings
-serverEditorOverviewAutoPublishDefaultEdit=Edit
-serverEditorOverviewAutoPublishOverride=Override default settings
-serverEditorOverviewAutoPublishOverrideInterval=Publishing interval (in seconds):
-serverEditorOverviewAutoPublishDisable=Never publish automatically
-serverEditorOverviewAutoPublishCommand=modify publish settings
-serverEditorOverviewOpenLaunchConfiguration=Open launch configuration
-serverEditorOverviewAutoPublishInvalid=The automatic publish setting is invalid. It must be a {0} seconds or more.
-
-# Menu items. {0} will be replaced by one of the xxxEditorActionXxx fields
-# from below. @Ctrl+Z is the menu mnemonic
-editorUndoEnabled=Undo {0}@Ctrl+Z
-editorUndoDisabled=Undo@Ctrl+Z
-editorRedoEnabled=Redo {0}@Ctrl+Y
-editorRedoDisabled=Redo@Ctrl+Y
-
-editorSaveErrorDialog=Save Problems
-editorSaveErrorMessage=Error while saving. {0}
-
-editorReadOnly=Read Only
-editorWritable=Writable
-editorReadOnlyFiles=Read Only files: {0}
-
-editorServerEditor=Server Editor
-editorPromptIrreversible=This operation cannot be undone. Do you want to proceed?
-editorRenameFiles=The server has been renamed. Do you want to rename the corresponding files to match?
-
-# message if a dirty resource is deleted
-editorResourceDeleteTitle=Server Deleted
-editorResourceDeleteServerMessage=The server {0} has been deleted from the file system. Do you want to save your changes or close the editor without saving?
-editorResourceDeleteSave=Save
-
-editorResourceModifiedTitle=File Changed
-editorServerModifiedMessage=The server has been changed on the file system. Do you want to load the changes?
-
-editorValidateEditFailureMessage=The server cannot be edited.
-editorReadOnlyMessage=File(s) being edited have become read-only. The editor will become read-only and changes will be lost.
-
-editorResourceWarnTitle=Server Modification Warning
-editorResourceWarnMessage=The server you are modifying is read-only. All changes will be lost because the server cannot be saved.
-
-
-audioPrefSelectFile=Select Audio File
-audioPrefEnable=&Enable sounds
-audioPrefVolume=&Volume:
-audioPrefSounds=&Sounds:
-audioPrefSound=Sound
-audioPrefFile=Audio File
-audioPrefPlay=&Play
-audioPrefBrowse=&Browse...
-audioPrefReset=&Reset
-
-audioUnknown=(unknown)
-audioDefault=(default)
-audioNone=(none)
-
-errorStartingMonitor=Could not start the server monitor: {0}
-
-internalWebBrowserName=Internal Web Browser
-
-preferenceInternetDescription=General internet settings are available in the contained preference pages. \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/OverlayImageDescriptor.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/OverlayImageDescriptor.java
deleted file mode 100644
index fa265e068..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/OverlayImageDescriptor.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-/**
- * A OverlayImageDescriptor consists of a main icon and one or more overlays.
- * The overlays are computed according to flags set on creation of the descriptor.
- */
-public class OverlayImageDescriptor extends CompositeImageDescriptor {
- // flag to render the error overlay
- public final static int ERROR = 0x001;
-
- private Image fBaseImage;
- private int fFlags;
- private Point fSize;
-
- /**
- * Create a new OverlayImageDescriptor.
- *
- * @param baseImage an image descriptor used as the base image
- * @param flags flags indicating which adornments are to be rendered
- */
- public OverlayImageDescriptor(Image baseImage, int flags) {
- setBaseImage(baseImage);
- setFlags(flags);
- }
-
- /**
- * @see CompositeImageDescriptor#getSize()
- */
- protected Point getSize() {
- if (fSize == null) {
- ImageData data = getBaseImage().getImageData();
- setSize(new Point(data.width, data.height));
- }
- return fSize;
- }
-
- /**
- * @see Object#equals(java.lang.Object)
- */
- public boolean equals(Object object) {
- if (!(object instanceof OverlayImageDescriptor))
- return false;
-
- OverlayImageDescriptor other = (OverlayImageDescriptor) object;
- return (getBaseImage().equals(other.getBaseImage()) && getFlags() == other.getFlags());
- }
-
- /**
- * @see Object#hashCode()
- */
- public int hashCode() {
- return getBaseImage().hashCode() | getFlags();
- }
-
- /**
- * @see CompositeImageDescriptor#drawCompositeImage(int, int)
- */
- protected void drawCompositeImage(int width, int height) {
- ImageData bg = getBaseImage().getImageData();
- if (bg == null)
- bg = DEFAULT_IMAGE_DATA;
-
- drawImage(bg, 0, 0);
- drawOverlays();
- }
-
- /**
- * Add any overlays to the image as specified in the flags.
- */
- protected void drawOverlays() {
- int flags = getFlags();
- ImageData data = null;
- if ((flags & ERROR) != 0) {
- data = DebugUITools.getImage(IDebugUIConstants.IMG_OVR_ERROR).getImageData();
- int x = getSize().x - data.width;
- drawImage(data, x, 0);
- }
- }
-
- protected Image getBaseImage() {
- return fBaseImage;
- }
-
- protected void setBaseImage(Image baseImage) {
- fBaseImage = baseImage;
- }
-
- protected int getFlags() {
- return fFlags;
- }
-
- protected void setFlags(int flags) {
- fFlags = flags;
- }
-
- protected void setSize(Point size) {
- fSize = size;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ProgressUtil.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ProgressUtil.java
deleted file mode 100644
index c5a3e8d4a..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ProgressUtil.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.core.runtime.*;
-/**
- * Progress Monitor utility.
- */
-public class ProgressUtil {
- /**
- * ProgressUtil constructor comment.
- */
- private ProgressUtil() {
- super();
- }
-
- /**
- * Return a valid progress monitor.
- *
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- * @return org.eclipse.core.runtime.IProgressMonitor
- */
- public static IProgressMonitor getMonitorFor(IProgressMonitor monitor) {
- if (monitor == null)
- return new NullProgressMonitor();
- return monitor;
- }
-
- /**
- * Return a sub-progress monitor with the given amount on the
- * current progress monitor.
- *
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- * @param ticks int
- * @return org.eclipse.core.runtime.IProgressMonitor
- */
- public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks);
- }
-
- /**
- * Return a sub-progress monitor with the given amount on the
- * current progress monitor.
- *
- * @param monitor a progress monitor, or null
- * @param ticks a number of ticks
- * @param style a style
- * @return a progress monitor
- */
- public static IProgressMonitor getSubMonitorFor(IProgressMonitor monitor, int ticks, int style) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks, style);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ProjectPropertyPage.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ProjectPropertyPage.java
deleted file mode 100644
index 0ff6db22b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ProjectPropertyPage.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.Dialog;
-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.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleType;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.ui.ServerUICore;
-/**
- * PropertyPage for IProjects. It shows the server and runtime preference for the project.
- */
-public class ProjectPropertyPage extends PropertyPage {
- protected IProject project;
- protected IModule module;
- protected IServer server;
-
- /**
- * ProjectPropertyPage constructor comment.
- */
- public ProjectPropertyPage() {
- super();
- }
-
- /**
- * Create the body of the page.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @return org.eclipse.swt.widgets.Control
- */
- protected Control createContents(Composite parent) {
- try {
- IAdaptable element = getElement();
- if (element instanceof IProject)
- project = (IProject) element;
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.numColumns = 4;
- layout.verticalSpacing = 10;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label label = new Label(composite, SWT.WRAP);
- label.setText(Messages.prefProjectDescription);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 4;
- data.widthHint = 200;
- label.setLayoutData(data);
-
- module = ServerUtil.getModule(project);
- if (module == null) {
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.prefProjectNotModule);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 4;
- label.setLayoutData(data);
- } else {
- IModuleType mt = module.getModuleType();
- if (mt != null) {
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.prefProject);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- label.setLayoutData(data);
-
- Label moduleKind = new Label(composite, SWT.NONE);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- moduleKind.setLayoutData(data);
- moduleKind.setText(module.getName() + " (" + mt.getName() + ")");
- }
-
- IServer prefServer = ServerCore.getDefaultServer(module);
-
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.prefProjectDefaultServer);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
- label.setLayoutData(data);
-
- final IServer[] servers = getServersBySupportedModule(module);
- if (servers == null || servers.length == 0) {
- label = new Label(composite, SWT.WRAP);
- label.setText(Messages.prefProjectNotConfigured);
- data = new GridData();
- data.horizontalSpan = 3;
- label.setLayoutData(data);
- } else {
- final Table table = new Table(composite, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- data.heightHint = 70;
- table.setLayoutData(data);
-
- // add none option
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(Messages.prefProjectNoServer);
- //item.setImage();
-
- int size2 = servers.length;
- int count = 0;
- for (int j = 0; j < size2; j++) {
- item = new TableItem(table, SWT.NONE);
- item.setText(ServerUICore.getLabelProvider().getText(servers[j]));
- item.setImage(ServerUICore.getLabelProvider().getImage(servers[j]));
- item.setData(servers[j]);
- if (servers[j].equals(prefServer))
- count = j + 1;
- }
-
- table.setSelection(count);
-
- table.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- int index = table.getSelectionIndex();
- if (index == 0) {
- server = null;
- } else if (index > 0) {
- server = servers[index-1];
- }
- }
- });
- }
- }
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error creating project property page", e);
- return null;
- }
- }
-
- /**
- * Returns a list of all servers that this module is configured on.
- *
- * @param module org.eclipse.wst.server.core.IModule
- * @return java.util.List
- */
- protected static IServer[] getServersBySupportedModule(IModule module) {
- if (module == null)
- return new IServer[0];
-
- // do it the slow way - go through all servers and
- // see if this module is configured in it
- List list = new ArrayList();
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (ServerUtil.isSupportedModule(servers[i].getServerType().getRuntimeType().getModuleTypes(), module.getModuleType()))
- list.add(servers[i]);
- }
- }
-
- IServer[] allServers = new IServer[list.size()];
- list.toArray(allServers);
- return allServers;
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#performOk()
- */
- public boolean performOk() {
- if (module != null) {
- try {
- ServerCore.setDefaultServer(module, server, null);
- } catch (CoreException e) {
- Trace.trace(Trace.SEVERE, "Error setting preferred server", e);
- EclipseUtil.openError(Messages.errorCouldNotSavePreference, e.getStatus());
- return false;
- }
- }
- return super.performOk();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/RuntimePreferencePage.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/RuntimePreferencePage.java
deleted file mode 100644
index 322f5a2f3..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/RuntimePreferencePage.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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.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.DirectoryDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.IRuntimeLocator;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.ui.internal.viewers.RuntimeComposite;
-import org.eclipse.wst.server.ui.internal.wizard.ClosableWizardDialog;
-import org.eclipse.wst.server.ui.internal.wizard.TaskWizard;
-import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.NewRuntimeWizardFragment;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- * The preference page that holds server runtimes.
- */
-public class RuntimePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- protected Button edit;
- protected Button remove;
- protected Label pathLabel;
-
- /**
- * RuntimePreferencesPage constructor comment.
- */
- public RuntimePreferencePage() {
- super();
- noDefaultAndApplyButton();
- }
-
- /**
- * Create the preference options.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @return org.eclipse.swt.widgets.Control
- */
- protected Control createContents(Composite parent) {
- initializeDialogUnits(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ContextIds.PREF_GENERAL);
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
- layout.verticalSpacing = convertVerticalDLUsToPixels(3);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- composite.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- composite.setLayoutData(data);
-
- Label label = new Label(composite, SWT.WRAP);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- label.setText(Messages.preferenceRuntimesDescription);
-
- label = new Label(composite, SWT.WRAP);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- label.setText(Messages.preferenceRuntimesTable);
-
- final RuntimeComposite runtimeComp = new RuntimeComposite(composite, SWT.NONE, new RuntimeComposite.RuntimeSelectionListener() {
- public void runtimeSelected(IRuntime runtime) {
- if (runtime == null) {
- edit.setEnabled(false);
- remove.setEnabled(false);
- pathLabel.setText("");
- } else if (runtime.isReadOnly()) {
- edit.setEnabled(false);
- remove.setEnabled(false);
- pathLabel.setText(runtime.getLocation() + "");
- } else {
- edit.setEnabled(true);
- remove.setEnabled(true);
- pathLabel.setText(runtime.getLocation() + "");
- }
- }
- });
- runtimeComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
-
- Composite buttonComp = new Composite(composite, SWT.NONE);
- layout = new GridLayout();
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = convertVerticalDLUsToPixels(3);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- buttonComp.setLayout(layout);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- buttonComp.setLayoutData(data);
-
- Button add = SWTUtil.createButton(buttonComp, Messages.add);
- add.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (showWizard(null) == Window.CANCEL)
- return;
- runtimeComp.refresh();
- }
- });
-
- edit = SWTUtil.createButton(buttonComp, Messages.edit);
- edit.setEnabled(false);
- edit.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IRuntime runtime = runtimeComp.getSelectedRuntime();
- if (runtime != null) {
- IRuntimeWorkingCopy runtimeWorkingCopy = runtime.createWorkingCopy();
- if (showWizard(runtimeWorkingCopy) != Window.CANCEL) {
- try {
- runtimeComp.refresh(runtime);
- } catch (Exception ex) {
- // ignore
- }
- }
- }
- }
- });
-
- remove = SWTUtil.createButton(buttonComp, Messages.remove);
- remove.setEnabled(false);
- remove.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IRuntime runtime = runtimeComp.getSelectedRuntime();
- if (shouldRemoveRuntime(runtime))
- try {
- runtime.delete();
- runtimeComp.remove(runtime);
- } catch (Exception ex) {
- // ignore
- }
- }
- });
-
- Button search = SWTUtil.createButton(buttonComp, Messages.search);
- data = (GridData) search.getLayoutData();
- data.verticalIndent = 9;
- search.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- try {
- // select a target directory for the search
- DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
- directoryDialog.setMessage(Messages.dialogRuntimeSearchMessage);
- directoryDialog.setText(Messages.dialogRuntimeSearchTitle);
-
- String pathStr = directoryDialog.open();
- if (pathStr == null)
- return;
-
- final IPath path = new Path(pathStr);
-
- final ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
- dialog.setBlockOnOpen(false);
- dialog.setCancelable(true);
- dialog.open();
- final IProgressMonitor monitor = dialog.getProgressMonitor();
- final IRuntimeLocator[] locators = ServerPlugin.getRuntimeLocators();
- monitor.beginTask(Messages.dialogRuntimeSearchProgress, 100 * locators.length + 10);
- final List list = new ArrayList();
-
- final IRuntimeLocator.IRuntimeSearchListener listener = new IRuntimeLocator.IRuntimeSearchListener() {
- public void runtimeFound(final IRuntimeWorkingCopy runtime) {
- dialog.getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- monitor.subTask(runtime.getName());
- }
- });
- list.add(runtime);
- }
- };
-
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor2) {
- if (locators != null) {
- int size = locators.length;
- for (int i = 0; i < size; i++) {
- if (!monitor2.isCanceled())
- try {
- locators[i].searchForRuntimes(path, listener, monitor2);
- } catch (CoreException ce) {
- Trace.trace(Trace.WARNING, "Error locating runtimes: " + locators[i].getId(), ce);
- }
- }
- }
- Trace.trace(Trace.INFO, "Done search");
- }
- };
- dialog.run(true, true, runnable);
-
- Trace.trace(Trace.FINER, "Found runtimes: " + list.size());
-
- if (!monitor.isCanceled()) {
- if (list.isEmpty()) {
- EclipseUtil.openError(getShell(), Messages.infoNoRuntimesFound);
- return;
- }
- monitor.worked(5);
- // remove duplicates from list (based on location)
- Trace.trace(Trace.FINER, "Removing duplicates");
- List good = new ArrayList();
- Iterator iterator2 = list.iterator();
- while (iterator2.hasNext()) {
- boolean dup = false;
- IRuntime wc = (IRuntime) iterator2.next();
-
- IRuntime[] runtimes = ServerCore.getRuntimes();
- if (runtimes != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].getLocation() != null && runtimes[i].getLocation().equals(wc.getLocation()))
- dup = true;
- }
- }
- if (!dup)
- good.add(wc);
- }
- monitor.worked(5);
-
- // add to list
- Trace.trace(Trace.FINER, "Adding runtimes: " + good.size());
- Iterator iterator = good.iterator();
- while (iterator.hasNext()) {
- IRuntimeWorkingCopy wc = (IRuntimeWorkingCopy) iterator.next();
- wc.save(false, monitor);
- }
- monitor.done();
- }
- dialog.close();
- } catch (Exception ex) {
- Trace.trace(Trace.SEVERE, "Error finding runtimes", ex);
- }
- runtimeComp.refresh();
- }
- });
-
- pathLabel = new Label(parent, SWT.NONE);
- pathLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- protected boolean shouldRemoveRuntime(IRuntime runtime) {
- if (runtime == null)
- return false;
-
- // check for use
- boolean inUse = false;
-
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (runtime.equals(servers[i].getRuntime()))
- inUse = true;
- }
- }
-
- /*IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- if (projects != null) {
- int size = projects.length;
- for (int i = 0; i < size; i++) {
- IProjectProperties props = ServerCore.getProjectProperties(projects[i]);
- if (runtime.equals(props.getRuntimeTarget()))
- inUse = true;
- }
- }*/
-
- if (inUse) {
- if (!MessageDialog.openConfirm(getShell(), Messages.defaultDialogTitle, Messages.dialogRuntimeInUse))
- return false;
- }
-
- return true;
- }
-
- protected int showWizard(final IRuntimeWorkingCopy runtimeWorkingCopy) {
- String title = null;
- WizardFragment fragment = null;
- TaskModel taskModel = new TaskModel();
- if (runtimeWorkingCopy == null) {
- title = Messages.wizNewRuntimeWizardTitle;
- fragment = new WizardFragment() {
- protected void createChildFragments(List list) {
- list.add(new NewRuntimeWizardFragment());
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveRuntime(getTaskModel(), monitor);
- }
- });
- }
- };
- } else {
- title = Messages.wizEditRuntimeWizardTitle;
- final WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(runtimeWorkingCopy.getRuntimeType().getId());
- if (fragment2 == null) {
- edit.setEnabled(false);
- return Window.CANCEL;
- }
- taskModel.putObject(TaskModel.TASK_RUNTIME, runtimeWorkingCopy);
- fragment = new WizardFragment() {
- protected void createChildFragments(List list) {
- list.add(fragment2);
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveRuntime(getTaskModel(), monitor);
- }
- });
- }
- };
- }
- TaskWizard wizard = new TaskWizard(title, fragment, taskModel);
- wizard.setForcePreviousAndNextButtons(true);
- ClosableWizardDialog dialog = new ClosableWizardDialog(getShell(), wizard);
- return dialog.open();
- }
-
- protected IRuntime getSelection(ISelection sel2) {
- IStructuredSelection sel = (IStructuredSelection) sel2;
- return (IRuntime) sel.getFirstElement();
- }
-
- /**
- * Initializes this preference page using the passed workbench.
- *
- * @param workbench the current workbench
- */
- public void init(IWorkbench workbench) {
- // do nothing
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#performOk()
- */
- public boolean performOk() {
- // TODO - should not save until user hits ok
- return true;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible)
- setTitle(Messages.preferenceRuntimesTitleLong);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/SWTUtil.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/SWTUtil.java
deleted file mode 100644
index 459a68283..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/SWTUtil.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-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;
-/**
- * SWT Utility class.
- */
-public class SWTUtil {
- private static FontMetrics fontMetrics;
-
- protected static void initializeDialogUnits(Control testControl) {
- // Compute and store a font metric
- GC gc = new GC(testControl);
- gc.setFont(JFaceResources.getDialogFont());
- fontMetrics = gc.getFontMetrics();
- gc.dispose();
- }
-
- /**
- * Returns a width hint for a button control.
- */
- protected static int getButtonWidthHint(Button button) {
- int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
- return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- }
-
- /**
- * Create a new button with the standard size.
- *
- * @param comp the component to add the button to
- * @param label the button label
- * @return a button
- */
- public static Button createButton(Composite comp, String label) {
- Button b = new Button(comp, SWT.PUSH);
- b.setText(label);
- if (fontMetrics == null)
- initializeDialogUnits(comp);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
- data.widthHint = getButtonWidthHint(b);
- b.setLayoutData(data);
- return b;
- }
-
- /**
- * Convert DLUs to pixels.
- *
- * @param comp a component
- * @param x pixels
- * @return dlus
- */
- public static int convertHorizontalDLUsToPixels(Composite comp, int x) {
- if (fontMetrics == null)
- initializeDialogUnits(comp);
- return Dialog.convertHorizontalDLUsToPixels(fontMetrics, x);
- }
-
- /**
- * Convert DLUs to pixels.
- *
- * @param comp a component
- * @param y pixels
- * @return dlus
- */
- public static int convertVerticalDLUsToPixels(Composite comp, int y) {
- if (fontMetrics == null)
- initializeDialogUnits(comp);
- return Dialog.convertVerticalDLUsToPixels(fontMetrics, y);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerAdapterFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerAdapterFactory.java
deleted file mode 100644
index 52efdbc3b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerAdapterFactory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.server.ui.internal;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.ui.IActionFilter;
-/**
- * Adapter factory to adapt servers to IActionFilter.
- */
-public class ServerAdapterFactory implements IAdapterFactory {
- IActionFilter actionFilter = new IActionFilter() {
- public boolean testAttribute(Object target, String name, String value) {
- return ServerPropertyTester.checkProperty(target, name, value);
- }
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType != IActionFilter.class)
- return null;
-
- return actionFilter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
- return new Class[] { IActionFilter.class };
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLabelProvider.java
deleted file mode 100644
index 1ba1468d4..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLabelProvider.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.IClient;
-/**
- * A label provider for all server related objects.
- */
-public class ServerLabelProvider implements ILabelProvider {
- public ServerLabelProvider() {
- // do nothing
- }
-
- protected Image getModuleImage(String typeId) {
- if (typeId == null)
- return null;
-
- Image image = ImageResource.getImage(typeId);
- int ind = typeId.indexOf(".");
- while (image == null && ind >= 0) {
- typeId = typeId.substring(0, ind);
- image = ImageResource.getImage(typeId);
- }
- return image;
- }
-
- protected ImageDescriptor getModuleImageDescriptor(String typeId) {
- if (typeId == null)
- return null;
-
- ImageDescriptor image = ImageResource.getImageDescriptor(typeId);
- int ind = typeId.indexOf(".");
- while (image == null && ind >= 0) {
- typeId = typeId.substring(0, ind);
- image = ImageResource.getImageDescriptor(typeId);
- }
- return image;
- }
-
- /*
- * @see ILabelProvider#getImage(Object)
- */
- public ImageDescriptor getImageDescriptor(Object element) {
- try {
- if (element instanceof IRuntimeType) {
- IRuntimeType runtimeType = (IRuntimeType) element;
- return ImageResource.getImageDescriptor(runtimeType.getId());
- } else if (element instanceof IRuntime) {
- IRuntime runtime = (IRuntime) element;
- return ImageResource.getImageDescriptor(runtime.getRuntimeType().getId());
- } else if (element instanceof IServerType) {
- IServerType serverType = (IServerType) element;
- return ImageResource.getImageDescriptor(serverType.getId());
- } else if (element instanceof IServer) {
- IServer server = (IServer) element;
- return ImageResource.getImageDescriptor(server.getServerType().getId());
- } else if (element instanceof IModule) {
- IModule module = (IModule) element;
- IModuleType mt = module.getModuleType();
- return getModuleImageDescriptor(mt.getId());
- } else if (element instanceof IModule[]) {
- IModule[] modules = (IModule[]) element;
- IModule module = modules[modules.length - 1];
- IModuleType mt = module.getModuleType();
- return getModuleImageDescriptor(mt.getId());
- } else if (element instanceof IWorkbenchAdapter) {
- return ((IWorkbenchAdapter) element).getImageDescriptor(null);
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not get image descriptor", e);
- }
- return null;
- }
-
- /*
- * @see ILabelProvider#getImage(Object)
- */
- public Image getImage(Object element) {
- try {
- if (element instanceof IRuntimeType) {
- IRuntimeType runtimeType = (IRuntimeType) element;
- return ImageResource.getImage(runtimeType.getId());
- } else if (element instanceof IRuntime) {
- IRuntime runtime = (IRuntime) element;
- return ImageResource.getImage(runtime.getRuntimeType().getId());
- } else if (element instanceof IServerType) {
- IServerType serverType = (IServerType) element;
- return ImageResource.getImage(serverType.getId());
- } else if (element instanceof IServer) {
- IServer server = (IServer) element;
- if (server.getServerType() == null)
- return null;
-
- return ImageResource.getImage(server.getServerType().getId());
- } else if (element instanceof IModule) {
- IModule module = (IModule) element;
- IModuleType mt = module.getModuleType();
- if (mt == null)
- return null;
-
- return getModuleImage(mt.getId());
- } else if (element instanceof IModule[]) {
- IModule[] modules = (IModule[]) element;
- IModule module = modules[modules.length - 1];
- IModuleType mt = module.getModuleType();
- if (mt == null)
- return null;
-
- return getModuleImage(mt.getId());
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not get image descriptor", e);
- }
- return null;
- }
-
- protected String getString(String s) {
- if (s == null)
- return "";
-
- return s;
- }
-
- /*
- * @see ILabelProvider#getText(Object)
- */
- public String getText(Object element) {
- if (element == null)
- return "";
-
- if (element instanceof IRuntime) {
- return getString(((IRuntime) element).getName());
- } else if (element instanceof IServer) {
- return getString(((IServer) element).getName());
- } else if (element instanceof IRuntimeType) {
- return ((IRuntimeType) element).getName();
- } else if (element instanceof IServerType) {
- return ((IServerType) element).getName();
- } else if (element instanceof IClient) {
- return ((IClient) element).getName();
- } else if (element instanceof IModule) {
- return ((IModule) element).getName();
- } else if (element instanceof IModule[]) {
- IModule[] modules = (IModule[]) element;
- return modules[modules.length - 1].getName();
- } else if (element instanceof IWorkbenchAdapter) {
- return ((IWorkbenchAdapter) element).getLabel(null);
- }
-
- return "";
- }
-
- /*
- * @see IBaseLabelProvider#addListener(ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- /*
- * @see IBaseLabelProvider#isLabelProperty(Object, String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /*
- * @see IBaseLabelProvider#removeListener(ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- /*
- * @see IBaseLabelProvider#dispose()
- */
- public void dispose() {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLaunchShortcut.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLaunchShortcut.java
deleted file mode 100644
index f122256aa..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerLaunchShortcut.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.debug.ui.ILaunchShortcut;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.ui.internal.actions.RunOnServerActionDelegate;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-/**
- *
- */
-public class ServerLaunchShortcut implements ILaunchShortcut {
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.jface.viewers.ISelection, java.lang.String)
- */
- public void launch(ISelection selection, final String mode) {
- RunOnServerActionDelegate del = new RunOnServerActionDelegate() {
- protected String getLaunchMode() {
- return mode;
- }
- };
- IAction action = new Action() {
- // dummy action
- };
- del.selectionChanged(action, selection);
- del.run(action);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.debug.ui.ILaunchShortcut#launch(org.eclipse.ui.IEditorPart, java.lang.String)
- */
- public void launch(IEditorPart editor, String mode) {
- if (editor == null)
- return;
-
- // check if the editor input itself can be run. Otherwise, check if
- // the editor has a file input that can be run
- IEditorInput input = editor.getEditorInput();
-
- if (ServerPlugin.hasModuleArtifact(input)) {
- launch(new StructuredSelection(input), mode);
- } else if (input instanceof IFileEditorInput) {
- IFileEditorInput fei = (IFileEditorInput) input;
- IFile file = fei.getFile();
- if (ServerPlugin.hasModuleArtifact(file))
- launch(new StructuredSelection(file), mode);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPreferencePage.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPreferencePage.java
deleted file mode 100644
index 0e748bea8..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPreferencePage.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.internal.ServerPreferences;
-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.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.Spinner;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-/**
- * The preference page that holds server properties.
- */
-public class ServerPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- protected Button publishBeforeStart;
- protected Button autoRestart;
-
- protected Button promptIrreversible;
-
- protected Button showOnActivity;
-
- protected byte saveEditors;
-
- protected Button saveNever;
- protected Button savePrompt;
- protected Button saveAuto;
- protected Button syncOnStartup;
-
- protected ServerPreferences preferences;
- protected ServerUIPreferences uiPreferences;
-
- protected Button autoPublishOnAction;
- protected Button autoPublishLocal;
- protected Spinner autoPublishLocalTime;
- protected Button autoPublishRemote;
- protected Spinner autoPublishRemoteTime;
-
- protected Combo machineSpeedCombo;
-
- /**
- * ServerPreferencesPage constructor comment.
- */
- public ServerPreferencePage() {
- super();
-
- preferences = ServerPreferences.getInstance();
- uiPreferences = ServerUIPlugin.getPreferences();
- }
-
- /**
- * Create the preference options.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @return org.eclipse.swt.widgets.Control
- */
- protected Control createContents(Composite parent) {
- initializeDialogUnits(parent);
- IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
- whs.setHelp(parent, ContextIds.PREF_GENERAL);
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
- layout.verticalSpacing = convertVerticalDLUsToPixels(4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 3;
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- composite.setLayoutData(data);
-
- showOnActivity = new Button(composite, SWT.CHECK);
- showOnActivity.setText(Messages.prefShowOnActivity);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- showOnActivity.setLayoutData(data);
- showOnActivity.setSelection(uiPreferences.getShowOnActivity());
- whs.setHelp(showOnActivity, ContextIds.PREF_GENERAL_SHOW_ON_ACTIVITY);
-
- publishBeforeStart = new Button(composite, SWT.CHECK);
- publishBeforeStart.setText(Messages.prefAutoPublish);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- publishBeforeStart.setLayoutData(data);
- publishBeforeStart.setSelection(preferences.isAutoPublishing());
- whs.setHelp(publishBeforeStart, ContextIds.PREF_GENERAL_PUBLISH_BEFORE_START);
-
- syncOnStartup = new Button(composite, SWT.CHECK);
- syncOnStartup.setText(Messages.prefSyncStartup);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- syncOnStartup.setLayoutData(data);
- syncOnStartup.setSelection(preferences.isSyncOnStartup());
- whs.setHelp(syncOnStartup, ContextIds.PREF_GENERAL_SYNC_STARTUP);
-
- autoPublishLocal = new Button(composite, SWT.CHECK);
- autoPublishLocal.setText(Messages.prefAutoPublishLocal);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- autoPublishLocal.setLayoutData(data);
- autoPublishLocal.setSelection(preferences.getAutoPublishLocal());
- whs.setHelp(autoPublishLocal, ContextIds.PREF_GENERAL_AUTOPUBLISH_LOCAL);
-
- final Label autoPublishLocalTimeLabel = new Label(composite, SWT.NONE);
- autoPublishLocalTimeLabel.setText(Messages.prefAutoPublishLocalTime);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- data.horizontalIndent = 20;
- autoPublishLocalTimeLabel.setLayoutData(data);
- autoPublishLocalTimeLabel.setEnabled(autoPublishLocal.getSelection());
-
- autoPublishLocalTime = new Spinner(composite, SWT.BORDER);
- autoPublishLocalTime.setMinimum(0);
- autoPublishLocalTime.setMaximum(120);
- autoPublishLocalTime.setSelection(preferences.getAutoPublishLocalTime());
- autoPublishLocalTime.setEnabled(autoPublishLocal.getSelection());
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- data.widthHint = 60;
- autoPublishLocalTime.setLayoutData(data);
- whs.setHelp(autoPublishLocalTime, ContextIds.PREF_GENERAL_AUTOPUBLISH_LOCAL);
-
- autoPublishLocal.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- autoPublishLocalTimeLabel.setEnabled(autoPublishLocal.getSelection());
- autoPublishLocalTime.setEnabled(autoPublishLocal.getSelection());
- }
- });
-
- autoPublishRemote = new Button(composite, SWT.CHECK);
- autoPublishRemote.setText(Messages.prefAutoPublishRemote);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- autoPublishRemote.setLayoutData(data);
- autoPublishRemote.setSelection(preferences.getAutoPublishRemote());
- whs.setHelp(autoPublishRemote, ContextIds.PREF_GENERAL_AUTOPUBLISH_REMOTE);
-
- final Label autoPublishRemoteTimeLabel = new Label(composite, SWT.NONE);
- autoPublishRemoteTimeLabel.setText(Messages.prefAutoPublishRemoteTime);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- data.horizontalIndent = 20;
- autoPublishRemoteTimeLabel.setLayoutData(data);
- autoPublishRemoteTimeLabel.setEnabled(autoPublishRemote.getSelection());
-
- autoPublishRemoteTime = new Spinner(composite, SWT.BORDER);
- autoPublishRemoteTime.setMinimum(0);
- autoPublishRemoteTime.setMaximum(120);
- autoPublishRemoteTime.setSelection(preferences.getAutoPublishRemoteTime());
- autoPublishRemoteTime.setEnabled(autoPublishRemote.getSelection());
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- data.widthHint = 60;
- autoPublishRemoteTime.setLayoutData(data);
- whs.setHelp(autoPublishRemoteTime, ContextIds.PREF_GENERAL_AUTOPUBLISH_REMOTE);
-
- autoPublishRemote.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- autoPublishRemoteTimeLabel.setEnabled(autoPublishRemote.getSelection());
- autoPublishRemoteTime.setEnabled(autoPublishRemote.getSelection());
- }
- });
-
- autoRestart = new Button(composite, SWT.CHECK);
- autoRestart.setText(Messages.prefAutoRestart);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- autoRestart.setLayoutData(data);
- autoRestart.setSelection(preferences.isAutoRestarting());
- whs.setHelp(autoRestart, ContextIds.PREF_GENERAL_AUTO_RESTART);
-
- promptIrreversible = new Button(composite, SWT.CHECK);
- promptIrreversible.setText(Messages.prefPromptIrreversible);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- promptIrreversible.setLayoutData(data);
- promptIrreversible.setSelection(uiPreferences.getPromptBeforeIrreversibleChange());
- whs.setHelp(promptIrreversible, ContextIds.PREF_GENERAL_PROMPT_IRREVERSIBLE);
-
- Label label = new Label(composite, SWT.NONE);
- data = new GridData();
- data.horizontalSpan = 3;
- label.setLayoutData(data);
-
- // save editors group
- Group saveEditorGroup = new Group(composite, SWT.NONE);
- saveEditorGroup.setText(Messages.prefSaveEditorsGroup);
-
- layout = new GridLayout();
- layout.numColumns = 3;
- saveEditorGroup.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- saveEditorGroup.setLayoutData(data);
-
- saveNever = new Button(saveEditorGroup, SWT.RADIO);
- saveNever.setText(Messages.prefSaveEditorsNever);
- saveNever.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- saveEditors = ServerUIPreferences.SAVE_EDITORS_NEVER;
- }
- });
- whs.setHelp(saveNever, ContextIds.PREF_GENERAL_SAVE_EDITORS);
-
- savePrompt = new Button(saveEditorGroup, SWT.RADIO);
- savePrompt.setText(Messages.prefSaveEditorsPrompt);
- savePrompt.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- saveEditors = ServerUIPreferences.SAVE_EDITORS_PROMPT;
- }
- });
- whs.setHelp(savePrompt, ContextIds.PREF_GENERAL_SAVE_EDITORS);
-
- saveAuto = new Button(saveEditorGroup, SWT.RADIO);
- saveAuto.setText(Messages.prefSaveEditorsAutosave);
- saveAuto.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- saveEditors = ServerUIPreferences.SAVE_EDITORS_AUTO;
- }
- });
- whs.setHelp(saveAuto, ContextIds.PREF_GENERAL_SAVE_EDITORS);
-
- label = new Label(composite, SWT.NONE);
- data = new GridData();
- data.horizontalSpan = 3;
- label.setLayoutData(data);
-
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.prefMachineSpeed);
-
- machineSpeedCombo = new Combo(composite, SWT.READ_ONLY);
- String[] items = new String[] {
- Messages.prefMachineSpeedVerySlow,
- Messages.prefMachineSpeedSlow,
- Messages.prefMachineSpeedAverage,
- Messages.prefMachineSpeedFast,
- Messages.prefMachineSpeedVeryFast
- };
- machineSpeedCombo.setItems(items);
- machineSpeedCombo.select((preferences.getMachineSpeed() - 1) / 2);
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- data.horizontalSpan = 2;
- machineSpeedCombo.setLayoutData(data);
- whs.setHelp(machineSpeedCombo, ContextIds.PREF_GENERAL_TIMEOUT_DELAY);
-
- setSaveEditorStatus(uiPreferences.getSaveEditors());
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- protected void setSaveEditorStatus(byte status) {
- saveEditors = status;
- saveNever.setSelection(saveEditors == ServerUIPreferences.SAVE_EDITORS_NEVER);
- savePrompt.setSelection(saveEditors == ServerUIPreferences.SAVE_EDITORS_PROMPT);
- saveAuto.setSelection(saveEditors == ServerUIPreferences.SAVE_EDITORS_AUTO);
- }
-
- /**
- * Initializes this preference page using the passed workbench.
- *
- * @param workbench the current workbench
- */
- public void init(IWorkbench workbench) {
- // do nothing
- }
-
- /**
- * Performs special processing when this page's Defaults button has been pressed.
- */
- protected void performDefaults() {
- autoRestart.setSelection(preferences.isDefaultAutoRestarting());
- publishBeforeStart.setSelection(preferences.isDefaultAutoPublishing());
- promptIrreversible.setSelection(uiPreferences.getDefaultPromptBeforeIrreversibleChange());
- showOnActivity.setSelection(uiPreferences.getDefaultShowOnActivity());
-
- syncOnStartup.setSelection(preferences.getDefaultSyncOnStartup());
- autoPublishLocal.setSelection(preferences.getDefaultAutoPublishLocal());
- autoPublishLocalTime.setSelection(preferences.getDefaultAutoPublishLocalTime());
- autoPublishRemote.setSelection(preferences.getDefaultAutoPublishRemote());
- autoPublishRemoteTime.setSelection(preferences.getDefaultAutoPublishRemoteTime());
-
- machineSpeedCombo.select((preferences.getDefaultMachineSpeed() - 1) / 2);
-
- setSaveEditorStatus(uiPreferences.getDefaultSaveEditors());
-
- super.performDefaults();
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- preferences.setAutoPublishing(publishBeforeStart.getSelection());
- preferences.setAutoRestarting(autoRestart.getSelection());
- preferences.setSyncOnStartup(syncOnStartup.getSelection());
- uiPreferences.setSaveEditors(saveEditors);
- uiPreferences.setPromptBeforeIrreversibleChange(promptIrreversible.getSelection());
- uiPreferences.setShowOnActivity(showOnActivity.getSelection());
-
- preferences.setAutoPublishLocal(autoPublishLocal.getSelection());
- preferences.setAutoPublishLocalTime(autoPublishLocalTime.getSelection());
- preferences.setAutoPublishRemote(autoPublishRemote.getSelection());
- preferences.setAutoPublishRemoteTime(autoPublishRemoteTime.getSelection());
-
- preferences.setMachineSpeed(machineSpeedCombo.getSelectionIndex() * 2 + 1);
-
- // auto restart any servers that are ready for restart
- if (autoRestart.getSelection())
- autoRestartAll();
-
- return true;
- }
-
- /**
- * Automatically restart any servers that require it.
- */
- protected static void autoRestartAll() {
- Trace.trace(Trace.FINEST, "Auto restarting all dirty servers");
-
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- IServer server = servers[i];
- if (server.getServerRestartState()) {
- String mode = server.getMode();
- if (server.canRestart(mode).isOK())
- try {
- Trace.trace(Trace.FINEST, "Attempting to auto restart " + server.getName());
- server.restart(mode, (IProgressMonitor)null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error restarting: " + server, e);
- }
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPropertyTester.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPropertyTester.java
deleted file mode 100644
index 8525e9b4b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerPropertyTester.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-/**
- *
- */
-public class ServerPropertyTester extends PropertyTester {
- /* (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (expectedValue instanceof String)
- return checkProperty(receiver, property, (String) expectedValue);
- return checkProperty(receiver, property, null);
- }
-
- protected static boolean checkProperty(Object target, String property, String value) {
- if ("isRunnable".equals(property)) {
- // check if project has a module associated with it
- if (target instanceof IProject)
- return ServerUtil.getModule((IProject) target) != null;
-
- // check for runnable object
- boolean b = ServerPlugin.hasModuleArtifact(target);
- if (b)
- return true;
-
- /*if (!(receiver instanceof IEditorPart))
- return false;
-
- // check if the editor input itself can be run. Otherwise, check if
- // the editor has a file input that can be run
- IEditorPart editor = (IEditorPart) receiver;
- IEditorInput input = editor.getEditorInput();
-
- b = ServerPlugin.hasModuleArtifact(input);
- if (b)
- return true;*/
-
- if (target instanceof IFileEditorInput) {
- IFileEditorInput fei = (IFileEditorInput) target;
- IFile file = fei.getFile();
- b = ServerPlugin.hasModuleArtifact(file);
- if (b)
- return true;
- }
- return false;
- } else if ("serverType".equals(property)) {
- if (!(target instanceof IServer))
- return false;
-
- IServer server = (IServer) target;
-
- String[] typeIds = ServerPlugin.tokenize(value, ",");
- return supportsServerType(server.getServerType().getId(), typeIds);
- }
- return false;
- }
-
- /**
- * Returns true if the given server type (given by the id) can use this action.
- *
- * @return boolean
- */
- protected static boolean supportsServerType(String id, String[] typeIds) {
- if (id == null || id.length() == 0)
- return false;
-
- if (typeIds == null)
- return false;
-
- int size = typeIds.length;
- for (int i = 0; i < size; i++) {
- if (typeIds[i].endsWith("*")) {
- if (id.length() >= typeIds[i].length() && id.startsWith(typeIds[i].substring(0, typeIds[i].length() - 1)))
- return true;
- } else if (id.equals(typeIds[i]))
- return true;
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPlugin.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPlugin.java
deleted file mode 100644
index 1176058ca..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPlugin.java
+++ /dev/null
@@ -1,756 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- **********************************************************************/
-package org.eclipse.wst.server.ui.internal;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.*;
-import org.eclipse.wst.server.core.util.PublishAdapter;
-import org.eclipse.wst.server.ui.ServerUIUtil;
-import org.eclipse.wst.server.ui.internal.actions.RunOnServerActionDelegate;
-import org.eclipse.wst.server.ui.internal.editor.IServerEditorInput;
-import org.eclipse.wst.server.ui.internal.editor.ServerEditorCore;
-import org.eclipse.wst.server.ui.internal.editor.ServerEditorInput;
-import org.eclipse.wst.server.ui.internal.viewers.InitialSelectionProvider;
-import org.eclipse.wst.server.ui.internal.wizard.ClosableWizardDialog;
-import org.eclipse.wst.server.ui.internal.wizard.TaskWizard;
-import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.NewRuntimeWizardFragment;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
-import org.osgi.framework.BundleContext;
-/**
- * The server UI plugin class.
- */
-public class ServerUIPlugin extends AbstractUIPlugin {
- protected static final String VIEW_ID = "org.eclipse.wst.server.ui.ServersView";
-
- // server UI plugin id
- public static final String PLUGIN_ID = "org.eclipse.wst.server.ui";
-
- protected static final String EXTENSION_SERVER_IMAGES = "serverImages";
- private static final String EXTENSION_WIZARD_FRAGMENTS = "wizardFragments";
- public static final String EXTENSION_EDITOR_PAGES = "editorPages";
- public static final String EXTENSION_EDITOR_PAGE_SECTIONS = "editorPageSections";
-
- //public static final byte START = 0;
- public static final byte STOP = 1;
- //public static final byte RESTART = 2;
-
- // singleton instance of this class
- private static ServerUIPlugin singleton;
-
- protected Map imageDescriptors = new HashMap();
-
- // cached copy of all runtime wizards
- private static Map wizardFragments;
-
- // cached initial selection provider
- private static InitialSelectionProvider selectionProvider;
-
- private static IRegistryChangeListener registryListener;
-
- private static class RegistryChangeListener implements IRegistryChangeListener {
- public void registryChanged(IRegistryChangeEvent event) {
- IExtensionDelta[] deltas = event.getExtensionDeltas(ServerUIPlugin.PLUGIN_ID, EXTENSION_WIZARD_FRAGMENTS);
- if (deltas != null) {
- for (int i = 0; i < deltas.length; i++) {
- handleWizardFragmentDelta(deltas[i]);
- }
- }
-
- deltas = event.getExtensionDeltas(ServerUIPlugin.PLUGIN_ID, EXTENSION_SERVER_IMAGES);
- if (deltas != null) {
- for (int i = 0; i < deltas.length; i++) {
- ImageResource.handleServerImageDelta(deltas[i]);
- }
- }
-
- deltas = event.getExtensionDeltas(ServerUIPlugin.PLUGIN_ID, EXTENSION_EDITOR_PAGES);
- if (deltas != null) {
- for (int i = 0; i < deltas.length; i++) {
- ServerEditorCore.handleEditorPageFactoriesDelta(deltas[i]);
- }
- }
-
- deltas = event.getExtensionDeltas(ServerUIPlugin.PLUGIN_ID, EXTENSION_EDITOR_PAGE_SECTIONS);
- if (deltas != null) {
- for (int i = 0; i < deltas.length; i++) {
- ServerEditorCore.handleEditorPageSectionFactoriesDelta(deltas[i]);
- }
- }
- }
- }
-
- static class WizardFragmentData {
- String id;
- IConfigurationElement ce;
- WizardFragment fragment;
-
- public WizardFragmentData(String id, IConfigurationElement ce) {
- this.id = id;
- this.ce = ce;
- }
- }
-
- protected static List terminationWatches = new ArrayList();
-
- protected IServerLifecycleListener serverLifecycleListener = new IServerLifecycleListener() {
- public void serverAdded(IServer server) {
- server.addServerListener(serverListener);
- ((Server) server).addPublishListener(publishListener);
- }
-
- public void serverChanged(IServer server) {
- // ignore
- }
-
- public void serverRemoved(IServer server) {
- server.removeServerListener(serverListener);
- ((Server) server).removePublishListener(publishListener);
- }
- };
-
- protected static IServerListener serverListener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- // if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
- showServersView(true);
- } else if ((eventKind & ServerEvent.SERVER_CHANGE) != 0) {
- showServersView(false);
- }
- }
- };
-
- protected static IPublishListener publishListener = new PublishAdapter() {
- public void publishStarted(IServer server) {
- showServersView(false);
- }
-
- public void publishFinished(IServer server, IStatus status) {
- showServersView(false);
- }
- };
-
- /**
- * Create the ServerUIPlugin.
- */
- public ServerUIPlugin() {
- super();
- singleton = this;
- }
-
- /**
- * Returns the singleton instance of this plugin.
- *
- * @return org.eclipse.wst.server.ui.internal.plugin.ServerUIPlugin
- */
- public static ServerUIPlugin getInstance() {
- return singleton;
- }
-
- /**
- * Convenience method for logging.
- *
- * @param status org.eclipse.core.runtime.IStatus
- */
- public static void log(IStatus status) {
- getInstance().getLog().log(status);
- }
-
- /**
- * Return the UI preferences.
- *
- * @return ServerUIPreferences
- */
- public static ServerUIPreferences getPreferences() {
- return new ServerUIPreferences();
- }
-
- /**
- * @see Plugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- Trace.trace(Trace.CONFIG, "----->----- Server UI plugin start ----->-----");
- super.start(context);
-
- ServerUIPreferences prefs = getPreferences();
- prefs.setDefaults();
-
- ServerCore.addServerLifecycleListener(serverLifecycleListener);
-
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- servers[i].addServerListener(serverListener);
- ((Server) servers[i]).addPublishListener(publishListener);
- }
- }
- }
-
- /**
- * @see Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- Trace.trace(Trace.CONFIG, "-----<----- Server UI plugin stop -----<-----");
- super.stop(context);
-
- if (registryListener != null) {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- registry.removeRegistryChangeListener(registryListener);
- }
-
- ImageResource.dispose();
-
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- servers[i].removeServerListener(serverListener);
- ((Server) servers[i]).removePublishListener(publishListener);
- }
- }
-
- ServerCore.removeServerLifecycleListener(serverLifecycleListener);
- }
-
- /**
- * Adds a watch to this server. If it hasn't stopped in a
- * reasonable amount of time, the user will be prompted to
- * terminate the server.
- *
- * @param shell a shell
- * @param server a server
- * @param mode a debug mode
- */
- public static void addTerminationWatch(final Shell shell, final IServer server, final int mode) {
- if (terminationWatches.contains(server))
- return;
-
- terminationWatches.add(server);
-
- class TerminateThread extends Thread {
- public boolean alive = true;
- public IServerListener listener;
-
- public TerminateThread() {
- super("Server Termination Thread");
- }
-
- public void run() {
- while (alive) {
- ServerType serverType = (ServerType) server.getServerType();
- int delay = serverType.getStartTimeout();
- if (mode == 1)
- delay = serverType.getStopTimeout();
- else if (mode == 2)
- delay += serverType.getStopTimeout();
-
- if (delay < 0)
- return;
-
- try {
- Thread.sleep(delay);
- } catch (InterruptedException e) {
- // ignore
- }
-
- if (server.getServerState() == IServer.STATE_STOPPED)
- alive = false;
-
- if (alive) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- TerminationDialog dialog = new TerminationDialog(shell, server.getName());
- dialog.open();
- if (dialog.getReturnCode() == IDialogConstants.OK_ID) {
- // only try calling terminate once. Also, make sure that it didn't stop while
- // the dialog was open
- if (server.getServerState() != IServer.STATE_STOPPED)
- server.stop(true);
- alive = false;
- }
- }
- });
- }
- if (!alive) {
- if (listener != null)
- server.removeServerListener(listener);
- terminationWatches.remove(server);
- }
- }
- }
- }
-
- final TerminateThread t = new TerminateThread();
- t.setDaemon(true);
- t.setPriority(Thread.NORM_PRIORITY - 2);
-
- // add listener to stop the thread if/when the server stops
- IServerListener listener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server2 = event.getServer();
- if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- if (server2.getServerState() == IServer.STATE_STOPPED && t != null)
- t.alive = false;
- }
- }
- };
- t.listener = listener;
- server.addServerListener(listener);
-
- t.start();
- }
-
- /**
- * Returns the server that came from the given file, or <code>null</code>
- * if none. This convenience method searches the list of known
- * servers ({@link ServerCore#getServers()}) for the one with a matching
- * location ({@link Server#getFile()}). The file may not be null.
- *
- * @param file a server file
- * @return the server instance, or <code>null</code> if
- * there is no server associated with the given file
- */
- public static IServer findServer(IFile file) {
- if (file == null)
- throw new IllegalArgumentException();
-
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (file.equals(((Server)servers[i]).getFile()))
- return servers[i];
- }
- }
- return null;
- }
-
- /**
- * Returns an array of all known runtime instances of
- * the given runtime type. This convenience method filters the list of known
- * runtime ({@link ServerCore#getRuntimes()}) for ones with a matching
- * runtime type ({@link IRuntime#getRuntimeType()}). The array will not
- * contain any working copies.
- * <p>
- * A new array is returned on each call, so clients may store or modify the result.
- * </p>
- *
- * @param runtimeType the runtime type
- * @return a possibly-empty list of runtime instances {@link IRuntime}
- * of the given runtime type
- */
- public static IRuntime[] getRuntimes(IRuntimeType runtimeType) {
- List list = new ArrayList();
- IRuntime[] runtimes = ServerCore.getRuntimes();
- if (runtimes != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].getRuntimeType() != null && runtimes[i].getRuntimeType().equals(runtimeType))
- list.add(runtimes[i]);
- }
- }
-
- IRuntime[] r = new IRuntime[list.size()];
- list.toArray(r);
- return r;
- }
-
- /**
- * Open the given server with the server editor.
- *
- * @param server
- */
- public static void editServer(IServer server) {
- if (server == null)
- return;
-
- editServer(server.getId());
- }
-
- /**
- * Open the given server id with the server editor.
- *
- * @param serverId
- */
- protected static void editServer(String serverId) {
- if (serverId == null)
- return;
-
- IWorkbenchWindow workbenchWindow = ServerUIPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage page = workbenchWindow.getActivePage();
-
- try {
- IServerEditorInput input = new ServerEditorInput(serverId);
- page.openEditor(input, IServerEditorInput.EDITOR_ID);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error opening server editor", e);
- }
- }
-
- /**
- * Use the preference to prompt the user to save dirty editors, if applicable.
- *
- * @return boolean - Returns false if the user cancelled the operation
- */
- public static boolean saveEditors() {
- byte b = ServerUIPlugin.getPreferences().getSaveEditors();
- if (b == ServerUIPreferences.SAVE_EDITORS_NEVER)
- return true;
- return ServerUIPlugin.getInstance().getWorkbench().saveAllEditors(b == ServerUIPreferences.SAVE_EDITORS_PROMPT);
- }
-
- /**
- * Prompts the user if the server is dirty. Returns true if the server was
- * not dirty or if the user decided to continue anyway. Returns false if
- * the server is dirty and the user chose to cancel the operation.
- *
- * @param shell a shell
- * @param server a server
- * @return boolean
- */
- public static boolean promptIfDirty(Shell shell, IServer server) {
- if (server == null)
- return false;
-
- if (!(server instanceof IServerWorkingCopy))
- return true;
-
- String title = Messages.resourceDirtyDialogTitle;
-
- IServerWorkingCopy wc = (IServerWorkingCopy) server;
- if (wc.isDirty()) {
- String message = NLS.bind(Messages.resourceDirtyDialogMessage, server.getName());
- String[] labels = new String[] {Messages.resourceDirtyDialogContinue, IDialogConstants.CANCEL_LABEL};
- MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.INFORMATION, labels, 0);
-
- if (dialog.open() != 0)
- return false;
- }
-
- return true;
- }
-
- /**
- * Show the Servers view. The Servers is never given focus.
- *
- * @param bringToFront <code>true</code> to make the Servers view push to the top
- * of the z-order, and <code>false</code> to just highlight it
- */
- protected static void showServersView(final boolean bringToFront) {
- if (!getPreferences().getShowOnActivity())
- return;
-
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- try {
- IWorkbench workbench = ServerUIPlugin.getInstance().getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
-
- IWorkbenchPage page = workbenchWindow.getActivePage();
-
- IViewPart view2 = page.findView(VIEW_ID);
-
- if (view2 != null) {
- if (bringToFront)
- page.bringToTop(view2);
- else {
- IWorkbenchSiteProgressService wsps = (IWorkbenchSiteProgressService)
- view2.getSite().getAdapter(IWorkbenchSiteProgressService.class);
- wsps.warnOfContentChange();
- }
- } else
- page.showView(VIEW_ID);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error opening TCP/IP view", e);
- }
- }
- });
- }
-
- /**
- * Returns true if the given server is already started in the given
- * mode, or could be (re)started in the start mode.
- *
- * @param server
- * @param launchMode
- * @return boolean
- */
- public static boolean isCompatibleWithLaunchMode(IServer server, String launchMode) {
- if (server == null || launchMode == null)
- return false;
-
- int state = server.getServerState();
- if (state == IServer.STATE_STARTED && launchMode.equals(server.getMode()))
- return true;
-
- if (server.getServerType().supportsLaunchMode(launchMode))
- return true;
- return false;
- }
-
- /**
- * Open the new runtime wizard.
- *
- * @param shell
- * @param type
- * @param version
- * @param runtimeTypeId
- * @return true if a new runtime was created
- */
- public static boolean showNewRuntimeWizard(Shell shell, final String type, final String version, final String runtimeTypeId) {
- WizardFragment fragment = new WizardFragment() {
- protected void createChildFragments(List list) {
- list.add(new NewRuntimeWizardFragment(type, version, runtimeTypeId));
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveRuntime(getTaskModel(), monitor);
- }
- });
- }
- };
- TaskWizard wizard = new TaskWizard(Messages.wizNewRuntimeWizardTitle, fragment);
- wizard.setForcePreviousAndNextButtons(true);
- ClosableWizardDialog dialog = new ClosableWizardDialog(shell, wizard);
- return (dialog.open() == IDialogConstants.OK_ID);
- }
-
- /**
- * Open the new runtime wizard.
- *
- * @param shell
- * @param runtimeTypeId
- * @return true if a new runtime was created
- */
- public static boolean showNewRuntimeWizard(Shell shell, final String runtimeTypeId) {
- IRuntimeType runtimeType = null;
- if (runtimeTypeId != null)
- runtimeType = ServerCore.findRuntimeType(runtimeTypeId);
- if (runtimeType != null) {
- try {
- final IRuntimeWorkingCopy runtime = runtimeType.createRuntime(null, null);
- TaskModel taskModel = new TaskModel();
- taskModel.putObject(TaskModel.TASK_RUNTIME, runtime);
-
- WizardFragment fragment = new WizardFragment() {
- protected void createChildFragments(List list) {
- list.add(getWizardFragment(runtimeTypeId));
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveRuntime(getTaskModel(), monitor);
- }
- });
- }
- };
- TaskWizard wizard = new TaskWizard(Messages.wizNewRuntimeWizardTitle, fragment, taskModel);
- wizard.setForcePreviousAndNextButtons(true);
- ClosableWizardDialog dialog = new ClosableWizardDialog(shell, wizard);
- return (dialog.open() == IDialogConstants.OK_ID);
- } catch (Exception e) {
- return false;
- }
- }
- return showNewRuntimeWizard(shell, null, null, runtimeTypeId);
- }
-
- /**
- * Open the new runtime wizard.
- * @param shell
- * @return true if a new runtime was created
- */
- public static boolean showNewRuntimeWizard(Shell shell) {
- return ServerUIUtil.showNewRuntimeWizard(shell, null, null);
- }
-
- /**
- * Returns the wizard fragment with the given id.
- *
- * @param typeId the server or runtime type id
- * @return a wizard fragment, or <code>null</code> if none could be found
- */
- public static WizardFragment getWizardFragment(String typeId) {
- if (typeId == null)
- return null;
-
- if (wizardFragments == null)
- loadWizardFragments();
-
- Iterator iterator = wizardFragments.keySet().iterator();
- while (iterator.hasNext()) {
- String key = (String) iterator.next();
- if (typeId.equals(key)) {
- WizardFragmentData data = (WizardFragmentData) wizardFragments.get(key);
- return getWizardFragment(data);
- }
- }
- return null;
- }
-
- /**
- * Load the wizard fragments.
- */
- private static synchronized void loadWizardFragments() {
- if (wizardFragments != null)
- return;
- Trace.trace(Trace.CONFIG, "->- Loading .wizardFragments extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, EXTENSION_WIZARD_FRAGMENTS);
-
- wizardFragments = new HashMap(cf.length);
- loadWizardFragments(cf);
- addRegistryListener();
-
- Trace.trace(Trace.CONFIG, "-<- Done loading .wizardFragments extension point -<-");
- }
-
- /**
- * Load wizard fragments.
- */
- private static synchronized void loadWizardFragments(IConfigurationElement[] cf) {
- for (int i = 0; i < cf.length; i++) {
- try {
- String id = cf[i].getAttribute("typeIds");
- wizardFragments.put(id, new WizardFragmentData(id, cf[i]));
- Trace.trace(Trace.CONFIG, " Loaded wizardFragment: " + id);
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load wizardFragment: " + cf[i].getAttribute("id"), t);
- }
- }
- }
-
- /**
- * Returns the initial selection provider.
- *
- * @return an initial selection provider, or <code>null</code> if none could be found
- */
- public static InitialSelectionProvider getInitialSelectionProvider() {
- if (selectionProvider == null)
- loadInitialSelectionProvider();
-
- return selectionProvider;
- }
-
- /**
- * Load the initial selection provider.
- */
- private static synchronized void loadInitialSelectionProvider() {
- if (selectionProvider != null)
- return;
-
- Trace.trace(Trace.CONFIG, "->- Loading .initialSelectionProvider extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, "initialSelectionProvider");
-
- if (cf.length == 1) {
- try {
- selectionProvider = (InitialSelectionProvider) cf[0].createExecutableExtension("class");
- Trace.trace(Trace.CONFIG, " Loaded initialSelectionProvider: " + cf[0].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load initialSelectionProvider: " + cf[0].getAttribute("id"), t);
- }
- } else if (cf.length > 1)
- Trace.trace(Trace.WARNING, "More that one initial selection provider found - ignoring");
- else
- Trace.trace(Trace.CONFIG, "No initial selection provider found");
-
- if (selectionProvider == null)
- selectionProvider = new InitialSelectionProvider();
-
- Trace.trace(Trace.CONFIG, "-<- Done loading .initialSelectionProvider extension point -<-");
- }
-
- protected static WizardFragment getWizardFragment(WizardFragmentData fragment) {
- if (fragment == null)
- return null;
-
- if (fragment.fragment == null) {
- try {
- fragment.fragment = (WizardFragment) fragment.ce.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create wizardFragment: " + fragment.ce.getAttribute("id"), t);
- }
- }
- return fragment.fragment;
- }
-
- public static void runOnServer(Object object, String launchMode) {
- RunOnServerActionDelegate delegate = new RunOnServerActionDelegate();
- Action action = new Action() {
- // dummy action
- };
- if (object != null) {
- StructuredSelection sel = new StructuredSelection(object);
- delegate.selectionChanged(action, sel);
- } else
- delegate.selectionChanged(action, null);
-
- delegate.run(action);
- }
-
- public static synchronized void addRegistryListener() {
- if (registryListener != null)
- return;
-
- registryListener = new RegistryChangeListener();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- registry.addRegistryChangeListener(registryListener, ServerUIPlugin.PLUGIN_ID);
- }
-
- protected static void handleWizardFragmentDelta(IExtensionDelta delta) {
- if (wizardFragments == null) // not loaded yet
- return;
-
- IConfigurationElement[] cf = delta.getExtension().getConfigurationElements();
-
- if (delta.getKind() == IExtensionDelta.ADDED) {
- loadWizardFragments(cf);
- } else {
- /*int size = wizardFragments.size();
- WizardFragment[] wf = new WizardFragment[size];
- wizardFragments.toArray(wf);
- int size2 = cf.length;
-
- for (int i = 0; i < size; i++) {
- for (int j = 0; j < size2; j++) {
- if (wf[i].getId().equals(cf[j].getAttribute("id"))) {
- wf[i].dispose();
- wizardFragments.remove(wf[i]);
- }
- }
- }*/
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPreferences.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPreferences.java
deleted file mode 100644
index e70ca7b02..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/ServerUIPreferences.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.Preferences;
-/**
- * Helper class that stores preference information for
- * the server tools.
- */
-public class ServerUIPreferences {
- private static final String PREF_PROMPT_IRREVERSIBLE = "prompt-irreversible";
- private static final String PREF_IMPORT_LOCATION = "import-location";
- private static final String PREF_SAVE_EDITORS = "save-editors";
- private static final String PREF_HOST_NAMES = "host-names";
- private static final String PREF_SHOW_ON_ACTIVITY = "show-on-activity";
-
- public static final byte SAVE_EDITORS_NEVER = 0;
- public static final byte SAVE_EDITORS_PROMPT = 1;
- public static final byte SAVE_EDITORS_AUTO = 2;
-
- private static final int MAX_HOSTNAMES = 10;
-
- private Preferences preferences;
-
- /**
- * ServerUIPreference constructor comment.
- */
- public ServerUIPreferences() {
- super();
- preferences = ServerUIPlugin.getInstance().getPluginPreferences();
- }
-
- public void setDefaults() {
- preferences.setDefault(PREF_PROMPT_IRREVERSIBLE, getDefaultPromptBeforeIrreversibleChange());
- preferences.setDefault(PREF_SAVE_EDITORS, getDefaultSaveEditors());
- preferences.setDefault(PREF_HOST_NAMES, "localhost");
- preferences.setDefault(PREF_SHOW_ON_ACTIVITY, true);
- }
-
- /**
- * Returns whether the user should be prompted before making an
- * irreversible change in the editor.
- *
- * @return boolean
- */
- public boolean getPromptBeforeIrreversibleChange() {
- return preferences.getBoolean(PREF_PROMPT_IRREVERSIBLE);
- }
-
- /**
- * Returns the default value of whether the user should be prompted
- * before making an irreversible change in the editor.
- *
- * @return boolean
- */
- public boolean getDefaultPromptBeforeIrreversibleChange() {
- return true;
- }
-
- /**
- * Sets whether the user should be prompted before making an
- * irreversible change in the editor.
- *
- * @param b true to prompt before irreversible changes
- */
- public void setPromptBeforeIrreversibleChange(boolean b) {
- preferences.setValue(PREF_PROMPT_IRREVERSIBLE, b);
- ServerUIPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Returns the import location.
- *
- * @return java.lang.String
- */
- public String getImportLocation() {
- return preferences.getString(PREF_IMPORT_LOCATION);
- }
-
- /**
- * Sets the import location.
- *
- * @param s the import location
- */
- public void setImportLocation(String s) {
- preferences.setValue(PREF_IMPORT_LOCATION, s);
- ServerUIPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Returns the default setting for saving editors before launching.
- *
- * @return byte
- */
- public byte getDefaultSaveEditors() {
- return SAVE_EDITORS_PROMPT;
- }
-
- /**
- * Returns the setting for saving editors before launching.
- *
- * @return byte
- */
- public byte getSaveEditors() {
- return (byte) preferences.getInt(PREF_SAVE_EDITORS);
- }
-
- /**
- * Sets the value for saving editors before launching.
- *
- * @param b
- */
- public void setSaveEditors(byte b) {
- preferences.setValue(PREF_SAVE_EDITORS, b);
- ServerUIPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Returns the default setting for opening the servers view on activity.
- *
- * @return boolean
- */
- public boolean getDefaultShowOnActivity() {
- return true;
- }
-
- /**
- * Returns the setting for opening the servers view on activity.
- *
- * @return boolean
- */
- public boolean getShowOnActivity() {
- return preferences.getBoolean(PREF_SHOW_ON_ACTIVITY);
- }
-
- /**
- * Sets the value for opening the servers view on activity.
- *
- * @param b
- */
- public void setShowOnActivity(boolean b) {
- preferences.setValue(PREF_SHOW_ON_ACTIVITY, b);
- ServerUIPlugin.getInstance().savePluginPreferences();
- }
-
- /**
- * Return the list of most recently used hostnames.
- *
- * @return the hostnames
- */
- public List getHostnames() {
- String s = preferences.getString(PREF_HOST_NAMES);
- StringTokenizer st = new StringTokenizer(s, "|*|");
- List list = new ArrayList();
- while (st.hasMoreTokens()) {
- list.add(st.nextToken());
- }
- return list;
- }
-
- /**
- * Add a new hostname to the most recently used list.
- *
- * @param hostname
- */
- public void addHostname(String hostname) {
- if ("localhost".equals(hostname))
- return;
-
- List list = getHostnames();
-
- // remove duplicates
- if (list.contains(hostname))
- list.remove(hostname);
-
- // always add second (leave localhost first)
- list.add(1, hostname);
-
- // remove least used hostname
- if (list.size() > MAX_HOSTNAMES)
- list.remove(list.size() - 1);
-
- StringBuffer sb = new StringBuffer();
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- String s = (String) iterator.next();
- sb.append(s);
- sb.append("|*|");
- }
- preferences.setValue(PREF_HOST_NAMES, sb.toString());
- ServerUIPlugin.getInstance().savePluginPreferences();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Startup.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Startup.java
deleted file mode 100644
index 066ada67e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Startup.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.IStartup;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.util.PublishAdapter;
-import org.eclipse.wst.server.ui.internal.audio.Audio;
-/**
- *
- */
-public class Startup implements IStartup {
- /**
- * @see org.eclipse.wst.server.core.internal.IStartup#startup()
- */
- public void startup() {
- Trace.trace(Trace.FINEST, "Audio startup");
-
- final IPublishListener publishListener = new PublishAdapter() {
- public void publishFinished(IServer server, IStatus status) {
- Audio.playSound("org.eclipse.wst.server.sound.publishFinished");
- }
- };
-
- final IServerListener serverListener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if (eventKind == (ServerEvent.SERVER_CHANGE | ServerEvent.STATE_CHANGE)) {
- int state = server.getServerState();
- if (state == IServer.STATE_STARTED)
- Audio.playSound("org.eclipse.wst.server.sound.serverStart");
- else if (state == IServer.STATE_STOPPED)
- Audio.playSound("org.eclipse.wst.server.sound.serverStop");
- }
- }
- };
-
- IServerLifecycleListener listener = new IServerLifecycleListener() {
- public void serverAdded(IServer server) {
- server.addServerListener(serverListener);
- ((Server) server).addPublishListener(publishListener);
- }
-
- public void serverChanged(IServer server) {
- // do nothing
- }
-
- public void serverRemoved(IServer server) {
- server.removeServerListener(serverListener);
- ((Server) server).removePublishListener(publishListener);
- }
- };
- ServerCore.addServerLifecycleListener(listener);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/TerminationDialog.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/TerminationDialog.java
deleted file mode 100644
index a14eb7784..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/TerminationDialog.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.osgi.util.NLS;
-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.PlatformUI;
-/**
- * Dialog that prompts a user to see if a server should
- * be terminated.
- */
-public class TerminationDialog extends Dialog {
- protected String serverName;
-
- /**
- * TerminationDialog constructor comment.
- *
- * @param parentShell a shell
- * @param serverName a server name
- */
- public TerminationDialog(Shell parentShell, String serverName) {
- super(parentShell);
- this.serverName = serverName;
- setBlockOnOpen(true);
- }
-
- /**
- *
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Messages.terminateServerDialogTitle);
- }
-
- /**
- * Creates and returns the contents of the upper part
- * of this dialog (above the button bar).
- *
- * @param parent the parent composite to contain the dialog area
- * @return the dialog area control
- */
- protected Control createDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.TERMINATE_SERVER_DIALOG);
-
- Label label = new Label(composite, SWT.WRAP);
- label.setText(NLS.bind(Messages.terminateServerDialogMessage, new String[] {serverName}));
- GridData data = new GridData();
- data.widthHint = 400;
- label.setLayoutData(data);
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Trace.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Trace.java
deleted file mode 100644
index 6b886c62d..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/Trace.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-/**
- * Helper class to route trace output.
- */
-public class Trace {
- public static byte CONFIG = 0;
- public static byte INFO = 1;
- public static byte WARNING = 2;
- public static byte SEVERE = 3;
- public static byte FINEST = 4;
- public static byte FINER = 5;
- public static byte PERFORMANCE = 6;
- public static byte EXTENSION_POINT = 7;
-
- protected static int pluginLength = -1;
-
- private static final String[] levelNames = new String[] {
- "CONFIG ", "INFO ", "WARNING", "SEVERE ", "FINER ", "FINEST ", "PERF ", "EXTENSION"};
- private static final String spacer = " ";
-
- private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm.ss.SSS");
-
- /**
- * Trace constructor comment.
- */
- private Trace() {
- super();
- }
-
- /**
- * Trace the given text.
- *
- * @param level a trace level
- * @param s a message
- */
- public static void trace(byte level, String s) {
- trace(level, s, null);
- }
-
- /**
- * Trace the given message and exception.
- *
- * @param level a trace level
- * @param s a message
- * @param t a throwable
- */
- public static void trace(byte level, String s, Throwable t) {
- if (!ServerUIPlugin.getInstance().isDebugging())
- return;
-
- String pluginId = ServerUIPlugin.PLUGIN_ID;
- StringBuffer sb = new StringBuffer(pluginId);
- if (pluginId.length() > pluginLength)
- pluginLength = pluginId.length();
- else if (pluginId.length() < pluginLength)
- sb.append(spacer.substring(0, pluginLength - pluginId.length()));
- sb.append(" ");
- sb.append(levelNames[level]);
- sb.append(" ");
- sb.append(sdf.format(new Date()));
- sb.append(" ");
- sb.append(s);
- System.out.println(sb.toString());
- if (t != null)
- t.printStackTrace();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/WebLaunchableClient.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/WebLaunchableClient.java
deleted file mode 100644
index fb694d0a5..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/WebLaunchableClient.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.ui.browser.IWebBrowser;
-import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.model.ClientDelegate;
-import org.eclipse.wst.server.core.util.HttpLaunchable;
-/**
- *
- */
-public class WebLaunchableClient extends ClientDelegate {
- /*
- * @see ClientDelegate#supports(ILaunchable)
- */
- public boolean supports(IServer server, Object launchable, String launchMode) {
- return (launchable instanceof HttpLaunchable);
- }
-
- /*
- * @see ClientDelegate#launch(ILaunchable)
- */
- public IStatus launch(IServer server, Object launchable, String launchMode, ILaunch launch) {
- HttpLaunchable http = (HttpLaunchable) launchable;
- try {
- IWorkbenchBrowserSupport browserSupport = ServerUIPlugin.getInstance().getWorkbench().getBrowserSupport();
- IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null);
- browser.openURL(http.getURL());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error opening browser", e);
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AbstractServerActionDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AbstractServerActionDelegate.java
deleted file mode 100644
index 518823fd8..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/AbstractServerActionDelegate.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.EclipseUtil;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
-/**
- *
- */
-public abstract class AbstractServerActionDelegate implements IActionDelegate {
- protected List servers;
-
- /**
- * Return true if this server can currently be acted on.
- *
- * @return boolean
- * @param server org.eclipse.wst.server.core.IServer
- */
- public abstract boolean accept(IServer server);
-
- /**
- * Perform action on this server.
- *
- * @param shell a shell
- * @param server a server
- */
- public abstract void perform(Shell shell, IServer server);
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- Shell shell = EclipseUtil.getShell();
- Iterator iterator = servers.iterator();
- Object obj = iterator.next();
- if (obj instanceof IServer) {
- IServer server = (IServer) obj;
- if (accept(server))
- perform(shell, server);
- selectionChanged(action, new StructuredSelection(servers));
- }
- }
-
- /* (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) {
- servers = new ArrayList();
- if (selection.isEmpty() || !(selection instanceof StructuredSelection)) {
- action.setEnabled(false);
- return;
- }
-
- boolean enabled = false;
- Iterator iterator = ((StructuredSelection) selection).iterator();
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof IServer) {
- IServer server = (IServer) obj;
- if (accept(server)) {
- servers.add(server);
- enabled = true;
- }
- } else {
- action.setEnabled(false);
- return;
- }
- }
- action.setEnabled(enabled);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DebugOnServerAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DebugOnServerAction.java
deleted file mode 100644
index a5adc30a4..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DebugOnServerAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * "Debug on Server" menu action. Allows the user to select an
- * object, and have automatic server creation, launching, and
- * the appropriate client to appear. A new instance of this
- * action must be created for each object that the user selects.
- */
-public class DebugOnServerAction extends Action {
- protected DebugOnServerActionDelegate delegate;
-
- /**
- * DebugOnServerAction constructor comment.
- *
- * @param object the object to attempt to debug
- */
- public DebugOnServerAction(Object object) {
- super(Messages.actionDebugOnServer);
-
- setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DTOOL_DEBUG_ON_SERVER));
- setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CTOOL_DEBUG_ON_SERVER));
- setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ETOOL_DEBUG_ON_SERVER));
-
- delegate = new DebugOnServerActionDelegate();
- if (object != null) {
- StructuredSelection sel = new StructuredSelection(object);
- delegate.selectionChanged(this, sel);
- } else
- delegate.selectionChanged(this, null);
- }
-
- /**
- * Implementation of method defined on <code>IAction</code>.
- */
- public void run() {
- delegate.run(this);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DebugOnServerActionDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DebugOnServerActionDelegate.java
deleted file mode 100644
index d811e87b7..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DebugOnServerActionDelegate.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import org.eclipse.debug.core.ILaunchManager;
-/**
- *
- */
-public class DebugOnServerActionDelegate extends RunOnServerActionDelegate {
- /**
- * Returns the start mode that the server should use.
- */
- protected String getLaunchMode() {
- return ILaunchManager.DEBUG_MODE;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DeleteActionDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DeleteActionDelegate.java
deleted file mode 100644
index 083596603..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/DeleteActionDelegate.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.view.servers.DeleteAction;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-/**
- *
- */
-public class DeleteActionDelegate implements IWorkbenchWindowActionDelegate {
- protected IServer[] servers;
- protected Shell shell;
-
- /**
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- if (window != null)
- shell = window.getShell();
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- if (action != null && action.isEnabled() && servers != null)
- return;
- DeleteAction delete = new DeleteAction(shell, servers);
- delete.run();
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- servers = null;
- if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection)) {
- action.setEnabled(false);
- return;
- }
-
- IStructuredSelection select = (IStructuredSelection) selection;
- Iterator iterator = select.iterator();
-
- List list = new ArrayList();
-
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof IServer)
- list.add(obj);
- else {
- action.setEnabled(false);
- return;
- }
- }
-
- servers = new IServer[list.size()];
- list.toArray(servers);
- action.setEnabled(true);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/LaunchWizardAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/LaunchWizardAction.java
deleted file mode 100644
index a1ee767d8..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/LaunchWizardAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWizard;
-import org.eclipse.ui.PlatformUI;
-/**
- * An abstract action that opens up a workbench wizard when run.
- */
-abstract class LaunchWizardAction extends Action {
- /**
- * LaunchWizardAction
- */
- public LaunchWizardAction() {
- super();
- }
-
- /**
- * Return the workbench wizard that should be opened.
- *
- * @return the wizard to open
- */
- protected abstract IWorkbenchWizard getWizard();
-
- /*
- * @see IAction.run()
- */
- public void run() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- ISelection selection = workbenchWindow.getSelectionService().getSelection();
-
- IStructuredSelection selectionToPass = null;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- else
- selectionToPass = StructuredSelection.EMPTY;
-
- IWorkbenchWizard wizard = getWizard();
- wizard.init(workbench, selectionToPass);
- WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
- dialog.open();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewServerAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewServerAction.java
deleted file mode 100644
index 24a98e259..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewServerAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import org.eclipse.jface.action.IAction;
-
-import org.eclipse.wst.server.ui.internal.wizard.ClosableWizardDialog;
-import org.eclipse.wst.server.ui.internal.wizard.NewServerWizard;
-/**
- * Action to create a new server.
- */
-public class NewServerAction extends NewWizardAction {
- protected String[] ids;
- protected String[] values;
-
- /**
- * Create a new NewServerAction.
- */
- public NewServerAction() {
- super();
- }
-
- /**
- * Create a new NewServerAction with some initial task model
- * properties.
- *
- * @param ids
- * @param values
- */
- public NewServerAction(String[] ids, String[] values) {
- super();
- this.ids = ids;
- this.values = values;
- }
-
- /**
- * Performs this action.
- * <p>
- * This method is called when the delegating action has been triggered.
- * Implement this method to do the actual work.
- * </p>
- *
- * @param action the action proxy that handles the presentation portion of the
- * action
- */
- public void run(IAction action) {
- NewServerWizard wizard = null;
- if (ids == null)
- wizard = new NewServerWizard();
- else
- wizard = new NewServerWizard(ids, values);
- wizard.init(workbench, selection);
- ClosableWizardDialog dialog = new ClosableWizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
- dialog.open();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewServerWizardAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewServerWizardAction.java
deleted file mode 100644
index 0c1a2f6f6..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewServerWizardAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import org.eclipse.ui.IWorkbenchWizard;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.NewServerWizard;
-/**
- * An action to invoke the new server and server configuration wizard.
- */
-public class NewServerWizardAction extends LaunchWizardAction {
- protected String[] ids;
- protected String[] values;
-
- /**
- * New server action.
- */
- public NewServerWizardAction() {
- super();
-
- setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CTOOL_NEW_SERVER));
- setText(Messages.actionSetNewServer);
- }
-
- /**
- * New server action.
- *
- * @param ids ids to pass into the action
- * @param values values to pass into the action
- */
- public NewServerWizardAction(String[] ids, String[] values) {
- this();
- this.ids = ids;
- this.values = values;
- }
-
- /**
- * Return the wizard that should be opened.
- *
- * @return org.eclipse.ui.IWorkbenchWizard
- */
- protected IWorkbenchWizard getWizard() {
- return new NewServerWizard(ids, values);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewWizardAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewWizardAction.java
deleted file mode 100644
index afcf36f32..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/NewWizardAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-/**
- * Action to create a new server element through a wizard.
- */
-public abstract class NewWizardAction implements IWorkbenchWindowActionDelegate {
- protected IWorkbench workbench;
- protected IStructuredSelection selection;
-
- /**
- * NewWizardAction constructor comment.
- */
- public NewWizardAction() {
- super();
- }
-
- /**
- * Disposes this action delegate. The implementor should unhook any references
- * to itself so that garbage collection can occur.
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * Initializes this action delegate with the workbench window it will work in.
- *
- * @param window the window that provides the context for this delegate
- */
- public void init(IWorkbenchWindow window) {
- workbench = window.getWorkbench();
- }
-
- /**
- * Notifies this action delegate that the selection in the workbench has changed.
- * <p>
- * Implementers can use this opportunity to change the availability of the
- * action or to modify other presentation properties.
- * </p>
- *
- * @param action the action proxy that handles presentation portion of the action
- * @param sel the current selection in the workbench
- */
- public void selectionChanged(IAction action, ISelection sel) {
- if (sel instanceof IStructuredSelection)
- selection = (IStructuredSelection) sel;
- else
- selection = null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/ProfileOnServerAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/ProfileOnServerAction.java
deleted file mode 100644
index 6f4d2038e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/ProfileOnServerAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * "Profile on Server" menu action. Allows the user to select an
- * object, and have automatic server creation, launching, and
- * the appropriate client to appear. A new instance of this
- * action must be created for each object that the user selects.
- */
-public class ProfileOnServerAction extends Action {
- protected ProfileOnServerActionDelegate delegate;
-
- /**
- * Profile an object on server.
- *
- * @param object the object to attempt to debug
- */
- public ProfileOnServerAction(Object object) {
- super(Messages.actionProfileOnServer);
-
- setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DTOOL_PROFILE_ON_SERVER));
- setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CTOOL_PROFILE_ON_SERVER));
- setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ETOOL_PROFILE_ON_SERVER));
-
- delegate = new ProfileOnServerActionDelegate();
- if (object != null) {
- StructuredSelection sel = new StructuredSelection(object);
- delegate.selectionChanged(this, sel);
- } else
- delegate.selectionChanged(this, null);
- }
-
- /**
- * Implementation of method defined on <code>IAction</code>.
- */
- public void run() {
- delegate.run(this);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/ProfileOnServerActionDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/ProfileOnServerActionDelegate.java
deleted file mode 100644
index 129a0aed6..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/ProfileOnServerActionDelegate.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import org.eclipse.debug.core.ILaunchManager;
-/**
- *
- */
-public class ProfileOnServerActionDelegate extends RunOnServerActionDelegate {
- /**
- * Returns the start mode that the server should use.
- */
- protected String getLaunchMode() {
- return ILaunchManager.PROFILE_MODE;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerAction.java
deleted file mode 100644
index 67642d326..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * "Run on Server" menu action. Allows the user to select an
- * object, and have automatic server creation, launching, and
- * the appropriate client to appear. A new instance of this
- * action must be created for each object that the user selects.
- */
-public class RunOnServerAction extends Action {
- protected RunOnServerActionDelegate delegate;
-
- /**
- * Run on server action.
- *
- * @param object the object to attempt to debug
- */
- public RunOnServerAction(Object object) {
- super(Messages.actionRunOnServer);
-
- setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DTOOL_RUN_ON_SERVER));
- setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CTOOL_RUN_ON_SERVER));
- setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ETOOL_RUN_ON_SERVER));
-
- delegate = new RunOnServerActionDelegate();
- if (object != null) {
- StructuredSelection sel = new StructuredSelection(object);
- delegate.selectionChanged(this, sel);
- } else
- delegate.selectionChanged(this, null);
- }
-
- /**
- * Implementation of method defined on <code>IAction</code>.
- */
- public void run() {
- delegate.run(this);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
deleted file mode 100644
index ba23e7a69..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/actions/RunOnServerActionDelegate.java
+++ /dev/null
@@ -1,504 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.actions;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.IClient;
-import org.eclipse.wst.server.core.internal.ILaunchableAdapter;
-import org.eclipse.wst.server.core.internal.PublishServerJob;
-import org.eclipse.wst.server.core.internal.RestartServerJob;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.internal.ServerType;
-import org.eclipse.wst.server.core.internal.StartServerJob;
-import org.eclipse.wst.server.ui.internal.*;
-import org.eclipse.wst.server.ui.internal.wizard.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-/**
- * Support for starting/stopping server and clients for resources running on a server.
- */
-public class RunOnServerActionDelegate implements IWorkbenchWindowActionDelegate {
- protected static final String[] launchModes = {
- ILaunchManager.RUN_MODE, ILaunchManager.DEBUG_MODE, ILaunchManager.PROFILE_MODE };
-
- protected Object selection;
-
- protected IWorkbenchWindow window;
-
- protected static Object globalSelection;
-
- protected static Map globalLaunchMode;
-
- protected boolean tasksRun;
-
- /**
- * RunOnServerActionDelegate constructor comment.
- */
- public RunOnServerActionDelegate() {
- super();
- }
-
- /**
- * Disposes this action delegate. The implementor should unhook any references
- * to itself so that garbage collection can occur.
- */
- public void dispose() {
- window = null;
- }
-
- /**
- * Initializes this action delegate with the workbench window it will work in.
- *
- * @param newWindow the window that provides the context for this delegate
- */
- public void init(IWorkbenchWindow newWindow) {
- window = newWindow;
- }
-
- public IServer getServer(IModule module, String launchMode, IProgressMonitor monitor) {
- IServer server = ServerCore.getDefaultServer(module);
-
- // ignore preference if the server doesn't support this mode.
- if (server != null && !ServerUIPlugin.isCompatibleWithLaunchMode(server, launchMode))
- server = null;
-
- if (server != null && !ServerUtil.containsModule(server, module, monitor)) {
- IServerWorkingCopy wc = server.createWorkingCopy();
- try {
- ServerUtil.modifyModules(wc, new IModule[] { module }, new IModule[0], monitor);
- wc.save(false, monitor);
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Could not add module to server", ce);
- server = null;
- }
- }
-
- Shell shell;
- if (window != null)
- shell = window.getShell();
- else
- shell = ServerUIPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getShell();
-
- if (server == null) {
- // try the full wizard
- RunOnServerWizard wizard = new RunOnServerWizard(module, launchMode);
- ClosableWizardDialog dialog = new ClosableWizardDialog(shell, wizard);
- if (dialog.open() == Window.CANCEL) {
- monitor.setCanceled(true);
- return null;
- }
-
- try {
- Platform.getJobManager().join("org.eclipse.wst.server.ui.family", null);
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error waiting for job", e);
- }
- server = wizard.getServer();
- boolean preferred = wizard.isPreferredServer();
- tasksRun = true;
-
- // set preferred server if requested
- if (server != null && preferred) {
- try {
- ServerCore.setDefaultServer(module, server, monitor);
- } catch (CoreException ce) {
- String message = Messages.errorCouldNotSavePreference;
- ErrorDialog.openError(shell, Messages.errorDialogTitle, message, ce.getStatus());
- }
- }
- }
-
- try {
- Platform.getJobManager().join("org.eclipse.wst.server.ui.family", new NullProgressMonitor());
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error waiting for job", e);
- }
-
- return server;
- }
-
- /**
- * Run the resource on a server.
- *
- * @param monitor org.eclipse.core.runtime.IProgressMonitor
- */
- protected void run(IProgressMonitor monitor) {
- String launchMode = getLaunchMode();
- IModuleArtifact moduleArtifact = ServerPlugin.loadModuleArtifact(selection);
-
- Shell shell;
- if (window != null)
- shell = window.getShell();
- else
- shell = ServerUIPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getShell();
-
- if (moduleArtifact == null || moduleArtifact.getModule() == null) {
- EclipseUtil.openError(Messages.errorNoModules);
- Trace.trace(Trace.FINEST, "No modules");
- return;
- }
- IModule module = moduleArtifact.getModule();
-
- // check for servers with the given start mode
- IServer[] servers = ServerCore.getServers();
- boolean found = false;
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size && !found; i++) {
- if (ServerUIPlugin.isCompatibleWithLaunchMode(servers[i], launchMode)) {
- try {
- IModule[] parents = servers[i].getRootModules(module, monitor);
- if (parents != null && parents.length > 0)
- found = true;
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
-
- if (!found) {
- // no existing server supports the project and start mode!
- // check if there might be another one that can be created
- IServerType[] serverTypes = ServerCore.getServerTypes();
- boolean found2 = false;
- if (serverTypes != null) {
- int size = serverTypes.length;
- for (int i = 0; i < size && !found2; i++) {
- IServerType type = serverTypes[i];
- IModuleType[] moduleTypes = type.getRuntimeType().getModuleTypes();
- if (type.supportsLaunchMode(launchMode) && ServerUtil.isSupportedModule(moduleTypes, module.getModuleType())) {
- found2 = true;
- }
- }
- }
- if (!found2) {
- EclipseUtil.openError(Messages.errorNoServer);
- Trace.trace(Trace.FINEST, "No server for start mode");
- return;
- }
- }
-
- if (!ServerUIPlugin.saveEditors())
- return;
-
- tasksRun = false;
- IServer server = getServer(module, launchMode, monitor);
- if (monitor.isCanceled())
- return;
-
- Trace.trace(Trace.FINEST, "Server: " + server);
-
- if (server == null) {
- EclipseUtil.openError(Messages.errorNoServer);
- Trace.trace(Trace.SEVERE, "No server found");
- return;
- }
-
- if (!ServerUIPlugin.promptIfDirty(shell, server))
- return;
-
- if (!tasksRun) {
- SelectTasksWizard wizard = new SelectTasksWizard(server);
- wizard.addPages();
- if (wizard.hasTasks() && wizard.hasOptionalTasks()) {
- WizardDialog dialog = new WizardDialog(shell, wizard);
- if (dialog.open() == Window.CANCEL)
- return;
- } else
- wizard.performFinish();
- }
-
- // get the launchable adapter and module object
- ILaunchableAdapter launchableAdapter = null;
- Object launchable = null;
- ILaunchableAdapter[] adapters = ServerPlugin.getLaunchableAdapters();
- if (adapters != null) {
- int size2 = adapters.length;
- for (int j = 0; j < size2; j++) {
- ILaunchableAdapter adapter = adapters[j];
- try {
- Object launchable2 = adapter.getLaunchable(server, moduleArtifact);
- Trace.trace(Trace.FINEST, "adapter= " + adapter + ", launchable= " + launchable2);
- if (launchable2 != null) {
- launchableAdapter = adapter;
- launchable = launchable2;
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error in launchable adapter", e);
- }
- }
- }
-
- IClient[] clients = new IClient[0];
- if (launchable != null)
- clients = getClients(server, launchable, launchMode);
-
- Trace.trace(Trace.FINEST, "Launchable clients: " + clients);
-
- IClient client = null;
- if (clients == null || clients.length == 0) {
- EclipseUtil.openError(Messages.errorNoClient);
- Trace.trace(Trace.SEVERE, "No launchable clients!");
- return;
- } else if (clients.length == 1) {
- client = clients[0];
- } else {
- SelectClientWizard wizard = new SelectClientWizard(clients);
- ClosableWizardDialog dialog = new ClosableWizardDialog(shell, wizard);
- dialog.open();
- client = wizard.getSelectedClient();
- if (client == null)
- return;
- }
-
- Trace.trace(Trace.FINEST, "Ready to launch");
-
- // start server if it's not already started
- // and cue the client to start
- IModule[] modules = new IModule[] { module }; // TODO: get parent heirarchy correct
- int state = server.getServerState();
- if (state == IServer.STATE_STARTING) {
- LaunchClientJob clientJob = new LaunchClientJob(server, modules, launchMode, moduleArtifact, launchableAdapter, client);
- clientJob.schedule();
- } else if (state == IServer.STATE_STARTED) {
- boolean restart = false;
- String mode = server.getMode();
- if (!ILaunchManager.DEBUG_MODE.equals(mode) && ILaunchManager.DEBUG_MODE.equals(launchMode)) {
- int result = openWarningDialog(shell, Messages.dialogModeWarningDebug);
- if (result == 1)
- launchMode = mode;
- else if (result == 0)
- restart = true;
- else
- return;
- } else if (!ILaunchManager.PROFILE_MODE.equals(mode) && ILaunchManager.PROFILE_MODE.equals(launchMode)) {
- int result = openWarningDialog(shell, Messages.dialogModeWarningProfile);
- if (result == 1)
- launchMode = mode;
- else if (result == 0)
- restart = true;
- else
- return;
- }
-
- PublishServerJob publishJob = new PublishServerJob(server, IServer.PUBLISH_INCREMENTAL, false);
- LaunchClientJob clientJob = new LaunchClientJob(server, modules, launchMode, moduleArtifact, launchableAdapter, client);
- publishJob.setNextJob(clientJob);
-
- if (restart) {
- RestartServerJob restartJob = new RestartServerJob(server, launchMode);
- restartJob.setNextJob(publishJob);
- restartJob.schedule();
- } else
- publishJob.schedule();
- } else if (state != IServer.STATE_STOPPING) {
- PublishServerJob publishJob = new PublishServerJob(server);
- StartServerJob startServerJob = new StartServerJob(server, launchMode);
- LaunchClientJob clientJob = new LaunchClientJob(server, modules, launchMode, moduleArtifact, launchableAdapter, client);
-
- if (((ServerType)server.getServerType()).startBeforePublish()) {
- startServerJob.setNextJob(publishJob);
- publishJob.setNextJob(clientJob);
- startServerJob.schedule();
- } else {
- publishJob.setNextJob(startServerJob);
- startServerJob.setNextJob(clientJob);
- publishJob.schedule();
- }
- }
- }
-
- /**
- * Returns the launchable clients for the given server and launchable
- * object.
- *
- * @param server org.eclipse.wst.server.core.IServer
- * @param launchable
- * @param launchMode String
- * @return an array of clients
- */
- public static IClient[] getClients(IServer server, Object launchable, String launchMode) {
- ArrayList list = new ArrayList();
- IClient[] clients = ServerPlugin.getClients();
- if (clients != null) {
- int size = clients.length;
- for (int i = 0; i < size; i++) {
- Trace.trace(Trace.FINEST, "client= " + clients[i]);
- if (clients[i].supports(server, launchable, launchMode))
- list.add(clients[i]);
- }
- }
-
- IClient[] clients2 = new IClient[list.size()];
- list.toArray(clients2);
- return clients2;
- }
-
- /**
- * Open a message dialog.
- *
- * @param shell
- * @param message
- * @return a dialog return constant
- */
- protected int openWarningDialog(Shell shell, String message) {
- MessageDialog dialog = new MessageDialog(shell, Messages.errorDialogTitle, null,
- message, MessageDialog.WARNING, new String[] {Messages.dialogModeWarningRestart,
- Messages.dialogModeWarningContinue, IDialogConstants.CANCEL_LABEL}, 0);
- return dialog.open();
- }
-
- /**
- * The delegating action has been performed. Implement
- * this method to do the actual work.
- *
- * @param action action proxy that handles the presentation
- * portion of the plugin action
- */
- public void run(IAction action) {
- Trace.trace(Trace.FINEST, "Running on Server...");
- try {
- run(new NullProgressMonitor());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Run on Server Error", e);
- }
- }
-
- protected boolean isEnabled() {
- try {
- Boolean b = (Boolean) globalLaunchMode.get(getLaunchMode());
- return b.booleanValue();
- } catch (Exception e) {
- // ignore
- }
- return false;
- }
-
- /**
- * Returns the start mode that the server should use.
- */
- protected String getLaunchMode() {
- return ILaunchManager.RUN_MODE;
- }
-
- /**
- * Determine which clients can act on the current selection.
- *
- * @param action action proxy that handles presentation
- * portion of the plugin action
- * @param sel current selection in the desktop
- */
- public void selectionChanged(IAction action, ISelection sel) {
- Trace.trace(Trace.FINEST, "> selectionChanged");
- selection = null;
- long time = System.currentTimeMillis();
- if (sel == null || sel.isEmpty() || !(sel instanceof IStructuredSelection)) {
- action.setEnabled(false);
- globalSelection = null;
- return;
- }
-
- IStructuredSelection select = (IStructuredSelection) sel;
- Iterator iterator = select.iterator();
- if (iterator.hasNext())
- selection = iterator.next();
- if (iterator.hasNext()) { // more than one selection (should never happen)
- action.setEnabled(false);
- selection = null;
- globalSelection = null;
- return;
- }
-
- if (selection != globalSelection) {
- Trace.trace(Trace.FINEST, "Selection: " + selection);
- if (selection != null)
- Trace.trace(Trace.FINEST, "Selection type: " + selection.getClass().getName());
- globalSelection = selection;
- globalLaunchMode = new HashMap();
- if (!ServerPlugin.hasModuleArtifact(globalSelection)) {
- action.setEnabled(false);
- return;
- }
-
- Trace.trace(Trace.FINEST, "checking for module artifact");
- IModuleArtifact moduleArtifact = ServerPlugin.getModuleArtifact(globalSelection);
- IModule module = null;
- if (moduleArtifact != null)
- module = moduleArtifact.getModule();
- Trace.trace(Trace.FINEST, "moduleArtifact= " + moduleArtifact + ", module= " + module);
- if (module != null)
- findGlobalLaunchModes(module);
- else {
- globalLaunchMode.put(ILaunchManager.RUN_MODE, new Boolean(true));
- globalLaunchMode.put(ILaunchManager.DEBUG_MODE, new Boolean(true));
- globalLaunchMode.put(ILaunchManager.PROFILE_MODE, new Boolean(true));
- }
- }
-
- action.setEnabled(isEnabled());
- Trace.trace(Trace.FINEST, "< selectionChanged " + (System.currentTimeMillis() - time));
- }
-
- /**
- * Determines whether there is a server factory available for the given module
- * and the various start modes.
- */
- protected void findGlobalLaunchModes(IModule module) {
- IServerType[] serverTypes = ServerCore.getServerTypes();
- if (serverTypes != null) {
- int size = serverTypes.length;
- for (int i = 0; i < size; i++) {
- IServerType type = serverTypes[i];
- if (isValidServerType(type, module)) {
- for (byte b = 0; b < launchModes.length; b++) {
- if (type.supportsLaunchMode(launchModes[b])) {
- globalLaunchMode.put(launchModes[b], new Boolean(true));
- }
- }
- }
- }
- }
- }
-
- /**
- * Returns true if the given server type can launch the module.
- */
- protected boolean isValidServerType(IServerType type, IModule module) {
- try {
- IRuntimeType runtimeType = type.getRuntimeType();
- ServerUtil.isSupportedModule(runtimeType.getModuleTypes(), module.getModuleType());
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
- protected boolean supportsLaunchMode(IServer server, String launchMode) {
- return server.getServerType().supportsLaunchMode(launchMode);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/Audio.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/Audio.java
deleted file mode 100644
index 24f7717fe..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/Audio.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.audio;
-
-/**
- * Audio is the main interface to the audio plugin.<p>
- *
- * Adding a new sound to your plugin is as easy as ABC:
- * <ul>
- * <li>A: Add the following requires to your plugin.xml:<br>
- * <pre>&lt;import plugin="org.eclipse.wst.server.util"&gt;</pre></li>
- *
- * <li>B: Define a new sound extension point in your plugin.xml:<br>
- * <pre>&lt;extension point="org.eclipse.wst.server.util.sound"&gt;
- * &lt;category id="org.eclipse.myPlugin"
- * name="My Plugin Name"/&gt;
- * &lt;sound id="org.eclipse.myPlugin.mySound"
- * category="org.eclipse.myPlugin"
- * name="Something Happened"
- * location="sounds/mySound.wav"/&gt;
- * &lt;sound id="org.eclipse.myPlugin.myOtherSounds"
- * category="org.eclipse.myPlugin"
- * name="Another Event Happened"/&gt;
- * &lt;/extension&gt;</pre><br>
- * (the location is optional. If it is not specified, the sound
- * will not play until the user specifies an audio file)</li>
- *
- * <li>C: Call the sounds when the appropriate events occur within
- * your plugin:<br>
- * <pre>org.eclipse.wst.audio.Audio.playSound("org.eclipse.myPlugin.mySound");</pre></li>
- * </ul>
- */
-public class Audio {
- /**
- * AudioCore constructor comment.
- */
- private Audio() {
- super();
- }
-
- /**
- * Plays the sound with the given id.
- *
- * @param id java.lang.String
- */
- public static void playSound(String id) {
- AudioCore.getInstance().playSound(id);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioCore.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioCore.java
deleted file mode 100644
index 80499cb72..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioCore.java
+++ /dev/null
@@ -1,694 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.audio;
-
-import java.util.*;
-import java.io.*;
-import java.net.URL;
-import javax.sound.sampled.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ui.IMemento;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- * Main audio plugin class.
- */
-public class AudioCore {
- protected static AudioCore instance;
-
- public static final String PREF_SOUND_ENABLED = "soundEnabled";
- public static final String PREF_VOLUME = "volume";
-
- public static final String SOUNDS_FILE = "sounds.xml";
- public static final String DISABLED_FILE = "disabled-sounds.xml";
-
- // Categories - map of String id to String names
- private Map categories;
-
- // Sounds - map of String id to Sound
- private Map sounds;
-
- // specific sounds or categories that have been disabled, by id
- private List disabledSounds;
- private List disabledCategories;
-
- // SoundMap - map of String id to an IPath
- private Map userSoundMap;
-
- /**
- * AudioCore constructor comment.
- */
- private AudioCore() {
- super();
-
- loadExtensionPoints();
-
- loadSoundMap();
- loadDisabledLists();
-
-
- }
-
- /**
- * Return the categories
- *
- * @return java.util.Map
- */
- protected Map getCategories() {
- return categories;
- }
-
- /**
- * Returns the audio clip.
- *
- * @param url java.net.URL
- * @return javax.sound.sampled.Clip
- */
- protected static Clip getClip(URL url) {
- try {
- AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(url);
-
- AudioFormat format = audioInputStream.getFormat();
-
- /**
- * we can't yet open the device for ALAW/ULAW playback,
- * convert ALAW/ULAW to PCM
- */
- if ((format.getEncoding() == AudioFormat.Encoding.ULAW) ||
- (format.getEncoding() == AudioFormat.Encoding.ALAW)) {
- AudioFormat tmp = new AudioFormat(
- AudioFormat.Encoding.PCM_SIGNED,
- format.getSampleRate(),
- format.getSampleSizeInBits() * 2,
- format.getChannels(),
- format.getFrameSize() * 2,
- format.getFrameRate(), true);
- audioInputStream = AudioSystem.getAudioInputStream(tmp, audioInputStream);
- format = tmp;
- }
- DataLine.Info info = new DataLine.Info(
- Clip.class, audioInputStream.getFormat(),
- ((int) audioInputStream.getFrameLength() *
- format.getFrameSize()));
-
- Clip clip = (Clip) AudioSystem.getLine(info);
- clip.open(audioInputStream);
- return clip;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not get clip: " + url, e);
- }
- return null;
- }
-
- /**
- * Returns true if audio is currently available on this system.
- *
- * @return boolean
- */
- protected static boolean isAudioSupported() {
- try {
- boolean sound = false;
- Mixer.Info[] info2 = AudioSystem.getMixerInfo();
- if (info2 != null) {
- int size = info2.length;
- for (int i = 0; i < size; i++) {
- //Trace.trace(" " + info2[i]);
- Mixer mixer = AudioSystem.getMixer(info2[i]);
- if (mixer != null) {
- //Trace.trace(" Mixer:" + mixer);
- //Trace.trace(" " + mixer.getLineInfo());
- try {
- Line.Info info = mixer.getLineInfo();
- Line line = mixer.getLine(info);
- //Trace.trace(" Line:" + line);
- if (line != null && line.toString().indexOf("Output") >= 0)
- sound = true;
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
- return sound;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not verify audio status", e);
- }
- return true;
- }
-
- /**
- * Returns true if sound is enabled.
- *
- * @return boolean
- */
- public boolean getDefaultSoundsEnabled() {
- return getPreferenceStore().getDefaultBoolean(PREF_SOUND_ENABLED);
- }
-
- /**
- * Returns the default volume.
- *
- * @return int
- */
- public int getDefaultVolume() {
- return getPreferenceStore().getDefaultInt(PREF_VOLUME);
- }
-
- /**
- * Returns the singleton instance.
- *
- * @return org.eclipse.audio.internal.AudioCore
- */
- public static AudioCore getInstance() {
- if (instance == null)
- instance = new AudioCore();
- return instance;
- }
-
- /**
- *
- * @return org.eclipse.jface.preference.IPreferenceStore
- */
- protected IPreferenceStore getPreferenceStore() {
- return ServerUIPlugin.getInstance().getPreferenceStore();
- }
-
- /**
- * Returns the sound with the given id.
- *
- * @param id java.lang.String
- * @return org.eclipse.audio.Sound
- */
- protected Sound getSound(String id) {
- try {
- return (Sound) sounds.get(id);
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- * Return the sounds.
- *
- * @return java.util.Map
- */
- protected Map getSounds() {
- return sounds;
- }
-
- /**
- * Returns the full user sound map.
- *
- * @return java.util.Map
- */
- protected Map getUserSoundMap() {
- if (userSoundMap == null)
- loadSoundMap();
- return userSoundMap;
- }
-
- /**
- * Return the current URL for this sound.
- *
- * @param id java.lang.String
- * @return java.net.URL
- */
- protected IPath getUserSoundPath(String id) {
- try {
- if (userSoundMap == null)
- loadSoundMap();
-
- IPath path = (IPath) userSoundMap.get(id);
- if (path != null)
- return path;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not get sound URL: " + id, e);
- }
- return null;
- }
-
- /**
- * Returns the preferred volume.
- *
- * @return int
- */
- public int getVolume() {
- return getPreferenceStore().getInt(PREF_VOLUME);
- }
-
- /**
- * Initialize the default preferences.
- *
- * @param store org.eclipse.jface.preference.IPreferenceStore
- */
- public static void initializeDefaultPreferences(IPreferenceStore store) {
- store.setDefault(PREF_VOLUME, 18);
- }
-
- /**
- * Returns true if the given category is enabled.
- *
- * @param id java.lang.String
- * @return boolean
- */
- public boolean isCategoryEnabled(String id) {
- if (id == null)
- return false;
-
- if (disabledCategories == null)
- loadDisabledLists();
-
- return (!disabledCategories.contains(id));
- }
-
- /**
- * Returns true if sound is enabled.
- *
- * @return boolean
- */
- public boolean isSoundEnabled() {
- return getPreferenceStore().getBoolean(PREF_SOUND_ENABLED);
- }
-
- /**
- * Returns true if the given sound is enabled.
- *
- * @param id java.lang.String
- * @return boolean
- */
- public boolean isSoundEnabled(String id) {
- if (id == null)
- return false;
-
- if (disabledSounds == null)
- loadDisabledLists();
-
- return (!disabledSounds.contains(id));
- }
-
- /**
- * Saves the disabled sound list.
- */
- private void loadDisabledLists() {
- String filename = ServerUIPlugin.getInstance().getStateLocation().append(DISABLED_FILE).toOSString();
-
- FileInputStream in = null;
- disabledCategories = new ArrayList();
- disabledSounds = new ArrayList();
- try {
- in = new FileInputStream(filename);
- IMemento memento = XMLMemento.loadMemento(in);
-
- IMemento cat = memento.getChild("categories");
- IMemento[] children = cat.getChildren("category");
-
- int size = children.length;
- for (int i = 0; i < size; i++) {
- try {
- IMemento child = children[i];
- String id = child.getString("id");
-
- disabledCategories.add(id);
- } catch (Exception ex) {
- Trace.trace(Trace.SEVERE, "Error reading URL map ", ex);
- }
- }
-
- IMemento sound = memento.getChild("sounds");
- children = sound.getChildren("sound");
-
- size = children.length;
- for (int i = 0; i < size; i++) {
- try {
- IMemento child = children[i];
- String id = child.getString("id");
-
- disabledSounds.add(id);
- } catch (Exception ex) {
- Trace.trace(Trace.SEVERE, "Error reading URL map ", ex);
- }
- }
- } catch (Exception e) {
- //AudioPlugin.log(new Status(IStatus.WARNING, AudioPlugin.PLUGIN_ID, 0, "Could not load disabled sound information", e));
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
-
- /**
- * Load extension point.
- */
- private void loadExtensionPoints() {
- // load extension points
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, "audio");
-
- int size = cf.length;
- categories = new HashMap();
- sounds = new HashMap();
-
- for (int i = 0; i < size; i++) {
- try {
- String elementName = cf[i].getName();
- String id = cf[i].getAttribute("id");
- String name = cf[i].getAttribute("name");
- if ("category".equals(elementName)) {
- categories.put(id, name);
- } else if ("sound".equals(elementName)) {
- String category = cf[i].getAttribute("category");
- String location = cf[i].getAttribute("location");
-
- URL realURL = null;
- if (location != null && location.length() > 0) {
- String pluginId = cf[i].getDeclaringExtension().getNamespace();
- URL url = Platform.find(Platform.getBundle(pluginId), new Path(location));
- realURL = Platform.resolve(url);
- }
-
- Sound sound = new Sound(id, category, name, realURL);
- sounds.put(id, sound);
- }
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not load audio: " + cf[i].getAttribute("id"), t);
- }
- }
- }
-
- /**
- * Saves the disabled sound list.
- */
- private void loadSoundMap() {
- String filename = ServerUIPlugin.getInstance().getStateLocation().append(SOUNDS_FILE).toOSString();
-
- InputStream in = null;
- userSoundMap = new HashMap();
- try {
- in = new FileInputStream(filename);
- IMemento memento = XMLMemento.loadMemento(in);
-
- IMemento[] children = memento.getChildren("map");
-
- int size = children.length;
- for (int i = 0; i < size; i++) {
- try {
- IMemento child = children[i];
- String id = child.getString("id");
- String pathStr = child.getString("path");
- IPath path = new Path(pathStr);
-
- userSoundMap.put(id, path);
- } catch (Exception ex) {
- Trace.trace(Trace.SEVERE, "Error reading URL map ", ex);
- }
- }
- } catch (Exception e) {
- // ignore
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
-
- /**
- * Play the sound with the given id. (provided that
- * the user has enabled the sound)
- *
- * @param id java.lang.String
- */
- public void playSound(String id) {
- if (!isSoundEnabled())
- return;
-
- if (!isSoundEnabled(id))
- return;
-
- try {
- Sound sound = (Sound) sounds.get(id);
- String category = sound.getCategory();
- if (category != null && categories.containsKey(category)) {
- if (!isCategoryEnabled(category))
- return;
- }
-
- URL url = sound.getLocation();
- IPath path = getUserSoundPath(id);
- if (path != null)
- url = path.toFile().toURL();
-
- playSound(url, getVolume());
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error playing audio: " + id, e);
- }
- }
-
- /**
- * Plays the sound at the given url.
- *
- * @param url java.net.URL
- */
- protected static void playSound(URL url, final int volume) {
- try {
- Trace.trace(Trace.FINEST, "playSound");
- if (url == null || volume <= 0)
- return;
-
- final Clip clip = getClip(url);
- if (clip == null)
- return;
-
- Trace.trace(Trace.FINEST, "playing");
-
- Thread t = new Thread("Sound Thread") {
- public void run() {
- // set gain
- FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
- double value = volume / 20.0;
- float dB = (float) (Math.log(value==0.0?0.0001:value)/Math.log(10.0)*20.0);
- gainControl.setValue(dB);
-
- Trace.trace(Trace.FINEST, "start");
- clip.start();
- try {
- sleep(99);
- } catch (Exception e) {
- // ignore
- }
-
- while (clip.isActive()) {
- try {
- sleep(99);
- } catch (Exception e) {
- break;
- }
- }
- clip.stop();
- clip.close();
- Trace.trace(Trace.FINEST, "stop");
- }
- };
- t.setDaemon(true);
- t.start();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error playing audio: " + url, e);
- }
- }
-
- /**
- * Saves the disabled sounds and categories list.
- */
- private void saveDisabledLists() {
- String filename = ServerUIPlugin.getInstance().getStateLocation().append(DISABLED_FILE).toOSString();
-
- FileOutputStream fout = null;
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("disabled");
-
- IMemento cat = memento.createChild("categories");
- Iterator iterator = disabledCategories.iterator();
- while (iterator.hasNext()) {
- IMemento child = cat.createChild("category");
- String id = (String) iterator.next();
- child.putString("id", id);
- }
-
- IMemento sound = memento.createChild("sounds");
- iterator = disabledSounds.iterator();
- while (iterator.hasNext()) {
- IMemento child = sound.createChild("sound");
- String id = (String) iterator.next();
- child.putString("id", id);
- }
-
- fout = new FileOutputStream(filename);
- memento.save(fout);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save disabled information", e);
- } finally {
- if (fout != null) {
- try {
- fout.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
-
- /**
- * Saves the disabled sound list.
- */
- private void saveSoundMap() {
- String filename = ServerUIPlugin.getInstance().getStateLocation().append(SOUNDS_FILE).toOSString();
-
- FileOutputStream fout = null;
- try {
- XMLMemento memento = XMLMemento.createWriteRoot("sound-map");
-
- Iterator iterator = userSoundMap.keySet().iterator();
- while (iterator.hasNext()) {
- IMemento child = memento.createChild("map");
- String id = (String) iterator.next();
- child.putString("id", id);
- IPath path = (IPath) userSoundMap.get(id);
- child.putString("path", path.toString());
- }
-
- fout = new FileOutputStream(filename);
- memento.save(fout);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not save URL map information", e);
- } finally {
- if (fout != null) {
- try {
- fout.close();
- } catch (Exception e) {
- // ignore
- }
- }
- }
- }
-
- /**
- * Enable or disable a specific category.
- *
- * @param id java.lang.String
- * @param b boolean
- */
- public void setCategoryEnabled(String id, boolean b) {
- if (id == null)
- return;
-
- if (disabledCategories == null)
- loadDisabledLists();
-
- if (b) {
- if (disabledCategories.contains(id)) {
- disabledCategories.remove(id);
- saveDisabledLists();
- }
- } else {
- if (!disabledCategories.contains(id)) {
- disabledCategories.add(id);
- saveDisabledLists();
- }
- }
- }
-
- /**
- * Enable or disable a specific sound.
- *
- * @param id java.lang.String
- * @param b boolean
- */
- public void setSoundEnabled(String id, boolean b) {
- if (id == null)
- return;
-
- if (disabledSounds == null)
- loadDisabledLists();
-
- if (b) {
- if (disabledSounds.contains(id)) {
- disabledSounds.remove(id);
- saveDisabledLists();
- }
- } else {
- if (!disabledSounds.contains(id)) {
- disabledSounds.add(id);
- saveDisabledLists();
- }
- }
- }
-
- /**
- * Sets whether sound is enabled.
- *
- * @param enabled
- */
- public void setSoundsEnabled(boolean enabled) {
- getPreferenceStore().setValue(PREF_SOUND_ENABLED, enabled);
- }
-
- /**
- * Sets the current URL for this sound.
- *
- * @param id java.lang.String
- * @param path IPath
- */
- protected void setSoundURL(String id, IPath path) {
- if (id == null || path == null)
- return;
-
- try {
- if (userSoundMap == null)
- loadSoundMap();
-
- userSoundMap.put(id, path);
- saveSoundMap();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not get sound URL: " + id, e);
- }
- }
-
- /**
- * Sets the full user sound map.
- *
- * @param map the sound map
- */
- protected void setUserSoundMap(Map map) {
- if (map != null) {
- userSoundMap = map;
- saveSoundMap();
- }
- }
-
- /**
- * Sets the volume.
- *
- * @param volume the volume
- */
- public void setVolume(int volume) {
- getPreferenceStore().setValue(PREF_VOLUME, volume);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioPreferencePage.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioPreferencePage.java
deleted file mode 100644
index be0a6b3e7..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioPreferencePage.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.audio;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.wst.server.ui.internal.ContextIds;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- * Audio preference page.
- */
-public class AudioPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- protected Button enableButton;
- protected Spinner volume;
-
- protected Map userSoundMap;
-
- protected CategoryTableViewer viewer;
-
- boolean soundAvailable = true;
-
- /**
- * AudioPreferencePage constructor comment.
- */
- public AudioPreferencePage() {
- super();
-
- loadUserMapInfo();
- }
-
- protected IPath chooseAudioFile() {
- FileDialog dialog = new FileDialog(getShell(), SWT.SINGLE);
- dialog.setText(Messages.audioPrefSelectFile);
- dialog.setFilterExtensions(new String[] {"*.au;*.wav"});
- dialog.setFilterPath(null);
- dialog.open();
-
- String[] filenames = dialog.getFileNames();
- if (filenames != null && filenames.length > 0) {
- String filterPath = dialog.getFilterPath();
- return new Path(filterPath + java.io.File.separator + filenames[0]);
- }
- return null;
- }
-
- /**
- * Creates and returns the SWT control for the customized body
- * of this preference page under the given parent composite.
- * <p>
- * This framework method must be implemented by concrete
- * subclasses.
- * </p>
- *
- * @param parent the parent composite
- * @return the new control
- */
- protected Control createContents(Composite parent) {
- initializeDialogUnits(parent);
- IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
- whs.setHelp(parent, ContextIds.AUDIO_PREFERENCES);
-
- final AudioCore core = AudioCore.getInstance();
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
- layout.verticalSpacing = convertVerticalDLUsToPixels(3);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- composite.setLayoutData(data);
-
- enableButton = new Button(composite, SWT.CHECK);
- enableButton.setText(Messages.audioPrefEnable);
- enableButton.setSelection(AudioCore.getInstance().isSoundEnabled());
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- enableButton.setLayoutData(data);
- whs.setHelp(enableButton, ContextIds.AUDIO_PREFERENCES_ENABLE);
-
- final Label volumeLabel = new Label(composite, SWT.NONE);
- volumeLabel.setText(Messages.audioPrefVolume);
- data = new GridData();
- data.horizontalIndent = 20;
- volumeLabel.setLayoutData(data);
- volumeLabel.setEnabled(enableButton.getSelection());
-
- volume = new Spinner(composite, SWT.BORDER);
- volume.setMinimum(0);
- volume.setMaximum(20);
- volume.setSelection(AudioCore.getInstance().getVolume());
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- data.horizontalSpan = 2;
- data.widthHint = 60;
- volume.setLayoutData(data);
- volume.setEnabled(enableButton.getSelection());
- whs.setHelp(volume, ContextIds.AUDIO_PREFERENCES_VOLUME);
-
- enableButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- volumeLabel.setEnabled(enableButton.getSelection());
- volume.setEnabled(enableButton.getSelection());
- }
- });
-
- Label label = new Label(composite, SWT.NONE);
- data = new GridData();
- data.horizontalSpan = 3;
- label.setLayoutData(data);
-
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.audioPrefSounds);
- data = new GridData();
- data.horizontalSpan = 3;
- label.setLayoutData(data);
-
- final Table table = new Table(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.CHECK);
- data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = 2;
- table.setLayoutData(data);
- whs.setHelp(table, ContextIds.AUDIO_PREFERENCES_SOUNDS_TABLE);
-
- viewer = new CategoryTableViewer(table);
-
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
- table.setHeaderVisible(true);
-
- tableLayout.addColumnData(new ColumnPixelData(19, false));
- TableColumn col = new TableColumn(table, SWT.NONE, 0);
- col.setText("");
- col.setResizable(false);
-
- tableLayout.addColumnData(new ColumnWeightData(11, 110, true));
- col = new TableColumn(table, SWT.NONE, 1);
- col.setText(Messages.audioPrefSound);
- col.setResizable(true);
-
- tableLayout.addColumnData(new ColumnWeightData(15, 150, true));
- col = new TableColumn(table, SWT.NONE, 2);
- col.setText(Messages.audioPrefFile);
- col.setResizable(true);
-
- viewer.setContentProvider(new AudioTableContentProvider());
- viewer.setLabelProvider(new AudioTableLabelProvider(this));
- viewer.setInput("root");
-
- setCheckState(viewer);
-
- viewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- boolean checked = event.getChecked();
- Object obj = event.getElement();
-
- if (obj instanceof String) {
- String id = (String) obj;
- core.setCategoryEnabled(id, checked);
- //viewer.refresh();
- Iterator iterator = AudioTableContentProvider.getSoundsByCategory(id).iterator();
- while (iterator.hasNext()) {
- Sound s = (Sound) iterator.next();
- viewer.setChecked(s, checked);
- core.setSoundEnabled(s.getId(), checked);
- }
- } else {
- Sound sound = (Sound) obj;
- core.setSoundEnabled(sound.getId(), checked);
- }
- }
- });
-
- Composite right = new Composite(composite, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 1;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
- layout.verticalSpacing = convertVerticalDLUsToPixels(4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- right.setLayout(layout);
- data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL);
- right.setLayoutData(data);
-
- // play button and table selection listener
- final Button playButton = SWTUtil.createButton(right, Messages.audioPrefPlay);
- playButton.setEnabled(false);
- whs.setHelp(playButton, ContextIds.AUDIO_PREFERENCES_PLAY);
-
- final Button browseButton = SWTUtil.createButton(right, Messages.audioPrefBrowse);
- browseButton.setEnabled(false);
- whs.setHelp(browseButton, ContextIds.AUDIO_PREFERENCES_BROWSE);
-
- final Button resetButton = SWTUtil.createButton(right, Messages.audioPrefReset);
- resetButton.setEnabled(false);
- whs.setHelp(resetButton, ContextIds.AUDIO_PREFERENCES_RESET);
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- try {
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- Object obj = sel.getFirstElement();
- if (obj instanceof Sound) {
- Sound sound = (Sound) obj;
- URL url = getSoundURL(sound.getId());
- if (url != null && soundAvailable)
- playButton.setEnabled(true);
- else
- playButton.setEnabled(false);
- browseButton.setEnabled(true);
-
- if (getUserSoundPath(sound.getId()) != null)
- resetButton.setEnabled(true);
- else
- resetButton.setEnabled(false);
- } else {
- playButton.setEnabled(false);
- browseButton.setEnabled(false);
- resetButton.setEnabled(false);
- }
- } catch (Exception ex) {
- Trace.trace(Trace.SEVERE, "Error in table selection", ex);
- }
- }
- });
-
- soundAvailable = AudioCore.isAudioSupported();
- if (soundAvailable) {
- playButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- try {
- int sel = table.getSelectionIndex();
- Sound sound = (Sound) table.getItem(sel).getData();
- AudioCore.playSound(getSoundURL(sound.getId()), volume.getSelection());
- } catch (Exception ex) {
- Trace.trace(Trace.SEVERE, "Error in table selection", ex);
- }
- }
- });
- } else
- playButton.setEnabled(false);
-
- browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- try {
- IPath path = chooseAudioFile();
- if (path != null) {
- int sel = table.getSelectionIndex();
- Sound sound = (Sound) table.getItem(sel).getData();
- setUserSoundPath(sound.getId(), path);
- viewer.refresh(sound);
- playButton.setEnabled(true);
- }
- } catch (Exception ex) {
- Trace.trace(Trace.SEVERE, "Error browsing", ex);
- }
- }
- });
-
- resetButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- try {
- int sel = table.getSelectionIndex();
- Sound sound = (Sound) table.getItem(sel).getData();
- removeUserSoundPath(sound.getId());
- viewer.refresh(sound);
- //playButton.setEnabled(true);
- } catch (Exception ex) {
- Trace.trace(Trace.SEVERE, "Error reseting sound", ex);
- }
- }
- });
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- protected void setCheckState(CheckboxTableViewer viewer) {
- AudioCore core = AudioCore.getInstance();
-
- Map categories = core.getCategories();
-
- // first, find all the categories and sort
- List cats = new ArrayList();
- Iterator iterator = categories.keySet().iterator();
- while (iterator.hasNext())
- cats.add(iterator.next());
-
- // list them, ignoring empty ones
- iterator = categories.keySet().iterator();
- while (iterator.hasNext()) {
- String id = (String) iterator.next();
- List l = AudioTableContentProvider.getSoundsByCategory(id);
- if (!l.isEmpty()) {
- if (core.isCategoryEnabled(id))
- viewer.setChecked(id, true);
-
- int size = l.size();
- for (int i = 0; i < size; i++) {
- Sound s = (Sound) l.get(i);
- if (core.isSoundEnabled(s.getId()))
- viewer.setChecked(s, true);
- }
- }
- }
-
- // finally, list the "misc" sounds
- List l = AudioTableContentProvider.getSoundsByCategory(null);
- if (!l.isEmpty()) {
- int size = l.size();
- for (int i = 0; i < size; i++) {
- Sound s = (Sound) l.get(i);
- if (core.isSoundEnabled(s.getId()))
- viewer.setChecked(s, true);
- }
- }
- }
-
- /**
- *
- * @return org.eclipse.core.runtime.IPath
- * @param id java.lang.String
- */
- protected URL getSoundURL(String id) {
- try {
- IPath path = (IPath) userSoundMap.get(id);
- if (path != null)
- return path.toFile().toURL();
- } catch (Exception e) {
- // ignore
- }
-
- return AudioCore.getInstance().getSound(id).getLocation();
- }
-
- /**
- *
- * @return org.eclipse.core.runtime.IPath
- * @param id java.lang.String
- */
- protected IPath getUserSoundPath(String id) {
- try {
- IPath path = (IPath) userSoundMap.get(id);
- if (path != null)
- return path;
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- /**
- * 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) {
- // do nothing
- }
-
- /**
- *
- */
- protected void loadUserMapInfo() {
- // create a copy of the user sound map
- Map map = AudioCore.getInstance().getUserSoundMap();
- userSoundMap = new HashMap(map.size());
-
- Iterator iterator = map.keySet().iterator();
- while (iterator.hasNext()) {
- String id = (String) iterator.next();
- IPath path = (IPath) map.get(id);
- userSoundMap.put(id, path);
- }
- }
-
- /**
- * @see PreferencePage#performDefaults()
- */
- protected void performDefaults() {
- AudioCore core = AudioCore.getInstance();
-
- enableButton.setSelection(core.getDefaultSoundsEnabled());
- volume.setSelection(core.getDefaultVolume());
-
- userSoundMap = new HashMap();
- viewer.refresh();
-
- super.performDefaults();
- }
-
- /**
- * @see PreferencePage#performOk()
- */
- public boolean performOk() {
- AudioCore core = AudioCore.getInstance();
- core.setSoundsEnabled(enableButton.getSelection());
- core.setVolume(volume.getSelection());
-
- core.setUserSoundMap(userSoundMap);
- viewer.refresh();
-
- return super.performOk();
- }
-
- /**
- *
- */
- protected void removeUserSoundPath(String id) {
- if (userSoundMap.containsKey(id))
- userSoundMap.remove(id);
- }
-
- /**
- *
- */
- protected void saveUserMapInfo() {
- // create a copy of the user sound map
- Map map = AudioCore.getInstance().getUserSoundMap();
- userSoundMap = new HashMap(map.size());
-
- Iterator iterator = map.keySet().iterator();
- while (iterator.hasNext()) {
- String id = (String) iterator.next();
- IPath path = (IPath) map.get(id);
- userSoundMap.put(id, path);
- }
- }
-
- /**
- *
- * @param path org.eclipse.core.runtime.IPath
- */
- protected void setUserSoundPath(String id, IPath path) {
- userSoundMap.put(id, path);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioTableContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioTableContentProvider.java
deleted file mode 100644
index b8033c223..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioTableContentProvider.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.audio;
-
-import java.util.*;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-/**
- * Audio table content provider.
- */
-class AudioTableContentProvider implements IStructuredContentProvider {
- protected static final String MISC_CATEGORY = "miscCategory";
-
- /**
- * AudioTableContentProvider constructor comment.
- */
- public AudioTableContentProvider() {
- super();
- }
-
- /**
- * Disposes of this content provider.
- * This is called by the viewer when it is disposed.
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * Returns the elements to display in the viewer
- * when its input is set to the given element.
- * These elements can be presented as rows in a table, items in a list, etc.
- * The result is not modified by the viewer.
- *
- * @param inputElement the input element
- * @return the array of elements to display in the viewer
- */
- public Object[] getElements(Object inputElement) {
- AudioCore core = AudioCore.getInstance();
-
- Map categories = core.getCategories();
- Map sounds = core.getSounds();
-
- List list = new ArrayList(sounds.size());
-
- // first, find all the categories and sort
- List cats = new ArrayList();
- Iterator iterator = categories.keySet().iterator();
- while (iterator.hasNext())
- cats.add(iterator.next());
- sortCategories(cats);
-
- // list them, ignoring empty ones
- iterator = categories.keySet().iterator();
- while (iterator.hasNext()) {
- String id = (String) iterator.next();
- List l = getSoundsByCategory(id);
- if (!l.isEmpty()) {
- list.add(id);
- sortSounds(l);
-
- int size = l.size();
- for (int i = 0; i < size; i++)
- list.add(l.get(i));
- }
- }
-
- // finally, list the "misc" sounds
- List l = getSoundsByCategory(null);
- if (!l.isEmpty()) {
- list.add(MISC_CATEGORY);
- sortSounds(l);
-
- int size = l.size();
- for (int i = 0; i < size; i++)
- list.add(l.get(i));
- }
-
- return list.toArray();
- }
-
- /**
- * Returns the sounds from the given category. Use null
- * to return all miscelleneous sounds with no category or
- * an invalid category.
- *
- * @return java.util.List
- * @param category java.lang.String
- */
- protected static List getSoundsByCategory(String category) {
- AudioCore core = AudioCore.getInstance();
-
- Map sounds = core.getSounds();
- Map categories = core.getCategories();
- List list = new ArrayList();
-
- Iterator iterator = sounds.keySet().iterator();
- while (iterator.hasNext()) {
- String id = (String) iterator.next();
- Sound sound = (Sound) sounds.get(id);
- if (category != null && category.equals(sound.getCategory()))
- list.add(sound);
- else if (category == null && (sound.getCategory() == null || !categories.containsKey(sound.getCategory())))
- list.add(sound);
- }
- return list;
- }
-
- /**
- * Notifies this content provider that the given viewer's input
- * has been switched to a different element.
- * <p>
- * A typical use for this method is registering the content provider as a listener
- * to changes on the new input (using model-specific means), and deregistering the viewer
- * from the old input. In response to these change notifications, the content provider
- * propagates the changes to the viewer.
- * </p>
- *
- * @param viewer the viewer
- * @param oldInput the old input element, or <code>null</code> if the viewer
- * did not previously have an input
- * @param newInput the new input element, or <code>null</code> if the viewer
- * does not have an input
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- /**
- * Sorts a list of categories, in place.
- *
- * @param list java.util.List
- */
- protected void sortCategories(List list) {
- int size = list.size();
- if (size < 2)
- return;
-
- Map categories = AudioCore.getInstance().getCategories();
-
- for (int i = 0; i < size - 1; i++) {
- for (int j = i+1; j < size; j++) {
- String a = (String) list.get(i);
- String aa = (String) categories.get(a);
- String b = (String) list.get(j);
- String bb = (String) categories.get(b);
- if (aa.compareTo(bb) > 0) {
- list.set(i, b);
- list.set(j, a);
- }
- }
- }
- }
-
- /**
- * Sorts a list of sounds, in place.
- *
- * @param sounds java.util.List
- */
- protected void sortSounds(List sounds) {
- int size = sounds.size();
- if (size < 2)
- return;
-
- for (int i = 0; i < size - 1; i++) {
- for (int j = i+1; j < size; j++) {
- Sound a = (Sound) sounds.get(i);
- Sound b = (Sound) sounds.get(j);
- if (a.getName().compareTo(b.getName()) > 0) {
- sounds.set(i, b);
- sounds.set(j, a);
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioTableLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioTableLabelProvider.java
deleted file mode 100644
index a65fceeed..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/AudioTableLabelProvider.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.audio;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.core.runtime.*;
-import java.net.URL;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-/**
- * Audio table label provider.
- */
-class AudioTableLabelProvider implements ITableLabelProvider {
- protected AudioPreferencePage page;
-
- /**
- * AudioTableLabelProvider constructor comment.
- *
- * @param page the preference page
- */
- public AudioTableLabelProvider(AudioPreferencePage page) {
- super();
- this.page = page;
- }
-
- /**
- * Adds a listener to this label provider.
- * Has no effect if an identical listener is already registered.
- * <p>
- * Label provider listeners are informed about state changes
- * that affect the rendering of the viewer that uses this label provider.
- * </p>
- *
- * @param listener a label provider listener
- */
- public void addListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- /**
- * Disposes of this label provider. When a label provider is
- * attached to a viewer, the viewer will automatically call
- * this method when the viewer is being closed. When label providers
- * are used outside of the context of a viewer, it is the client's
- * responsibility to ensure that this method is called when the
- * provider is no longer needed.
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * @see ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- /*AudioCore core = AudioCore.getInstance();
-
- if (columnIndex == 0) {
- if (element instanceof String) {
- if (element != AudioTableContentProvider.MISC_CATEGORY) {
- if (core.isCategoryEnabled((String) element))
- return ImageResource.getImage(ImageResource.IMG_AUDIO_ENABLED);
- return ImageResource.getImage(ImageResource.IMG_AUDIO_DISABLED);
- }
- return null;
- }
- Sound sound = (Sound) element;
- if (!core.isCategoryEnabled(sound.getCategory()))
- return ImageResource.getImage(ImageResource.IMG_AUDIO_UNAVAILABLE);
- if (core.isSoundEnabled(sound.getId()))
- return ImageResource.getImage(ImageResource.IMG_AUDIO_ENABLED);
- return ImageResource.getImage(ImageResource.IMG_AUDIO_DISABLED);
- } else*/
- if (columnIndex == 1) {
- if (element instanceof String)
- return ImageResource.getImage(ImageResource.IMG_AUDIO_CATEGORY);
- return ImageResource.getImage(ImageResource.IMG_AUDIO_SOUND);
- }
- return null;
- }
-
- /**
- * @see ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (columnIndex == 0)
- return "";
-
- if (element instanceof String) {
- String categoryId = (String) element;
- if (columnIndex == 1) {
- if (categoryId.equals(AudioTableContentProvider.MISC_CATEGORY))
- return ""; //(Miscellaneous)";
- Map categories = AudioCore.getInstance().getCategories();
- return (String) categories.get(categoryId);
- }
- return "";
- }
- Sound sound = (Sound) element;
-
- if (columnIndex == 1) {
- String s = sound.getName();
- if (s != null)
- return s;
- return Messages.audioUnknown;
- } else if (columnIndex == 2) {
- IPath path = page.getUserSoundPath(sound.getId());
- if (path != null)
- return path.lastSegment();
-
- URL url = page.getSoundURL(sound.getId());
- if (url == null)
- return Messages.audioNone;
- return Messages.audioDefault;
- }
- return "";
- }
-
- /**
- * Returns whether the label would be affected
- * by a change to the given property of the given element.
- * This can be used to optimize a non-structural viewer update.
- * If the property mentioned in the update does not affect the label,
- * then the viewer need not update the label.
- *
- * @param element the element
- * @param property the property
- * @return <code>true</code> if the label would be affected,
- * and <code>false</code> if it would be unaffected
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * Removes a listener to this label provider.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a label provider listener
- */
- public void removeListener(ILabelProviderListener listener) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/CategoryTableViewer.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/CategoryTableViewer.java
deleted file mode 100644
index 85c7dd735..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/CategoryTableViewer.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.audio;
-
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Widget;
-/**
- *
- */
-public class CategoryTableViewer extends CheckboxTableViewer {
- protected Color color;
-
- public CategoryTableViewer(Table table) {
- super(table);
- createColor(table);
- }
-
- protected void createColor(Control c) {
- color = new Color(c.getDisplay(), 255, 255, 225);
- c.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- color.dispose();
- }
- });
- }
-
- public void doUpdateItem(Widget widget, Object element, boolean fullMap) {
- if (color == null)
- return;
- if (widget instanceof TableItem) {
- TableItem item = (TableItem) widget;
- if (element instanceof String) {
- item.setBackground(color);
- } else
- item.setBackground(null);
- }
- super.doUpdateItem(widget, element, fullMap);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/Sound.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/Sound.java
deleted file mode 100644
index de29438c7..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/Sound.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.audio;
-
-import java.net.URL;
-/**
- * A single sound.
- */
-class Sound {
- protected String id;
- protected String name;
- public URL location;
- protected String category;
-
- /**
- * Sound constructor comment.
- */
- public Sound() {
- super();
- }
-
- /**
- * Sound constructor comment.
- *
- * @param id an id
- * @param category a category
- * @param name a name
- * @param loc location
- */
- public Sound(String id, String category, String name, URL loc) {
- super();
-
- this.id = id;
- this.category = category;
- this.name = name;
- this.location = loc;
- }
-
- /**
- *
- * @return org.eclipse.audio.Category
- */
- public String getCategory() {
- return category;
- }
-
- /**
- *
- * @return java.lang.String
- */
- public String getId() {
- return id;
- }
-
- /**
- *
- * @return java.net.URL
- */
- public URL getLocation() {
- return location;
- }
-
- /**
- *
- * @return java.lang.String
- */
- public String getName() {
- return name;
- }
-
- /**
- *
- * @param newCategory org.eclipse.audio.Category
- */
- public void setCategory(String newCategory) {
- category = newCategory;
- }
-
- /**
- *
- * @param newId java.lang.String
- */
- public void setId(String newId) {
- id = newId;
- }
-
- /**
- *
- * @param newLocation java.net.URL
- */
- public void setLocation(URL newLocation) {
- location = newLocation;
- }
-
- /**
- *
- * @param newName java.lang.String
- */
- public void setName(String newName) {
- name = newName;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/XMLMemento.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/XMLMemento.java
deleted file mode 100644
index de3c1deae..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/audio/XMLMemento.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.audio;
-
-import java.io.*;
-import java.util.*;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.ui.IMemento;
-/**
- * A Memento is a class independent container for persistence
- * info. It is a reflection of 3 storage requirements.
- *
- * 1) We need the ability to persist an object and restore it.
- * 2) The class for an object may be absent. If so we would
- * like to skip the object and keep reading.
- * 3) The class for an object may change. If so the new class
- * should be able to read the old persistence info.
- *
- * We could ask the objects to serialize themselves into an
- * ObjectOutputStream, DataOutputStream, or Hashtable. However
- * all of these approaches fail to meet the second requirement.
- *
- * Memento supports binary persistance with a version ID.
- */
-public final class XMLMemento implements IMemento {
- private Document factory;
- private Element element;
-
- /**
- * Answer a memento for the document and element. For simplicity
- * you should use createReadRoot and createWriteRoot to create the initial
- * mementos on a document.
- */
- private XMLMemento(Document doc, Element el) {
- factory = doc;
- element = el;
- }
-
- /*
- * @see IMemento
- */
- public IMemento createChild(String type) {
- Element child = factory.createElement(type);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
-
- /*
- * @see IMemento
- */
- public IMemento createChild(String type, String id) {
- Element child = factory.createElement(type);
- child.setAttribute(TAG_ID, id);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
-
- /**
- * Create a Document from a Reader and answer a root memento for reading
- * a document.
- */
- protected static XMLMemento createReadRoot(Reader reader) {
- Document document = null;
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- document = parser.parse(new InputSource(reader));
- Node node = document.getFirstChild();
- if (node instanceof Element)
- return new XMLMemento(document, (Element) node);
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- /**
- * Answer a root memento for writing a document.
- *
- * @param type a type
- * @return a memento
- */
- public static XMLMemento createWriteRoot(String type) {
- Document document;
- try {
- document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
- Element element = document.createElement(type);
- document.appendChild(element);
- return new XMLMemento(document, element);
- } catch (ParserConfigurationException e) {
- throw new Error(e);
- }
- }
-
- /*
- * @see IMemento
- */
- public IMemento getChild(String type) {
-
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return null;
-
- // Find the first node which is a child of this node.
- for (int nX = 0; nX < size; nX ++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element2 = (Element)node;
- if (element2.getNodeName().equals(type))
- return new XMLMemento(factory, element2);
- }
- }
-
- // A child was not found.
- return null;
- }
-
- /*
- * @see IMemento
- */
- public IMemento [] getChildren(String type) {
-
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return new IMemento[0];
-
- // Extract each node with given type.
- ArrayList list = new ArrayList(size);
- for (int nX = 0; nX < size; nX ++) {
- Node node = nodes.item(nX);
- if (node instanceof Element) {
- Element element2 = (Element)node;
- if (element2.getNodeName().equals(type))
- list.add(element2);
- }
- }
-
- // Create a memento for each node.
- size = list.size();
- IMemento [] results = new IMemento[size];
- for (int x = 0; x < size; x ++) {
- results[x] = new XMLMemento(factory, (Element)list.get(x));
- }
- return results;
- }
-
- /*
- * @see IMemento
- */
- public Float getFloat(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Float(strValue);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- /*
- * @see IMemento
- */
- public String getID() {
- return element.getAttribute(TAG_ID);
- }
-
- /*
- * @see IMemento
- */
- public Integer getInteger(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Integer(strValue);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-
- /*
- * @see IMemento
- */
- public String getString(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- return attr.getValue();
- }
-
- /**
- * Loads a memento from the given filename.
- *
- * @param in java.io.InputStream
- * @return org.eclipse.ui.IMemento
- */
- public static IMemento loadMemento(InputStream in) {
- Document document = null;
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- document = parser.parse(in);
- Node node = document.getFirstChild();
- if (node instanceof Element)
- return new XMLMemento(document, (Element) node);
- } catch (Exception e) {
- // ignore
- } finally {
- try {
- in.close();
- } catch (Exception e) {
- // ignore
- }
- }
- return null;
- }
-
- /*
- * @see IMemento
- */
- private void putElement(Element element2) {
- NamedNodeMap nodeMap = element2.getAttributes();
- int size = nodeMap.getLength();
- for (int i = 0; i < size; i++){
- Attr attr = (Attr)nodeMap.item(i);
- putString(attr.getName(),attr.getValue());
- }
-
- NodeList nodes = element2.getChildNodes();
- size = nodes.getLength();
- for (int i = 0; i < size; i ++) {
- Node node = nodes.item(i);
- if (node instanceof Element) {
- XMLMemento child = (XMLMemento)createChild(node.getNodeName());
- child.putElement((Element)node);
- }
- }
- }
-
- /*
- * @see IMemento
- */
- public void putFloat(String key, float f) {
- element.setAttribute(key, String.valueOf(f));
- }
-
- /*
- * @see IMemento
- */
- public void putInteger(String key, int n) {
- element.setAttribute(key, String.valueOf(n));
- }
-
- /*
- * @see IMemento
- */
- public void putMemento(IMemento memento) {
- XMLMemento xmlMemento = (XMLMemento) memento;
- putElement(xmlMemento.element);
- }
-
- /*
- * @see IMemento
- */
- public void putString(String key, String value) {
- if (value == null)
- return;
- element.setAttribute(key, value);
- }
-
- /**
- * Save this Memento to a Writer.
- */
- protected void save(OutputStream os) throws IOException {
- Result result = new StreamResult(os);
- Source source = new DOMSource(factory);
- try {
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
- transformer.transform(source, result);
- }
- catch (TransformerConfigurationException e) {
- throw (IOException) (new IOException().initCause(e));
- }
- catch (TransformerException e) {
- throw (IOException) (new IOException().initCause(e));
- }
- }
-
- /**
- * Returns the data of the Text node of the memento. Each memento is allowed
- * only one Text node.
- *
- * @return the data of the Text node of the memento, or <code>null</code>
- * if the memento has no Text node.
- */
- public String getTextData() {
- return null;
- }
-
- /**
- * Sets the memento's Text node to contain the given data. Creates the Text node if
- * none exists. If a Text node does exist, it's current contents are replaced.
- * Each memento is allowed only one text node.
- *
- * @param data the data to be placed on the Text node
- */
- public void putTextData(String data) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/ServerCommand.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/ServerCommand.java
deleted file mode 100644
index 865391522..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/ServerCommand.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.command;
-
-import org.eclipse.core.commands.operations.AbstractOperation;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-/**
- * A command on a server.
- */
-public abstract class ServerCommand extends AbstractOperation {
- protected IServerWorkingCopy server;
-
- /**
- * ServerCommand constructor.
- *
- * @param server a server
- * @param name a label
- */
- public ServerCommand(IServerWorkingCopy server, String name) {
- super(name);
- this.server = server;
- }
-
- public abstract void execute();
-
- public IStatus execute(IProgressMonitor monitor, IAdaptable adapt) {
- execute();
- return null;
- }
-
- public abstract void undo();
-
- public IStatus undo(IProgressMonitor monitor, IAdaptable adapt) {
- undo();
- return null;
- }
-
- public IStatus redo(IProgressMonitor monitor, IAdaptable adapt) {
- return execute(monitor, adapt);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerAutoPublishDefaultCommand.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerAutoPublishDefaultCommand.java
deleted file mode 100644
index ffec80f0d..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerAutoPublishDefaultCommand.java
+++ /dev/null
@@ -1,50 +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.server.ui.internal.command;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Command to change the server's auto-publish setting.
- */
-public class SetServerAutoPublishDefaultCommand extends ServerCommand {
- protected int setting;
- protected int oldSetting;
-
- /**
- * SetServerAutoPublishDefaultCommand constructor.
- *
- * @param server a server
- * @param setting the auto-publish setting
- */
- public SetServerAutoPublishDefaultCommand(IServerWorkingCopy server, int setting) {
- super(server, Messages.serverEditorOverviewAutoPublishCommand);
- this.setting = setting;
- }
-
- /**
- * Execute the command.
- */
- public void execute() {
- ServerWorkingCopy swc = (ServerWorkingCopy) server;
- oldSetting = swc.getAutoPublishSetting();
- swc.setAutoPublishSetting(setting);
- }
-
- /**
- * Undo the command.
- */
- public void undo() {
- ServerWorkingCopy swc = (ServerWorkingCopy) server;
- swc.setAutoPublishSetting(oldSetting);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerAutoPublishTimeCommand.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerAutoPublishTimeCommand.java
deleted file mode 100644
index e1b3c9a0e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerAutoPublishTimeCommand.java
+++ /dev/null
@@ -1,50 +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.server.ui.internal.command;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Command to change the server's auto-publish setting.
- */
-public class SetServerAutoPublishTimeCommand extends ServerCommand {
- protected int time;
- protected int oldTime;
-
- /**
- * SetServerAutoPublishDefaultCommand constructor.
- *
- * @param server a server
- * @param time a publish time
- */
- public SetServerAutoPublishTimeCommand(IServerWorkingCopy server, int time) {
- super(server, Messages.serverEditorOverviewAutoPublishCommand);
- this.time = time;
- }
-
- /**
- * Execute the command.
- */
- public void execute() {
- ServerWorkingCopy swc = (ServerWorkingCopy) server;
- oldTime = swc.getAutoPublishTime();
- swc.setAutoPublishTime(time);
- }
-
- /**
- * Undo the command.
- */
- public void undo() {
- ServerWorkingCopy swc = (ServerWorkingCopy) server;
- swc.setAutoPublishTime(oldTime);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerConfigurationFolderCommand.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerConfigurationFolderCommand.java
deleted file mode 100644
index 931bb617d..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerConfigurationFolderCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.command;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Command to change the server configuration folder.
- */
-public class SetServerConfigurationFolderCommand extends ServerCommand {
- protected IFolder folder;
- protected IFolder oldFolder;
-
- /**
- * SetServerConfigurationFolderCommand constructor.
- *
- * @param server a server
- * @param folder a new server configuration location
- */
- public SetServerConfigurationFolderCommand(IServerWorkingCopy server, IFolder folder) {
- super(server, Messages.serverEditorOverviewServerHostnameCommand);
- this.folder = folder;
- }
-
- /**
- * Execute the command.
- */
- public void execute() {
- oldFolder = server.getServerConfiguration();
- server.setServerConfiguration(folder);
- }
-
- /**
- * Undo the command.
- */
- public void undo() {
- server.setServerConfiguration(oldFolder);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerHostnameCommand.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerHostnameCommand.java
deleted file mode 100644
index 158bd8412..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerHostnameCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.command;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Command to change the server hostname.
- */
-public class SetServerHostnameCommand extends ServerCommand {
- protected String name;
- protected String oldName;
-
- /**
- * SetServerHostnameCommand constructor.
- *
- * @param server a server
- * @param name a hostname or IP address
- */
- public SetServerHostnameCommand(IServerWorkingCopy server, String name) {
- super(server, Messages.serverEditorOverviewServerHostnameCommand);
- this.name = name;
- }
-
- /**
- * Execute the command.
- */
- public void execute() {
- oldName = server.getHost();
- server.setHost(name);
- }
-
- /**
- * Undo the command.
- */
- public void undo() {
- server.setHost(oldName);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerNameCommand.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerNameCommand.java
deleted file mode 100644
index 7ba416f57..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerNameCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.command;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Command to change the server name.
- */
-public class SetServerNameCommand extends ServerCommand {
- protected String name;
- protected String oldName;
-
- /**
- * SetServerNameCommand constructor.
- *
- * @param server a server
- * @param name a name for the server
- */
- public SetServerNameCommand(IServerWorkingCopy server, String name) {
- super(server, Messages.serverEditorOverviewServerNameCommand);
- this.name = name;
- }
-
- /**
- * Execute the command.
- */
- public void execute() {
- oldName = server.getName();
- server.setName(name);
- }
-
- /**
- * Undo the command.
- */
- public void undo() {
- server.setName(oldName);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerRuntimeCommand.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerRuntimeCommand.java
deleted file mode 100644
index 70c9a06e7..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/command/SetServerRuntimeCommand.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.command;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Command to change the server runtime.
- */
-public class SetServerRuntimeCommand extends ServerCommand {
- protected IRuntime runtime;
- protected IRuntime oldRuntime;
-
- /**
- * SetServerRuntimeCommand constructor.
- *
- * @param server a server
- * @param runtime a server runtime
- */
- public SetServerRuntimeCommand(IServerWorkingCopy server, IRuntime runtime) {
- super(server, Messages.serverEditorOverviewRuntimeCommand);
- this.runtime = runtime;
- }
-
- /**
- * Execute the command.
- */
- public void execute() {
- oldRuntime = server.getRuntime();
- server.setRuntime(runtime);
- }
-
- /**
- * Undo the command.
- */
- public void undo() {
- server.setRuntime(oldRuntime);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java
deleted file mode 100644
index bfa2e0cce..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/GlobalCommandManager.java
+++ /dev/null
@@ -1,695 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-/**
- *
- */
-public class GlobalCommandManager {
- // maximum number of commands in the history
- private static final int MAX_HISTORY = 200;
-
- class ServerResourceCommand {
- IUndoableOperation command;
- String id;
- }
-
- // commands in the undo history
- protected List undoList = new ArrayList();
-
- // commands in the redo history
- protected List redoList = new ArrayList();
-
- class CommandManagerInfo {
- // number of open editors on this resource
- int count;
-
- // true if the resource has not been saved since
- // the last change
- boolean isDirty;
-
- // true if the resource is read-only
- boolean isReadOnly;
-
- // true if all changes can be undone, false if
- // a non-reversable change has been made
- boolean canCompletelyUndo = true;
-
- // the element id
- String id;
-
- // the working copy
- IServerWorkingCopy wc;
-
- // files and timestamps
- Map fileMap;
-
- int timestamp;
- }
-
- protected Map commandManagers = new HashMap();
-
- // property change listeners
- protected List propertyListeners;
- public static final String PROP_DIRTY = "dirtyState";
- public static final String PROP_UNDO = "undoAction";
- public static final String PROP_REDO = "redoAction";
- public static final String PROP_RELOAD = "reload";
-
- protected static GlobalCommandManager instance;
-
- public static GlobalCommandManager getInstance() {
- if (instance == null)
- instance = new GlobalCommandManager();
- return instance;
- }
-
- /**
- * Add a property change listener to this instance.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- if (propertyListeners == null)
- propertyListeners = new ArrayList();
- propertyListeners.add(listener);
- }
-
- /**
- * Remove a property change listener from this instance.
- *
- * @param listener java.beans.PropertyChangeListener
- */
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- if (propertyListeners != null)
- propertyListeners.remove(listener);
- }
-
- /**
- * Fire a property change event.
- */
- protected void firePropertyChangeEvent(String propertyName, Object oldValue, Object newValue) {
- if (propertyListeners == null)
- return;
-
- PropertyChangeEvent event = new PropertyChangeEvent(this, propertyName, oldValue, newValue);
- //Trace.trace("Firing: " + event + " " + oldValue);
- try {
- int size = propertyListeners.size();
- PropertyChangeListener[] pcl = new PropertyChangeListener[size];
- propertyListeners.toArray(pcl);
-
- for (int i = 0; i < size; i++)
- try {
- pcl[i].propertyChange(event);
- } catch (Exception e) {
- // ignore
- }
- } catch (Exception e) {
- // ignore
- }
- }
-
- /**
- * Get the command manager for a given id.
- *
- * @param id an id
- */
- public void getCommandManager(String id) {
- Trace.trace(Trace.FINEST, "Getting command manager for " + id);
- try {
- CommandManagerInfo info = (CommandManagerInfo) commandManagers.get(id);
- if (info != null) {
- info.count ++;
- return;
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not find existing command manager", e);
- }
- Trace.trace(Trace.FINEST, "Creating new command manager for " + id);
- try {
- CommandManagerInfo info = new CommandManagerInfo();
- info.count = 1;
- info.id = id;
- IServer server = null;
- if (id != null)
- server = ServerCore.findServer(id);
- if (server != null)
- info.wc = server.createWorkingCopy();
- info.isDirty = false;
- info.isReadOnly = false;
- commandManagers.put(id, info);
- updateTimestamps(id);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not obtain command manager", e);
- }
- return;
- }
-
- /**
- * Release the command manager for a given id.
- *
- * @param id an id
- */
- public void releaseCommandManager(String id) {
- Trace.trace(Trace.FINEST, "Releasing command manager for " + id);
- try {
- CommandManagerInfo info = (CommandManagerInfo) commandManagers.get(id);
- if (info != null) {
- info.count --;
- if (info.count == 0) {
- commandManagers.remove(id);
- clearUndoList(id);
- clearRedoList(id);
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not release command manager", e);
- }
- }
-
- /**
- * Reload the command manager for a given id.
- *
- * @param id an id
- * @param monitor a progress monitor
- */
- public void reload(String id, IProgressMonitor monitor) {
- try {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info != null) {
- IServer server = null;
- if (id != null)
- server = ServerCore.findServer(id);
- if (server != null)
- info.wc = server.createWorkingCopy();
- //info.serverElement = ServerCore.getResourceManager().getServer()
- //info.serverElement = ServerCore.getEditManager().reloadEditModel(info.file, monitor);
- firePropertyChangeEvent(PROP_RELOAD, id, null);
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not release command manager", e);
- }
- }
-
- /**
- *
- */
- protected CommandManagerInfo getExistingCommandManagerInfo(String id) {
- try {
- return (CommandManagerInfo) commandManagers.get(id);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not find existing command manager info");
- }
- return null;
- }
-
- /**
- * Returns true if there is only one command manager.
- *
- * @param id an id
- * @return <code>true</code> if the only command manager
- */
- public boolean isOnlyCommandManager(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- return (info != null && info.count == 1);
- }
-
- protected IServerEditorPartInput getPartInput(String serverId, ServerResourceCommandManager serverCommandManager) {
- CommandManagerInfo serverInfo = null;
- IServerWorkingCopy server = null;
- boolean serverReadOnly = false;
- if (serverId != null) {
- serverInfo = getExistingCommandManagerInfo(serverId);
- if (serverInfo == null)
- return null;
-
- server = serverInfo.wc;
- serverReadOnly = serverInfo.isReadOnly;
- }
-
- return new ServerEditorPartInput(serverCommandManager, server, serverReadOnly);
- }
-
- /**
- *
- */
- protected IServerWorkingCopy getServerResource(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return null;
-
- return info.wc;
- }
-
- /**
- * Execute the given command and place it in the undo stack.
- * If the command cannot be undone, the user will be notifed
- * before it is executed.
- *
- * @param id an id
- * @param command a task
- */
- public void executeCommand(String id, IUndoableOperation command) {
- if (!command.canUndo() && !undoList.isEmpty() && ServerUIPlugin.getPreferences().getPromptBeforeIrreversibleChange()) {
- try {
- Display d = Display.getCurrent();
- if (d == null)
- d = Display.getDefault();
-
- Shell shell = d.getActiveShell();
- if (!MessageDialog.openConfirm(shell, Messages.editorServerEditor, Messages.editorPromptIrreversible))
- return;
- } catch (Exception e) {
- // ignore
- }
- }
-
- ServerResourceCommand src = new ServerResourceCommand();
- src.id = id;
- src.command = command;
-
- try {
- command.execute(new NullProgressMonitor(), null);
- } catch (ExecutionException ce) {
- return;
- }
-
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return;
-
- if (command.canUndo())
- addToUndoList(src);
- else {
- info.canCompletelyUndo = false;
- clearUndoList(id);
- }
-
- // clear redo list since a new command has been executed.
- clearRedoList(id);
-
- setDirtyState(id, true);
- }
-
- /**
- * Add a command to the history.
- */
- private void addToUndoList(ServerResourceCommand src) {
- undoList.add(src);
-
- // limit history growth
- if (undoList.size() > MAX_HISTORY)
- undoList.remove(0);
-
- firePropertyChangeEvent(PROP_UNDO, src.id, null);
- }
-
- /**
- * Clears the undo of a particular resource.
- */
- private void clearUndoList(String id) {
- int i = 0;
- boolean modified = false;
- while (i < undoList.size()) {
- ServerResourceCommand src = (ServerResourceCommand) undoList.get(i);
- if (src.id.equals(id)) {
- modified = true;
- undoList.remove(i);
- } else
- i++;
- }
- if (modified)
- firePropertyChangeEvent(PROP_UNDO, id, null);
- }
-
- /**
- * Clears the redo of a particular resource.
- */
- private void clearRedoList(String id) {
- int i = 0;
- boolean modified = false;
- while (i < redoList.size()) {
- ServerResourceCommand src = (ServerResourceCommand) redoList.get(i);
- if (src.id.equals(id)) {
- redoList.remove(i);
- modified = true;
- } else
- i++;
- }
- if (modified)
- firePropertyChangeEvent(PROP_REDO, id, null);
- }
-
- /**
- * Returns true if there is a command that can be undone.
- * @return boolean
- */
- protected boolean canUndo(String a, String b) {
- Iterator iterator = undoList.iterator();
- while (iterator.hasNext()) {
- ServerResourceCommand src = (ServerResourceCommand) iterator.next();
- if (src.id == a || src.id == b)
- return true;
- }
- return false;
- }
-
- /**
- * Returns true if there is a command that can be redone.
- * @return boolean
- */
- protected boolean canRedo(String a, String b) {
- Iterator iterator = redoList.iterator();
- while (iterator.hasNext()) {
- ServerResourceCommand src = (ServerResourceCommand) iterator.next();
- if (src.id == a || src.id == b)
- return true;
- }
- return false;
- }
-
- /**
- * Returns the command that would be undone next.
- *
- * @param a an id
- * @return a task
- */
- public IUndoableOperation getUndoCommand(String a) {
- int size = undoList.size();
- for (int i = size - 1; i >= 0; i--) {
- ServerResourceCommand src = (ServerResourceCommand) undoList.get(i);
- if (src.id == a)
- return src.command;
- }
- return null;
- }
-
- /**
- * Returns the command that would be redone next.
- *
- * @param a an id
- * @return a task
- */
- public IUndoableOperation getRedoCommand(String a) {
- int size = redoList.size();
- for (int i = size - 1; i >= 0; i--) {
- ServerResourceCommand src = (ServerResourceCommand) redoList.get(i);
- if (src.id == a)
- return src.command;
- }
- return null;
- }
-
- /**
- * Returns true if the server resource is "dirty".
- *
- * @param id an id
- * @return a task
- */
- public boolean isDirty(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return false;
-
- return info.isDirty;
- }
-
- /**
- * Returns true if the server resource is read-only.
- *
- * @param id an id
- * @return boolean
- */
- public boolean isReadOnly(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return false;
- return info.isReadOnly;
- }
-
- /**
- * Sets the server resource read-only flag.
- *
- * @param id an id
- * @param readOnly <code>true</code> to set read-only, <code>false</code> otherwise
- */
- public void setReadOnly(String id, boolean readOnly) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return;
-
- if (info.isReadOnly == readOnly)
- return;
- info.isReadOnly = readOnly;
- firePropertyChangeEvent(PROP_RELOAD, id, null);
- }
-
- /**
- * Returns true if the server resource files are read-only.
- *
- * @param id an id
- * @return <code>true</code> if the files are read-only
- */
- public boolean areFilesReadOnly(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return false;
- return (getReadOnlyFiles(id).length > 0);
- }
-
- /**
- * Sets the dirty state and fires an event if needed.
- * @param dirty boolean
- */
- private void setDirtyState(String id, boolean dirty) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info.isDirty == dirty)
- return;
-
- info.isDirty = dirty;
- firePropertyChangeEvent(PROP_DIRTY, id, null);
- }
-
- /**
- * Undo the last command.
- */
- protected void undo(String a) {
- ServerResourceCommand src = null;
- Iterator iterator = undoList.iterator();
- while (iterator.hasNext()) {
- ServerResourceCommand src2 = (ServerResourceCommand) iterator.next();
- if (src2.id == a)
- src = src2;
- }
- if (src == null)
- return;
-
- try {
- src.command.undo(null, null);
- } catch (ExecutionException ee) {
- // do something
- }
- undoList.remove(src);
- firePropertyChangeEvent(PROP_UNDO, src.id, null);
- redoList.add(src);
- firePropertyChangeEvent(PROP_REDO, src.id, null);
-
- CommandManagerInfo info = getExistingCommandManagerInfo(src.id);
- if (info.canCompletelyUndo && getUndoCommand(src.id) == null)
- setDirtyState(src.id, false);
- }
-
- /**
- * Redo the last command.
- */
- protected void redo(String a) {
- ServerResourceCommand src = null;
- Iterator iterator = redoList.iterator();
- while (iterator.hasNext()) {
- ServerResourceCommand src2 = (ServerResourceCommand) iterator.next();
- if (src2.id == a)
- src = src2;
- }
- if (src == null)
- return;
-
- try {
- src.command.execute(new NullProgressMonitor(), null);
- } catch (ExecutionException ce) {
- return;
- }
- redoList.remove(src);
- firePropertyChangeEvent(PROP_REDO, src.id, null);
- undoList.add(src);
- firePropertyChangeEvent(PROP_UNDO, src.id, null);
-
- setDirtyState(src.id, true);
- }
-
- /**
- * Clears the history list.
- *
- * @param id an id
- */
- public void resourceSaved(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- //clearUndoList(resource);
- //clearRedoList(resource);
- info.canCompletelyUndo = true;
- setDirtyState(id, false);
- }
-
- /**
- * Return an array of read-only files.
- *
- * @param server a server
- * @return a possibly empty array of files
- */
- public static IFile[] getReadOnlyFiles(IServerAttributes server) {
- try {
- List list = new ArrayList();
- IFile file = ((Server)server).getFile();
-
- if (file != null)
- list.add(file);
-
- //if ()
- //IServerConfiguration config = (IServerConfiguration) element;
- // TODO: get read-only files
- IFile[] files = new IFile[list.size()];
- list.toArray(files);
- return files;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "getReadOnlyFiles", e);
- }
- return null;
- }
-
- /**
- *
- */
- protected IFile[] getServerResourceFiles(String id) {
- if (id == null)
- return new IFile[0];
-
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return new IFile[0];
-
- return getReadOnlyFiles(info.wc);
- }
-
- protected IFile[] getReadOnlyFiles(String id) {
- List list = new ArrayList();
- IFile[] files = getServerResourceFiles(id);
- int size = files.length;
- for (int i = 0; i < size; i++) {
- if (files[i].isReadOnly())
- list.add(files[i]);
- }
-
- IFile[] fileList = new IFile[list.size()];
- list.toArray(fileList);
- return fileList;
- }
-
- /**
- * Update the timestamps.
- *
- * @param id an id
- */
- public void updateTimestamps(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return;
-
- info.fileMap = new HashMap();
- IFile[] files = getServerResourceFiles(id);
- if (files != null) {
- int size = files.length;
-
- for (int i = 0; i < size; i++) {
- if (files[i] != null) {
- File f = files[i].getLocation().toFile();
- if (f != null) {
- long time = f.lastModified();
- info.fileMap.put(files[i], new Long(time));
- }
- }
- }
- }
- info.timestamp = getTimestamp(info);
- }
-
- protected static int getTimestamp(CommandManagerInfo info) {
- IServer server = info.wc.getOriginal();
-
- if (server != null)
- return ((Server)server).getTimestamp();
- return -1;
- }
-
- /**
- *
- */
- protected boolean hasChanged(String id) {
- CommandManagerInfo info = getExistingCommandManagerInfo(id);
- if (info == null)
- return false;
- IFile[] files = getServerResourceFiles(id);
- int size = files.length;
-
- int count = 0;
- for (int i = 0; i < size; i++) {
- count++;
- File f = files[i].getLocation().toFile();
- try {
- Long time = (Long) info.fileMap.get(files[i]);
- if (time.longValue() != f.lastModified())
- return true;
- } catch (Exception e) {
- return true;
- }
- }
-
- int timestamp = getTimestamp(info);
- if (info.timestamp != timestamp)
- return true;
-
- if (count != info.fileMap.size())
- return true;
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IOrdered.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IOrdered.java
deleted file mode 100644
index 8872f8bd8..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IOrdered.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-/**
- * An object that has an absolute ordering, and can be ordered against other objects.
- *
- * <p>
- * [issue: It is notoriously difficult to place any kind of
- * useful order on objects that are contributed independently by
- * non-collaborating parties. The IOrdered mechanism is weak, and
- * can't really solve the problem. Issues of presentation are usually
- * best left to the UI, which can sort objects based on arbitrary
- * properties.]
- * </p>
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IOrdered {
- /**
- * Returns the order (index/priority).
- *
- * @return int
- */
- public int getOrder();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorActionFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorActionFactory.java
deleted file mode 100644
index 41791ecf6..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorActionFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.IEditorSite;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
-/**
- *
- */
-public interface IServerEditorActionFactory extends IOrdered {
- /**
- * Returns the id.
- *
- * @return an id
- */
- public String getId();
-
- /**
- * Returns the name.
- *
- * @return a name
- */
- public String getName();
-
- /**
- * Returns true if the given server resource type (given by the
- * id) can be opened with this editor. This result is based on
- * the result of the getFactoryIds() method.
- *
- * @param id an id
- * @return boolean
- */
- public boolean supportsServerElementType(String id);
-
- /**
- * Returns true if this editor page should be visible with the given server.
- * This allows (for instance) complex configuration pages to only be shown when used
- * with non-unittest servers.
- *
- * @param server a server
- * @return <code>true</code> if the action should display
- */
- public boolean shouldDisplay(IServerWorkingCopy server);
-
- /**
- * Create the action.
- *
- * @param site an editor site
- * @param input a server editor input
- * @return an action
- */
- public IAction createAction(IEditorSite site, IServerEditorPartInput input);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorInput.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorInput.java
deleted file mode 100644
index 61ec8d9eb..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorInput.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.ui.IEditorInput;
-/**
- * This is the editor input for the server and server
- * configuration editor. The input includes both a server
- * and server configuration.
- *
- * <p>This interface is not intended to be implemented by clients.</p>
- */
-public interface IServerEditorInput extends IEditorInput {
- public static final String EDITOR_ID = ServerUIPlugin.PLUGIN_ID + ".editor";
-
- /**
- * Returns the server id.
- *
- * @return java.lang.String
- */
- public String getServerId();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPageSectionFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPageSectionFactory.java
deleted file mode 100644
index 474385334..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPageSectionFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.ServerEditorSection;
-/**
- *
- */
-public interface IServerEditorPageSectionFactory extends IOrdered {
- /**
- * Returns the id.
- *
- * @return the id
- */
- public String getId();
-
- /**
- * Returns true if the given server resource type (given by the
- * id) can be opened with this editor. This result is based on
- * the result of the types attribute.
- *
- * @param id the type id
- * @return boolean
- */
- public boolean supportsType(String id);
-
- public String getInsertionId();
-
- /**
- * Returns true if this editor page section should be visible with the given server.
- * This allows (for instance) complex configuration pages to only be shown when used
- * with non-unittest servers.
- *
- * @param server a server
- * @return <code>true</code> if the section should be shown, and <code>false</code> otherwise
- */
- public boolean shouldCreateSection(IServerWorkingCopy server);
-
- /**
- * Create the editor page section.
- *
- * @return the section
- */
- public ServerEditorSection createSection();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPartFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPartFactory.java
deleted file mode 100644
index dc601de6e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/IServerEditorPartFactory.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.ui.IEditorPart;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-/**
- *
- */
-public interface IServerEditorPartFactory extends IOrdered {
- /**
- * Returns the id.
- *
- * @return the id
- */
- public String getId();
-
- /**
- * Return the displayable name.
- *
- * @return the name
- */
- public String getName();
-
- /**
- * Returns true if the given server resource type (given by the
- * id) can be opened with this editor. This result is based on
- * the result of the types attribute.
- *
- * @param id a server type id
- * @return <code>true</code> if the type is supported
- */
- public boolean supportsType(String id);
-
- /**
- * Returns true if a given insertion id is supported.
- *
- * @param id
- * @return <code>true</code> if the insertion id is supported
- */
- public boolean supportsInsertionId(String id);
-
- /**
- * Returns true if this editor page should be visible with the given server.
- * This allows (for instance) complex configuration pages to only be shown when used
- * with non-unittest servers.
- *
- * @param server a server
- * @return <code>true</code> if the page should be visible
- */
- public boolean shouldCreatePage(IServerWorkingCopy server);
-
- /**
- * Create the editor page.
- *
- * @return the editor page
- */
- public IEditorPart createPage();
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java
deleted file mode 100644
index af9205310..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/OverviewEditorPart.java
+++ /dev/null
@@ -1,730 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Color;
-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.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.forms.FormColors;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.*;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerType;
-import org.eclipse.wst.server.core.util.SocketUtil;
-import org.eclipse.wst.server.ui.editor.*;
-import org.eclipse.wst.server.ui.internal.ContextIds;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.internal.command.*;
-import org.eclipse.wst.server.ui.internal.wizard.ClosableWizardDialog;
-import org.eclipse.wst.server.ui.internal.wizard.TaskWizard;
-import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- * Server general editor page.
- */
-public class OverviewEditorPart extends ServerEditorPart {
- protected Text serverName;
- protected Text serverConfigurationName;
- protected Text hostname;
- protected Combo runtimeCombo;
- protected Button autoPublishDefault;
- protected Button autoPublishDisable;
- protected Button autoPublishOverride;
- protected Spinner autoPublishTime;
-
- protected Color colorDefault;
- protected Color colorRed;
-
- protected boolean updating;
-
- protected IRuntime[] runtimes;
-
- protected PropertyChangeListener listener;
-
- protected IRuntimeLifecycleListener runtimeListener;
-
- /**
- * OverviewEditorPart constructor comment.
- */
- public OverviewEditorPart() {
- super();
- }
-
- /**
- *
- */
- protected void addChangeListener() {
- listener = new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getPropertyName().equals("configuration-id") && serverConfigurationName != null) {
- IFolder folder = getServer().getServerConfiguration();
- if (folder == null || !folder.exists())
- serverConfigurationName.setForeground(colorRed);
- else
- serverConfigurationName.setForeground(colorDefault);
- }
- validate();
- if (updating)
- return;
- updating = true;
- if (event.getPropertyName().equals("name"))
- updateNames();
- else if (event.getPropertyName().equals("hostname") && hostname != null) {
- hostname.setText((String) event.getNewValue());
- } else if (event.getPropertyName().equals("runtime-id")) {
- String runtimeId = (String) event.getNewValue();
- IRuntime runtime = null;
- if (runtimeId != null)
- runtime = ServerCore.findRuntime(runtimeId);
- if (runtimeCombo != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
- }
- } else if (event.getPropertyName().equals("configuration-id") && serverConfigurationName != null) {
- String path = (String) event.getNewValue();
- serverConfigurationName.setText(path);
- } else if (event.getPropertyName().equals(Server.PROP_AUTO_PUBLISH_TIME)) {
- Integer curAutoPublishTime = (Integer)event.getNewValue();
- autoPublishTime.setSelection(curAutoPublishTime.intValue());
- validate();
- } else if (event.getPropertyName().equals(Server.PROP_AUTO_PUBLISH_SETTING)) {
- Integer autoPublishSetting = (Integer)event.getNewValue();
- int setting = autoPublishSetting.intValue();
- autoPublishDefault.setSelection(setting == Server.AUTO_PUBLISH_DEFAULT);
- autoPublishOverride.setSelection(setting == Server.AUTO_PUBLISH_OVERRIDE);
- autoPublishDisable.setSelection(setting == Server.AUTO_PUBLISH_DISABLE);
- autoPublishTime.setEnabled(setting == Server.AUTO_PUBLISH_OVERRIDE);
- validate();
- }
- updating = false;
- }
- };
- if (server != null)
- server.addPropertyChangeListener(listener);
- }
-
- protected void updateNames() {
- if (serverName != null)
- serverName.setText(server.getName());
- }
-
- /**
- * Creates the SWT controls for this workbench part.
- *
- * @param parent the parent control
- */
- public final void createPartControl(final Composite parent) {
- FormToolkit toolkit = getFormToolkit(parent.getDisplay());
-
- ScrolledForm form = toolkit.createScrolledForm(parent);
- form.setText(Messages.serverEditorOverviewPageTitle);
- form.getBody().setLayout(new GridLayout());
-
- Composite columnComp = toolkit.createComposite(form.getBody());
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- //layout.marginHeight = 10;
- //layout.marginWidth = 10;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 10;
- columnComp.setLayout(layout);
- columnComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- // left column
- Composite leftColumnComp = toolkit.createComposite(columnComp);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 10;
- layout.horizontalSpacing = 0;
- leftColumnComp.setLayout(layout);
- leftColumnComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- createGeneralSection(leftColumnComp, toolkit);
-
- insertSections(leftColumnComp, "org.eclipse.wst.server.editor.overview.left");
-
- // right column
- Composite rightColumnComp = toolkit.createComposite(columnComp);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 10;
- layout.horizontalSpacing = 0;
- rightColumnComp.setLayout(layout);
- rightColumnComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- createAutoPublishSection(rightColumnComp, toolkit);
-
- insertSections(rightColumnComp, "org.eclipse.wst.server.editor.overview.right");
-
- form.reflow(true);
-
- initialize();
- }
-
- protected void createGeneralSection(Composite leftColumnComp, FormToolkit toolkit) {
- Section section = toolkit.createSection(leftColumnComp, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
- section.setText(Messages.serverEditorOverviewGeneralSection);
- section.setDescription(Messages.serverEditorOverviewGeneralDescription);
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- Composite composite = toolkit.createComposite(section);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginHeight = 5;
- layout.marginWidth = 10;
- layout.verticalSpacing = 5;
- layout.horizontalSpacing = 15;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
- whs.setHelp(composite, ContextIds.EDITOR_OVERVIEW_PAGE);
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
-
- // server name
- if (server != null) {
- createLabel(toolkit, composite, Messages.serverEditorOverviewServerName);
-
- serverName = toolkit.createText(composite, server.getName());
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- serverName.setLayoutData(data);
- serverName.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (updating)
- return;
- updating = true;
- execute(new SetServerNameCommand(getServer(), serverName.getText()));
- updating = false;
- }
- });
- whs.setHelp(serverName, ContextIds.EDITOR_SERVER);
-
- // hostname
- createLabel(toolkit, composite, Messages.serverEditorOverviewServerHostname);
-
- hostname = toolkit.createText(composite, server.getHost());
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- hostname.setLayoutData(data);
- hostname.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (updating)
- return;
- updating = true;
- execute(new SetServerHostnameCommand(getServer(), hostname.getText()));
- updating = false;
- }
- });
- whs.setHelp(hostname, ContextIds.EDITOR_HOSTNAME);
- }
-
- // runtime
- if (server != null && server.getServerType() != null && server.getServerType().hasRuntime()) {
- final IRuntime runtime = server.getRuntime();
- createLabel(toolkit, composite, Messages.serverEditorOverviewRuntime);
-
- IRuntimeType runtimeType = server.getServerType().getRuntimeType();
- runtimes = ServerUIPlugin.getRuntimes(runtimeType);
-
- runtimeCombo = new Combo(composite, SWT.READ_ONLY);
- runtimeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- updateRuntimeCombo();
-
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
-
- runtimeCombo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- try {
- if (updating)
- return;
- updating = true;
- IRuntime newRuntime = runtimes[runtimeCombo.getSelectionIndex()];
- execute(new SetServerRuntimeCommand(getServer(), newRuntime));
- updating = false;
- } catch (Exception ex) {
- // ignore
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
- whs.setHelp(runtimeCombo, ContextIds.EDITOR_RUNTIME);
-
- Hyperlink link = toolkit.createHyperlink(composite, Messages.serverEditorOverviewRuntimeEdit, SWT.NONE);
- link.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- editRuntime(runtime);
- }
- });
- link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
-
- // add runtime listener
- runtimeListener = new IRuntimeLifecycleListener() {
- public void runtimeChanged(final IRuntime runtime2) {
- // may be name change of current runtime
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (runtime2.equals(getServer().getRuntime())) {
- try {
- if (updating)
- return;
- updating = true;
- execute(new SetServerRuntimeCommand(getServer(), runtime2));
- updating = false;
- } catch (Exception ex) {
- // ignore
- }
- }
-
- if (runtimeCombo != null) {
- updateRuntimeCombo();
-
- int size2 = runtimes.length;
- for (int i = 0; i < size2; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
- }
- }
- });
- }
-
- public void runtimeAdded(final IRuntime runtime2) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (runtimeCombo != null) {
- updateRuntimeCombo();
-
- int size2 = runtimes.length;
- for (int i = 0; i < size2; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
- }
- }
- });
- }
-
- public void runtimeRemoved(IRuntime runtime2) {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- if (runtimeCombo != null) {
- updateRuntimeCombo();
-
- int size2 = runtimes.length;
- for (int i = 0; i < size2; i++) {
- if (runtimes[i].equals(runtime))
- runtimeCombo.select(i);
- }
- }
- }
- });
- }
- };
-
- ServerCore.addRuntimeLifecycleListener(runtimeListener);
- }
-
- // server configuration path
- if (server != null && server.getServerType().hasServerConfiguration()) {
- createLabel(toolkit, composite, Messages.serverEditorOverviewServerConfigurationPath);
-
- IFolder folder = server.getServerConfiguration();
- if (folder == null)
- serverConfigurationName = toolkit.createText(composite, Messages.elementUnknownName);
- else
- serverConfigurationName = toolkit.createText(composite, "" + server.getServerConfiguration().getFullPath());
- colorDefault = serverConfigurationName.getForeground();
- colorRed = serverConfigurationName.getDisplay().getSystemColor(SWT.COLOR_RED);
- if (folder == null || !folder.exists())
- serverConfigurationName.setForeground(colorRed);
- //if (!server.getServerConfiguration().getFullPath().toFile().exists())
-
- serverConfigurationName.setEditable(false);
- serverConfigurationName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- whs.setHelp(serverConfigurationName, ContextIds.EDITOR_CONFIGURATION);
-
- final IFolder currentFolder = server.getServerConfiguration();
- Button browse = toolkit.createButton(composite, Messages.serverEditorOverviewServerConfigurationBrowse, SWT.PUSH);
- browse.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(serverConfigurationName.getShell(),
- currentFolder, true, Messages.serverEditorOverviewServerConfigurationBrowseMessage);
- dialog.showClosedProjects(false);
-
- if (dialog.open() != Window.CANCEL) {
- Object[] result = dialog.getResult();
- if (result != null && result.length == 1) {
- IPath path = (IPath) result[0];
-
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IResource resource = root.findMember(path);
- if (resource != null && resource instanceof IFolder) {
- IFolder folder2 = (IFolder) resource;
-
- if (updating)
- return;
- updating = true;
- execute(new SetServerConfigurationFolderCommand(getServer(), folder2));
- serverConfigurationName.setText(folder2.getFullPath().toString());
- updating = false;
- }
- }
- }
- }
- });
- browse.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- }
-
- if (server != null) {
- IServerType serverType = server.getServerType();
- if (serverType.supportsLaunchMode(ILaunchManager.RUN_MODE) || serverType.supportsLaunchMode(ILaunchManager.DEBUG_MODE)
- || serverType.supportsLaunchMode(ILaunchManager.PROFILE_MODE)) {
- ILaunchConfigurationType launchType = ((ServerType) serverType).getLaunchConfigurationType();
- if (launchType != null && launchType.isPublic()) {
- final Hyperlink link = toolkit.createHyperlink(composite, Messages.serverEditorOverviewOpenLaunchConfiguration, SWT.NONE);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- link.setLayoutData(data);
- link.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- try {
- ILaunchConfiguration launchConfig = ((Server) getServer()).getLaunchConfiguration(true, null);
- // TODO: use correct launch group
- DebugUITools.openLaunchConfigurationPropertiesDialog(link.getShell(), launchConfig, "org.eclipse.debug.ui.launchGroup.run");
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Could not create launch configuration", ce);
- }
- }
- });
- }
- }
- }
- }
-
- protected void createAutoPublishSection(Composite rightColumnComp, FormToolkit toolkit) {
- Section section = toolkit.createSection(rightColumnComp, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE);
- section.setText(Messages.serverEditorOverviewAutoPublishSection);
- section.setDescription(Messages.serverEditorOverviewAutoPublishDescription);
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- Composite composite = toolkit.createComposite(section);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 5;
- layout.marginWidth = 10;
- layout.verticalSpacing = 5;
- layout.horizontalSpacing = 15;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
- IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
- whs.setHelp(composite, ContextIds.EDITOR_OVERVIEW_PAGE);
- toolkit.paintBordersFor(composite);
- section.setClient(composite);
-
- // auto-publish
- if (server != null) {
- final Server svr = (Server) server;
- int publishSetting = svr.getAutoPublishSetting();
- autoPublishDefault = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishDefault, SWT.RADIO);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- autoPublishDefault.setLayoutData(data);
- autoPublishDefault.setSelection(publishSetting == Server.AUTO_PUBLISH_DEFAULT);
- whs.setHelp(autoPublishDefault, ContextIds.EDITOR_AUTOPUBLISH_DEFAULT);
-
- Hyperlink editDefaults = toolkit.createHyperlink(composite, Messages.serverEditorOverviewAutoPublishDefaultEdit, SWT.NONE);
- editDefaults.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- showPreferencePage();
- }
- });
- editDefaults.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- whs.setHelp(editDefaults, ContextIds.EDITOR_AUTOPUBLISH_DEFAULT);
-
- autoPublishDisable = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishDisable, SWT.RADIO);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- autoPublishDisable.setLayoutData(data);
- autoPublishDisable.setSelection(publishSetting == Server.AUTO_PUBLISH_DISABLE);
- whs.setHelp(autoPublishDisable, ContextIds.EDITOR_AUTOPUBLISH_DISABLE);
-
- autoPublishOverride = toolkit.createButton(composite, Messages.serverEditorOverviewAutoPublishOverride, SWT.RADIO);
- autoPublishOverride.setSelection(publishSetting == Server.AUTO_PUBLISH_OVERRIDE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- autoPublishOverride.setLayoutData(data);
- whs.setHelp(autoPublishOverride, ContextIds.EDITOR_AUTOPUBLISH_OVERRIDE);
-
- final Label autoPublishTimeLabel = toolkit.createLabel(composite, Messages.serverEditorOverviewAutoPublishOverrideInterval);
- data = new GridData();
- data.horizontalIndent = 20;
- autoPublishTimeLabel.setLayoutData(data);
- autoPublishTimeLabel.setEnabled(autoPublishOverride.getSelection());
-
- autoPublishTime = new Spinner(composite, SWT.BORDER);
- autoPublishTime.setMinimum(0);
- autoPublishTime.setMaximum(120);
- autoPublishTime.setSelection(svr.getAutoPublishTime());
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- data.widthHint = 60;
- autoPublishTime.setLayoutData(data);
- autoPublishTime.setEnabled(autoPublishOverride.getSelection());
- whs.setHelp(autoPublishTime, ContextIds.EDITOR_AUTOPUBLISH_OVERRIDE);
-
- autoPublishOverride.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (updating || !autoPublishOverride.getSelection())
- return;
- updating = true;
- execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_OVERRIDE));
- updating = false;
- autoPublishTimeLabel.setEnabled(autoPublishOverride.getSelection());
- autoPublishTime.setEnabled(autoPublishOverride.getSelection());
- validate();
- }
- });
-
- autoPublishDefault.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (updating || !autoPublishDefault.getSelection())
- return;
- updating = true;
- execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_DEFAULT));
- updating = false;
- autoPublishTimeLabel.setEnabled(autoPublishOverride.getSelection());
- autoPublishTime.setEnabled(autoPublishOverride.getSelection());
- validate();
- }
- });
-
- autoPublishDisable.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (updating || !autoPublishDisable.getSelection())
- return;
- updating = true;
- execute(new SetServerAutoPublishDefaultCommand(getServer(), Server.AUTO_PUBLISH_DISABLE));
- updating = false;
- autoPublishTimeLabel.setEnabled(autoPublishOverride.getSelection());
- autoPublishTime.setEnabled(autoPublishOverride.getSelection());
- validate();
- }
- });
-
- autoPublishTime.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (updating)
- return;
- updating = true;
- try {
- execute(new SetServerAutoPublishTimeCommand(getServer(), autoPublishTime.getSelection()));
- } catch (Exception ex) {
- // ignore
- }
- updating = false;
- validate();
- }
- });
- }
- }
-
- protected void editRuntime(IRuntime runtime) {
- IRuntimeWorkingCopy runtimeWorkingCopy = runtime.createWorkingCopy();
- if (showWizard(runtimeWorkingCopy) != Window.CANCEL) {
- try {
- runtimeWorkingCopy.save(false, null);
- } catch (Exception ex) {
- // ignore
- }
- }
- }
-
- protected boolean showPreferencePage() {
- String id = "org.eclipse.wst.server.ui.preferencePage";
- final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getSite().getShell(), id, new String[] { id }, null);
- return (dialog.open() == Window.OK);
- }
-
- protected int showWizard(final IRuntimeWorkingCopy runtimeWorkingCopy) {
- String title = Messages.wizEditRuntimeWizardTitle;
- final WizardFragment fragment2 = ServerUIPlugin.getWizardFragment(runtimeWorkingCopy.getRuntimeType().getId());
- if (fragment2 == null)
- return Window.CANCEL;
-
- TaskModel taskModel = new TaskModel();
- taskModel.putObject(TaskModel.TASK_RUNTIME, runtimeWorkingCopy);
-
- WizardFragment fragment = new WizardFragment() {
- protected void createChildFragments(List list) {
- list.add(fragment2);
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveRuntime(getTaskModel(), monitor);
- }
- });
- }
- };
-
- TaskWizard wizard = new TaskWizard(title, fragment, taskModel);
- wizard.setForcePreviousAndNextButtons(true);
- ClosableWizardDialog dialog = new ClosableWizardDialog(getEditorSite().getShell(), wizard);
- return dialog.open();
- }
-
- protected void updateRuntimeCombo() {
- IRuntimeType runtimeType = server.getServerType().getRuntimeType();
- runtimes = ServerUIPlugin.getRuntimes(runtimeType);
-
- if (SocketUtil.isLocalhost(server.getHost()) && runtimes != null) {
- List runtimes2 = new ArrayList();
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- IRuntime runtime2 = runtimes[i];
- if (!runtime2.isStub())
- runtimes2.add(runtime2);
- }
- runtimes = new IRuntime[runtimes2.size()];
- runtimes2.toArray(runtimes);
- }
-
- int size = runtimes.length;
- String[] items = new String[size];
- for (int i = 0; i < size; i++)
- items[i] = runtimes[i].getName();
-
- runtimeCombo.setItems(items);
- }
-
- protected Label createLabel(FormToolkit toolkit, Composite parent, String text) {
- Label label = toolkit.createLabel(parent, text);
- label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
- return label;
- }
-
- public void dispose() {
- super.dispose();
-
- if (server != null)
- server.removePropertyChangeListener(listener);
-
- if (runtimeListener != null)
- ServerCore.removeRuntimeLifecycleListener(runtimeListener);
- }
-
- /* (non-Javadoc)
- * Initializes the editor part with a site and input.
- */
- public void init(IEditorSite site, IEditorInput input) {
- super.init(site, input);
-
- addChangeListener();
- initialize();
- }
-
- /**
- * Initialize the fields in this editor.
- */
- protected void initialize() {
- if (serverName == null)
- return;
- updating = true;
-
- if (server != null) {
- serverName.setText(server.getName());
- if (readOnly)
- serverName.setEditable(false);
- else
- serverName.setEditable(true);
- }
-
- updating = false;
- validate();
- }
-
- protected void validate() {
- if (server != null && server.getServerType().hasServerConfiguration()) {
- IFolder folder = getServer().getServerConfiguration();
- if (folder == null || !folder.exists()) {
- setErrorMessage(Messages.errorMissingConfiguration);
- return;
- }
- }
-
- if (autoPublishTime.isEnabled() && autoPublishOverride.getSelection()) {
- int i = autoPublishTime.getSelection();
- if (i < 1) {
- setErrorMessage(NLS.bind(Messages.serverEditorOverviewAutoPublishInvalid, "1"));
- return;
- }
- }
-
- setErrorMessage(null);
- }
-
- /*
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- if (serverName != null)
- serverName.setFocus();
- else if (serverConfigurationName != null)
- serverConfigurationName.setFocus();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java
deleted file mode 100644
index 42a8e1396..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditor.java
+++ /dev/null
@@ -1,957 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.MultiPageEditorPart;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.editor.*;
-import org.eclipse.wst.server.ui.internal.*;
-/**
- * A multi-page server resource editor.
- */
-public class ServerEditor extends MultiPageEditorPart {
- /**
- * Internal part and shell activation listener
- */
- class ActivationListener extends ShellAdapter implements IPartListener {
- private IWorkbenchPart fActivePart;
- private boolean fIsHandlingActivation = false;
-
- public void partActivated(IWorkbenchPart part) {
- fActivePart = part;
- handleActivation();
- }
-
- public void partBroughtToTop(IWorkbenchPart part) {
- // do nothing
- }
-
- public void partClosed(IWorkbenchPart part) {
- // do nothing
- }
-
- public void partDeactivated(IWorkbenchPart part) {
- fActivePart = null;
- }
-
- public void partOpened(IWorkbenchPart part) {
- // do nothing
- }
-
- public void shellActivated(ShellEvent e) {
- handleActivation();
- }
-
- private void handleActivation() {
- if (fIsHandlingActivation)
- return;
-
- if (fActivePart == ServerEditor.this) {
- fIsHandlingActivation = true;
- try {
- checkResourceState();
- } finally {
- fIsHandlingActivation= false;
- }
- }
- }
- }
-
- class LifecycleListener implements IServerLifecycleListener {
- public void serverAdded(IServer oldServer) {
- // do nothing
- }
- public void serverChanged(IServer oldServer) {
- // do nothing
- }
- public void serverRemoved(IServer oldServer) {
- if (oldServer.equals(server) && !isDirty())
- closeEditor();
- }
- }
-
- protected IServerWorkingCopy server;
- protected String serverId;
- protected String serverName;
-
- protected GlobalCommandManager commandManager;
-
- protected PropertyChangeListener listener;
-
- protected IAction undoAction;
- protected IAction redoAction;
-
- protected TextAction cutAction;
- protected TextAction copyAction;
- protected TextAction pasteAction;
- protected boolean updatingActions;
-
- protected IAction[] editorActions;
-
- protected java.util.List serverPages;
-
- // on focus change flag
- protected boolean resourceDeleted;
-
- // input given to the contained pages
- protected IServerEditorPartInput editorPartInput;
-
- // status line and status
- protected IStatusLineManager status;
- protected StatusLineContributionItem statusItem;
-
- private ActivationListener activationListener = new ActivationListener();
- protected LifecycleListener resourceListener;
-
- // Used for disabling resource change check when saving through editor.
- protected boolean isSaving = false;
-
- protected static Map pageToFactory = new HashMap();
-
- /**
- * ServerEditor constructor comment.
- */
- public ServerEditor() {
- super();
-
- ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
-
- undoAction = new Action() {
- public void run() {
- getCommandManager().undo(serverId);
- }
- };
- undoAction.setEnabled(false);
- undoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- //undoAction.setHoverImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_HOVER));
- //undoAction.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
-
- redoAction = new Action() {
- public void run() {
- getCommandManager().redo(serverId);
- }
- };
- redoAction.setEnabled(false);
- redoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
- //redoAction.setHoverImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_HOVER));
- //redoAction.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
- }
-
- /**
- * Close the editor correctly.
- */
- protected void closeEditor() {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- getEditorSite().getPage().closeEditor(ServerEditor.this, false);
- }
- });
- }
-
- protected void createActions() {
- List actionList = new ArrayList();
-
- // add server actions
- if (server != null && server.getServerType() != null) {
- Iterator iterator = ServerEditorCore.getServerEditorActionFactories().iterator();
- String id = server.getServerType().getId();
- while (iterator.hasNext()) {
- ServerEditorActionFactory factory = (ServerEditorActionFactory) iterator.next();
- if (factory.supportsServerElementType(id) && factory.shouldDisplay(server))
- actionList.add(factory.createAction(getEditorSite(), editorPartInput));
- }
- }
-
- editorActions = new IAction[actionList.size()];
- actionList.toArray(editorActions);
- }
-
- public static IServerEditorPartFactory getPageFactory(ServerEditorPart part) {
- try {
- return (IServerEditorPartFactory) pageToFactory.get(part);
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- /**
- * Creates the pages of this multi-page editor.
- * <p>
- * Subclasses of <code>MultiPageEditor</code> must implement this method.
- * </p>
- */
- protected void createPages() {
- try {
- int index = 0;
- serverPages = new ArrayList();
-
- // add editor pages
- int pageCount = 0;
-
- String serverTypeId = null;
- if (server != null && server.getServerType() != null)
- serverTypeId = server.getServerType().getId();
-
- Iterator iterator = ServerEditorCore.getServerEditorPageFactories().iterator();
- while (iterator.hasNext()) {
- IServerEditorPartFactory factory = (IServerEditorPartFactory) iterator.next();
- if (serverTypeId != null && factory.supportsType(serverTypeId) && factory.shouldCreatePage(server)) {
- Trace.trace(Trace.FINEST, "Adding page: " + factory.getId() + " " + editorPartInput);
- try {
- IEditorPart page = factory.createPage();
- if (page != null) {
- pageToFactory.put(page, factory);
- index = addPage(page, editorPartInput);
- setPageText(index, factory.getName());
-
- serverPages.add(page);
-
- pageCount ++;
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not display editor page " + factory.getId(), e);
- }
- }
- }
-
- setActivePage(0);
-
- // register for events that might change the cut/copy/paste actions
- int count = getPageCount();
- for (int i = 0; i < count; i++) {
- Control control = getControl(i);
- registerEvents(control);
- }
- updateActions();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error creating server editor pages", e);
- }
- }
-
- public void dispose() {
- if (activationListener != null) {
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.getPartService().removePartListener(activationListener);
- Shell shell = window.getShell();
- if (shell != null && !shell.isDisposed())
- shell.removeShellListener(activationListener);
- activationListener = null;
- }
-
- if (resourceListener != null)
- ServerCore.removeServerLifecycleListener(resourceListener);
-
- if (serverName != null && !server.getName().equals(serverName)) {
- // only prompt if the server is in the workspace or there is a configuration
- if (server.getServerConfiguration() != null || ((Server)server).getFile() != null) {
- String title = Messages.editorServerEditor;
- String message = Messages.editorRenameFiles;
- if (MessageDialog.openQuestion(getEditorSite().getShell(), title, message))
- try {
- ((ServerWorkingCopy)server).renameFiles(null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error renaming server", e);
- }
- }
- }
-
- super.dispose();
- if (commandManager != null)
- commandManager.removePropertyChangeListener(listener);
-
- if (serverId != null)
- commandManager.releaseCommandManager(serverId);
- }
-
- /* (non-Javadoc)
- * Saves the contents of this editor.
- * <p>
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public void doSave(IProgressMonitor monitor) {
- // set the isSaving flag to true
- isSaving = true;
-
- // check pages for errors first
- java.util.List errors = new ArrayList();
- Iterator iterator = serverPages.iterator();
- int count = 0;
- while (iterator.hasNext()) {
- IEditorPart part = (IEditorPart) iterator.next();
- if (part instanceof ServerEditorPart) {
- IStatus[] status2 = ((ServerEditorPart) part).getSaveStatus();
- if (status2 != null) {
- int size = status2.length;
- for (int i = 0; i < size; i++)
- errors.add("[" + getPageText(count) + "] " + status2[i].getMessage());
- }
- }
- count ++;
- }
- if (!errors.isEmpty()) {
- StringBuffer sb = new StringBuffer();
- sb.append(Messages.errorEditorCantSave + "\n");
- iterator = errors.iterator();
- while (iterator.hasNext())
- sb.append("\t" + ((String) iterator.next()) + "\n");
-
- EclipseUtil.openError(getEditorSite().getShell(), sb.toString());
- monitor.setCanceled(true);
- // reset the isSaving flag
- isSaving = false;
- return;
- }
-
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- int ticks = 2000;
- String name = "";
- if (server != null)
- name = server.getName();
- monitor.beginTask(NLS.bind(Messages.savingTask, name), ticks);
- if (server != null)
- ticks /= 2;
-
- if (server != null) {
- server.save(false, ProgressUtil.getSubMonitorFor(monitor, ticks));
- getCommandManager().resourceSaved(serverId);
- commandManager.updateTimestamps(serverId);
- }
-
- ILabelProvider labelProvider = ServerUICore.getLabelProvider();
- if (server != null)
- setPartName(labelProvider.getText(server));
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error saving server editor", e);
-
- monitor.setCanceled(true);
-
- String title = Messages.editorSaveErrorDialog;
- String message = NLS.bind(Messages.editorSaveErrorMessage, e.getLocalizedMessage());
- MessageDialog.openError(getEditorSite().getShell(), title, message);
- } finally {
- monitor.done();
- }
- // reset the isSaving flag
- isSaving = false;
- }
-
- /* (non-Javadoc)
- * Saves the contents of this editor to another object.
- * <p>
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public void doSaveAs() {
- // do nothing
- }
-
- /**
- * Fire a property change event.
- *
- * @param i int
- */
- protected void firePropertyChange(int i) {
- if (i == ServerEditorPart.PROP_ERROR)
- updateStatusError();
- super.firePropertyChange(i);
- }
-
- /**
- * Return the global command manager.
- *
- * @return the global command manager
- */
- public GlobalCommandManager getCommandManager() {
- return commandManager;
- }
-
- /**
- * Return the redo action.
- *
- * @return org.eclipse.jface.action.Action
- */
- public IAction getRedoAction() {
- return redoAction;
- }
-
- /**
- * Return the undo action.
- *
- * @return org.eclipse.jface.action.Action
- */
- public IAction getUndoAction() {
- return undoAction;
- }
-
- /* (non-Javadoc)
- * Sets the cursor and selection state for this editor to the passage defined
- * by the given marker.
- * <p>
- * Subclasses may override. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public void gotoMarker(IMarker marker) {
- // do nothing
- }
-
- /**
- * Update the cut, copy, and paste actions.
- */
- public void updateActionsImpl() {
- if (updatingActions)
- return;
-
- updatingActions = true;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- updatingActions = false;
- updateActions();
- }
- });
- }
-
- /**
- * Update the cut, copy, and paste actions.
- */
- public void updateActions() {
- cutAction.update();
- copyAction.update();
- pasteAction.update();
- }
-
- /**
- * Update the cut, copy, and paste actions.
- */
- protected void updateStatusLine() {
- if (statusItem != null) {
- boolean readOnly = false;
- if (server != null && commandManager.isReadOnly(serverId))
- readOnly = true;
-
- if (readOnly)
- statusItem.setText(Messages.editorReadOnly);
- else
- statusItem.setText(Messages.editorWritable);
- }
-
- if (status != null) {
- StringBuffer sb = new StringBuffer();
- boolean first = true;
- if (server != null) {
- IFile[] files = commandManager.getReadOnlyFiles(serverId);
- for (int i = 0; i < files.length; i++) {
- if (!first)
- sb.append(", ");
- sb.append(files[i].getName());
- first = false;
- }
- }
- /*if (serverConfiguration != null) {
- IFile[] files = commandManager.getReadOnlyFiles(serverConfigurationId);
- for (int i = 0; i < files.length; i++) {
- if (!first)
- sb.append(", ");
- sb.append(files[i].getName());
- first = false;
- }
- }*/
- if (sb.length() > 1)
- status.setMessage(NLS.bind(Messages.editorReadOnlyFiles, sb.toString()));
- else
- status.setMessage("");
- }
- }
-
- /**
- *
- */
- public void updateStatusError() {
- if (status == null)
- return;
-
- String error = null;
- IEditorPart part = getActiveEditor();
- if (part instanceof ServerEditorPart)
- error = ((ServerEditorPart) part).getErrorMessage();
-
- Iterator iterator = serverPages.iterator();
- int count = 0;
- while (error == null && iterator.hasNext()) {
- part = (IEditorPart) iterator.next();
- if (part instanceof ServerEditorPart) {
- error = ((ServerEditorPart) part).getErrorMessage();
- if (error != null)
- error = "[" + getPageText(count) + "] " + error;
- }
- count ++;
- }
- status.setErrorMessage(error);
- }
-
- /**
- *
- */
- protected void pageChange(int newPageIndex) {
- super.pageChange(newPageIndex);
- updateStatusError();
- }
-
- /**
- * Set the status.
- *
- * @param status a status line manager
- * @param item a status contribution item
- */
- public void setStatus(IStatusLineManager status, StatusLineContributionItem item) {
- this.status = status;
- this.statusItem = item;
- updateStatusError();
- }
-
- /**
- * Register for key and traversal events to enable/disable the cut/copy/paste actions.
- */
- protected void registerEvents(Control control) {
- if (control == null)
- return;
-
- if (control instanceof Text || control instanceof Combo) {
- // register the world... any of these actions could cause the state to change
- control.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent event) {
- updateActionsImpl();
- }
- });
- control.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent event) {
- updateActionsImpl();
- }
- public void keyReleased(KeyEvent event) {
- updateActionsImpl();
- }
- });
- control.addMouseListener(new MouseListener() {
- public void mouseDown(MouseEvent event) {
- // do nothing
- }
- public void mouseUp(MouseEvent event) {
- updateActionsImpl();
- }
- public void mouseDoubleClick(MouseEvent event) {
- updateActionsImpl();
- }
- });
- control.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent event) {
- updateActionsImpl();
- }
- public void focusLost(FocusEvent event) {
- updateActionsImpl();
- }
- });
- if (control instanceof Text) {
- Text text = (Text) control;
- text.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- updateActionsImpl();
- }
- });
- text.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- updateActionsImpl();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- updateActionsImpl();
- }
- });
- } else {
- Combo combo = (Combo) control;
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- updateActionsImpl();
- }
- });
- combo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- updateActionsImpl();
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- updateActionsImpl();
- }
- });
- }
- }
-
- if (control instanceof Composite) {
- Control[] children = ((Composite)control).getChildren();
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++)
- registerEvents(children[i]);
- }
- }
- }
-
- /* (non-Javadoc)
- * Initializes the editor part with a site and input.
- * <p>
- * Subclasses of <code>EditorPart</code> must implement this method. Within
- * the implementation subclasses should verify that the input type is acceptable
- * and then save the site and input. Here is sample code:
- * </p>
- * <pre>
- * if (!(input instanceof IFileEditorInput))
- * throw new PartInitException("Invalid Input: Must be IFileEditorInput");
- * setSite(site);
- * setInput(editorInput);
- * </pre>
- */
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- commandManager = GlobalCommandManager.getInstance();
- super.init(site, input);
-
- if (input instanceof IFileEditorInput) {
- IFileEditorInput fei = (IFileEditorInput) input;
- IFile file = fei.getFile();
- if (file != null && file.exists()) {
- IServer server2 = ServerUIPlugin.findServer(file);
- if (server2 != null)
- serverId = server2.getId();
- }
- if (serverId == null)
- throw new PartInitException(NLS.bind(Messages.errorEditor, file.getName()));
- } else if (input instanceof IServerEditorInput) {
- IServerEditorInput sei = (IServerEditorInput) input;
- serverId = sei.getServerId();
- }
-
- if (serverId != null) {
- commandManager.getCommandManager(serverId);
- server = commandManager.getServerResource(serverId);
- }
-
- ILabelProvider labelProvider = ServerUICore.getLabelProvider();
- if (server != null) {
- setPartName(labelProvider.getText(server));
- setTitleImage(labelProvider.getImage(server));
- setTitleToolTip(serverId);
- serverName = server.getName();
- } else
- setPartName("-");
-
- cutAction = new TextAction(site.getShell().getDisplay(), TextAction.CUT_ACTION);
- copyAction = new TextAction(site.getShell().getDisplay(), TextAction.COPY_ACTION);
- pasteAction = new TextAction(site.getShell().getDisplay(), TextAction.PASTE_ACTION);
-
- listener = new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (GlobalCommandManager.PROP_DIRTY.equals(event.getPropertyName())) {
- Object obj = event.getOldValue();
- if (obj == serverId)
- firePropertyChange(PROP_DIRTY);
- } else if (GlobalCommandManager.PROP_UNDO.equals(event.getPropertyName())) {
- Object obj = event.getOldValue();
- if (obj == serverId)
- updateUndoAction();
- } else if (GlobalCommandManager.PROP_REDO.equals(event.getPropertyName())) {
- Object obj = event.getOldValue();
- if (obj == serverId)
- updateRedoAction();
- } else if (GlobalCommandManager.PROP_RELOAD.equals(event.getPropertyName())) {
- Object obj = event.getOldValue();
- if (obj == serverId) {
- server = commandManager.getServerResource(serverId);
- refresh();
- }
- }
- }
- };
- if (server != null && commandManager.isDirty(serverId))
- firePropertyChange(PROP_DIRTY);
-
- commandManager.addPropertyChangeListener(listener);
-
- // create editor input
- ServerResourceCommandManager serverCommandManager = null;
- if (server != null)
- serverCommandManager = new ServerResourceCommandManager(this, serverId, commandManager);
- editorPartInput = commandManager.getPartInput(serverId, serverCommandManager);
-
- createActions();
-
- // add resource listener
- resourceListener = new LifecycleListener();
- ServerCore.addServerLifecycleListener(resourceListener);
-
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- window.getPartService().addPartListener(activationListener);
- window.getShell().addShellListener(activationListener);
- }
-
- /* (non-Javadoc)
- * Returns whether the contents of this editor have changed since the last save
- * operation.
- * <p>
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public boolean isDirty() {
- if (commandManager != null) {
- if (server != null && commandManager.isDirty(serverId))
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * Returns whether the "save as" operation is supported by this editor.
- * <p>
- * Subclasses must override this method to implement the open-save-close lifecycle
- * for an editor. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /**
- * Update the undo action.
- */
- protected void updateUndoAction() {
- IUndoableOperation command = commandManager.getUndoCommand(serverId);
- if (command == null) {
- undoAction.setText(Messages.editorUndoDisabled);
- undoAction.setToolTipText("");
- undoAction.setDescription("");
- undoAction.setEnabled(false);
- } else {
- String text = NLS.bind(Messages.editorUndoEnabled, new Object[] {command.getLabel()});
- undoAction.setText(text);
- undoAction.setToolTipText(command.getLabel());
- undoAction.setDescription(command.getLabel());
- undoAction.setEnabled(true);
- }
- }
-
- /**
- * Update the redo action.
- */
- protected void updateRedoAction() {
- IUndoableOperation command = commandManager.getRedoCommand(serverId);
- if (command == null) {
- redoAction.setText(Messages.editorRedoDisabled);
- redoAction.setToolTipText("");
- redoAction.setDescription("");
- redoAction.setEnabled(false);
- } else {
- String text = NLS.bind(Messages.editorRedoEnabled, new Object[] {command.getLabel()});
- redoAction.setText(text);
- redoAction.setToolTipText(command.getLabel());
- redoAction.setDescription(command.getLabel());
- redoAction.setEnabled(true);
- }
- }
-
- /**
- * Return the cut action.
- *
- * @return org.eclipse.jface.action.IAction
- */
- public IAction getCutAction() {
- return cutAction;
- }
-
- /**
- * Return the copy action.
- *
- * @return org.eclipse.jface.action.IAction
- */
- public IAction getCopyAction() {
- return copyAction;
- }
-
- /**
- * Return the paste action.
- *
- * @return org.eclipse.jface.action.IAction
- */
- public IAction getPasteAction() {
- return pasteAction;
- }
-
- /**
- * Returns the editor actions.
- *
- * @return org.eclipse.jface.action.IAction
- */
- public IAction[] getEditorActions() {
- return editorActions;
- }
-
- /**
- * Update the server pages with new input.
- */
- protected void refresh() {
- // create editor input
- ServerResourceCommandManager serverCommandManager = null;
- if (server != null)
- serverCommandManager = new ServerResourceCommandManager(this, serverId, commandManager);
- editorPartInput = commandManager.getPartInput(serverId, serverCommandManager);
-
- Iterator iterator = serverPages.iterator();
- while (iterator.hasNext()) {
- IEditorPart part = (IEditorPart) iterator.next();
- try {
- part.init(part.getEditorSite(), editorPartInput);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error refresh()ing editor part", e);
- }
- }
- }
-
- /**
- *
- */
- protected void promptReadOnlyServerFile(String id) {
- commandManager.setReadOnly(id, true);
- String title = Messages.editorResourceModifiedTitle;
- String message = Messages.editorReadOnlyMessage;
- MessageDialog.openInformation(getEditorSite().getShell(), title, message);
- }
-
- /**
- *
- */
- protected void promptReloadServerFile(String id, IServerWorkingCopy wc) {
- String title = Messages.editorResourceModifiedTitle;
- String message = Messages.editorServerModifiedMessage;
-
- if (MessageDialog.openQuestion(getEditorSite().getShell(), title, message)) {
- try {
- //wc.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
- //TODO: refresh local server
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error refreshing server", e);
- }
- commandManager.reload(id, new NullProgressMonitor());
- }
- }
-
- /**
- *
- */
- public void setFocus() {
- super.setFocus();
- }
-
- /**
- *
- */
- protected void checkResourceState() {
- // do not check the resource state change if saving through the editor
- if (isSaving) {
- // do nothing
- return;
- }
-
- // check for deleted files
- if (resourceDeleted) {
- String title = Messages.editorResourceDeleteTitle;
- String message = null;
- if (server != null)
- message = NLS.bind(Messages.editorResourceDeleteServerMessage, server.getName());
- String[] labels = new String[] {Messages.editorResourceDeleteSave, IDialogConstants.CLOSE_LABEL};
- MessageDialog dialog = new MessageDialog(getEditorSite().getShell(), title, null, message, MessageDialog.INFORMATION, labels, 0);
-
- if (dialog.open() == 0)
- doSave(new NullProgressMonitor());
- else
- closeEditor();
- return;
- }
- resourceDeleted = false;
-
- // check for server changes
- if (serverId != null) {
- if (!commandManager.isDirty(serverId)) {
- if (commandManager.hasChanged(serverId))
- promptReloadServerFile(serverId, server);
- } else {
- if (commandManager.hasChanged(serverId) && !commandManager.areFilesReadOnly(serverId))
- promptReloadServerFile(serverId, server);
- else if (commandManager.areFilesReadOnly(serverId) && !commandManager.isReadOnly(serverId))
- promptReadOnlyServerFile(serverId);
- }
- if (commandManager.isReadOnly(serverId) && !commandManager.areFilesReadOnly(serverId))
- commandManager.setReadOnly(serverId, false);
- commandManager.updateTimestamps(serverId);
- }
-
- updateStatusLine();
- }
-
- /**
- * Set the title tooltip.
- *
- * @return the title tooltip
- */
- public String getTitleToolTip() {
- Server server2 = (Server) server;
- if (server != null && server2.getFile() != null)
- return server2.getFile().getFullPath().toString();
- else if (server != null)
- return server.getName();
- else
- return "error";
- }
-
- public int getOrientation() {
- return Window.getDefaultOrientation();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionBarContributor.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionBarContributor.java
deleted file mode 100644
index ae4c948dd..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionBarContributor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.EditorActionBarContributor;
-/**
- * Server editor action bar contributor.
- */
-public class ServerEditorActionBarContributor extends EditorActionBarContributor {
- public static final String SERVER_EDITOR_SEPARATOR = "server-editor-additions";
-
- // current editor
- protected ServerEditor editor;
-
- /**
- * ServerEditorActionBarContributor constructor comment.
- */
- public ServerEditorActionBarContributor() {
- super();
- }
-
- /**
- * Sets the active editor for the contributor.
- * <p>
- * The <code>EditorActionBarContributor</code> implementation of this method does
- * nothing. Subclasses may reimplement. This generally entails disconnecting
- * from the old editor, connecting to the new editor, and updating the actions
- * to reflect the new editor.
- * </p>
- *
- * @param targetEditor the new target editor
- */
- public void setActiveEditor(IEditorPart targetEditor) {
- super.setActiveEditor(targetEditor);
-
- if (targetEditor != null && targetEditor.equals(editor))
- return;
-
- IActionBars actionBars = getActionBars();
- boolean actionBarsUpdated = false;
-
- if (editor != null) {
- editor.setStatus(null, null);
-
- IStatusLineManager status = actionBars.getStatusLineManager();
- status.removeAll();
-
- IToolBarManager tbm = actionBars.getToolBarManager();
- tbm.removeAll();
-
- actionBarsUpdated = true;
- }
-
- if (targetEditor instanceof ServerEditor) {
- editor = (ServerEditor) targetEditor;
- Trace.trace(Trace.FINEST, "Editor action bar contributor for: " + editor);
- editor.updateUndoAction();
- editor.updateRedoAction();
-
- actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), editor.getUndoAction());
- actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), editor.getRedoAction());
-
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), editor.getCopyAction());
- actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), editor.getCutAction());
- actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), editor.getPasteAction());
-
- IStatusLineManager status = actionBars.getStatusLineManager();
- StatusLineContributionItem item = new StatusLineContributionItem("id");
- status.add(item);
-
- editor.setStatus(status, item);
- editor.updateStatusLine();
-
- IAction[] actions = editor.getEditorActions();
- IToolBarManager tbm = actionBars.getToolBarManager();
- tbm.add(new Separator(SERVER_EDITOR_SEPARATOR));
- boolean modified = false;
- if (actions != null) {
- int size = actions.length;
- Trace.trace(Trace.FINEST, "Attempting to add editor actions: " + size);
- for (int i = 0; i < size; i++) {
- Trace.trace(Trace.FINEST, "action: " + actions[i]);
- tbm.appendToGroup(SERVER_EDITOR_SEPARATOR, actions[i]);
- modified = true;
- }
- }
-
- if (modified)
- tbm.update(false);
- actionBarsUpdated = true;
- } else
- editor = null;
-
- if (actionBarsUpdated)
- actionBars.updateActionBars();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionFactory.java
deleted file mode 100644
index b40e649fc..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorActionFactory.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.internal.provisional.ServerEditorActionFactoryDelegate;
-import org.eclipse.ui.IEditorSite;
-/**
- * A default server that can be created for a set of given
- * natures.
- */
-public class ServerEditorActionFactory implements IServerEditorActionFactory {
- private IConfigurationElement element;
- private ServerEditorActionFactoryDelegate delegate;
-
- /**
- * ServerEditorActionFactory constructor.
- *
- * @param element a configuration element
- */
- public ServerEditorActionFactory(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- *
- */
- protected IConfigurationElement getConfigurationElement() {
- return element;
- }
-
- /**
- * Returns the id of this default server.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the id of this default server.
- *
- * @return java.lang.String
- */
- public String getName() {
- return element.getAttribute("name");
- }
-
- /**
- * Returns the order.
- *
- * @return int
- */
- public int getOrder() {
- try {
- String o = element.getAttribute("order");
- return Integer.parseInt(o);
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- /**
- * Return the ids of the server resource factories (specified
- * using Java-import style) that this page may support.
- *
- * @return java.lang.String[]
- */
- public String[] getTypeIds() {
- try {
- List list = new ArrayList();
- StringTokenizer st = new StringTokenizer(element.getAttribute("typeIds"), ",");
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str);
- }
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- } catch (Exception e) {
- //Trace.trace("Could not get server resource from: " + element.getAttribute("serverResources"));
- return null;
- }
- }
-
- /**
- * @see IServerEditorActionFactory#supportsServerElementType(String)
- */
- public boolean supportsServerElementType(String id) {
- if (id == null || id.length() == 0)
- return false;
-
- String[] s = getTypeIds();
- if (s == null)
- return false;
-
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
- return true;
- } else if (id.equals(s[i]))
- return true;
- }
- return false;
- }
-
- /*
- *
- */
- public ServerEditorActionFactoryDelegate getDelegate() {
- if (delegate == null) {
- try {
- delegate = (ServerEditorActionFactoryDelegate) element.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create server action factory delegate", t);
- }
- }
- return delegate;
- }
-
- /**
- * @see IServerEditorActionFactory#shouldDisplay(IServerWorkingCopy)
- */
- public boolean shouldDisplay(IServerWorkingCopy server) {
- try {
- return getDelegate().shouldDisplay(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return false;
- }
- }
-
- /**
- * @see IServerEditorActionFactory#createAction(IEditorSite, IServerEditorPartInput)
- */
- public IAction createAction(IEditorSite site, IServerEditorPartInput input) {
- try {
- return getDelegate().createAction(site, input);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return null;
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorCore.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorCore.java
deleted file mode 100644
index 39da11842..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorCore.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionDelta;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- *
- */
-public class ServerEditorCore {
- // cached copy of all editor factories and actions
- private static List editorPageFactories;
- private static List editorPageSectionFactories;
- private static List editorActionFactories;
-
- /**
- * Returns a List of all editor page factories
- *
- * @return java.util.List
- */
- public static List getServerEditorPageFactories() {
- if (editorPageFactories == null)
- loadEditorPageFactories();
- return editorPageFactories;
- }
-
- /**
- * Returns a List of all editor page section factories
- *
- * @return java.util.List
- */
- public static List getServerEditorPageSectionFactories() {
- if (editorPageSectionFactories == null)
- loadEditorPageSectionFactories();
- return editorPageSectionFactories;
- }
-
- /**
- * Load the editor page factory extension point.
- */
- private static void loadEditorPageFactories() {
- Trace.trace(Trace.CONFIG, "->- Loading .editorPages extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, ServerUIPlugin.EXTENSION_EDITOR_PAGES);
- editorPageFactories = new ArrayList(cf.length);
- loadEditorPageFactories(cf);
- ServerUIPlugin.addRegistryListener();
- Trace.trace(Trace.CONFIG, "-<- Done loading .editorPages extension point -<-");
- }
-
- /**
- * Load the editor page factory extension point.
- */
- private static void loadEditorPageFactories(IConfigurationElement[] cf) {
- int size = cf.length;
- for (int i = 0; i < size; i++) {
- try {
- editorPageFactories.add(new ServerEditorPartFactory(cf[i]));
- Trace.trace(Trace.CONFIG, " Loaded editorPage: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load editorPage: " + cf[i].getAttribute("id"), t);
- }
- }
-
- // sort pages
- sortOrderedList(editorPageFactories);
- }
-
- public static void handleEditorPageFactoriesDelta(IExtensionDelta delta) {
- if (editorPageFactories == null) // not loaded yet
- return;
-
- IConfigurationElement[] cf = delta.getExtension().getConfigurationElements();
-
- if (delta.getKind() == IExtensionDelta.ADDED)
- loadEditorPageFactories(cf);
- else {
- int size = editorPageFactories.size();
- ServerEditorPartFactory[] sepf = new ServerEditorPartFactory[size];
- editorPageFactories.toArray(sepf);
- int size2 = cf.length;
-
- for (int i = 0; i < size; i++) {
- for (int j = 0; j < size2; j++) {
- if (sepf[i].getId().equals(cf[j].getAttribute("id"))) {
- editorPageFactories.remove(sepf[i]);
- }
- }
- }
- }
- }
-
- /**
- * Load the editor page section factory extension point.
- */
- private static void loadEditorPageSectionFactories() {
- Trace.trace(Trace.CONFIG, "->- Loading .editorPageSections extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, ServerUIPlugin.EXTENSION_EDITOR_PAGE_SECTIONS);
- editorPageSectionFactories = new ArrayList(cf.length);
- loadEditorPageSectionFactories(cf);
- ServerUIPlugin.addRegistryListener();
- Trace.trace(Trace.CONFIG, "-<- Done loading .editorPageSections extension point -<-");
- }
-
- /**
- * Load the editor page section factory extension point.
- */
- private static void loadEditorPageSectionFactories(IConfigurationElement[] cf) {
- int size = cf.length;
- for (int i = 0; i < size; i++) {
- try {
- editorPageSectionFactories.add(new ServerEditorPageSectionFactory(cf[i]));
- Trace.trace(Trace.CONFIG, " Loaded editorPageSection: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load editorPageSection: " + cf[i].getAttribute("id"), t);
- }
- }
-
- // sort sections
- sortOrderedList(editorPageSectionFactories);
- }
-
- public static void handleEditorPageSectionFactoriesDelta(IExtensionDelta delta) {
- if (editorPageSectionFactories == null) // not loaded yet
- return;
-
- IConfigurationElement[] cf = delta.getExtension().getConfigurationElements();
-
- if (delta.getKind() == IExtensionDelta.ADDED)
- loadEditorPageSectionFactories(cf);
- else {
- int size = editorPageSectionFactories.size();
- ServerEditorPageSectionFactory[] seps = new ServerEditorPageSectionFactory[size];
- editorPageSectionFactories.toArray(seps);
- int size2 = cf.length;
-
- for (int i = 0; i < size; i++) {
- for (int j = 0; j < size2; j++) {
- if (seps[i].getId().equals(cf[j].getAttribute("id"))) {
- editorPageSectionFactories.remove(seps[i]);
- }
- }
- }
- }
- }
-
- /**
- * Returns a List of all editor action factories.
- *
- * @return java.util.List
- */
- public static List getServerEditorActionFactories() {
- if (editorActionFactories == null)
- loadEditorActionFactories();
- return editorActionFactories;
- }
-
- /**
- * Load the editor action factories extension point.
- */
- private static void loadEditorActionFactories() {
- Trace.trace(Trace.CONFIG, "->- Loading .editorActions extension point ->-");
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] cf = registry.getConfigurationElementsFor(ServerUIPlugin.PLUGIN_ID, "editorActions");
-
- int size = cf.length;
- editorActionFactories = new ArrayList(size);
- for (int i = 0; i < size; i++) {
- try {
- editorActionFactories.add(new ServerEditorActionFactory(cf[i]));
- Trace.trace(Trace.CONFIG, " Loaded editorAction: " + cf[i].getAttribute("id"));
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, " Could not load editorAction: " + cf[i].getAttribute("id"), t);
- }
- }
-
- // sort pages
- sortOrderedList(editorActionFactories);
- Trace.trace(Trace.CONFIG, "-<- Done loading .editorActions extension point -<-");
- }
-
- /**
- * Sort the given list of IOrdered items into indexed order. This method
- * modifies the original list, but returns the value for convenience.
- *
- * @param list java.util.List
- * @return java.util.List
- */
- public static List sortOrderedList(List list) {
- if (list == null)
- return null;
-
- int size = list.size();
- for (int i = 0; i < size - 1; i++) {
- for (int j = i + 1; j < size; j++) {
- IOrdered a = (IOrdered) list.get(i);
- IOrdered b = (IOrdered) list.get(j);
- if (a.getOrder() > b.getOrder()) {
- Object temp = a;
- list.set(i, b);
- list.set(j, temp);
- }
- }
- }
- return list;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInput.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInput.java
deleted file mode 100644
index 31861ac4c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInput.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPersistableElement;
-/**
- * The editor input for server configurations and instances. The
- * input points to a resource that is either an instance or
- * configuration.
- *
- * <p>Editors supporting this editor input should use the ResourceManager
- * to load their own copy of the resource. Each editor is responsible
- * for managing this resource and making sure that only one copy is
- * loaded from disk when multiple editors are opened on the same
- * resource.</p>
- *
- * <p>When the editor saves back to the resource, the server tooling
- * will notice the change and reload the new configuration.</p>
- *
- * <p>Editors should call setEditing(resource, true) when the first
- * editor opens on a particular resource, and setEditing(resource,
- * false) when the last editor on a resource closes. This will
- * ensure that the server tooling does not try to edit the resource
- * and cause conflicting changes while an editor is open.</p>
- */
-public class ServerEditorInput implements IServerEditorInput, IPersistableElement {
- private String serverId;
-
- /**
- * ServerEditorInput constructor comment.
- *
- * @param serverId a server id
- */
- public ServerEditorInput(String serverId) {
- super();
- this.serverId = serverId;
- }
-
- /**
- * Returns the server id.
- * @return org.eclipse.core.resources.IResource
- */
- public String getServerId() {
- return serverId;
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof ServerEditorInput))
- return false;
- ServerEditorInput other = (ServerEditorInput) obj;
- if (serverId == null) {
- if (other.serverId != null)
- return false;
- } else if (!serverId.equals(other.serverId))
- return false;
- return true;
- }
-
- /**
- * Returns whether the editor input exists.
- * <p>
- * This method is primarily used to determine if an editor input should
- * appear in the "File Most Recently Used" menu. An editor input will appear
- * in the list until the return value of <code>exists</code> becomes
- * <code>false</code> or it drops off the bottom of the list.
- *
- * @return <code>true</code> if the editor input exists; <code>false</code>
- * otherwise
- */
- public boolean exists() {
- if (serverId != null && ServerCore.findServer(serverId) == null)
- return false;
-
- return true;
- }
-
- /**
- * Returns an object which is an instance of the given class
- * associated with this object. Returns <code>null</code> if
- * no such object can be found.
- *
- * @param adapter the adapter class to look up
- * @return a object castable to the given class,
- * or <code>null</code> if this object does not
- * have an adapter for the given class
- */
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * Returns the ID of an element factory which can be used to recreate
- * this object. An element factory extension with this ID must exist
- * within the workbench registry.
- *
- * @return the element factory ID
- */
- public String getFactoryId() {
- return ServerEditorInputFactory.FACTORY_ID;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return ImageResource.getImageDescriptor(ImageResource.IMG_SERVER);
- }
-
- /**
- * Returns the name of this editor input for display purposes.
- * <p>
- * For instance, if the fully qualified input name is
- * <code>"a\b\MyFile.gif"</code>, the return value would be just
- * <code>"MyFile.gif"</code>.
- *
- * @return the file name string
- */
- public String getName() {
- if (serverId != null) {
- IServer server = ServerCore.findServer(serverId);
- if (server != null)
- return server.getName();
- return serverId;
- }
- return "";
- }
-
- /*
- * Returns an object that can be used to save the state of this editor input.
- *
- * @return the persistable element, or <code>null</code> if this editor input
- * cannot be persisted
- */
- public IPersistableElement getPersistable() {
- return this;
- }
-
- public String getToolTipText() {
- String s = null;
- if (serverId != null) {
- IServer server = ServerCore.findServer(serverId);
- if (server != null) {
- Server server2 = (Server) server;
- if (server2.getFile() != null) {
- s = server2.getFile().getFullPath().makeRelative().toString();
- if (s.startsWith("/"))
- s = s.substring(1);
- } else
- s = server.getName();
- }
- }
- if (s == null)
- s = "";
- return s;
- }
-
- /**
- * Saves the state of an element within a memento.
- *
- * @param memento the storage area for element state
- */
- public void saveState(IMemento memento) {
- ServerEditorInputFactory.saveState(memento, this);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInputFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInputFactory.java
deleted file mode 100644
index 70bbc7480..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorInputFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-/**
- * This factory is used in the persistence of ServerResourceEditorInput
- * instances. This allows the user to close the workbench with an
- * open editor and reopen to the same editor.
- */
-public class ServerEditorInputFactory implements IElementFactory {
- protected final static String FACTORY_ID = "org.eclipse.wst.server.ui.editor.input.factory";
- protected final static String SERVER_ID = "server-id";
-
- /**
- * ServerEditorInputFactory constructor comment.
- */
- public ServerEditorInputFactory() {
- // do nothing
- }
-
- /*
- * Creates editor input based on the state in the memento.
- */
- public IAdaptable createElement(IMemento memento) {
- // get the resource names
- String serverId = memento.getString(SERVER_ID);
-
- return new ServerEditorInput(serverId);
- }
-
- /**
- * Saves the state of an element within a memento.
- *
- * @param memento the storage area for element state
- * @param input server editor input
- */
- public static void saveState(IMemento memento, ServerEditorInput input) {
- if (input == null)
- return;
-
- if (input.getServerId() != null)
- memento.putString(SERVER_ID, input.getServerId());
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPageSectionFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPageSectionFactory.java
deleted file mode 100644
index 208a29179..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPageSectionFactory.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.expressions.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.*;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- *
- */
-public class ServerEditorPageSectionFactory implements IServerEditorPageSectionFactory {
- private IConfigurationElement element;
- private Expression fContextualLaunchExpr = null;
-
- /**
- * ServerEditorPageSectionFactory constructor.
- *
- * @param element a configuration element
- */
- public ServerEditorPageSectionFactory(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- *
- */
- protected IConfigurationElement getConfigurationElement() {
- return element;
- }
-
- /**
- * Returns the id of this factory.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the order.
- *
- * @return int
- */
- public int getOrder() {
- try {
- String o = element.getAttribute("order");
- return Integer.parseInt(o);
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- /**
- * Returns the insertion id of this factory.
- *
- * @return java.lang.String
- */
- public String getInsertionId() {
- return element.getAttribute("insertionId");
- }
-
- /**
- * Return the ids of the server resource factories (specified
- * using Java-import style) that this page may support.
- *
- * @return java.lang.String[]
- */
- protected String[] getTypeIds() {
- try {
- List list = new ArrayList();
- StringTokenizer st = new StringTokenizer(element.getAttribute("typeIds"), ",");
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str.trim());
- }
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- } catch (Exception e) {
- //Trace.trace("Could not get server resource from: " + element.getAttribute("serverResources"));
- return null;
- }
- }
-
- /**
- * @see IServerEditorPageSectionFactory#supportsType(String)
- */
- public boolean supportsType(String id) {
- if (id == null || id.length() == 0)
- return false;
-
- String[] s = getTypeIds();
- if (s == null)
- return false;
-
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
- return true;
- } else if (id.equals(s[i]))
- return true;
- }
- return false;
- }
-
- /**
- * @see IServerEditorPageSectionFactory#shouldCreateSection(IServerWorkingCopy)
- */
- public boolean shouldCreateSection(IServerWorkingCopy server) {
- try {
- return isEnabled(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return false;
- }
- }
-
- /**
- * @see IServerEditorPageSectionFactory#createSection()
- */
- public ServerEditorSection createSection() {
- try {
- return (ServerEditorSection) element.createExecutableExtension("class");
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Could not create server editor section", t);
- return null;
- }
- }
-
- /**
- * Returns an expression that represents the enablement logic for the
- * contextual launch element of this launch shortcut description or
- * <code>null</code> if none.
- * @return an evaluatable expression or <code>null</code>
- * @throws CoreException if the configuration element can't be
- * converted. Reasons include: (a) no handler is available to
- * cope with a certain configuration element or (b) the XML
- * expression tree is malformed.
- */
- public Expression getContextualLaunchEnablementExpression() throws CoreException {
- if (fContextualLaunchExpr == null) {
- IConfigurationElement[] elements = element.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null)
- fContextualLaunchExpr = ExpressionConverter.getDefault().perform(enablement);
- }
- return fContextualLaunchExpr;
- }
-
- /**
- * Evaluate the given expression within the given context and return
- * the result. Returns <code>true</code> iff result is either TRUE or NOT_LOADED.
- * This allows optimistic inclusion of shortcuts before plugins are loaded.
- * Returns <code>false</code> if exp is <code>null</code>.
- *
- * @param exp the enablement expression to evaluate or <code>null</code>
- * @param context the context of the evaluation. Usually, the
- * user's selection.
- * @return the result of evaluating the expression
- * @throws CoreException
- */
- protected boolean evalEnablementExpression(IEvaluationContext context, Expression exp) throws CoreException {
- return (exp != null) ? ((exp.evaluate(context)) != EvaluationResult.FALSE) : false;
- }
-
- /**
- * Returns true if enabled for the given object.
- *
- * @param obj an object
- * @return <code>true</code> if enabled
- * @throws CoreException if anything goes wrong
- */
- public boolean isEnabled(Object obj) throws CoreException {
- if (getContextualLaunchEnablementExpression() == null)
- return true;
- IEvaluationContext context = new EvaluationContext(null, obj);
- context.addVariable("server", obj);
- return evalEnablementExpression(context, getContextualLaunchEnablementExpression());
- }
-
- public String toString() {
- return "ServerEditorSection [" + getId() + ", " + getInsertionId() + ", " + getOrder() + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartFactory.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartFactory.java
deleted file mode 100644
index bc7126821..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartFactory.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.expressions.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.ui.IEditorPart;
-/**
- *
- */
-public class ServerEditorPartFactory implements IServerEditorPartFactory {
- private IConfigurationElement element;
- private Expression fContextualLaunchExpr = null;
-
- /**
- * ServerEditorPartFactory constructor.
- *
- * @param element a configuration element
- */
- public ServerEditorPartFactory(IConfigurationElement element) {
- super();
- this.element = element;
- }
-
- /**
- *
- */
- protected IConfigurationElement getConfigurationElement() {
- return element;
- }
-
- /**
- * Returns the id of this part factory.
- *
- * @return java.lang.String
- */
- public String getId() {
- return element.getAttribute("id");
- }
-
- /**
- * Returns the name of this part factory.
- *
- * @return java.lang.String
- */
- public String getName() {
- return element.getAttribute("name");
- }
-
- protected String[] getInsertionIds() {
- try {
- String insertionIds = element.getAttribute("insertionIds");
- List list = new ArrayList();
- if (insertionIds != null && insertionIds.length() > 0) {
- StringTokenizer st = new StringTokenizer(insertionIds, ",");
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str.trim());
- }
- }
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- } catch (Exception e) {
- //Trace.trace("Could not get server resource from: " + element.getAttribute("serverResources"));
- return null;
- }
- }
-
- /**
- * @see IServerEditorPartFactory#supportsInsertionId(String)
- */
- public boolean supportsInsertionId(String id) {
- if (id == null || id.length() == 0)
- return false;
-
- String[] s = getInsertionIds();
- if (s == null)
- return false;
-
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
- return true;
- } else if (id.equals(s[i]))
- return true;
- }
- return false;
- }
-
- /**
- * Returns the order.
- *
- * @return int
- */
- public int getOrder() {
- try {
- String o = element.getAttribute("order");
- return Integer.parseInt(o);
- } catch (NumberFormatException e) {
- return -1;
- }
- }
-
- /**
- * Return the ids of the server and server configuration type ids (specified
- * using Java-import style) that this page may support.
- *
- * @return java.lang.String[]
- */
- protected String[] getTypeIds() {
- try {
- List list = new ArrayList();
- StringTokenizer st = new StringTokenizer(element.getAttribute("typeIds"), ",");
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str != null && str.length() > 0)
- list.add(str.trim());
- }
- String[] s = new String[list.size()];
- list.toArray(s);
- return s;
- } catch (Exception e) {
- //Trace.trace("Could not get server resource from: " + element.getAttribute("serverResources"));
- return null;
- }
- }
-
- /**
- * @see IServerEditorPartFactory#supportsType(String)
- */
- public boolean supportsType(String id) {
- if (id == null || id.length() == 0)
- return false;
-
- String[] s = getTypeIds();
- if (s == null)
- return false;
-
- int size = s.length;
- for (int i = 0; i < size; i++) {
- if (s[i].endsWith("*")) {
- if (id.length() >= s[i].length() && id.startsWith(s[i].substring(0, s[i].length() - 1)))
- return true;
- } else if (id.equals(s[i]))
- return true;
- }
- return false;
- }
-
- /**
- * @see IServerEditorPartFactory#shouldCreatePage(IServerWorkingCopy)
- */
- public boolean shouldCreatePage(IServerWorkingCopy server) {
- try {
- return isEnabled(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return false;
- }
- }
-
- /**
- * @see IServerEditorPartFactory#createPage()
- */
- public IEditorPart createPage() {
- try {
- return (IEditorPart) element.createExecutableExtension("class");
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error calling delegate", e);
- return null;
- }
- }
-
- /**
- * Returns an expression that represents the enablement logic for the
- * contextual launch element of this launch shortcut description or
- * <code>null</code> if none.
- * @return an evaluatable expression or <code>null</code>
- * @throws CoreException if the configuration element can't be
- * converted. Reasons include: (a) no handler is available to
- * cope with a certain configuration element or (b) the XML
- * expression tree is malformed.
- */
- public Expression getContextualLaunchEnablementExpression() throws CoreException {
- if (fContextualLaunchExpr == null) {
- IConfigurationElement[] elements = element.getChildren(ExpressionTagNames.ENABLEMENT);
- IConfigurationElement enablement = elements.length > 0 ? elements[0] : null;
-
- if (enablement != null)
- fContextualLaunchExpr = ExpressionConverter.getDefault().perform(enablement);
- }
- return fContextualLaunchExpr;
- }
-
- /**
- * Evaluate the given expression within the given context and return
- * the result. Returns <code>true</code> iff result is either TRUE or NOT_LOADED.
- * This allows optimistic inclusion of shortcuts before plugins are loaded.
- * Returns <code>false</code> if exp is <code>null</code>.
- *
- * @param exp the enablement expression to evaluate or <code>null</code>
- * @param context the context of the evaluation. Usually, the
- * user's selection.
- * @return the result of evaluating the expression
- * @throws CoreException
- */
- protected boolean evalEnablementExpression(IEvaluationContext context, Expression exp) throws CoreException {
- return (exp != null) ? ((exp.evaluate(context)) != EvaluationResult.FALSE) : false;
- }
-
- /**
- * Returns true if enabled for the given object.
- *
- * @param obj an object
- * @return <code>true</code> if enabled
- * @throws CoreException if anything goes wrong
- */
- public boolean isEnabled(Object obj) throws CoreException {
- if (getContextualLaunchEnablementExpression() == null)
- return true;
- IEvaluationContext context = new EvaluationContext(null, obj);
- context.addVariable("server", obj);
- return evalEnablementExpression(context, getContextualLaunchEnablementExpression());
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartInput.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartInput.java
deleted file mode 100644
index 79045b29c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerEditorPartInput.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IPersistableElement;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
-/**
- *
- */
-public class ServerEditorPartInput implements IServerEditorPartInput {
- protected IServerWorkingCopy server;
- protected boolean serverReadOnly;
- protected ServerResourceCommandManager serverCommandManager;
-
- public ServerEditorPartInput(ServerResourceCommandManager serverCommandManager,
- IServerWorkingCopy server, boolean serverReadOnly) {
-
- this.server = server;
- this.serverReadOnly = serverReadOnly;
- this.serverCommandManager = serverCommandManager;
- }
-
- public String getName() {
- return "-";
- }
-
- public String getToolTipText() {
- return "-";
- }
-
- public boolean exists() {
- return true;
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /**
- * Returns the server to be edited.
- *
- * @return IServerResource
- */
- public IServerWorkingCopy getServer() {
- return server;
- }
-
- /**
- * Returns true if the server is read-only.
- *
- * @return boolean
- */
- public boolean isServerReadOnly() {
- return serverReadOnly;
- }
-
- public ServerResourceCommandManager getServerCommandManager() {
- return serverCommandManager;
- }
-
- public String toString() {
- return "ServerEditorPartInput [" + server + "]";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java
deleted file mode 100644
index bca43f308..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/ServerResourceCommandManager.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * A command manager for a single server resource.
- */
-public class ServerResourceCommandManager {
- protected ServerEditor editor;
- protected GlobalCommandManager commandManager;
- protected String id;
-
- public ServerResourceCommandManager(ServerEditor editor, String id, GlobalCommandManager commandManager) {
- this.editor = editor;
- this.commandManager = commandManager;
- this.id = id;
- }
-
- public boolean isReadOnly() {
- return commandManager.isReadOnly(id);
- }
-
- /**
- * Execute the given command and place it in the undo stack.
- * If the command cannot be undone, the user will be notifed
- * before it is executed.
- *
- * @param operation an undoable operation
- */
- public void execute(IUndoableOperation operation) {
- if (!validateEdit())
- return;
-
- if (commandManager.isReadOnly(id)) {
- warnReadOnly();
- return;
- }
- commandManager.executeCommand(id, operation);
- }
-
- protected void warnReadOnly() {
- String title = Messages.editorResourceWarnTitle;
- String message = Messages.editorResourceWarnMessage;
-
- MessageDialog.openWarning(editor.getEditorSite().getShell(), title, message);
- }
-
- /**
- *
- */
- protected boolean validateEdit() {
- if (commandManager.isDirty(id))
- return true;
-
- IFile[] files = commandManager.getReadOnlyFiles(id);
- if (files.length == 0)
- return true;
-
- IStatus status = ResourcesPlugin.getWorkspace().validateEdit(files, editor.getEditorSite().getShell());
-
- if (status.getSeverity() == IStatus.ERROR) {
- // inform user
- String message = Messages.editorValidateEditFailureMessage;
- ErrorDialog.openError(editor.getEditorSite().getShell(), Messages.errorDialogTitle, message, status);
-
- // change to read-only
- commandManager.setReadOnly(id, true);
-
- // do not execute command
- return false;
- }
- // check file timestamp
- IServerAttributes serverfile = commandManager.getServerResource(id);
- if (commandManager.hasChanged(id)) {
- if (serverfile instanceof IServer)
- editor.promptReloadServerFile(id, (IServerWorkingCopy) serverfile);
- }
-
- // allow edit
- return true;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/StatusLineContributionItem.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/StatusLineContributionItem.java
deleted file mode 100644
index 9a35eec4d..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/StatusLineContributionItem.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.texteditor.IStatusField;
-/**
- * Contribution item for the status line.
- */
-public class StatusLineContributionItem extends ContributionItem implements IStatusField {
-
- static class StatusLineLabel extends CLabel {
-
- private static int INDENT= 3; // left and right margin used in CLabel
-
- private Point fFixedSize;
-
- public StatusLineLabel(Composite parent, int style) {
- super(parent, style);
-
- GC gc= new GC(parent);
- gc.setFont(parent.getFont());
- Point extent= gc.textExtent("MMMMMMMMM"); //$NON-NLS-1$
- gc.dispose();
-
- fFixedSize= new Point(extent.x + INDENT * 2, 10);
- }
-
- public Point computeSize(int wHint, int hHint, boolean changed) {
- return fFixedSize;
- }
- }
-
- private String fText;
- private Image fImage;
- private StatusLineLabel fLabel;
-
- /**
- * Creates a new item with the given id.
- *
- * @param id the item's id
- */
- StatusLineContributionItem(String id) {
- super(id);
- }
-
- /*
- * @see IStatusField#setText
- */
- public void setText(String text) {
- fText= text;
- if (fLabel != null && !fLabel.isDisposed()) {
- fLabel.setText(fText);
- }
- }
-
- /*
- * @see IStatusField#setImage(Image)
- */
- public void setImage(Image image) {
- fImage= image;
- if (fLabel != null && !fLabel.isDisposed()) {
- fLabel.setImage(fImage);
- }
- }
-
- /*
- * @see IContributionItem#fill(Composite)
- */
- public void fill(Composite parent) {
- fLabel= new StatusLineLabel(parent, SWT.SHADOW_IN);
- fLabel.setData(this);
-
- if (fText != null)
- fLabel.setText(fText);
- }
-}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/TextAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/TextAction.java
deleted file mode 100644
index 458b5bf04..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/editor/TextAction.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.editor;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Text;
-/**
- * Text actions (cut, copy, paste) for the Web browser.
- */
-public class TextAction extends Action {
- protected Display display;
- protected Clipboard clipboard;
- protected byte type;
-
- public static final byte CUT_ACTION = 0;
- public static final byte COPY_ACTION = 1;
- public static final byte PASTE_ACTION = 2;
-
- /**
- * TextAction constructor comment.
- */
- protected TextAction(Display display, byte type) {
- super("Text action: " + type);
- this.display = display;
- clipboard = new Clipboard(display);
- this.type = type;
- }
-
- protected Control getControl() {
- Control control = display.getFocusControl();
- return control;
- }
-
- protected Point getControlSelection() {
- Control control = getControl();
- if (control == null)
- return null;
-
- if (control instanceof Text) {
- Text text = (Text) control;
- return text.getSelection();
- } else if (control instanceof Combo) {
- Combo combo = (Combo) control;
- return combo.getSelection();
- } else
- return null;
- }
-
- protected void setControlSelection(Point sel) {
- Control control = getControl();
- if (control == null)
- return;
-
- if (control instanceof Text) {
- Text text = (Text) control;
- text.setSelection(sel);
- } else if (control instanceof Combo) {
- Combo combo = (Combo) control;
- combo.setSelection(sel);
- }
- }
-
- protected String getControlText() {
- Control control = getControl();
- if (control == null)
- return null;
-
- if (control instanceof Text) {
- Text text = (Text) control;
- return text.getText();
- } else if (control instanceof Combo) {
- Combo combo = (Combo) control;
- return combo.getText();
- } else
- return null;
- }
-
- protected void setControlText(String text) {
- Control control = getControl();
- if (control == null)
- return;
-
- if (control instanceof Text) {
- Text text2 = (Text) control;
- text2.setText(text);
- } else if (control instanceof Combo) {
- Combo combo = (Combo) control;
- combo.setText(text);
- }
- }
-
- /**
- * Copies the selected text to the clipboard. The text will be put in the
- * clipboard in plain text format.
- */
- public void copy() {
- Point selection = getControlSelection();
- String text = getControlText();
- if (selection == null || text == null)
- return;
-
- int length = selection.y - selection.x;
- if (length > 0) {
- TextTransfer plainTextTransfer = TextTransfer.getInstance();
- try {
- clipboard.setContents(
- new String[] { text.substring(selection.x, selection.y) },
- new Transfer[] { plainTextTransfer });
- } catch (SWTError error) {
- // Copy to clipboard failed. This happens when another application
- // is accessing the clipboard while we copy. Ignore the error.
- }
- }
- }
-
- /**
- * Moves the selected text to the clipboard. The text will be put in the
- * clipboard in plain text format and RTF format.
- */
- public void cut(){
- Point selection = getControlSelection();
- if (selection == null)
- return;
-
- if (selection.y > selection.x) {
- copy();
- delete();
- }
- }
-
- /**
- * Deletes the character to the right of the caret. Delete the selected text if any.
- */
- public void delete() {
- Point selection = getControlSelection();
- String text = getControlText();
- if (selection == null || text == null)
- return;
-
- if (selection.x != selection.y) {
- text = text.substring(0, selection.x) + text.substring(selection.y);
- setControlText(text);
- setControlSelection(new Point(selection.x, selection.x));
- }
- }
-
- /**
- * Replaces the selection with the clipboard text or insert the text at
- * the current caret offset if there is no selection.
- * If the widget has the SWT.SINGLE style and the clipboard text contains
- * more than one line, only the first line without line delimiters is
- * inserted in the widget.
- */
- public void paste() {
- TextTransfer transfer = TextTransfer.getInstance();
- Point selection = getControlSelection();
- String text = getControlText();
- if (selection == null)
- return;
-
- String newText = (String) clipboard.getContents(transfer);
- if (newText != null && newText.length() > 0) {
- if (text == null)
- text = newText;
- else
- text = text.substring(0, selection.x) + newText + text.substring(selection.y);
- setControlText(text);
-
- // set the selection to the end of the paste
- int x = selection.x + newText.length();
- setControlSelection(new Point(x, x));
- }
- }
-
- /**
- * Execute the action.
- */
- public void run() {
- if (display == null)
- return;
- if (type == CUT_ACTION)
- cut();
- else if (type == COPY_ACTION)
- copy();
- else if (type == PASTE_ACTION)
- paste();
- }
-
- /**
- * Update the actions enabled/disabled state.
- */
- protected void update() {
- if (getControl() == null) {
- setEnabled(false);
- return;
- }
- Point selection = getControlSelection();
- String text = getControlText();
-
- try {
- if (type == CUT_ACTION)
- setEnabled(text != null && text.length() > 0 && selection != null && selection.x < selection.y);
- else if (type == COPY_ACTION)
- setEnabled(text != null && text.length() > 0 && selection != null && selection.x < selection.y);
- else if (type == PASTE_ACTION) {
- Control control = getControl();
- if (!control.isEnabled()) {
- setEnabled(false);
- return;
- }
- if (!(control instanceof Text)) {
- setEnabled(false);
- return;
- }
-
- Text text2 = (Text) control;
- if (!text2.getEditable()) {
- setEnabled(false);
- return;
- }
- TextTransfer transfer = TextTransfer.getInstance();
- String newText = (String) clipboard.getContents(transfer);
- setEnabled(newText != null && newText.length() > 0);
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error updating text action", e);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ConnectedUIDecorator.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ConnectedUIDecorator.java
deleted file mode 100644
index 3a7d25263..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ConnectedUIDecorator.java
+++ /dev/null
@@ -1,107 +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.server.ui.internal.provisional;
-
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-
-public class ConnectedUIDecorator extends UIDecorator {
- private static final String[] serverStateUnmanaged = new String[] {
- "",
- Messages.viewStatusStarting4,
- Messages.viewStatusStarted2,
- Messages.viewStatusStopping4,
- Messages.viewStatusStopped2};
-
- private static final String[] startingText = new String[] {
- Messages.viewStatusStarting1,
- Messages.viewStatusStarting2,
- Messages.viewStatusStarting3};
-
- private static final String[] stoppingText = new String[] {
- Messages.viewStatusStopping1,
- Messages.viewStatusStopping2,
- Messages.viewStatusStopping3};
-
- private static final Image[] startingImages = new Image[] {
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTING_1),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTING_2),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTING_3)
- };
-
- private static final Image[] stoppingImages = new Image[] {
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPING_1),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPING_2),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPING_2)
- };
-
- /**
- * @see UIDecorator#getStateLabel(int, String, int)
- */
- public String getStateLabel(int state, String mode, int count) {
- if (state == IServer.STATE_UNKNOWN)
- return "";
- else if (state == IServer.STATE_STARTING)
- return startingText[count];
- else if (state == IServer.STATE_STOPPING)
- return stoppingText[count];
- else if (state == IServer.STATE_STARTED) {
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- return Messages.viewStatusStartedDebug;
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- return Messages.viewStatusStartedProfile;
- else
- return Messages.viewStatusStarted;
- } else if (state == IServer.STATE_STOPPED)
- return Messages.viewStatusStopped;
-
- return serverStateUnmanaged[state];
- }
-
- /**
- * @see UIDecorator#getStateImage(int, String, int)
- */
- public Image getStateImage(int state, String mode, int count) {
- if (state == IServer.STATE_UNKNOWN)
- return null;
- else if (state == IServer.STATE_STARTING)
- return startingImages[count];
- else if (state == IServer.STATE_STOPPING)
- return stoppingImages[count];
- else if (state == IServer.STATE_STOPPED)
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPED);
- else { //if (state == IServer.STATE_STARTED) {
- //String mode = server.getMode();
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED_DEBUG);
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED_PROFILE);
- else
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED);
- }
- }
-
- public boolean canRestart() {
- return false;
- }
-
- public void setupAction(Action action, int action2) {
- action.setToolTipText(Messages.actionStopToolTip2);
- action.setText(Messages.actionStop2);
- action.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_DISCONNECT));
- action.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_DISCONNECT));
- action.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_DISCONNECT));
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ManagedUIDecorator.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ManagedUIDecorator.java
deleted file mode 100644
index 29206c58f..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ManagedUIDecorator.java
+++ /dev/null
@@ -1,102 +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.server.ui.internal.provisional;
-
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-
-public class ManagedUIDecorator extends UIDecorator {
- private static final String[] serverStateUnmanaged = new String[] {
- "",
- Messages.viewStatusStarting4,
- Messages.viewStatusStarted2,
- Messages.viewStatusStopping4,
- Messages.viewStatusStopped2};
-
- private static final String[] startingText = new String[] {
- Messages.viewStatusStarting1,
- Messages.viewStatusStarting2,
- Messages.viewStatusStarting3};
-
- private static final String[] stoppingText = new String[] {
- Messages.viewStatusStopping1,
- Messages.viewStatusStopping2,
- Messages.viewStatusStopping3};
-
- private static final Image[] startingImages = new Image[] {
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTING_1),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTING_2),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTING_3)
- };
-
- private static final Image[] stoppingImages = new Image[] {
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPING_1),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPING_2),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPING_2)
- };
-
- /**
- * @see UIDecorator#getStateLabel(int, String, int)
- */
- public String getStateLabel(int state, String mode, int count) {
- if (state == IServer.STATE_UNKNOWN)
- return "";
- else if (state == IServer.STATE_STARTING)
- return startingText[count];
- else if (state == IServer.STATE_STOPPING)
- return stoppingText[count];
- else if (state == IServer.STATE_STARTED) {
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- return Messages.viewStatusStartedDebug;
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- return Messages.viewStatusStartedProfile;
- else
- return Messages.viewStatusStarted;
- } else if (state == IServer.STATE_STOPPED)
- return Messages.viewStatusStopped;
-
- return serverStateUnmanaged[state];
- }
-
- /**
- * @see UIDecorator#getStateImage(int, String, int)
- */
- public Image getStateImage(int state, String mode, int count) {
- if (state == IServer.STATE_UNKNOWN)
- return null;
- else if (state == IServer.STATE_STARTING)
- return startingImages[count];
- else if (state == IServer.STATE_STOPPING)
- return stoppingImages[count];
- else if (state == IServer.STATE_STOPPED)
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPED);
- else { //if (state == IServer.STATE_STARTED) {
- //String mode = server.getMode();
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED_DEBUG);
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED_PROFILE);
- else
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED);
- }
- }
-
- public String getModuleName() {
- return "module";
- }
-
- public boolean canRestart() {
- return true;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/PublishedUIDecorator.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/PublishedUIDecorator.java
deleted file mode 100644
index b4f63b02e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/PublishedUIDecorator.java
+++ /dev/null
@@ -1,102 +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.server.ui.internal.provisional;
-
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-
-public class PublishedUIDecorator extends UIDecorator {
- private static final String[] serverStateUnmanaged = new String[] {
- "",
- Messages.viewStatusStarting4,
- Messages.viewStatusStarted2,
- Messages.viewStatusStopping4,
- Messages.viewStatusStopped2};
-
- private static final String[] startingText = new String[] {
- Messages.viewStatusStarting1,
- Messages.viewStatusStarting2,
- Messages.viewStatusStarting3};
-
- private static final String[] stoppingText = new String[] {
- Messages.viewStatusStopping1,
- Messages.viewStatusStopping2,
- Messages.viewStatusStopping3};
-
- private static final Image[] startingImages = new Image[] {
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTING_1),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTING_2),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTING_3)
- };
-
- private static final Image[] stoppingImages = new Image[] {
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPING_1),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPING_2),
- ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPING_2)
- };
-
- /**
- * @see UIDecorator#getStateLabel(int, String, int)
- */
- public String getStateLabel(int state, String mode, int count) {
- if (state == IServer.STATE_UNKNOWN)
- return "";
- else if (state == IServer.STATE_STARTING)
- return startingText[count];
- else if (state == IServer.STATE_STOPPING)
- return stoppingText[count];
- else if (state == IServer.STATE_STARTED) {
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- return Messages.viewStatusStartedDebug;
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- return Messages.viewStatusStartedProfile;
- else
- return Messages.viewStatusStarted;
- } else if (state == IServer.STATE_STOPPED)
- return Messages.viewStatusStopped;
-
- return serverStateUnmanaged[state];
- }
-
- /**
- * @see UIDecorator#getStateImage(int, String, int)
- */
- public Image getStateImage(int state, String mode, int count) {
- if (state == IServer.STATE_UNKNOWN)
- return null;
- else if (state == IServer.STATE_STARTING)
- return startingImages[count];
- else if (state == IServer.STATE_STOPPING)
- return stoppingImages[count];
- else if (state == IServer.STATE_STOPPED)
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPED);
- else { //if (state == IServer.STATE_STARTED) {
- //String mode = server.getMode();
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED_DEBUG);
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED_PROFILE);
- else
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED);
- }
- }
-
- public String getModuleName() {
- return "module";
- }
-
- public boolean canRestart() {
- return false;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ServerEditorActionFactoryDelegate.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ServerEditorActionFactoryDelegate.java
deleted file mode 100644
index d60a390dd..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/ServerEditorActionFactoryDelegate.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.provisional;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.IEditorSite;
-
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
-/**
- *
- * @plannedfor 1.0
- */
-public abstract class ServerEditorActionFactoryDelegate {
- /**
- * Returns true if this editor action should be visible on the given
- * server. This allows actions to be filtered based on the server type
- * or server attributes.
- *
- * @param server the server being edited
- * @return <code>true</code> if the action should be displayed, or
- * <code>false</code> otherwise
- */
- public boolean shouldDisplay(IServerWorkingCopy server) {
- return true;
- }
-
- /**
- * Create the action.
- *
- * @param site the editor site
- * @param input the server editor port input
- * @return an action that can be run against the server
- */
- public abstract IAction createAction(IEditorSite site, IServerEditorPartInput input);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/UIDecorator.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/UIDecorator.java
deleted file mode 100644
index de9952d06..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/UIDecorator.java
+++ /dev/null
@@ -1,56 +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.server.ui.internal.provisional;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-
-public abstract class UIDecorator {
- public static final int ACTION_STOP = 0;
-
- /**
- * Returns a string representing the given state.
- *
- * @param state a server state
- * @param mode a launch mode
- * @param count a timer count
- * @return java.lang.String
- */
- public abstract String getStateLabel(int state, String mode, int count);
-
- /**
- * Returns an image representing the given state.
- *
- * @param state a server state
- * @param mode a launch mode
- * @param count a timer count
- * @return org.eclipse.jface.parts.IImage
- */
- public abstract Image getStateImage(int state, String mode, int count);
-
- public String getModuleName() {
- return "module";
- }
-
- public boolean canRestart() {
- return false;
- }
-
- public void setupAction(Action action, int action2) {
- action.setToolTipText(Messages.actionStopToolTip);
- action.setText(Messages.actionStop);
- action.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_STOP));
- action.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_STOP));
- action.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_STOP));
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/UIDecoratorManager.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/UIDecoratorManager.java
deleted file mode 100644
index e55fdcf26..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/provisional/UIDecoratorManager.java
+++ /dev/null
@@ -1,21 +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.server.ui.internal.provisional;
-
-import org.eclipse.wst.server.core.IServerType;
-
-public class UIDecoratorManager {
- protected static UIDecorator decorator = new ManagedUIDecorator();
-
- public static UIDecorator getUIDecorator(IServerType serverType) {
- return decorator;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/AbstractServerAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/AbstractServerAction.java
deleted file mode 100644
index dd6aaf426..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/AbstractServerAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-import org.eclipse.wst.server.core.IServer;
-/**
- * An abstract class for an action on a server.
- */
-public abstract class AbstractServerAction extends SelectionProviderAction {
- public Shell shell;
-
- public AbstractServerAction(Shell shell, ISelectionProvider selectionProvider, String name) {
- super(selectionProvider, name);
- this.shell = shell;
- setEnabled(false);
- }
-
- /**
- * Return true if this server can currently be acted on.
- *
- * @return boolean
- * @param server org.eclipse.wst.server.core.IServer
- */
- public abstract boolean accept(IServer server);
-
- /**
- * Perform action on this server.
- * @param server org.eclipse.wst.server.core.IServer
- */
- public abstract void perform(IServer server);
-
- public void run() {
- Iterator iterator = getStructuredSelection().iterator();
- Object obj = iterator.next();
- if (obj instanceof IServer) {
- IServer server = (IServer) obj;
- if (accept(server))
- perform(server);
- selectionChanged(getStructuredSelection());
- }
- }
-
- /**
- * Update the enable state.
- *
- * @param sel a selection
- */
- public void selectionChanged(IStructuredSelection sel) {
- if (sel.isEmpty()) {
- setEnabled(false);
- return;
- }
- boolean enabled = false;
- Iterator iterator = sel.iterator();
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof IServer) {
- IServer server = (IServer) obj;
- if (accept(server))
- enabled = true;
- } else {
- setEnabled(false);
- return;
- }
- }
- setEnabled(enabled);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/DeleteAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/DeleteAction.java
deleted file mode 100644
index 138e8a2aa..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/DeleteAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.ui.internal.DeleteServerDialog;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.swt.widgets.Shell;
-/**
- * Action for deleting server resources.
- */
-public class DeleteAction extends Action {
- protected IServer[] servers;
- protected IFolder[] configs;
- protected Shell shell;
-
- /**
- * DeleteAction constructor.
- *
- * @param shell a shell
- * @param server a server
- */
- public DeleteAction(Shell shell, IServer server) {
- this(shell, new IServer[] { server });
- }
-
- /**
- * DeleteAction constructor.
- *
- * @param shell a shell
- * @param servers an array of servers
- */
- public DeleteAction(Shell shell, IServer[] servers) {
- super(Messages.actionDelete);
- this.shell = shell;
-
- this.servers = servers;
-
- List list = new ArrayList();
-
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (servers[i].getServerConfiguration() != null)
- list.add(servers[i].getServerConfiguration());
- }
-
- // remove configurations that are still referenced by other servers
- IServer[] servers2 = ServerCore.getServers();
- if (servers2 != null) {
- int size2 = servers2.length;
- for (int j = 0; j < size2; j++) {
- boolean found = false;
- for (int i = 0; i < size; i++) {
- if (servers[i].equals(servers2[j]))
- found = true;
- }
- if (!found) {
- IFolder folder = servers2[j].getServerConfiguration();
- if (folder != null && list.contains(folder))
- list.remove(folder);
- }
- }
- }
-
- configs = new IFolder[list.size()];
- list.toArray(configs);
- }
-
- /**
- * Invoked when an action occurs.
- */
- public void run() {
- DeleteServerDialog dsd = new DeleteServerDialog(shell, servers, configs);
- dsd.open();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModifyModulesAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModifyModulesAction.java
deleted file mode 100644
index f8fa261d6..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModifyModulesAction.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.server.ui.internal.view.servers;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.ClosableWizardDialog;
-import org.eclipse.wst.server.ui.internal.wizard.ModifyModulesWizard;
-/**
- * Action to modify the modules of a server.
- */
-public class ModifyModulesAction extends Action {
- protected IWorkbenchPart part;
- protected IServer server;
-
- /**
- * ModifyModulesAction constructor comment.
- *
- * @param server a server
- */
- public ModifyModulesAction(IServer server) {
- super(Messages.actionModifyModules);
- this.server = server;
- }
-
- /*
- * Notifies this action delegate that the selection in the workbench has changed.
- */
- public void selectionChanged(IAction action, ISelection selection) {
- server = null;
-
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection) selection;
- Object obj = sel.getFirstElement();
- if (obj instanceof IServer)
- server = (IServer) obj;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- part = targetPart;
- }
-
- /*
- * Performs this action.
- */
- public void run(IAction action) {
- if (server == null)
- return;
-
- Shell shell = part.getSite().getShell();
- //if (!ServerUIUtil.promptIfDirty(shell, server))
- // return;
-
- // check if there are any projects first
- // get currently deployed modules
- List deployed = new ArrayList();
- List modules = new ArrayList();
- IModule[] currentModules = server.getModules();
- if (currentModules != null) {
- int size = currentModules.length;
- for (int i = 0; i < size; i++) {
- deployed.add(currentModules[i]);
- }
- }
-
- // get remaining modules
- IModule[] modules2 = ServerUtil.getModules(server.getServerType().getRuntimeType().getModuleTypes());
- if (modules != null) {
- int size = modules2.length;
- for (int i = 0; i < size; i++) {
- IModule module = modules2[i];
- if (!deployed.contains(module)) {
- IStatus status = server.canModifyModules(new IModule[] { module }, null, null);
- if (status != null && status.getSeverity() != IStatus.ERROR)
- modules.add(module);
- }
- }
- }
-
- if (deployed.isEmpty() && modules.isEmpty()) {
- MessageDialog.openInformation(shell, Messages.defaultDialogTitle, Messages.dialogAddRemoveModulesNone);
- return;
- }
-
- ModifyModulesWizard wizard = new ModifyModulesWizard(server);
- ClosableWizardDialog dialog = new ClosableWizardDialog(shell, wizard);
- dialog.open();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleServer.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleServer.java
deleted file mode 100644
index 5452461bd..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleServer.java
+++ /dev/null
@@ -1,78 +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.server.ui.internal.view.servers;
-
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-/**
- * A utility class for referencing a server and a module at the same time.
- */
-public class ModuleServer {
- /**
- * The server
- */
- public IServer server;
-
- /**
- * The module
- */
- public IModule[] module;
-
- /**
- * Create a new module-server.
- *
- * @param server the server
- * @param module the module
- */
- public ModuleServer(IServer server, IModule[] module) {
- this.server = server;
- this.module = module;
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (!(obj instanceof ModuleServer))
- return false;
-
- ModuleServer ms = (ModuleServer) obj;
- if (!ms.server.equals(server))
- return false;
-
- if (ms.module.length != module.length)
- return false;
-
- int size = module.length;
- for (int i = 0; i < size; i++) {
- if (!module[i].equals(ms.module[i]))
- return false;
- }
- return true;
- }
-
- /**
- * @see Object#toString()
- */
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("Server-Module [" + server.getId() + "/" + server.getName() + ", (");
-
- int size = module.length;
- for (int i = 0; i < size; i++) {
- if (i > 0)
- sb.append(", ");
- sb.append(module[i].getName());
- }
- sb.append(")]");
- return sb.toString();
- }
-}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleSloshAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleSloshAction.java
deleted file mode 100644
index 07f690f03..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ModuleSloshAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.ClosableWizardDialog;
-import org.eclipse.wst.server.ui.internal.wizard.ModifyModulesWizard;
-/**
- *
- */
-public class ModuleSloshAction extends AbstractServerAction {
- public ModuleSloshAction(Shell shell, ISelectionProvider selectionProvider, String name) {
- super(shell, selectionProvider, name);
- }
-
- /**
- * Return true if this server can currently be acted on.
- * @return boolean
- * @param server org.eclipse.wst.server.core.IServer
- */
- public boolean accept(IServer server) {
- return true;
- }
-
- /**
- * Perform action on this server.
- * @param server org.eclipse.wst.server.core.IServer
- */
- public void perform(final IServer server) {
- if (server == null)
- return;
-
- //if (!ServerUIUtil.promptIfDirty(shell, server))
- // return;
-
- // check if there are any projects first
- // get currently deployed modules
- List deployed = new ArrayList();
- List modules = new ArrayList();
- IModule[] currentModules = server.getModules();
- if (currentModules != null) {
- int size = currentModules.length;
- for (int i = 0; i < size; i++) {
- deployed.add(currentModules[i]);
- }
- }
-
- // get remaining modules
- IModule[] modules2 = ServerUtil.getModules(server.getServerType().getRuntimeType().getModuleTypes());
- if (modules != null) {
- int size = modules2.length;
- for (int i = 0; i < size; i++) {
- IModule module = modules2[i];
- if (!deployed.contains(module)) {
- IStatus status = server.canModifyModules(new IModule[] { module }, null, null);
- if (status != null && status.getSeverity() != IStatus.ERROR)
- modules.add(module);
- }
- }
- }
-
- if (deployed.isEmpty() && modules.isEmpty()) {
- MessageDialog.openInformation(shell, Messages.defaultDialogTitle, Messages.dialogAddRemoveModulesNone);
- return;
- }
-
- ModifyModulesWizard wizard = new ModifyModulesWizard(server);
- ClosableWizardDialog dialog = new ClosableWizardDialog(shell, wizard);
- dialog.open();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerAction.java
deleted file mode 100644
index 6b02675eb..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerAction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Action for monitoring a server.
- */
-public class MonitorServerAction extends Action {
- protected IServer server;
- protected Shell shell;
-
- /**
- * MonitorServerAction constructor.
- *
- * @param shell a shell
- * @param server a server
- */
- public MonitorServerAction(Shell shell, IServer server) {
- super(Messages.actionMonitorProperties);
- this.shell = shell;
- this.server = server;
- }
-
- /**
- * Invoked when an action occurs.
- */
- public void run() {
- MonitorServerDialog msd = new MonitorServerDialog(shell, server);
- msd.open();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerDialog.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerDialog.java
deleted file mode 100644
index df2fbc25e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerDialog.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.viewers.MonitorComposite;
-import org.eclipse.osgi.util.NLS;
-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;
-/**
- * Dialog that prompts a user to monitor ports from a given server.
- */
-public class MonitorServerDialog extends Dialog {
- protected IServer server;
- protected MonitorComposite monitorComp;
-
- /**
- * MonitorServerDialog constructor comment.
- * @param parentShell the parent shell
- * @param server the server
- */
- public MonitorServerDialog(Shell parentShell, IServer server) {
- super(parentShell);
- this.server = server;
-
- setBlockOnOpen(true);
- }
-
- /**
- *
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Messages.dialogMonitorTitle);
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- }
-
- /**
- *
- */
- protected Control createDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 550;
- composite.setLayoutData(data);
- composite.setFont(parent.getFont());
- //WorkbenchHelp.setHelp(composite, ContextIds.TERMINATE_SERVER_DIALOG);
-
- Label label = new Label(composite, SWT.WRAP);
- label.setText(NLS.bind(Messages.dialogMonitorDescription, new String[] { server.getName() } ));
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- label.setLayoutData(data);
-
- monitorComp = new MonitorComposite(composite, SWT.NONE, null, server);
- monitorComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerPortAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerPortAction.java
deleted file mode 100644
index d63b630af..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/MonitorServerPortAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.action.Action;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.IMonitoredServerPort;
-import org.eclipse.wst.server.core.internal.IServerMonitorManager;
-import org.eclipse.wst.server.core.internal.ServerMonitorManager;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-/**
- * Monitor a server port.
- */
-public class MonitorServerPortAction extends Action {
- protected Shell shell;
- protected IServer server;
- protected ServerPort port;
- protected IMonitoredServerPort monitoredPort;
- protected boolean checked;
-
- public MonitorServerPortAction(Shell shell, IServer server, ServerPort port) {
- super(NLS.bind(Messages.actionMonitorPort, new String[] { port.getPort() + "", port.getName() }));
-
- this.shell = shell;
- this.server = server;
- this.port = port;
-
- IMonitoredServerPort[] msps = ServerMonitorManager.getInstance().getMonitoredPorts(server);
- if (msps != null) {
- int size = msps.length;
- for (int i = 0; i < size; i++) {
- if (port.equals(msps[i].getServerPort()) && // msps[i].isStarted() &&
- (msps[i].getContentTypes() == null || msps[i].getContentTypes().length == 0 ||
- (port.getContentTypes() != null && msps[i].getContentTypes().length == port.getContentTypes().length)))
- monitoredPort = msps[i];
- }
- }
-
- checked = monitoredPort != null; // && monitoredPort.isStarted();
- setChecked(checked);
- }
-
- /**
- * Enable or disable monitoring.
- */
- public void run() {
- IServerMonitorManager smm = ServerMonitorManager.getInstance();
- if (checked) {
- smm.removeMonitor(monitoredPort);
- } else {
- if (monitoredPort == null)
- monitoredPort = smm.createMonitor(server, port, -1, null);
-
- try {
- smm.startMonitor(monitoredPort);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not monitor", e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/OpenAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/OpenAction.java
deleted file mode 100644
index d4435f5de..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/OpenAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- * "Open" menu action.
- */
-public class OpenAction extends Action {
- protected IServer server;
-
- /**
- * OpenAction constructor.
- *
- * @param server a server
- */
- public OpenAction(IServer server) {
- super(Messages.actionOpen);
-
- this.server = server;
- setEnabled(server.getServerType() != null);
- }
-
- /**
- * Implementation of method defined on <code>IAction</code>.
- */
- public void run() {
- try {
- ServerUIPlugin.editServer(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error editing element", e);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/PublishAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/PublishAction.java
deleted file mode 100644
index c86ce8d8f..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/PublishAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.PublishServerJob;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.swt.widgets.Shell;
-/**
- * Publish to a server.
- */
-public class PublishAction extends AbstractServerAction {
- public PublishAction(Shell shell, ISelectionProvider selectionProvider, String name) {
- super(shell, selectionProvider, name);
- try {
- selectionChanged((IStructuredSelection) selectionProvider.getSelection());
- } catch (Exception e) {
- // ignore
- }
- }
-
- /**
- * Return true if this server can currently be acted on.
- * @return boolean
- * @param server org.eclipse.wst.server.core.IServer
- */
- public boolean accept(IServer server) {
- return server.canPublish().isOK();
- }
-
- /**
- * Perform action on this server.
- * @param server org.eclipse.wst.server.core.IServer
- */
- public void perform(final IServer server) {
- if (!ServerUIPlugin.promptIfDirty(shell, server))
- return;
-
- if (!ServerUIPlugin.saveEditors())
- return;
-
- PublishServerJob publishJob = new PublishServerJob(server, IServer.PUBLISH_INCREMENTAL, false);
- publishJob.setUser(true);
- publishJob.schedule();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RemoveModuleAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RemoveModuleAction.java
deleted file mode 100644
index 72fc7ba6c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RemoveModuleAction.java
+++ /dev/null
@@ -1,57 +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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.swt.widgets.Shell;
-/**
- * Action for removing a module from a server.
- */
-public class RemoveModuleAction extends Action {
- protected IServer server;
- protected IModule module;
- protected Shell shell;
-
- /**
- * RemoveModuleAction constructor.
- *
- * @param shell a shell
- * @param server a server
- * @param module a module
- */
- public RemoveModuleAction(Shell shell, IServer server, IModule module) {
- super(Messages.actionRemove);
- this.shell = shell;
-
- this.server = server;
- this.module = module;
- }
-
- /**
- * Invoked when an action occurs.
- */
- public void run() {
- if (MessageDialog.openConfirm(shell, Messages.defaultDialogTitle, Messages.dialogRemoveModuleConfirm)) {
- try {
- IServerWorkingCopy wc = server.createWorkingCopy();
- wc.modifyModules(null, new IModule[] { module }, null);
- wc.save(true, null);
- } catch (Exception e) {
- // ignore
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RestartAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RestartAction.java
deleted file mode 100644
index d0591f9c0..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RestartAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.RestartServerJob;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.internal.provisional.UIDecoratorManager;
-import org.eclipse.swt.widgets.Shell;
-/**
- * Restart a server.
- */
-public class RestartAction extends AbstractServerAction {
- protected String mode;
-
- public RestartAction(Shell shell, ISelectionProvider selectionProvider, String name) {
- this(shell, selectionProvider, name, null);
- }
-
- public RestartAction(Shell shell, ISelectionProvider selectionProvider, String name, String mode) {
- super(shell, selectionProvider, name);
- try {
- selectionChanged((IStructuredSelection) selectionProvider.getSelection());
- } catch (Exception e) {
- // ignore
- }
- this.mode = mode;
- }
-
- /**
- * Return true if this server can currently be acted on.
- *
- * @return boolean
- * @param server org.eclipse.wst.server.core.IServer
- */
- public boolean accept(IServer server) {
- String mode2 = mode;
- if (mode2 == null)
- mode2 = server.getMode();
- return server.getServerType() != null && UIDecoratorManager.getUIDecorator(server.getServerType()).canRestart() && server.canRestart(mode2).isOK();
- }
-
- /**
- * Perform action on this server.
- * @param server org.eclipse.wst.server.core.IServer
- */
- public void perform(IServer server) {
- if (!ServerUIPlugin.promptIfDirty(shell, server))
- return;
-
- try {
- String launchMode = mode;
- if (launchMode == null)
- launchMode = server.getMode();
- RestartServerJob restartJob = new RestartServerJob(server, launchMode);
- restartJob.schedule();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error restarting server", e);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RestartModuleAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RestartModuleAction.java
deleted file mode 100644
index f5fd9822e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/RestartModuleAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Restart a module on a server.
- */
-public class RestartModuleAction extends Action {
- protected IServer server;
- protected IModule[] module;
-
- public RestartModuleAction(IServer server, IModule[] module) {
- super();
- this.server = server;
- this.module = module;
-
- int size = module.length;
- setText(NLS.bind(Messages.actionRestartModule, module[size - 1].getName()));
-
- setEnabled(server.canControlModule(module, null).isOK() && server.getModuleState(module) != IServer.STATE_STOPPED);
- }
-
- /**
- * Implementation of method defined on <code>IAction</code>.
- */
- public void run() {
- server.restartModule(module, null);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerAction.java
deleted file mode 100644
index 450031263..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.actions.SelectionProviderAction;
-/**
- *
- */
-public class ServerAction extends SelectionProviderAction {
- protected Shell shell;
- protected byte action;
-
- public ServerAction(Shell shell, ISelectionProvider provider, String label, byte action) {
- super(provider, label);
- this.shell = shell;
- this.action = action;
- setEnabled(ServerActionHelper.isActionEnabled(getSelection(), action));
- }
-
- /**
- * Notifies this action that the given (non-structured) selection has changed
- * in the selection provider.
- * <p>
- * The <code>SelectionProviderAction</code> implementation of this method
- * does nothing. Subclasses may reimplement to react to this selection change.
- * </p>
- *
- * @param selection the new selection
- */
- public void selectionChanged(ISelection selection) {
- setEnabled(ServerActionHelper.isActionEnabled(selection, action));
- }
-
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(ServerActionHelper.isActionEnabled(selection, action));
- }
-
- /**
- * The default implementation of this <code>IAction</code> method
- * does nothing. Subclasses should override this method
- * if they do not need information from the triggering event,
- * or override <code>run(Event)</code> if they do.
- */
- public void run() {
- ServerActionHelper.performAction(shell, getSelection(), action);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerActionHelper.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerActionHelper.java
deleted file mode 100644
index a766536af..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerActionHelper.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import java.util.Iterator;
-
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.actions.NewServerWizardAction;
-import org.eclipse.swt.widgets.Shell;
-/**
- *
- */
-public class ServerActionHelper {
- /**
- * Constants for actions
- */
- public static final byte ACTION_OPEN = 0;
- public static final byte ACTION_DELETE = 1;
- public static final byte ACTION_BOOKMARK = 2;
-
- private ServerActionHelper() {
- // do nothing
- }
-
- public static void fillContextMenu(Shell shell, ISelection selection, IMenuManager menu) {
- MenuManager newMenu = new MenuManager(Messages.actionNew);
- fillNewContextMenu(shell, selection, newMenu);
- menu.add(newMenu);
- fillOtherContextMenu(shell, selection, menu);
- }
-
- public static void fillNewContextMenu(Shell shell, ISelection selection, IMenuManager menu) {
- IAction newServerAction = new NewServerWizardAction();
- newServerAction.setText(Messages.actionNewServer);
- menu.add(newServerAction);
- }
-
- public static void fillOtherContextMenu(Shell shell, ISelection selection, IMenuManager menu) {
- if (selection == null)
- return;
-
- if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
- return;
- }
-
- protected static void addServerActions(Shell shell, IMenuManager menu, IServer server) {
- final ISelection selection = new StructuredSelection(server);
- ISelectionProvider provider = new ISelectionProvider() {
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- // do nothing
- }
- public ISelection getSelection() {
- return selection;
- }
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- // do nothing
- }
- public void setSelection(ISelection sel) {
- // do nothing
- }
- };
-
- // create the debug action
- Action debugAction = new StartAction(shell, provider, "debug", ILaunchManager.DEBUG_MODE);
- debugAction.setToolTipText(Messages.actionDebugToolTip);
- debugAction.setText(Messages.actionDebug);
- debugAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START_DEBUG));
- debugAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START_DEBUG));
- debugAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START_DEBUG));
- menu.add(debugAction);
-
- // create the start action
- Action runAction = new StartAction(shell, provider, "start", ILaunchManager.RUN_MODE);
- runAction.setToolTipText(Messages.actionStartToolTip);
- runAction.setText(Messages.actionStart);
- runAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START));
- runAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START));
- runAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START));
- menu.add(runAction);
-
- // create the profile action
- Action profileAction = new StartAction(shell, provider, "profile", ILaunchManager.PROFILE_MODE);
- profileAction.setToolTipText(Messages.actionProfileToolTip);
- profileAction.setText(Messages.actionProfile);
- profileAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START_PROFILE));
- profileAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START_PROFILE));
- profileAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START_PROFILE));
- menu.add(profileAction);
-
- // create the restart action
- MenuManager menuManager = new MenuManager(Messages.actionRestart);
-
- Action restartAction = new RestartAction(shell, provider, "restart", ILaunchManager.RUN_MODE);
- restartAction.setToolTipText(Messages.actionRestartToolTip);
- restartAction.setText(Messages.actionRestart);
- restartAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_RESTART));
- restartAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_RESTART));
- restartAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_RESTART));
- menuManager.add(restartAction);
- //menu.add(restartAction);
- menu.add(menuManager);
-
- // create the stop action
- /*Action stopAction = new StopAction(shell, provider, "stop", IServerFactory.SERVER_STATE_SET_MANAGED);
- stopAction.setToolTipText(Messages.actionStopToolTip"));
- stopAction.setText(Messages.actionStop"));
- stopAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_STOP));
- stopAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_STOP));
- stopAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_STOP));
- menu.add(stopAction);
-
- // create the disconnect action
- Action disconnectAction = new StopAction(shell, provider, "disconnect", IServerFactory.SERVER_STATE_SET_ATTACHED);
- disconnectAction.setToolTipText(Messages.actionStopToolTip2"));
- disconnectAction.setText(Messages.actionStop2"));
- disconnectAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_DISCONNECT));
- disconnectAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_DISCONNECT));
- disconnectAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_DISCONNECT));
- menu.add(disconnectAction);*/
-
- // create the publish action
- Action publishAction = new PublishAction(shell, provider, "publish");
- publishAction.setToolTipText(Messages.actionPublishToolTip);
- publishAction.setText(Messages.actionPublish);
- publishAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_PUBLISH));
- publishAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_PUBLISH));
- publishAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_PUBLISH));
- menu.add(publishAction);
- }
-
- public static boolean isActionEnabled(ISelection selection, byte action) {
- if (selection == null || action < 0)
- return false;
-
- if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
- return false;
-
- IStructuredSelection sel = (IStructuredSelection) selection;
-
- if (action == ACTION_OPEN) {
- return false;
- } else if (action == ACTION_DELETE) {
- // get selection but avoid no selection or multiple selection
- IModule[] module = null;
- if (!sel.isEmpty()) {
- Iterator iterator = sel.iterator();
- Object obj = iterator.next();
- if (obj instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) obj;
- module = ms.module;
- }
- if (iterator.hasNext())
- module = null;
- }
-
- return (module == null || module.length == 1);
- }
-
- return false;
- }
-
- public static boolean performAction(Shell shell, ISelection selection, byte action) {
- //if (!isActionEnabled(selection, action))
- // return false;
-
- if (selection == null || action < 0)
- return false;
-
- if (selection.isEmpty() || !(selection instanceof IStructuredSelection))
- return false;
-
- IStructuredSelection sel = (IStructuredSelection) selection;
-
- if (action == ACTION_OPEN) {
- if (sel.size() != 1)
- return false;
-
- Object obj = sel.getFirstElement();
- if (obj instanceof IServer) {
- Action open = new OpenAction((IServer) obj);
- open.run();
- return true;
- }
- return false;
- } else if (action == ACTION_DELETE) {
- // get selection but avoid no selection or multiple selection
- IServer server = null;
- IModule[] module = null;
- if (!sel.isEmpty()) {
- Iterator iterator = sel.iterator();
- Object obj = iterator.next();
- if (obj instanceof IServer)
- server = (IServer) obj;
- if (obj instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) obj;
- server = ms.server;
- module = ms.module;
- }
- if (iterator.hasNext()) {
- server = null;
- module = null;
- }
- }
-
- if (module == null)
- new DeleteAction(shell, server).run();
- else if (module.length == 1)
- new RemoveModuleAction(shell, server, module[0]).run();
-
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns an action of the specified type, which can be used for global.
- *
- * @param shell a shell
- * @param provider a selection provider
- * @param action an action
- * @return an action
- */
- public static IAction getAction(Shell shell, ISelectionProvider provider, byte action) {
- if (action == ACTION_DELETE) {
- return new ServerAction(shell, provider, Messages.actionDelete, ServerActionHelper.ACTION_DELETE);
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableLabelProvider.java
deleted file mode 100644
index c82a0667e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableLabelProvider.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.internal.DefaultServerLabelDecorator;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.provisional.UIDecoratorManager;
-import org.eclipse.swt.graphics.Image;
-/**
- * Server table label provider.
- */
-public class ServerTableLabelProvider implements ITableLabelProvider {
- public static final String[] syncState = new String[] {
- Messages.viewSyncOkay,
- Messages.viewSyncRestart,
- Messages.viewSyncPublish,
- Messages.viewSyncRestartPublish,
- Messages.viewSyncPublishing};
-
- public static final String[] syncStateUnmanaged = new String[] {
- Messages.viewSyncOkay2,
- Messages.viewSyncRestart2,
- Messages.viewSyncPublish2,
- Messages.viewSyncRestartPublish2,
- Messages.viewSyncPublishing2};
-
- private int count = 0;
-
- protected DefaultServerLabelDecorator decorator = new DefaultServerLabelDecorator();
-
- protected IServer defaultServer;
-
- /**
- * ServerTableLabelProvider constructor comment.
- */
- public ServerTableLabelProvider() {
- super();
- }
-
- public void addListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- public void dispose() {
- decorator.dispose();
- }
-
- public void setDefaultServer(IServer ds) {
- defaultServer = ds;
- }
-
- public IServer getDefaultServer() {
- return defaultServer;
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- if (element instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) element;
- if (columnIndex == 0) {
- return ServerUICore.getLabelProvider().getImage(ms.module[ms.module.length - 1]);
- } else if (columnIndex == 1)
- return getStateImage(ms.server.getServerType(), ms.server.getModuleState(ms.module), null);
- else if (columnIndex == 2) {
- IStatus status = ((Server) ms.server).getModuleStatus(ms.module);
- if (status != null) {
- ISharedImages sharedImages = ServerUIPlugin.getInstance().getWorkbench().getSharedImages();
- if (status.getSeverity() == IStatus.ERROR)
- return sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
- else if (status.getSeverity() == IStatus.WARNING)
- return sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
- else if (status.getSeverity() == IStatus.INFO)
- return sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
- }
- }
- return null;
- }
- IServer server = (IServer) element;
- if (columnIndex == 0) {
- if (server.getServerType() != null) {
- Image image = ImageResource.getImage(server.getServerType().getId());
- IStatus status = ((Server) server).getServerStatus();
- if (defaultServer != null && defaultServer.equals(server) || status != null) {
- Image decorated = decorator.decorateImage(image, element);
- if (decorated != null)
- return decorated;
- }
- return image;
- }
- return null;
- } else if (columnIndex == 1) {
- IServerType serverType = server.getServerType();
- if (serverType == null)
- return null;
- //if (serverType.getServerStateSet() == IServerType.SERVER_STATE_SET_PUBLISHED)
- // return null;
- return getServerStateImage(server);
- } else
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) element;
- if (columnIndex == 0) {
- int size = ms.module.length;
- return ms.module[size - 1].getName();
- } else if (columnIndex == 1)
- return getStateLabel(ms.server.getServerType(), ms.server.getModuleState(ms.module), null);
- else if (columnIndex == 2) {
- IStatus status = ((Server) ms.server).getModuleStatus(ms.module);
- if (status != null)
- return status.getMessage();
- return "";
- }
- }
- IServer server = (IServer) element;
- if (columnIndex == 0)
- return notNull(server.getName());
- else if (columnIndex == 1) {
- IServerType serverType = server.getServerType();
- if (serverType != null)
- return getServerStateLabel(server);
-
- return "";
- } else if (columnIndex == 2) {
- IStatus status = ((Server) server).getServerStatus();
- if (status != null)
- return status.getMessage();
-
- if (server.getServerType() == null)
- return "";
-
- //if (server.getServerType().hasServerConfiguration() && server.getServerConfiguration() == null)
- // return Messages.viewNoConfiguration");
-
- if (server.getServerState() == IServer.STATE_UNKNOWN)
- return "";
-
- String serverId = server.getId();
- if (ServerTableViewer.publishing.contains(serverId))
- return syncState[4];
-
- int i = 0;
- //if (server.getServerRestartState())
- if (((Server)server).shouldRestart())
- i = 1;
-
- // republish
- if (((Server)server).shouldPublish())
- i += 2;
-
- //IServerType serverType = server.getServerType();
- // TODO: state set
- //if (serverType.getServerStateSet() == IServerType.SERVER_STATE_SET_MANAGED)
- return syncState[i];
- //return syncStateUnmanaged[i];
- } else
- return "-";
- }
-
- protected String notNull(String s) {
- if (s == null)
- return "";
- return s;
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- /**
- * Returns an image representing the server's state.
- *
- * @return org.eclipse.jface.parts.IImage
- * @param server org.eclipse.wst.server.core.IServer
- */
- protected Image getServerStateImage(IServer server) {
- return getStateImage(server.getServerType(), server.getServerState(), server.getMode());
- }
-
- /**
- * Returns an image representing the given state.
- *
- * @return org.eclipse.jface.parts.IImage
- */
- protected Image getStateImage(IServerType serverType, int state, String mode) {
- return UIDecoratorManager.getUIDecorator(serverType).getStateImage(state, mode, count);
- /*if (state == IServer.STATE_UNKNOWN)
- return null;
- else if (state == IServer.STATE_STARTING)
- return startingImages[count];
- else if (state == IServer.STATE_STOPPING)
- return stoppingImages[count];
- else if (state == IServer.STATE_STOPPED)
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STOPPED);
- else { //if (state == IServer.STATE_STARTED) {
- //String mode = server.getMode();
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED_DEBUG);
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED_PROFILE);
- else
- return ImageResource.getImage(ImageResource.IMG_SERVER_STATE_STARTED);
- }*/
- }
-
- /**
- * Returns a string representing the server's state.
- *
- * @return java.lang.String
- * @param server org.eclipse.wst.server.core.IServer
- */
- protected String getServerStateLabel(IServer server) {
- return getStateLabel(server.getServerType(), server.getServerState(), server.getMode());
- }
-
- /**
- * Returns a string representing the given state.
- *
- * @return java.lang.String
- */
- protected String getStateLabel(IServerType serverType, int state, String mode) {
- return UIDecoratorManager.getUIDecorator(serverType).getStateLabel(state, mode, count);
- /*if (stateSet == IServerType.SERVER_STATE_SET_PUBLISHED)
- return "";
-
- if (stateSet == IServerType.SERVER_STATE_SET_MANAGED) {
- if (state == IServer.STATE_UNKNOWN)
- return "";
- else if (state == IServer.STATE_STARTING)
- return startingText[count];
- else if (state == IServer.STATE_STOPPING)
- return stoppingText[count];
- else if (state == IServer.STATE_STARTED) {
- if (ILaunchManager.DEBUG_MODE.equals(mode))
- return Messages.viewStatusStartedDebug");
- else if (ILaunchManager.PROFILE_MODE.equals(mode))
- return Messages.viewStatusStartedProfile");
- else
- return Messages.viewStatusStarted");
- } else if (state == IServer.STATE_STOPPED)
- return Messages.viewStatusStopped");
- }
-
- return serverStateUnmanaged[state];*/
- }
-
- protected void animate() {
- count ++;
- if (count > 2)
- count = 0;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableViewer.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableViewer.java
deleted file mode 100644
index e71389449..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServerTableViewer.java
+++ /dev/null
@@ -1,493 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.util.PublishAdapter;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.actions.ActionFactory;
-/**
- * Tree view showing servers and their associations.
- */
-public class ServerTableViewer extends TreeViewer {
- protected static final String ROOT = "root";
-
- protected IServerLifecycleListener serverResourceListener;
- protected IPublishListener publishListener;
- protected IServerListener serverListener;
-
- protected static Object deletedElement = null;
-
- //protected static Shell fShell;
-
- // servers that are currently publishing and starting
- protected static List publishing = new ArrayList();
- protected static List starting = new ArrayList();
-
- protected ServerTableLabelProvider labelProvider;
- protected ISelectionListener dsListener;
-
- protected ServersView view;
-
- public class ServerContentProvider implements IStructuredContentProvider, ITreeContentProvider {
- public Object[] getElements(Object element) {
- List list = new ArrayList();
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (!((Server)servers[i]).isPrivate())
- list.add(servers[i]);
- }
- }
- return list.toArray();
- }
-
- public void inputChanged(Viewer theViewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getChildren(Object element) {
- if (element instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) element;
- try {
- IModule[] children = ms.server.getChildModules(ms.module, null);
- int size = children.length;
- ModuleServer[] ms2 = new ModuleServer[size];
- for (int i = 0; i < size; i++) {
- int size2 = ms.module.length;
- IModule[] module = new IModule[size2 + 1];
- System.arraycopy(ms.module, 0, module, 0, size2);
- module[size2] = children[i];
- ms2[i] = new ModuleServer(ms.server, module);
- }
- return ms2;
- } catch (Exception e) {
- return null;
- }
- }
-
- IServer server = (IServer) element;
- IModule[] modules = server.getModules();
- int size = modules.length;
- ModuleServer[] ms = new ModuleServer[size];
- for (int i = 0; i < size; i++) {
- ms[i] = new ModuleServer(server, new IModule[] { modules[i] });
- }
- return ms;
- }
-
- public Object getParent(Object element) {
- if (element instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) element;
- return ms.server;
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof ModuleServer) {
- // Check if the module server has child modules.
- ModuleServer curModuleServer = (ModuleServer)element;
- IServer curServer = curModuleServer.server;
- IModule[] curModule = curModuleServer.module;
- if (curServer != null && curModule != null) {
- IModule[] curChildModule = curServer.getChildModules(curModule, null);
- if (curChildModule != null && curChildModule.length > 0)
- return true;
-
- return false;
- }
-
- return false;
- }
-
- IServer server = (IServer) element;
- return server.getModules().length > 0;
- }
- }
-
- /*protected void createHoverHelp(Shell parent, Point p) {
- if (fShell != null) {
- fShell.dispose();
- fShell = null;
- }
- fShell = new Shell(parent, SWT.NO_FOCUS | SWT.ON_TOP | SWT.RESIZE | SWT.NO_TRIM);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 3;
- layout.marginWidth = 3;
- fShell.setLayout(layout);
-
- Display display = parent.getDisplay();
- StyledText text = new StyledText(fShell, SWT.NONE);
- text.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- text.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- text.append("Testing\nThis is multi-line");
-
- fShell.setLocation(p.x, p.y);
- fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
- fShell.pack();
- fShell.setVisible(true);
- }*/
-
- protected Thread thread = null;
- protected boolean stopThread = false;
-
- protected void startThread() {
- stopThread = false;
- if (thread != null)
- return;
-
- thread = new Thread("Servers View Animator") {
- public void run() {
- while (!stopThread) {
- try {
- labelProvider.animate();
- final Object[] rootElements = ((ITreeContentProvider)getContentProvider()).getElements(null);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getTree() != null && !getTree().isDisposed())
- update(rootElements, null);
- }
- });
- Thread.sleep(250);
- } catch (Exception e) {
- Trace.trace(Trace.FINEST, "Error in animated server view", e);
- }
- thread = null;
- }
- }
- };
- thread.setDaemon(true);
- thread.start();
- }
-
- protected void stopThread() {
- stopThread = true;
- }
-
- /**
- * ServerTableViewer constructor comment.
- *
- * @param view the view
- * @param tree the tree
- */
- public ServerTableViewer(final ServersView view, final Tree tree) {
- super(tree);
- this.view = view;
- /*tree.addMouseMoveListener(new MouseMoveListener() {
- public void mouseMove(MouseEvent e) {
- if (fShell != null) {
- fShell.dispose();
- fShell = null;
- }
- }
- });
- tree.addMouseTrackListener(new MouseTrackListener() {
- public void mouseEnter(MouseEvent event) {
- // ignore
- }
-
- public void mouseExit(MouseEvent event) {
- // ignore
- }
-
- public void mouseHover(MouseEvent event) {
- createHoverHelp(tree.getShell(), tree.toDisplay(event.x, event.y));
- }
- });*/
-
- setContentProvider(new ServerContentProvider());
- labelProvider = new ServerTableLabelProvider();
- setLabelProvider(labelProvider);
- setSorter(new ViewerSorter() {
- // empty
- });
-
- setInput(ROOT);
-
- addListeners();
-
- IActionBars actionBars = view.getViewSite().getActionBars();
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), new ServerAction(getControl().getShell(), this, "Delete it!", ServerActionHelper.ACTION_DELETE));
-
- // TODO: add default server listener
- /*dsListener = new ISelectionListener() {
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if (!(selection instanceof IStructuredSelection))
- return;
- IStructuredSelection sel = (IStructuredSelection) selection;
- final Object obj = sel.getFirstElement();
- IProject proj = null;
- if (obj instanceof IResource) {
- IResource res = (IResource) obj;
- proj = res.getProject();
- }
- if (proj == null && obj != null) {
- try {
- IResource res = (IResource) Platform.getAdapterManager().getAdapter(obj, IResource.class);
- if (res != null)
- proj = res.getProject();
- } catch (Exception e) {
- // ignore
- }
- }
- if (proj != null) {
- final IProject project = proj;
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getTree() == null || getTree().isDisposed())
- return;
-
- IServer defaultServer = null;
- if (project != null) {
- IProjectProperties props = ServerCore.getProjectProperties(project);
- defaultServer = props.getDefaultServer();
- }
- IServer oldDefaultServer = labelProvider.getDefaultServer();
- if ((oldDefaultServer == null && defaultServer == null)
- || (oldDefaultServer != null && oldDefaultServer.equals(defaultServer)))
- return;
- labelProvider.setDefaultServer(defaultServer);
-
- if (oldDefaultServer != null)
- refresh(oldDefaultServer);
- if (defaultServer != null)
- refresh(defaultServer);
- }
- });
- }
- }
- };
- view.getViewSite().getPage().addSelectionListener(dsListener);*/
- }
-
- protected void addListeners() {
- serverResourceListener = new IServerLifecycleListener() {
- public void serverAdded(IServer server) {
- addServer(server);
- server.addServerListener(serverListener);
- ((Server) server).addPublishListener(publishListener);
- }
- public void serverChanged(IServer server) {
- refreshServer(server);
- }
- public void serverRemoved(IServer server) {
- removeServer(server);
- server.removeServerListener(serverListener);
- ((Server) server).removePublishListener(publishListener);
- }
- };
- ServerCore.addServerLifecycleListener(serverResourceListener);
-
- publishListener = new PublishAdapter() {
- public void publishStarted(IServer server) {
- handlePublishChange(server, true);
- }
-
- public void publishFinished(IServer server, IStatus status) {
- handlePublishChange(server, false);
- }
- };
-
- serverListener = new IServerListener() {
- public void serverChanged(ServerEvent event) {
- if (event == null) {
- return;
- }
- int eventKind = event.getKind();
- IServer server = event.getServer();
- if ((eventKind & ServerEvent.SERVER_CHANGE) != 0) {
- // server change event
- if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
- refreshServer(server);
- int state = event.getState();
- String id = server.getId();
- if (state == IServer.STATE_STARTING || state == IServer.STATE_STOPPING) {
- if (!starting.contains(id)) {
- if (starting.isEmpty())
- startThread();
- starting.add(id);
- }
- } else {
- if (starting.contains(id)) {
- starting.remove(id);
- if (starting.isEmpty())
- stopThread();
- }
- }
- } else
- refreshServer(server);
- } else if ((eventKind & ServerEvent.MODULE_CHANGE) != 0) {
- // module change event
- if ((eventKind & ServerEvent.STATE_CHANGE) != 0 || (eventKind & ServerEvent.PUBLISH_STATE_CHANGE) != 0) {
- refreshServer(server);
- }
- }
- }
- };
-
- // add listeners to servers
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- servers[i].addServerListener(serverListener);
- ((Server) servers[i]).addPublishListener(publishListener);
- }
- }
- }
-
- protected void refreshServer(final IServer server) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- try {
- refresh(server);
- ISelection sel = ServerTableViewer.this.getSelection();
- ServerTableViewer.this.setSelection(sel);
- } catch (Exception e) {
- // ignore
- }
- }
- });
- }
-
- protected void handleDispose(DisposeEvent event) {
- stopThread();
- //view.getViewSite().getPage().removeSelectionListener(dsListener);
-
- ServerCore.removeServerLifecycleListener(serverResourceListener);
-
- // remove listeners from server
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- servers[i].removeServerListener(serverListener);
- ((Server) servers[i]).removePublishListener(publishListener);
- }
- }
-
- super.handleDispose(event);
- }
-
- /**
- * Called when the publish state changes.
- * @param server org.eclipse.wst.server.core.IServer
- */
- protected void handlePublishChange(IServer server, boolean isPublishing) {
- String serverId = server.getId();
- if (isPublishing)
- publishing.add(serverId);
- else
- publishing.remove(serverId);
-
- refreshServer(server);
- }
-
- /**
- *
- */
- protected void handleServerModulesChanged(IServer server2) {
- if (server2 == null)
- return;
-
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (server2.equals(servers[i]))
- refresh(servers[i]);
- }
- }
- }
-
- /**
- * Called when an element is added.
- * @param server org.eclipse.wst.server.core.IServer
- */
- protected void handleServerResourceAdded(IServer server) {
- add(null, server);
- }
-
- /*protected void handleServerResourceAdded(IServerConfiguration configuration) {
- configurationChange(configuration, true);
- }*/
-
- /**
- * Called when an element is changed.
- * @param server org.eclipse.wst.server.core.IServer
- */
- protected void handleServerResourceChanged(IServer server) {
- refresh(server);
- }
-
- /*protected void handleServerResourceChanged(IServerConfiguration configuration) {
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- IServerConfiguration config = servers[i].getServerConfiguration();
- if (configuration.equals(config))
- refresh(servers[i]);
- }
- }
- }*/
-
- /**
- * Called when an element is removed.
- * @param server org.eclipse.wst.server.core.IServer
- */
- protected void handleServerResourceRemoved(IServer server) {
- remove(server);
-
- String serverId = server.getId();
- publishing.remove(serverId);
-
- view.getViewSite().getActionBars().getStatusLineManager().setMessage(null, null);
- }
-
- /*protected void handleServerResourceRemoved(IServerConfiguration configuration) {
- configurationChange(configuration, false);
- }*/
-
- protected void addServer(final IServer server) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- add(ROOT, server);
- }
- });
- }
-
- protected void removeServer(final IServer server) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- remove(server);
- }
- });
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServersView.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServersView.java
deleted file mode 100644
index de4fe39ef..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServersView.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import java.util.Iterator;
-
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.IDebugView;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.Trace;
-import org.eclipse.wst.server.core.model.ServerDelegate;
-import org.eclipse.wst.server.ui.internal.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.ResourceTransfer;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
-/**
- * View of server, their configurations and status.
- */
-public class ServersView extends ViewPart {
- private static final String TAG_COLUMN_WIDTH = "columnWidth";
-
- protected int[] cols;
-
- protected Tree treeTable;
- protected ServerTableViewer tableViewer;
-
- // actions on a server
- protected Action[] actions;
- protected MenuManager restartMenu;
-
- /**
- * ServersView constructor comment.
- */
- public ServersView() {
- super();
- }
-
- /**
- * createPartControl method comment.
- *
- * @param parent a parent composite
- */
- public void createPartControl(Composite parent) {
- treeTable = new Tree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.NONE);
- treeTable.setHeaderVisible(true);
- treeTable.setLinesVisible(false);
- treeTable.setLayoutData(new GridData(GridData.FILL_BOTH));
- treeTable.setFont(parent.getFont());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(treeTable, ContextIds.VIEW_SERVERS);
-
- // add columns
- TreeColumn column = new TreeColumn(treeTable, SWT.SINGLE);
- column.setText(Messages.viewServer);
- column.setWidth(cols[0]);
-
- TreeColumn column2 = new TreeColumn(treeTable, SWT.SINGLE);
- column2.setText(Messages.viewStatus);
- column2.setWidth(cols[1]);
-
- TreeColumn column3 = new TreeColumn(treeTable, SWT.SINGLE);
- column3.setText(Messages.viewSync);
- column3.setWidth(cols[2]);
-
- tableViewer = new ServerTableViewer(this, treeTable);
- initializeActions(tableViewer);
-
- treeTable.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- try {
- /*TableItem item = table.getSelection()[0];
- IServerResource resource = (IServerResource) item.getData();
- IServerResourceFactory factory = ServerUtil.getServerResourceFactory(resource);
- String label = ServerLabelProvider.getInstance().getText(factory);
- label += " (";
- label += ServerCore.getResourceManager().getServerResourceLocation(resource).getFullPath().toString().substring(1);
- label += ")";
- getViewSite().getActionBars().getStatusLineManager().setMessage(ServerLabelProvider.getInstance().getImage(factory), label);
-
- if (resource instanceof IServer) {
- IServer server = (IServer) resource;
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunch[] launches = launchManager.getLaunches();
- int size = launches.length;
- for (int i = size-1; i >= 0; i--) {
- ILaunchConfiguration config = launches[i].getLaunchConfiguration();
- if (LAUNCH_CONFIGURATION_TYPE_ID.equals(config.getType().getIdentifier()) &&
- ServerCore.getServerRef(server).equals(config.getAttribute(SERVER_REF, (String)null))) {
- selectServerProcess(launches[i]);
- return;
- }
- }
- }*/
- } catch (Exception e) {
- getViewSite().getActionBars().getStatusLineManager().setMessage(null, "");
- }
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- try {
- TreeItem item = treeTable.getSelection()[0];
- Object data = item.getData();
- if (!(data instanceof IServer))
- return;
- IServer server = (IServer) data;
- ServerUIPlugin.editServer(server);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not open server", e);
- }
- }
- });
-
- MenuManager menuManager = new MenuManager("#PopupMenu");
- menuManager.setRemoveAllWhenShown(true);
- final Shell shell = treeTable.getShell();
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(shell, mgr);
- }
- });
- Menu menu = menuManager.createContextMenu(parent);
- treeTable.setMenu(menu);
- getSite().registerContextMenu(menuManager, tableViewer);
- getSite().setSelectionProvider(tableViewer);
-
- initDragAndDrop();
- }
-
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- cols = new int[3];
- for (int i = 0; i < 3; i++) {
- cols[i] = 200;
- if (memento != null) {
- Integer in = memento.getInteger(TAG_COLUMN_WIDTH + i);
- if (in != null && in.intValue() > 5)
- cols[i] = in.intValue();
- }
- }
- }
-
- public void saveState(IMemento memento) {
- TreeColumn[] tc = treeTable.getColumns();
- for (int i = 0; i < 3; i++) {
- int width = tc[i].getWidth();
- if (width != 0)
- memento.putInteger(TAG_COLUMN_WIDTH + i, width);
- }
- }
-
- protected void selectServerProcess(Object process) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow() ;
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IWorkbenchPart part = page.findView(IDebugUIConstants.ID_DEBUG_VIEW);
- if (part != null) {
- IDebugView view = (IDebugView)part.getAdapter(IDebugView.class);
- if (view != null) {
- Viewer viewer = view.getViewer();
- if (viewer != null) {
- viewer.setSelection(new StructuredSelection(process));
- }
- }
- }
- }
- }
- }
-
- /**
- * Initialize actions
- *
- * @param provider a selection provider
- */
- public void initializeActions(ISelectionProvider provider) {
- Shell shell = getSite().getShell();
-
- // create the debug action
- Action debugAction = new StartAction(shell, provider, "debug", ILaunchManager.DEBUG_MODE);
- debugAction.setToolTipText(Messages.actionDebugToolTip);
- debugAction.setText(Messages.actionDebug);
- debugAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START_DEBUG));
- debugAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START_DEBUG));
- debugAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START_DEBUG));
-
- // create the start action
- Action runAction = new StartAction(shell, provider, "start", ILaunchManager.RUN_MODE);
- runAction.setToolTipText(Messages.actionStartToolTip);
- runAction.setText(Messages.actionStart);
- runAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START));
- runAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START));
- runAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START));
-
- // create the profile action
- Action profileAction = new StartAction(shell, provider, "profile", ILaunchManager.PROFILE_MODE);
- profileAction.setToolTipText(Messages.actionProfileToolTip);
- profileAction.setText(Messages.actionProfile);
- profileAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START_PROFILE));
- profileAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START_PROFILE));
- profileAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START_PROFILE));
-
- // create the restart menu
- restartMenu = new MenuManager(Messages.actionRestart);
-
- Action restartAction = new RestartAction(shell, provider, "restartDebug", ILaunchManager.DEBUG_MODE);
- restartAction.setToolTipText(Messages.actionDebugToolTip);
- restartAction.setText(Messages.actionDebug);
- restartAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START_DEBUG));
- restartAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START_DEBUG));
- restartAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START_DEBUG));
- restartMenu.add(restartAction);
-
- restartAction = new RestartAction(shell, provider, "restartRun", ILaunchManager.RUN_MODE);
- restartAction.setToolTipText(Messages.actionRestartToolTip);
- restartAction.setText(Messages.actionStart);
- restartAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START));
- restartAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START));
- restartAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START));
- restartMenu.add(restartAction);
-
- restartAction = new RestartAction(shell, provider, "restartProfile", ILaunchManager.PROFILE_MODE);
- restartAction.setToolTipText(Messages.actionRestartToolTip);
- restartAction.setText(Messages.actionProfile);
- restartAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_START_PROFILE));
- restartAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_START_PROFILE));
- restartAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_START_PROFILE));
- restartMenu.add(restartAction);
-
- // create the restart action
- restartAction = new RestartAction(shell, provider, "restart");
- restartAction.setToolTipText(Messages.actionRestartToolTip);
- restartAction.setText(Messages.actionRestart);
- restartAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_RESTART));
- restartAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_RESTART));
- restartAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_RESTART));
-
- // create the stop action
- Action stopAction = new StopAction(shell, provider, "stop");
- stopAction.setToolTipText(Messages.actionStopToolTip);
- stopAction.setText(Messages.actionStop);
- stopAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_STOP));
- stopAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_STOP));
- stopAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_STOP));
-
- // create the disconnect action
- /*Action disconnectAction = new StopAction(shell, provider, "disconnect", IServerType.SERVER_STATE_SET_ATTACHED);
- disconnectAction.setToolTipText(Messages.actionStopToolTip2"));
- disconnectAction.setText(Messages.actionStop2"));
- disconnectAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_DISCONNECT));
- disconnectAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_DISCONNECT));
- disconnectAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_DISCONNECT));*/
-
- // create the publish action
- Action publishAction = new PublishAction(shell, provider, "publish");
- publishAction.setToolTipText(Messages.actionPublishToolTip);
- publishAction.setText(Messages.actionPublish);
- publishAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_PUBLISH));
- publishAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_PUBLISH));
- publishAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_PUBLISH));
-
- // create the module slosh dialog action
- Action addModuleAction = new ModuleSloshAction(shell, provider, "modules");
- addModuleAction.setToolTipText(Messages.actionModifyModulesToolTip);
- addModuleAction.setText(Messages.actionModifyModules);
- addModuleAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ETOOL_MODIFY_MODULES));
- addModuleAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CTOOL_MODIFY_MODULES));
- addModuleAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DTOOL_MODIFY_MODULES));
-
- actions = new Action[7];
- actions[0] = debugAction;
- actions[1] = runAction;
- actions[2] = profileAction;
- actions[3] = restartAction;
- actions[4] = stopAction;
- actions[5] = publishAction;
- actions[6] = addModuleAction;
-
- // add toolbar buttons
- IContributionManager cm = getViewSite().getActionBars().getToolBarManager();
- for (int i = 0; i < actions.length - 1; i++) {
- cm.add(actions[i]);
- }
- }
-
- protected void fillContextMenu(Shell shell, IMenuManager menu) {
- // get selection but avoid no selection or multiple selection
- IServer server = null;
- IModule[] module = null;
- IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
- if (!selection.isEmpty()) {
- Iterator iterator = selection.iterator();
- Object obj = iterator.next();
- if (obj instanceof IServer)
- server = (IServer) obj;
- if (obj instanceof ModuleServer) {
- ModuleServer ms = (ModuleServer) obj;
- server = ms.server;
- module = ms.module;
- }
- if (iterator.hasNext()) {
- server = null;
- module = null;
- }
- }
-
- // new action
- MenuManager newMenu = new MenuManager(Messages.actionNew);
- ServerActionHelper.fillNewContextMenu(null, selection, newMenu);
- menu.add(newMenu);
-
- // open action
- if (server != null) {
- menu.add(new OpenAction(server));
- if (server.getServerState() == IServer.STATE_UNKNOWN)
- menu.add(new UpdateStatusAction(server));
- menu.add(new Separator());
-
- if (module == null)
- menu.add(new DeleteAction(shell, server));
- else if (module.length == 1)
- menu.add(new RemoveModuleAction(shell, server, module[0]));
- menu.add(new Separator());
-
- // server actions
- for (int i = 0; i < actions.length - 1; i++) {
- if (i == 3)
- menu.add(restartMenu);
- else
- menu.add(actions[i]);
- }
-
- // monitor
- if (server.getServerType() != null) {
- final MenuManager menuManager = new MenuManager(Messages.actionMonitor);
-
- final IServer server2 = server;
- final Shell shell2 = shell;
- menuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- menuManager.removeAll();
- if (server2.getAdapter(ServerDelegate.class) != null) {
- ServerPort[] ports = server2.getServerPorts(null);
- if (ports != null) {
- int size = ports.length;
- for (int i = 0; i < size; i++) {
- if (!ports[i].isAdvanced())
- menuManager.add(new MonitorServerPortAction(shell2, server2, ports[i]));
- }
- }
- }
-
- if (!menuManager.isEmpty())
- menuManager.add(new Separator());
-
- menuManager.add(new MonitorServerAction(shell2, server2));
- }
- });
-
- // add an initial menu item so that the menu appears correctly
- menuManager.add(new MonitorServerAction(shell, server));
- menu.add(menuManager);
- }
- menu.add(new SwitchServerLocationAction(server));
- }
-
- if (server != null && module != null) {
- menu.add(new Separator());
- menu.add(new RestartModuleAction(server, module));
- }
-
- menu.add(new Separator());
- menu.add(actions[6]);
-
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end"));
- }
-
- /**
- *
- */
- public void setFocus() {
- if (treeTable != null)
- treeTable.setFocus();
- }
-
- /**
- * Adds drag and drop support to the Servers view.
- */
- protected void initDragAndDrop() {
- int ops = DND.DROP_COPY;
- Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getInstance(),
- ResourceTransfer.getInstance(), FileTransfer.getInstance() };
- //tableViewer.addDragSupport(ops, transfers, new ServersViewDragAdapter(viewer));
- tableViewer.addDropSupport(ops | DND.DROP_DEFAULT, transfers, new ServersViewDropAdapter(tableViewer));
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServersViewDropAdapter.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServersViewDropAdapter.java
deleted file mode 100644
index 355700b90..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/ServersViewDropAdapter.java
+++ /dev/null
@@ -1,123 +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.server.ui.internal.view.servers;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.ui.part.ResourceTransfer;
-import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.actions.RunOnServerActionDelegate;
-/**
- *
- */
-public class ServersViewDropAdapter extends ViewerDropAdapter {
- protected ServersViewDropAdapter(Viewer viewer) {
- super(viewer);
- }
-
- public void dragEnter(DropTargetEvent event) {
- if (event.detail == DND.DROP_DEFAULT)
- event.detail = DND.DROP_COPY;
-
- super.dragEnter(event);
- }
-
- public boolean performDrop(Object data) {
- Object target = getCurrentTarget();
- IServer server = null;
- if (target instanceof IServer)
- server = (IServer) target;
-
- if (server == null)
- return false;
-
- final IServer finalServer = server;
- RunOnServerActionDelegate ros = new RunOnServerActionDelegate() {
- public IServer getServer(IModule module, String launchMode, IProgressMonitor monitor) {
- return finalServer;
- }
- };
- Action action = new Action() {
- //
- };
- if (data instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection) data;
- data = sel.getFirstElement();
- }
- ros.selectionChanged(action, new StructuredSelection(data));
-
- //if (!action.isEnabled())
- // return false;
-
- ros.run(action);
- return true;
- }
-
- public boolean validateDrop(Object target, int operation, TransferData transferType) {
- if (target == null)
- return false;
- /*IServer server = null;
- if (target instanceof IServer)
- server = (IServer) target;*/
- //if (!ServerUIPlugin.hasModuleArtifact(target))
- // return false;
-
- System.out.println("Target: " + target + " " + operation + " " + transferType);
-
- if (FileTransfer.getInstance().isSupportedType(transferType))
- return true;
- if (ResourceTransfer.getInstance().isSupportedType(transferType))
- return true;
- if (LocalSelectionTransfer.getInstance().isSupportedType(transferType))
- return true;
-
- return false;
- }
-
- /**
- * Returns the resource selection from the LocalSelectionTransfer.
- *
- * @return the resource selection from the LocalSelectionTransfer
- */
- /*private IResource[] getSelectedResources() {
- ArrayList selectedResources = new ArrayList();
-
- ISelection selection = LocalSelectionTransfer.getInstance()
- .getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ssel = (IStructuredSelection) selection;
- for (Iterator i = ssel.iterator(); i.hasNext();) {
- Object o = i.next();
- if (o instanceof IResource) {
- selectedResources.add(o);
- }
- else if (o instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) o;
- IResource r = (IResource) a.getAdapter(IResource.class);
- if (r != null) {
- selectedResources.add(r);
- }
- }
- }
- }
- return (IResource[]) selectedResources.toArray(new IResource[selectedResources.size()]);
- }*/
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/StartAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/StartAction.java
deleted file mode 100644
index 1ca37c3bb..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/StartAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.PublishServerJob;
-import org.eclipse.wst.server.core.internal.ServerPreferences;
-import org.eclipse.wst.server.core.internal.ServerType;
-import org.eclipse.wst.server.core.internal.StartServerJob;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.swt.widgets.Shell;
-/**
- * Start a server.
- */
-public class StartAction extends AbstractServerAction {
- protected String launchMode = ILaunchManager.RUN_MODE;
-
- public StartAction(Shell shell, ISelectionProvider selectionProvider, String name, String launchMode) {
- super(shell, selectionProvider, name);
- this.launchMode = launchMode;
- try {
- selectionChanged((IStructuredSelection) selectionProvider.getSelection());
- } catch (Exception e) {
- // ignore
- }
- }
-
- /**
- * Return true if this server can currently be acted on.
- * @return boolean
- * @param server org.eclipse.wst.server.core.IServer
- */
- public boolean accept(IServer server) {
- return server.canStart(launchMode).isOK();
- }
-
- /**
- * Perform action on this server.
- * @param server org.eclipse.wst.server.core.IServer
- */
- public void perform(final IServer server) {
- //if (!ServerUIUtil.promptIfDirty(shell, server))
- // return;
-
- if (!ServerUIPlugin.saveEditors())
- return;
-
- if (!ServerPreferences.getInstance().isAutoPublishing()) {
- StartServerJob startJob = new StartServerJob(server, launchMode);
- startJob.schedule();
- return;
- }
-
- try {
- PublishServerJob publishJob = new PublishServerJob(server, IServer.PUBLISH_INCREMENTAL, false);
- StartServerJob startJob = new StartServerJob(server, launchMode);
-
- if (((ServerType)server.getServerType()).startBeforePublish()) {
- startJob.setNextJob(publishJob);
- startJob.schedule();
- } else {
- publishJob.setNextJob(startJob);
- publishJob.schedule();
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error starting server", e);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/StopAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/StopAction.java
deleted file mode 100644
index 5abab0ec2..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/StopAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-/**
- * Stop (terminate) a server.
- */
-public class StopAction extends AbstractServerAction {
- public StopAction(Shell shell, ISelectionProvider selectionProvider, String name) {
- super(shell, selectionProvider, name);
- try {
- selectionChanged((IStructuredSelection) selectionProvider.getSelection());
- } catch (Exception e) {
- // ignore
- }
- }
-
- /**
- * Return true if this server can currently be acted on.
- * @return boolean
- * @param server org.eclipse.wst.server.core.IServer
- */
- public boolean accept(IServer server) {
- if (server.getServerType() == null)
- return false;
- return server.getServerType() != null && server.canStop().isOK();
- }
-
- /**
- * Perform action on this server.
- * @param server org.eclipse.wst.server.core.IServer
- */
- public void perform(final IServer server) {
- ServerUIPlugin.addTerminationWatch(shell, server, ServerUIPlugin.STOP);
-
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(shell, Messages.defaultDialogTitle, null,
- NLS.bind(Messages.dialogStoppingServer, server.getName()), MessageDialog.INFORMATION, new String[0], 0);
- dialog.setBlockOnOpen(false);
- dialog.open();
-
- server.stop(false);
- dialog.close();
- }
- });
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/SwitchServerLocationAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/SwitchServerLocationAction.java
deleted file mode 100644
index 05adf79fd..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/SwitchServerLocationAction.java
+++ /dev/null
@@ -1,48 +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.server.ui.internal.view.servers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.*;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Action to switch a server's location between the workspace and metadata.
- */
-public class SwitchServerLocationAction extends Action {
- protected Server server;
-
- /**
- * An action to switch a server's location between the workspace and metadata.
- *
- * @param server a servers
- */
- public SwitchServerLocationAction(IServer server) {
- super();
- this.server = (Server) server;
- if (this.server.getFile() != null)
- setText(Messages.actionMoveServerToMetadata);
- else
- setText(Messages.actionMoveServerToWorkspace);
- }
-
- /**
- * Invoked when an action occurs.
- */
- public void run() {
- try {
- Server.switchLocation(server, null);
- } catch (CoreException ce) {
- // ignore for now
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/UpdateStatusAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/UpdateStatusAction.java
deleted file mode 100644
index 371e32988..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/view/servers/UpdateStatusAction.java
+++ /dev/null
@@ -1,40 +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.server.ui.internal.view.servers;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.*;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Action to update a server's status.
- */
-public class UpdateStatusAction extends Action {
- protected IServer server;
-
- /**
- * An action to update the status of a server.
- *
- * @param server a server
- */
- public UpdateStatusAction(IServer server) {
- super(Messages.actionUpdateStatus);
- this.server = server;
- }
-
- /**
- * Invoked when an action occurs.
- */
- public void run() {
- UpdateServerJob job = new UpdateServerJob(server);
- job.schedule();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTableComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTableComposite.java
deleted file mode 100644
index 6aea532a1..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTableComposite.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-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.Table;
-/**
- *
- */
-public abstract class AbstractTableComposite extends Composite {
- protected Table table;
- protected TableViewer tableViewer;
-
- public AbstractTableComposite(Composite parent, int style) {
- super(parent, style);
-
- createWidgets();
- }
-
- protected void createWidgets() {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- setLayout(layout);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- setLayoutData(data);
-
- createTable();
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- table.setLayoutData(data);
- table.setLinesVisible(true);
- createTableViewer();
- }
-
- protected void createTable() {
- table = new Table(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
- }
-
- protected void createTableViewer() {
- tableViewer = new LockedTableViewer(table);
- }
-
- protected TableViewer getTableViewer() {
- return tableViewer;
- }
-
- protected Object getSelection(ISelection sel2) {
- IStructuredSelection sel = (IStructuredSelection) sel2;
- return sel.getFirstElement();
- }
-
- public void refresh() {
- tableViewer.refresh();
- }
-
- public void refresh(Object obj) {
- tableViewer.refresh(obj);
- }
-
- public void remove(Object obj) {
- tableViewer.remove(obj);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeComposite.java
deleted file mode 100644
index a86da408b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeComposite.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Tree;
-
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- *
- */
-public abstract class AbstractTreeComposite extends Composite {
- protected Tree tree;
- protected TreeViewer treeViewer;
- protected Label description;
-
- public AbstractTreeComposite(Composite parent, int style) {
- super(parent, style);
-
- createWidgets();
- }
-
- protected void createWidgets() {
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = 3;
- layout.verticalSpacing = 3;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- setLayout(layout);
-
- String descriptionText = getDescriptionLabel();
- if (descriptionText != null) {
- Label label = new Label(this, SWT.WRAP);
- label.setText(descriptionText);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- }
-
- Label label = new Label(this, SWT.WRAP);
- label.setText(getTitleLabel());
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
- if (descriptionText != null)
- data.verticalIndent = 7;
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- String details = getDetailsLabel();
- if (details != null) {
- Link prefLink = new Link(this, SWT.NONE);
- data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- data.horizontalSpan = 2;
- prefLink.setLayoutData(data);
- prefLink.setText("<a>" + details + "</a>");
- prefLink.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- detailsSelected();
- }
- });
- }
-
- tree = new Tree(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
- data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = 2;
- tree.setLayoutData(data);
-
- treeViewer = new TreeViewer(tree);
- treeViewer.setSorter(new ViewerSorter());
- treeViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object element = s.getFirstElement();
- if (treeViewer.isExpandable(element))
- treeViewer.setExpandedState(element, !treeViewer.getExpandedState(element));
- }
- });
-
- label = new Label(this, SWT.NONE);
- label.setText("");
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
- label.setLayoutData(data);
-
- // view composite
- Composite comp = new Composite(this, SWT.NONE);
- layout = new GridLayout();
- layout.horizontalSpacing = 3;
- layout.verticalSpacing = 0;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- comp.setLayout(layout);
-
- data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
- comp.setLayoutData(data);
-
- label = new Label(comp, SWT.NONE);
- label.setText(Messages.viewBy);
- data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
- label.setLayoutData(data);
-
- final Combo combo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
- combo.setItems(getComboOptions());
- combo.select(1);
- combo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- int sel = combo.getSelectionIndex();
- viewOptionSelected((byte) sel);
- }
- });
-
- if (hasDescription()) {
- description = new Label(this, SWT.WRAP);
- description.setText(Messages.wizDescription);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 2;
- data.heightHint = 35;
- description.setLayoutData(data);
- }
-
- tree.forceFocus();
- }
-
- protected abstract String getDescriptionLabel();
-
- protected abstract String getTitleLabel();
-
- protected abstract String[] getComboOptions();
-
- protected boolean hasDescription() {
- return true;
- }
-
- protected void setDescription(String text) {
- if (description != null && text != null)
- description.setText(Messages.wizDescription + " " + text);
- }
-
- protected abstract void viewOptionSelected(byte option);
-
- protected TreeViewer getTreeViewer() {
- return treeViewer;
- }
-
- protected Object getSelection(ISelection sel2) {
- IStructuredSelection sel = (IStructuredSelection) sel2;
- return sel.getFirstElement();
- }
-
- public void refresh() {
- treeViewer.refresh();
- }
-
- public void refresh(Object obj) {
- treeViewer.refresh(obj);
- }
-
- public void remove(Object obj) {
- treeViewer.remove(obj);
- }
-
- protected String getDetailsLabel() {
- return null;
- }
-
- protected void detailsSelected() {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeContentProvider.java
deleted file mode 100644
index 9cb8785d9..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeContentProvider.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-/**
- * Runtime type content provider.
- */
-public abstract class AbstractTreeContentProvider implements ITreeContentProvider {
- public static final byte STYLE_FLAT = 0;
-
- public static final String ROOT = "root";
-
- protected byte style;
-
- protected Object initialSelection;
-
- public class TreeElement {
- String text;
- List contents;
- }
-
- protected Object[] elements;
- protected Map elementToParentMap = new HashMap(2);
- protected Map textMap = new HashMap(2);
-
- /**
- * AbstractTreeContentProvider constructor comment.
- *
- * @param style a style parameter
- */
- public AbstractTreeContentProvider(byte style) {
- super();
- this.style = style;
-
- fillTree();
- }
-
- public AbstractTreeContentProvider(byte style, boolean init) {
- super();
- this.style = style;
- }
-
- protected abstract void fillTree();
-
- protected void clean() {
- elements = null;
- elementToParentMap = new HashMap(2);
- textMap = new HashMap(2);
-
- initialSelection = null;
- }
-
- protected TreeElement getOrCreate(List list, String text) {
- try {
- Object obj = textMap.get(text);
- if (obj != null)
- return (TreeElement) obj;
- } catch (Exception e) {
- return null;
- }
-
- TreeElement element = new TreeElement();
- element.text = text;
- element.contents = new ArrayList();
- textMap.put(text, element);
- list.add(element);
- return element;
- }
-
- protected TreeElement getOrCreate(List list, String id, String text) {
- try {
- Object obj = textMap.get(id);
- if (obj != null)
- return (TreeElement) obj;
- } catch (Exception e) {
- return null;
- }
-
- TreeElement element = new TreeElement();
- element.text = text;
- element.contents = new ArrayList();
- textMap.put(id, element);
- list.add(element);
- return element;
- }
-
- protected TreeElement getByText(String text) {
- try {
- return (TreeElement) textMap.get(text);
- } catch (Exception e) {
- return null;
- }
- }
-
- protected TreeElement getParentImpl(Object obj) {
- try {
- return (TreeElement) elementToParentMap.get(obj);
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- * Disposes of this content provider.
- * This is called by the viewer when it is disposed.
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * Returns the elements to display in the viewer
- * when its input is set to the given element.
- * These elements can be presented as rows in a table, items in a list, etc.
- * The result is not modified by the viewer.
- *
- * @param element the input element
- * @return the array of elements to display in the viewer
- */
- public Object[] getElements(Object element) {
- return elements;
- }
-
- public Object[] getChildren(Object element) {
- if (style == STYLE_FLAT)
- return null;
- else if (!(element instanceof TreeElement))
- return null;
-
- TreeElement rte = (TreeElement) element;
- return rte.contents.toArray();
- }
-
- public Object getParent(Object element) {
- if (style == STYLE_FLAT)
- return null;
- //else if (element instanceof TreeElement)
- // return null;
-
- return getParentImpl(element);
- }
-
- public boolean hasChildren(Object element) {
- if (style == STYLE_FLAT)
- return false;
- //else if (!(element instanceof TreeElement))
- // return false;
- Object[] children = getChildren(element);
- return children != null && children.length > 0;
-
- //return true;
- }
-
- /**
- * Notifies this content provider that the given viewer's input
- * has been switched to a different element.
- * <p>
- * A typical use for this method is registering the content provider as a listener
- * to changes on the new input (using model-specific means), and deregistering the viewer
- * from the old input. In response to these change notifications, the content provider
- * propagates the changes to the viewer.
- * </p>
- *
- * @param viewer the viewer
- * @param oldInput the old input element, or <code>null</code> if the viewer
- * did not previously have an input
- * @param newInput the new input element, or <code>null</code> if the viewer
- * does not have an input
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- private Object[] getAllObjects() {
- List list = new ArrayList();
- Object[] obj = getElements(null);
- if (obj != null) {
- int size = obj.length;
- for (int i = 0; i < size; i++) {
- if (!(obj[i] instanceof AbstractTreeContentProvider.TreeElement))
- list.add(obj[i]);
- getAllChildren(list, obj[i]);
- }
- }
- return list.toArray();
- }
-
- private void getAllChildren(List list, Object element) {
- Object[] obj = getChildren(element);
- if (obj != null) {
- int size = obj.length;
- for (int i = 0; i < size; i++) {
- if (!(obj[i] instanceof AbstractTreeContentProvider.TreeElement))
- list.add(obj[i]);
- getAllChildren(list, obj[i]);
- }
- }
- }
-
- public Object getInitialSelection() {
- if (initialSelection == null) {
- InitialSelectionProvider isp = ServerUIPlugin.getInitialSelectionProvider();
- initialSelection = isp.getInitialSelection(getAllObjects());
- }
- return initialSelection;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeLabelProvider.java
deleted file mode 100644
index 44f66c0c6..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/AbstractTreeLabelProvider.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-/**
- * Abstract tree label provider.
- */
-public abstract class AbstractTreeLabelProvider extends BaseLabelProvider {
- /**
- * AbstractTreeLabelProvider constructor comment.
- */
- public AbstractTreeLabelProvider() {
- super();
- }
-
- /**
- * @see BaseLabelProvider#getImage(Object)
- */
- public Image getImage(Object element) {
- if (element instanceof ServerTreeContentProvider.TreeElement) {
- ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
- return sharedImages.getImage(ISharedImages.IMG_OBJ_FOLDER);
- }
- return getImageImpl(element);
- }
-
- /**
- * Return an image for the given element.
- *
- * @param element an element
- * @return an image
- */
- protected abstract Image getImageImpl(Object element);
-
- /**
- * @see BaseLabelProvider#getText(Object)
- */
- public String getText(Object element) {
- if (element instanceof ServerTreeContentProvider.TreeElement) {
- return ((ServerTreeContentProvider.TreeElement) element).text;
- }
- return getTextImpl(element);
- }
-
- /**
- * Return a label for the given element.
- *
- * @param element an element
- * @return a label
- */
- protected abstract String getTextImpl(Object element);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/BaseLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/BaseLabelProvider.java
deleted file mode 100644
index aba56f46b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/BaseLabelProvider.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-/**
- * A basic label provider.
- */
-public abstract class BaseLabelProvider implements ILabelProvider {
- /**
- * BaseLabelProvider constructor comment.
- */
- public BaseLabelProvider() {
- super();
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * @see ILabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- return null;
- }
-
- /**
- * @see ILabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- return "";
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- // do nothing
- }
-
- protected String notNull(String s) {
- if (s == null)
- return "";
- return s;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/DefaultViewerSorter.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/DefaultViewerSorter.java
deleted file mode 100644
index a4b95874b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/DefaultViewerSorter.java
+++ /dev/null
@@ -1,90 +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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.IServerType;
-/**
- * Class used to sort categories, runtime types, and server types in the
- * New wizards.
- */
-public class DefaultViewerSorter extends ViewerSorter {
- /**
- * @see ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public int compare(Viewer viewer, Object o1, Object o2) {
- if (o1 instanceof AbstractTreeContentProvider.TreeElement)
- o1 = ((AbstractTreeContentProvider.TreeElement) o1).text;
-
- if (o2 instanceof AbstractTreeContentProvider.TreeElement)
- o2 = ((AbstractTreeContentProvider.TreeElement) o2).text;
-
- // filter out strings
- if (o1 instanceof String && o2 instanceof String)
- return compareCategories((String) o1, (String) o2);
- if (o1 instanceof String)
- return -1;
- if (o2 instanceof String)
- return 1;
-
- if (o1 instanceof IRuntimeType && o2 instanceof IRuntimeType)
- return compareRuntimeTypes((IRuntimeType) o1, (IRuntimeType) o2);
-
- if (o1 instanceof IServerType && o2 instanceof IServerType)
- return compareServerTypes((IServerType) o1, (IServerType) o2);
-
- return 0;
- }
-
- /**
- * Sort two category names.
- *
- * @param s1 the first category
- * @param s2 the second category
- * @return a negative number if the first element is less than the
- * second element; the value <code>0</code> if the first element is
- * equal to the second element; and a positive number if the first
- * element is greater than the second element
- */
- protected int compareCategories(String s1, String s2) {
- return s1.compareTo(s2);
- }
-
- /**
- * Sort two runtime types.
- *
- * @param r1 the first runtime type
- * @param r2 the second runtime type
- * @return a negative number if the first element is less than the
- * second element; the value <code>0</code> if the first element is
- * equal to the second element; and a positive number if the first
- * element is greater than the second element
- */
- protected int compareRuntimeTypes(IRuntimeType r1, IRuntimeType r2) {
- return r1.getName().compareToIgnoreCase(r2.getName());
- }
-
- /**
- * Sort two server types.
- *
- * @param s1 the first server type
- * @param s2 the second server type
- * @return a negative number if the first element is less than the
- * second element; the value <code>0</code> if the first element is
- * equal to the second element; and a positive number if the first
- * element is greater than the second element
- */
- protected int compareServerTypes(IServerType s1, IServerType s2) {
- return s1.getName().compareToIgnoreCase(s2.getName());
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ILockedLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ILockedLabelProvider.java
deleted file mode 100644
index 7171e03a6..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ILockedLabelProvider.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-/**
- * Extends <code>ITableLabelProvider</code> with methods to provide
- * lock information.
- */
-public interface ILockedLabelProvider {
- /**
- * Returns the lock info for the element. This value will be used
- * to change the presentation of the table row.
- *
- * @param element the object representing the entire row, or
- * <code>null</code> indicating that no input object is set
- * in the viewer
- * @return <code>true</code> if the item is locked, and <code>false</code>
- * otherwise
- */
- public boolean isLocked(Object element);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InitialSelectionProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InitialSelectionProvider.java
deleted file mode 100644
index b1dbff90e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InitialSelectionProvider.java
+++ /dev/null
@@ -1,112 +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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-/**
- * Class used to sort categories, runtime types, and server types in the
- * New wizards.
- */
-public class InitialSelectionProvider extends ViewerSorter {
-
- public Object getInitialSelection(Object[] obj) {
- if (obj == null || obj.length == 0)
- return null;
-
- if (obj[0] instanceof IRuntimeType) {
- int size = obj.length;
- IRuntimeType[] rt = new IRuntimeType[size];
- for (int i = 0; i < size; i++)
- rt[i] = (IRuntimeType) obj[i];
- return getInitialSelection(rt);
- }
-
- if (obj[0] instanceof IServerType) {
- int size = obj.length;
- IServerType[] st = new IServerType[size];
- for (int i = 0; i < size; i++)
- st[i] = (IServerType) obj[i];
- return getInitialSelection(st);
- }
-
- if (obj[0] instanceof IServer) {
- int size = obj.length;
- IServer[] st = new IServer[size];
- for (int i = 0; i < size; i++)
- st[i] = (IServer) obj[i];
- return getInitialSelection(st);
- }
-
- return null;
- }
-
- /**
- *
- * @param serverTypes
- * @return the initial selection
- */
- public IServerType getInitialSelection(IServerType[] serverTypes) {
- if (serverTypes == null)
- return null;
-
- int size = serverTypes.length;
- for (int i = 0; i < size; i++) {
- if (hasRuntime(serverTypes[i]))
- return serverTypes[i];
- }
- return serverTypes[0];
- }
-
- /**
- *
- * @param servers
- * @return the initial selection
- */
- public IServer getInitialSelection(IServer[] servers) {
- if (servers == null)
- return null;
-
- return servers[0];
- }
-
- /**
- *
- * @param runtimeTypes
- * @return the initial selection
- */
- public IRuntimeType getInitialSelection(IRuntimeType[] runtimeTypes) {
- if (runtimeTypes == null)
- return null;
-
- int size = runtimeTypes.length;
- for (int i = 0; i < size; i++) {
- if (hasRuntime(runtimeTypes[i]))
- return runtimeTypes[i];
- }
- return runtimeTypes[0];
- }
-
- protected boolean hasRuntime(IServerType serverType) {
- return hasRuntime(serverType.getRuntimeType());
- }
-
- protected boolean hasRuntime(IRuntimeType runtimeType) {
- if (runtimeType == null)
- return false;
- IRuntime[] runtimes = ServerUIPlugin.getRuntimes(runtimeType);
- return runtimes != null && runtimes.length > 0;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerComposite.java
deleted file mode 100644
index 4d00e8abe..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerComposite.java
+++ /dev/null
@@ -1,102 +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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.wst.server.core.internal.IInstallableServer;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- *
- */
-public class InstallableServerComposite extends AbstractTreeComposite {
- protected IInstallableServer selection;
- protected InstallableServerSelectionListener listener;
-
- protected InstallableServerContentProvider contentProvider;
- protected boolean initialSelection = true;
-
- public interface InstallableServerSelectionListener {
- public void installableServerSelected(IInstallableServer server);
- }
-
- public InstallableServerComposite(Composite parent, int style, InstallableServerSelectionListener listener2) {
- super(parent, style);
- this.listener = listener2;
-
- contentProvider = new InstallableServerContentProvider(InstallableServerContentProvider.STYLE_VENDOR);
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setLabelProvider(new InstallableServerLabelProvider());
- treeViewer.setInput(AbstractTreeContentProvider.ROOT);
-
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- Object obj = getSelection(event.getSelection());
- if (obj instanceof IInstallableServer) {
- selection = (IInstallableServer) obj;
- setDescription(selection.getDescription());
- } else {
- selection = null;
- setDescription("");
- }
- listener.installableServerSelected(selection);
- }
- });
-
- treeViewer.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (e1 instanceof IInstallableServer && !(e2 instanceof IInstallableServer))
- return 1;
- if (!(e1 instanceof IInstallableServer) && e2 instanceof IInstallableServer)
- return -1;
- if (!(e1 instanceof IInstallableServer && e2 instanceof IInstallableServer))
- return super.compare(viewer, e1, e2);
- IInstallableServer r1 = (IInstallableServer) e1;
- IInstallableServer r2 = (IInstallableServer) e2;
- return r1.getName().compareToIgnoreCase(r2.getName());
- }
- });
- treeViewer.expandToLevel(2);
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible && initialSelection) {
- initialSelection = false;
- if (contentProvider.getInitialSelection() != null)
- treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
- }
- }
-
- protected String getTitleLabel() {
- return Messages.installableServerCompTree;
- }
-
- protected String getDescriptionLabel() {
- return null;
- }
-
- protected String[] getComboOptions() {
- return new String[] { Messages.name,
- Messages.vendor, Messages.version };
- }
-
- protected void viewOptionSelected(byte option) {
- ISelection sel = treeViewer.getSelection();
- treeViewer.setContentProvider(new InstallableServerContentProvider(option));
- treeViewer.setSelection(sel);
- }
-
- public IInstallableServer getSelectedInstallableServer() {
- return selection;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerContentProvider.java
deleted file mode 100644
index add684fa5..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerContentProvider.java
+++ /dev/null
@@ -1,62 +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.server.ui.internal.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.server.core.internal.IInstallableServer;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-/**
- * Installable server content provider.
- */
-public class InstallableServerContentProvider extends AbstractTreeContentProvider {
- public static final byte STYLE_VENDOR = 1;
- public static final byte STYLE_VERSION = 2;
-
- public InstallableServerContentProvider(byte style) {
- super(style, false);
-
- fillTree();
- }
-
- public void fillTree() {
- clean();
- List list = new ArrayList();
- if (style != STYLE_FLAT) {
- IInstallableServer[] iis = ServerPlugin.getInstallableServers();
- if (iis != null) {
- int size = iis.length;
- for (int i = 0; i < size; i++) {
- IInstallableServer is = iis[i];
- TreeElement ele = null;
- if (style == STYLE_VENDOR) {
- ele = getOrCreate(list, is.getVendor());
- ele.contents.add(is);
- elementToParentMap.put(is, ele);
- } else if (style == STYLE_VERSION) {
- ele = getOrCreate(list, is.getVersion());
- ele.contents.add(is);
- elementToParentMap.put(is, ele);
- }
- }
- }
- } else {
- IInstallableServer[] iis = ServerPlugin.getInstallableServers();
- if (iis != null) {
- int size = iis.length;
- for (int i = 0; i < size; i++)
- list.add(iis[i]);
- }
- }
- elements = list.toArray();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerLabelProvider.java
deleted file mode 100644
index 3cb707299..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/InstallableServerLabelProvider.java
+++ /dev/null
@@ -1,41 +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.server.ui.internal.viewers;
-
-import org.eclipse.wst.server.core.internal.IInstallableServer;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.swt.graphics.Image;
-/**
- * Installable server label provider.
- */
-public class InstallableServerLabelProvider extends AbstractTreeLabelProvider {
- /**
- * InstallableServerLabelProvider constructor comment.
- */
- public InstallableServerLabelProvider() {
- super();
- }
-
- /**
- *
- */
- protected Image getImageImpl(Object element) {
- return ImageResource.getImage(ImageResource.IMG_SERVER);
- }
-
- /**
- *
- */
- protected String getTextImpl(Object element) {
- IInstallableServer is = (IInstallableServer) element;
- return notNull(is.getName());
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/LockedCheckboxTableViewer.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/LockedCheckboxTableViewer.java
deleted file mode 100644
index ea06b4b55..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/LockedCheckboxTableViewer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Widget;
-/**
- *
- */
-public class LockedCheckboxTableViewer extends CheckboxTableViewer {
- protected Color color;
-
- public LockedCheckboxTableViewer(Table table) {
- super(table);
- createColor(table);
- }
-
- protected void createColor(Control c) {
- color = new Color(c.getDisplay(), 255, 255, 225);
- c.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- color.dispose();
- }
- });
- }
-
- public void doUpdateItem(Widget widget, Object element, boolean fullMap) {
- if (color == null)
- return;
- if (widget instanceof TableItem) {
- TableItem item = (TableItem) widget;
- if (getLabelProvider() instanceof ILockedLabelProvider) {
- ILockedLabelProvider provider = (ILockedLabelProvider) getLabelProvider();
- if (provider.isLocked(element)) {
- item.setBackground(color);
- item.setImage(0, null);
- } else
- item.setBackground(null);
- }
- }
- super.doUpdateItem(widget, element, fullMap);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/LockedTableViewer.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/LockedTableViewer.java
deleted file mode 100644
index 1ec2d15b9..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/LockedTableViewer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Widget;
-/**
- *
- */
-public class LockedTableViewer extends TableViewer {
- protected Color color;
-
- public LockedTableViewer(Composite parent) {
- super(parent);
- createColor(parent);
- }
-
- public LockedTableViewer(Composite parent, int style) {
- super(parent, style);
- createColor(parent);
- }
-
- public LockedTableViewer(Table table) {
- super(table);
- createColor(table);
- }
-
- protected void createColor(Control c) {
- color = new Color(c.getDisplay(), 255, 255, 225);
- c.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- color.dispose();
- }
- });
- }
-
- public void doUpdateItem(Widget widget, Object element, boolean fullMap) {
- if (color == null)
- return;
- if (widget instanceof TableItem) {
- TableItem item = (TableItem) widget;
- if (getLabelProvider() instanceof ILockedLabelProvider) {
- ILockedLabelProvider provider = (ILockedLabelProvider) getLabelProvider();
- if (provider.isLocked(element)) {
- item.setBackground(color);
- item.setImage(0, null);
- } else
- item.setBackground(null);
- }
- }
- super.doUpdateItem(widget, element, fullMap);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorComposite.java
deleted file mode 100644
index c7976905b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorComposite.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.*;
-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.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.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-import org.eclipse.wst.server.core.internal.IMonitoredServerPort;
-import org.eclipse.wst.server.core.internal.IServerMonitorManager;
-import org.eclipse.wst.server.core.internal.ServerMonitorManager;
-import org.eclipse.wst.server.ui.internal.EclipseUtil;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-/**
- *
- */
-public class MonitorComposite extends Composite {
- //protected ServerPort selection;
- protected PortSelectionListener listener;
- protected IServer server;
-
- protected IServerMonitorManager smm;
-
- protected Table monitorTable;
- protected TableViewer monitorTableViewer;
-
- public interface PortSelectionListener {
- public void portSelected(ServerPort port);
- }
-
- public MonitorComposite(Composite parent, int style, PortSelectionListener listener2, IServer server) {
- super(parent, style);
- this.listener = listener2;
- this.server = server;
-
- smm = ServerMonitorManager.getInstance();
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- setLayout(layout);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- setLayoutData(data);
-
- monitorTable = new Table(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- //data.horizontalSpan = 2;
- data.heightHint = 150;
- //data.widthHint = 340;
- monitorTable.setLayoutData(data);
- monitorTable.setLinesVisible(true);
- monitorTableViewer = new TableViewer(monitorTable);
-
- TableLayout tableLayout = new TableLayout();
- monitorTable.setLayout(tableLayout);
- monitorTable.setHeaderVisible(true);
-
- tableLayout.addColumnData(new ColumnWeightData(8, 80, true));
- TableColumn col = new TableColumn(monitorTable, SWT.NONE);
- col.setText(Messages.dialogMonitorColumnStatus);
-
- tableLayout.addColumnData(new ColumnWeightData(12, 120, true));
- col = new TableColumn(monitorTable, SWT.NONE);
- col.setText(Messages.dialogMonitorColumnType);
-
- tableLayout.addColumnData(new ColumnWeightData(8, 80, true));
- col = new TableColumn(monitorTable, SWT.NONE);
- col.setText(Messages.dialogMonitorColumnPort);
-
- tableLayout.addColumnData(new ColumnWeightData(8, 80, true));
- col = new TableColumn(monitorTable, SWT.NONE);
- col.setText(Messages.dialogMonitorColumnMonitorPort);
-
- tableLayout.addColumnData(new ColumnWeightData(8, 80, true));
- col = new TableColumn(monitorTable, SWT.NONE);
- col.setText(Messages.dialogMonitorColumnContentType);
-
- monitorTableViewer.setContentProvider(new MonitorContentProvider(server));
- monitorTableViewer.setLabelProvider(new MonitorLabelProvider(server));
- monitorTableViewer.setInput(AbstractTreeContentProvider.ROOT);
-
- monitorTableViewer.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- IMonitoredServerPort port1 = (IMonitoredServerPort) e1;
- IMonitoredServerPort port2 = (IMonitoredServerPort) e2;
- if (port1.getServerPort().getPort() == port2.getServerPort().getPort()) {
- if (port1.getMonitorPort() == port2.getMonitorPort()) {
- return 0;
- } else if (port1.getMonitorPort() > port2.getMonitorPort())
- return 1;
- else
- return -1;
- } else if (port1.getServerPort().getPort() > port2.getServerPort().getPort())
- return 1;
- else
- return -1;
- }
- });
-
- Composite buttonComp = new Composite(this, SWT.NONE);
- buttonComp.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));
- layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- buttonComp.setLayout(layout);
-
- final IServer server2 = server;
- Button add = SWTUtil.createButton(buttonComp, Messages.add);
- add.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MonitorDialog dialog = new MonitorDialog(getShell(), server2);
- if (dialog.open() != Window.CANCEL) {
- ServerPort port = dialog.getServerPort();
- IMonitoredServerPort sp = smm.createMonitor(server2, port, dialog.getMonitorPort(), dialog.getContentTypes());
- if (sp != null)
- monitorTableViewer.add(sp);
- }
- }
- });
-
- final Button edit = SWTUtil.createButton(buttonComp, Messages.edit);
- edit.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection sel = (IStructuredSelection) monitorTableViewer.getSelection();
- IMonitoredServerPort port = (IMonitoredServerPort) sel.getFirstElement();
- MonitorDialog dialog = new MonitorDialog(getShell(), server2, port.getServerPort(), port.getMonitorPort(), port.getContentTypes());
- if (dialog.open() != Window.CANCEL) {
- smm.removeMonitor(port);
- monitorTableViewer.remove(port);
- port = smm.createMonitor(server2, dialog.getServerPort(), dialog.getMonitorPort(), dialog.getContentTypes());
- if (port != null) {
- monitorTableViewer.add(port);
- monitorTableViewer.setSelection(new StructuredSelection(port));
- }
- }
- }
- });
- edit.setEnabled(false);
-
- final Button remove = SWTUtil.createButton(buttonComp, Messages.remove);
- remove.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IMonitoredServerPort msp = (IMonitoredServerPort) getSelection(monitorTableViewer.getSelection());
- if (msp.isStarted())
- smm.stopMonitor(msp);
- smm.removeMonitor(msp);
- monitorTableViewer.remove(msp);
- }
- });
- remove.setEnabled(false);
-
- final Button start = SWTUtil.createButton(buttonComp, Messages.start);
- start.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection sel = (IStructuredSelection) monitorTableViewer.getSelection();
- IMonitoredServerPort msp = (IMonitoredServerPort) sel.getFirstElement();
- try {
- smm.startMonitor(msp);
- } catch (CoreException ce) {
- EclipseUtil.openError(getShell(), ce.getLocalizedMessage());
- }
- monitorTableViewer.refresh(msp);
- monitorTableViewer.setSelection(new StructuredSelection(msp));
- }
- });
- start.setEnabled(false);
-
- final Button stop = SWTUtil.createButton(buttonComp, Messages.stop);
- stop.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection sel = (IStructuredSelection) monitorTableViewer.getSelection();
- IMonitoredServerPort msp = (IMonitoredServerPort) sel.getFirstElement();
- smm.stopMonitor(msp);
- monitorTableViewer.refresh(msp);
- monitorTableViewer.setSelection(new StructuredSelection(msp));
- }
- });
- stop.setEnabled(false);
-
- monitorTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IMonitoredServerPort port = (IMonitoredServerPort) getSelection(monitorTableViewer.getSelection());
- if (port != null) {
- edit.setEnabled(!port.isStarted());
- remove.setEnabled(true);
- start.setEnabled(!port.isStarted());
- stop.setEnabled(port.isStarted());
- } else {
- edit.setEnabled(false);
- remove.setEnabled(false);
- start.setEnabled(false);
- stop.setEnabled(false);
- }
- }
- });
-
- IMonitoredServerPort[] msps = ServerMonitorManager.getInstance().getMonitoredPorts(server);
- if (msps != null && msps.length > 0)
- monitorTableViewer.setSelection(new StructuredSelection(msps[0]));
- }
-
- protected Object getSelection(ISelection sel2) {
- IStructuredSelection sel = (IStructuredSelection) sel2;
- return sel.getFirstElement();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorContentProvider.java
deleted file mode 100644
index 466619272..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorContentProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.ServerMonitorManager;
-/**
- * Monitor port content provider.
- */
-public class MonitorContentProvider implements IStructuredContentProvider {
- protected IServer server;
-
- public MonitorContentProvider(IServer server) {
- super();
- this.server = server;
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return ServerMonitorManager.getInstance().getMonitoredPorts(server);
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorDialog.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorDialog.java
deleted file mode 100644
index 8f564b5b1..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorDialog.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Dialog that prompts a user to add or edit a server monitor.
- */
-public class MonitorDialog extends Dialog {
- protected IServer server;
- protected ServerPort port;
- protected int monitorPort = -1;
- protected String[] portContentTypes;
- protected String[] contentTypes;
- protected boolean isEdit = false;
- protected boolean portChanged = false;
-
- protected Button ok;
-
- protected Table table;
- protected TableViewer tableViewer;
- protected boolean init;
-
- /**
- * MonitorDialog constructor comment.
- *
- * @param parentShell the shell
- * @param server the server
- */
- public MonitorDialog(Shell parentShell, IServer server) {
- super(parentShell);
-
- this.server = server;
- }
-
- public MonitorDialog(Shell parentShell, IServer server, ServerPort port, int monitorPort, String[] contentTypes) {
- this(parentShell, server);
- this.monitorPort = monitorPort;
- this.contentTypes = contentTypes;
- this.port = port;
- isEdit = true;
- }
-
- /**
- *
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Messages.dialogMonitorTitle);
- }
-
- protected void createButtonsForButtonBar(Composite parent) {
- ok = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-
- /**
- *
- */
- protected Control createDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
- //WorkbenchHelp.setHelp(composite, ContextIds.TERMINATE_SERVER_DIALOG);
-
- Label label = new Label(composite, SWT.WRAP);
- label.setText(NLS.bind(Messages.dialogMonitorAddDescription, new String[] { server.getName() } ));
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- data.widthHint = 275;
- label.setLayoutData(data);
-
- table = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
- data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- data.heightHint = 100;
- data.horizontalSpan = 2;
- table.setLayoutData(data);
- table.setLinesVisible(true);
- tableViewer = new TableViewer(table);
-
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
- table.setHeaderVisible(true);
-
- tableLayout.addColumnData(new ColumnWeightData(12, 120, true));
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setText(Messages.dialogMonitorColumnType);
-
- tableLayout.addColumnData(new ColumnWeightData(4, 40, true));
- col = new TableColumn(table, SWT.NONE);
- col.setText(Messages.dialogMonitorColumnPort);
-
- tableViewer.setContentProvider(new PortContentProvider(server));
- tableViewer.setLabelProvider(new PortLabelProvider(server));
- tableViewer.setInput(AbstractTreeContentProvider.ROOT);
-
- tableViewer.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- ServerPort port1 = (ServerPort) e1;
- ServerPort port2 = (ServerPort) e2;
- if (port1.getPort() == port2.getPort())
- return 0;
- else if (port1.getPort() > port2.getPort())
- return 1;
- else
- return -1;
- }
- });
-
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.dialogMonitorMonitorPort);
-
- final Text portText = new Text(composite, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 150;
- portText.setLayoutData(data);
- if (monitorPort >= 0)
- portText.setText(monitorPort + "");
-
- portText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- try {
- monitorPort = Integer.parseInt(portText.getText());
- if (ok != null)
- ok.setEnabled(true);
- } catch (Exception ex) {
- monitorPort = -1;
- if (ok != null)
- ok.setEnabled(false);
- }
- portChanged = true;
- }
- });
-
- label = new Label(composite, SWT.NONE);
- label.setText(Messages.dialogMonitorContentType);
-
- final Combo combo = new Combo(composite, SWT.READ_ONLY);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 150;
- combo.setLayoutData(data);
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int size = combo.getItemCount();
- int sel = combo.getSelectionIndex();
- if (sel == size - 1)
- contentTypes = portContentTypes;
- else
- contentTypes = new String[] { portContentTypes[sel] };
- }
- });
-
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- port = (ServerPort) getSelection(tableViewer.getSelection());
- if (port == null)
- return;
- if (!portChanged) {
- portText.setText((port.getPort() + 1) + "");
- portChanged = false;
- }
- portContentTypes = port.getContentTypes();
- String[] s = null;
- String all = Messages.dialogMonitorContentTypeAll;
- if (portContentTypes == null || portContentTypes.length == 1) {
- s = new String[] { all };
- } else {
- int size = portContentTypes.length;
- s = new String[size+1];
- for (int i = 0; i < size; i++) {
- s[i] = MonitorLabelProvider.getContentTypeString(portContentTypes[i]);
- }
- s[size] = all;
- }
- combo.setItems(s);
- combo.setText(all);
- }
- });
-
- Dialog.applyDialogFont(composite);
-
- if (port != null) {
- portChanged = true;
- String[] ct = contentTypes;
- tableViewer.setSelection(new StructuredSelection(port));
- if (ct != null && ct.length > 0)
- combo.setText(MonitorLabelProvider.getContentTypeString(ct[0]));
- } else if (tableViewer != null) {
- try {
- Object obj = tableViewer.getElementAt(0);
- if (obj != null)
- tableViewer.setSelection(new StructuredSelection(obj));
- } catch (Exception e) {
- // ignore
- }
- }
-
- portChanged = false;
-
- return composite;
- }
-
- protected Object getSelection(ISelection sel2) {
- IStructuredSelection sel = (IStructuredSelection) sel2;
- return sel.getFirstElement();
- }
-
- public int getMonitorPort() {
- return monitorPort;
- }
-
- public ServerPort getServerPort() {
- return port;
- }
-
- public String[] getContentTypes() {
- return contentTypes;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorLabelProvider.java
deleted file mode 100644
index 3d2a784be..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/MonitorLabelProvider.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.IMonitoredServerPort;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Monitor port label provider.
- */
-public class MonitorLabelProvider extends BaseLabelProvider implements ITableLabelProvider {
- protected IServer server;
-
- public MonitorLabelProvider(IServer server) {
- super();
- this.server = server;
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- IMonitoredServerPort port = (IMonitoredServerPort) element;
- if (columnIndex == 0) {
- if (port.isStarted())
- return ImageResource.getImage(ImageResource.IMG_MONITOR_ON);
- return ImageResource.getImage(ImageResource.IMG_MONITOR_OFF);
- }
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- IMonitoredServerPort port = (IMonitoredServerPort) element;
- if (columnIndex == 0) {
- if (port.isStarted())
- return Messages.started;
- return Messages.stopped;
- } else if (columnIndex == 1)
- return notNull(port.getServerPort().getName());
- else if (columnIndex == 2)
- return port.getServerPort().getPort() + "";
- else if (columnIndex == 3)
- return port.getMonitorPort() + "";
- else {
- String[] content = port.getContentTypes();
- if (content == null || content.length == 0)
- return Messages.dialogMonitorContentTypeAll;
-
- StringBuffer sb = new StringBuffer();
- int size = content.length;
- for (int i = 0; i < size; i++) {
- if (i > 0)
- sb.append(",");
- sb.append(getContentTypeString(content[i]));
- }
- return sb.toString();
- }
- }
-
- protected static String getContentTypeString(String s) {
- if ("web".equals(s))
- return Messages.dialogMonitorContentTypeWeb;
- else if ("webservices".equals(s))
- return Messages.dialogMonitorContentTypeWebServices;
- else
- return s;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/PortContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/PortContentProvider.java
deleted file mode 100644
index fc9547391..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/PortContentProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.wst.server.core.IServer;
-/**
- * Monitor port content provider.
- */
-public class PortContentProvider implements IStructuredContentProvider {
- protected IServer server;
-
- public PortContentProvider(IServer server) {
- super();
- this.server = server;
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return server.getServerPorts(null);
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/PortLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/PortLabelProvider.java
deleted file mode 100644
index 7c674f750..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/PortLabelProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.ServerPort;
-/**
- * Server port label provider.
- */
-public class PortLabelProvider extends BaseLabelProvider implements ITableLabelProvider {
- protected IServer server;
-
- public PortLabelProvider(IServer server) {
- super();
- this.server = server;
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- ServerPort port = (ServerPort) element;
- if (columnIndex == 0)
- return notNull(port.getName());
- else if (columnIndex == 1)
- return port.getPort() + "";
- else
- return "";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeComposite.java
deleted file mode 100644
index 7e1799f47..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeComposite.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-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.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.internal.ResourceManager;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- *
- */
-public class RuntimeComposite extends AbstractTableComposite {
- protected IRuntime selection;
- protected IRuntime defaultRuntime;
- protected RuntimeSelectionListener listener;
-
- public interface RuntimeSelectionListener {
- public void runtimeSelected(IRuntime runtime);
- }
-
- class RuntimeViewerSorter extends ViewerSorter {
- boolean sortByName;
- public RuntimeViewerSorter(boolean sortByName) {
- this.sortByName = sortByName;
- }
-
- public int compare(Viewer viewer, Object e1, Object e2) {
- IRuntime r1 = (IRuntime) e1;
- IRuntime r2 = (IRuntime) e2;
- if (sortByName)
- return collator.compare(notNull(r1.getName()), notNull(r2.getName()));
-
- if (r1.getRuntimeType() == null)
- return -1;
- if (r2.getRuntimeType() == null)
- return 1;
- return collator.compare(notNull(r1.getRuntimeType().getName()), notNull(r2.getRuntimeType().getName()));
- }
-
- protected String notNull(String s) {
- if (s == null)
- return "";
- return s;
- }
- }
-
- public RuntimeComposite(Composite parent, int style, RuntimeSelectionListener listener2) {
- super(parent, style);
- this.listener = listener2;
-
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
- table.setHeaderVisible(true);
-
- tableLayout.addColumnData(new ColumnWeightData(60, 160, true));
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setText(Messages.columnName);
- col.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- tableViewer.setSorter(new RuntimeViewerSorter(true));
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- tableLayout.addColumnData(new ColumnWeightData(45, 125, true));
- col = new TableColumn(table, SWT.NONE);
- col.setText(Messages.columnType);
- col.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- tableViewer.setSorter(new RuntimeViewerSorter(false));
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- tableViewer.setContentProvider(new RuntimeContentProvider());
- tableViewer.setLabelProvider(new RuntimeTableLabelProvider());
- tableViewer.setInput(AbstractTreeContentProvider.ROOT);
- tableViewer.setColumnProperties(new String[] {"name", "type"});
- tableViewer.setSorter(new RuntimeViewerSorter(true));
-
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- Object obj = getSelection(event.getSelection());
- if (obj instanceof IRuntime)
- selection = (IRuntime) obj;
- else
- selection = null;
- listener.runtimeSelected(selection);
- }
- });
-
- table.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- if (e.character == 'l') {
- try {
- IRuntime runtime = getSelectedRuntime();
- IRuntimeWorkingCopy wc = runtime.createWorkingCopy();
- wc.setReadOnly(!runtime.isReadOnly());
- wc.save(false, null);
- refresh(runtime);
- } catch (Exception ex) {
- // ignore
- }
- }
- }
-
- public void keyReleased(KeyEvent e) {
- // do nothing
- }
- });
-
- final ResourceManager rm = ResourceManager.getInstance();
- defaultRuntime = rm.getDefaultRuntime();
- if (defaultRuntime != null)
- ((CheckboxTableViewer)tableViewer).setChecked(defaultRuntime, true);
-
- ((CheckboxTableViewer)tableViewer).addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- try {
- IRuntime runtime = (IRuntime) event.getElement();
- if (event.getChecked()) {
- if (defaultRuntime != null && !runtime.equals(defaultRuntime))
- ((CheckboxTableViewer)tableViewer).setChecked(defaultRuntime, false);
- rm.setDefaultRuntime(runtime);
- defaultRuntime = runtime;
- } else
- rm.setDefaultRuntime(null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error setting default runtime", e);
- }
- }
- });
- }
-
- protected void createTable() {
- table = new Table(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.CHECK);
- }
-
- protected void createTableViewer() {
- tableViewer = new LockedCheckboxTableViewer(table);
- }
-
- public IRuntime getSelectedRuntime() {
- return selection;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeContentProvider.java
deleted file mode 100644
index ab7f09eb9..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeContentProvider.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.internal.Runtime;
-/**
- * Runtime content provider.
- */
-public class RuntimeContentProvider implements IStructuredContentProvider {
- /**
- * RuntimeContentProvider constructor comment.
- */
- public RuntimeContentProvider() {
- super();
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * @see IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object inputElement) {
- List list = new ArrayList();
- IRuntime[] runtimes = ServerCore.getRuntimes();
- if (runtimes != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (!((Runtime)runtimes[i]).isPrivate())
- list.add(runtimes[i]);
- }
- }
- return list.toArray();
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTableLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTableLabelProvider.java
deleted file mode 100644
index e1e711fe0..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTableLabelProvider.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.swt.graphics.Image;
-/**
- * Runtime table label provider.
- */
-public class RuntimeTableLabelProvider extends BaseLabelProvider implements ITableLabelProvider, ILockedLabelProvider {
- /**
- * RuntimeTableLabelProvider constructor comment.
- */
- public RuntimeTableLabelProvider() {
- super();
- }
-
- /**
- * @see ITableLabelProvider#getColumnImage(Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- IRuntime runtime = (IRuntime) element;
- IRuntimeType runtimeType = runtime.getRuntimeType();
- if (runtimeType != null)
- return ImageResource.getImage(runtimeType.getId());
- }
- return null;
- }
-
- /**
- * @see ITableLabelProvider#getColumnText(Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- IRuntime runtime = (IRuntime) element;
- if (columnIndex == 0)
- return notNull(runtime.getName());
- /*else if (columnIndex == 1) {
- IPath location = runtime.getLocation();
- if (location == null)
- return "";
- else
- return notNull(location.toOSString());
- }*/
- else if (columnIndex == 1) {
- IRuntimeType runtimeType = runtime.getRuntimeType();
- if (runtimeType != null)
- return notNull(runtimeType.getName());
- return "";
- } else
- return "X";
- }
-
- public boolean isLocked(Object element) {
- IRuntime runtime = (IRuntime) element;
- return runtime.isReadOnly();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTreeContentProvider.java
deleted file mode 100644
index 05a89596e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTreeContentProvider.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- * Runtime content provider.
- */
-public class RuntimeTreeContentProvider extends AbstractTreeContentProvider {
- public static final byte STYLE_VENDOR = 1;
- public static final byte STYLE_VERSION = 2;
- public static final byte STYLE_TYPE = 3;
-
- /**
- * RuntimeTreeContentProvider constructor.
- *
- * @param style a style
- */
- public RuntimeTreeContentProvider(byte style) {
- super(style);
- }
-
- public void fillTree() {
- clean();
- List list = new ArrayList();
- if (style != STYLE_FLAT) {
- IRuntime[] runtimes = ServerCore.getRuntimes();
- if (runtimes != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- IRuntimeType runtimeType = runtimes[i].getRuntimeType();
- try {
- TreeElement ele = null;
- if (style == STYLE_VENDOR)
- ele = getOrCreate(list, runtimeType.getVendor());
- else if (style == STYLE_VERSION)
- ele = getOrCreate(list, runtimeType.getVersion());
- else if (style == STYLE_TYPE)
- ele = getOrCreate(list, runtimeType.getName());
- ele.contents.add(runtimes[i]);
- elementToParentMap.put(runtimes[i], ele);
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error in runtime content provider", e);
- }
- }
- }
- } else {
- IRuntime[] runtimes = ServerCore.getRuntimes();
- if (runtimes != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++)
- list.add(runtimes[i]);
- }
- }
- elements = list.toArray();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTreeLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTreeLabelProvider.java
deleted file mode 100644
index 4cf36de05..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTreeLabelProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-/**
- * Runtime label provider.
- */
-public class RuntimeTreeLabelProvider extends AbstractTreeLabelProvider implements ITableLabelProvider {
- /**
- * RuntimeTreeLabelProvider constructor comment.
- */
- public RuntimeTreeLabelProvider() {
- super();
- }
-
- /**
- *
- */
- protected Image getImageImpl(Object element) {
- IRuntime runtime = (IRuntime) element;
- if (runtime.getRuntimeType() != null)
- return ImageResource.getImage(runtime.getRuntimeType().getId());
- return null;
- }
-
- /**
- *
- */
- protected String getTextImpl(Object element) {
- IRuntime runtime = (IRuntime) element;
- return notNull(runtime.getName());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- if (element instanceof ServerTreeContentProvider.TreeElement) {
- ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
- return sharedImages.getImage(ISharedImages.IMG_OBJ_FOLDER);
- }
- return getImageImpl(element);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof ServerTreeContentProvider.TreeElement) {
- if (columnIndex == 0)
- return ((ServerTreeContentProvider.TreeElement) element).text;
- return "";
- }
- IRuntime runtime = (IRuntime) element;
- if (columnIndex == 0)
- return runtime.getName();
- else if (columnIndex == 1) {
- if (runtime.getRuntimeType() != null)
- return notNull(runtime.getRuntimeType().getName());
- return "";
- }
- return "X";
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeComposite.java
deleted file mode 100644
index cbafa1675..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeComposite.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.NewInstallableServerWizard;
-/**
- *
- */
-public class RuntimeTypeComposite extends AbstractTreeComposite {
- protected IRuntimeType selection;
- protected RuntimeTypeSelectionListener listener;
- protected boolean creation;
- protected String type;
- protected String version;
- protected String runtimeTypeId;
-
- protected RuntimeTypeTreeContentProvider contentProvider;
- protected boolean initialSelection = true;
-
- public interface RuntimeTypeSelectionListener {
- public void runtimeTypeSelected(IRuntimeType runtimeType);
- }
-
- public RuntimeTypeComposite(Composite parent, int style, boolean creation, RuntimeTypeSelectionListener listener2, String type, String version, String runtimeTypeId) {
- super(parent, style);
- this.listener = listener2;
- this.creation = creation;
- this.type = type;
- this.version = version;
- this.runtimeTypeId = runtimeTypeId;
-
- contentProvider = new RuntimeTypeTreeContentProvider(RuntimeTypeTreeContentProvider.STYLE_VENDOR, creation, type, version, runtimeTypeId);
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setLabelProvider(new RuntimeTypeTreeLabelProvider());
- treeViewer.setInput(AbstractTreeContentProvider.ROOT);
-
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- Object obj = getSelection(event.getSelection());
- if (obj instanceof IRuntimeType) {
- selection = (IRuntimeType) obj;
- setDescription(selection.getDescription());
- } else {
- selection = null;
- setDescription("");
- }
- listener.runtimeTypeSelected(selection);
- }
- });
-
- treeViewer.setSorter(new DefaultViewerSorter());
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible && initialSelection) {
- initialSelection = false;
- if (contentProvider.getInitialSelection() != null)
- treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
- }
- }
-
- protected String getTitleLabel() {
- return Messages.runtimeTypeCompTree;
- }
-
- protected String getDescriptionLabel() {
- return Messages.runtimeTypeCompDescription;
- }
-
- protected String[] getComboOptions() {
- return new String[] { Messages.name,
- Messages.vendor, Messages.version,
- Messages.moduleSupport };
- }
-
- protected void viewOptionSelected(byte option) {
- ISelection sel = treeViewer.getSelection();
- treeViewer.setContentProvider(new RuntimeTypeTreeContentProvider(option, creation, type, version, runtimeTypeId));
- treeViewer.setSelection(sel);
- }
-
- public void refresh() {
- ISelection sel = treeViewer.getSelection();
- RuntimeTypeTreeContentProvider cp = (RuntimeTypeTreeContentProvider) treeViewer.getContentProvider();
- treeViewer.setContentProvider(new RuntimeTypeTreeContentProvider(cp.style, creation, type, version, runtimeTypeId));
- treeViewer.setSelection(sel);
- }
-
- public IRuntimeType getSelectedRuntimeType() {
- return selection;
- }
-
- protected String getDetailsLabel() {
- if (ServerPlugin.getInstallableServers().length > 0)
- return Messages.installableServerLink;
- return null;
- }
-
- protected void detailsSelected() {
- NewInstallableServerWizard wizard2 = new NewInstallableServerWizard();
- WizardDialog dialog = new WizardDialog(getShell(), wizard2);
- if (dialog.open() != Window.CANCEL)
- refresh();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java
deleted file mode 100644
index 88f77ceb7..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeContentProvider.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.server.core.*;
-/**
- * Runtime type content provider.
- */
-public class RuntimeTypeTreeContentProvider extends AbstractTreeContentProvider {
- public static final byte STYLE_VENDOR = 1;
- public static final byte STYLE_VERSION = 2;
- public static final byte STYLE_MODULE_TYPE = 3;
-
- protected boolean creation;
- protected String type;
- protected String version;
- protected String runtimeTypeId;
-
- /**
- * RuntimeTypeContentProvider constructor.
- *
- * @param style a style
- * @param creation true to include runtimes that can be created
- */
- public RuntimeTypeTreeContentProvider(byte style, boolean creation) {
- super(style);
- this.creation = creation;
- }
-
- public RuntimeTypeTreeContentProvider(byte style, boolean creation, String type, String version, String runtimeTypeId) {
- super(style, false);
- this.type = type;
- this.version = version;
- this.runtimeTypeId = runtimeTypeId;
- this.creation = creation;
-
- fillTree();
- }
-
- public void fillTree() {
- clean();
- List list = new ArrayList();
- if (style != STYLE_FLAT) {
- IRuntimeType[] runtimeTypes = ServerUtil.getRuntimeTypes(type, version, runtimeTypeId);
- if (runtimeTypes != null) {
- int size = runtimeTypes.length;
- for (int i = 0; i < size; i++) {
- IRuntimeType runtimeType = runtimeTypes[i];
- if (!creation || runtimeType.canCreate()) {
- TreeElement ele = null;
- if (style == STYLE_VENDOR) {
- ele = getOrCreate(list, runtimeType.getVendor());
- ele.contents.add(runtimeType);
- elementToParentMap.put(runtimeType, ele);
- } else if (style == STYLE_VERSION) {
- ele = getOrCreate(list, runtimeType.getVersion());
- ele.contents.add(runtimeType);
- elementToParentMap.put(runtimeType, ele);
- } else if (style == STYLE_MODULE_TYPE) {
- // TODO: does not handle "jst.*" format
- IModuleType[] moduleTypes = runtimeType.getModuleTypes();
- if (moduleTypes != null) {
- int size2 = moduleTypes.length;
- for (int j = 0; j < size2; j++) {
- IModuleType mb = moduleTypes[j];
- if (mb != null) {
- ele = getOrCreate(list, mb.getName());
- TreeElement ele2 = getOrCreate(ele.contents, mb.getName() + "/" + mb.getVersion(), mb.getVersion());
- ele2.contents.add(runtimeType);
- elementToParentMap.put(runtimeType, ele2);
- elementToParentMap.put(ele2, ele);
- }
- }
- }
- }
- }
- }
- }
- } else {
- IRuntimeType[] runtimeTypes = ServerUtil.getRuntimeTypes(type, version, runtimeTypeId);
- if (runtimeTypes != null) {
- int size = runtimeTypes.length;
- for (int i = 0; i < size; i++) {
- IRuntimeType runtimeType = runtimeTypes[i];
- if (!creation || runtimeType.canCreate())
- list.add(runtimeType);
- }
- }
- }
- elements = list.toArray();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeLabelProvider.java
deleted file mode 100644
index be65daf51..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/RuntimeTypeTreeLabelProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.swt.graphics.Image;
-/**
- * Runtime type label provider.
- */
-public class RuntimeTypeTreeLabelProvider extends AbstractTreeLabelProvider {
- /**
- * RuntimeTypeTreeLabelProvider constructor comment.
- */
- public RuntimeTypeTreeLabelProvider() {
- super();
- }
-
- /**
- *
- */
- protected Image getImageImpl(Object element) {
- IRuntimeType runtimeType = (IRuntimeType) element;
- return ImageResource.getImage(runtimeType.getId());
- }
-
- /**
- *
- */
- protected String getTextImpl(Object element) {
- IRuntimeType runtimeType = (IRuntimeType) element;
- return notNull(runtimeType.getName());
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/SView.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/SView.java
deleted file mode 100644
index 9f380918b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/SView.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-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.AccessibleEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Rectangle;
-import org.eclipse.swt.graphics.Region;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.TypedListener;
-/**
- * Simple SWT widget with an image banner and a label.
- */
-public class SView extends Canvas {
- protected Color focusColor;
- protected boolean mouseOver = false;
- protected boolean hasFocus = false;
- //protected boolean isOpen = true;
-
- //protected String name;
- //protected String description;
-
- protected Color one;
- protected Color two;
- protected Color three;
-
- protected Color grone;
- protected Color grtwo;
- protected Color grthree;
-
- private Cursor cursor;
-
- public SView(Composite parent, int style) {
- super(parent, style);
-
- cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
- setCursor(cursor);
-
- one = new Color(getDisplay(), 224, 244, 252);
- two = new Color(getDisplay(), 178, 212, 247);
- three = new Color(getDisplay(), 138, 185, 242);
-
- grone = new Color(getDisplay(), 229, 255, 193);
- grtwo = new Color(getDisplay(), 63, 214, 16);
- grthree = new Color(getDisplay(), 21, 157, 4);
-
- addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
- SView.this.paintControl(e);
- }
- });
- addMouseListener(new MouseListener() {
- public void mouseDown(MouseEvent e) {
- //changeTwistie(!isOpen);
- }
- public void mouseUp(MouseEvent e) {
- // do nothing
- }
- public void mouseDoubleClick(MouseEvent e) {
- // do nothing
- }
- });
- addMouseTrackListener(new MouseTrackListener() {
- public void mouseEnter(MouseEvent e) {
- mouseOver = true;
- SView.this.redraw();
- }
- public void mouseExit(MouseEvent e) {
- mouseOver = false;
- SView.this.redraw();
- }
- public void mouseHover(MouseEvent e) {
- // do nothing
- }
- });
- addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- //changeTwistie(!isOpen);
- redraw();
- }
- });
- addListener(SWT.Traverse, new Listener () {
- public void handleEvent(Event e) {
- if (e.detail != SWT.TRAVERSE_RETURN)
- e.doit = true;
- }
- });
- addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
- hasFocus = true;
- redraw();
- }
- public void focusLost(FocusEvent e) {
- hasFocus = false;
- redraw();
- }
- });
- addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- if (e.character == '\r') {
- // Activation
- notifyListeners(SWT.Selection);
- }
- }
- });
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- disposeImpl();
- }
- });
-
- getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getName(AccessibleEvent e) {
- //e.result = name;
- }
-
- public void getDescription(AccessibleEvent e) {
- //e.result = description;
- }
- });
-
- getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() {
- public void getLocation(AccessibleControlEvent e) {
- Rectangle location = getBounds();
- Point pt = toDisplay(new Point(location.x, location.y));
- e.x = pt.x;
- e.y = pt.y;
- e.width = location.width;
- e.height = location.height;
- }
-
- public void getChildCount(AccessibleControlEvent e) {
- e.detail = 0;
- }
-
- public void getRole(AccessibleControlEvent e) {
- e.detail = ACC.ROLE_TREE;
- }
-
- public void getState(AccessibleControlEvent e) {
- //e.detail = isOpen ? ACC.STATE_EXPANDED : ACC.STATE_COLLAPSED;
- }
- });
- }
-
- protected void disposeImpl() {
- if (cursor != null) {
- cursor.dispose();
- cursor = null;
- one.dispose();
- two.dispose();
- three.dispose();
-
- grone.dispose();
- grtwo.dispose();
- grthree.dispose();
- }
- }
-
- public void addSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) return;
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- }
-
- public void removeSelectionListener(SelectionListener listener) {
- checkWidget ();
- if (listener == null) return;
- removeListener (SWT.Selection, listener);
- }
-
- protected void notifyListeners(int eventType) {
- Event event = new Event();
- event.type = eventType;
- event.widget = this;
- notifyListeners(eventType, event);
- }
-
- protected void paintRect(GC gc, int x, int y, Color a, Color b, Color c) {
- int[] p = new int[] { 0, 2, 2, 0, 30, 0, 32, 2, 32, 30, 30, 32, 2, 32, 0, 30};
-
- int[] q = new int[p.length];
- for (int i = 0; i < p.length / 2; i++) {
- q[i*2] = p[i*2] + x;
- q[i*2+1] = p[i*2+1] + y;
- }
-
- Region region = new Region(getDisplay());
- region.add(q);
-
- gc.setClipping(region);
-
- gc.setBackground(a);
- gc.setForeground(b);
- gc.fillGradientRectangle(x, y, 32, 32, true);
- gc.setClipping((Region)null);
- gc.setForeground(c);
- gc.drawPolygon(q);
-
- gc.setForeground(getForeground());
- gc.setBackground(getBackground());
- String st = "Tomcat Test Environment";
- Point stp = gc.stringExtent(st);
- gc.drawString(st, x+16 - stp.x / 2, y + 32 + 2);
- }
-
- void paintControl(PaintEvent e) {
- GC gc = e.gc;
-
- Point s = getSize();
-
- gc.setBackground(getBackground());
- gc.fillRectangle(0, 0, s.x, s.y);
-
- /*if (mouseOver)
- gc.setBackground(getFocusColor());
- else
- gc.setBackground(getForeground());*/
-
- // one
- paintRect(gc, 60, 0, one, two, three);
-
- paintRect(gc, 140, 0, grone, grtwo, grthree);
-
- /*if (hasFocus) {
- gc.setBackground(getBackground());
- gc.setForeground(getFocusColor());
- gc.drawFocus(0, 0, 10, 11);
- }*/
- }
-
- /*public Color getFocusColor() {
- return focusColor;
- }
-
- public void setFocusColor(Color color) {
- focusColor = color;
- }*/
-
- public Point computeSize(int wHint, int hHint, boolean changed) {
- return new Point(200, 60);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerComposite.java
deleted file mode 100644
index 4fdb5bd7a..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerComposite.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- *
- */
-public class ServerComposite extends AbstractTreeComposite {
- protected IServer selection;
- protected ServerSelectionListener listener;
- protected ServerTreeContentProvider contentProvider;
- protected boolean initialSelection = true;
- protected byte viewOption;
-
- protected IModule module;
- protected String launchMode;
- protected boolean includeIncompatibleVersions;
-
- public interface ServerSelectionListener {
- public void serverSelected(IServer server);
- }
-
- public ServerComposite(Composite parent, int style, ServerSelectionListener listener2, IModule module, String launchMode) {
- super(parent, style);
- this.module = module;
- this.launchMode = launchMode;
-
- this.listener = listener2;
-
- contentProvider = new ServerTreeContentProvider(ServerTreeContentProvider.STYLE_HOST, module, launchMode);
- viewOption = ServerTreeContentProvider.STYLE_HOST;
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setLabelProvider(new ServerTreeLabelProvider());
- treeViewer.setInput(AbstractTreeContentProvider.ROOT);
- treeViewer.expandToLevel(1);
-
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- Object obj = getSelection(event.getSelection());
- if (obj instanceof IServer) {
- selection = (IServer) obj;
- setDescription(selection.getServerType().getRuntimeType().getDescription());
- } else {
- selection = null;
- setDescription("");
- }
- listener.serverSelected(selection);
- }
- });
- }
-
- public ServerComposite(Composite parent, int style, ServerSelectionListener listener2) {
- this(parent, style, listener2, null, null);
- }
-
- public void setIncludeIncompatibleVersions(boolean b) {
- includeIncompatibleVersions = b;
- ISelection sel = treeViewer.getSelection();
- contentProvider.setIncludeIncompatibleVersions(b);
- treeViewer.refresh();
- treeViewer.setSelection(sel, true);
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible && initialSelection) {
- initialSelection = false;
- if (contentProvider.getInitialSelection() != null)
- treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
- }
- }
-
- public void refreshAll() {
- ISelection sel = treeViewer.getSelection();
- contentProvider = new ServerTreeContentProvider(viewOption, module, launchMode);
- contentProvider.setIncludeIncompatibleVersions(includeIncompatibleVersions);
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setSelection(sel);
- }
-
- protected String getDescriptionLabel() {
- return null; //Messages.serverTypeCompDescription");
- }
-
- protected String getTitleLabel() {
- return Messages.wizNewServerSelectExisting;
- }
-
- protected String[] getComboOptions() {
- return new String[] { Messages.name, Messages.host,
- Messages.vendor, Messages.version };
- }
-
- protected void viewOptionSelected(byte option) {
- ISelection sel = treeViewer.getSelection();
- viewOption = option;
- contentProvider = new ServerTreeContentProvider(option, module, launchMode);
- contentProvider.setIncludeIncompatibleVersions(includeIncompatibleVersions);
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setSelection(sel);
- }
-
- public IServer getSelectedServer() {
- return selection;
- }
-
- public void setSelection(IServer server) {
- treeViewer.setSelection(new StructuredSelection(server), true);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTreeContentProvider.java
deleted file mode 100644
index c13a38bed..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTreeContentProvider.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleType;
-import org.eclipse.wst.server.core.IRuntimeType;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-/**
- * Runtime type content provider.
- */
-public class ServerTreeContentProvider extends AbstractTreeContentProvider {
- public static final byte STYLE_HOST = 1;
- public static final byte STYLE_VENDOR = 2;
- public static final byte STYLE_VERSION = 3;
-
- protected IModule module;
- protected String launchMode;
- protected boolean includeIncompatibleVersions;
-
- /**
- * ServerTreeContentProvider constructor.
- *
- * @param style a style
- */
- public ServerTreeContentProvider(byte style) {
- super(style);
- }
-
- public ServerTreeContentProvider(byte style, IModule module, String launchMode) {
- super(style, false);
- this.module = module;
- this.launchMode = launchMode;
-
- fillTree();
- }
-
- public void setIncludeIncompatibleVersions(boolean b) {
- includeIncompatibleVersions = b;
- fillTree();
- }
-
- protected void fillTree() {
- clean();
- List list = new ArrayList();
- if (style != STYLE_FLAT) {
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (acceptServer(servers[i])) {
- IServerType serverType = servers[i].getServerType();
- IRuntimeType runtimeType = serverType.getRuntimeType();
- TreeElement te = null;
- if (style == STYLE_HOST) {
- te = getOrCreate(list, servers[i].getHost());
- } else if (style == STYLE_VERSION) {
- String version = Messages.elementUnknownName;
- if (runtimeType != null)
- version = runtimeType.getVersion();
- te = getOrCreate(list, version);
- } else if (style == STYLE_VENDOR) {
- String vendor = Messages.elementUnknownName;
- if (runtimeType != null)
- vendor = runtimeType.getVendor();
- te = getOrCreate(list, vendor);
- }
- te.contents.add(servers[i]);
- elementToParentMap.put(servers[i], te);
- }
- }
- }
- } else {
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- if (acceptServer(servers[i]))
- list.add(servers[i]);
- }
- }
- }
- elements = list.toArray();
- }
-
- protected boolean acceptServer(IServer server) {
- if (module == null || launchMode == null)
- return true;
- if (!ServerUIPlugin.isCompatibleWithLaunchMode(server, launchMode))
- return false;
-
- IModuleType mt = module.getModuleType();
- if (includeIncompatibleVersions) {
- if (!ServerUtil.isSupportedModule(server.getServerType().getRuntimeType().getModuleTypes(), mt.getId(), null))
- return false;
- } else {
- if (!ServerUtil.isSupportedModule(server.getServerType().getRuntimeType().getModuleTypes(), mt.getId(), mt.getVersion()))
- return false;
- }
- return true;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTreeLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTreeLabelProvider.java
deleted file mode 100644
index e56944cd2..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTreeLabelProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.swt.graphics.Image;
-/**
- * Server tree label provider.
- */
-public class ServerTreeLabelProvider extends AbstractTreeLabelProvider {
- /**
- * ServerTreeLabelProvider constructor comment.
- */
- public ServerTreeLabelProvider() {
- super();
- }
-
- /**
- * @see AbstractTreeLabelProvider#getImageImpl(Object)
- */
- public Image getImageImpl(Object element) {
- IServer server = (IServer) element;
- return ImageResource.getImage(server.getServerType().getId());
- }
-
- /**
- * @see AbstractTreeLabelProvider#getTextImpl(Object)
- */
- public String getTextImpl(Object element) {
- IServer server = (IServer) element;
- return server.getName();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeComposite.java
deleted file mode 100644
index ab0573468..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeComposite.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.wst.server.core.IModuleType;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.NewInstallableServerWizard;
-/**
- *
- */
-public class ServerTypeComposite extends AbstractTreeComposite {
- protected IServerType selection;
- protected ServerTypeSelectionListener listener;
- protected ServerTypeTreeContentProvider contentProvider;
- protected boolean initialSelection = true;
-
- protected IModuleType moduleType;
-
- protected boolean isLocalhost;
- protected boolean includeIncompatibleVersions;
-
- public interface ServerTypeSelectionListener {
- public void serverTypeSelected(IServerType type);
- }
-
- public ServerTypeComposite(Composite parent, int style, IModuleType moduleType, ServerTypeSelectionListener listener2) {
- super(parent, style);
- this.listener = listener2;
-
- this.moduleType = moduleType;
-
- contentProvider = new ServerTypeTreeContentProvider(ServerTypeTreeContentProvider.STYLE_VENDOR, moduleType);
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setLabelProvider(new ServerTypeTreeLabelProvider());
- treeViewer.setInput(AbstractTreeContentProvider.ROOT);
-
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- Object obj = getSelection(event.getSelection());
- if (obj instanceof IServerType) {
- selection = (IServerType) obj;
- setDescription(selection.getDescription());
- } else {
- selection = null;
- setDescription("");
- }
- listener.serverTypeSelected(selection);
- }
- });
-
- treeViewer.setSorter(new DefaultViewerSorter());
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible && initialSelection) {
- initialSelection = false;
- if (contentProvider.getInitialSelection() != null)
- treeViewer.setSelection(new StructuredSelection(contentProvider.getInitialSelection()), true);
- }
- }
-
- public void setHost(boolean newHost) {
- if (isLocalhost == newHost)
- return;
-
- isLocalhost = newHost;
- ISelection sel = treeViewer.getSelection();
- contentProvider.setLocalhost(isLocalhost);
- treeViewer.refresh();
- //treeViewer.expandToLevel(2);
- treeViewer.setSelection(sel, true);
- }
-
- public void setIncludeIncompatibleVersions(boolean b) {
- includeIncompatibleVersions = b;
- ISelection sel = treeViewer.getSelection();
- contentProvider.setIncludeIncompatibleVersions(b);
- treeViewer.refresh();
- treeViewer.setSelection(sel, true);
- }
-
- protected String getDescriptionLabel() {
- return null;
- }
-
- protected String getTitleLabel() {
- return Messages.serverTypeCompLabel;
- }
-
- protected String[] getComboOptions() {
- return new String[] { Messages.name,
- Messages.vendor, Messages.version,
- Messages.moduleSupport };
- }
-
- protected void viewOptionSelected(byte option) {
- ISelection sel = treeViewer.getSelection();
- contentProvider = new ServerTypeTreeContentProvider(option, moduleType);
- contentProvider.setLocalhost(isLocalhost);
- contentProvider.setIncludeIncompatibleVersions(includeIncompatibleVersions);
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setSelection(sel);
- }
-
- public IServerType getSelectedServerType() {
- return selection;
- }
-
- public void refresh() {
- ISelection sel = treeViewer.getSelection();
- ServerTypeTreeContentProvider cp = (ServerTypeTreeContentProvider) treeViewer.getContentProvider();
- treeViewer.setContentProvider(new ServerTypeTreeContentProvider(cp.style, moduleType));
- treeViewer.setSelection(sel);
- }
-
- protected String getDetailsLabel() {
- if (ServerPlugin.getInstallableServers().length > 0)
- return Messages.installableServerLink;
- return null;
- }
-
- protected void detailsSelected() {
- NewInstallableServerWizard wizard2 = new NewInstallableServerWizard();
- WizardDialog dialog = new WizardDialog(getShell(), wizard2);
- if (dialog.open() != Window.CANCEL)
- refresh();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java
deleted file mode 100644
index 7c91e41e4..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeContentProvider.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- * Server type content provider.
- */
-public class ServerTypeTreeContentProvider extends AbstractTreeContentProvider {
- public static final byte STYLE_VENDOR = 1;
- public static final byte STYLE_VERSION = 2;
- public static final byte STYLE_MODULE_TYPE = 3;
- public static final byte STYLE_TYPE = 4; // not used yet
-
- protected boolean localhost;
-
- protected IModuleType moduleType;
- protected boolean includeIncompatibleVersions;
-
- /**
- * ServerTypeTreeContentProvider constructor.
- *
- * @param style a style
- * @param moduleType a module type
- */
- public ServerTypeTreeContentProvider(byte style, IModuleType moduleType) {
- super(style, false);
- localhost = true;
-
- this.moduleType = moduleType;
-
- fillTree();
- }
-
- public void fillTree() {
- clean();
-
- List list = new ArrayList();
- IServerType[] serverTypes = ServerCore.getServerTypes();
- if (serverTypes != null) {
- int size = serverTypes.length;
- for (int i = 0; i < size; i++) {
- IServerType serverType = serverTypes[i];
- if (include(serverType)) {
- if (style == STYLE_FLAT) {
- list.add(serverType);
- } else if (style != STYLE_MODULE_TYPE) {
- try {
- IRuntimeType runtimeType = serverType.getRuntimeType();
- TreeElement ele = null;
- if (style == STYLE_VENDOR)
- ele = getOrCreate(list, runtimeType.getVendor());
- else if (style == STYLE_VERSION)
- ele = getOrCreate(list, runtimeType.getVersion());
- else if (style == STYLE_TYPE)
- ele = getOrCreate(list, runtimeType.getName());
- ele.contents.add(serverType);
- elementToParentMap.put(serverType, ele);
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Error in server configuration content provider", e);
- }
- } else { // style = MODULE_TYPE
- IRuntimeType runtimeType = serverType.getRuntimeType();
- IModuleType[] moduleTypes = runtimeType.getModuleTypes();
- if (moduleTypes != null) {
- int size2 = moduleTypes.length;
- for (int j = 0; j < size2; j++) {
- IModuleType mb = moduleTypes[j];
- if (mb != null) {
- TreeElement ele = getOrCreate(list, mb.getName());
- TreeElement ele2 = getOrCreate(ele.contents, mb.getName() + "/" + mb.getVersion(), mb.getVersion());
- ele2.contents.add(serverType);
- elementToParentMap.put(serverType, ele2);
- elementToParentMap.put(ele2, ele);
- }
- }
- }
- }
- }
- }
- }
- elements = list.toArray();
- }
-
- protected boolean include(IServerType serverType) {
- IRuntimeType runtimeType = serverType.getRuntimeType();
- if (runtimeType == null)
- return false;
-
- String moduleTypeId = null;
- if (moduleType != null)
- moduleTypeId = moduleType.getId();
- if (includeIncompatibleVersions) {
- if (!ServerUtil.isSupportedModule(runtimeType.getModuleTypes(), moduleTypeId, null))
- return false;
- } else {
- String moduleVersion = null;
- if (moduleType != null)
- moduleVersion = moduleType.getVersion();
- if (!ServerUtil.isSupportedModule(runtimeType.getModuleTypes(), moduleTypeId, moduleVersion))
- return false;
- }
-
- if (localhost || serverType.supportsRemoteHosts())
- return true;
-
- return false;
- }
-
- protected boolean checkForNonStubEnvironmentRuntime(IServerType serverType) {
- IRuntimeType runtimeType = serverType.getRuntimeType();
- IRuntime[] runtimes = ServerUIPlugin.getRuntimes(runtimeType);
- if (runtimes == null || runtimes.length == 0)
- return false;
-
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (!runtimes[i].isStub())
- return true;
- }
- return false;
- }
-
- public void setLocalhost(boolean local) {
- localhost = local;
- fillTree();
- }
-
- public void setIncludeIncompatibleVersions(boolean b) {
- includeIncompatibleVersions = b;
- fillTree();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeLabelProvider.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeLabelProvider.java
deleted file mode 100644
index c5de75f0a..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/viewers/ServerTypeTreeLabelProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.viewers;
-
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.swt.graphics.Image;
-/**
- * Server type label provider.
- */
-public class ServerTypeTreeLabelProvider extends AbstractTreeLabelProvider {
- /**
- * ServerTypeTreeLabelProvider constructor comment.
- */
- public ServerTypeTreeLabelProvider() {
- super();
- }
-
- /**
- *
- */
- protected Image getImageImpl(Object element) {
- IServerType type = (IServerType) element;
- return ImageResource.getImage(type.getId());
- }
-
- /**
- *
- */
- protected String getTextImpl(Object element) {
- IServerType type = (IServerType) element;
- return notNull(type.getName());
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/InternetPreferencePage.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/InternetPreferencePage.java
deleted file mode 100644
index 02f08d36c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/InternetPreferencePage.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.webbrowser;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * A preference page that holds internet preferences.
- */
-public class InternetPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- /**
- * InternetPreferencePage constructor comment.
- */
- public InternetPreferencePage() {
- super();
- noDefaultAndApplyButton();
- }
-
- /**
- * Create the preference options.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @return org.eclipse.swt.widgets.Control
- */
- protected Control createContents(Composite parent) {
- initializeDialogUnits(parent);
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
- layout.verticalSpacing = convertVerticalDLUsToPixels(4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- composite.setLayoutData(data);
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ContextIds.PREF_BROWSER);
-
- Label label = new Label(composite, SWT.WRAP);
- label.setText(Messages.preferenceInternetDescription);
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- label.setLayoutData(data);
-
- Dialog.applyDialogFont(composite);
-
- return composite;
- }
-
- /**
- * Initializes this preference page using the passed workbench.
- *
- * @param workbench the current workbench
- */
- public void init(IWorkbench workbench) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/OpenBrowserWorkbenchAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/OpenBrowserWorkbenchAction.java
deleted file mode 100644
index 4e9e9217f..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/OpenBrowserWorkbenchAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2004, 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.server.ui.internal.webbrowser;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.*;
-import org.eclipse.ui.browser.IWebBrowser;
-import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- * Action to open the Web broswer.
- */
-public class OpenBrowserWorkbenchAction implements IWorkbenchWindowActionDelegate {
- /**
- * OpenBrowserWorkbenchAction constructor comment.
- */
- public OpenBrowserWorkbenchAction() {
- super();
- }
-
- /**
- * Disposes this action delegate. The implementor should unhook any references
- * to itself so that garbage collection can occur.
- */
- public void dispose() {
- // do nothing
- }
-
- /**
- * Initializes this action delegate with the workbench window it will work in.
- *
- * @param window the window that provides the context for this delegate
- */
- public void init(IWorkbenchWindow window) {
- // do nothing
- }
-
- /**
- * Performs this action.
- * <p>
- * This method is called when the delegating action has been triggered.
- * Implement this method to do the actual work.
- * </p>
- *
- * @param action the action proxy that handles the presentation portion of the
- * action
- */
- public void run(IAction action) {
- try {
- IWorkbenchBrowserSupport browserSupport = ServerUIPlugin.getInstance().getWorkbench().getBrowserSupport();
- IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null);
- browser.openURL(null);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error opening browser", e);
- }
- }
-
- /**
- * Notifies this action delegate that the selection in the workbench has changed.
- * <p>
- * Implementers can use this opportunity to change the availability of the
- * action or to modify other presentation properties.
- * </p>
- *
- * @param action the action proxy that handles presentation portion of the action
- * @param selection the current selection in the workbench
- */
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/SwitchBrowserWorkbenchAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/SwitchBrowserWorkbenchAction.java
deleted file mode 100644
index 10f0f623c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/SwitchBrowserWorkbenchAction.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.webbrowser;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.events.MenuAdapter;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.browser.BrowserManager;
-import org.eclipse.ui.internal.browser.IBrowserDescriptor;
-import org.eclipse.ui.internal.browser.WebBrowserPreference;
-import org.eclipse.ui.internal.browser.WebBrowserUtil;
-/**
- * Action to open the Web broswer.
- */
-public class SwitchBrowserWorkbenchAction implements IWorkbenchWindowPulldownDelegate2 {
- /**
- * The menu created by this action
- */
- private Menu fMenu;
-
- protected boolean recreateMenu = false;
-
- /**
- * SwitchBrowserWorkbenchAction constructor comment.
- */
- public SwitchBrowserWorkbenchAction() {
- super();
- }
-
- public void dispose() {
- setMenu(null);
- }
-
- /**
- * Sets this action's drop-down menu, disposing the previous menu.
- *
- * @param menu the new menu
- */
- private void setMenu(Menu menu) {
- if (fMenu != null) {
- fMenu.dispose();
- }
- fMenu = menu;
- }
-
- public void init(IWorkbenchWindow window) {
- // do nothing
- }
-
- /**
- * Adds the given action to the specified menu with an accelerator specified
- * by the given number.
- *
- * @param menu the menu to add the action to
- * @param action the action to add
- * @param accelerator the number that should appear as an accelerator
- */
- protected void addToMenu(Menu menu, IAction action, int accelerator) {
- StringBuffer label= new StringBuffer();
- if (accelerator >= 0 && accelerator < 10) {
- //add the numerical accelerator
- label.append('&');
- label.append(accelerator);
- label.append(' ');
- }
- label.append(action.getText());
- action.setText(label.toString());
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(menu, -1);
- }
-
- /**
- * Fills the drop-down menu with favorites and launch history,
- * launch shortcuts, and an action to open the launch configuration dialog.
- *
- * @param menu the menu to fill
- */
- protected void fillMenu(Menu menu) {
- int i = 0;
- if (WebBrowserUtil.canUseInternalWebBrowser()) {
- addToMenu(menu, new SwitchDefaultBrowserAction(null, WebBrowserPreference.getBrowserChoice() == WebBrowserPreference.INTERNAL, null), i++);
- }
- IBrowserDescriptor current = BrowserManager.getInstance().getCurrentWebBrowser();
- BrowserManager browserManager = BrowserManager.getInstance();
- Iterator iterator = browserManager.getWebBrowsers().iterator();
- while (iterator.hasNext()) {
- IBrowserDescriptor browser = (IBrowserDescriptor) iterator.next();
- addToMenu(menu, new SwitchDefaultBrowserAction(browser, WebBrowserPreference.getBrowserChoice() != WebBrowserPreference.INTERNAL && browser.equals(current), browserManager), i++);
- }
- }
-
- /**
- * Creates the menu for the action
- */
- private void initMenu() {
- // Add listener to repopulate the menu each time
- // it is shown because of dynamic history list
- fMenu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- //if (recreateMenu) {
- Menu m = (Menu) e.widget;
- MenuItem[] items = m.getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].dispose();
- }
- fillMenu(m);
- recreateMenu = false;
- //}
- }
- });
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
-
- public void run(IAction action) {
- // do nothing
- }
-
- public Menu getMenu(Menu parent) {
- setMenu(new Menu(parent));
- //fillMenu(fMenu);
- initMenu();
- return fMenu;
- }
-
- public Menu getMenu(Control parent) {
- setMenu(new Menu(parent));
- //fillMenu(fMenu);
- initMenu();
- return fMenu;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/SwitchDefaultBrowserAction.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/SwitchDefaultBrowserAction.java
deleted file mode 100644
index d9f8a162e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/webbrowser/SwitchDefaultBrowserAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.webbrowser;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.internal.browser.BrowserManager;
-import org.eclipse.ui.internal.browser.IBrowserDescriptor;
-import org.eclipse.ui.internal.browser.WebBrowserPreference;
-import org.eclipse.wst.server.ui.internal.Messages;
-/**
- * Action to open the Web browser.
- */
-public class SwitchDefaultBrowserAction extends Action {
- protected IBrowserDescriptor webbrowser;
- protected BrowserManager browserManager;
-
- /**
- * SwitchDefaultBrowserAction constructor comment.
- *
- * @param webbrowser a browser
- * @param current true if this is the current browser
- * @param manager the browser manager
- */
- public SwitchDefaultBrowserAction(IBrowserDescriptor webbrowser, boolean current, BrowserManager manager) {
- super();
-
- this.webbrowser = webbrowser;
- this.browserManager = manager;
- if (webbrowser == null)
- setText(Messages.internalWebBrowserName);
- else
- setText(webbrowser.getName());
-
- if (current)
- setChecked(true);
- }
-
- /**
- * Implementation of method defined on <code>IAction</code>.
- */
- public void run() {
- if (webbrowser == null)
- WebBrowserPreference.setBrowserChoice(WebBrowserPreference.INTERNAL);
- else {
- WebBrowserPreference.setBrowserChoice(WebBrowserPreference.EXTERNAL);
- browserManager.setCurrentWebBrowser(webbrowser);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/AbstractWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/AbstractWizard.java
deleted file mode 100644
index 65f822eaf..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/AbstractWizard.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IWorkbench;
-/**
- * An abstract Wizard that contains helper methods.
- */
-public abstract class AbstractWizard extends Wizard {
- protected IWorkbench workbench;
- protected IStructuredSelection selection;
-
- /**
- * AbstractWizard constructor comment.
- */
- public AbstractWizard() {
- super();
- }
-
- /**
- * Return the current workbench.
- *
- * @return the workbench
- */
- public IWorkbench getWorkbench() {
- return workbench;
- }
-
- /**
- * Initialize the workbench and current selection.
- *
- * @param newWorkbench
- * @param newSelection
- */
- public void init(IWorkbench newWorkbench, IStructuredSelection newSelection) {
- workbench = newWorkbench;
- selection = newSelection;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/ClosableWizardDialog.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/ClosableWizardDialog.java
deleted file mode 100644
index 5e757508c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/ClosableWizardDialog.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-/**
- * A closable wizard dialog.
- */
-public class ClosableWizardDialog extends WizardDialog {
- /**
- * Constructor for ClosableWizardDialog.
- * @param shell
- * @param wizard
- */
- public ClosableWizardDialog(Shell shell, IWizard wizard) {
- super(shell, wizard);
- }
-
- /**
- * The Finish button has been pressed.
- */
- public void finishPressed() {
- super.finishPressed();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/ModifyModulesWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/ModifyModulesWizard.java
deleted file mode 100644
index 08b930f30..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/ModifyModulesWizard.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.PublishServerJob;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.ModifyModulesWizardFragment;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- * A wizard used to add and remove modules.
- */
-public class ModifyModulesWizard extends TaskWizard {
- static class ModifyModulesWizard2 extends WizardFragment {
- protected void createChildFragments(List list) {
- list.add(new ModifyModulesWizardFragment());
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveServer(getTaskModel(), monitor);
-
- IServerAttributes svr = (IServerAttributes) getTaskModel().getObject(TaskModel.TASK_SERVER);
- if (svr instanceof IServer) {
- IServer server = (IServer) svr;
- if (server.getServerState() != IServer.STATE_STOPPED) {
- PublishServerJob publishJob = new PublishServerJob(server);
- publishJob.schedule();
- }
- }
- }
- });
- }
- }
-
- /**
- * ModifyModulesWizard constructor.
- *
- * @param server a server
- */
- public ModifyModulesWizard(IServer server) {
- super(Messages.wizModuleWizardTitle, new ModifyModulesWizard2());
-
- if (server != null)
- getTaskModel().putObject(TaskModel.TASK_SERVER, server.createWorkingCopy());
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewInstallableServerWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewInstallableServerWizard.java
deleted file mode 100644
index 4210cf5c9..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewInstallableServerWizard.java
+++ /dev/null
@@ -1,80 +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 Corporation - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.server.ui.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.server.core.internal.IInstallableServer;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.NewInstallableServerWizardFragment;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- * A wizard to create a new installable server.
- */
-public class NewInstallableServerWizard extends TaskWizard {
- /**
- * NewInstallableServerWizard constructor comment.
- */
- public NewInstallableServerWizard() {
- super(Messages.wizNewServerWizardTitle, new WizardFragment() {
- protected void createChildFragments(List list) {
- list.add(new NewInstallableServerWizardFragment());
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- IInstallableServer is = (IInstallableServer) getTaskModel().getObject("installableServer");
- if (is != null) {
- is.install(monitor);
- promptRestart();
- }
- }
- });
- }
- });
- }
-
- /**
- * Prompt the user to restart.
- */
- public static void promptRestart() {
- final Display display = Display.getDefault();
- display.asyncExec(new Runnable() {
- public void run() {
- boolean restart = MessageDialog.openQuestion(display.getActiveShell(),
- Messages.defaultDialogTitle, Messages.wizNewInstallableServerRestart
- );
- if (restart) {
- Thread t = new Thread("Restart thread") {
- public void run() {
- try {
- sleep(1000);
- } catch (Exception e) {
- // ignore
- }
- display.asyncExec(new Runnable() {
- public void run() {
- PlatformUI.getWorkbench().restart();
- }
- });
- }
- };
- t.setDaemon(true);
- t.start();
- }
- }
- });
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewRuntimeWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewRuntimeWizard.java
deleted file mode 100644
index 04a2249ec..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewRuntimeWizard.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.NewRuntimeWizardFragment;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-/**
- * A wizard to create a new runtime.
- */
-public class NewRuntimeWizard extends TaskWizard implements INewWizard {
- /**
- * NewRuntimeWizard constructor comment.
- */
- public NewRuntimeWizard() {
- super(Messages.wizNewRuntimeWizardTitle, new WizardFragment() {
- protected void createChildFragments(List list) {
- list.add(new NewRuntimeWizardFragment());
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveRuntime(getTaskModel(), monitor);
- }
- });
- }
- });
-
- setForcePreviousAndNextButtons(true);
- }
-
- public void init(IWorkbench newWorkbench, IStructuredSelection newSelection) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewServerWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewServerWizard.java
deleted file mode 100644
index ce8be44b4..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/NewServerWizard.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.wst.server.core.IServerAttributes;
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.ModifyModulesWizardFragment;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.NewServerWizardFragment;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.TasksWizardFragment;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-/**
- * A wizard to create a new server and server configuration.
- */
-public class NewServerWizard extends TaskWizard implements INewWizard {
- /**
- * NewServerWizard constructor comment.
- */
- public NewServerWizard() {
- this(null, null);
- }
-
- public NewServerWizard(final String[] ids, final String[] values) {
- super(Messages.wizNewServerWizardTitle, new WizardFragment() {
- protected void createChildFragments(List list) {
- list.add(new NewServerWizardFragment());
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.tempSaveRuntime(getTaskModel(), monitor);
- WizardTaskUtil.tempSaveServer(getTaskModel(), monitor);
- }
- });
- list.add(new ModifyModulesWizardFragment());
- list.add(new TasksWizardFragment());
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveRuntime(getTaskModel(), monitor);
- WizardTaskUtil.saveServer(getTaskModel(), monitor);
- try {
- IServerAttributes server = (IServerAttributes) getTaskModel().getObject(TaskModel.TASK_SERVER);
- ServerUIPlugin.getPreferences().addHostname(server.getHost());
- } catch (Exception e) {
- // ignore
- }
- }
- });
- }
- });
-
- if (ids != null) {
- TaskModel taskModel2 = getTaskModel();
- int size = ids.length;
- for (int i = 0; i < size; i++) {
- taskModel2.putObject(ids[i], values[i]);
- }
- }
- }
-
- public void init(IWorkbench newWorkbench, IStructuredSelection newSelection) {
- // do nothing
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/RunOnServerWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/RunOnServerWizard.java
deleted file mode 100644
index e21146a0b..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/RunOnServerWizard.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerAttributes;
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.ModifyModulesWizardFragment;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.NewServerWizardFragment;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.TasksWizardFragment;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- * A wizard used to select a server from various lists.
- */
-public class RunOnServerWizard extends TaskWizard {
- protected static NewServerWizardFragment task;
-
- /**
- * RunOnServerWizard constructor comment.
- *
- * @param module a module
- * @param launchMode a launch mode
- */
- public RunOnServerWizard(final IModule module, final String launchMode) {
- super(Messages.wizRunOnServerTitle, new WizardFragment() {
- protected void createChildFragments(List list) {
- task = new NewServerWizardFragment(module, launchMode);
- list.add(task);
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.tempSaveRuntime(getTaskModel(), monitor);
- WizardTaskUtil.tempSaveServer(getTaskModel(), monitor);
- }
- });
- list.add(new ModifyModulesWizardFragment(module));
- list.add(new TasksWizardFragment());
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveRuntime(getTaskModel(), monitor);
- WizardTaskUtil.saveServer(getTaskModel(), monitor);
- try {
- IServerAttributes server = (IServerAttributes) getTaskModel().getObject(TaskModel.TASK_SERVER);
- ServerUIPlugin.getPreferences().addHostname(server.getHost());
- } catch (Exception e) {
- // ignore
- }
- }
- });
- }
- });
-
- setNeedsProgressMonitor(true);
- if (ILaunchManager.DEBUG_MODE.equals(launchMode))
- setWindowTitle(Messages.wizDebugOnServerTitle);
- else if (ILaunchManager.PROFILE_MODE.equals(launchMode))
- setWindowTitle(Messages.wizProfileOnServerTitle);
- }
-
- /**
- * Return the server.
- * @return org.eclipse.wst.server.core.IServer
- */
- public IServer getServer() {
- try {
- return (IServer) getRootFragment().getTaskModel().getObject(TaskModel.TASK_SERVER);
- } catch (Exception e) {
- return null;
- }
- }
-
- public boolean isPreferredServer() {
- if (task == null)
- return false;
- return task.isPreferredServer();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/SelectClientWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/SelectClientWizard.java
deleted file mode 100644
index 3cb2a07e4..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/SelectClientWizard.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import org.eclipse.wst.server.core.internal.IClient;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.page.SelectClientComposite;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.eclipse.swt.widgets.Composite;
-/**
- * A wizard used to select a server client from a list.
- */
-public class SelectClientWizard extends TaskWizard {
- protected static SelectClientComposite comp;
-
- /**
- * SelectClientWizard constructor comment.
- *
- * @param clients an array of clients
- */
- public SelectClientWizard(final IClient[] clients) {
- super(Messages.wizSelectClientWizardTitle,
- new WizardFragment() {
- public boolean hasComposite() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.internal.task.WizardTask#getWizardPage()
- */
- public Composite createComposite(Composite parent, IWizardHandle wizard) {
- comp = new SelectClientComposite(parent, wizard, clients);
- return comp;
- }
- }
- );
-
- setForcePreviousAndNextButtons(true);
- }
-
- /**
- * Return the selected client.
- * @return org.eclipse.wst.server.core.IClient
- */
- public IClient getSelectedClient() {
- return comp.getSelectedClient();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/SelectTasksWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/SelectTasksWizard.java
deleted file mode 100644
index 16eb7f643..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/SelectTasksWizard.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.TasksWizardFragment;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- * A wizard used to select server and module tasks.
- */
-public class SelectTasksWizard extends TaskWizard {
- protected static TasksWizardFragment fragment;
-
- /**
- * SelectTasksWizard constructor.
- *
- * @param server a server
- */
- public SelectTasksWizard(final IServer server) {
- super(Messages.wizTaskWizardTitle, new WizardFragment() {
- protected void createChildFragments(List list) {
- fragment = new TasksWizardFragment();
- list.add(fragment);
- list.add(new WizardFragment() {
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- WizardTaskUtil.saveServer(getTaskModel(), monitor);
- }
- });
- }
- });
- getTaskModel().putObject(TaskModel.TASK_SERVER, server);
- addPages();
- }
-
- /**
- * Return <code>true</code> if this wizard has tasks.
- *
- * @return <code>true</code> if this wizard has tasks, and <code>false</code>
- * otherwise
- */
- public boolean hasTasks() {
- return fragment.hasTasks();
- }
-
- /**
- * Return <code>true</code> if this wizard has optional tasks.
- *
- * @return <code>true</code> if this wizard has optional tasks, and
- * <code>false</code> otherwise
- */
- public boolean hasOptionalTasks() {
- return fragment.hasOptionalTasks();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizard.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizard.java
deleted file mode 100644
index dc29ca92c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizard.java
+++ /dev/null
@@ -1,562 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.ui.internal.EclipseUtil;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.internal.wizard.page.WorkspaceRunnableAdapter;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- * A wizard used to execute tasks.
- */
-public class TaskWizard implements IWizard {
- private static final byte FINISH = 2;
- private static final byte CANCEL = 3;
-
- private List pages;
- private boolean addingPages;
- private Map fragmentData = new HashMap();
- protected TaskModel taskModel;
-
- private IWizardContainer container = null;
-
- private boolean needsProgressMonitor = false;
-
- private boolean forcePreviousAndNextButtons = false;
-
- private boolean isHelpAvailable = false;
-
- private Image defaultImage = null;
-
- private RGB titleBarColor = null;
-
- private String windowTitle = null;
-
- private IDialogSettings dialogSettings = null;
-
- private WizardFragment rootFragment;
- private WizardFragment currentFragment;
-
- /**
- * Create a new TaskWizard with the given title and root fragment.
- *
- * @param title a title
- * @param rootFragment a root fragment
- */
- public TaskWizard(String title, WizardFragment rootFragment) {
- this(title, rootFragment, null);
- setWindowTitle(title);
- }
-
- /**
- * Create a new TaskWizard with the given title, root fragment, and task model.
- *
- * @param title a title
- * @param rootFragment a root fragment
- * @param taskModel a task model
- */
- public TaskWizard(String title, WizardFragment rootFragment, TaskModel taskModel) {
- super();
- if (title != null)
- setWindowTitle(title);
- this.rootFragment = rootFragment;
- this.taskModel = taskModel;
- if (taskModel == null)
- this.taskModel = new TaskModel();
-
- setNeedsProgressMonitor(true);
- setForcePreviousAndNextButtons(true);
- }
-
- public void setTaskModel(TaskModel taskModel) {
- this.taskModel = taskModel;
- }
-
- public TaskModel getTaskModel() {
- return taskModel;
- }
-
- public void setRootFragment(WizardFragment rootFragment) {
- this.rootFragment = rootFragment;
- }
-
- public WizardFragment getRootFragment() {
- return rootFragment;
- }
-
- /**
- * Cancel the client selection.
- *
- * @return boolean
- */
- public boolean performCancel() {
- final List list = getAllWizardFragments();
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- Iterator iterator = list.iterator();
- while (iterator.hasNext())
- executeTask((WizardFragment) iterator.next(), CANCEL, monitor);
- } catch (CoreException ce) {
- throw new InvocationTargetException(ce);
- }
- }
- };
-
- Throwable t = null;
- try {
- if (getContainer() != null)
- getContainer().run(true, true, runnable);
- else
- runnable.run(new NullProgressMonitor());
- return true;
- } catch (InvocationTargetException te) {
- t = te.getCause();
- } catch (Exception e) {
- t = e;
- }
- Trace.trace(Trace.SEVERE, "Error cancelling task wizard", t);
-
- if (t instanceof CoreException) {
- EclipseUtil.openError(t.getLocalizedMessage(), ((CoreException)t).getStatus());
- } else
- EclipseUtil.openError(t.getLocalizedMessage());
-
- return false;
-
- }
-
- public boolean performFinish() {
- if (currentFragment != null)
- currentFragment.exit();
-
- final WizardFragment cFragment = currentFragment;
-
- final List list = getAllWizardFragments();
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- // enter & exit the remaining pages
- int index = list.indexOf(cFragment);
- while (index > 0 && index < list.size() - 1) {
- final WizardFragment fragment = (WizardFragment) list.get(++index);
- try {
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- fragment.enter();
- fragment.exit();
- }
- });
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not enter/exit page", e);
- }
- }
-
- if (useJob()) {
- class FinishWizardJob extends Job {
- public FinishWizardJob() {
- super(getJobTitle());
- }
-
- public boolean belongsTo(Object family) {
- return "org.eclipse.wst.server.ui.family".equals(family);
- }
-
- public IStatus run(IProgressMonitor monitor2) {
- try {
- Iterator iterator = list.iterator();
- while (iterator.hasNext())
- executeTask((WizardFragment) iterator.next(), FINISH, monitor2);
- } catch (CoreException ce) {
- Trace.trace(Trace.SEVERE, "Error finishing wizard job", ce);
- return new Status(IStatus.ERROR, ServerUIPlugin.PLUGIN_ID, 0, ce.getLocalizedMessage(), null);
- }
- return Status.OK_STATUS;
- }
- }
-
- FinishWizardJob job = new FinishWizardJob();
- job.setUser(true);
- job.schedule();
- } else {
- Iterator iterator = list.iterator();
- while (iterator.hasNext())
- executeTask((WizardFragment) iterator.next(), FINISH, monitor);
- }
- }
- };
-
- Throwable t = null;
- try {
- if (getContainer() != null)
- getContainer().run(true, true, new WorkspaceRunnableAdapter(runnable));
- else
- runnable.run(new NullProgressMonitor());
- return true;
- } catch (InvocationTargetException te) {
- Trace.trace(Trace.SEVERE, "Error finishing task wizard", te);
- t = te.getCause();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error finishing task wizard 2", e);
- t = e;
- }
-
- // TODO: show better error dialog, e.g. when Tomcat config is corrupt while doing Add/Remove
- // it currently displays the error message twice
- Trace.trace(Trace.WARNING, "Error completing wizard", t);
- if (t instanceof CoreException) {
- EclipseUtil.openError(t.getLocalizedMessage(), ((CoreException)t).getStatus());
- } else if (t instanceof NullPointerException)
- EclipseUtil.openError("NullPointerException");
- else
- EclipseUtil.openError(t.getLocalizedMessage());
-
- return false;
- }
-
- public void addPage(IWizardPage page) {
- pages.add(page);
- page.setWizard(this);
- }
-
- protected void executeTask(WizardFragment fragment, byte type, IProgressMonitor monitor) throws CoreException {
- if (fragment == null)
- return;
-
- if (type == FINISH)
- fragment.performFinish(monitor);
- else if (type == CANCEL)
- fragment.performCancel(monitor);
- }
-
- protected WizardFragment getCurrentWizardFragment() {
- return currentFragment;
- }
-
- protected void switchWizardFragment(WizardFragment newFragment) {
- List list = getAllWizardFragments();
- int oldIndex = list.indexOf(currentFragment);
- int newIndex = list.indexOf(newFragment);
- if (oldIndex == newIndex)
- return;
-
- //safeExecuteTask(currentFragment, DEPARTURE);
- if (currentFragment != null)
- currentFragment.exit();
-
- if (oldIndex < newIndex)
- oldIndex ++;
- else
- oldIndex --;
-
- while (oldIndex != newIndex) {
- WizardFragment fragment = (WizardFragment) list.get(oldIndex);
- //safeExecuteTask(fragment, ARRIVAL);
- //safeExecuteTask(fragment, DEPARTURE);
- fragment.enter();
- fragment.exit();
- if (oldIndex < newIndex)
- oldIndex ++;
- else
- oldIndex --;
- }
-
- currentFragment = newFragment;
- //safeExecuteTask(currentFragment, ARRIVAL);
- currentFragment.enter();
- }
-
- private List getAllWizardFragments() {
- List list = new ArrayList();
- list.add(rootFragment);
- addSubWizardFragments(rootFragment, list);
-
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- WizardFragment fragment = (WizardFragment) iterator.next();
- if (!taskModel.equals(fragment.getTaskModel()))
- fragment.setTaskModel(taskModel);
- }
- return list;
- }
-
- private void addSubWizardFragments(WizardFragment fragment, List list) {
- Iterator iterator = fragment.getChildFragments().iterator();
- while (iterator.hasNext()) {
- WizardFragment child = (WizardFragment) iterator.next();
- list.add(child);
- addSubWizardFragments(child, list);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#addPages()
- */
- public void addPages() {
- if (addingPages)
- return;
-
- try {
- addingPages = true;
- pages = new ArrayList();
- Iterator iterator = getAllWizardFragments().iterator();
- while (iterator.hasNext()) {
- WizardFragment fragment = (WizardFragment) iterator.next();
- TaskWizardPage page = getFragmentData(fragment);
- if (fragment.hasComposite()) {
- if (page != null)
- addPage(page);
- else {
- TaskWizardPage page2 = new TaskWizardPage(fragment);
- fragmentData.put(fragment, page2);
- addPage(page2);
- }
- }
- }
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error adding fragments to wizard", e);
- } finally {
- addingPages = false;
- }
- }
-
- /*private static void updateWizardPages() {
- try {
- current.updatePages();
- current.getContainer().updateButtons();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error updating wizard pages", e);
- }
- }*/
-
- private TaskWizardPage getFragmentData(WizardFragment fragment) {
- try {
- TaskWizardPage page = (TaskWizardPage) fragmentData.get(fragment);
- if (page != null)
- return page;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error getting fragment data", e);
- }
-
- return null;
- }
-
- protected void updatePages() {
- addPages();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#canFinish()
- */
- public boolean canFinish() {
- // Default implementation is to check if all pages are complete.
- for (int i= 0; i < pages.size(); i++) {
- if (!((IWizardPage)pages.get(i)).isPageComplete())
- return false;
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#createPageControls(org.eclipse.swt.widgets.Composite)
- */
- public void createPageControls(Composite pageContainer) {
- // the default behavior is to create all the pages controls
- for (int i = 0; i < pages.size(); i++){
- IWizardPage page = (IWizardPage) pages.get(i);
- page.createControl(pageContainer);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#dispose()
- */
- public void dispose() {
- // notify pages
- for (int i = 0; i < pages.size(); i++){
- ((IWizardPage)pages.get(i)).dispose();
- }
-
- // dispose of image
- if (defaultImage != null) {
- defaultImage.dispose();
- defaultImage = null;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getContainer()
- */
- public IWizardContainer getContainer() {
- return container;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getDefaultPageImage()
- */
- public Image getDefaultPageImage() {
- return defaultImage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getDialogSettings()
- */
- public IDialogSettings getDialogSettings() {
- return dialogSettings;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getNextPage(IWizardPage page) {
- int index = pages.indexOf(page);
- if (index == pages.size() - 1 || index == -1)
- // last page or page not found
- return null;
-
- return (IWizardPage)pages.get(index + 1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getPage(java.lang.String)
- */
- public IWizardPage getPage(String name) {
- for (int i= 0; i < pages.size(); i++) {
- IWizardPage page = (IWizardPage)pages.get(i);
- String pageName = page.getName();
- if (pageName.equals(name))
- return page;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getPageCount()
- */
- public int getPageCount() {
- return pages.size();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getPages()
- */
- public IWizardPage[] getPages() {
- return (IWizardPage[])pages.toArray(new IWizardPage[pages.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getPreviousPage(IWizardPage page) {
- int index = pages.indexOf(page);
- if (index == 0 || index == -1)
- // first page or page not found
- return null;
- return (IWizardPage)pages.get(index - 1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getStartingPage()
- */
- public IWizardPage getStartingPage() {
- if (pages.size() == 0)
- return null;
-
- return (IWizardPage) pages.get(0);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getTitleBarColor()
- */
- public RGB getTitleBarColor() {
- return titleBarColor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#getWindowTitle()
- */
- public String getWindowTitle() {
- return windowTitle;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#isHelpAvailable()
- */
- public boolean isHelpAvailable() {
- return isHelpAvailable;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#needsPreviousAndNextButtons()
- */
- public boolean needsPreviousAndNextButtons() {
- return forcePreviousAndNextButtons || pages.size() > 1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#needsProgressMonitor()
- */
- public boolean needsProgressMonitor() {
- return needsProgressMonitor;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.IWizard#setContainer(org.eclipse.jface.wizard.IWizardContainer)
- */
- public void setContainer(IWizardContainer wizardContainer) {
- this.container = wizardContainer;
- }
-
- public void setDialogSettings(IDialogSettings settings) {
- dialogSettings = settings;
- }
-
- public void setNeedsProgressMonitor(boolean b) {
- needsProgressMonitor = b;
- }
-
- public void setForcePreviousAndNextButtons(boolean b) {
- forcePreviousAndNextButtons = b;
- }
-
- public void setWindowTitle(String title) {
- windowTitle = title;
- }
-
- protected boolean useJob() {
- return false;
- }
-
- protected String getJobTitle() {
- return getWindowTitle();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizardPage.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizardPage.java
deleted file mode 100644
index 02658ffc8..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/TaskWizardPage.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- * A task wizard page.
- */
-class TaskWizardPage extends WizardPage implements IWizardHandle {
- protected WizardFragment fragment;
-
- protected boolean isEmptyError = false;
-
- public TaskWizardPage(WizardFragment fragment) {
- super(fragment.toString());
- this.fragment = fragment;
- }
-
- public void createControl(Composite parentComp) {
- Composite comp = null;
- try {
- comp = fragment.createComposite(parentComp, this);
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not create wizard page composite", e);
- }
- if (comp == null) {
- comp = new Composite(parentComp, SWT.NONE);
- comp.setLayout(new FillLayout(SWT.VERTICAL));
- Label label = new Label(comp, SWT.NONE);
- label.setText("Internal error");
- }
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.widthHint = convertHorizontalDLUsToPixels(150);
- //data.heightHint = convertVerticalDLUsToPixels(350);
- comp.setLayoutData(data);
- setControl(comp);
- }
-
- public boolean isPageComplete() {
- //if (isEmptyError)
- // return false;
- try {
- if (!fragment.isComplete())
- return false;
- } catch (Exception e) {
- return false;
- }
- //return (getMessage() == null || getMessageType() != ERROR);
- return true;
- }
-
- public boolean canFlipToNextPage() {
- if (getNextPage() == null)
- return false;
- //if (isEmptyError)
- // return false;
- try {
- if (!fragment.isComplete())
- return false;
- } catch (Exception e) {
- return false;
- }
- return true;
- //return (getMessage() == null || getMessageType() != ERROR);
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- if (visible) {
- TaskWizard wizard = (TaskWizard) getWizard();
- wizard.switchWizardFragment(fragment);
-
- if (getContainer().getCurrentPage() != null)
- getContainer().updateButtons();
- }
- }
-
- public void setMessage(String message, int type) {
- if (type == IMessageProvider.ERROR && "".equals(message)) {
- isEmptyError = true;
- message = null;
- } else
- isEmptyError = false;
- super.setMessage(message, type);
- WizardFragment frag = ((TaskWizard) getWizard()).getCurrentWizardFragment();
- if (!fragment.equals(frag))
- return;
- getContainer().updateButtons();
- }
-
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InterruptedException, InvocationTargetException {
- getWizard().getContainer().run(fork, cancelable, runnable);
- }
-
- public void update() {
- fragment.updateChildFragments();
- ((TaskWizard) getWizard()).updatePages();
- if (getContainer().getCurrentPage() != null)
- getContainer().updateButtons();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/WizardTaskUtil.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/WizardTaskUtil.java
deleted file mode 100644
index 07c10442c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/WizardTaskUtil.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard;
-
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.ProjectProperties;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.EclipseUtil;
-import org.eclipse.wst.server.ui.internal.Trace;
-/**
- *
- */
-public class WizardTaskUtil {
- private WizardTaskUtil() {
- // do nothing
- }
-
- public static void saveRuntime(TaskModel taskModel, IProgressMonitor monitor) throws CoreException {
- IRuntime runtime = (IRuntime) taskModel.getObject(TaskModel.TASK_RUNTIME);
- if (runtime != null && runtime instanceof IRuntimeWorkingCopy) {
- IRuntimeWorkingCopy workingCopy = (IRuntimeWorkingCopy) runtime;
- if (workingCopy.isDirty())
- taskModel.putObject(TaskModel.TASK_RUNTIME, workingCopy.save(false, monitor));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.internal.task.ITask#doTask()
- */
- public static void saveServer(TaskModel taskModel, IProgressMonitor monitor) throws CoreException {
- IServer server = (IServer) taskModel.getObject(TaskModel.TASK_SERVER);
- if (server != null && server instanceof IServerWorkingCopy) {
- IServerWorkingCopy workingCopy = (IServerWorkingCopy) server;
- if (workingCopy.isDirty()) {
- IFile file = ((Server)workingCopy).getFile();
- if (file != null) {
- IProject project = file.getProject();
-
- if (!file.getProject().exists())
- EclipseUtil.createNewServerProject(null, project.getName(), null, monitor);
-
- ProjectProperties pp = ServerPlugin.getProjectProperties(project);
- if (!pp.isServerProject())
- pp.setServerProject(true, monitor);
- }
- taskModel.putObject(TaskModel.TASK_SERVER, workingCopy.save(false, monitor));
- }
- }
- }
-
- public static void tempSaveRuntime(TaskModel taskModel, IProgressMonitor monitor) throws CoreException {
- IRuntime runtime = (IRuntime) taskModel.getObject(TaskModel.TASK_RUNTIME);
- if (runtime != null && runtime instanceof IRuntimeWorkingCopy) {
- IRuntimeWorkingCopy workingCopy = (IRuntimeWorkingCopy) runtime;
- if (!workingCopy.isDirty())
- return;
-
- runtime = workingCopy.save(false, monitor);
- taskModel.putObject(TaskModel.TASK_RUNTIME, runtime.createWorkingCopy());
- }
- }
-
- public static void tempSaveServer(TaskModel taskModel, IProgressMonitor monitor) throws CoreException {
- IServer server = (IServer) taskModel.getObject(TaskModel.TASK_SERVER);
- if (server != null && server instanceof IServerWorkingCopy) {
- IServerWorkingCopy workingCopy = (IServerWorkingCopy) server;
- if (!workingCopy.isDirty())
- return;
-
- IFile file = ((Server)workingCopy).getFile();
- if (file != null) {
- IProject project = file.getProject();
-
- if (!file.getProject().exists())
- EclipseUtil.createNewServerProject(null, project.getName(), null, monitor);
-
- ProjectProperties pp = ServerPlugin.getProjectProperties(project);
- if (!pp.isServerProject())
- pp.setServerProject(true, monitor);
- }
- IRuntime runtime = workingCopy.getRuntime();
-
- server = workingCopy.save(false, monitor);
- workingCopy = server.createWorkingCopy();
-
- workingCopy.setRuntime(runtime);
- if (workingCopy.getServerType().hasServerConfiguration()) {
- ((ServerWorkingCopy)workingCopy).importConfiguration(runtime, null);
- }
- taskModel.putObject(TaskModel.TASK_SERVER, workingCopy);
- }
- }
-
- public static void addModule(IModule module, TaskModel taskModel, IProgressMonitor monitor) throws CoreException {
- if (module == null)
- return;
-
- IServer server = (IServer) taskModel.getObject(TaskModel.TASK_SERVER);
- IModule parentModule = null;
- try {
- IModule[] parents = server.getRootModules(module, monitor);
- if (parents != null && parents.length > 0) {
- parentModule = parents[0];
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not find parent module", e);
- }
-
- if (parentModule == null) {
- // Use the original module since no parent module is available.
- parentModule = module;
- }
-
- IModule[] modules = server.getModules();
- int size = modules.length;
- for (int i = 0; i < size; i++) {
- if (parentModule.equals(modules[i]))
- return;
- }
-
- IServerWorkingCopy workingCopy = server.createWorkingCopy();
- workingCopy.modifyModules(new IModule[] { parentModule }, new IModule[0], monitor);
- taskModel.putObject(TaskModel.TASK_SERVER, workingCopy.save(false, monitor));
- }
-
- public static void modifyModules(List add, List remove, TaskModel taskModel, IProgressMonitor monitor) throws CoreException {
- if ((add == null || add.isEmpty()) && (remove == null || remove.isEmpty()))
- return;
-
- IServerWorkingCopy workingCopy = (IServerWorkingCopy) taskModel.getObject(TaskModel.TASK_SERVER);
-
- // modify modules
- IModule[] remove2 = new IModule[0];
- if (remove != null) {
- remove2 = new IModule[remove.size()];
- remove.toArray(remove2);
- }
-
- IModule[] add2 = new IModule[0];
- if (add != null) {
- add2 = new IModule[add.size()];
- add.toArray(add2);
- }
-
- IFile file = ((Server)workingCopy).getFile();
- if (file != null) {
- IProject project = file.getProject();
-
- if (!file.getProject().exists())
- EclipseUtil.createNewServerProject(null, project.getName(), null, monitor);
-
- ProjectProperties pp = ServerPlugin.getProjectProperties(project);
- if (!pp.isServerProject())
- pp.setServerProject(true, monitor);
- }
-
- workingCopy.modifyModules(add2, remove2, monitor);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/ModifyModulesWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/ModifyModulesWizardFragment.java
deleted file mode 100644
index 77018a58e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/ModifyModulesWizardFragment.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.fragment;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.IModuleVisitor;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.ui.internal.Trace;
-import org.eclipse.wst.server.ui.internal.wizard.WizardTaskUtil;
-import org.eclipse.wst.server.ui.internal.wizard.page.ModifyModulesComposite;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- *
- */
-public class ModifyModulesWizardFragment extends WizardFragment {
- protected ModifyModulesComposite comp;
-
- protected IModule module;
-
- public ModifyModulesWizardFragment() {
- // do nothing
- }
-
- public ModifyModulesWizardFragment(IModule module) {
- this.module = module;
- }
-
- public boolean hasComposite() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.internal.task.WizardTask#getWizardPage()
- */
- public Composite createComposite(Composite parent, IWizardHandle handle) {
- comp = new ModifyModulesComposite(parent, handle, module);
- return comp;
- }
-
- public void setTaskModel(TaskModel taskModel) {
- super.setTaskModel(taskModel);
- if (comp != null)
- comp.setTaskModel(taskModel);
- }
-
- public List getChildFragments() {
- updateModules();
- return super.getChildFragments();
- }
-
- public void enter() {
- updateModules();
- }
-
- protected void updateModules() {
- if (comp != null) {
- IServerAttributes server = (IServerAttributes) getTaskModel().getObject(TaskModel.TASK_SERVER);
- comp.setServer(server);
- comp.setTaskModel(getTaskModel());
- } else if (module != null) {
- TaskModel taskModel = getTaskModel();
- if (taskModel == null)
- return;
- IServerWorkingCopy server = (IServerWorkingCopy) taskModel.getObject(TaskModel.TASK_SERVER);
- if (server == null) {
- taskModel.putObject(TaskModel.TASK_MODULES, null);
- return;
- }
-
- final List moduleList = new ArrayList();
- if (server != null) {
- ((Server) server).visit(new IModuleVisitor() {
- public boolean visit(IModule[] module2) {
- moduleList.add(module2);
- return true;
- }
- }, null);
- }
-
- // add module
- IModule parent = null;
- try {
- IModule[] parents = server.getRootModules(module, null);
- List list = new ArrayList();
-
- if (parents != null && parents.length > 0) {
- parent = parents[0];
- list.add(parent);
- }
- // TODO - get parent modules correct
- if (!moduleList.contains(module)) {
- moduleList.add(new IModule[] { module });
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not find parent module", e);
- }
-
- taskModel.putObject(TaskModel.TASK_MODULES, moduleList);
- }
- }
-
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- if (comp != null)
- WizardTaskUtil.modifyModules(comp.getModulesToAdd(), comp.getModulesToRemove(), getTaskModel(), monitor);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewInstallableServerWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewInstallableServerWizardFragment.java
deleted file mode 100644
index 9716ce2ee..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewInstallableServerWizardFragment.java
+++ /dev/null
@@ -1,48 +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.server.ui.internal.wizard.fragment;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.wizard.page.NewInstallableServerComposite;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-/**
- *
- */
-public class NewInstallableServerWizardFragment extends WizardFragment {
- protected NewInstallableServerComposite comp;
-
- public NewInstallableServerWizardFragment() {
- // do nothing
- }
-
- public boolean hasComposite() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.internal.task.WizardTask#getWizardPage()
- */
- public Composite createComposite(Composite parent, IWizardHandle wizard) {
- comp = new NewInstallableServerComposite(parent, getTaskModel(), wizard);
-
- wizard.setTitle(Messages.wizNewInstallableServerTitle);
- wizard.setDescription(Messages.wizNewInstallableServerDescription);
- wizard.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_NEW_SERVER));
- return comp;
- }
-
- public boolean isComplete() {
- return getTaskModel().getObject("installableServer") != null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewRuntimeWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewRuntimeWizardFragment.java
deleted file mode 100644
index 741d96fcb..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewRuntimeWizardFragment.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.fragment;
-
-import java.util.List;
-
-import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.wizard.page.NewRuntimeComposite;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-
-import org.eclipse.swt.widgets.Composite;
-/**
- *
- */
-public class NewRuntimeWizardFragment extends WizardFragment {
- protected NewRuntimeComposite page;
-
- // filter by type/version
- protected String type;
- protected String version;
-
- // filter by partial runtime type id
- protected String runtimeTypeId;
-
- public NewRuntimeWizardFragment() {
- // do nothing
- }
-
- public NewRuntimeWizardFragment(String type, String version, String runtimeTypeId) {
- this.type = type;
- this.version = version;
- this.runtimeTypeId = runtimeTypeId;
- }
-
- public boolean hasComposite() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.internal.task.WizardTask#getWizardPage()
- */
- public Composite createComposite(Composite parent, IWizardHandle wizard) {
- page = new NewRuntimeComposite(parent, wizard, getTaskModel(), type, version, runtimeTypeId);
- return page;
- }
-
- protected void createChildFragments(List list) {
- if (getTaskModel() == null)
- return;
-
- IRuntimeWorkingCopy runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
- if (runtime == null)
- return;
-
- WizardFragment sub = ServerUIPlugin.getWizardFragment(runtime.getRuntimeType().getId());
- if (sub != null)
- list.add(sub);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewServerWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewServerWizardFragment.java
deleted file mode 100644
index ac3502ef0..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/NewServerWizardFragment.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.fragment;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.wizard.page.NewServerComposite;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-/**
- *
- */
-public class NewServerWizardFragment extends WizardFragment {
- public static final String MODE = "mode";
- public static final byte MODE_EXISTING = 0;
- public static final byte MODE_DETECT = 1;
- public static final byte MODE_MANUAL= 2;
-
- protected NewServerComposite comp;
- protected IModule module;
- protected String launchMode;
-
- protected Map fragmentMap = new HashMap();
- protected Map configMap = new HashMap();
-
- public NewServerWizardFragment() {
- // do nothing
- }
-
- public NewServerWizardFragment(IModule module, String launchMode) {
- this.module = module;
- this.launchMode = launchMode;
- }
-
- public boolean hasComposite() {
- return true;
- }
-
- public void enter() {
- super.enter();
- getTaskModel().putObject(TaskModel.TASK_LAUNCH_MODE, launchMode);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.internal.task.WizardTask#getWizardPage()
- */
- public Composite createComposite(Composite parent, IWizardHandle wizard) {
- comp = new NewServerComposite(parent, wizard, module, launchMode);
- if (getTaskModel() != null)
- comp.setTaskModel(getTaskModel());
- return comp;
- }
-
- protected WizardFragment getWizardFragment(String typeId) {
- try {
- WizardFragment fragment = (WizardFragment) fragmentMap.get(typeId);
- if (fragment != null)
- return fragment;
- } catch (Exception e) {
- // ignore
- }
-
- WizardFragment fragment = ServerUIPlugin.getWizardFragment(typeId);
- if (fragment != null)
- fragmentMap.put(typeId, fragment);
- return fragment;
- }
-
- public List getChildFragments() {
- List listImpl = new ArrayList();
- createChildFragments(listImpl);
- return listImpl;
- }
-
- protected void createChildFragments(List list) {
- if (getTaskModel() == null)
- return;
-
- Byte b = (Byte) getTaskModel().getObject(MODE);
- if (b != null && b.byteValue() == MODE_MANUAL) {
- IRuntime runtime = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
- if (runtime != null && runtime instanceof IRuntimeWorkingCopy) {
- WizardFragment sub = getWizardFragment(runtime.getRuntimeType().getId());
- if (sub != null)
- list.add(sub);
- }
-
- IServerAttributes server = (IServerAttributes) getTaskModel().getObject(TaskModel.TASK_SERVER);
- if (server != null) {
- // createConfiguration(server);
- if (server.getServerType().hasServerConfiguration() && server instanceof ServerWorkingCopy) {
- ServerWorkingCopy swc = (ServerWorkingCopy) server;
- swc.importConfiguration(runtime, null);
- }
- WizardFragment sub = getWizardFragment(server.getServerType().getId());
- if (sub != null)
- list.add(sub);
- }
- } else if (b != null && b.byteValue() == MODE_EXISTING) {
- /*if (comp != null) {
- IServer server = comp.getServer();
- if (server != null)
- list.add(new TasksWizardFragment());
- }*/
- }
- }
-
- public boolean isComplete() {
- if (comp == null)
- return false;
- return comp.getServer() != null;
- }
-
- public IServerWorkingCopy getServer() {
- if (comp == null)
- return null;
- return comp.getServer();
- }
-
- public boolean isPreferredServer() {
- if (comp == null)
- return false;
- return comp.isPreferredServer();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/ServerConfigurationWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/ServerConfigurationWizardFragment.java
deleted file mode 100644
index 16803d5ed..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/ServerConfigurationWizardFragment.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.fragment;
-
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- *
- */
-public class ServerConfigurationWizardFragment extends WizardFragment {
- public ServerConfigurationWizardFragment() {
- // do nothing
- }
-
- public void enter() {
- //TaskModel model = getTaskModel();
- //IRuntime runtime = (IRuntime) model.getObject(TaskModel.TASK_RUNTIME);
- //IServerWorkingCopy server = (IServerWorkingCopy) model.getObject(TaskModel.TASK_SERVER);
-
- //IServerType type = server.getServerType();
- /*if (type.hasServerConfiguration() && server.getServerConfiguration() == null) {
- try {
- IFile file = null;
- if (ServerCore.getServerPreferences().isCreateResourcesInWorkspace())
- file = ServerUtil.getUnusedServerConfigurationFile(WizardUtil.getServerProject(), type.getServerConfigurationType());
-
- IServerConfigurationWorkingCopy serverConfiguration = type.getServerConfigurationType().importFromRuntime(null, file, runtime, new NullProgressMonitor());
- ServerUtil.setServerConfigurationDefaultName(serverConfiguration);
- model.putObject(TaskModel.TASK_SERVER_CONFIGURATION, serverConfiguration);
- server.setServerConfiguration(serverConfiguration);
- updateChildFragments();
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Could not create configuration", e);
- }
- }*/
- }
-
- /*protected void createChildFragments(List list) {
- IServerWorkingCopy server = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
- IServerConfiguration serverConfiguration = null;
- if (server != null)
- serverConfiguration = server.getServerConfiguration();
- if (serverConfiguration != null) {
- WizardFragment sub = ServerUICore.getWizardFragment(serverConfiguration.getServerConfigurationType().getId());
- if (sub != null)
- list.add(sub);
- }
- }*/
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/TasksWizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/TasksWizardFragment.java
deleted file mode 100644
index f9a3dab39..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/fragment/TasksWizardFragment.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.fragment;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.*;
-import org.eclipse.wst.server.core.model.PublishOperation;
-import org.eclipse.wst.server.ui.internal.editor.IOrdered;
-import org.eclipse.wst.server.ui.internal.wizard.page.TasksComposite;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.wst.server.ui.wizard.WizardFragment;
-/**
- *
- */
-public class TasksWizardFragment extends WizardFragment {
- public class TaskInfo implements IOrdered {
- public int kind;
- public String id;
- public PublishOperation task2;
-
- private static final String DEFAULT = "default:";
-
- public boolean isSelected() {
- if (id == null)
- return false;
-
- if (selectedTaskMap.containsKey(id))
- return ((Boolean) selectedTaskMap.get(id)).booleanValue();
-
- if (selectedTaskMap.containsKey(DEFAULT + id))
- return ((Boolean) selectedTaskMap.get(DEFAULT + id)).booleanValue();
-
- return false;
- }
-
- public void setDefaultSelected(boolean sel) {
- selectedTaskMap.put(DEFAULT + getId(), new Boolean(sel));
- }
-
- public boolean getDefaultSelected() {
- return ((Boolean) selectedTaskMap.get(DEFAULT + id)).booleanValue();
- }
-
- public void setSelected(boolean sel) {
- selectedTaskMap.put(getId(), new Boolean(sel));
- }
-
- public int getOrder() {
- return task2.getOrder();
- }
-
- protected String getId() {
- return id;
- }
- }
-
- protected TasksComposite comp;
-
- protected List tasks;
- protected boolean hasOptionalTasks;
-
- protected Map selectedTaskMap = new HashMap();
-
- public TasksWizardFragment() {
- // do nothing
- }
-
- public void enter() {
- updateTasks();
-
- if (comp != null)
- comp.createControl();
- }
-
- public List getChildFragments() {
- updateTasks();
- return super.getChildFragments();
- }
-
- public void setTaskModel(TaskModel taskModel) {
- super.setTaskModel(taskModel);
- updateTasks();
- }
-
- public void updateTasks() {
- tasks = null;
- if (getTaskModel() == null)
- return;
-
- IServerAttributes server = (IServerAttributes) getTaskModel().getObject(TaskModel.TASK_SERVER);
- List modules = (List) getTaskModel().getObject(TaskModel.TASK_MODULES);
-
- if (server != null && modules == null) {
- final List moduleList = new ArrayList();
- ((Server) server).visit(new IModuleVisitor() {
- public boolean visit(IModule[] module2) {
- moduleList.add(module2);
- return true;
- }
- }, null);
-
- modules = moduleList;
- }
-
- if (server != null && modules != null) {
- tasks = new ArrayList();
- createTasks(server, modules);
- }
-
- if (comp != null)
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- comp.setTasks(tasks);
- }
- });
- }
-
- protected void createTasks(IServerAttributes server, List modules) {
- if (server == null)
- return;
-
- List enabledTasks = ((Server)server).getEnabledOptionalPublishOperationIds();
- List disabledTasks = ((Server)server).getDisabledPreferredPublishOperationIds();
- PublishOperation[] tasks2 = ((Server)server).getAllTasks(modules);
- for (int j = 0; j < tasks2.length; j++) {
- int kind = tasks2[j].getKind();
- String id = ((Server)server).getPublishOperationId(tasks2[j]);
- if (kind == PublishOperation.OPTIONAL || kind == PublishOperation.PREFERRED)
- hasOptionalTasks = true;
- tasks2[j].setTaskModel(getTaskModel());
-
- boolean selected = true;
- if (kind == PublishOperation.OPTIONAL) {
- if (!enabledTasks.contains(id))
- selected = false;
- } else if (kind == PublishOperation.PREFERRED) {
- if (disabledTasks.contains(id))
- selected = false;
- }
- addServerTask(server, tasks2[j], selected);
- }
- }
-
- public void addServerTask(IServerAttributes server, PublishOperation task2, boolean selected) {
- TaskInfo sti = new TaskInfo();
- sti.task2 = task2;
- sti.kind = task2.getKind();
- sti.id = ((Server)server).getPublishOperationId(task2);
- sti.setDefaultSelected(selected);
-
- tasks.add(sti);
- }
-
- public boolean hasComposite() {
- return hasTasks();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.server.ui.internal.task.WizardTask#getWizardPage()
- */
- public Composite createComposite(Composite parent, IWizardHandle wizard) {
- comp = new TasksComposite(parent, wizard);
- return comp;
- }
-
- /**
- * @see WizardFragment#performFinish(IProgressMonitor)
- */
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- if (!hasOptionalTasks)
- return;
-
- if (tasks == null || tasks.isEmpty())
- return;
-
- TaskModel taskModel = getTaskModel();
- IServer server = (IServer)taskModel.getObject(TaskModel.TASK_SERVER);
- if (server == null)
- return;
-
- boolean createdWC = false;
- ServerWorkingCopy wc = null;
- if (server instanceof ServerWorkingCopy)
- wc = (ServerWorkingCopy)server;
- else {
- wc = (ServerWorkingCopy)server.createWorkingCopy();
- createdWC = true;
- }
- wc.resetPreferredPublishOperations();
- wc.resetOptionalPublishOperations();
-
- Iterator iterator = tasks.iterator();
- while (iterator.hasNext()) {
- TaskInfo task = (TaskInfo)iterator.next();
- if (PublishOperation.REQUIRED == task.kind)
- continue;
-
- if (PublishOperation.PREFERRED == task.kind) {
- if (!task.isSelected())
- wc.disablePreferredPublishOperations(task.task2);
- } else if (PublishOperation.OPTIONAL == task.kind) {
- if (task.isSelected())
- wc.enableOptionalPublishOperations(task.task2);
- }
- }
-
- if (createdWC && wc.isDirty())
- wc.save(true, monitor);
- monitor.done();
- }
-
- /**
- * Return <code>true</code> if this wizard has tasks.
- *
- * @return <code>true</code> if this wizard has tasks, and <code>false</code>
- * otherwise
- */
- public boolean hasTasks() {
- return tasks == null || !tasks.isEmpty();
- }
-
- /**
- * Return <code>true</code> if this wizard has optional tasks.
- *
- * @return <code>true</code> if this wizard has optional tasks, and
- * <code>false</code> otherwise
- */
- public boolean hasOptionalTasks() {
- return hasOptionalTasks;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ElementCreationCache.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ElementCreationCache.java
deleted file mode 100644
index 985961e66..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ElementCreationCache.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-/**
- * A helper class used to cache the creation of server elements.
- */
-public class ElementCreationCache {
- protected Map elementCache;
- protected Map taskCache;
-
- /**
- * ElementCreationCache constructor comment.
- */
- public ElementCreationCache() {
- super();
- elementCache = new HashMap();
- taskCache = new HashMap();
- }
-
- /**
- * Return the key to use for the given factory.
- *
- * @param type the server type
- * @param host the server host
- * @return the key
- */
- protected String getKey(IServerType type, String host) {
- return type.getId() + "|" + host + "|";
- }
-
- /**
- * Returns a server.
- *
- * @param type
- * @param host a hostname or IP
- * @param monitor a progress monitor
- * @return a server working copy
- * @throws CoreException if anything goes wrong
- */
- public IServerWorkingCopy getServer(IServerType type, String host, IProgressMonitor monitor) throws CoreException {
- try {
- IServerWorkingCopy server = getCachedServer(type, host);
- if (server != null)
- return server;
- } catch (Exception e) {
- // ignore
- }
-
- try {
- IFile file = null;
- //if (ServerPreferences.getInstance().isCreateResourcesInWorkspace())
- // file = ServerUtil.getUnusedServerFile(WizardUtil.getServerProject(), type);
-
- IServerWorkingCopy server = type.createServer(null, file, (IRuntime)null, monitor);
- elementCache.put(getKey(type, host), server);
- return server;
- } catch (CoreException ce) {
- throw ce;
- }
- }
-
- /**
- * Returns a cached server resource.
- *
- * @param type the server type
- * @param host a hostname or IP
- * @return a working copy
- */
- public IServerWorkingCopy getCachedServer(IServerType type, String host) {
- try {
- IServerWorkingCopy server = (IServerWorkingCopy) elementCache.get(getKey(type, host));
- if (server != null)
- return server;
- } catch (Exception e) {
- // ignore
- }
-
- return null;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/FixedTableLayout.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/FixedTableLayout.java
deleted file mode 100644
index f07ba231e..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/FixedTableLayout.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-//import java.util.ArrayList;
-//import java.util.List;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-/**
- *
- */
-public class FixedTableLayout extends Layout {
- //private List columns = new ArrayList();
-
- /*public void addColumnData(Integer data) {
- columns.add(data);
- }*/
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Layout#computeSize(org.eclipse.swt.widgets.Composite, int, int, boolean)
- */
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- Table table = (Table) composite;
- Point result = table.computeSize(wHint, hHint, flushCache);
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) {
- Table table = (Table) composite;
- TableColumn[] tableColumns = table.getColumns();
- int width = table.getClientArea().width - 10;
-
- tableColumns[0].setWidth(width);
- }
-}
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/HostnameComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/HostnameComposite.java
deleted file mode 100644
index 408d9bac9..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/HostnameComposite.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-
-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.Point;
-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.Label;
-/**
- * A composite used to select a hostname.
- */
-public class HostnameComposite extends Composite {
- private static final String LOCALHOST = "localhost";
- protected String host;
- protected IHostnameSelectionListener listener;
-
- protected Combo combo;
-
- public interface IHostnameSelectionListener {
- public void hostnameSelected(String host);
- }
-
- /**
- * Create a new HostnameComposite.
- *
- * @param parent a parent composite
- * @param listener2 a hostname selection listener
- */
- public HostnameComposite(Composite parent, IHostnameSelectionListener listener2) {
- super(parent, SWT.NONE);
- this.listener = listener2;
-
- createControl();
- }
-
- /**
- * Creates the UI of the page.
- */
- protected void createControl() {
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 3;
- setLayout(layout);
- //WorkbenchHelp.setHelp(this, ContextIds.SELECT_CLIENT_WIZARD);
-
- Label label = new Label(this, SWT.WRAP);
- label.setText(Messages.hostname);
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- List hosts = ServerUIPlugin.getPreferences().getHostnames();
- String[] s = new String[hosts.size()];
- hosts.toArray(s);
-
- combo = new Combo(this, SWT.DROP_DOWN);
- combo.setItems(s);
- combo.setText(LOCALHOST);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 2;
- combo.setLayoutData(data);
-
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- hostnameChanged(combo.getText());
- }
- });
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- Point p = combo.getSelection();
- hostnameChanged(combo.getText());
- combo.setSelection(p);
- }
- });
-
- Dialog.applyDialogFont(this);
- }
-
- protected void hostnameChanged(String newHost) {
- if (newHost == null)
- return;
-
- if (newHost.equals(host))
- return;
-
- host = newHost;
- listener.hostnameSelected(host);
- }
-
- public String getHostname() {
- return host;
- }
-
- public void setHostname(String hostname) {
- combo.setText(hostname);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
deleted file mode 100644
index 9e2df33df..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/ModifyModulesComposite.java
+++ /dev/null
@@ -1,633 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-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.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.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.internal.*;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-/**
- * A wizard page used to add and remove modules.
- */
-public class ModifyModulesComposite extends Composite {
- protected IWizardHandle wizard;
-
- protected IServerAttributes server;
-
- protected Map childModuleMap = new HashMap();
- protected Map parentModuleMap = new HashMap();
-
- // original modules on the server
- protected List originalModules = new ArrayList();
-
- // modules available to be added to the server
- protected List modules = new ArrayList();
-
- // current modules on the server
- protected List deployed = new ArrayList();
-
- protected TreeViewer availableTreeViewer;
- protected TreeViewer deployedTreeViewer;
-
- protected Button add, addAll;
- protected Button remove, removeAll;
-
- protected TaskModel taskModel;
- protected IModule newModule;
- protected IModule origNewModule;
-
- protected Map errorMap;
-
- abstract class TreeContentProvider implements ITreeContentProvider {
- public void dispose() {
- // do nothing
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public Object[] getChildren(Object parentElement) {
- IModule[] parent = (IModule[]) parentElement;
- IModule[] children = (IModule[]) childModuleMap.get(new ChildModuleMapKey(parent));
-
- List list = new ArrayList();
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- IModule child = children[i];
-
- parentModuleMap.put(child, parent);
-
- int size2 = parent.length;
- IModule[] module2 = new IModule[size2 + 1];
- System.arraycopy(parent, 0, module2, 0, size2);
- module2[size2] = child;
- list.add(module2);
- }
- }
- return list.toArray();
- }
-
- public Object getParent(Object element) {
- IModule[] child = (IModule[]) element;
- return (IModule[]) parentModuleMap.get(child);
- }
-
- public boolean hasChildren(Object element) {
- IModule[] parent = (IModule[]) element;
- IModule[] children = (IModule[]) childModuleMap.get(new ChildModuleMapKey(parent));
- return (children != null && children.length > 0);
- }
- }
-
- class AvailableContentProvider extends TreeContentProvider {
- public Object[] getElements(Object inputElement) {
- List list = new ArrayList();
- Iterator iterator = modules.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- list.add(new IModule[] { module });
- }
- return list.toArray();
- }
- }
-
- class DeployedContentProvider extends TreeContentProvider {
- public Object[] getElements(Object inputElement) {
- List list = new ArrayList();
- Iterator iterator = deployed.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- list.add(new IModule[] { module });
- }
- return list.toArray();
- }
- }
-
- /**
- * The key element for the child module map
- * ChildMapModuleKey
- */
- protected class ChildModuleMapKey {
- private IModule[] moduleTree;
-
- protected ChildModuleMapKey(IModule curModule) {
- if (curModule != null) {
- moduleTree = new IModule[] { curModule };
- }
- }
-
- protected ChildModuleMapKey(IModule[] curModuleTree) {
- moduleTree = curModuleTree;
- }
-
- public boolean equals(Object obj) {
- if (obj == this) // same object
- return true;
-
- if (!(obj instanceof ChildModuleMapKey))
- return false;
-
- IModule[] curCompareModule = ((ChildModuleMapKey) obj).moduleTree;
- if (curCompareModule == moduleTree) {
- // the module tree is the same
- return true;
- } else if (moduleTree == null || curCompareModule == null || moduleTree.length != curCompareModule.length){
- return false;
- } else {
- // compare each module
- for (int i = 0; i < curCompareModule.length; i++) {
- if (!curCompareModule[i].equals(moduleTree[i]))
- return false;
- }
- return true;
- }
- }
-
- public int hashCode() {
- // force the same hash code on all the instances to makes sure the
- // equals(Object) method is being used for comparing the objects
- return 12345;
- }
- }
-
- /**
- * Create a new ModifyModulesComposite.
- *
- * @param parent a parent composite
- * @param wizard a wizard
- * @param module the module that is being added
- */
- public ModifyModulesComposite(Composite parent, IWizardHandle wizard, IModule module) {
- super(parent, SWT.NONE);
- this.wizard = wizard;
- origNewModule = module;
-
- wizard.setTitle(Messages.wizModuleTitle);
- wizard.setDescription(Messages.wizModuleDescription);
- wizard.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_SELECT_SERVER));
-
- createControl();
- }
-
- public void setServer(IServerAttributes server) {
- if (server == this.server)
- return;
-
- this.server = server;
- originalModules = new ArrayList();
- deployed = new ArrayList();
- modules = new ArrayList();
-
- childModuleMap = new HashMap();
-
- if (server == null)
- return;
-
- // get currently deployed modules
- IModule[] currentModules = server.getModules();
- if (currentModules != null) {
- int size = currentModules.length;
- for (int i = 0; i < size; i++) {
- originalModules.add(currentModules[i]);
- deployed.add(currentModules[i]);
- }
- }
-
- // add new module
- newModule = null;
- errorMap = new HashMap();
- if (origNewModule != null) {
- try {
- IModule[] parents = server.getRootModules(origNewModule, null);
- if (parents != null && parents.length > 0)
- newModule = parents[0];
- else
- newModule = origNewModule;
- } catch (CoreException ce) {
- errorMap.put(newModule, ce.getStatus());
- newModule = null;
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not find root module", e);
- newModule = null;
- }
- }
- if (newModule != null && !deployed.contains(newModule))
- deployed.add(newModule);
-
- // get remaining modules
- IModule[] modules2 = ServerUtil.getModules(server.getServerType().getRuntimeType().getModuleTypes());
- if (modules2 != null) {
- int size = modules2.length;
- for (int i = 0; i < size; i++) {
- IModule module = modules2[i];
- if (!deployed.contains(module)) {
- try {
- IModule[] parents = server.getRootModules(module, null);
- if (parents != null) {
- int size2 = parents.length;
- for (int j = 0; j < size2; j++) {
- if (parents[j].equals(module)) {
- IStatus status = server.canModifyModules(new IModule[] { module }, null, null);
- if (status != null && !status.isOK())
- errorMap.put(module, status);
- modules.add(module);
- }
- }
- }
- } catch (CoreException ce) {
- errorMap.put(module, ce.getStatus());
- modules.add(module);
- }
- }
- }
- }
-
- // build child map
- Iterator iterator = deployed.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- try {
- IModule[] children = server.getChildModules(new IModule[] { module }, null);
- if (children != null && children.length > 0)
- childModuleMap.put(new ChildModuleMapKey(module), children);
- } catch (Exception e) {
- // ignore
- }
- }
-
- iterator = modules.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- try {
- IModule[] children = server.getChildModules(new IModule[] { module }, null);
- if (children != null && children.length > 0)
- childModuleMap.put(new ChildModuleMapKey(module), children);
- } catch (Exception e) {
- // ignore
- }
- }
-
- if (availableTreeViewer != null)
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- try { // update trees if we can
- availableTreeViewer.refresh();
- deployedTreeViewer.refresh();
- setEnablement();
- } catch (Exception e) {
- // ignore
- }
- }
- });
- updateTaskModel();
- }
-
- public void setTaskModel(TaskModel model) {
- this.taskModel = model;
- }
-
- /**
- * Creates the UI of the page.
- */
- protected void createControl() {
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- layout.numColumns = 3;
- setLayout(layout);
- setFont(getParent().getFont());
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.MODIFY_MODULES_COMPOSITE);
-
- Label label = new Label(this, SWT.NONE);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
- data.horizontalSpan = 3;
- label.setLayoutData(data);
- label.setText(Messages.wizModuleMessage);
-
- label = new Label(this, SWT.NONE);
- label.setText(Messages.wizModuleAvailableList);
-
- label = new Label(this, SWT.NONE);
- label.setText("");
-
- label = new Label(this, SWT.NONE);
- label.setText(Messages.wizModuleDeployedList);
-
- Tree availableTree = new Tree(this, SWT.BORDER);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 200;
- data.widthHint = 150;
- availableTree.setLayoutData(data);
-
- availableTreeViewer = new TreeViewer(availableTree);
- availableTreeViewer.setLabelProvider(ServerUICore.getLabelProvider());
- availableTreeViewer.setContentProvider(new AvailableContentProvider());
- availableTreeViewer.setSorter(new ViewerSorter());
- availableTreeViewer.setInput("root");
-
- availableTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- setEnablement();
- }
- });
- availableTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- setEnablement();
- if (add.isEnabled())
- add(false);
- }
- });
-
- // slosh buttons
- Composite comp = new Composite(this, SWT.NONE);
- data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 120;
- comp.setLayoutData(data);
-
- layout = new GridLayout();
- layout.marginWidth = 5;
- layout.marginHeight = 25;
- layout.verticalSpacing = 20;
- comp.setLayout(layout);
-
- add = new Button(comp, SWT.PUSH);
- add.setText(Messages.wizModuleAdd);
- add.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- add.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- add(false);
- }
- });
-
- remove = new Button(comp, SWT.PUSH);
- remove.setText(Messages.wizModuleRemove);
- remove.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- remove.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- remove(false);
- }
- });
-
- label = new Label(comp, SWT.NONE);
- label.setText("");
-
- addAll = new Button(comp, SWT.PUSH);
- addAll.setText(Messages.wizModuleAddAll);
- addAll.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- addAll.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- add(true);
- }
- });
-
- removeAll = new Button(comp, SWT.PUSH);
- removeAll.setText(Messages.wizModuleRemoveAll);
- removeAll.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- removeAll.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- remove(true);
- }
- });
-
- Tree deployedTree = new Tree(this, SWT.BORDER);
- data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 150;
- deployedTree.setLayoutData(data);
-
- deployedTreeViewer = new TreeViewer(deployedTree);
- deployedTreeViewer.setLabelProvider(ServerUICore.getLabelProvider());
- deployedTreeViewer.setContentProvider(new DeployedContentProvider());
- deployedTreeViewer.setSorter(new ViewerSorter());
- deployedTreeViewer.setInput("root");
-
- deployedTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- setEnablement();
- }
- });
- deployedTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- setEnablement();
- if (remove.isEnabled())
- remove(false);
- }
- });
-
- setEnablement();
- availableTree.setFocus();
-
- Dialog.applyDialogFont(this);
- }
-
- protected IModule getAvailableSelection() {
- IStructuredSelection sel = (IStructuredSelection) availableTreeViewer.getSelection();
- return getModule((IModule[]) sel.getFirstElement());
- }
-
- protected IModule getDeployedSelection() {
- IStructuredSelection sel = (IStructuredSelection) deployedTreeViewer.getSelection();
- return getModule((IModule[]) sel.getFirstElement());
- }
-
- protected static IModule getModule(IModule[] modules2) {
- if (modules2 == null)
- return null;
- return modules2[modules2.length - 1];
- }
-
- protected void setEnablement() {
- boolean enabled = false;
- wizard.setMessage(null, IMessageProvider.NONE);
-
- IModule module = getAvailableSelection();
- if (module != null) {
- try {
- IStatus status = (IStatus) errorMap.get(module);
- if (modules.contains(module)) {
- if (status == null)
- enabled = true;
- else if (status.getSeverity() == IStatus.ERROR)
- wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
- else if (status.getSeverity() == IStatus.WARNING)
- wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
- else if (status.getSeverity() == IStatus.INFO)
- wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
- }
- } catch (Exception e) {
- // ignore
- }
- }
- add.setEnabled(enabled);
- addAll.setEnabled(modules.size() > 0);
-
- enabled = false;
- module = getDeployedSelection();
- if (module != null) {
- try {
- if (deployed.contains(module) && !module.equals(newModule))
- enabled = true;
- } catch (Exception e) {
- // ignore
- }
- }
- remove.setEnabled(enabled);
- if (newModule == null)
- removeAll.setEnabled(deployed.size() > 0);
- else
- removeAll.setEnabled(deployed.size() > 1);
- }
-
- protected void add(boolean all) {
- if (all) {
- IModule[] modules2 = new IModule[modules.size()];
- modules.toArray(modules2);
- moveAll(modules2, true);
- } else
- moveAll(new IModule[] { getAvailableSelection() }, true);
- updateTaskModel();
- }
-
- protected void remove(boolean all) {
- if (all) {
- IModule[] modules2 = new IModule[deployed.size()];
- deployed.toArray(modules2);
- moveAll(modules2, false);
- } else
- moveAll(new IModule[] { getDeployedSelection() }, false);
- updateTaskModel();
- }
-
- protected void moveAll(IModule[] mods, boolean add2) {
- int size = mods.length;
- List list = new ArrayList();
- for (int i = 0; i < size; i++) {
- IStatus status = (IStatus) errorMap.get(mods[i]);
-
- if (status == null && !list.contains(mods[i]))
- list.add(mods[i]);
- }
-
- Iterator iterator = list.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- if (add2) {
- modules.remove(module);
- deployed.add(module);
- } else if (!module.equals(newModule)) {
- modules.add(module);
- deployed.remove(module);
- }
- }
-
- availableTreeViewer.refresh();
- deployedTreeViewer.refresh();
-
- setEnablement();
- }
-
- protected void updateTaskModel() {
- if (taskModel == null)
- return;
-
- taskModel.putObject(TaskModel.TASK_MODULES, getModuleMap());
- wizard.update();
- }
-
- public List getModulesToRemove() {
- List list = new ArrayList();
- Iterator iterator = originalModules.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- if (!deployed.contains(module))
- list.add(module);
- }
- return list;
- }
-
- public List getModulesToAdd() {
- List list = new ArrayList();
- Iterator iterator = deployed.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- if (!originalModules.contains(module))
- list.add(module);
- }
- return list;
- }
-
- private void addChildMap(List map, IModule[] parents, IModule[] children) {
- if (children == null)
- return;
-
- int size = children.length;
- for (int i = 0; i < size; i++) {
- IModule module = children[i];
-
- int size2 = parents.length;
- IModule[] modules2 = new IModule[size2 + 1];
- System.arraycopy(parents, 0, modules2, 0, size2);
- modules2[size2] = module;
- map.add(modules2);
-
- IModule[] children2 = (IModule[]) childModuleMap.get(new ChildModuleMapKey(module));
- if (children2 != null)
- addChildMap(map, modules2, children2);
- }
- }
-
- public List getModuleMap() {
- final List map = new ArrayList();
-
- Iterator iterator = deployed.iterator();
- while (iterator.hasNext()) {
- IModule module = (IModule) iterator.next();
- IModule[] moduleTree = new IModule[] { module };
- map.add(moduleTree);
- IModule[] children = (IModule[]) childModuleMap.get(new ChildModuleMapKey(module));
- if (children != null)
- addChildMap(map, moduleTree, children);
- }
-
- return map;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewDetectServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewDetectServerComposite.java
deleted file mode 100644
index 8aaca6f3c..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewDetectServerComposite.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerAttributes;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-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.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-/**
- * A wizard page used to detect a server.
- */
-public class NewDetectServerComposite extends Composite {
- protected String host;
-
- protected IServerWorkingCopy server;
- protected IServerSelectionListener listener;
-
- protected List servers = new ArrayList();
-
- protected Button detect;
- protected Table table;
- protected TableViewer tableViewer;
- protected Label hostLabel;
-
- public interface IServerSelectionListener {
- public void serverSelected(IServerAttributes server);
- }
-
- public class ServerContentProvider implements IStructuredContentProvider {
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return servers.toArray();
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
- }
-
- public class ServerLabelProvider implements ITableLabelProvider {
- public void addListener(ILabelProviderListener listener2) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- IServer server2 = (IServer) element;
- if (columnIndex == 0)
- return server2.getName();
- else if (columnIndex == 0)
- return "n/a";
- return null;
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener2) {
- // do nothing
- }
- }
-
- /**
- * Create a new NewDetectServerComposite.
- *
- * @param parent a parent composite
- * @param listener2 a server selection listener
- */
- public NewDetectServerComposite(Composite parent, IServerSelectionListener listener2) {
- super(parent, SWT.NONE);
- this.listener = listener2;
-
- createControl();
- }
-
- protected Label createHeadingLabel(Composite parent, String text, int span) {
- Label label = createLabel(parent, text, span, true, false);
- label.setFont(JFaceResources.getBannerFont());
- return label;
- }
-
- protected Label createLabel(Composite parent, String text, int span, boolean alignTop, boolean indent) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(text);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- if (alignTop)
- data.verticalAlignment = GridData.BEGINNING;
- data.horizontalSpan = span;
- if (indent)
- data.horizontalIndent = 10;
- label.setLayoutData(data);
- return label;
- }
-
- /**
- * Creates the UI of the page.
- */
- protected void createControl() {
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 2;
- setLayout(layout);
- //WorkbenchHelp.setHelp(this, ContextIds.SELECT_CLIENT_WIZARD);
-
- createHeadingLabel(this, "Select the Server", 2);
-
- table = new Table(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- data.heightHint = 60;
- data.widthHint = 50;
- data.horizontalSpan = 2;
- data.horizontalIndent = 10;
- table.setLayoutData(data);
-
- TableLayout tableLayout = new TableLayout();
- table.setHeaderVisible(true);
-
- tableLayout.addColumnData(new ColumnWeightData(50, 100, true));
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setText("Server");
-
- tableLayout.addColumnData(new ColumnWeightData(40, 80, true));
- TableColumn col2 = new TableColumn(table, SWT.NONE);
- col2.setText("Status");
-
- table.setLayout(tableLayout);
-
- tableViewer = new TableViewer(table);
- tableViewer.setContentProvider(new ServerContentProvider());
- tableViewer.setLabelProvider(new ServerLabelProvider());
- tableViewer.setColumnProperties(new String[] {"name", "status"});
- tableViewer.setInput("root");
-
- String date = "<now>";
- hostLabel = createLabel(this, "Last detected servers on " + host + " at " + date + ":", 1, false, true);
-
- detect = SWTUtil.createButton(this, "Refresh");
- detect.setEnabled(false);
- data = (GridData) detect.getLayoutData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END;
-
- // listeners
- detect.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- // do nothing
- }
- });
-
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- Object obj = sel.getFirstElement();
- IServerWorkingCopy newServer = null;
- if (obj instanceof IServerWorkingCopy)
- newServer = (IServerWorkingCopy) obj;
-
- if ((newServer == null && server != null) || (newServer != null && !newServer.equals(server))) {
- server = newServer;
- listener.serverSelected(server);
- }
- }
- });
-
- setHost(null);
-
- Dialog.applyDialogFont(this);
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- servers = new ArrayList();
- tableViewer.refresh();
- if (host != null) {
- hostLabel.setText("Detected servers on " + host + ":");
- detect.setEnabled(true);
- table.setEnabled(true);
- } else {
- hostLabel.setText("No host selected");
- detect.setEnabled(false);
- table.setEnabled(false);
- }
- }
-
- public IServerWorkingCopy getServer() {
- return server;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewInstallableServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewInstallableServerComposite.java
deleted file mode 100644
index e921b2026..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewInstallableServerComposite.java
+++ /dev/null
@@ -1,76 +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.server.ui.internal.wizard.page;
-
-import org.eclipse.jface.dialogs.Dialog;
-
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.core.internal.IInstallableServer;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-import org.eclipse.wst.server.ui.internal.viewers.InstallableServerComposite;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-/**
- * A composite used to select a server to install.
- */
-public class NewInstallableServerComposite extends Composite {
- private TaskModel taskModel;
- private IWizardHandle wizard;
-
- /**
- * Create a new NewInstallableServerComposite.
- *
- * @param parent a parent composite
- * @param taskModel a task model
- * @param wizard the wizard this composite is contained in
- */
- public NewInstallableServerComposite(Composite parent, TaskModel taskModel, IWizardHandle wizard) {
- super(parent, SWT.NONE);
- this.taskModel = taskModel;
- this.wizard = wizard;
-
- createControl();
- }
-
- /**
- * Creates the UI of the page.
- */
- protected void createControl() {
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 3;
- setLayout(layout);
- //WorkbenchHelp.setHelp(this, ContextIds.SELECT_CLIENT_WIZARD);
-
- InstallableServerComposite comp = new InstallableServerComposite(this, SWT.NONE, new InstallableServerComposite.InstallableServerSelectionListener() {
- public void installableServerSelected(IInstallableServer server) {
- handleSelection(server);
- }
- });
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 200;
- comp.setLayoutData(data);
-
- Dialog.applyDialogFont(this);
- }
-
- protected void handleSelection(IInstallableServer server) {
- taskModel.putObject("installableServer", server);
- wizard.update();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
deleted file mode 100644
index d4e405637..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewManualServerComposite.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
-import org.eclipse.wst.server.core.util.SocketUtil;
-import org.eclipse.wst.server.ui.internal.*;
-import org.eclipse.wst.server.ui.internal.viewers.ServerTypeComposite;
-/**
- * Wizard page used to create a server and configuration at the same time.
- */
-public class NewManualServerComposite extends Composite {
- public interface ServerSelectionListener {
- public void serverSelected(IServerAttributes server);
- public void runtimeSelected(IRuntime runtime);
- }
-
- public interface IWizardHandle2 {
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InterruptedException, InvocationTargetException;
- public void update();
- public void setMessage(String newMessage, int newType);
- }
- protected IWizardHandle2 wizard;
-
- protected ServerTypeComposite serverTypeComposite;
-
- protected Label runtimeLabel;
- protected Combo runtimeCombo;
- protected Button runtimeButton;
- protected IRuntime[] runtimes;
- protected IRuntime newRuntime;
-
- protected IRuntime runtime;
- protected IServerWorkingCopy server;
- protected ServerSelectionListener listener;
-
- protected String host;
-
- protected IModuleType moduleType;
-
- protected ElementCreationCache cache = new ElementCreationCache();
-
- /**
- * Creates a new server and server configuration. If the initial
- * resource selection contains exactly one container resource then it will be
- * used as the default container resource.
- *
- * @param parent a parent composite
- * @param wizard a wizard handle
- * @param moduleType a module type
- * @param listener a server selection listener
- */
- public NewManualServerComposite(Composite parent, IWizardHandle2 wizard, IModuleType moduleType, ServerSelectionListener listener) {
- super(parent, SWT.NONE);
- this.wizard = wizard;
- this.listener = listener;
-
- this.moduleType = moduleType;
-
- createControl();
- wizard.setMessage("", IMessageProvider.ERROR); //$NON-NLS-1$
- }
-
- /**
- * Returns this page's initial visual components.
- */
- protected void createControl() {
- // top level group
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- setLayout(layout);
-
- this.setFont(getParent().getFont());
- IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
- whs.setHelp(this, ContextIds.NEW_SERVER_WIZARD);
-
- serverTypeComposite = new ServerTypeComposite(this, SWT.NONE, moduleType, new ServerTypeComposite.ServerTypeSelectionListener() {
- public void serverTypeSelected(IServerType type2) {
- handleTypeSelection(type2);
- //WizardUtil.defaultSelect(parent, CreateServerWizardPage.this);
- }
- });
- serverTypeComposite.setIncludeIncompatibleVersions(true);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- data.horizontalSpan = 3;
- serverTypeComposite.setLayoutData(data);
- whs.setHelp(serverTypeComposite, ContextIds.NEW_SERVER_TYPE);
-
- runtimeLabel = new Label(this, SWT.NONE);
- runtimeLabel.setText(Messages.wizNewServerRuntime);
-
- runtimeCombo = new Combo(this, SWT.READ_ONLY);
- runtimeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- runtimeCombo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- try {
- runtime = runtimes[runtimeCombo.getSelectionIndex()];
- if (server != null) {
- server.setRuntime(runtime);
- listener.runtimeSelected(runtime);
- }
- } catch (Exception ex) {
- // ignore
- }
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- });
-
- runtimeButton = SWTUtil.createButton(this, Messages.installedRuntimes);
- runtimeButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- runtimeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (showPreferencePage()) {
- IServerType serverType = serverTypeComposite.getSelectedServerType();
- updateRuntimes(serverType);
- updateRuntimeCombo(serverType);
- }
- }
- });
- Dialog.applyDialogFont(this);
- }
-
- protected boolean showPreferencePage() {
- String id = "org.eclipse.wst.server.ui.preferencePage";
- String id2 = "org.eclipse.wst.server.ui.runtime.preferencePage";
- final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), id2, new String[] { id, id2 }, null);
- return (dialog.open() == Window.OK);
- }
-
- public void setHost(String host) {
- this.host = host;
- if (serverTypeComposite == null)
- return;
- if (host == null) {
- serverTypeComposite.setHost(true);
- } else if (SocketUtil.isLocalhost(host))
- serverTypeComposite.setHost(true);
- else
- serverTypeComposite.setHost(false);
- handleTypeSelection(serverTypeComposite.getSelectedServerType());
- if (server != null) {
- server.setHost(host);
- ServerUtil.setServerDefaultName(server);
- }
- }
-
- /**
- * Return the current editable element.
- */
- protected void loadServerImpl(final IServerType serverType) {
- server = null;
-
- if (serverType == null)
- return;
-
- server = cache.getCachedServer(serverType, host);
- if (server != null) {
- server.setHost(host);
- ServerUtil.setServerDefaultName(server);
- runtime = server.getRuntime();
- return;
- }
-
- final CoreException[] ce = new CoreException[1];
-
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- try {
- monitor = ProgressUtil.getMonitorFor(monitor);
- int ticks = 200;
- monitor.beginTask(NLS.bind(Messages.loadingTask, serverType.getName()), ticks);
-
- server = cache.getServer(serverType, host, ProgressUtil.getSubMonitorFor(monitor, 200));
- if (server != null) {
- server.setHost(host);
- ServerUtil.setServerDefaultName(server);
-
- if (serverType.hasRuntime() && server.getRuntime() == null) {
- runtime = null;
- updateRuntimes(serverType);
- runtime = getDefaultRuntime();
- server.setRuntime(runtime);
-
- if (server.getServerType().hasServerConfiguration()) {
- ((ServerWorkingCopy)server).importConfiguration(runtime, null);
- }
- }
- }
- } catch (CoreException cex) {
- ce[0] = cex;
- } catch (Throwable t) {
- Trace.trace(Trace.SEVERE, "Error creating element", t); //$NON-NLS-1$
- } finally {
- monitor.done();
- }
- }
- };
- try {
- wizard.run(true, false, runnable);
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Error with runnable", e); //$NON-NLS-1$
- }
-
- if (ce[0] != null)
- wizard.setMessage(ce[0].getLocalizedMessage(), IMessageProvider.ERROR);
- else if (server == null)
- wizard.setMessage(Messages.wizErrorServerCreationError, IMessageProvider.ERROR);
- }
-
- /**
- * Pick the first non-stub runtime first. Otherwise, just pick the first runtime.
- *
- * @return the default runtime
- */
- protected IRuntime getDefaultRuntime() {
- if (runtimes == null || runtimes.length == 0)
- return null;
-
- if (runtimes != null) {
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- if (!runtimes[i].isStub())
- return runtimes[i];
- }
- }
- return runtimes[0];
- }
-
- protected void updateRuntimes(IServerType serverType) {
- if (serverType == null)
- return;
-
- IRuntimeType runtimeType = serverType.getRuntimeType();
- runtimes = ServerUIPlugin.getRuntimes(runtimeType);
- newRuntime = null;
-
- if (server != null && SocketUtil.isLocalhost(server.getHost()) && runtimes != null) {
- List runtimes2 = new ArrayList();
- int size = runtimes.length;
- for (int i = 0; i < size; i++) {
- IRuntime runtime2 = runtimes[i];
- if (!runtime2.isStub())
- runtimes2.add(runtime2);
- }
- runtimes = new IRuntime[runtimes2.size()];
- runtimes2.toArray(runtimes);
- if (runtimes2.size() > 0)
- return;
- }
-
- // create a new runtime
- try {
- IRuntimeWorkingCopy runtimeWC = runtimeType.createRuntime(null, null);
- ServerUtil.setRuntimeDefaultName(runtimeWC);
- runtimes = new IRuntime[1];
- runtimes[0] = runtimeWC;
- newRuntime = runtimeWC;
- } catch (Exception e) {
- Trace.trace(Trace.SEVERE, "Couldn't create runtime", e); //$NON-NLS-1$
- }
- }
-
- protected void updateRuntimeCombo(IServerType serverType) {
- if (serverType == null || !serverType.hasRuntime()) {
- if (runtimeLabel != null) {
- runtimeLabel.setEnabled(false);
- runtimeCombo.setItems(new String[0]);
- runtimeCombo.setEnabled(false);
- runtimeLabel.setVisible(false);
- runtimeCombo.setVisible(false);
- runtimeButton.setEnabled(false);
- runtimeButton.setVisible(false);
- }
- runtimes = new IRuntime[0];
- runtime = null;
- if (server != null)
- server.setRuntime(null);
- return;
- }
-
- updateRuntimes(serverType);
-
- int size = runtimes.length;
- String[] items = new String[size];
- for (int i = 0; i < size; i++) {
- if (runtimes[i].equals(newRuntime))
- items[i] = Messages.wizNewServerRuntimeCreate;
- else
- items[i] = runtimes[i].getName();
- }
-
- if (runtime == null) {
- runtime = getDefaultRuntime();
- server.setRuntime(runtime);
- }
- if (runtimeCombo != null) {
- runtimeCombo.setItems(items);
- if (runtimes.length > 0) {
- int sel = -1;
- for (int i = 0; i < size; i++) {
- if (runtimes[i].equals(runtime))
- sel = i;
- }
- if (sel < 0) {
- sel = 0;
- server.setRuntime(runtimes[0]);
- }
-
- runtimeCombo.select(sel);
- }
-
- IRuntimeType runtimeType = serverType.getRuntimeType();
- boolean showRuntime = ServerUIPlugin.getRuntimes(runtimeType).length >=1;
- runtimeCombo.setEnabled(showRuntime);
- runtimeLabel.setEnabled(showRuntime);
- runtimeButton.setEnabled(showRuntime);
- runtimeLabel.setVisible(showRuntime);
- runtimeCombo.setVisible(showRuntime);
- runtimeButton.setVisible(showRuntime);
- }
- }
-
- /**
- * Handle the server type selection.
- */
- protected void handleTypeSelection(IServerType serverType) {
- boolean wrong = false;
- if (serverType != null && moduleType != null) {
- IRuntimeType runtimeType = serverType.getRuntimeType();
- if (!ServerUtil.isSupportedModule(runtimeType.getModuleTypes(), moduleType)) {
- serverType = null;
- wrong = true;
- //wizard.setMessage("Not the right spec level2", IMessageProvider.ERROR);
- }
- }
-
- if (wrong) {
- server = null;
- runtime = null;
- wizard.setMessage(NLS.bind(Messages.errorVersionLevel, new Object[] { moduleType.getName(), moduleType.getVersion() }), IMessageProvider.ERROR);
- } else if (serverType == null) {
- server = null;
- runtime = null;
- wizard.setMessage("", IMessageProvider.ERROR); //$NON-NLS-1$
- } else {
- wizard.setMessage(null, IMessageProvider.NONE);
- loadServerImpl(serverType);
- }
- updateRuntimeCombo(serverType);
- listener.serverSelected(server);
- wizard.update();
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- if (visible) {
- /*if (defaultServerFactory != null) {
- tree.setSelection(new TreeItem[] { defaultServerFactory });
- tree.showItem(tree.getItems()[0]);
- }*/
- // force the focus to initially validate the fields
- handleTypeSelection(null);
- }
-
- Control[] c = getChildren();
- if (c != null) {
- int size = c.length;
- for (int i = 0; i < size; i++)
- if (c[i] != null && c[i] instanceof ServerTypeComposite)
- c[i].setVisible(visible);
- }
- if (visible)
- handleTypeSelection(serverTypeComposite.getSelectedServerType());
- }
-
- public void refresh() {
- serverTypeComposite.refresh();
- }
-
- public IRuntime getRuntime() {
- return runtime;
- }
-
- public IServerWorkingCopy getServer() {
- return server;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewRuntimeComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewRuntimeComposite.java
deleted file mode 100644
index 06b33c3f9..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewRuntimeComposite.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.wst.server.core.*;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-import org.eclipse.wst.server.ui.internal.viewers.RuntimeTypeComposite;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-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.Tree;
-/**
- *
- */
-public class NewRuntimeComposite extends Composite {
- protected Tree tree;
- protected TreeViewer treeViewer;
-
- protected IRuntimeWorkingCopy runtime;
- protected Map runtimeMap = new HashMap();
-
- protected TaskModel taskModel;
- protected IWizardHandle wizard;
-
- protected String type;
- protected String version;
- protected String runtimeTypeId;
-
- public NewRuntimeComposite(Composite parent, IWizardHandle wizard, TaskModel tm, String type, String version, String runtimeTypeId) {
- super(parent, SWT.NONE);
-
- this.wizard = wizard;
- this.taskModel = tm;
- this.type = type;
- this.version = version;
- this.runtimeTypeId = runtimeTypeId;
-
- createControl();
-
- wizard.setTitle(Messages.wizNewRuntimeTitle);
- wizard.setDescription(Messages.wizNewRuntimeDescription);
- wizard.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_NEW_RUNTIME));
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl() {
- //initializeDialogUnits(parent);
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- setLayout(layout);
-
- final RuntimeTypeComposite comp = new RuntimeTypeComposite(this, SWT.NONE, true, new RuntimeTypeComposite.RuntimeTypeSelectionListener() {
- public void runtimeTypeSelected(IRuntimeType runtimeType) {
- handleSelection(runtimeType);
- }
- }, type, version, runtimeTypeId);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 250;
- comp.setLayoutData(data);
- }
-
- protected void handleSelection(IRuntimeType runtimeType) {
- if (runtimeType == null)
- runtime = null;
- else {
- try {
- runtime = null;
- runtime = (IRuntimeWorkingCopy) runtimeMap.get(runtimeType);
- } catch (Exception e) {
- // ignore
- }
- if (runtime == null) {
- try {
- runtime = runtimeType.createRuntime(null, null);
- ServerUtil.setRuntimeDefaultName(runtime);
- if (runtime != null)
- runtimeMap.put(runtimeType, runtime);
- } catch (Exception e) {
- // ignore
- }
- }
- }
-
- taskModel.putObject(TaskModel.TASK_RUNTIME, runtime);
- wizard.update();
- }
-
- public IRuntimeWorkingCopy getRuntime() {
- return runtime;
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- Control[] c = getChildren();
- if (c != null) {
- int size = c.length;
- for (int i = 0; i < size; i++)
- if (c[i] != null)
- c[i].setVisible(visible);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewServerComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewServerComposite.java
deleted file mode 100644
index 348b95c43..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/NewServerComposite.java
+++ /dev/null
@@ -1,487 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-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.ui.PlatformUI;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IModuleType;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.IServerAttributes;
-import org.eclipse.wst.server.core.IServerType;
-import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.TaskModel;
-import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
-import org.eclipse.wst.server.ui.internal.*;
-import org.eclipse.wst.server.ui.internal.viewers.ServerComposite;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.NewServerWizardFragment;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-/**
- * A wizard page used to select a server.
- */
-public class NewServerComposite extends Composite {
- protected IWizardHandle wizard;
- protected TaskModel taskModel;
- protected IModule module;
- protected String launchMode;
-
- protected static final byte MODE_EXISTING = 0;
- protected static final byte MODE_DETECT = 1;
- protected static final byte MODE_MANUAL= 2;
- protected byte mode;
-
- protected Composite detectComp2;
- protected NewDetectServerComposite detectComp;
- protected HostnameComposite detectHostComp;
- protected Composite manualComp2;
- protected NewManualServerComposite manualComp;
- protected HostnameComposite manualHostComp;
- protected ServerComposite existingComp;
-
- protected Composite stack;
- protected StackLayout stackLayout;
-
- protected String lastHostname;
-
- protected Button pref;
- protected boolean preferred;
-
- protected IServerWorkingCopy existingWC;
-
- /**
- * Create a new NewServerComposite.
- *
- * @param parent a parent composite
- * @param wizard a wizard handle
- * @param module a module
- * @param launchMode a launch mode
- */
- public NewServerComposite(Composite parent, IWizardHandle wizard, IModule module, String launchMode) {
- super(parent, SWT.NONE);
- this.wizard = wizard;
- this.module = module;
- this.launchMode = launchMode;
-
- wizard.setTitle(Messages.wizNewServerTitle);
- wizard.setDescription(Messages.wizNewServerDescription);
- wizard.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_NEW_SERVER));
-
- createControl();
- }
-
- public NewServerComposite(Composite parent, IWizardHandle wizard) {
- this(parent, wizard, null, null);
- }
-
- protected Label createLabel(Composite parent, String text, int span) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(text);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
- data.horizontalSpan = span;
- label.setLayoutData(data);
- return label;
- }
-
- protected Label createLabel(Composite parent, String text) {
- return createLabel(parent, text, 1);
- }
-
- protected Button createRadioButton(Composite parent, String text, int span) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(text);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
- data.horizontalSpan = span;
- data.horizontalIndent = 10;
- button.setLayoutData(data);
- return button;
- }
-
- protected Text createText(Composite parent, String text2, int span) {
- Text text = new Text(parent, SWT.NONE);
- text.setText(text2);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
- data.horizontalSpan = span;
- text.setLayoutData(data);
- return text;
- }
-
- /**
- * Creates the UI of the page.
- */
- protected void createControl() {
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- setLayout(layout);
- //WorkbenchHelp.setHelp(this, ContextIds.SELECT_CLIENT_WIZARD);
-
- if (module != null)
- createLabel(this, Messages.wizNewServerSelect, 1);
-
- Button existing = null;
- if (module != null) {
- final Button predefined = createRadioButton(this, Messages.wizNewServerExisting, 1);
- predefined.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (predefined.getSelection())
- toggleMode(MODE_EXISTING);
- }
- });
- existing = predefined;
- }
-
- /*final Button auto = createRadioButton(this, Messages.wizNewServerDetect"), 1);
- auto.setEnabled(false);
- auto.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (auto.getSelection())
- toggleMode(MODE_DETECT);
- }
- });*/
-
- Button manual = null;
- if (module != null) {
- final Button manualButton = createRadioButton(this, Messages.wizNewServerManual, 1);
- manualButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (manualButton.getSelection())
- toggleMode(MODE_MANUAL);
- }
- });
- manual = manualButton;
- }
-
- stack = new Composite(this, SWT.NONE);
- GridData data = new GridData(GridData.FILL_BOTH);
- stack.setLayoutData(data);
- stackLayout = new StackLayout();
- stackLayout.marginHeight = 0;
- stackLayout.marginWidth = 0;
- stack.setLayout(stackLayout);
-
- if (module != null)
- createExistingComposite(stack);
- createAutoComposite(stack);
- createManualComposite(stack);
-
- if (existingComp != null) {
- if (isExistingServer()) {
- mode = MODE_EXISTING;
- stackLayout.topControl = existingComp;
- existing.setSelection(true);
- } else {
- mode = MODE_MANUAL;
- stackLayout.topControl = manualComp2;
- manualComp.setVisible(true);
- if (manual != null)
- manual.setSelection(true);
- existing.setEnabled(false);
- existingComp.setEnabled(false);
- }
- } else {
- mode = MODE_MANUAL;
- stackLayout.topControl = manualComp2;
- manualComp.setVisible(true);
- if (manual != null)
- manual.setSelection(true);
- }
-
- if (module != null) {
- // preferred server button
- pref = new Button(this, SWT.CHECK | SWT.WRAP);
- pref.setText(Messages.wizSelectServerPreferred);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_END);
- //pref.setSelection(true);
- //preferred = true;
- data.horizontalSpan = 1;
- pref.setLayoutData(data);
- pref.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- preferred = pref.getSelection();
- }
- });
- PlatformUI.getWorkbench().getHelpSystem().setHelp(pref, ContextIds.SELECT_SERVER_PREFERENCE);
- }
-
- Dialog.applyDialogFont(this);
- }
-
- protected void toggleMode(byte newMode) {
- if (!isVisible())
- return;
-
- if (newMode == mode)
- return;
-
- mode = newMode;
- wizard.setMessage(null, IMessageProvider.NONE);
-
- if (mode == MODE_EXISTING) {
- stackLayout.topControl = existingComp;
- existingComp.setSelection(existingComp.getSelectedServer());
- } else if (mode == MODE_DETECT) {
- stackLayout.topControl = detectComp2;
- detectComp.setVisible(true);
- } else {
- stackLayout.topControl = manualComp2;
- manualComp.setVisible(true);
- }
- stack.layout();
- if (taskModel != null) {
- taskModel.putObject(NewServerWizardFragment.MODE, new Byte(mode));
- updateTaskModel();
- }
- }
-
- protected HostnameComposite createHostComposite(Composite comp) {
- HostnameComposite hostComp = new HostnameComposite(comp, new HostnameComposite.IHostnameSelectionListener() {
- public void hostnameSelected(String host) {
- lastHostname = host;
- if (detectComp != null)
- detectComp.setHost(host);
- if (manualComp != null)
- manualComp.setHost(host);
- }
- });
-
- if (lastHostname != null)
- hostComp.setHostname(lastHostname);
-
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- hostComp.setLayoutData(data);
- return hostComp;
- }
-
- protected void createAutoComposite(Composite comp) {
- detectComp2 = new Composite(comp, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- detectComp2.setLayout(layout);
-
- detectHostComp = createHostComposite(detectComp2);
-
- detectComp = new NewDetectServerComposite(detectComp2, new NewDetectServerComposite.IServerSelectionListener() {
- public void serverSelected(IServerAttributes server) {
- // do nothing
- }
- });
-
- if (lastHostname != null)
- detectComp.setHost(lastHostname);
- else
- detectComp.setHost("localhost");
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- data.heightHint = 150;
- detectComp.setLayoutData(data);
- }
-
- protected void createExistingComposite(Composite comp) {
- existingComp = new ServerComposite(comp, SWT.NONE, new ServerComposite.ServerSelectionListener() {
- public void serverSelected(IServer server) {
- wizard.setMessage(null, IMessageProvider.NONE);
-
- // check for compatibility
- if (server != null && module != null) {
- IServerType serverType = server.getServerType();
- IModuleType mt = module.getModuleType();
- if (!ServerUtil.isSupportedModule(serverType.getRuntimeType().getModuleTypes(), mt)) {
- String type = mt.getName();
- wizard.setMessage(NLS.bind(Messages.errorVersionLevel, new Object[] { type, mt.getVersion() }), IMessageProvider.ERROR);
- server = null;
- }
- if (wizard.getMessage() == null) {
- try {
- server.getRootModules(module, null);
- } catch (CoreException ce) {
- IStatus status = ce.getStatus();
- if (status != null) {
- if (status.getSeverity() == IStatus.ERROR)
- wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
- else if (status.getSeverity() == IStatus.WARNING)
- wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
- else if (status.getSeverity() == IStatus.INFO)
- wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
- }
- } catch (Exception e) {
- Trace.trace(Trace.WARNING, "Could not find root module", e);
- }
- }
- }
-
- if (existingWC != null) {
- if (server != null && server.equals(existingWC.getOriginal()))
- return;
- existingWC = null;
- }
- if (server != null)
- existingWC = server.createWorkingCopy();
- updateTaskModel();
- }
- }, module, launchMode);
- existingComp.setIncludeIncompatibleVersions(true);
- GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- data.heightHint = 150;
- existingComp.setLayoutData(data);
- }
-
- protected boolean isExistingServer() {
- if (module == null || launchMode == null)
- return false;
-
- IServer[] servers = ServerCore.getServers();
- if (servers != null) {
- int size = servers.length;
- for (int i = 0; i < size; i++) {
- IModuleType mt = module.getModuleType();
- if (ServerUIPlugin.isCompatibleWithLaunchMode(servers[i], launchMode) &&
- ServerUtil.isSupportedModule(servers[i].getServerType().getRuntimeType().getModuleTypes(), mt))
- return true;
- }
- }
- return false;
- }
-
- protected void createManualComposite(Composite comp) {
- manualComp2 = new Composite(comp, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- manualComp2.setLayout(layout);
- manualComp2.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- manualHostComp = createHostComposite(manualComp2);
- IModuleType mt = null;
- if (module != null)
- mt = module.getModuleType();
-
- manualComp = new NewManualServerComposite(manualComp2, new NewManualServerComposite.IWizardHandle2() {
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InterruptedException, InvocationTargetException {
- wizard.run(fork, cancelable, runnable);
- }
- public void update() {
- wizard.update();
- }
- public void setMessage(String newMessage, int newType) {
- wizard.setMessage(newMessage, newType);
- }
- }, mt, new NewManualServerComposite.ServerSelectionListener() {
- public void serverSelected(IServerAttributes server) {
- updateTaskModel();
- }
- public void runtimeSelected(IRuntime runtime) {
- updateTaskModel();
- }
- });
-
- if (lastHostname != null)
- manualComp.setHost(lastHostname);
- else
- manualComp.setHost("localhost");
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = 3;
- data.heightHint = 300;
- manualComp.setLayoutData(data);
- }
-
- protected void updateTaskModel() {
- if (taskModel != null) {
- IServerWorkingCopy server = getServer();
- if (server != null) {
- taskModel.putObject(TaskModel.TASK_SERVER, server);
- taskModel.putObject(TaskModel.TASK_RUNTIME, server.getRuntime());
- } else {
- taskModel.putObject(TaskModel.TASK_SERVER, null);
- taskModel.putObject(TaskModel.TASK_RUNTIME, null);
- }
- }
- wizard.update();
- }
-
- public void setTaskModel(TaskModel model) {
- taskModel = model;
- taskModel.putObject(NewServerWizardFragment.MODE, new Byte(mode));
- updateTaskModel();
- }
-
- public IServerWorkingCopy getServer() {
- if (mode == MODE_EXISTING)
- return existingWC; //existingComp.getSelectedServer();
- else if (mode == MODE_DETECT)
- return detectComp.getServer();
- else
- return manualComp.getServer();
- }
-
- public IRuntime getRuntime() {
- if (mode == MODE_EXISTING) {
- IServer server = existingComp.getSelectedServer();
- if (server != null)
- return server.getRuntime();
- return null;
- } else if (mode == MODE_DETECT)
- return null;
- else
- return manualComp.getRuntime();
- }
-
- /**
- * Returns true if this server should become the preferred server.
- *
- * @return boolean
- */
- public boolean isPreferredServer() {
- return preferred;
- }
-
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- Control[] c = getChildren();
- if (c != null) {
- int size = c.length;
- for (int i = 0; i < size; i++)
- if (c[i] != null)
- c[i].setVisible(visible);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/SelectClientComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/SelectClientComposite.java
deleted file mode 100644
index 683fbfb65..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/SelectClientComposite.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.wst.server.core.internal.IClient;
-import org.eclipse.wst.server.ui.ServerUICore;
-import org.eclipse.wst.server.ui.internal.*;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.swt.SWT;
-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.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-/**
- * A wizard page used to select a server client.
- */
-public class SelectClientComposite extends Composite {
- protected IWizardHandle wizard;
-
- // the list of elements to select from
- protected IClient[] clients;
-
- // the currently selected element
- protected IClient selectedClient;
-
- // the table containing the elements
- protected Table elementTable;
-
- // the description of the selected client
- protected Label description;
-
- /**
- * Create a new SelectClientComposite.
- *
- * @param parent a parent composite
- * @param wizard a wizard handle
- * @param clients an array of clients
- */
- public SelectClientComposite(Composite parent, IWizardHandle wizard, IClient[] clients) {
- super(parent, SWT.NONE);
- this.wizard = wizard;
- this.clients = clients;
-
- wizard.setTitle(Messages.wizSelectClientTitle);
- wizard.setDescription(Messages.wizSelectClientDescription);
- wizard.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_SELECT_SERVER_CLIENT));
-
- createControl();
- }
-
- /**
- * Clears the selected client.
- */
- public void clearSelectedClient() {
- selectedClient = null;
- }
-
- /**
- * Creates the UI of the page.
- */
- protected void createControl() {
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = SWTUtil.convertHorizontalDLUsToPixels(this, 4);
- layout.verticalSpacing = SWTUtil.convertVerticalDLUsToPixels(this, 4);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- setLayout(layout);
-
- IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
- whs.setHelp(this, ContextIds.SELECT_CLIENT_WIZARD);
-
- Label label = new Label(this, SWT.WRAP);
- label.setText(Messages.wizSelectClientMessage);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
- label.setLayoutData(data);
-
- elementTable = new Table(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
- data.heightHint = 80;
- data.horizontalIndent = 20;
- elementTable.setLayoutData(data);
- elementTable.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- handleSelection();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- handleSelection();
- //TODO: WizardUtil.defaultSelect(getWizard(), SelectClientWizardPage.this);
- }
- });
- whs.setHelp(elementTable, ContextIds.SELECT_CLIENT);
-
- if (clients != null) {
- int size = clients.length;
- for (int i = 0; i < size; i++) {
- TableItem item = new TableItem(elementTable, SWT.NONE);
- item.setText(0, ServerUICore.getLabelProvider().getText(clients[i]));
- item.setImage(0, ServerUICore.getLabelProvider().getImage(clients[i]));
- item.setData(clients[i]);
- }
- }
-
- description = new Label(this, SWT.WRAP);
- description.setText("");
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
- data.heightHint = 70;
- description.setLayoutData(data);
-
- Dialog.applyDialogFont(this);
- }
-
- /**
- * Return the selected client.
- *
- * @return org.eclipse.wst.server.core.IClient
- */
- public IClient getSelectedClient() {
- return selectedClient;
- }
-
- /**
- * Handle the selection of a client.
- */
- protected void handleSelection() {
- int index = elementTable.getSelectionIndex();
- if (index < 0)
- selectedClient = null;
- else
- selectedClient = clients[index];
-
- if (selectedClient != null)
- wizard.setMessage(null, IMessageProvider.NONE);
- else
- wizard.setMessage("", IMessageProvider.ERROR);
-
- String desc = null;
- if (selectedClient != null)
- desc = selectedClient.getDescription();
- if (desc == null)
- desc = "";
- description.setText(desc);
-
- wizard.update();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksComposite.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksComposite.java
deleted file mode 100644
index 1d292ec10..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksComposite.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.wst.server.core.model.PublishOperation;
-import org.eclipse.wst.server.ui.internal.ContextIds;
-import org.eclipse.wst.server.ui.internal.ImageResource;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.SWTUtil;
-import org.eclipse.wst.server.ui.internal.wizard.fragment.TasksWizardFragment;
-import org.eclipse.wst.server.ui.wizard.IWizardHandle;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.PlatformUI;
-/**
- * A wizard page used to select server and module tasks.
- */
-public class TasksComposite extends Composite {
- protected IWizardHandle wizard;
-
- protected Composite comp;
-
- // the list of elements to select from
- protected List tasks;
-
- protected boolean created;
-
- /**
- * Create a new TasksComposite.
- *
- * @param parent a parent composite
- * @param wizard a wizard handle
- */
- public TasksComposite(Composite parent, IWizardHandle wizard) {
- super(parent, SWT.NONE);
- this.wizard = wizard;
-
- wizard.setTitle(Messages.wizTaskTitle);
- wizard.setDescription(Messages.wizTaskDescription);
- wizard.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_WIZBAN_SELECT_SERVER));
-
- //createControl();
- }
-
- public void setTasks(List tasks) {
- this.tasks = tasks;
-
- Control[] children = getChildren();
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- children[i].dispose();
- }
- }
-
- //createControl();
- //layout(true);
- created = false;
- }
-
- /**
- * Creates the UI of the page.
- */
- public void createControl() {
- if (created)
- return;
- TasksLayout layout = new TasksLayout(SWTUtil.convertVerticalDLUsToPixels(this, 4));
- setLayout(layout);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, ContextIds.SELECT_TASK_WIZARD);
-
- int size = 0;
- if (tasks != null)
- size = tasks.size();
-
- for (int i = 0; i < size; i++) {
- Object obj = tasks.get(i);
- final TasksWizardFragment.TaskInfo sti = (TasksWizardFragment.TaskInfo) obj;
- final Button checkbox = new Button(this, SWT.CHECK | SWT.WRAP);
- String label = sti.task2.getLabel();
- if (label != null)
- checkbox.setText(label);
- else
- checkbox.setText(Messages.elementUnknownName);
- checkbox.setFocus();
-
- checkbox.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- sti.setSelected(checkbox.getSelection());
- }
- public void widgetDefaultSelected(SelectionEvent event) {
- sti.setSelected(checkbox.getSelection());
- }
- });
-
- Label description = new Label(this, SWT.WRAP);
- String desc = sti.task2.getDescription();
- if (desc != null)
- description.setText(desc);
- else
- description.setText(Messages.elementUnknownName);
-
- if (sti.kind == PublishOperation.REQUIRED) {
- checkbox.setSelection(true);
- checkbox.setEnabled(false);
- description.setEnabled(false);
- } else
- checkbox.setSelection(sti.getDefaultSelected());
- }
-
- if (size == 0) {
- Label label = new Label(this, SWT.NONE);
- label.setText(Messages.wizTaskNone);
- }
-
- Dialog.applyDialogFont(this);
- layout(true, true);
- created = true;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksLayout.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksLayout.java
deleted file mode 100644
index 17bfbd5be..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/TasksLayout.java
+++ /dev/null
@@ -1,59 +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.server.ui.internal.wizard.page;
-
-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;
-/**
- *
- */
-public class TasksLayout extends Layout {
- private int verticalSpacing;
-
- public TasksLayout(int verticalSpacing) {
- this.verticalSpacing = verticalSpacing;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Layout#computeSize(org.eclipse.swt.widgets.Composite, int, int, boolean)
- */
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
- return new Point(wHint, hHint);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) {
- Control[] children = composite.getChildren();
- Rectangle r = composite.getClientArea();
-
- int y = r.y;
- if (children != null) {
- int size = children.length;
- for (int i = 0; i < size; i++) {
- if (i % 2 == 0) {
- int h = children[i].computeSize(r.width, SWT.DEFAULT).y;
- children[i].setBounds(r.x, y, r.width, h);
- y += h + verticalSpacing;
- } else {
- int h = Math.max(50, children[i].computeSize(r.width - 20, SWT.DEFAULT).y);
- children[i].setBounds(r.x + 20, y, r.width - 20, h);
- y += h + verticalSpacing;
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/WizardUtil.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/WizardUtil.java
deleted file mode 100644
index e3a819f70..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/WizardUtil.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.wst.server.core.internal.ServerPlugin;
-import org.eclipse.wst.server.ui.internal.Messages;
-import org.eclipse.wst.server.ui.internal.ServerUIPlugin;
-import org.eclipse.wst.server.ui.internal.wizard.ClosableWizardDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Shell;
-/**
- * A helper class for wizards.
- */
-public class WizardUtil {
- /**
- * Use static methods.
- */
- private WizardUtil() {
- // do nothing
- }
-
- /**
- * Return a new or existing server project.
- *
- * @return the server project
- */
- public static IProject getServerProject() {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- if (projects != null) {
- int size = projects.length;
- for (int i = 0; i < size; i++) {
- if (ServerPlugin.getProjectProperties(projects[i]).isServerProject())
- return projects[i];
- }
- }
-
- String s = findUnusedServerProjectName();
- return ResourcesPlugin.getWorkspace().getRoot().getProject(s);
- }
-
- /**
- * Finds an unused project name to use as a server project.
- *
- * @return java.lang.String
- */
- protected static String findUnusedServerProjectName() {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- String name = NLS.bind(Messages.defaultServerProjectName, "");
- int count = 1;
- while (root.getProject(name).exists()) {
- name = NLS.bind(Messages.defaultServerProjectName, ++count + "");
- }
- return name;
- }
-
- /**
- * Return the container with the given name, if one exists.
- *
- * @param containerName java.lang.String
- * @return org.eclipse.core.resources.IContainer
- */
- public static IContainer findContainer(String containerName) {
- if (containerName == null || containerName.equals(""))
- return null;
-
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- try {
- IProject project = root.getProject(containerName);
- if (project != null && project.exists())
- return project;
- } catch (Exception e) {
- // ignore
- }
-
- try {
- IFolder folder = root.getFolder(new Path(containerName));
- if (folder != null && folder.exists())
- return folder;
- } catch (Exception e) {
- // ignore
- }
- return null;
- }
-
- /**
- * Tries to find a server project folder in the heirarchy
- * of the given resource. If it finds one, it returns the
- * folder that the resource is or is in.
- *
- * @param resource org.eclipse.core.resources.IResource
- * @return org.eclipse.core.resources.IContainer
- */
- protected static IContainer findServerProjectContainer(IResource resource) {
- IContainer container = null;
- while (resource != null) {
- if (container == null && resource instanceof IContainer)
- container = (IContainer) resource;
-
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- if (ServerUIPlugin.findServer(file) != null)
- return null;
- }
-
- if (resource instanceof IProject) {
- if (resource.getProject().isOpen())
- return container;
- }
- resource = resource.getParent();
- }
- return null;
- }
-
- /**
- * Return the full pathname of a container.
- *
- * @param container org.eclipse.core.resources.Container
- * @return java.lang.String
- */
- public static String getContainerText(IContainer container) {
- String name = container.getName();
- while (container != null && !(container instanceof IProject)) {
- container = container.getParent();
- name = container.getName() + "/" + name;
- }
- return name;
- }
-
- /**
- * Returns the selected container from this selection.
- *
- * @param selection the selection
- * @return the container
- */
- public static IContainer getSelectionContainer(IStructuredSelection selection) {
- if (selection == null || selection.isEmpty())
- return null;
-
- Object obj = selection.getFirstElement();
- if (obj instanceof IResource)
- return findServerProjectContainer((IResource) obj);
-
- return null;
- }
-
- /**
- * Return true if the container is a valid server project
- * folder and is not "within" a server instance or configuration.
- *
- * @param name a container name
- * @return <code>null</code> if the container is fine, and an error message
- * otherwise
- */
- public static String validateContainer(String name) {
- IContainer container = WizardUtil.findContainer(name);
- if (container == null || !container.exists()) {
- IStatus status = ResourcesPlugin.getWorkspace().validateName(name, IResource.PROJECT);
- if (status.isOK())
- return null; // we can create one later
- return status.getMessage();
- }
-
- String error = Messages.wizErrorInvalidFolder;
- try {
- // find project of this container
- IProject project = null;
- if (container instanceof IProject) {
- project = (IProject) container;
- } else {
- // look up hierarchy for project
- IContainer temp = container.getParent();
- while (project == null && temp != null && !(temp instanceof IProject)) {
- temp = temp.getParent();
- }
- if (temp != null && temp instanceof IProject)
- project = (IProject) temp;
- }
-
- // validate the project
- if (project != null && !project.isOpen())
- return Messages.wizErrorClosedProject;
-
- if (project == null || !project.exists() || !project.isOpen())
- return error;
-
- // make sure we're not embedding in another server element
- IResource temp = container;
- while (temp != null && !(temp instanceof IProject)) {
- if (temp instanceof IFile) {
- IFile file = (IFile) temp;
- if (ServerUIPlugin.findServer(file) != null)
- return error;
- }
- temp = temp.getParent();
- }
- } catch (Exception e) {
- return error;
- }
- return null;
- }
-
- /**
- * Returns true if the user said okay to creating a new server
- * project.
- *
- * @param shell a shell
- * @param projectName a project name
- * @return <code>true</code> if the user wants to create a server project
- */
- public static boolean promptForServerProjectCreation(Shell shell, String projectName) {
- String msg = NLS.bind(Messages.createServerProjectDialogMessage, projectName);
- return MessageDialog.openQuestion(shell, Messages.createServerProjectDialogTitle, msg);
- }
-
- /**
- * Handles default selection within a wizard by going to the next
- * page, or finishing the wizard if possible.
- *
- * @param wizard a wizard
- * @param page a wizard page
- */
- public static void defaultSelect(IWizard wizard, IWizardPage page) {
- if (page.canFlipToNextPage() && page.getNextPage() != null)
- wizard.getContainer().showPage(page.getNextPage());
- else if (wizard.canFinish() && wizard.getContainer() instanceof ClosableWizardDialog) {
- ClosableWizardDialog dialog = (ClosableWizardDialog) wizard.getContainer();
- dialog.finishPressed();
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/WorkspaceRunnableAdapter.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/WorkspaceRunnableAdapter.java
deleted file mode 100644
index e80519d33..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/wizard/page/WorkspaceRunnableAdapter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.internal.wizard.page;
-
-import java.lang.reflect.InvocationTargetException;
-
-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.jface.operation.IRunnableWithProgress;
-/**
- * IRunnableWithProgressAdapter to allow it to run an IWorkspaceRunnable.
- */
-public class WorkspaceRunnableAdapter implements IRunnableWithProgress {
- private IWorkspaceRunnable workspaceRunnable;
-
- public WorkspaceRunnableAdapter(IWorkspaceRunnable runnable) {
- workspaceRunnable = runnable;
- }
-
- /*
- * @see IRunnableWithProgress#run(IProgressMonitor)
- */
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- ResourcesPlugin.getWorkspace().run(workspaceRunnable, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/package.html b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/package.html
deleted file mode 100644
index 3babaea24..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/package.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="../../../../../..//apistyles.css" type="text/css">
-<title>WTP API overview</title>
-</head>
-<body>
-<p>The server tools UI.</p>
-<table width="500">
-<tr>
-<td>
-<p>ServerUICore is the main entry-point for the API. From here, clients
-can get the wizard pages for a particular server type, get a label
-provider for all server types, or launch Run on Server directly.</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>ServerUIUtil provides utility methods. Currently, this is limited to
-launching the server runtime wizard and editing an existing server
-runtime.</p>
-</td>
-</tr>
-</table>
-<table width="500">
-<tr>
-<td>
-<p>ServerLaunchConfigurationTab is a generic server tools tab that can
-be used in launch configuration tab groups for a server launch. It shows
-information about the server to the user.</p>
-</td>
-</tr>
-</table>
-</body>
-</html>
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/package.xml b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/package.xml
deleted file mode 100644
index 873e26402..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/package.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
-<head>
- <!-- Escape to the root of your source folder -->
- <meta
- name="root"
- content="../../../../../../" />
- <title>WTP API overview</title>
-</head>
-
-<body>
-
-<abstract>The server tools UI.</abstract>
-
-<p>ServerUICore is the main entry-point for the API. From here, clients
-can get the wizard pages for a particular server type, get a label
-provider for all server types, or launch Run on Server directly.</p>
-
-<p>ServerUIUtil provides utility methods. Currently, this is limited to
-launching the server runtime wizard and editing an existing server
-runtime.</p>
-
-<p>ServerLaunchConfigurationTab is a generic server tools tab that can
-be used in launch configuration tab groups for a server launch. It shows
-information about the server to the user.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/IWizardHandle.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/IWizardHandle.java
deleted file mode 100644
index 85c9752a8..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/IWizardHandle.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-/**
- * A wizard handle.
- *
- * @since 1.0
- */
-public interface IWizardHandle extends IMessageProvider {
- /**
- * Updates the wizard error messages and buttons.
- */
- public void update();
-
- /**
- * Sets the title of this wizard page.
- *
- * @param title the title of the wizard page
- */
- public void setTitle(String title);
-
- /**
- * The page's description.
- *
- * @param desc the page's description
- */
- public void setDescription(String desc);
-
- /**
- * The page's image descriptor.
- *
- * @param image the page's image descriptor
- */
- public void setImageDescriptor(ImageDescriptor image);
-
- /**
- * Set an error or warning message.
- *
- * @param newMessage the new message
- * @param newType the new type, from IStatus
- */
- public void setMessage(String newMessage, int newType);
-
- /**
- * Execute a runnable within the context of the wizard. This will typically
- * disable the wizard while the runnable is running, and provide a progress
- * monitor for the user.
- *
- * @param fork true if a separate thread should be used
- * @param cancelable true if it should be cancelable
- * @param runnable the runnable
- * @throws InterruptedException thrown if it is interrupted
- * @throws InvocationTargetException thrown if there is an error
- */
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InterruptedException, InvocationTargetException;
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/WizardFragment.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/WizardFragment.java
deleted file mode 100644
index d6e4d7bb5..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/WizardFragment.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 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.server.ui.wizard;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.wst.server.core.TaskModel;
-/**
- * A wizard fragment is a node within a wizard that provides a completely
- * extendable wizard flow by supporting a flexible tree structure for the
- * pages. As the user walks pages through the wizard, they are actually
- * traversing the nodes of a tree, and each node can add or remove children
- * at any time.
- *
- * Each node may be non-UI (useful for injecting behaviour into the tree)
- * or contain a single wizard page (@see hasComposite() and
- * createComposite(Composite, IWizardHandle)). The node may also have
- * children (@see getChildFragments(), which should be updated or refreshed
- * whenever the updateChildFragments() method is called by another node to
- * let this node know that it's state may have changed.
- *
- * This implementation uses a createChildFragments() method to allow the
- * fragment to add it's children into the tree. Note that this method may
- * be called multiple times as the tree is updated and it must return the
- * same instance of any children that have previously been returned.
- *
- * @since 1.0
- */
-public abstract class WizardFragment {
- private TaskModel taskModel;
- private boolean isComplete = true;
- private List listImpl;
-
- /**
- * Returns <code>true</code> if this fragment has an associated UI,
- * and <code>false</code> otherwise.
- *
- * @return true if the fragment has a composite
- */
- public boolean hasComposite() {
- return false;
- }
-
- /**
- * Creates the composite associated with this fragment.
- * This method is only called when hasComposite() returns true.
- *
- * @param parent a parent composite
- * @param handle a wizard handle
- * @return the created composite
- */
- public Composite createComposite(Composite parent, IWizardHandle handle) {
- return null;
- }
-
- /**
- * Sets the wizard task model. The task model is shared by all fragments
- * in the wizard and is used to share data.
- *
- * @param taskModel the task model
- */
- public void setTaskModel(TaskModel taskModel) {
- this.taskModel = taskModel;
- }
-
- /**
- * Returns the wizard task model.
- *
- * @return the task model
- */
- public TaskModel getTaskModel() {
- return taskModel;
- }
-
- /**
- * Called when the wizard that this fragment belongs to has traversed
- * into this wizard fragment. It is called to give the fragment the
- * opportunity to initialize any values shown in the composite or
- * update the task model.
- * <p>
- * When finish is pressed, the current fragment is exit()ed, and then
- * performFinish() is called on all of the fragments in the tree.
- * enter() and exit() are not called on the remaining fragments.
- * </p>
- */
- public void enter() {
- // do nothing
- }
-
- /**
- * Called when the wizard that this fragment belongs to has traversed
- * out of this wizard fragment. It is called to give the fragment the
- * opportunity to save any values entered into the composite or
- * update the task model.
- * <p>
- * When finish is pressed, the current fragment is exit()ed, and then
- * performFinish() is called on all of the fragments in the tree.
- * enter() and exit() are not called on the remaining fragments.
- * </p>
- */
- public void exit() {
- // do nothing
- }
-
- /**
- * Called when the wizard that this fragment belongs to is finished.
- * After exit()ing the current page, all fragment's performFinish()
- * methods are called in order.
- * <p>
- * This method is not called on the UI thread and must not access the
- * composite. Not only might the user never have accessed the fragment's
- * composite, but this method may be called asynchronously on a job
- * once the wizard has closed.
- * </p>
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if something goes wrong
- */
- public void performFinish(IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * Called when the wizard that this fragment belongs to is canceled.
- * After exit()ing the current page, all fragment's performCancel()
- * methods are called in order.
- * <p>
- * This method is not called on the UI thread and must not access the
- * composite. Not only might the user never have accessed the fragment's
- * composite, but this method may be called asynchronously on a job
- * once the wizard has closed.
- * </p>
- *
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting and cancellation are not desired
- * @throws CoreException if something goes wrong
- */
- public void performCancel(IProgressMonitor monitor) throws CoreException {
- // do nothing
- }
-
- /**
- * Returns the child fragments. Child fragments come directly after this fragment
- * in the wizard flow.
- *
- * @return a list of child fragments
- */
- public List getChildFragments() {
- if (listImpl == null) {
- listImpl = new ArrayList();
- createChildFragments(listImpl);
- }
- return listImpl;
- }
-
- /**
- * Called to give the fragment a chance to update it's child fragments in
- * response to other changes within the wizard or task model.
- */
- public void updateChildFragments() {
- listImpl = null;
- }
-
- /**
- * This method is called by the implementation of getChildFragments() to
- * allow this fragment to add it's children. This method must cache and
- * return the same instance of any child fragment created. If new
- * instances are created each time the wizard is updated, the enablement
- * state and the flow of the wizard will be incorrect.
- *
- * @param list a list to add the child fragments to
- */
- protected void createChildFragments(List list) {
- // do nothing
- }
-
- /**
- * Returns true if this fragment is complete (can finish). If it is
- * complete the user will be allowed to go to the next fragment or
- * finish the wizard. If the fragment is not complete, the Next button
- * will be disabled. If the fragment is complete but another fragment
- * is not complete, the Finish button will not be enabled.
- *
- * @return <code>true</code> if the fragment is complete, and
- * <code>false</code> otherwise
- */
- public boolean isComplete() {
- return isComplete;
- }
-
- /**
- * Set the isComplete state.
- *
- * @param complete <code>true</code> if the fragment is complete, and
- * <code>false</code> otherwise
- */
- protected void setComplete(boolean complete) {
- this.isComplete = complete;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/package.html b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/package.html
deleted file mode 100644
index 29657b709..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/package.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<html>
-<head>
-<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<link rel="stylesheet" href="../../../../../..//apistyles.css" type="text/css">
-<title>WTP API overview</title>
-</head>
-<body>
-<p>Wizard and task support for the server tools UI.</p>
-<table width="500">
-<tr>
-<td>
-<p>WizardFragment is extended to provide a subtree of wizard pages or tasks
-that can be inserted into a larger wizard flow. TaskWizard is the standard
-wizard that knows how to handle WizardFragments and display them in order
-within a single wizard. It uses the TaskWizardPages to display the wizard
-fragment's composites within the wizard.</p>
-</td>
-</tr>
-</table>
-</body>
-</html>
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/package.xml b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/package.xml
deleted file mode 100644
index 9043333d5..000000000
--- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/wizard/package.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html>
-<head>
- <!-- Escape to the root of your source folder -->
- <meta
- name="root"
- content="../../../../../../" />
- <title>WTP API overview</title>
-</head>
-
-<body>
-
-<abstract>Wizard and task support for the server tools UI.</abstract>
-
-<p>WizardFragment is extended to provide a subtree of wizard pages or tasks
-that can be inserted into a larger wizard flow. TaskWizard is the standard
-wizard that knows how to handle WizardFragments and display them in order
-within a single wizard. It uses the TaskWizardPages to display the wizard
-fragment's composites within the wizard.</p>
-
-</body>
-</html> \ No newline at end of file

Back to the top